4 Replies Latest reply on Apr 6, 2010 10:32 AM by stigbord

    sqlite difference between flex and javascript


      A followup on my last post:


      The .lrcat-file from Adobe Lightroom Can NOT be useb by Adobe AIR when using sqlite from javascript. (it is a regular sqlite3 file)

      But, if I use FLEX and sqlite  , I can access the database and use it as  Ilike.


      This seems very strange to me. And very annoying, as I do not know how to mix flex and ajax/html-apps. Can they use the the database? Can I send variables/arrays from flex to javascript?


      I have tried to find some documentation or a tutoria on this subject, but to no avail..stig

        • 1. Re: sqlite difference between flex and javascript
          Joe ... Ward Level 4

          There really should not be any difference whether you use Flex or JavaScript, but a bug is always a possiblity. Please report it at http://www.adobe.com/go/wish/



          • 2. Re: sqlite difference between flex and javascript
            stigbord Level 1

            I did eventually figure this one out. Not why it happens, but how to avoid it.


            It appears that if you open a database- file in the application directory, the file is not always actually opened. Sometimes it is, and sometimes not.

            If, on the other hand, you open a database-file based on it's full path from root, you'll always get it to work.


            It took me the better part of 4 days to figure this out, as I got no error messages what so ever. AIR claimed the file was open.


            I tried this so many times, and there seems to be no pattern on when things work and when they don't. A little message saying" you have opened a new, blank, empty file" would have saved med from all this lost time.


            Perhaps a good idea for the next version?


            • 3. Re: sqlite difference between flex and javascript
              Joe ... Ward Level 4

              The application directory should be considered read-only, because in fact, it is on some operating systems and configurations. Although you can try to work around this using the full path, this only gets around the AIR restrictions, so your app will still fail for some users.


              A good strategy is to treat the database file in the application directory as a template and copy it elsewhere before using it in the application.


              I agree that better error messages would be useful, although ActionScript doesn't have a concept of warnings and opening new, blank, empty files is a valid operation. As a workaround, you could do a sanity check for a known table before proceeding.

              • 4. Re: sqlite difference between flex and javascript
                stigbord Level 1

                I do agree 100% with you, but my problem was not quite that simple.


                On my first 10 -12 attempts I could read the file.

                Then it intermittently stopped working. I had the same type of file in the same folder. Perhaps if one database-file is copied to the application preferences-folder it stops looking in the application-folder for other files? I tried to dump the url of the file out in debugging, and everything looked correct as well. (I'm accessing quite a number of sqlite-databases from one application, not sure if that is normal. All are read-only)



                One error message that would be very nice is to get a distinct error that says something like " there are NO tables in you database. Are you CRAZY??" . I thought the problem was that I could not read one specific table, and it turned out there was nothing there, because it was apparently an empty file.