John Duu wrote:
> Marnen Laibow-Koser wrote:
>> John Duu wrote:
>> [...]
>>> so don't know if WHERE (defects.org IN
>>> ('NULL')) is equivalent to org IS NULL or if this syntax is a JavaDB
>>> specific.
>>
>> It is not equivalent at all. See the apostrophes around 'NULL'? That
>> means it's the literal string NULL, not the SQL null value.
>>
>> If you knew SQL, this would be trivially self-evident. Please learn
>> SQL.
>>
>> Best,
>> --
>> Marnen Laibow-Koser
>> http://www.marnen.org
>> [email protected]
>
> If WHERE (defects.org IN ('NULL')) select the string literal 'NULL',
> then the data selected is wrong, no?
>
> I would expect
> #<Defect id: 1, org: "NULL", created_at: "2010-10-04 00:14:20",
> updated_at:
> "2010-10-04 00:14:20>
>
> but instead, I actually get
>
> #<Defect id: 1, org: nil, created_at: "2010-10-04 00:14:20", updated_at:
> "2010-10-04 00:14:20>
>
> (org is string data type).
Hmm. I wonder if JavaDB stores null values as the literal "NULL", or if
the Ruby/JavaDB adaptor is at fault.
In either case, your database (or its adaptor) is doing something silly
(in that there is apparently no way to distinguish between NULL and
"NULL"), and you should certainly not rely on this silliness.
Best,
--
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.