Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC:

CoreDBF class 04 Feb 2020 10:42 #13037

  • wriedmann
  • wriedmann's Avatar
  • Topic Author


  • Posts: 3367
  • 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

    File Attachment:

    File Name: DBFServerApp.zip
    File Size:6 KB

    P.S. of course I'm open to suggestions, bug fixes, enhancements
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    CoreDBF class 04 Feb 2020 11:18 #13038

    • Juraj
    • Juraj's Avatar


  • Posts: 159
  • Hi Wolfgang,

    After import DBServerApp.viaef into Xide 1.17 and compile I have tihis error message (in attachments.

    Juraj

    Please Log in or Create an account to join the conversation.

    CoreDBF class 04 Feb 2020 11:25 #13039

    • wriedmann
    • wriedmann's Avatar
    • Topic Author


  • Posts: 3367
  • 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
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    CoreDBF class 04 Feb 2020 11:39 #13040

    • Juraj
    • Juraj's Avatar


  • Posts: 159
  • 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

    Please Log in or Create an account to join the conversation.

    CoreDBF class 04 Feb 2020 11:44 #13041

    • robert
    • robert's Avatar


  • Posts: 3600
  • 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
    XSharp Development Team
    The Netherlands

    Please Log in or Create an account to join the conversation.

    CoreDBF class 04 Feb 2020 13:41 #13046

    • Karl-Heinz
    • Karl-Heinz's Avatar


  • Posts: 774
  • 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 ?
    FUNCTION TestAppend() AS  VOID
    LOCAL i AS DWORD 
    LOCAL aFields AS ARRAY
    LOCAL cDbf AS STRING  
    LOCAL f AS FLOAT 
                         
        RddSetDefault( "dbfcdx" )
        
    	cDBF := "D:\test\XDbfTest.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 
    

    regards
    Karl-Heinz

    Please Log in or Create an account to join the conversation.

    CoreDBF class 04 Feb 2020 13:47 #13047

    • wriedmann
    • wriedmann's Avatar
    • Topic Author


  • Posts: 3367
  • Hi Karl-Heinz,

    this is really strange!
    I have to check it out later today.
    Basically the Append() method does the following:
    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

    So I don't see any cause why it could be so slow....

    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    CoreDBF class 04 Feb 2020 14:00 #13048

    • FFF
    • FFF's Avatar


  • Posts: 1422
  • 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 ;)
    Regards
    Karl (X# 2.16.0.5; Xide 2.16; W8.1/64 German)

    Please Log in or Create an account to join the conversation.

    Last edit: by FFF.

    CoreDBF class 04 Feb 2020 14:23 #13049

    • Karl-Heinz
    • Karl-Heinz's Avatar


  • Posts: 774
  • 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

    Please Log in or Create an account to join the conversation.

    CoreDBF class 11 Feb 2020 08:57 #13155

    • Karl-Heinz
    • Karl-Heinz's Avatar


  • Posts: 774
  • 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

    Please Log in or Create an account to join the conversation.

    CoreDBF class 11 Feb 2020 10:53 #13156

    • FFF
    • FFF's Avatar


  • Posts: 1422
  • Karl-Heinz wrote: am i correct that you´re using win8.1 64bit, and you´re still facing the mentioned append speed issues ?

    Yes and Yes ;)
    Regards
    Karl (X# 2.16.0.5; Xide 2.16; W8.1/64 German)

    Please Log in or Create an account to join the conversation.

    CoreDBF class 11 Feb 2020 11:37 #13158

    • Karl-Heinz
    • Karl-Heinz's Avatar


  • Posts: 774
  • Yes and Yes ;)

    Yeah, Win8.1 the best Win OS ever ! When the support ends January 2023 i´ll also retire :-)

    Please Log in or Create an account to join the conversation.

    Last edit: by Karl-Heinz.

    CoreDBF class 11 Feb 2020 13:13 #13159

    • Chris
    • Chris's Avatar


  • Posts: 3984
  • Still love my Win7! :)
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    CoreDBF class 11 Feb 2020 13:20 #13160

    • FFF
    • FFF's Avatar


  • Posts: 1422
  • Chris wrote: Still love my Win7! :)

    7 was ok and i kept it, until i saw ClassicShell for W8. Switched and possibly i'll follow Karl-Heinz with "retire" - or swap to *ix, as X# will run there ;-)
    Regards
    Karl (X# 2.16.0.5; Xide 2.16; W8.1/64 German)

    Please Log in or Create an account to join the conversation.

    CoreDBF class 11 Feb 2020 16:24 #13170

    • wriedmann
    • wriedmann's Avatar
    • Topic Author


  • Posts: 3367
  • Win 10 is not so bad as you all are saying!

    Ok, it is a bit different from W7/W8, but after all I feel it is better than both.

    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    CoreDBF class 11 Feb 2020 18:31 #13177

    • FFF
    • FFF's Avatar


  • Posts: 1422
  • wriedmann wrote: I feel it is better than both.

    Well, my System runs. And runs. And it does, what it should and does not, what it should not. What more could i ask?
    Regards
    Karl (X# 2.16.0.5; Xide 2.16; W8.1/64 German)

    Please Log in or Create an account to join the conversation.

    CoreDBF class 11 Feb 2020 18:42 #13178

    • Chris
    • Chris's Avatar


  • Posts: 3984
  • For me it's mainly a matter of control over our systems, unfortunately in W10 we have little anymore, MS can just do whatever it wants now. I know it's fighting a lost battle...
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    CoreDBF class 11 Feb 2020 20:44 #13180

    • Karl-Heinz
    • Karl-Heinz's Avatar


  • Posts: 774
  • btw. Tomorrow will be another (Win10) day of horror - it's Patchday ! :woohoo:

    Please Log in or Create an account to join the conversation.

    CoreDBF class 11 Feb 2020 22:04 #13181

    • Chris
    • Chris's Avatar


  • Posts: 3984
  • Karl-Heinz wrote: btw. Tomorrow will be another (Win10) day of horror - it's Patchday ! :woohoo:


    :) :) :)
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    CoreDBF class 21 Feb 2020 20:22 #13363

    • ic2
    • ic2's Avatar


  • Posts: 1667
  • I am reading posts in the forum of the last few weeks. Reading this I've got 1 remark and 1 question.

    Remark: <W10 users You can pretty safely use W10 if you run O&O ShutUp10 . www.oo-software.com/en/shutup10 It switches off all kind of unwanted things like Telemetry, forced updates. I usually run updates every 3-4 months only (by first allowing it on O&O ShutUp10) and feature updates at least 5-6 months after release. Occasionally one of the Telemetry settings appears reset (O&O will mention that if you open it) but that's all.

    What I really love in W10 is the Alt - Windows key combination which allows you to select clipboard content of previous cuts/copies. I really use it all the day. And there are quite a few other (sometimes small) differences with W7/W8. I do use the W10 menu which has been much improved but still run Classic Shell to enable me quickly browsing through programs + the W10 menu can only be externally changed when an option has been added to the good old Start Menu directories anyway.

    Question: I found Karl-Heinz 's remark of the speed of the append compared to VO disturbing. I have downloaded the sample but not yet tried it. Do others see the same slowness? If not, what could be the cause for Karl-Heinz ?

    Dick

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1
    • 2