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

TOPIC:

CopyDB() Method 27 Nov 2021 21:50 #20561

  • Neale
  • Neale's Avatar
  • Topic Author


  • Posts: 21
  • Hello

    Since installing XSharp 2.9a Public version the CopyDB() method seems to hang on
    large .DBF files ( 75k + records ) and other .DBF’s are copied with few and duplicated
    records. Reinstalled 2.8a and all seems OK ?

    Neale

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

    CopyDB() Method 27 Nov 2021 22:56 #20564

    • Chris
    • Chris's Avatar


  • Posts: 2955
  • Hi Neal,

    Can you please give us a sample showing the problem? I tried to reproduce it with the code below, but it seems to work fine (output dbf identical to the source dbf), so of course the test is missing something to make the problem manifest itself.

    FUNCTION Start() AS INT
    	LOCAL cFileName AS STRING
    	cFileName := "c:\test\copydb"
    	RddSetDefault("DBFCDX")
    	DbCreate(cFileName , {{"FLD1","C",20,0}})
    	FErase(cFileName + ".cdx")
    	DbUseArea(TRUE,,cFileName,,FALSE)
    	? "created"
    	FOR LOCAL n := 1 AS INT UPTO 500_000
    		DbAppend()
    		FieldPut(1, StrZero(n,10))
    	NEXT
    	DbCreateOrder("FLD1",cFileName,"FLD1")
    	DbCloseArea()
    	? "appended"
    	
    	LOCAL db AS DbServer
    	db := DBServer{cFileName} 
    	? db:CopyDB(cFileName + "_copy")
    	db:Close()
    RETURN 0
    XSharp Development Team
    chris(at)xsharp.eu

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

    Last edit: by Chris.

    CopyDB() Method 27 Nov 2021 23:33 #20565

    • Neale
    • Neale's Avatar
    • Topic Author


  • Posts: 21
  • Hello Chris
    Your example worked OK.
    Will check again and send an example later, a snippet of the code I am using CopyDB ;

    oArt3Server := DBServer{ SELF:cArt3Path + "Transact.DBF", FALSE }
    oArt3Server:CopyDB( SELF:cArt4Path + "Transact.DBF" )
    oArt3Server:Close()
    oArt3Server := NULL_OBJECT
    SELF:oDCProgressBar1:Advance(1)

    Neale

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

    CopyDB() Method 29 Nov 2021 22:28 #20617

    • Neale
    • Neale's Avatar
    • Topic Author


  • Posts: 21
  • Hello Chris
    Thanks for your help, I noticed in your example you deleted the associated .CDX file before calling CopyDB(), that solved the problem.
    In 2.8a CopyDB() seemed to work without deleting the old .CDX.
    All good and thanks again.

    Neale

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

    CopyDB() Method 30 Nov 2021 01:49 #20620

    • Chris
    • Chris's Avatar


  • Posts: 2955
  • Hi Neal,

    Ah, OK, glad to hear! I had not suspected that this could be the issue, I'm just always doing that before creating a new dbf/cdx set.

    .
    XSharp Development Team
    chris(at)xsharp.eu

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

    CopyDB() Method 30 Nov 2021 08:24 #20623

    • robert
    • robert's Avatar


  • Posts: 2593
  • Neale,

    In X# 2.8a we were deleting the production index (the cdx with the same name as the DBF) when creating a new dbf file.
    We are no longer doing that because that was not compatible with Visual Objects and several other xbase implementations.


    Robert
    XSharp Development Team
    The Netherlands

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

    • Page:
    • 1