SQLite Images and Standalone Issues
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 23
- Joined: Sun Jul 13, 2008 7:39 pm
SQLite Images and Standalone Issues
I have an app that works perfectly in development. I store and retrieve images to a SQLite database.
No issues at all.
However, when I build the runtime version, the data stored as the image data is completely corrupted and the application fails horribly.
Has anyone else experienced this?
Using LiveCode 8.1.0 dp2
No issues at all.
However, when I build the runtime version, the data stored as the image data is completely corrupted and the application fails horribly.
Has anyone else experienced this?
Using LiveCode 8.1.0 dp2
Re: SQLite Images and Standalone Issues
Try with livecode 7
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
Re: SQLite Images and Standalone Issues
You can also try to base64Encode your data before storing them, and use base64Decode to restore the original (binary) data.
-
- VIP Livecode Opensource Backer
- Posts: 23
- Joined: Sun Jul 13, 2008 7:39 pm
Re: SQLite Images and Standalone Issues
No improvement with livecode 7. Same issue.
What is most disappointing is that it works flawlessly in development mode. It is just when I compile to runtime mode that it fails.
Not sure what to do now. I will try base64Encode/deCode but I am not particularly hopeful on this.
What is most disappointing is that it works flawlessly in development mode. It is just when I compile to runtime mode that it fails.
Not sure what to do now. I will try base64Encode/deCode but I am not particularly hopeful on this.
-
- VIP Livecode Opensource Backer
- Posts: 9823
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: SQLite Images and Standalone Issues
Is the db external included in your Standalone Builder settings?Stewart Lynch wrote:What is most disappointing is that it works flawlessly in development mode. It is just when I compile to runtime mode that it fails.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: SQLite Images and Standalone Issues
Definitely make sure you encode/decode the data, and even though SQLL is very forgiving on datatypes, make sure your datatype is BLOB.
-
- VIP Livecode Opensource Backer
- Posts: 23
- Joined: Sun Jul 13, 2008 7:39 pm
Re: SQLite Images and Standalone Issues
Everything I try works just fine in development. I can use base64 encoding or not.
The problem arises when I build to a standalone.
I know that the dbexternal is included in the runtime because I can access the data that was stored during the development process. However, as soon as I build it, the storing and retrieval of the image data is corrupted.
I m about to give up and abandon the project as I have spent far too much time on this.
As I said, very disappointing.
The problem arises when I build to a standalone.
I know that the dbexternal is included in the runtime because I can access the data that was stored during the development process. However, as soon as I build it, the storing and retrieval of the image data is corrupted.
I m about to give up and abandon the project as I have spent far too much time on this.
As I said, very disappointing.
Re: SQLite Images and Standalone Issues
So did you use base64encode/decode in standalone, or not?
-
- VIP Livecode Opensource Backer
- Posts: 23
- Joined: Sun Jul 13, 2008 7:39 pm
Re: SQLite Images and Standalone Issues
Yes, I used base64encode/decode in standalone with same unsuccessful results.
Again, why does it work in development but not in standalone?
Again, why does it work in development but not in standalone?
Re: SQLite Images and Standalone Issues
Well, that's what we're trying to help you figure out. Please excuse the beginner questions, I don't know you. The standalone is on what platform? Are you sure that whatever script you are running isn't silently dying before it achieves? LC scripts, if they fail, when compiled, will do so silently. It's annoying, but it's the world we live in. Without seeing your code and a sample, it's all guessing from this end.
Compiling anything, especially something from a very forgiving scripting environment, can and does sometimes lead to different behavior. LC isn't the only tool that suffers from this malady.
Compiling anything, especially something from a very forgiving scripting environment, can and does sometimes lead to different behavior. LC isn't the only tool that suffers from this malady.
Re: SQLite Images and Standalone Issues
It could be interesting to know if the problem comes from writing or reading.
Can you read, with the standalone, images stored by the live environment ?
Can you read, in the live environment, images stored by the standalone ?
And with an other app (a DB manager, for example, there are some free for SQLite), what do you see written by your app (in both modes) ?
And if you put an image in your DB with that tool, can your app read it ? in wich mode ?
You get the idea...
Can you read, with the standalone, images stored by the live environment ?
Can you read, in the live environment, images stored by the standalone ?
And with an other app (a DB manager, for example, there are some free for SQLite), what do you see written by your app (in both modes) ?
And if you put an image in your DB with that tool, can your app read it ? in wich mode ?
You get the idea...
-
- VIP Livecode Opensource Backer
- Posts: 23
- Joined: Sun Jul 13, 2008 7:39 pm
Re: SQLite Images and Standalone Issues
The problem is definitely though writing in the standalone.
If I update the database via the runtime version, I can read it OK via the runtime version. However, as soon as I update the second (cropped image) via a snapshot and update the database, the cropped image gets corrupted somehow when updating the table.
The development version works fine. Updates to the cropped image are saved correctly
http://www.screencast.com/t/zq7izNrz
I have taken out all extraneous code from my app and built this simple example to demonstrate the problem.
Watch this video to see what I am trying to accomplish and showing how the runtime fails.
If someone else can test this stack I have attached and then build as a runtime and get the same result then I will know I am not going crazy. If it is a bug, I am not sure how even to report it.
If I update the database via the runtime version, I can read it OK via the runtime version. However, as soon as I update the second (cropped image) via a snapshot and update the database, the cropped image gets corrupted somehow when updating the table.
The development version works fine. Updates to the cropped image are saved correctly
http://www.screencast.com/t/zq7izNrz
I have taken out all extraneous code from my app and built this simple example to demonstrate the problem.
Watch this video to see what I am trying to accomplish and showing how the runtime fails.
If someone else can test this stack I have attached and then build as a runtime and get the same result then I will know I am not going crazy. If it is a bug, I am not sure how even to report it.
Re: SQLite Images and Standalone Issues
Thanks for all the information/stack/movie.
I gave a look at it, and i suspected the problem came from a lack of "metadata" about the cropped image stored in the DB. Somehow, the standalone could not figure out what to do with the retrieved data : If i saved the main image in the cropped field of the DB, it came back perfectly, but not the cropped one. This one was missing something, and that was not due to the writing/retrieving process since the other one go thru the same.
So, i gave a look at the doc and found that the "export snapshot" (on the CropIt button) can have a format specified, like AS JPEG. Simply adding this solved the issue for me. Give it a try.
For some mysterious reason the interactive livecode is more forgiving and try harder to figure out what to do with the data... but specifying a format seems to ensure the correct image header is included in the binary data, so LC know what it is when it get it back (ie how to decode it to a picture).
I gave a look at it, and i suspected the problem came from a lack of "metadata" about the cropped image stored in the DB. Somehow, the standalone could not figure out what to do with the retrieved data : If i saved the main image in the cropped field of the DB, it came back perfectly, but not the cropped one. This one was missing something, and that was not due to the writing/retrieving process since the other one go thru the same.
So, i gave a look at the doc and found that the "export snapshot" (on the CropIt button) can have a format specified, like AS JPEG. Simply adding this solved the issue for me. Give it a try.
For some mysterious reason the interactive livecode is more forgiving and try harder to figure out what to do with the data... but specifying a format seems to ensure the correct image header is included in the binary data, so LC know what it is when it get it back (ie how to decode it to a picture).
-
- VIP Livecode Opensource Backer
- Posts: 23
- Joined: Sun Jul 13, 2008 7:39 pm
Re: SQLite Images and Standalone Issues
Ormente, you are a life saver. Having been away from LiveCode for quiet some time now (I have been developing iOS and MacOS apps in Swift for the past couple of years), I am just getting back in to it and should have checked out the documentation.
I am only using LiveCode now for Desktop apps as I am more comfortable using Xcode and Swift for developing iOS apps.
Thank you for taking the time to follow this thread and offer a solution. Very much appreciated. Merci beaucoup mon ami.
I am only using LiveCode now for Desktop apps as I am more comfortable using Xcode and Swift for developing iOS apps.
Thank you for taking the time to follow this thread and offer a solution. Very much appreciated. Merci beaucoup mon ami.
Re: SQLite Images and Standalone Issues
Je t'en prie Stewart, c'était un plaisir.
Thanks Stewart, you're welcome. It's allways a pleasure to help (and i learn a lot in the process).
It's also nice i was able to reproduce the issue and fix it... on windows.
If i wanted to make a (very unfair) joke i would say that it helps a lot that livecode is really consistently bugged.
But, seriously, it was very very cool to be able to do crossplatform troubleshooting.
Thanks Stewart, you're welcome. It's allways a pleasure to help (and i learn a lot in the process).
It's also nice i was able to reproduce the issue and fix it... on windows.
If i wanted to make a (very unfair) joke i would say that it helps a lot that livecode is really consistently bugged.
But, seriously, it was very very cool to be able to do crossplatform troubleshooting.