On 2014/07/15 13:48, Edward Ned Harvey (sqlite) wrote:
I would really love to have an easy way of putting a long? into the database,
and then getting a long? back out. Maybe it exists and I'm just doing it the
hard way right now...
I guess what I'm really getting at is this: The 5 data types in sqlite are Null, Integer,
Real, Text, and Blob. These all have native counterparts in C#, specifically: null, long?
(or Nullable<long>), double? (or Nullable<double>), string, and byte[].
If I have something like a long? or a double?, and I want to natively store it
and retrieve it, I am surprised such a thing doesn't exist. Instead, I have to
check for null and if so, then store System.DBNull, and when I retrieve it, I
have to check for System.DBNull and if so, then return null...
System.DBNull is not a native SQLite construct, it is probably one of the third party connectors. SQLite supports natively a lot of
methods for data typing that might not be obvious to the TCL or native to third party connectors. Using the API directly one can not
only access these other methods but also add innumerable conversion routines to suit your flavour of project variable types.
That said, I am sure that if you were using the API natively, or able to do so, the question would never arise, so I understand that
this is not an option. Further to this, I am not sure which development environment you are using, I am guessing some C or scripting
format or such, all of which support different data typing, and more importantly, none of which is a standard or used in a wide
variety of systems - which is why the other poster did not even know what you meant with "long?". SQLite's narrow set of types play
to the advantage of being connectable to all the myriad of platforms it supports, but sadly with it comes the caveat of not having
many specific types and some of the base types are maybe a bit too wide - I believe they are getting fleshed out a bit in SQLite4.
Maybe ask the designers of your connector for such functionality?
Either way, I hope you find a suitable solution, and if you do manage to get a change for the connector in support of your quest, be
sure to let us know!
Cheers,
Ryan
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users