I hate my life. More crashes.

Gunnar Swan GunnarSwan at PracticeToPass.com
Sun May 4 16:55:53 CDT 2003


I don't see in this code where you do a "Valentina Init" ... ?
Suggestion ... run the database xtra instances inside a parent script.
Plug the parent script into a list.
refer to the list item.
The list has global access.

you don't want to ... for every call to the database ... start a new instance and shut it down.
you don't want to -- for every call to the database ... open and close the database.
Very time consuming.

On application start ..  (NOT movie start)

(1) initialize the core database engine ... 
(2) open the databases necessary.

On app running 
(1) Cursors should refer to databases started on application start.
(2) Open cursor in a function.
(3) set someReturnValue = cursor results
(4) Close cursor in a function
(5) return cursor results as independent variable  RETURN someReturnValue

On app close  (NOT movie stop)
(1) flush databases
(2) close databases
(3) close core database engine.

You want to handle databases in this fashion for ALL applications. Visual Basic, Delphi, Director ... doesn't matter.
(Client server applications go one step further. the Connection object) -- << After thoughts of suicide diminish ?

I use an ANCESTOR for valentina. I'll show you soon.


>on ReadFromUserDatabase
>   put "creating user database"
>   myDBPath = the moviepath & "username.vdb"
>   myDBTable = "Users"
>   myDB = new( xtra "VDatabase")-- NEW INSTANCE OF THE XTRA
>
>   OpenDataBase(myDB, myDBPath,1) -- CREATE DATABASE FROM SCRATCH
>
>   myBaseTableRef = GetBaseObjectName(myDB, 1) -- Get the TABLE  **** 
>The baseRef OBJ is the table
>   
>   -- ...then your addField stuff.
>   userField = "Username"
>   passwordField = "Password"
>   hintField = "Hint"
>
>   -- create a cursor object
>   myDBref = myDB.GetRef()
>   --  
>   myCrsRef = new(xtra "VCursor", myDBref, "SELECT * FROM" && 
>myDBTable)--myBaseTableRef)
>   put ValentinaError()
>   myCrsRef.SetBlank()
>   -- add Zav as a user with ferrari as password and "Italian sports 
>car" as hint.
>   myUser = "Zav"
>   myPassword = "ferrari"
>   myHint = "Italian Sports Car"
>   myCrsRef.AddRecord([myUser, myPassword, myHint])
>
>   --  flush the db
>   myDB.Flush()
>   -- Clear the cursor reference
>   myCrsRef = 0
>
>   -- Close the database
>   CloseDataBase(myDB)
>end
>




More information about the Valentina mailing list