[V4RB] Changing Database structure

Ruslan Zasukhin sunshine at public.kherson.ua
Sun Apr 27 13:49:42 CDT 2003


on 4/27/03 1:37 PM, Stan R. Busk at maxprog at mac.com wrote:

> Hi,
> 
> I am not sure I understand exactly what you mean. For example, I need
> to add to the structure of table myTable of myDatabase the field
> myField this way "myField = new VULong ("myField")" so which UPDATE
> command do I need to use in order to insert this new field in my old
> database files? 

Stan,

Once again, steps are:

1) you modify constructor of you myTable adding
        myField = new VULong ("myField")"

2) you add to code that open your db:

        mydb as myDatabase

------------ this is new code
        db as Vdaatabse

        db.Open()
        if( db.SchemaVersion = 1 )
             db.GetBaseObject("myTable").AddField("myField", type)
             db.SchemaVersion = 2
        endif
        db.Close   
---------------

        myDatabase.Open


> I read the doc. and I was thinking the UPDATE command
> was for updating values...

You have not correctly understand.
You do not need use here UPDATE command.


> Stan
> 
>>> 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 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.

-- 
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://listserv.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list