databases on iPhone

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

sylvanr
Posts: 80
Joined: Wed Nov 24, 2010 10:38 am

Re: databases on iPhone

Post by sylvanr » Wed Jan 05, 2011 9:40 pm

Here is the latest from Jacqueline at RunRev support for those that might be following the problem with databases in the iOS:

"I've done a little research while the rest of the team was gone. The problem is
with the backup file that is created on every save operation. On iOS there are no
permissions that allow creation of the backup file, so you get an error and no
save happens.

This isn't fixable or easy to work around by users. I've entered a bug report on
it and the engine will need to be altered to accomodate a different saving
behavior on mobile OS. If you are in a hurry to proceed, I'd suggest using text
files instead of stacks to save data."

bdtrauma
Posts: 34
Joined: Fri Dec 24, 2010 11:37 pm

Re: databases on iPhone

Post by bdtrauma » Thu Jan 06, 2011 12:03 pm

Interesting I put my H&P program on the ipad and it seems to be saving each card even when closing the program.... but if you turn the ipad off... goodbye data.... resets to the original data that was there when I installed the app.

Bert

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: databases on iPhone

Post by Klaus » Thu Jan 06, 2011 1:42 pm

Hi Bert,

that sounds more like some kind of caching mechanism of the iOS!


Best

Klaus

sylvanr
Posts: 80
Joined: Wed Nov 24, 2010 10:38 am

Re: databases on iPhone

Post by sylvanr » Thu Jan 06, 2011 8:55 pm

I just wanted to update everyone on the forum with another message from Jacqueline today at RunRev LiveCode support. I won't have time to work on this today as I have to actually go to work. If anyone is able to get a standalone database app to work that can save new card/records and data from multiple fields using the "launcher" method, please post to the forum. I am not sure where Jacqueline means to use the workaround script?? In the launcher stack script? In the database stack script? In a card script? In a button script? If any of this is clear to anyone, please shed some light. Will be looking forward to the actual bug fix!

Thanks to all that are following this forum and offering suggestions, ideas, example stacks and clarificaions!

Today's message from Jacqueline:


"Since I last wrote, our engineers have discovered that the problem is more due to
the backup file name than to the stack itself. They will be implementing a fix for
this on iOS.

For now, there actually is a clever workaround:

get the filename of stack tStack
if there is a file it then
rename file it to (it & ".backup")
end if
save stack tStack
if the result is empty and there is a file (it & ".backup") then
delete file (it & ".backup")
else if there is a file (it & ".backup") then
rename file (it & ".backup") to it
end if

Consider this a temporary fix, as the real problem will be fixed at the engine
level in an upcoming release."

interactbooks
Posts: 65
Joined: Thu Oct 07, 2010 4:47 pm

Re: databases on iPhone

Post by interactbooks » Fri Jan 07, 2011 3:09 am

I'm a little late stepping into this party, but I was wondering if it might be best for you to implement a SQLite database as your actual database engine. Use the code mentioned in this thread to copy the database file (which is a .db) file to your documents folder. IOS fully support SQLite and so does LiveCode. I think this may resolve all the issues that you have had and would in fact potentially give you a much more versatile database engine.

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: databases on iPhone

Post by Klaus » Fri Jan 07, 2011 12:45 pm

Hi interactbooks,

you're not only a little late, you obviously did not read this thread at all!
It is all about the current LACK of database externals for iOS and how to workaround this!
:lol:


Best

Klaus

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: databases on iPhone

Post by Klaus » Fri Jan 07, 2011 7:48 pm

@sylvanr

The next version of LC (4.5.3) has fixed the problem with the "not saving" stack in the docs folder.
So my "splash screen" and stack in CP approach will work with that version!


Best

Klaus

sylvanr
Posts: 80
Joined: Wed Nov 24, 2010 10:38 am

Re: databases on iPhone

Post by sylvanr » Sat Jan 08, 2011 12:53 am

