FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Temp table for ADS
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Temp table for ADS
Posted: Tue Dec 04, 2018 08: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
Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
Re: Temp table for ADS
Posted: Wed Dec 05, 2018 02: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

Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Re: Temp table for ADS
Posted: Wed Dec 05, 2018 09: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
Posts: 102
Joined: Sat Jun 06, 2015 06:57 PM
Re: Temp table for ADS
Posted: Thu Dec 06, 2018 01:43 AM

if the file already exists can't you just zap the file before running the report instead of creating a new one?

Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
Re: Temp table for ADS
Posted: Thu Dec 06, 2018 01:49 PM

Tim,

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

saludos

Marcelo Vía

Posts: 244
Joined: Mon Jun 05, 2006 09:39 PM
Re: Temp table for ADS
Posted: Thu Dec 06, 2018 06: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
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Re: Temp table for ADS
Posted: Thu Dec 06, 2018 07: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
Posts: 990
Joined: Thu Nov 17, 2005 05:49 PM
Re: Temp table for ADS
Posted: 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.

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Temp table for ADS
Posted: Fri Dec 14, 2018 03: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
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Re: Temp table for ADS
Posted: Sat Dec 15, 2018 01: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
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Re: Temp table for ADS
Posted: Sat Dec 15, 2018 01: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

Continue the discussion