Author | Topic: In-memory Work Area | |
---|---|---|
Otto Trapp | In-memory Work Area on Thu, 19 Jan 2017 11:04:37 +0100 Hello, Is it somehow possible to create and populate a work area in Xbase that is not linked to any database file, just to a memory structure defined for example by a DbStruct() array? Regards, Otto | |
Peter Alderliesten | Re: In-memory Work Area on Fri, 20 Jan 2017 09:25:58 +0100 Otto, > Is it somehow possible to create and populate a work area in Xbase that > is not linked to any database file, just to a memory structure defined > for example by a DbStruct() array? This was on the slate for Xbase++ 2.0 Afaik this has not yet been realised. Peter | |
Soeren Nommsen | Re: In-memory Work Area on Fri, 27 Jan 2017 16:38:28 +0100 Hello Otto, It is possible but not documented yet. Try this: #include "dac.ch" #include "sql.ch" PROCEDURE Main LOCAL oStmt, cStmt, aResult := NIL create in-memory-table TEXT INTO cStmt TRIMMED CREATE TABLE art_mem( artid Char(10), artnr char(10), artbez char (50) ); ENDTEXT USQLStatement():New():FromChar( cStmt ):Build():Execute() fill in-memory-table from dbf 'artikel' USE artikel EXCLUSIVE INSERT INTO art_mem( artid, artnr, artbez ) SELECT artid, artnr, artbez FROM artikel create in-memory-index oStmt := USQLStatement():New():FromChar( "CREATE INDEX 'artid' on art_mem ( artid )" ):Build() oStmt:Execute() TEXT INTO cStmt TRIMMED SELECT art_mem.artid, art_mem.artnr, art_mem.artbez FROM art_mem ORDER BY art_mem.artbez ENDTEXT ? Time() DacSqlStatement():fromChar( cStmt ):Build():query( NIL, @aResult ) ? Time() wait CLOSE DATABASES RETURN PROCEDURE DbeSys DbeLoad( "FOXDBE", .T.) DbeLoad( "CDXDBE" , .T.) DbeBuild( "FOXCDX", "FOXDBE", "CDXDBE" ) RETURN Regards, Soeren | |
Jonathan Leeming | Re: In-memory Work Area on Sat, 28 Jan 2017 10:26:22 -0700 Hi Soeren... and thanks... I've wondered about this and you have given me a good starting point. I modified the DBE to DBFNTX, created a test file and it works great! Thanks Again... Jonathan On Fri, 27 Jan 2017 16:38:28 +0100, Soeren Nommsen wrote: >Hello Otto, > >It is possible but not documented yet. > >Try this: > >#include "dac.ch" >#include "sql.ch" > >PROCEDURE Main > > LOCAL oStmt, cStmt, aResult := NIL > > create in-memory-table > > TEXT INTO cStmt TRIMMED > CREATE TABLE art_mem( artid Char(10), artnr char(10), artbez char >(50) ); > ENDTEXT > > USQLStatement():New():FromChar( cStmt ):Build():Execute() > > fill in-memory-table from dbf 'artikel' > > USE artikel EXCLUSIVE > INSERT INTO art_mem( artid, artnr, artbez ) SELECT artid, artnr, artbez >FROM artikel > > create in-memory-index > > oStmt := USQLStatement():New():FromChar( "CREATE INDEX 'artid' on art_mem >( artid )" ):Build() > oStmt:Execute() > > TEXT INTO cStmt TRIMMED > SELECT art_mem.artid, art_mem.artnr, art_mem.artbez FROM art_mem ORDER >BY art_mem.artbez > ENDTEXT > > ? Time() > DacSqlStatement():fromChar( cStmt ):Build():query( NIL, @aResult ) > ? Time() > wait > > CLOSE DATABASES > >RETURN > >PROCEDURE DbeSys > DbeLoad( "FOXDBE", .T.) > DbeLoad( "CDXDBE" , .T.) > DbeBuild( "FOXCDX", "FOXDBE", "CDXDBE" ) >RETURN > > >Regards, >Soeren | |
Boris Borzic | Re: In-memory Work Area - 1 attachment on Fri, 27 Jan 2017 19:04:39 +0100 Otto Trapp wrote in news:396c5419$a0ba2ba$4afa8@news.alaska-software.com: > Is it somehow possible to create and populate a work area in Xbase that > is not linked to any database file, just to a memory structure defined > for example by a DbStruct() array? If you have SQLExpress, you can create in-memory SQLDataSet objects. Attached is a working sample. Best regards, Boris Borzic http://xb2.net http://sqlexpress.net industrial strength Xbase++ development tools SQLTest4.prg |