There are several aspects of SQLite that I don't understand, and at the top of 
this list is dates.

I have an application that writes data into a simple SQLite table with three 
fields.  Two are integers and the third is a date.  At one customer's site, 
that application was happily writing Julian dates (floating-point numbers) into 
the date field, until I did something (maybe updating my sqlite library?), and 
it suddenly started writing dates as human-readable strings.  At another 
customer's site, the same application is still writing dates as Julian dates.  
There is an ActiveX control with versions at both sites that read the databases 
and generate graphs from them.

I have a C# application using the most popular ADO .Net provider for SQLite.  
Using this application, I write dates into my databases as human-readable 
strings.  At customer A, the trend files are happily graphed.  At customer B, 
they aren't. 

So, since customer B uses Julian dates, I modified my C# application to read an 
.ini file to determine what date format to use.  If the .ini file says to use 
Julian dates, then I translate the human-readable string into a floating-point 
number using the julianday() function.  Then I try to write that value into my 
table.

The next things on my things I don't understand about SQLite are that columns 
are not restricted to one data type, and that there is no specific date format. 
 I have seen a customer A database in which the column containing the date 
happily contained a Julian date and then a human-readable string.  But, 
accepting all that without understanding it, I should be able to write a 
floating-point number into my field.  But when I tried, I got an exception with 
this message:

Invalid cast from 'Double' to 'DateTime'.Couldn't store <2455342.48371528> in 
value_timestamp Column.  Expected type is DateTime.

Huh???  I didn't think there was a DateTime type, and I thought I could write 
anything into any column!  Is this something that the ADO .Net provider is 
enforcing that doesn't really correspond to the database?  What is the 
recommended way to write a datetime value as a Julian date?

Thanks very much!

RobR



      
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to