developer.jelix.org is not used any more and exists only for history. Post new tickets on the Github account.
developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#992 closed bug (fixed)

jDaoFactoryBase: findby method should handle operators checked in addCondition method when using NULL values

Reported by: mike Owned by: mike
Priority: normal Milestone: Jelix 1.0.11
Component: jelix:dao Version: 1.1.3
Severity: normal Keywords: jdaoconditions
Cc: Blocked By:
Blocking: Documentation needed: no
Hosting Provider: Php version:

Description

Since #888 the operator is now checked and we see that we can use "IS", "IS NOT", "IS NULL", "IS NOT NULL", "LIKE".... But when use "IS NULL" in addCondition, it doesn't work. Especially these cases don't work :

$conditions->addCondition('status','LIKE', null);
$conditions->addCondition('status','IS', null);
$conditions->addCondition('status','IS NULL', null);

_generateCondition method doesn't generate the query like I expect. The result query should be "myfield IS NULL" and in fact it's "myfield IS NOT NULL".

This is because the only one operator who is checked is "=", anything else would generate "myfield IS NOT NULL". This one works on 1.1.3.

$conditions->addCondition('status','=', null);

I will add a patch who corrects this bug.

Attachments (1)

patch_992.diff (2.1 KB) - added by mike 11 years ago.
Add the others operators

Download all attachments as: .zip

Change History (6)

Changed 11 years ago by mike

Add the others operators

comment:1 Changed 11 years ago by mike

  • review set to review?

It's a small patch but very useful, I think it worth to integrate it in jelix 1.1.4.

comment:2 Changed 11 years ago by laurentj

  • Milestone changed from Jelix 1.1.4 to Jelix 1.0.11
  • review changed from review? to review+

ok for me. it should be landed in 1.0.x, 1.1.x and trunk branches.

comment:3 Changed 11 years ago by laurentj

  • Resolution set to fixed
  • Status changed from new to closed

landed.

Note that the format of your patch was not very good. You must create your patch with the "hg diff" command. The svn repository is not used anymore.

Thanks for your patch.

comment:4 Changed 11 years ago by mike

Thanks! You made a small mistake in my name but no worries! For my next patches, I'll use hg, I swear ;-)

comment:5 Changed 11 years ago by laurentj

Oh sorry for your name !

Note: See TracTickets for help on using tickets.