1. #31
    Sencha User
    Join Date
    Sep 2011
    Posts
    23
    Vote Rating
    0
    eryx is on a distinguished road

      0  

    Wink Thanks!

    Thanks!


    Hey once again.

    You're absolutely right this helps me very much for now. I almost did the same like the one you mentioned. But I should have looked at he query. Of course you must define this on the last property else it will not work

    Gretings Eryx

  2. #32
    Sencha User
    Join Date
    Feb 2012
    Posts
    12
    Vote Rating
    0
    ahaeusse is on a distinguished road

      0  

    Default


    Hi tomalex,

    thx for sharing this nice plugin. It was exactly what i was looking for.

    I am stuck with a little problem here (just started whith sencha touch).
    I have a json file containing data i want to import into my db when the app is started for the first time.
    The json is an export from a database and looks similar to this structure:

    Code:
    {"21":
        {   "firstname":"Alex",
            "lastname":"Testuser",
            "age":"43"
        },
     "22":
     {    "firstname":"Andy",
           "lastname":"Testuser2",
           "age":"23"
     },
        <here come 200 more records>
    }
    I created the database and the table using your example (worked perfect).

    Do you have a little example or idea how i could "import" my json file?

    Thx in advance.
    Alex

  3. #33
    Sencha User tomalex0's Avatar
    Join Date
    Apr 2009
    Location
    San Jose, CA
    Posts
    589
    Vote Rating
    16
    tomalex0 will become famous soon enough

      0  

    Default


    If you gone through the Demo implementation, you will find Add functionality its like

    create a record and then save it.

    Based on your json data, you will have to iterate the json object and save record in the loop.

    Code:
    [
        {
            "21": {
                "firstname": "Alex",
                "lastname": "Testuser",
                "age": "43"
            },
            "22": {
                "firstname": "Andy",
                "lastname": "Testuser2",
                "age": "23"
            }
        }
    ]
    Ext.iterate(a,function(key,obj){ 
         var rec = Ext.ModelMgr.create(obj, 'ModelName').save();
    });
    Sencha Touch Demos

    IosToggleField Forum - Github
    Form Validation
    Forum - Github
    Iphone Settings Menu
    Forum
    Sqlite Storage & Login Manifest
    Forum
    KitchenSink MVC
    Forum - Github
    SqliteProxy-v1 Forum - Github
    SqliteProxy-v2
    Forum - Github
    Arshaw Fullcalendar Forum - Github






  4. #34
    Sencha User
    Join Date
    Aug 2011
    Location
    London
    Posts
    395
    Vote Rating
    17
    digeridoopoo will become famous soon enough

      0  

    Default Clarification

    Clarification


    Pardon my ignorance, but could you explain exactly what the SQLite Proxy can be used for? Could it be used for storing large media (i.e. pictures, Video) files in an SQLite database in the browser?

    Thanks

  5. #35
    Sencha User
    Join Date
    Sep 2011
    Posts
    23
    Vote Rating
    0
    eryx is on a distinguished road

      0  

    Default Databaseversion

    Databaseversion


    Hi there it's me again

    I'm struggeling a little bit with the changeversion of the database atm and I hope you may be able to help me.

    My mainproblem is with this

    PHP Code:
        /**
         * @cfg {String} version
         * database version. If different than current, use updatedb event to update database
         */
        
    dbVersion'1.0'
    I update my database with he method changeversion from 1.0 to 2.0, altering a table and all that goes well. My problem now is I don't now how to update the one in the code above. If I set it to 2.0 it will fail at first startup but works after a restart.

    If I let it on 1.0 it will never work. Could you explain what you mean with updatedb event or how I could update the version in SqliteConnection.js.

    Thanks for your time and have a nice day

    Greetings Eryx

  6. #36
    Sencha User
    Join Date
    Feb 2012
    Posts
    20
    Vote Rating
    3
    bstrappazzon is on a distinguished road

      0  

    Default


    Hi Tomalex,

    First I want to thank you for this great proxy, I started using it in sencha 1.1 and keep using it with this new version.

    I have a little problem when trying to update an object. Actually I get my object model from the store, modify it and finally save it but the proxy keep trying to make an insert instead of and update.

    Here is some code :

    Code:
    var store = Ext.getStore('NewsStore');
    var newsRecord = store.getById(id);
                
    console.log(newsRecord, 'News'); 
    
    
    //update model with news content
    newsRecord.set('read',true);
    newsRecord.set('content','my new content');
    newsRecord.save();
    And this is my model

    Code:
    Ext.define('Kaveat.model.News', {
        extend: "Ext.data.Model",
        config: {
            fields: [
                {name: 'newsId',      type: 'int', fieldOption: 'PRIMARY KEY'},
                {name: 'type',        type: 'int'},
                {name: 'title',       type: 'string'},
                {name: 'content',     type: 'string'},
                {name: 'date',        type: 'string'},
                {name: 'read',        type: 'boolean'},
                {name: 'dateModified',type: 'string'}
            ],
            proxy: {
                type: 'sqlitestorage',
                    dbConfig: {
                        tablename: 'news',
                        dbConn: Ext.DbConnection
                    },
            }
        }
    });

    Do you have any idea on this issue?

    Again thank you for work and for your answer

    Ben

  7. #37
    Sencha User
    Join Date
    Jan 2012
    Posts
    20
    Vote Rating
    0
    hihei is on a distinguished road

      0  

    Default


    Hi Tomalex, I insert data to sqlite db withou proxy, but only with api instruction, bu I don't understand why the when I do customeStore.load() the it's empty. E declared proxy in model . . . Thank you in advance!

  8. #38
    Sencha User
    Join Date
    Mar 2012
    Posts
    28
    Vote Rating
    0
    gcw07 is on a distinguished road

      0  

    Default


    Ben, while I'm using SqliteProxy 2 and Sencha Touch 2, the same problem exists there too. I was able to finally track down the reason after back stepping through the code. It appears the system thinks it is a phantom record and because of this, it calls the create method instead of the update method. Unfortunately the only way around it so far I've found is to manually set the phantom flag:
    Code:
    newsRecord.phantom = false;
    That seems to fix it, though it isn't a great thing to manually be setting that, but don't see any other way around it at this time.

  9. #39
    Sencha User
    Join Date
    Feb 2012
    Posts
    8
    Vote Rating
    0
    dmregister is on a distinguished road

      0  

    Default SqliteProxy not working with Phonegap

    SqliteProxy not working with Phonegap


    I have been trying to get sencha 2 and sqlite 2 to work in phonegap but cant seem to.

    The problem, it seems that my dbConfig, which are the first few line in the app.js file, right above Ext.application
    Code:
    Ext.ns('DbConnection');
    var dbconnval = {
        dbName: "dbStorage",
        dbDescription: "local storage db"
    };
    Ext.DbConnection = Ext.create('Ext.Sqlite.Connection',dbconnval);
    Ext.application( etc etc)
    The DbConnection code gets executed before phonegap is ready. I have tried multiple solutions to no avail. Anyone ever had this problem?

    The error that I am getting is INVALID_STATE_ERR: DOM EXCEPTION 11: An attempt was made to use an object that is not, or is no longer usable.

    Any help would be greatly appreciated.

  10. #40
    Sencha User
    Join Date
    Mar 2012
    Location
    Bangalore
    Posts
    26
    Vote Rating
    0
    khushkedia is on a distinguished road

      0  

    Default Sqlite proxy

    Sqlite proxy


    Hello Team,

    I am trying to use the Sqllite proxy for Sencha Touch. I got the latest code from the github.

    Not knowing what exactly has to be done with it, cause am very new to Sencha touch and sqlllite,
    I put the "sqlite.js in store", "override.js in model" and "sqliteproxy.js and sqlliteconnection.js in views".

    I get an error that says sqlite.js not found. Any idea what am i missing in this.

    Thanks in advance.

    Khushbu