Standalone and Valentina
Trevor DeVore
lists at mangomultimedia.com
Wed Dec 22 10:57:18 EST 2004
On Dec 22, 2004, at 3:18 AM, Jean-Claude SERRANO wrote:
> I have an application developed in revolution.
> This application works with a database Valentina.
> The Connection to the database is good by using Revolution on Mac OS X.
> But, I can’t connect to the database in the standalone version.
>
> Can somebody help me?
Oui, on peut vous aider.
When you build a standalone you need to make the database dll/bundles
available to your standalone executable. There are a couple of ways to
do this.
Method 1: Use the Standalone Builder
If you are using Rev 2.5 (maybe 2.2 as well, I don't remember) then you
configure your standalone application by selecting "Standalone
Application Settings..." from the file menu or the Application Browser
contextual menu. From the "General" section select the "Database
Support" checkbox and select "Valentina". In theory this should place
all the files you need for database connectivity in the folder the
Standalone Builder puts your executable in. I haven't tried it for
Valentina but I know it doesn't work for MySQL in 2.5.
Method 2: Do it manually
This is my preferred method. Once you understand how everything works
it isn't too hard and you can place the required database files
anywhere you would like. I'm an organization freak so this suits me
nicely :-)
When working with databases and Revolution you generally need two
externals whether working on OS X or Windows. The first is
revdb.dll/.bundle which is the database abstraction external for
Revolution. When you call a handler such as revOpenDatabase you are
using this external. You can find these files in the
"components/global environment/" folder in your Revolution application
folder.
The second file is the database external itself, in your case
VXCMD_macho/VXCMD.dll. These files are located in "components/global
environment/database_drivers/MacOSX/" and "components/global
environment/database_drivers/Win32/".
To begin with you must copy these files in a location where your
executable will easily be able to find them. Here is what I do:
./myExecutable.exe
./data/externals/revdb.dll
./data/externals/revdb.bundle
./data/externals/VXCMD_macho
./data/externals/VXCMD.dll
Now that the files are in the proper location you need to tell your
executable where to find the files. This requires two steps. First
you need to set the externals property of the stack used to make your
standalone so the engine knows where to find revdb.dll/.bundle. Second
you need to set the the database driver path using
revSetDatabaseDriverPath.
Though there are other ways to set externals property of a stack the
most straightforward way is to set the externals in the "startup"
handler that is called when your executable launches. You could put
something like this in your stack script:
on startup
local tExternals = ""
put sys_AppPath() & "/data/externals/revdb.dll" &cr into tExternals
put sys_AppPath() & "/data/externals/revdb.bundle" after tExternals
set the externals of this stack to tExternals
pass startup
end startup
/**
* Set the database driver path.
*/
on preOpenStack
--> TEST: DISPLAY THE EXTERNAL PACKAGES AVAILABLE TO THE STACK
--> SHOULD DISPLAY "RevDB".
answer the externalPackages of this stack
revSetDatabaseDriverPath (sys_AppPath() & "/data/externals/")
pass preOpenStack
end preOpenStack
/**
* Returns the path to the executable.
*/
function sys_AppPath
local tPath = ""
put address into tPath
set itemDel to ":"
delete item 1 of tPath
return tPath
end sys_AppPath
This code will set the externals of the stack and display a dialog box
showing which external packages are available to the stack. If
everything went as planned then the dialog box should display "RevDB".
Hopefully this will get you started. If you aren't using revDB and are
just accessing Valentina directly using the XCMD then you would do
things slightly differently. If this is the case then let me know I
can explain how to do that.
Hope this helps,
--
Trevor DeVore
Blue Mango Multimedia
trevor at mangomultimedia.com
More information about the use-livecode
mailing list