Page 1 of 1

Temp table for ADS

Posted: Tue Dec 04, 2018 8:27 pm
by TimStone
I am experimenting with using ADT files and a data dictionary.

For some processes, I create a temporary file. When I do so, using DBCreate( ), it adds the file to the Data Dictionary. Then if I exit that module, and enter again, it fails to create a new, empty table because the other one has been added to the data dictionary.

I don't want the temporary files in the data dictionary but ADS is doing this automatically. I've tried to delete the file within the program ( FileDelete() ), but that still leaves it in the DD.

Any suggestions ?

Re: Temp table for ADS

Posted: Wed Dec 05, 2018 2:26 am
by Marcelo Via Giglio
Tim,

I use temporary tables with ADS, but for all the operation with them I use SQL

CREATE TABLE #temp ..............

DROP TABLE #temp

I hope this can help you

Regards

Marcelo Vía

Re: Temp table for ADS

Posted: Wed Dec 05, 2018 9:04 pm
by TimStone
The temp tables are used for reports and they are all pre-written with DBF formats, so I would prefer not to rewrite the code in SQL. Also, the system is being set to run with either DBF or ADT files, so the code set must be the same.

Re: Temp table for ADS

Posted: Thu Dec 06, 2018 1:43 am
by dtussman
if the file already exists can't you just zap the file before running the report instead of creating a new one?

Re: Temp table for ADS

Posted: Thu Dec 06, 2018 1:49 pm
by Marcelo Via Giglio
Tim,

you can use transparently SQL with DBF, ADS or mix them in a same ADD

saludos

Marcelo Vía

Re: Temp table for ADS

Posted: Thu Dec 06, 2018 6:55 pm
by Giovany Vecchi
To delete a table in the data dictionary you must call ADSCACHEOPENTABLES (0) to release the loaded tables.

ADSCACHEOPENTABLES (0)
AdsDDRemoveTable("TableInDictionari",l_ExcludeFisical)

Or

DROP TABLE MyTable FROM DATABASE ;

Check some routines in:
https://github.com/giovanyvecchi/tAdsGi ... anager.prg

Re: Temp table for ADS

Posted: Thu Dec 06, 2018 7:49 pm
by TimStone
Thank you. I will study this material.

Re: Temp table for ADS

Posted: Thu Dec 13, 2018 11:05 pm
by reinaldocrespo
Hello Tim;

The problem is you are not creating a temp table. It is only called temp. Temporary tables exist only to the DD connection and are lost upon disconnection or when you drop the table.

If you want continue using your ISAM code, which is probably 100 times slower than an actual #temp table, then think that you need to delete the table from the DD before creating a new one.

Tables on DD are not temp tables and are available to any other app connected to the same DD.

When learning to use SQL, I find it helps a lot to read devzone forum.

Hope that helps,


Reinaldo.

Re: Temp table for ADS

Posted: Fri Dec 14, 2018 3:58 pm
by James Bott
Tim,

Did you know there is a temp DBF that exists only in memory? If your tables aren't too large maybe you can use them. They work just like a real DBF.

See this forum thread for more info:

http://forums.fivetechsupport.com/viewt ... +temporary

James

Re: Temp table for ADS

Posted: Sat Dec 15, 2018 1:33 am
by TimStone
Reinaldo,

In my app, I extract data and put it in a dbf ( not called Temp, but rather it has an actual name ), use it ( perhaps for several different reports ) and then delete it.

I never try to add it to the DD. I actually do not want it in there. Unfortunately, by using the CREATE function, it automatically puts it in the DD. When I issue a DELETE for the db, it does not remove it from the DD. Then I cannot issue another CREATE for that same table name.

Using straight DBFCDX. RDD, I have no problem with these steps. It only occurs when using a DD.

Tim

P.S. Speed is NOT an issue.

Re: Temp table for ADS

Posted: Sat Dec 15, 2018 1:38 am
by TimStone
James,

Did you try using that Temp ( memory ) dbf with tData ?