SubSonic Forums
All Your Database Are Belong To Us

GetRecordCount() on SQLite problem.

Latest post 08-20-2008 6:13 AM by marcusio. 2 replies.
  • 08-19-2008 8:59 AM

    GetRecordCount() on SQLite problem.

     

    I was just playing around with SubSonic 2.1 Final and SQLite, and for some reason just today encountered some strange behavior (at least to me). The very first two examples on http://subsonicproject.com/querying/select-queries/ are not working (throwing invalid cast exception) for SQLite. Of course, I tried same schemas, data, code etc both SQLServer and SQLite.

     So, am I missing something? Can anyone can give me an explanation why I can’t get record count from SQLite table. No that I can’t get it other way but it’s kind of silly, those are first two examples one encounters searching for querying help.

     

    Thank you

     

  • 08-19-2008 4:29 PM In reply to

    Re: GetRecordCount() on SQLite problem.

    Can you try overriding the GetCountSelect() in SubSonic\SqlQuery\SqlGenerators\SQLiteGenerator.cs.

    The base one is probably not good
    If you can fix this plese submit a patch

    If I am I because I am I, and You are You because You are You, then I am I, and you are you. But If I am I because You are You, and You are You because I am I, then I am not I and You are not You. -Rabbi of Kotzk

  • 08-20-2008 6:13 AM In reply to

    Re: GetRecordCount() on SQLite problem.

    Reply |Contact |Answer

    Hi, I must admit I somewhat jumped in without firstly check everything possible and I’m sorry for that. Actual problem exists in July 8th final build and source, but fortunately has been solved by some kind soul recently. Exact line is 1241 (SqlQuery.cs, GetRecordCount(), count = (int)result;) where SqlClient.SqlCommand.ExecuteScalar() returns boxed Int32 and SQLite.SQLiteCommand.ExecuteScalar() returns Int64 and that’s it. Anyway thank you for your kind reply…

     

Page 1 of 1 (3 items) | RSS