Hi all,
if someone is interested: the attached application contains a class to permit an object oriented access to DBF files without using any VO compatible class.
There is also some code showing how to use this class.
Wolfgang
P.S. of course I'm open to suggestions, bug fixes, enhancements
CoreDBF class
CoreDBF class
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
CoreDBF class
Hi Wolfgang,
After import DBServerApp.viaef into Xide 1.17 and compile I have tihis error message (in attachments.
Juraj
After import DBServerApp.viaef into Xide 1.17 and compile I have tihis error message (in attachments.
Juraj
- Attachments
-
- DBFServerAppError.png (13.01 KiB) Viewed 1803 times
CoreDBF class
Hi Juraj,
strange.... you can remove this class from the application, it is not more needed. Or you can simply change the build type to "Text".
Wolfgang
P.S. I have XIDE 1.23 and X# 2.2a and there it compiles
strange.... you can remove this class from the application, it is not more needed. Or you can simply change the build type to "Text".
Wolfgang
P.S. I have XIDE 1.23 and X# 2.2a and there it compiles
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
CoreDBF class
Hi Wolfgang,
after remove this class I have next error message (in atachments) in Form1:CreateDBFile..
oFieldList := List<RDDFieldInfo>{}
oFieldList:Add( RDDFieldInfo{ "FIELDC", "C", 10, 0, 0 } )
oFieldList:Add( RDDFieldInfo{ "FIELDD", "D", 8, 0, 0 } )
oFieldList:Add( RDDFieldInfo{ "FIELDN", "N", 10, 2, 0 } )
oFieldList:Add( RDDFieldInfo{ "FIELDL", "L", 1, 0, 0 } )
oFieldList:Add( RDDFieldInfo{ "FIELDM", "M", 10, 0, 0 } )
when I delete last "0" , copilation is OK.
Juraj
after remove this class I have next error message (in atachments) in Form1:CreateDBFile..
oFieldList := List<RDDFieldInfo>{}
oFieldList:Add( RDDFieldInfo{ "FIELDC", "C", 10, 0, 0 } )
oFieldList:Add( RDDFieldInfo{ "FIELDD", "D", 8, 0, 0 } )
oFieldList:Add( RDDFieldInfo{ "FIELDN", "N", 10, 2, 0 } )
oFieldList:Add( RDDFieldInfo{ "FIELDL", "L", 1, 0, 0 } )
oFieldList:Add( RDDFieldInfo{ "FIELDM", "M", 10, 0, 0 } )
when I delete last "0" , copilation is OK.
Juraj
- Attachments
-
- DBFServerAppError01.png (72.43 KiB) Viewed 1803 times
CoreDBF class
Juraj,
The last X# build has added an extra parameter in the constructor: this is the Flags field for VFP which is used to indicate that a field is autonumber or binary.
Robert
The last X# build has added an extra parameter in the constructor: this is the Flags field for VFP which is used to indicate that a field is autonumber or binary.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
-
- Posts: 774
- Joined: Wed May 17, 2017 8:50 am
- Location: Germany
CoreDBF class
Hi Wolfgang,
the Append() is incredible slow. Even when i change in your CreateDBFile() the loop to
FOR nI := 1 UPTO 100
it still takes 5,5 seconds to create and fill both dbfs. I couldn´t believe that, and created a test. When i run the TestAppend() with X# it takes indeed seconds ! to append 100 records. When i increase the loop upto 1000, VO appends 1000 records in less than 0,1 seconds. ...
can you confirm this behaviour ?
regards
Karl-Heinz
the Append() is incredible slow. Even when i change in your CreateDBFile() the loop to
FOR nI := 1 UPTO 100
it still takes 5,5 seconds to create and fill both dbfs. I couldn´t believe that, and created a test. When i run the TestAppend() with X# it takes indeed seconds ! to append 100 records. When i increase the loop upto 1000, VO appends 1000 records in less than 0,1 seconds. ...
can you confirm this behaviour ?
Code: Select all
FUNCTION TestAppend() AS VOID
LOCAL i AS DWORD
LOCAL aFields AS ARRAY
LOCAL cDbf AS STRING
LOCAL f AS FLOAT
RddSetDefault( "dbfcdx" )
cDBF := "D:testXDbfTest.dbf"
aFields := { { "LAST" , "C" , 10 , 0 } }
SetExclusive ( true ) // X# 2,36 secs !
// SetExclusive ( false ) // X# 4,64 secs !
? "-------------------"
? "Create and fill DBF"
? "-------------------"
? DbCreate( cDBF , AFields)
? DbUseArea( ,,cDBF )
f := Seconds()
FOR i := 1 UPTO 100
DbAppend()
FieldPut ( 1 , PadL ( i , 10 , "0" ) )
NEXT
? "Elapsed:" , Seconds() - f
DbCloseArea()
RETURN
Karl-Heinz
CoreDBF class
Hi Karl-Heinz,
this is really strange!
I have to check it out later today.
Basically the Append() method does the following:
So I don't see any cause why it could be so slow....
Wolfgang
this is really strange!
I have to check it out later today.
Basically the Append() method does the following:
Code: Select all
public virtual method Append( lReleaseLocks as logic ) as logic
local lReturn as logic
local nSaveArea as dword
nSaveArea := RuntimeState.CurrentWorkArea
lReturn := false
try
RuntimeState.CurrentWorkArea := _oRDD:Area
lReturn := CoreDB.Append( lReleaseLocks )
catch oEx as Exception
self:ProcessException( oEx )
lReturn := false
finally
RuntimeState.CurrentWorkArea := nSaveArea
end try
return lReturn
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
CoreDBF class
Wolfgang,
yes, strange.
Took your code, imported Aef into Xide1.23, compiles, runs.
Click "Create DBF" - Bang, "konnte nicht auf eine Objectinstanz festgelegt werden".
looked in Code, find defaultpath for DBF is c: temp, change to zu "D:" (as i have no c:temp)
recompile, run, create dbf
swap to explorer, to look, if true -> yes, - dbf and fpt written
come back to app -> apphang.
?
EDIT: coming back after writing this, i find a "DBF written" messagebox. Hit ok. Looking NOW into explorer, i see also a cdx file written. I'm rather sure, it wasn't there, when i first looked
yes, strange.
Took your code, imported Aef into Xide1.23, compiles, runs.
Click "Create DBF" - Bang, "konnte nicht auf eine Objectinstanz festgelegt werden".
looked in Code, find defaultpath for DBF is c: temp, change to zu "D:" (as i have no c:temp)
recompile, run, create dbf
swap to explorer, to look, if true -> yes, - dbf and fpt written
come back to app -> apphang.
?
EDIT: coming back after writing this, i find a "DBF written" messagebox. Hit ok. Looking NOW into explorer, i see also a cdx file written. I'm rather sure, it wasn't there, when i first looked
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
-
- Posts: 774
- Joined: Wed May 17, 2017 8:50 am
- Location: Germany
CoreDBF class
Hi Karl,
the app doesn´t hang, but you have to wait ... or decrease the for loop as i did
The problem is not Wolfgang´s class, the problem is IMO the way a append currently works.
regards
Karl-Heinz
the app doesn´t hang, but you have to wait ... or decrease the for loop as i did
The problem is not Wolfgang´s class, the problem is IMO the way a append currently works.
regards
Karl-Heinz
-
- Posts: 774
- Joined: Wed May 17, 2017 8:50 am
- Location: Germany
CoreDBF class
Hi Karl,
am i correct that you´re using win8.1 64bit, and you´re still facing the mentioned append speed issues ?
regards
Karl-Heinz
am i correct that you´re using win8.1 64bit, and you´re still facing the mentioned append speed issues ?
regards
Karl-Heinz