File tree Expand file tree Collapse file tree 3 files changed +25
-9
lines changed Expand file tree Collapse file tree 3 files changed +25
-9
lines changed Original file line number Diff line number Diff line change @@ -100,17 +100,20 @@ public function toValueString($expression)
100
100
101
101
private function toNeededString ($ expression , $ method )
102
102
{
103
+ if (null === $ expression )
104
+ throw new WrongArgumentException (
105
+ 'not null expression expected '
106
+ );
107
+
103
108
$ string = null ;
104
109
105
- if (null !== $ expression ) {
106
- if ($ expression instanceof DialectString) {
107
- if ($ expression instanceof Query)
108
- $ string .= '( ' .$ expression ->toDialectString ($ this ).') ' ;
109
- else
110
- $ string .= $ expression ->toDialectString ($ this );
111
- } else {
112
- $ string .= $ this ->$ method ($ expression );
113
- }
110
+ if ($ expression instanceof DialectString) {
111
+ if ($ expression instanceof Query)
112
+ $ string .= '( ' .$ expression ->toDialectString ($ this ).') ' ;
113
+ else
114
+ $ string .= $ expression ->toDialectString ($ this );
115
+ } else {
116
+ $ string .= $ this ->$ method ($ expression );
114
117
}
115
118
116
119
return $ string ;
Original file line number Diff line number Diff line change
1
+ 2012-01-11 Evgeny V. Kokovikhin
2
+
3
+ * core/DB/Dialect.class.php: throw exception for null values. Thanks to
4
+ Nikita V. Konstantinov.
5
+
1
6
2011-11-21 Alexey S. Denisov, Evgeny V. Kokovikhin
2
7
3
8
* meta/types/ObjectType.class.php, test/misc/DAOTest.class.php: changed logic
Original file line number Diff line number Diff line change @@ -210,6 +210,14 @@ public function testBaseSqlGeneration()
210
210
'(- a) ' ,
211
211
Expression::minus ('a ' )->toDialectString ($ dialect )
212
212
);
213
+
214
+ try {
215
+ Expression::eq ('id ' , null )->toDialectString ($ dialect );
216
+
217
+ $ this ->fail ();
218
+ } catch (WrongArgumentException $ e ) {
219
+ //it's Ok
220
+ }
213
221
}
214
222
215
223
public function testPgGeneration ()
You can’t perform that action at this time.
0 commit comments