Hello,
I want to copy my database for backup purpose, but the following code doesn't work on Android, why?
########CODE#######
on mouseUp
#close database connection
put the connID of this stack into conID
revCloseDatabase conID
#backup
if the environment is "mobile" then
put URL ( "binfile:" & SpecialFolderPath("documents") & "/gamedb.sqlite" ) into URL ("binfile:" & the text of field "corrente" & "/gamedb.bak" )
else
#impostiamoci per lavorare con i percorsi relativi
set itemDel to "/"
set the defaultFolder to item 1 to -2 of (the effective fileName of this stack)
put URL ("binfile:" & the defaultfolder & "/gamedb.sqlite" ) into URL ("binfile:" & the text of field "corrente" & "/gamedb.bak" )
end if
#salviamo l'impostazione
answer "backup eseguito"
OpenStack #this is to reconnect to the database
go to card "principale"
end mouseUp
#####END OF CODE#####
Can't copy database [SOLVED]
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Can't copy database [SOLVED]
Last edited by MaxV on Tue May 24, 2016 10:07 pm, edited 1 time in total.
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
-
- VIP Livecode Opensource Backer
- Posts: 858
- Joined: Wed Jun 24, 2009 1:17 pm
- Contact:
Re: Can't copy database
Hi MaxV - sometimes when I use URL I need to make sure there are enough brackets to ensure that the engine parses the bits I want parsed first before parsing the rest ... it probably won't solve your issue, but it just might?
EDIT: of course the other thing is, are you sure the location in field "corrente" is valid?
Code: Select all
put URL ( "binfile:" & (SpecialFolderPath("documents") & "/gamedb.sqlite" )) into URL ("binfile:" & (the text of field "corrente" & "/gamedb.bak" ))
--and
put URL ("binfile:" & (the defaultfolder & "/gamedb.sqlite" )) into URL ("binfile:" & (the text of field "corrente" & "/gamedb.bak" ))
"...this is not the code you are looking for..."
Re: Can't copy database
I fell so stupid... I had to check write external storage in the app permission.
I hate all this permission checks and requests for mobile app!
I hate all this permission checks and requests for mobile app!

Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
-
- VIP Livecode Opensource Backer
- Posts: 858
- Joined: Wed Jun 24, 2009 1:17 pm
- Contact:
Re: Can't copy database [SOLVED]
I've done that exact same thing with permissions on Android - I bet we all have...
"...this is not the code you are looking for..."