Andre,
humm... how do I address the VCXMD directly? I put it into externals property and reloaded the IDE, is this enought?
Here's the basics that I use - the rest you can get from the docs Jan pointed you to:
global gValentinaInit,gMainDBRef
on StartupDB get Valentina("SetDebugLevel",3) if not(gValentinaInit) then get Valentina("Init",20*1024*1024,YourMacLicenseCode,YourWindowsLicenseCode) if (it contains "ERROR") then put false into gValentinaInit -- Call your error handler here else put true into gValentinaInit end if end if end StartupDB
on ShutdownDB if gValentinaInit then get Valentina("Shutdown") put false into gValentinaInit end ShutdownDB
on OpenDB pDBPath put Valentina("Database_Open",pDBPath) into temp if (temp contains "ERROR") then -- call your error handler here else put temp into gMainDBRef end if end OpenDB
on CloseDB get Valentina("Database_Close",gMainDBRef) put "" into gMainDBRef end CloseDB
-- Then to make a simple query that gets all the data from the People table put Valentina("Database_SQLSelectRecords",gMainDBRef,"SELECT * FROM People") into tRecs
Hope this helps,
Ken Ray Sons of Thunder Software Email: [EMAIL PROTECTED] Web Site: http://www.sonsothunder.com/
One word of warning, though. The above example will work nicely when only a single stack opens and closes Valentina. I mean closing the engine not db files. However, when working in IDE it is possible to have multiple stacks opening and closing Valentina, and one could close Valentina without another one knowing about it, leading to a likely crash. So, one should also have a global monitoring the number of open stacks. More complicated but more reliable approach is for gValentinaInit (in the above example) to be a counter of init requests (instead of being a simple true/false flag). Each open must be then matched but a close which descreases the count and actually closes the kernel only when it is 0.
if (gValentinaInit=0) thenon StartupDB get Valentina("SetDebugLevel",3)
put 1 into gValentinaInitget Valentina("Init",20*1024*1024,YourMacLicenseCode,YourWindowsLicenseCode) if (it contains "ERROR") then put false into gValentinaInit -- Call your error handler here else
end if
else add 1 to gValentinaInit
end if end StartupDB
on ShutdownDB
substract 1 from gValentinaInit if gValentinaInit = 0 then get Valentina("Shutdown")
end ShutdownDB
If all your stacks use such a code, then you can close and open then in any order.
Robert Brenstein _______________________________________________ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution