facebook

Great sample: How to create and use Local DB Storage

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #311981 Reply

    Albatros78
    Participant

    Wayne,

    I would like to post this item into How to section, but not possible to send attached files …. Grrrrr !!!

    Here the main subject o this item:

    Hi Guys,

    I posted here my sample of “How to create a local db storage with Mb1” !!!

    Thanks Wayne for your help about JS calling function, sometimes not too clear with not doucmentation 🙂

    2 words:
    ——–
    1)
    This zipped file include 2 directories. One for Native Web browsers into html5, and second which is my mb1 application.
    You can use the HTML5 project with Firefox and Chrome (look at my post at http://www.genuitec.com/support-mobione/viewtopic.php?f=14&t=1036 about how to use Chrome debugger… very nice.
    Not tested with IE from my side…

    The second project is for your mb1 software (v1.0m9u4). It works perfectly into the simulator. Open the test center on the right to check the local storage and use the application.

    You can create DB, Table, Records…Etc….and see all of them into the live window on the right

    2)
    Wayne,
    There is one bug from mb1 in this example (commented ..)
    Look at my Sample_DB_custom js file. I have commented at the beginning the bug. I call a function inside another one. I don’t know if it the bug reason, but try it into test center like is explained at item 1, and you can see by yourself that test center not functionnal as explained into my js file
    Any feedback from you side will be nice to undertand this bug reason !

    Hope this helps

    Enjoy guys ….

    Attachments:
    You must be logged in to view attached files.
    #312395 Reply

    skashi
    Member

    Hi Albatros78

    Thanks for your post. It was very helpful.

    In response to your bug in your mb1 code your function is called as such:
    AutoCreateTable();

    And it should just be like this:
    autoCreateTable();

    Hope this helps

    Skashi

    #312415 Reply

    Albatros78
    Participant

    Hi skashi

    You’re welcome !

    Hope this sample was effective for you.

    Thanks for your comment about the bug. in fact not really bug but just bad wording of function name.

    I will do better next time 🙂

    #312463 Reply

    Albatros78
    Participant

    Hello Wayne,

    I just checked fix solution from skashi
    and it works. fine !

    But 2 things:

    – The call function must be spelled autoCreateTable() and not AutoCreateTable()
    AND the function name also MUST BE autoCreateTabel and not AutoCreateTable

    – Why the function name cannot be speeled with an uppercase letter ? Bug ?

    #312896 Reply

    shadow
    Member

    Hi everybody!

    i tried to use your stuff and all is working good when I try to create the db, the tabel and the fields but unfortunately it doesn’t save my job and when I leave MobiOne and re-enter, I can’t see the db…is it normal?

    Thanks,

    Shadow

    #312908 Reply

    Albatros78
    Participant

    Hello Shadow,

    Normally the db and table are always created, even if you leave emulator.

    Just somes infos to help you.

    Run gain my sample.
    – Create a DB “demo1”
    – Create a table “Table1”
    – and click twice to add 2 records. Normall the “John Travolta” record will be added twice, into your table

    Leave MobiOne Emulator and design

    Modify by hand the Sample_DB_custom.js file and change the line

    tx.executeSql(“INSERT INTO ” + MyTable + ” (firstname,lastname,phone,email) VALUES (?,?,?,?) “,[‘Travolta’,’John’,’0102030405′,’john@travolta.net’],function(tx,result)

    by a new one like:

    tx.executeSql(“INSERT INTO ” + MyTable + ” (firstname,lastname,phone,email) VALUES (?,?,?,?) “,[‘Albatros’,’test’,’0102030405′,’john@travolta.net’],function(tx,result)

    and:
    – Create again a DB with SAME name
    – Create a table with SAME name.

    Click add record.

    Normally your db will be populate with the previous records and also new one

    Hope this helps

    #318196 Reply

    exstyle
    Member

    Hello,

    how can I put the database in my template?

    Greets Timur

    #318223 Reply

    support-michael
    Keymaster

    @exstyle
    The current template model is limited to only design files, not custom javascript code. We are working on a more advanced template model that will provide more advanced support such as creation of multiple pages with custom actions. That is still a couple of months away.

    #322932 Reply

    Ravikant83
    Member

    Hello,

    I am new with MobiOne. how can we populate records as list on iphone from table? can we use search filter in record selection?

    Thanks
    Ravikant

    #324885 Reply

    Max87
    Member

    Hi guys,
    how to work with database on several pages?
    I’d like to create database while main page is loading(this works), on another page I have a button, when is clicked calls function which saves values from text fields from that page(not working).
    The code is in main_custom.js.

    #324898 Reply

    Max87
    Member

    Thanks Octavio. Have you ETA for example 🙂 ?

    #330868 Reply

    aklisiewicz
    Member

    @Albatros78 wrote:

    Wayne,

    I would like to post this item into How to section, but not possible to send attached files …. Grrrrr !!!

    Here the main subject o this item:

    Hi Guys,

    I posted here my sample of “How to create a local db storage with Mb1” !!!

    Thanks Wayne for your help about JS calling function, sometimes not too clear with not doucmentation 🙂

    2 words:
    ——–
    1)
    This zipped file include 2 directories. One for Native Web browsers into html5, and second which is my mb1 application.
    You can use the HTML5 project with Firefox and Chrome (look at my post at http://www.genuitec.com/support-mobione/viewtopic.php?f=14&t=1036 about how to use Chrome debugger… very nice.
    Not tested with IE from my side…

    The second project is for your mb1 software (v1.0m9u4). It works perfectly into the simulator. Open the test center on the right to check the local storage and use the application.

    Enjoy guys ….

    is this WWebSQL or SQLite ?
    Arthur

Viewing 12 posts - 1 through 12 (of 12 total)
Reply To: Great sample: How to create and use Local DB Storage

You must be logged in to post in the forum log in