Page 1 of 1

How to use Temporary Table

Posted: Sat May 30, 2009 10:40 am
by sudip
Hi All,

Is there any way to create a temporary table?

TIA.

Regards.

Sudip

Re: How to use Temporary Table

Posted: Sat May 30, 2009 5:33 pm
by Rathinagiri
What do you mean by that Sudip?

A dbf file?

Re: How to use Temporary Table

Posted: Sat May 30, 2009 7:37 pm
by sudip
Yes, Rathi.

I want to mean if there is any way to store data to a temporary dbf file, it will be very helpful.

Actually, I used this in another software tool (not related to Harbour/xHarbour). There it is called "cursor".

This software tool has some other problems. But, I like the concept of "cursor". With Harbour I have to use array (IMHO).

I heard something like Array RDD (if I am not wrong), but I haven't used it. ;)

BTW, can it be created with MySql? (that will be very helpful also)

Regards.

Sudip

Re: How to use Temporary Table

Posted: Sat May 30, 2009 8:31 pm
by Rathinagiri
In MySQL you can very well use temporary tables (connection wise). That would be created at the time of executing 'create' command, and would be cleared at the time of closure of the connection. I had used that in my system, particularly in user control and management.

Syntax is like this.

CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name
(create_definition,...)
[table_option ...]
[partition_options]

Or:

CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name
[(create_definition,...)]
[table_option ...]
[PARTITION BY partition_options]
select_statement

Or:

CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name
{ LIKE old_tbl_name | (LIKE old_tbl_name) }

Re: How to use Temporary Table

Posted: Sun May 31, 2009 4:37 am
by sudip
Hello Rathi,
rathinagiri wrote:In MySQL you can very well use temporary tables (connection wise). That would be created at the time of executing 'create' command, and would be cleared at the time of closure of the connection. I had used that in my system, particularly in user control and management.
Thanks a lot! I want this! I am very lucky to have a friend-cum-teacher like you :)
Regards.
Sudip

Re: How to use Temporary Table

Posted: Sun May 31, 2009 1:15 pm
by gfilatov
sudip wrote:Yes, Rathi.

I want to mean if there is any way to store data to a temporary dbf file, it will be very helpful.
Hi Sudip,

Take a look for the Harbour changelog:
...
+ added .prg function to create temporary files:
hb_dbCreateTemp( <cAlias>, <aStruct>, <cRDD>, ;
<cCodePage>, <nConnection> ) -> <lSuccess>
Not all RDDs have to support it. It's verified by support for
DBI_ISTEMPORARY dbInfo() action.
...
I hope that give you an idea :idea:

Re: How to use Temporary Table

Posted: Sun May 31, 2009 5:55 pm
by sudip
gfilatov wrote: Take a look for the Harbour changelog:
...
+ added .prg function to create temporary files:
hb_dbCreateTemp( <cAlias>, <aStruct>, <cRDD>, ;
<cCodePage>, <nConnection> ) -> <lSuccess>
Not all RDDs have to support it. It's verified by support for
DBI_ISTEMPORARY dbInfo() action.
...
I hope that give you an idea :idea:
Yes, thank you Guru!!! :-)
I got following information from \MiniGui\Harbour\Doc\WhatsNew.txt

HB_DBCREATETEMP()/DBCREATETEMP() to create temporary tables.

Is there any example for this?

Can I use it with HMG? (As you know, I want to work with both versions :-) )

Thank you very much again.

With best regards.

Sudip