Newbie alert - Creating databases in Lingo

Zav - Alex Zavatone zavpublic at mac.com
Sat Apr 12 21:53:17 CDT 2003


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.

OS X 10.2.5, 512 meg ram, DMX, last week's build of Valentina.


on InitValentina
   ValentinaInit(4 * 1024 * 1024, "", "") -- cache, mac serial, win serial
end

on StopValentina
   ValentinaShutdown
end

on CreateDatabase
   -- ValentinaSetExtensions([ ])

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

   CreateDataBase(myDB,"someFilePath",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,"Username",#kTypeString,10)
   hintField = AddField(myDB, myBaseTableRef,"Username",#kTypeString,30)

end



More information about the Valentina mailing list