DBF TEMPORARY

AntoninoP
Posts: 347
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy
Contact:

Re: DBF TEMPORARY

Post by AntoninoP »

nageswaragunupudi wrote:HB_DBCreateTemp( cAlias, aStruct, cRDD ) --> lSuccess
... use cAlias like any other alias
CLOSE cAlias at the end
Hi,
I am trying to substitute temporary database file with this, how can I associate an area to it?
Regards,
Antonino
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: DBF TEMPORARY

Post by nageswaragunupudi »

The first parameter itself is an Alias ( not a file name ) and this Alias is the workarea.

Example:
cAlias := cGetNewAlias()
if HB_DbCreateTemp( cAlias, aStruct, cRDD )
// do work with cAlias
// ? SELECT( cArea ) is the number of the work area.
CLOSE cAlias
endif
Regards

G. N. Rao.
Hyderabad, India
User avatar
fp
Posts: 76
Joined: Fri Dec 30, 2005 10:25 am
Location: Germany

Re: DBF TEMPORARY

Post by fp »

Hb_DbCreateTemp is a really good feature. I did not know this before. Is there also the possibility to create an index file and open?
Frank-Peter
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: DBF TEMPORARY

Post by nageswaragunupudi »

You can do all operations like a normal DBF.
This is exclusive open.
If the PC has more RAM it is lightning fast.
Regards

G. N. Rao.
Hyderabad, India
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: DBF TEMPORARY

Post by James Bott »

Since there seems to be a lot of interest in temporary DBFs, I am curious how others are using them?

I don't remember using one in a very long time, so maybe I am missing out on something.

Regards,
James
User avatar
Biel EA6DD
Posts: 680
Joined: Tue Feb 14, 2006 9:48 am
Location: Mallorca
Contact:

Re: DBF TEMPORARY

Post by Biel EA6DD »

nageswaragunupudi wrote:The first parameter itself is an Alias ( not a file name ) and this Alias is the workarea.

Example:
cAlias := cGetNewAlias()
if HB_DbCreateTemp( cAlias, aStruct, cRDD )
// do work with cAlias
// ? SELECT( cArea ) is the number of the work area.
CLOSE cAlias
endif
The Temporary File is created on the hard disk? or in memory?
Saludos desde Mallorca
Biel Maimó
http://bielsys.blogspot.com/
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: DBF TEMPORARY

Post by James Bott »

Biel,
The Temporary File is created on the hard disk? or in memory?
In memory.

James
User avatar
Biel EA6DD
Posts: 680
Joined: Tue Feb 14, 2006 9:48 am
Location: Mallorca
Contact:

Re: DBF TEMPORARY

Post by Biel EA6DD »

James Bott wrote:Biel,
The Temporary File is created on the hard disk? or in memory?
In memory.

James
Thanks James, what is confusing me is the 3st parameter cRDD.

I never used but like mentioned Carles there are Memory RDD like ArrayRDD and HB_MEMIO, if not misunderstand hb_DbCreateTemp will use one of those RDD.
Last edited by Biel EA6DD on Fri Jul 17, 2015 6:32 am, edited 1 time in total.
Saludos desde Mallorca
Biel Maimó
http://bielsys.blogspot.com/
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: DBF TEMPORARY

Post by James Bott »

Biel,
I never used but like mentioned Cales there are Memory RDD like ArrayRDD and HB_MEMIO, if not misunderstand hb_DbCreateTemp will use one of those RDD.
Agreed, it is not clear. Also, does this work only with Harbour or also with xHarbour?

It would be helpful if someone would post a small working example. Anyone?

James
User avatar
Euclides
Posts: 144
Joined: Wed Mar 28, 2007 1:19 pm

Re: DBF TEMPORARY

Post by Euclides »

Hi, this is a very small example:

Code: Select all

#include "fivewin.ch"

Function Main()
local cArq:="TST"
local aStruct:={{ "VEND", "C", 14, 0 },;
                { "NOMV", "C", 40, 0 },;
                { "FILX", "C", 02, 0 } }

   use CUSTOMER     //  Just to see how DBCreateTemp selects areas

   HB_DBCreateTemp(cArq, aStruct)
*
   for nY=1 to 99
       dbappend()
       TST->FILX := str(100-nY,2)
       TST->NOMV := replicate(TST->FILX,10)
       TST->VEND := str(nY,4)
   next
   index on FILX+NOMV+VEND to (cArq)
   browse( "Select:"+str(select(),3) )  //  Show "Select: 2"
   CLOSE
return nil
 
Regards, Euclides
Marc Vanzegbroeck
Posts: 1102
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Re: DBF TEMPORARY

Post by Marc Vanzegbroeck »

Hi,

It seems that HB_DBCreateTemp() doesn't exist in xharbour..
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: DBF TEMPORARY

Post by James Bott »

Euclides,

Thanks much for the example. I have it working. Do you know what RDD the function defaults to?

Marc,

I am running it successfully with xHarbour (ver 1.2.3). I believe this is the latest version and it is from 2013. Is yours older?

James
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: DBF TEMPORARY

Post by nageswaragunupudi »

Defaults to the default RDD of the application.
But I always used "DBFCDX" as the 3rd parameter.
Works with Harbour and xHarbour.
Regards

G. N. Rao.
Hyderabad, India
Marc Vanzegbroeck
Posts: 1102
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Re: DBF TEMPORARY

Post by Marc Vanzegbroeck »

James Bott wrote: Marc,

I am running it successfully with xHarbour (ver 1.2.3). I believe this is the latest version and it is from 2013. Is yours older?

James
James,

Indeed, I use an older version of xharbour.

Mobiel verstuurd via Tapatalk
Last edited by Marc Vanzegbroeck on Wed Jul 15, 2015 3:34 pm, edited 1 time in total.
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
AntoninoP
Posts: 347
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy
Contact:

Re: DBF TEMPORARY

Post by AntoninoP »

I am not able to use them, in my program I have all area in numbers.
look this code:

Code: Select all

proc main()
   local cArq:="test",i
   LOCAL t1 := hb_milliSeconds(), t2
   
   FERASE( cArq+".dbf" ) // 
   dbSelectArea(2)
   dbCreate( cArq, { { "ITEM", "N", 10, 2 },{ "RAND", "N", 10, 2 },{ "TESTO", "C", 10, 0 } } )
   USE (cArq)
   dbSelectArea(1)
   
   t2 := hb_milliSeconds()
   ? "Database creation: " + str(t2-t1) + "msec"
   t1 := t2
   
   for i:=1 to 100000 
      (2)->(dbAppend())
      (2)->ITEM := i / 100
      (2)->RAND = hb_Random(100)
      (2)->TESTO = hb_randStr(10)
   next
   
   t2 := hb_milliSeconds()
   ? "100.000 fields in " + str(t2-t1) + "msec"
   t1 := t2

   dbSelectArea(2)
   INDEX ON STR(FIELD->RAND,6,2)+STR(FIELD->ITEM,6,2) TAG "ITEST"
   
   OrdSetFocus( "ITEST" )
   DBGOTOP()

   t2 := hb_milliSeconds()
   ? "index in " + str(t2-t1) + "msec"
   t1 := t2
   
   WAIT "Press a key..." 
   browse(2)
   close
return
Our program is like this, but spread in about ten source files.

I tried to convert it with HB_DBCreateTemp, but without success, if I try it with "ARRAYRDD" is slower.
Post Reply