Page 1 of 1
Livecode Database functions fail
Posted: Thu Jun 20, 2013 1:47 pm
by gdmipad
I've been playing around with the livecode database functions with success for some time.
Since a few weeks none of the database functions work anymore.
Not in livecode 4.6.2 and not in livecode community 6.0.2.
The error I get is :
(Function: error in function handler) near "revOpenDatabase", char 12
Has anyone encountered the same problem ? What am I doing wrong here ?
Re: Livecode Database functions fail
Posted: Thu Jun 20, 2013 1:53 pm
by Klaus
Hi gdmipad,
please post the (relevant parts of) the script.
Best
Klaus
Re: Livecode Database functions fail
Posted: Thu Jun 20, 2013 2:17 pm
by gdmipad
Hi Klaus,
I get this error in every stack where database functions are used.
Also in the example stacks provided by Livecode, i.e. :
on mouseUp
local tDatabasePath, tSQLQuery
## Connect to the database
## Save the connection id
put specialFolderPath("desktop") & "/Beginners Course/Lesson 5/Sample Stacks/emailaddresses.sqlite" into tDatabasePath
put revOpenDatabase("sqlite",tDatabasePath,,,,) into sDatabaseID
## Check that the connection was successful
if sDatabaseID is not a number then
answer "Could not connect to database"
end if
end mouseUp
OR when trying to connect to a mysql database :
put revOpenDatabase("mysql", tDatabaseAddress, tDatabaseName, tDatabaseUser, tDatabasePassword) into tResult
(--> can't post the domain references here because my account doesn't permit)
I always get the same error on the revOpenDatabase function.
As if it can't find the library or something ? It seems like livecode doesn't recognize the function...
Re: Livecode Database functions fail
Posted: Thu Jun 20, 2013 2:42 pm
by Klaus
Hi gdmipad,
Ok, here we go...
1. Put the variable declaration at the top of the script and not within the mouseup-handler:
#########################
local tDatabasePath, tSQLQuery
on mouseup
...
########################
2. You are using two different variable names:
...
put revOpenDatabase("sqlite",tDatabasePath,,,,) into sDatabaseID
...
sDatabaseID <> tDatabaseID
Best
Klaus
Re: Livecode Database functions fail
Posted: Thu Jun 20, 2013 2:59 pm
by gdmipad
Hi Klaus,
I placed the declarations outside the mouseup handler but with no success.
I only used sDatabaseID as far as I can see, besides I copied the code straight from the livecode samples code.
I don't think the problem lies in the code because I've tested several Livecode samples connecting to different
databases (sqlite, mysql).
Livecode doesn't recognize the function revOpenDatabase for some reason

Re: Livecode Database functions fail
Posted: Thu Jun 20, 2013 3:30 pm
by Klaus
Oops, sorry, my fault, I mixed sDatabasePath with sDatabaseID.
Hm, is sDataBaseID declared somehwere as local of global?
And is this a standalone? Mac or Win?
You could check if the database driver got copied to the "externals" folder when building a standalone.
Re: Livecode Database functions fail
Posted: Thu Jun 20, 2013 4:21 pm
by gdmipad
Hi Klaus,
I finally resolved my problem by completely erasing Livecode and reinstalling it.
Then in preferences - Compatibility I had to download new drivers and use the legacy drivers.
After closing down Livecode and restarting Livecode it finally worked.
Thanx for your feedback on this matter !
Re: Livecode Database functions fail
Posted: Thu Jun 20, 2013 5:01 pm
by Klaus
Hi gdmipad,
glad you could solve it! But that's too funky, innit?
Best
Klaus
Re: Livecode Database functions fail
Posted: Thu Jun 20, 2013 7:05 pm
by gdmipad
I certainly lost some hairs during the process
