In-Memory SQite

  1. 4 months ago

    Joel_Eisenstat

    Mar 11 User since 2016

    Good morning,
    I am using an In-Memory SQite file as a cache/holder for table rows before being uploaded to Postgres.
    However I a having difficulty reading the memory file.

    lineitemTableView.dataSet = SQLiteDatabase1.rows
    var rs = lineitemTableView.dataSet;
    var count = rs.rowCount; // count = 0 , should be 3
    rs.moveFirst();

    where count gives 0 instead of 3 - (verified as seen in the screen shot) .
    This particular code was tested on its own successfully before being included in the project .
    Is there a 'more' specific way of pointing to the SQlite memory file when there are other db files in the project ?
    Any suggestions are appreciated.

  2. marco

    Mar 11 Administrator User since 2016

    Rows seems the query you have created in SQLiteDatabase1 (very bad name, it could lead to a lot of confusion). Anyway the issue is due to the fact that the dataSet run is asynchronous so you cannot know in advance when the query completes, that's the reason why the first time it executes it returns 0 and then 3.
    If you want to be sure about the timing you should write the code in the rows.DidFinish event.

  3. Joel_Eisenstat

    Mar 11 User since 2016

    Thanks Marco ,
    While on the subject of poor nomenclature it would be helpful as part of the search option to have a search and replace option ( as I always seem to use the default settings and either forget and/or too lazy to go back).

or Sign Up to reply!