Temp table for ADS

Post Reply
User avatar
TimStone
Posts: 2536
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Contact:

Temp table for ADS

Post 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 ?
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
Marcelo Via Giglio
Posts: 1033
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Re: Temp table for ADS

Post 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
User avatar
TimStone
Posts: 2536
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Contact:

Re: Temp table for ADS

Post 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.
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
dtussman
Posts: 78
Joined: Sat Jun 06, 2015 6:57 pm

Re: Temp table for ADS

Post by dtussman »

if the file already exists can't you just zap the file before running the report instead of creating a new one?
Marcelo Via Giglio
Posts: 1033
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Re: Temp table for ADS

Post by Marcelo Via Giglio »

Tim,

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

saludos

Marcelo Vía
User avatar
Giovany Vecchi
Posts: 129
Joined: Mon Jun 05, 2006 9:39 pm
Location: Brasil

Re: Temp table for ADS

Post 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
User avatar
TimStone
Posts: 2536
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Contact:

Re: Temp table for ADS

Post by TimStone »

Thank you. I will study this material.
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
User avatar
reinaldocrespo
Posts: 918
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: Temp table for ADS

Post 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.
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: Temp table for ADS

Post 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
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
TimStone
Posts: 2536
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Contact:

Re: Temp table for ADS

Post 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.
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
User avatar
TimStone
Posts: 2536
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Contact:

Re: Temp table for ADS

Post by TimStone »

James,

Did you try using that Temp ( memory ) dbf with tData ?
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
Post Reply