getkirby-v2 / toolkit

This is the deprecated toolkit for Kirby v2.
http://getkirby.com
81 stars 50 forks source link

No `something IS NULL` for SQL? #127

Closed zx1986 closed 8 years ago

zx1986 commented 8 years ago

There is no something is NULL condition for SQL, right?

not working with NULL columns :-(

    13 $failed_counter = $calloutdata->where('created_at', 'LIKE', "$today%")¬
    14                                ->andWhere('calling_result', '!=', '2')¬
    15                                ->orWhere('calling_result', 'IS', 'NULL')¬
    16                                ->count();¬
lukasbestle commented 8 years ago

I think it should work with a real null value:

    $failed_counter = $calloutdata->where('created_at', 'LIKE', "$today%")
                                  ->andWhere('calling_result', '!=', '2')
                                  ->orWhere('calling_result', 'IS', null)
                                  ->count();
zx1986 commented 8 years ago

@lukasbestle I had tried that, not work either :-(

lukasbestle commented 8 years ago

The database classes have been refactored in the Kirby 2.3 beta 2. null as value should indeed work and should have worked previously.

After reading through your code again, I don't really understand what you are trying to do. Couldn't you even remove the line where you are checking for null since it is always not equal to 2 anyway?

I'm closing this. Please reopen if you still have this issue and it is related to Kirby. Thanks.