facebook

SQLite examples

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

    aklisiewicz
    Member

    I have asked few questions some time ago about working with SQLite databases. This was in October/2012.
    I wonder if anything has improved or was implemented towards working on record manipulation, db connections etc. towards SQLite. Ath that point that was the main reason that I did not buy the software. I have a need to create some business type Apps which will heabily rely on existing local SQLite database. I was looking for a tool which will allow to build the queries fast and then quickly bind the retrieved data to the lists, forms etc. I’m not very much interested in working on “atomic level’, simply because the customer doesn;t care what tools I use, the only thing that counts is the result, so I need to get things done fast. Basically I need to build list/forms with Insert/Update/Delete records, some filtering and sorting, and reporting.

    Is MobiOne capable of doing those type operations without spending huge amount of time and learning tons of new things ?
    I would appreciate any opinons

    Arthur

    #336817 Reply

    Yann
    Member

    Hello aklisiewicz
    I developped an application with sqlite , MB1 run as well with sqlite for me
    an example

    
    var db = openDatabase('wasdb', '1.0', 'WAS DB', 5* 1024 * 1024);
    var msg;
    function tracer()
    {
    db.transaction(function (tx) {
      tx.executeSql('CREATE TABLE IF NOT EXISTS LOGS (id unique, log)');
      tx.executeSql('INSERT INTO LOGS (id, log) VALUES (1, "Premier")');
      tx.executeSql('INSERT INTO LOGS (id, log) VALUES (2, "Second")');
      msg = '<p>Log message created and row inserted.</p>';
      document.querySelector('#status').innerHTML =  msg;
    });
    }
    function voir()
    {
    db.transaction(function (tx) {
      tx.executeSql('SELECT * FROM LOGS', [], function (tx, results) {
       var len = results.rows.length, i;
       msg = "<p>Found rows: " + len + "</p>";
       document.querySelector('#status').innerHTML +=  msg;
       for (i = 0; i < len; i++){
         msg = "<p><b>" + results.rows.item(i).log + "</b></p>";
         document.querySelector('#status').innerHTML +=  msg;
       }
     }, null);
    });
    }
    function supp()
    {
    db.transaction(function (tx) {
      tx.executeSql('DELETE FROM LOGS');
      msg = '<p>supp.</p>';
      document.querySelector('#status').innerHTML =  msg;
    });
    }
    

    hope this help you

    #336827 Reply

    Andy
    Member

    I have just started on something similar and haven’t got far enough to provide examples. I’m hoping to borrow code from this – http://www.genuitec.com/support-genuitec/viewtopic.php?f=14&t=1858 – and merge it with my database queries to create a custom list with the data.

    I’m interested in seeing what others have done.

    #336858 Reply

    nvts
    Member

    Arthur,

    No this will not do it without coding. You will have to write your own code to perform the CRUD for each table and retrieve the entries from MobiOne screens and write them back to perform CRUD.

    I have been working on a sample app to develop the CRUD tools needed for each table and replicate them for all the tables in the database.

    You have to know JS and SQL statements to perform this.

    I am a newbie and learning how this integrates with MobiOne.

    Cheers…

    #336862 Reply

    aklisiewicz
    Member

    Thanks, but I did not ask or expected no coding at all. What I was expecting is to have somewhat easier database manipulation. The bed thing is that I cannot find any serious example on how this supposed to be done in MobiOne. I can write SQL queries, but I’m not very familiar with advanced JS. I can do some simple programing but I’m not sure how much experience MobiOne expects form the developer to do things like that.

    Art

    #340435 Reply

    aklisiewicz
    Member

    @Yann wrote:

    Hello aklisiewicz
    I developped an application with sqlite , MB1 run as well with sqlite for me
    an example

    
    var db = openDatabase('wasdb', '1.0', 'WAS DB', 5* 1024 * 1024);
    var msg;
    function tracer()
    {
    db.transaction(function (tx) {
      tx.executeSql('CREATE TABLE IF NOT EXISTS LOGS (id unique, log)');
      tx.executeSql('INSERT INTO LOGS (id, log) VALUES (1, "Premier")');
      tx.executeSql('INSERT INTO LOGS (id, log) VALUES (2, "Second")');
      msg = '<p>Log message created and row inserted.</p>';
      document.querySelector('#status').innerHTML =  msg;
    });
    }
    function voir()
    {
    db.transaction(function (tx) {
      tx.executeSql('SELECT * FROM LOGS', [], function (tx, results) {
       var len = results.rows.length, i;
       msg = "<p>Found rows: " + len + "</p>";
       document.querySelector('#status').innerHTML +=  msg;
       for (i = 0; i < len; i++){
         msg = "<p><b>" + results.rows.item(i).log + "</b></p>";
         document.querySelector('#status').innerHTML +=  msg;
       }
     }, null);
    });
    }
    function supp()
    {
    db.transaction(function (tx) {
      tx.executeSql('DELETE FROM LOGS');
      msg = '<p>supp.</p>';
      document.querySelector('#status').innerHTML =  msg;
    });
    }
    

    hope this help you

    Can I see yours or any other SQLite based application working ?
    I would like to buy a license but without seing MB1 in action with SQLite I’m not going to do it.

    Arthur

    #340444 Reply

    Brandon
    Member

    You can see a sample (and download it) here: http://cincyplanet.com/mobione/templates/
    Check the notepad sample and click the demo link.
    If you search for Cincyplanet on Apple app store you can see it in action in the actual app.

    #340447 Reply

    nvts
    Member

    So, back then I asked if M1 could support or work with SQLite or MySQL. I wanted to see some examples of this working. I was sent the same link to by CincyPlanet to look at. It showed me that it could be done, but you have to know how to code in JS or PHP to make either work.

    This does require coding to make it work. There is no plug or play or drop and drag to make it happen.
    This has nothing to do with M1. It does work for both, but it takes a lot of hours to perfect a good CRUD integration for SQLite or MySQL.

    I am still perfecting a CRUD for both that can be reused for all my data apps.
    MobiOne is a great GUI to build in. It is not a code generator for manipulating custom items like this. It requires coding to do the MAGIC.

    If MobiOne did do code generating, it would be worth 5 times what the license costs and I would have paid that.
    It does work for both as I have it working, but still perfecting the reusable code.

    CincyPlanet’s example is a great start and shows that it works.

    Cheers…

Viewing 8 posts - 1 through 8 (of 8 total)
Reply To: SQLite examples

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