in

SQLite + Query + DateTime

Last post 02-15-2008 12:52 PM by flipdoubt. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 02-11-2008 4:25 PM

    SQLite + Query + DateTime

    I've created a test SQLite database using SQLite Administrator, added a few records, and connected SubStage. Showing the existing data works like a champ! After I edit one record, however, SubStage + Scaffold insert nulls for the Date columns where NULLs are not allowed and CURRENT_DATE is the default. It seems like the scaffold does not work all that well with setting DateTime properties in a SQLite source. I say "it seems like" because it is very difficult to see properties being set using the scaffold. In fact, I'm not even sure whether the scaffold uses the generated objects when updating the the database. It looks like it uses the Query object. Is this true? Maybe the problem lies with SQLite + Query + DateTime. I know it doesn't happen with SQL Server. Any advice?

    Filed under:
  • 02-11-2008 4:58 PM In reply to

    Re: SQLite + Query + DateTime

     My assumption was correct in that Scaffold.UpdateRecord uses an Update object, not the generated business object. Having observed that, I saw the values scraped off the form, which looked good going into the Update object, the Query object, the SqlQuery object, and the QueryCommand. In the SQLiteDataProvider.AddParams method, however, all the parameters are added as DbType.AnsiString. The query gets executed, producing a result of 1, which I assume denotes success. It is not until the scaffold tries to show the resulting data in a grid that the error occurs.

    At this point, I assume the Update object counts on the data provider to use the correct data types. Is this just a problem with the Update object or will all the generated objects pass updates through the same code? Can anyone use the SQLite provider to insert or update dates? 

  • 02-11-2008 8:28 PM In reply to

    Re: SQLite + Query + DateTime

    Shouldn't SubSonic.Setting know the datatype of the value it is updating? Or, shouldn't the Update query be able to reference the table's schema? 

  • 02-11-2008 9:05 PM In reply to

    Re: SQLite + Query + DateTime

    In my amateur opinion, you can use the generated objects to update DateTime values but you can't use the Update object to update DateTime fields using the SQLiteDataProvider.

  • 02-15-2008 12:52 PM In reply to

    Re: SQLite + Query + DateTime

     Has anybody else observed the same thing? For that matter, are there many other people using SubSonic with SQLite?

Page 1 of 1 (5 items)