Temp table for ADS

Temp table for ADS

Postby TimStone » Tue Dec 04, 2018 8:27 pm

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
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2943
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Temp table for ADS

Postby Marcelo Via Giglio » Wed Dec 05, 2018 2:26 am

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
Marcelo Via Giglio
 
Posts: 1064
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Re: Temp table for ADS

Postby TimStone » Wed Dec 05, 2018 9:04 pm

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
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2943
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Temp table for ADS

Postby dtussman » Thu Dec 06, 2018 1:43 am

if the file already exists can't you just zap the file before running the report instead of creating a new one?
dtussman
 
Posts: 97
Joined: Sat Jun 06, 2015 6:57 pm

Re: Temp table for ADS

Postby Marcelo Via Giglio » Thu Dec 06, 2018 1:49 pm

Tim,

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

saludos

Marcelo Vía
Marcelo Via Giglio
 
Posts: 1064
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Re: Temp table for ADS

Postby Giovany Vecchi » Thu Dec 06, 2018 6:55 pm

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/tAdsGit/blob/master/Source/tAdsManager.prg
User avatar
Giovany Vecchi
 
Posts: 222
Joined: Mon Jun 05, 2006 9:39 pm
Location: Brasil

Re: Temp table for ADS

Postby TimStone » Thu Dec 06, 2018 7:49 pm

Thank you. I will study this material.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2943
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Temp table for ADS

Postby reinaldocrespo » Thu Dec 13, 2018 11:05 pm

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
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: Temp table for ADS

Postby James Bott » Fri Dec 14, 2018 3:58 pm

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/viewtopic.php?f=3&t=31054&hilit=dbf+temporary

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Temp table for ADS

Postby TimStone » Sat Dec 15, 2018 1:33 am

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
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2943
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Temp table for ADS

Postby TimStone » Sat Dec 15, 2018 1:38 am

James,

Did you try using that Temp ( memory ) dbf with tData ?
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2943
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], Rick Lipkin and 48 guests