i have one problem with data base, so the problem is that on mac i get a DB error, but on windows it works without any problem. please can you help me? why does it happen? i am attaching a simple livecode app which works on windows but gives error on mac.
Data base error on mac
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Data base error on mac
Hi everyone 
i have one problem with data base, so the problem is that on mac i get a DB error, but on windows it works without any problem. please can you help me? why does it happen? i am attaching a simple livecode app which works on windows but gives error on mac.
i have one problem with data base, so the problem is that on mac i get a DB error, but on windows it works without any problem. please can you help me? why does it happen? i am attaching a simple livecode app which works on windows but gives error on mac.
- Attachments
-
- test.zip
- (48.57 KiB) Downloaded 248 times
Last edited by AstghikM on Fri May 22, 2015 2:55 pm, edited 1 time in total.
Re: Data base error on mac
Hi AstghikM,
what does the error say and please also post the script that produces the error.
Best
Klaus
what does the error say and please also post the script that produces the error.
Best
Klaus
Re: Data base error on mac
Thank you for replyKlaus wrote:Hi AstghikM,
what does the error say and please also post the script that produces the error.
Best
Klaus
I just attached the file, the error says can't find the table "countries"
-
ToddFabacher
- Posts: 280
- Joined: Fri Jan 09, 2015 6:15 pm
Re: Data base error on mac
It seems that it is NOT problem in LiveCode, but only after it is compiled. The error seems to be in runtime, not in the LiveCode IDE.
It is an SQLite database...everything seems to be in order, but it does not work???
--Todd
It is an SQLite database...everything seems to be in order, but it does not work???
--Todd
-
ToddFabacher
- Posts: 280
- Joined: Fri Jan 09, 2015 6:15 pm
Re: Data base error on mac
The issue is with the file path. On the Mac during runtime, extra stuff is added to the path so you need to delete the extra to get the effective file path. This code will solve your problem.
Code: Select all
-- get the file path for this stack
put the effective filename of this stack into tPath
set the itemDelimiter to slash
if the platform = "MacOS" and the environment = "standalone application" then
-- if this is a standalone application running on a Mac, find the path to the .app file
repeat until last item of tPath contains ".app"
delete last item of tPath
end repeat
end if
-- remove the last item to get the path to the containing folder
delete last item of tPath
answer tPathRe: Data base error on mac
Hi AstghikM,
AHA!
What Todd says, BUT:
1. You should add your SQLite file to your standalone via the "Copy files" tab in the standalone builder!
Then you will find it here in your standalone -> specialfolderpath("engine")
2. Most users are NOT allowed to write in the "Applications" folder (same o Windows!) and even opening that db
is recoginzed as "writing" by the underlying OS, so that may produce an error!
3. Like on the mobile platform you should copy that db file to e.g. the users documents folder when the app starts
the very first time and access the db from there!
Best
Klaus
AHA!
What Todd says, BUT:
1. You should add your SQLite file to your standalone via the "Copy files" tab in the standalone builder!
Then you will find it here in your standalone -> specialfolderpath("engine")
2. Most users are NOT allowed to write in the "Applications" folder (same o Windows!) and even opening that db
is recoginzed as "writing" by the underlying OS, so that may produce an error!
3. Like on the mobile platform you should copy that db file to e.g. the users documents folder when the app starts
the very first time and access the db from there!
Best
Klaus