Page 2 of 3

Re: recursive call causing stack overflow.

Posted: Fri Nov 09, 2018 6:39 pm
by franco
Is DBCREATETEMP created in memory and have to be released then dropped.

Re: recursive call causing stack overflow.

Posted: Fri Nov 09, 2018 8:44 pm
by andyglezl
[Harbour] DBCREATETEMP() patch
Viktor Szakáts Sun, 15 Feb 2009 16:23:06 -0800

Hi all,
Pls find enclosed patch which implements:
dbCreateTemp( <cAlias>, <aStruct>, <cRDD>, <cDelimArg>, <cCodePage>,
<nConnection> ) -> <lSuccess>

This creates and opens a new temporary table. The file automatically
gets deleted on close
, all indexes created are also handled as temporary.

Please review and comment.

Brgds,
Viktor



Yo con esto, creo el archivo en memoria:
+-----------------------------------------------------
With this, I create the file in memory:

DBCREATE("mem:DBTemp", aDBStruct,, .T., "memarea")

y lo libero con:
+-------------------------
and I release it with:

DBCloseArea()
DBDROP("mem:DBTemp")

Re: recursive call causing stack overflow.

Posted: Fri Nov 09, 2018 9:29 pm
by franco
What is this DBCREATE("mem:DBTemp", aDBStruct, what here , .T., "memarea")
I think me "memarea" is alias.What is empty comma and .T. used for.
Would be nice to know if I change my whole programs temp tables.

Re: recursive call causing stack overflow.

Posted: Fri Nov 09, 2018 10:52 pm
by andyglezl
dbCreate()
Creates an empty database from a array.

Syntax:
dbCreate( <cFile>, <aStruct>, [<cRDD>], [<lKeepOpen>], [<cAlias>],
[<cDelimArg>], [<cCodePage>], [<nConnection>] )
Arguments
cFile Name of database file to be create
aStruct Name of a multidimensional array that contains the
database structure
cRDD Name of the RDD
lKeepOpen 3-way toggle to Open the file in New or Current work area:
NIL The file is not opened.
True It is opened in a New area.
False It is opened in the current area.
cAlias Name of database Alias


DBCREATE( "mem:DBTemp" , aDBStruct,, .T., "memarea")
Crea un archivo en MEMORIA llamado "DBTemp", "NEW" con el ALIAS "memarea"
Create a file in MEMORY called "DBTemp", "NEW" with the ALIAS "memarea"

DBCREATE( <cFile>, <aStruct>, [<cRDD>], [<lKeepOpen>], [<cAlias>], [<cDelimArg>], [<cCodePage>], [<nConnection>] )
Crea un archivo en DISCO
Create a file in DISCO

DBCREATETEMP( <cAlias>, <aStruct>, <cRDD>, <cDelimArg>, <cCodePage>, <nConnection> ) -> <lSuccess>
Crea un archivo "Temporal" en DISCO
Create a "Temporary" file in DISCO
---------------------------------------------------------------------------------------------------------------------------------------
Would be nice to know if I change my whole programs temp tables.
??? Y si se va la energia eléctrica
??? And if the power goes away

Re: recursive call causing stack overflow.

Posted: Fri Nov 09, 2018 11:20 pm
by andyglezl
En este post está el uso que yo le di con DEFINE REPORT...
+--------------------------------------------------------
In this post is the use that I gave him whit DEFINE REPORT...


http://www.hmgforum.com/viewtopic.php?f ... rop#p54951


HMG\3.4.4\SAMPLES\Advanced\MEMORY_TABLES

Re: recursive call causing stack overflow.

Posted: Sat Nov 10, 2018 12:54 am
by franco
Andy, thanks for your help and ideas. I viewed the above post, very interesting. Is there a way to add another field to the temp table after
creating it from a current table, before appending records. Would be very useful for setting a relation to a different current table and filling
the new field with new current table field information.
Franco

Re: recursive call causing stack overflow.

Posted: Sun Nov 11, 2018 8:47 pm
by franco
What is DISCO. I can start a program and leave running but can not find the temp file in C:. How do I get rid of temp file created with dbcreatetemp. Where in my computer is it I only have a c: drive. Win10

New thought on indexes and I found this works
......... DBCREATE( "mem:DBTemp" , aDBStruct,, .T., "memarea")
index on anyfield to Mem:DBTemp.ntx
Code
Close all
DBDROP("DBTemp")
This releases all from memory.

Thanks Franco

Re: recursive call causing stack overflow.

Posted: Mon Nov 12, 2018 4:24 pm
by andyglezl
What is DISCO.
Disco Duro
+----------------
HDD

Re: recursive call causing stack overflow.

Posted: Mon Nov 12, 2018 8:14 pm
by andyglezl
I can start a program and leave running but can not find the temp file in C:. How do I get rid of temp file created with dbcreatetemp.
:( Cual es la intención de esto ?
Asumo que al ser un archivo "temporal", dependera de cada version de Windows donde lo creará y que nombre le dará.
La unica referencia que se tiene, es el nombre del "Alias" que tu le pongas.
Si deseas saber que información tiene, hazlo como en el ejemplo que te envié, antes de cerrarlo.
*--------------------------------------------------------------------------------------------------------------------------------------------------------
:( What is the intention of this?
I assume that being a "temporary" file, it will depend on each version of Windows where it will be created and what name it will give you.
The only reference you have is the name of the "Alias" that you put on it.
If you want to know what information you have, do it as in the example I sent you, before closing it.



Code: Select all

Procedure CloseTables
*--------------------------------------------------------*
		//----------------------------------------------------------------		
		// PARA VER QUE PASA, YA QUE EL ARCHIVO ES TEMPORAL. 
		// TO SEE WHAT HAPPENS, SINCE THE ARCHIVE IS TEMPORARY.
		x:= ""
		GO TOP
		DO WHILE ! EOF()
			x := x + INV_NO + ' - ' + ITEM_NO + ' - ' + STR( GROUP ) + ' - ' + STR( COST ) + HB_OsNewLine()
			DBSKIP()
		ENDDO
		MSGBOX( x, "Lo Grabado/I saved it" )
		//----------------------------------------------------------------
		//----------------------------------------------------------------
		close PINV_IT
........

Re: recursive call causing stack overflow.

Posted: Tue Nov 13, 2018 7:57 am
by franco
Andy, Now I use hb_dbcreatetemp('temp',array)
code
close temp
release temp
But could not find it on computer. I wanted to make sure it was getting rid of it. I have done some extensive testing and find it is closing and releasing.
It is creating it in memory.
I like your way of creating a temporary mem table it is much faster. I created a 1,000,000 record table both ways. 5 seconds your way, 20 second
hb_dbcreate way.
I use this strictly for reports.
Franco