Dump/Restore Causes Crash With No Error...

Kimball Larsen kimball at kimballlarsen.com
Sun May 25 10:04:15 CDT 2003


On Sunday, May 25, 2003, at 02:41 AM, Ruslan Zasukhin wrote:

> on 5/25/03 10:38 AM, Kimball Larsen at kimball at kimballlarsen.com wrote:
>
> Hi Kimball,
>
>> Heya folks.. I'm fairly new to Valentina and very new to this list..
>> but I'm stuck, and hope someone can help.
>> I have searched the list archives, but have not found a solution to my
>> problem.  Here's some background.  I want to have a utilities section
>> in my application that includes buttons for both backing up the  
>> current
>> database and restoring a backup of a database.  I plan to use the xml
>> format.  The backup/restore seems to work just fine (ie, I can backup
>> to an xml file just fine, and the database restore function runs fine
>> and does restore the database from the xml file.. ).  However - after  
>> I
>> do a restore, as soon as I do anything else in my app that requires  
>> the
>> database, the whole application quits, with no error message or  
>> warning.
>>
>> Here is the code for my restore.  newDB is the existing global object
>> that is of type VDatabase.
>>
>>  dim dumpFile, dbFile as folderItem
>>  dim importedDB as VDatabase
>>  dim res as boolean
>>  newDB.close
>>  //newDB = nil
>>  dumpFile = getOpenFolderItem("????")
>>  dbFile = getFolderItem("db.vdb")
>>  dbFile.delete
>>  importedDB = new VDatabase
>>  importedDB.loadDump(dumpFile, dbFile, 2)
>>  importedDB.close
>>  importedDB = nil
>>  //newDB = new vdb
>>  dbFile = nil
>>  //res = newDB.open(dbFile)
>>  newDB.init("db.vdb")
>>  msgbox ("Database Restore Complete.")
>>
>> As I said, the restore runs just fine, but it appears that there is
>> some sort of a problem with newDB after the restore is done, because  
>> as
>> soon as I try to use it, the whole app crashes.
>>
>> Suggestions?  What am I doing wrong?
>
> I do not see obvious mistakes.
>
> On what line it crashes?

I don't know what line it crashes on.. debugging does not show it...

> What do NewDB.init() ?

Here is the whole method:
   dim f as folderItem
   dim res as boolean
   f = getFolderItem(dbName)
   if(f.exists) then
     res = self.open(f)
     if res = false then
       msgbox "Sorry, there was an error opening the patient database.   
Error: 120"
     end if
     'success!
     'msgbox "Database opened correctly"
   else
     msgBox "The patient database could not be found.  Now creating new  
database."
     f = getFolderItem(dbName)
     if f<>nil then
       res = self.create(f,1, 32*1024)
       if res = false then
         msgbox "Sorry, there was an error creating the patient  
database.  Error: 121"
       end if
     end if
   end if

>
>
> Have you made steps in debugger to see if Db object is not nill ?
>

Yes.

> Have you try set debugLevel = 2 for Valentina and watch console output  
> ?
> Try this, may be you will see some error code from Valentina.
>

I'll try this next.

> It seems Erne, have utility that do XML dump/load.
> Look into archive of V4RB/ThirdParty, it seems vExport project,
>
> Also project _TEST have it in one of tests.
>


I have reviewed both of these projects, and they work reasonably well,  
but I want to restore a database that I currently have open in the  
app.. so I have to close it, restore it, then reopen it.  Everything  
works but the reopening part.  Both of these examples don't open the  
freshly restored database.

-- Kimball  



> --  
> Best regards,
> Ruslan Zasukhin      [ I feel the need...the need for speed ]
> -------------------------------------------------------------
> e-mail: ruslan at paradigmasoft.com
> web: http://www.paradigmasoft.com
>
> To subscribe to the Valentina mail list go to:
> http://lists.macserve.net/mailman/listinfo/valentina
> -------------------------------------------------------------
>
> _______________________________________________
> Valentina mailing list
> Valentina at lists.macserve.net
> http://lists.macserve.net/mailman/listinfo/valentina
>
>
------------------------------------------------------------------------ 
-----------------------
"Not everything that can be counted counts,
	and not everything that counts can be counted."
		- Albert Einstein




More information about the Valentina mailing list