Friday, November 17, 2006

Tips for SQLite3ProfessionalPlugin

  • Tips 1

    db.RecordCount in SQLite3ProfessionalPlugin always returns -1 and I discovered that a lot of time in my code I used to check the following condition:

    rs = db.SQLSelect(" ... ")
    if (rs=nil) or (rs.RecordCount = 0) then DoSomething

    this code could be easely replaced by

    if (rs=nil) or (rs.EOF) then DoSomething
    because rs.RecordCount=0 really means rs.EOF=true in this simple test case.
  • Tips 2

    I discovered also that the SQLite3ProfessionalPlugin and DoD example can really be improved (expecially in scrolling time) if I add an index into the in memory database, so, in order to take advantage of the new trick just add the following lines at the end of SQLite3RecordSet.Constructor method:

    // CREATE INDEX
    sql = "CREATE INDEX rs_index ON rs (_SQLABS_INDEX_)"
    mDB.SQLExecute(sql)

    Query time will be slower by about 10/15% but you'll see a big scrolling speed improvement.

0 Comments:

Post a Comment

<< Home