[V4RB] Changing Database structure

Richard Altenburg valentina at brainchild.nl
Sun Apr 27 10:21:26 CDT 2003


On 27-04-2003 09:45, "Ruslan Zasukhin" <sunshine at public.kherson.ua> wrote:

>>> I wonder what is the best way to convert an existing static database
>>> once you add a new field to one of its tables. I guess you need to
>>> write a tool that create a new file with new structure, open old file
>>> with old structure and copy all data from the first to the latter. Am
>>> I true? Is there a better / easier way?
>> 
>> I don't know whether it is easier or not. It is your decission.
>> 
>> I do the following:
>> 
>> Opening database and checking which version database is.
>> 
>> If databaseversion is not the actual one then calling update-method
>> after update-method until the database-version is actual.
>> 
>> After that I give the message (information) that the database is
>> updated.
>> 
>> thats it.
>> 
>> When you want to get more information or example code. tell me.
> 
> Stan, 
> 
> And note, you need open database using Vdatabase class. NOT mydatabase.
> 
> Then you check version, if needed you Update structure, and close Vdatabase
> object.
> 
> Then open db as myDatabase.

I have the same problem, using BaseObject-classes for my table-structure
rather than using SQL to create the tables.

Should I, when I have a new version of the database scheme, open it without
using the BaseObject-classes, and use simple SQL to update the structure?

Please someone post some example code.



More information about the Valentina mailing list