On 11 Aug, Gerry Snyder wrote:
> fred238 wrote:
>> Gerry Snyder a écrit :
>>> fred238 wrote:
>>>> Is necessary to set column datatype in sqlite3 ?
>>>> Is better to use class storage in sqlite3 (TEXT, NUMERIC, INTEGER, 
>>>> REAL, NONE)  ?
>>>>
>>> Check out http://www.sqlite.org/datatype3.html and ask again here if 
>>> yu have further questions.
>>>
>> already read it and i don't understand all
> 
> Ok, I will try to help a little.
> 
> You do not need to set data types. If you don't, the default affinity 
> will be NUMERIC. That is, anything that looks like a number will be 
> stored as an integer or a real, as appropriate. This can waste some time 
> if you want to use the value as a string, but in general should not be a 
> real problem.
> 
> Specifying datatypes may make things easier for some strongly typed 
> languages (I don't really know--I use Tcl myself).

I disagree (although I also use Tcl). If you store eg. the string '08'
in a column with type NUMERIC, you'll get '8' back, in later
SELECTs. And that is probably not what you want. Set the column type
to 'TEXT' in such cases.

As in tcl, with 'eq' and '=='. Use 

  if {$a eq $b} {...}

to test for string identity, and

  if {$a == $b} {...}

to test for equal numeric values.

I see dynamic typing as a feature (well, I'm using tcl). But this does
not mean, it is without pitfalls.

rolf



-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to