Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Database creation questions

First I'd like to say I am rather frustrated with the lack of doc's in creating database's. So i thought maybe someone would be able to shed some light on these questions.

  1. I created a sqlite database, inserted some data into it using RazorSQL and put it in the resource folder for my app. Built a basic statement to retrieve the data.

    var db = Titanium.Database.install('../WhatsNextMovies.sqlite','savedlist');
    
                    var rows = db.execute('SELECT * FROM savedlist');
    
                    while (rows.isValidRow())
                    {
                        Titanium.API.info(rows.field(1) + 'n' + rows.field(0));
                        rows.next();
                    }
    
                    // close database
                    rows.close();
    

    This is attached to a button for testing. In the debug window it shows only one record, which isnt anything near what I put in the database.

  2. I created insert statements in my js file and I get errors stating it can not file table, or if i use the example from KS it says it worked in the debug window but when i look at the sqlite data file in my resource folder nothing is there.

Question is where is the database so I can view what is inserted? Is it cached somewhere? Is there any example code other then the KS as that really doesnt explain how to set it up?

All I would like to do is insert data into a database, based on xml variables from a details page. Then recall that data into a table view later.

Can anyone help me out please?

— asked April 7th 2010 by Jeffrey Messick
  • cached
  • creation
  • database
  • sqlite
  • titanium.database
0 Comments

2 Answers

  • I changed the file name of my xxxxx.sqlite database file to xxxxx.db

    Don't know if this will help.

    — answered April 8th 2010 by William Xue
    permalink
    0 Comments
  • If you are developing on a Mac, the database should be created at:
    ~/Library/Application\ Support/iPhone\ Simulator/{iOS version}/Applications/{guid}/Library/Application\ Support/database/{app-name}.sql

    — answered March 24th 2011 by c leung
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.