Newbie alert - Creating databases in Lingo

Zav - Alex Zavatone zavpublic at mac.com
Sat Apr 12 22:45:41 CDT 2003


>Hi Zav
>
>>ok.  Let's mention stability.  The following code instantly crashes 
>>Director if you type InitValentina and CreateDatabase.  I know I 
>>shouldn't attempt to add the same field more than once buuut this 
>>shouldn't crash.
>
>Sorry I can't check on OSX right now but...
>
>You've got an incomplete CreateDatabase handler in there - might 
>just be your copying and pasting into the email of course. You've 
>also got 2 CreateUserDatabase lines in your CreateUserDatabase 
>handler - don't know if this would matter or not.

Thanks for the proofread.  what's incomplete about the CreateDatabase 
line?  I looked at the docs and don't exactly get all the details 
about createdatabase so I just stole your example.  Also, do I need 
to close the database at the end of the handler?  I plan on making 
other routines to add and get records from the   "users" table of the 
username.vdb database.

on CreateUserDatabase
   myDBPath = the moviepath & "username.vdb"
   myDBTable = "Users"
   myDB = new( xtra "VDatabase")-- NEW INSTANCE OF THE XTRA

   CreateDataBase(myDB, myDBPath,1) -- CREATE DATABASE FROM SCRATCH

    myBaseTableRef = MakeNewBaseObject(myDB, myDBTable) -- MAKE A TABLE

   -- ...then your addField stuff.
   userField = AddField(myDB, myBaseTableRef,"Username",#kTypeString,10)
   passwordField = AddField(myDB, myBaseTableRef,"Password",#kTypeString,10)
   hintField = AddField(myDB, myBaseTableRef,"Hint",#kTypeString,30)

   -- is anything else required?
end

Thanks.
-- 
- Zav
Now in national syndication.


More information about the Valentina mailing list