> As you can see above 1 is always equal to '1'.

You're wrong. As you can see from your own examples when you store 1
or '1' in the field a of type "text" then comparison of field a to
either 1 or '1' is always true. And at the same time comparison of
constant 1 to constant '1' is always false. Do you feel the difference
in these test cases? Try to change something in your test case. E.g.
declare your field a as type "blob" or as type "any dummy type you
like" and you'll suddenly see that 1 is not always equal to '1'.

> Do you know some language where 1='1' or 1!='1' randomly?

I don't know of any language that does anything randomly and I know
that SQLite doesn't do these comparisons "randomly" either.
Have you ever read the document I pointed you to? You better do
because it explains all subtle differences in your test cases that you
do not happen to see now.

> The internal representation of the integer and of the double is different
> and internal conversation is needed. Most modern languages make this
> for string values too.

Wow, I have never seen so far anybody calling C and C++ "not a modern
language". Or you have already proposed this feature to C++0x
standard?


Pavel


P.S. Do you realize that as long as you make some accusations of type
"SQLite doesn't work like I want it to" without ever trying to
understand why SQLite works that way nobody will treat you seriously?

On Sat, Oct 31, 2009 at 5:29 AM, Alexey Pechnikov
<pechni...@mobigroup.ru> wrote:
> Hello!
>
> On Saturday 31 October 2009 02:31:44 Simon Slavin wrote:
>>
>> On 30 Oct 2009, at 9:47pm, Alexey Pechnikov wrote:
>>
>> > Now SQLite think that 1 is equal to '1' in some causes and think
>> > different in other.
>>
>> Just like every other language, once you get into it you have to learn
>> how the language works to understand what's going on.  Your problem is
>> not really with the comparison, it's with what happens to a value when
>> it is stored in a table.  Strongly typed languages usually do one of
>> two things:
>>
>> A) not allow the comparison at all (you get a syntax error from the
>> compiler)
>>
>> B) say that two values of different types never equal one-another
>
> You did forget the third way:
>
> C) convert values to same type before comparision
>
> In C the comparision some of different types is valid:
> int x =1;
> double y=2;
> if (y>x) ...
> The internal representation of the integer and of the double is different
> and internal conversation is needed. Most modern languages make this
> for string values too.
>
> In Tcl value can has string or numeric internal representation and is 
> converted
> before comparison. When values can have the same type and is equal than the
> result of equality check is positive. When values doesn't have the same type
> or have the same type but isn't equal than equality check is negative.
>
> Best regards, Alexey Pechnikov.
> http://pechnikov.tel/
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to