On Mar 25, 2009, at 9:02 AM, sqlite.20.tomca...@spamgourmet.com wrote:

> Hi everyone,
>
> I'm new to sqlite and this mailing list and hope to get some help
> here. I've used SQLite for some projects now and I must say, that it
> is the fastes database I ever used. Great work!
>
> But there is one thing, that I really dislike, because I get errors
> sometimes with this and that is the type guessing or the untyped way
> sqlite returns the data. So I searched the web and found
> http://www.sqlite.org/datatype3.html where strict affinity is
> described. I thought great, but how do I enable this option.
>
> After some search I found the thread from Feb. 2008. It sounds like
> that isn't a big code change and Samuel Neff wrote exactly that what I
> think about this :
>
>> But the important point is that no matter how much discussion we  
>> have, we
>> will never all agree that untyped is better than typed or that  
>> typed is
>> better than typed.  That's why an option so individual developers  
>> can choose
>> is good.  We don't have to agree, with an option we can agree to  
>> disagree.
>>
>> Sam
>
> So now my question: Why is this not implemented? I'd really like this
> option!!


Let me just say (again) that SQLite is not "untyped".  It is  
dynamically typed.  Big difference.  SQLite is strongly typed, it just  
does not place arbitrary constraints on what types of data that can be  
stored in a particular column.  SQLite keeps the type information with  
the data itself, not on the data's container.

If you want to place a restriction on a column such that it will only  
hold an integer (for example) you can use a CHECK constraint.

      CREATE TABLE example1(x INTEGER CHECK( typeof(x)='integer' ));

D. Richard Hipp
d...@hwaci.com



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

Reply via email to