File tree Expand file tree Collapse file tree 4 files changed +19
-5
lines changed Expand file tree Collapse file tree 4 files changed +19
-5
lines changed Original file line number Diff line number Diff line change 1
1
language : php
2
2
3
3
php :
4
+ - 7.2
4
5
- 7.1
5
6
- 7.0
6
7
- 5.6
Original file line number Diff line number Diff line change 13
13
"psr/log" : " ~1"
14
14
},
15
15
"require-dev" : {
16
- "phpunit/phpunit" : " ~4 .0" ,
16
+ "phpunit/phpunit" : " ~5 .0" ,
17
17
"phake/phake" : " 1.0.5" ,
18
18
"rkr/fakepdo" : " 0.1.*"
19
19
},
Original file line number Diff line number Diff line change @@ -151,13 +151,16 @@ public function getTableFields($table) {
151
151
* @return string
152
152
*/
153
153
public function quoteExpression ($ expression , array $ arguments = array ()) {
154
- $ func = function () use ($ arguments ) {
155
- static $ idx = -1 ;
156
- $ idx ++;
157
- $ index = $ idx ;
154
+ $ index = -1 ;
155
+ $ func = function () use ($ arguments , &$ index ) {
156
+ $ index ++;
158
157
if (array_key_exists ($ index , $ arguments )) {
159
158
$ argument = $ arguments [$ index ];
160
159
$ value = $ this ->quote ($ argument );
160
+ } elseif (count ($ arguments ) > 0 ) {
161
+ $ args = $ arguments ;
162
+ $ value = array_pop ($ args );
163
+ $ value = $ this ->quote ($ value );
161
164
} else {
162
165
$ value = 'NULL ' ;
163
166
}
Original file line number Diff line number Diff line change @@ -123,6 +123,16 @@ public function testDBExpr() {
123
123
$ this ->assertEquals ("SELECT \n\ta \nFROM \n\ttest t \nWHERE \n\t(a < '1000') \n" , $ str );
124
124
}
125
125
126
+ public function testDBExprFilter () {
127
+ $ str = TestSelect::create ()
128
+ ->field ('a ' )
129
+ ->from ('t ' , 'test ' )
130
+ ->where (new DBExprFilter ('a=? AND b=? ' , ['x ' => ['y ' => 1 ]], 'x.y ' ))
131
+ ->having (new DBExprFilter ('a=? AND b=? ' , ['x ' => ['y ' => 1 ]], 'x.y ' ))
132
+ ->asString ();
133
+ $ this ->assertEquals ("SELECT \n\ta \nFROM \n\ttest t \nWHERE \n\t(a='1' AND b='1') \nHAVING \n\t(a='1' AND b='1') \n" , $ str );
134
+ }
135
+
126
136
public function testOrder () {
127
137
$ str = TestSelect::create ()
128
138
->field ('a ' )
You can’t perform that action at this time.
0 commit comments