DBF TEMPORARY

Re: DBF TEMPORARY

Postby AntoninoP » Mon Jul 13, 2015 3:28 pm

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
AntoninoP
 
Posts: 375
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy

Re: DBF TEMPORARY

Postby nageswaragunupudi » Mon Jul 13, 2015 11:58 pm

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
nageswaragunupudi
 
Posts: 10660
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: DBF TEMPORARY

Postby fp » Tue Jul 14, 2015 11:34 am

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
fp
 
Posts: 76
Joined: Fri Dec 30, 2005 10:25 am
Location: Germany

Re: DBF TEMPORARY

Postby nageswaragunupudi » Tue Jul 14, 2015 11:37 am

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
nageswaragunupudi
 
Posts: 10660
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: DBF TEMPORARY

Postby James Bott » Tue Jul 14, 2015 1:51 pm

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
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: DBF TEMPORARY

Postby Biel EA6DD » Tue Jul 14, 2015 2:18 pm

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
Biel EA6DD
 
Posts: 682
Joined: Tue Feb 14, 2006 9:48 am
Location: Mallorca

Re: DBF TEMPORARY

Postby James Bott » Tue Jul 14, 2015 2:54 pm

Biel,

The Temporary File is created on the hard disk? or in memory?


In memory.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: DBF TEMPORARY

Postby Biel EA6DD » Tue Jul 14, 2015 3:54 pm

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
Biel EA6DD
 
Posts: 682
Joined: Tue Feb 14, 2006 9:48 am
Location: Mallorca

Re: DBF TEMPORARY

Postby James Bott » Tue Jul 14, 2015 4:04 pm

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
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: DBF TEMPORARY

Postby Euclides » Tue Jul 14, 2015 5:16 pm

Hi, this is a very small example:
Code: Select all  Expand view  RUN

#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
User avatar
Euclides
 
Posts: 156
Joined: Wed Mar 28, 2007 1:19 pm

Re: DBF TEMPORARY

Postby Marc Vanzegbroeck » Tue Jul 14, 2015 8:17 pm

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
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: DBF TEMPORARY

Postby James Bott » Tue Jul 14, 2015 9:31 pm

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
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: DBF TEMPORARY

Postby nageswaragunupudi » Tue Jul 14, 2015 10:41 pm

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
User avatar
nageswaragunupudi
 
Posts: 10660
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: DBF TEMPORARY

Postby Marc Vanzegbroeck » Wed Jul 15, 2015 8:00 am

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
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: DBF TEMPORARY

Postby AntoninoP » Wed Jul 15, 2015 9:12 am

I am not able to use them, in my program I have all area in numbers.
look this code:
Code: Select all  Expand view  RUN
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.
AntoninoP
 
Posts: 375
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy

PreviousNext

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: nageswaragunupudi and 38 guests