Prev: bBrowser and RowSelect()
Next: VO apps under Win7
From: Paulo Oliveira on 5 Nov 2009 11:17 Hi all, auStruct := {{"FICHA", "N", 10, 0}, {"ANO", "C", 2, 0}, {"MODELO", "C", 15, 0},; {"DESCRICAO", "C", 100, 0},{"DATA_ORC", "D", 8, 0}, {"CLIENTE", "C", 70, 0},; {"EPOCA", "C", 10, 0},{"ESCALAO", "C", 20, 0}, {"TOTAL_EUR", "N", 15, 2},{"MOEDA", "C", 3, 0},; {"TOTAL_MOEDA", "N", 15, 2},; {"CAMBIO", "N", 10, 3},{"CIMAGEM", "C", 150, 0},{"CCODPRO", "C", 1, 0},{"CTPMARG", "C", 2, 0},{"COBS","M",10,0}} odbsServer := bDBServer{EMPDBFPATH+"OrcFichC.dbf",,, "DBFCDX"} odbsServer:setOrder(3) auData:={} odbsServer:SuspendNotification() DO WHILE !odbsServer:eof NaoEspera() AAdd(auData, {odbsServer:INRFICHA,odbsServer:CANODOC,odbsServer:CCODART,; odbsServer:CDESCART,odbsServer:DDATA,odbsServer:CCLIENTE,; odbsServer:CEPOCA,odbsServer:ESCALAO,odbsServer:FTOTORC,odbsServer:CMOEDA,; odbsServer:FMOEDA,; odbsServer:FCAMBIO,odbsServer:CIMAGEM,odbsServer:CCODPRO,odbsServer:CTPMARG,odbsServer:COBS}) odbsServer:skip() ENDDO odbsServer:ResetNotification() aCampos:={} auStructCab:={} odbsServer:close() oasServer := bArrayServer{auStruct, auData, BINACTIVE, BDATAFORMAT_DBASE} I use this code to create a barrayserver to create a bArrayServer from a DBServer, but this take long time if DBServer with 10.000 records, is this the best way? TIA Paulo Oliveira
From: Amilcar A. Camargo on 5 Nov 2009 11:58 Hi Paulo, On Thu, 5 Nov 2009 08:17:31 -0800 (PST), Paulo Oliveira <paulo(a)clipinfor.com> wrote: >Hi all, > >auStruct := {{"FICHA", "N", 10, 0}, {"ANO", "C", 2, 0}, {"MODELO", >"C", 15, 0},; > {"DESCRICAO", "C", 100, 0},{"DATA_ORC", "D", 8, 0}, {"CLIENTE", "C", >70, 0},; > {"EPOCA", "C", 10, 0},{"ESCALAO", "C", 20, 0}, {"TOTAL_EUR", "N", >15, 2},{"MOEDA", "C", 3, 0},; > {"TOTAL_MOEDA", "N", 15, 2},; > {"CAMBIO", "N", 10, 3},{"CIMAGEM", "C", 150, 0},{"CCODPRO", "C", >1, 0},{"CTPMARG", "C", 2, 0},{"COBS","M",10,0}} > > odbsServer := bDBServer{EMPDBFPATH+"OrcFichC.dbf",,, "DBFCDX"} > odbsServer:setOrder(3) > auData:={} You will gain some time if you define the array with the final size once instead of AAdd'ing to it: auData := ArrayNew( odbServer:RecCount, ALen( auStruct ) ) > odbsServer:SuspendNotification() > DO WHILE !odbsServer:eof > NaoEspera() > AAdd(auData, >{odbsServer:INRFICHA,odbsServer:CANODOC,odbsServer:CCODART,; > odbsServer:CDESCART,odbsServer:DDATA,odbsServer:CCLIENTE,; > >odbsServer:CEPOCA,odbsServer:ESCALAO,odbsServer:FTOTORC,odbsServer:CMOEDA,; > odbsServer:FMOEDA,; > >odbsServer:FCAMBIO,odbsServer:CIMAGEM,odbsServer:CCODPRO,odbsServer:CTPMARG,odbsServer:COBS}) Using the server 'ACCESS' involves some extra processing. You can gain some time with odbServer:FIELDGET(...) and its best if you can provide field numbers as there is no conversion. You can do this with another array: aFldPos := { odbsServer:FieldPos( #INRFICHA ), ; odbsServer:FieldPos( #CANODOC ), ; odbsServer:FieldPos( #CCODART )...... } Also, going with the VODB...() functions will provide the best performance but, technically, you will be abandoning OOP with them. HTH, Amilcar A. Camargo F. Guatemala, C. A.
From: Alessandro Antonangeli on 5 Nov 2009 15:07 10000 records in memory may be a lot of memory usage. Try with DynSize(160) SetMaxDynSize(67108864) or higher value Ciao Alessandro Paulo Oliveira ha scritto: > Hi all, > > auStruct := {{"FICHA", "N", 10, 0}, {"ANO", "C", 2, 0}, {"MODELO", > "C", 15, 0},; > {"DESCRICAO", "C", 100, 0},{"DATA_ORC", "D", 8, 0}, {"CLIENTE", "C",
From: Geoff Schaller on 5 Nov 2009 15:45 Paulo. No, there is no good way. The "best" way is to load the DBF into memory as a string, find the first record using pointer arithmetic and then populate the array directly from that string. You know the structure of the DBF so this is quite possible. 5-6 hours work though. Then loading 10,000 rows should take around 1-2 minutes at most. But why do you need to do this? What benefit do you get from an array server that you don't already have as a DBF server? Geoff "Paulo Oliveira" <paulo(a)clipinfor.com> wrote in message news:58025d57-4f1e-4985-8c13-e921edc10b5e(a)m38g2000yqd.googlegroups.com: > Hi all, > > auStruct := {{"FICHA", "N", 10, 0}, {"ANO", "C", 2, 0}, {"MODELO", > "C", 15, 0},; > {"DESCRICAO", "C", 100, 0},{"DATA_ORC", "D", 8, 0}, {"CLIENTE", "C", > 70, 0},; > {"EPOCA", "C", 10, 0},{"ESCALAO", "C", 20, 0}, {"TOTAL_EUR", "N", > 15, 2},{"MOEDA", "C", 3, 0},; > {"TOTAL_MOEDA", "N", 15, 2},; > {"CAMBIO", "N", 10, 3},{"CIMAGEM", "C", 150, 0},{"CCODPRO", "C", > 1, 0},{"CTPMARG", "C", 2, 0},{"COBS","M",10,0}} > > odbsServer := bDBServer{EMPDBFPATH+"OrcFichC.dbf",,, "DBFCDX"} > odbsServer:setOrder(3) > auData:={} > > odbsServer:SuspendNotification() > DO WHILE !odbsServer:eof > NaoEspera() > AAdd(auData, > {odbsServer:INRFICHA,odbsServer:CANODOC,odbsServer:CCODART,; > odbsServer:CDESCART,odbsServer:DDATA,odbsServer:CCLIENTE,; > > odbsServer:CEPOCA,odbsServer:ESCALAO,odbsServer:FTOTORC,odbsServer:CMOEDA,; > odbsServer:FMOEDA,; > > odbsServer:FCAMBIO,odbsServer:CIMAGEM,odbsServer:CCODPRO,odbsServer:CTPMARG,odbsServer:COBS}) > odbsServer:skip() > ENDDO > odbsServer:ResetNotification() > aCampos:={} > auStructCab:={} > > odbsServer:close() > oasServer := bArrayServer{auStruct, auData, BINACTIVE, > BDATAFORMAT_DBASE} > > I use this code to create a barrayserver to create a bArrayServer from > a DBServer, but this take long time if DBServer with 10.000 records, > is this the best way? > > TIA > Paulo Oliveira
|
Pages: 1 Prev: bBrowser and RowSelect() Next: VO apps under Win7 |