Thanks, interactbooks, for the suggestion but I think there is a little bit more of a learning curve for what you suggest than for what we have been trying to do here. I already have old Hypercard stacks that I have imported into LiveCode easily and which worked fine with a few modifications but then quit working when imported into the iOS. LiveCode does pretty much everything I need for right now IF it would continue to function the same in the iOS as it does before importing into the iOS. I suppose that one day, I may want to play with the sql lite a little more, but was trying to avoid having to wrap my brain around the sql solution. The main attraction for me to LiveCode was that the concepts were already pretty familiar from my experiences in the past with Hypercard.

Klaus, how do I go about upgrading from version 4.5.2 to 4.5.3? Thanks!

ctflatt
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 243
Joined: Sun Dec 06, 2009 12:24 am
Contact:

Re: databases on iPhone

Post by ctflatt » Sat Jan 08, 2011 12:59 am

sylvanr:

Not sure, and I'm certainly not Klaus <<hehe>>, but I think if you purchase the Developer Program ($199USD/yr), you get access to pre-release builds, no?

:Todd

hliljegren
Posts: 111
Joined: Sun Aug 23, 2009 7:48 am
Contact:

Re: databases on iPhone

Post by hliljegren » Sat Jan 08, 2011 1:36 am

___________________________________
MacBook Pro M1 MAX 64 Gb,
LiveCode 10.0.1rc3

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: databases on iPhone

Post by Klaus » Sat Jan 08, 2011 12:49 pm

Hi all,

yes, you need to be a member of the LiveCode Developer Programm to get access to the developer previews.
But I think version 4.5.3 will be published officially some time next week.


Best

Klaus

sylvanr
Posts: 80
Joined: Wed Nov 24, 2010 10:38 am

Re: databases on iPhone

Post by sylvanr » Fri Jan 14, 2011 10:52 am

I downloaded the 4.5.3 version tonight but still can't get the database to save. Anyone else able to? Klaus, do you have a sample stack that you could post and then I could try so I can determine if it is just me or if it is still the program? Thanks.

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: databases on iPhone

Post by Klaus » Fri Jan 14, 2011 11:53 am

Hi sylvanr,

no, I do not have a sample stack, sorry.


Best

Klaus

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4163
Joined: Sun Jan 07, 2007 9:12 pm

Re: databases on iPhone

Post by bn » Fri Jan 14, 2011 1:53 pm

Hi Sylvanr,

I tried again and did a Stack "Standalone 0.0.2.livecode" and a stack "database.livecode" They are both in a folder in the zip file below.

you set up the stack Standalone with the standalone application settings for iOS, nothing special there. Then you go in the standalone application settings to copy files, there you include the "database.livecode" stack.

Then you start "Standalone" in the simulator. You click "go to database" There are some dialogs to tell you what the script of that button is doing, if it finds things etc. This is of course just for debugging.
This should start the stack "database". You can make some canges to the lower field and click the save button.
Now you can shut down the app and the next time you should see the changes in the database stack.

Some things of note: the simulator does not seem to always load the current "database" if you start the Standalone from livecode to go into the simulator. Deleting the app in the simulator helps. Seems some sort of caching?? Can be very confusing.
I did not test on an iOS device. Not at hand right now, should work though.

I did not get automatic saving to work with on closestack, on shutdownRequest. So you would have to push the save button. I dont know what messages the stack gets when the app is shut down.
It does save though on suspenStack. This message is send when you go to the "standalone" stack. There is a button "goMainStack" which should more appropriately have been named "goSplashStack" or "go Standalone stack" since the stack "standalone" is not the mainstack of the database but database is a stackfile included in the package.

So maybe this will get you started. It is now possible to save to a Stackfile between Runs of the app.

Kind regards
Attachments
standalone and Stack.zip
(4.69 KiB) Downloaded 358 times

sylvanr
Posts: 80
Joined: Wed Nov 24, 2010 10:38 am

Re: databases on iPhone

Post by sylvanr » Fri Jan 14, 2011 7:09 pm

Thanks bn! I downloaded the zip file and played with it a little and it looks like it does save my data when I close and re-open. I will play with it some more... finally some progress!!! Thanks.

Post Reply