Error when DB opened in subfolder containing é
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Error when DB opened in subfolder containing é
Found an odd bug, any ideas or can someone point me at the best place to report it to the guys at RunRev?
Basically, everything works fine with our app as long as its installed in a folder that uses regular UK/USA characters, but if we add an é into the folder name, for example create a folder under applications called 'données' and run the app from there when we try to open the database the command returns revdberr,invalid database type
Its an sqlite database, and the actual database path we are trying to open does not contain the é, it is just the path to application itself is in that contains the character.
Any ideas?
Andy
Basically, everything works fine with our app as long as its installed in a folder that uses regular UK/USA characters, but if we add an é into the folder name, for example create a folder under applications called 'données' and run the app from there when we try to open the database the command returns revdberr,invalid database type
Its an sqlite database, and the actual database path we are trying to open does not contain the é, it is just the path to application itself is in that contains the character.
Any ideas?
Andy
Hi Andy,
this is the place to report bugs:
http://quality.runrev.com/qacenter/
But it is a real shame that Rev still cannot handle paths with accents in the name correctly. This would definitively NOT be the case if they were french or czech or something.
But alas their are native english (well, sort of
) speakers, and thus a bit ignorant to other languages by nature 
this is the place to report bugs:
http://quality.runrev.com/qacenter/
But it is a real shame that Rev still cannot handle paths with accents in the name correctly. This would definitively NOT be the case if they were french or czech or something.
But alas their are native english (well, sort of


-
- VIP Livecode Opensource Backer
- Posts: 1005
- Joined: Sat Apr 08, 2006 3:06 pm
- Contact:
I have the latest release version 3 build 750 for mac, ive also restarted in v2.8 and 2.9 and compiled the app and had the same issue.
Problem occurs on both Mac and Windows builds, its quite easy to reproduce.
The other bug the databases seem to have is they fail on certain requests when called on OS X Tiger 10.4.10 or later. Earlier builds of Tiger and all Leopard versions work fine, and the legacy drivers work just fine so Ill report that one too! Took me a while to find that error when it was reported by a user!
Thanks
Andy
Problem occurs on both Mac and Windows builds, its quite easy to reproduce.
The other bug the databases seem to have is they fail on certain requests when called on OS X Tiger 10.4.10 or later. Earlier builds of Tiger and all Leopard versions work fine, and the legacy drivers work just fine so Ill report that one too! Took me a while to find that error when it was reported by a user!
Thanks
Andy
-
- VIP Livecode Opensource Backer
- Posts: 1005
- Joined: Sat Apr 08, 2006 3:06 pm
- Contact:
I'm using the latest 3.0 version as well and I just tested an app that uses SQLite and didn't see any problems if I added an é to the name of one of the folders (changed Program to Programé) in the application path. I also tested your 'données' example and that worked fine as well. I'm testing on OS X 10.5.
I wonder what the other variable is? I load all externals myself rather than relying on the standalone builder and I set the path to the database drivers using revSetDatabaseDriverPath.
I wonder what the other variable is? I load all externals myself rather than relying on the standalone builder and I set the path to the database drivers using revSetDatabaseDriverPath.
Trevor DeVore
ScreenSteps - https://www.screensteps.com
LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder
ScreenSteps - https://www.screensteps.com
LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder
Im afraid it still fails Trevor.
code im using (now!) to set the datbase driver path is...
to open the database im using....
If there is an accent in any character in the path to the application, 'it' returns revdberr,invalid database type. If there are no accents, it works fine.
It only affects compiled apps as well, works fine in the editor.
Its an odd one!
Im compiling in OS X 10.5 as well, and testing in both Mac and Windows, both have the same problem.
Is there an error in my code somewhere?
Andy
code im using (now!) to set the datbase driver path is...
Code: Select all
set the itemDelimiter to "/"
revsetdatabasedriverpath ((item 1 to -2 of the effective fileName of this stack) & "/Externals/database_drivers/")
Code: Select all
set the itemDelimiter to "/"
put (item 1 to -2 of the effective fileName of this stack) & "/data/diary.db" into gDiaryDBPath
get revOpenDatabase ("sqlite",gDiarydbPath, , , , )
put it into gDiarydbID
It only affects compiled apps as well, works fine in the editor.
Its an odd one!
Im compiling in OS X 10.5 as well, and testing in both Mac and Windows, both have the same problem.
Is there an error in my code somewhere?
Andy
-
- VIP Livecode Opensource Backer
- Posts: 1005
- Joined: Sat Apr 08, 2006 3:06 pm
- Contact:
I just put together a test stack and here is what I found.
I create a new stack with a button that had this script:
I configured the standalone properties so that sqlite db support was included. I built a standalone and clicked the button. A database was successfully created.
Next I changed the name of the folder that application was in so that it contained é. I tested again and saw the same error you are reporting.
Next I added the following code to the card script:
I rebuilt the application, placed the dbsqlite.bundle in the same folder as the application and tested. Clicking the button prompted me for a file but I never saw an answer dialog which was odd. I then changed the code in the card so that it executed on openstack rather than preopenstack:
I rebuilt the application, copied over dbsqlite.bundle and tested with success. I then changed the folder name so that it had an é and the test still was successful.
So it appears that setting the path to the folder where dbsqlite.bundle is stored using revSetDatabaseDriverPath does make a difference but it may fail depending on when you set the path. I imagine that Revolution hasn't loaded the database external when preopenstack is sent which is why I had problems with my first test.
I create a new stack with a button that had this script:
Code: Select all
on mouseUp pMouseBtnNo
ask file "Select file"
if the result is not "cancel" then
put revOpenDatabase("sqlite", it,,,,) into theResult
answer theResult
end if
end mouseUp
Next I changed the name of the folder that application was in so that it contained é. I tested again and saw the same error you are reporting.
Next I added the following code to the card script:
Code: Select all
on preopenstack
put the address into theFolder
set the itemdelimiter to ":"
put item 2 to -1 of theFolder into theFolder
set the itemdelimiter to slash
if item -3 to -2 of theFolder is "Contents/MacOS" then
delete item -4 to -1 of theFolder
end if
revSetDatabaseDriverPath theFolder
answer theFolder
end preopenstack
Code: Select all
on openstack
put the address into theFolder
set the itemdelimiter to ":"
put item 2 to -1 of theFolder into theFolder
set the itemdelimiter to slash
if item -3 to -2 of theFolder is "Contents/MacOS" then
delete item -4 to -1 of theFolder
end if
revSetDatabaseDriverPath theFolder
answer theFolder
end openstack
So it appears that setting the path to the folder where dbsqlite.bundle is stored using revSetDatabaseDriverPath does make a difference but it may fail depending on when you set the path. I imagine that Revolution hasn't loaded the database external when preopenstack is sent which is why I had problems with my first test.
Trevor DeVore
ScreenSteps - https://www.screensteps.com
LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder
ScreenSteps - https://www.screensteps.com
LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder
Thanks for giving this a go Trevor, its appreciated.
Im afraid on my system, even if I copy our code exactly and move the sqlite bundle into the same folder as the app in the package, its still failing.
It must be something to do with the code in the existing app or my mac, so Im going to start with a brand new empty app in the morning, just with your code and see if I can get that to work.
What I had completely overlooked was the put revOpenDatabase command instead of get revOpenDatabase, ive swapped all my gets to puts and its surprising how much faster it all runs, so thats a bonus - thanks!
Hopefully I can get the code you have to work and figure out exactly what is happening, Ill let you know as soon as Ive tried it.
Andy
Im afraid on my system, even if I copy our code exactly and move the sqlite bundle into the same folder as the app in the package, its still failing.
It must be something to do with the code in the existing app or my mac, so Im going to start with a brand new empty app in the morning, just with your code and see if I can get that to work.
What I had completely overlooked was the put revOpenDatabase command instead of get revOpenDatabase, ive swapped all my gets to puts and its surprising how much faster it all runs, so thats a bonus - thanks!
Hopefully I can get the code you have to work and figure out exactly what is happening, Ill let you know as soon as Ive tried it.
Andy
Thanks again for the code Trevor, I have moved a step closer!
It does now work if I use your code exactly and put the dbsqlite.bundle directly into the same folder as the application, whatever the folder is called.
If however I put the dbsqlite.bundle in the application package (which is where I have to have it unfortunately as I cant have a dbsqlite.bundle file in the main applications folder!) it still fails when you try to run the app from a folder containing an accent.
Im thinking maybe I can check on the application startup to see if the user has installed in the default applications folder, and if not copy the bundle into the folder they have installed in and set the path, maybe that will work around the problem.
Not ideal, but at least Im getting closer to the problem.
Thanks again for the help.
Andy
It does now work if I use your code exactly and put the dbsqlite.bundle directly into the same folder as the application, whatever the folder is called.
If however I put the dbsqlite.bundle in the application package (which is where I have to have it unfortunately as I cant have a dbsqlite.bundle file in the main applications folder!) it still fails when you try to run the app from a folder containing an accent.
Im thinking maybe I can check on the application startup to see if the user has installed in the default applications folder, and if not copy the bundle into the folder they have installed in and set the path, maybe that will work around the problem.
Not ideal, but at least Im getting closer to the problem.
Thanks again for the help.
Andy
OK, this is where im at....
If the dbsqlite.bundle file is in the same path as the application, and the database path is set, it works.
If the dbsqlite.bundle file is within same package as the application, and the application is in a 'regular folder', it works.
If however the dbsqlite.bundle file is within same package as the application, and the application is in a folder with accents etc, even with the database path set, it fails.
The obvious quick fix is to check the path of the application, see if it contains anything that could cause and issue, and if so copy the database drivers somewhere they will work, and set the path.
Ive quickly written some code that works to do this as follows...
This works fine, BUT only if I MOVE the folder and dont use the revCopyFolder. The copy command somehow destroys the bundle so it doesnt work, but move works fine.
Ideally Id want to copy the folder and leave an original in the package as the user could move the app to another folder later and it would then fail as the database drivers would have been moved out earlier.
Any ideas on the best way to copy a bundle from one location to another within rev and keep it working?
This so far is still better than what I had as at least it works, and I can add another routine to trap the error if the files are not there at all and ask the user to reinstall.
Thanks again
Andy
If the dbsqlite.bundle file is in the same path as the application, and the database path is set, it works.
If the dbsqlite.bundle file is within same package as the application, and the application is in a 'regular folder', it works.
If however the dbsqlite.bundle file is within same package as the application, and the application is in a folder with accents etc, even with the database path set, it fails.
The obvious quick fix is to check the path of the application, see if it contains anything that could cause and issue, and if so copy the database drivers somewhere they will work, and set the path.
Ive quickly written some code that works to do this as follows...
Code: Select all
on openStack
if the platform is "MacOS" then
if (replacetext(the effective fileName of this stack, "[a-zA-Z0-9 /.,_:]()","") is not empty) then
put the address into theFolder
set the itemdelimiter to ":"
put item 2 to -1 of theFolder into theFolder
set the itemdelimiter to slash
if item -3 to -2 of theFolder is "Contents/MacOS" then
delete item -4 to -1 of theFolder
end if
put theFolder & "/dbsqlite.bundle" into theNewFolder
-- check to see if the database drivers have already been moved to the new location
if there is not a folder theNewfolder then
-- no? move or copy them if they exist in the package
put ((item 1 to -2 of the effective fileName of this stack) & "/Externals/database_drivers/dbsqlite.bundle") into theOldFolder
if there is a folder theOldFolder then
revMoveFolder theOldFolder,theNewFolder
end if
end if
revSetDatabaseDriverPath theFolder
end if
end if -- end if platform is mac os
end openStack
Ideally Id want to copy the folder and leave an original in the package as the user could move the app to another folder later and it would then fail as the database drivers would have been moved out earlier.
Any ideas on the best way to copy a bundle from one location to another within rev and keep it working?
This so far is still better than what I had as at least it works, and I can add another routine to trap the error if the files are not there at all and ask the user to reinstall.
Thanks again
Andy
-
- VIP Livecode Opensource Backer
- Posts: 1005
- Joined: Sat Apr 08, 2006 3:06 pm
- Contact:
Convert the folder path to UTF-8 before passing it to revSetDatabaseDriverPath. If you do this then it will work even if the folder is inside the app bundle.
unidecode( uniencode(theFolder), "utf8")
unidecode( uniencode(theFolder), "utf8")
Trevor DeVore
ScreenSteps - https://www.screensteps.com
LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder
ScreenSteps - https://www.screensteps.com
LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder
Thanks!
That has fixed the problem completely.
Thanks again for the help, I would never have worked it out.
The code ive ended up with in case anyone else hits this issue is simply....
That has fixed the problem completely.
Thanks again for the help, I would never have worked it out.
The code ive ended up with in case anyone else hits this issue is simply....
Code: Select all
on openStack
set itemdel to slash
put ((item 1 to -2 of the effective fileName of this stack) & "/Externals/database_drivers/") into theFolder
revSetDatabaseDriverPath unidecode(uniencode(theFolder), "utf8")
end openStack