Page 4 of 4
Re: DBF TEMPORARY
Posted: Fri Jul 17, 2015 12:24 pm
by bpd2000
thefull wrote:Hi Enrico
I use NTX, and Harbour 3.2 i don't problem.
New code.
Code: Select all | Expand
REQUEST DBFNTX
REQUEST HB_MEMIO
function Main()
rddsetdefault( 'DBFNTX' ) // RDD NTX
test_memio()
return nil
/* Create file dbf and ntx/ in memory */
function test_memio()
dbcreate( "mem:test.dbf", { { "F1", "N", 10, 0 }, { "F2", "N", 10, 0 } } )
use "mem:test.dbf" alias memtest
index on field->f2 to "mem:tmp1.ntx" DESCENDING
for i := 1 to 100000
append blank
memtest->f1 := i
memtest->f2 := i * 100
next
go top
browse()
dbDrop( "mem:test.dbf" ) /* Free memory resource */
dbDrop( "mem:tmp1.ntx" ) /* Free memory resource */
return nil
I can not compile your code
as
BUILDH memio.prg
Re: DBF TEMPORARY
Posted: Fri Jul 17, 2015 1:41 pm
by thefull
Please, add a your make file , the library hbmemio.lib
In /contrib/hbmemio you have code/example
Re: DBF TEMPORARY
Posted: Wed Feb 17, 2016 6:13 am
by dbmanfwh
Hi Antonio,
Tdatabase Error In MemoryDb.
xHarbour 1.2.3 (Build 20150419)
Fwh 15.04
Application
===========
Error description: Error BASE/1109 Argument error: $
Args:
[ 1] = C :\
[ 2] = U
Stack Calls
===========
Called from: .\source\classes\DATABASE.PRG => TDATABASE:SETAREA( 289 )
Called from: .\source\classes\DATABASE.PRG => TDATABASE:NEW( 221 )
Variables in use
================
Procedure Type Value
==========================
TDATABASE:SETAREA
Param 1: N 2
Local 1: O Class: TDATABASE
Local 2: U
Local 3: U
Local 4: A Len: 0
Local 5: A Len: 0
Local 6: U
Local 7: C ":\"
Local 8: U
Local 9: U
Local 10: U
DataBases in use
================
1: => TEMP RddName: ARRAYRDD
==============================
RecNo RecCount BOF EOF
1 0 .T. .T.
Code: Select all | Expand
FUNCTION MAIN()
LOCAL oDb
LOCAL cAlias := cGetNewAlias("temp")
LOCAL aStruct := { { "F1", "N", 10, 0 }, { "F2", "N", 10, 0 } }
dbCreate( cAlias+".dbf", aStruct, "ARRAYRDD" )
USE (cAlias+".dbf") ALIAS (cAlias) NEW VIA "ARRAYRDD"
(cAlias)->(DbSelectArea())
DATABASE oDb // =======> error
oDb:Zap()
RETURN oDb
Re: DBF TEMPORARY
Posted: Wed Feb 17, 2016 10:25 am
by Antonio Linares
Try this:
DATABASE oDb FILE ""
Re: DBF TEMPORARY
Posted: Wed Feb 17, 2016 2:01 pm
by nageswaragunupudi
The case of memory file was not considered when making this part of the code in database.prg.
Please enclose all lines from 289 to 295 inside an if condition "if ! Empty( ::cfile ) ........... endif"
like this
Code: Select all | Expand
if ! Empty( ::cFile ) // <-- now inserted
if !( ":\" $ ::cFile ) //SubStr( ::cFile, 2, 2 ) != ":\"
if Left( ::cFile, 1 ) == '\'
::cFile := CurDrive() + ':' + ::cFile
else
::cFile := CurDrive() + ":\" + CurDir() + "\" + ::cFile
endif
endif
endif // <-- now inserted
We shall adopt a suitable fix in the next release
Re: DBF TEMPORARY
Posted: Wed Feb 17, 2016 2:25 pm
by dbmanfwh
I tried so.
But, error appears.
USE (cAlias+".dbf") ALIAS (cAlias) NEW VIA "ARRAYRDD"
? Select() // 1
? (CAlias )->( DbInfo (DBI _ FULLPATH)) // nul
1.
DEFINE DATABASE oDb FILE ""
? oDb:nAarea // ======> Result 0
oDb:zap() // Error database.prg (177) ===> METHOD Zap() INLINE ( ::nArea )->( DbZap() )
Error description: Error DBCMD/2001 Workarea not in use: __DBZAP
Called from: => __DBZAP( 0 )
Called from: .\source\classes\DATABASE.PRG => (b)TDATABASE:TDATABASE( 177 )
Called from: => TDATABASE:ZAP( 0 )
2.
DATABASE oDb
Error description: Error BASE/1109 Argument error: $
Called from: .\SOURCE\TDatabase.prg => TDATABASE:SETAREA( 289 )
Called from: .\SOURCE\TDatabase.prg => TDATABASE:NEW( 221 )
Because it returns nul from Memodb that (CAlias )->( DbInfo (DBI _ FULLPATH))
database.prg (288)
::cFile = ( nWorkArea )->( DbInfo( DBI_FULLPATH ) ) // ======> Result nul
database.prg (289) line Error
if !( ":\" $ ::cFile ) //SubStr( ::cFile, 2, 2 ) != ":\"