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 11language : php
22
33php :
4+ - 7.2
45 - 7.1
56 - 7.0
67 - 5.6
Original file line number Diff line number Diff line change 1313 "psr/log" : " ~1"
1414 },
1515 "require-dev" : {
16- "phpunit/phpunit" : " ~4 .0" ,
16+ "phpunit/phpunit" : " ~5 .0" ,
1717 "phake/phake" : " 1.0.5" ,
1818 "rkr/fakepdo" : " 0.1.*"
1919 },
Original file line number Diff line number Diff line change @@ -151,13 +151,16 @@ public function getTableFields($table) {
151151 * @return string
152152 */
153153 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 ++;
158157 if (array_key_exists ($ index , $ arguments )) {
159158 $ argument = $ arguments [$ index ];
160159 $ value = $ this ->quote ($ argument );
160+ } elseif (count ($ arguments ) > 0 ) {
161+ $ args = $ arguments ;
162+ $ value = array_pop ($ args );
163+ $ value = $ this ->quote ($ value );
161164 } else {
162165 $ value = 'NULL ' ;
163166 }
Original file line number Diff line number Diff line change @@ -123,6 +123,16 @@ public function testDBExpr() {
123123 $ this ->assertEquals ("SELECT \n\ta \nFROM \n\ttest t \nWHERE \n\t(a < '1000') \n" , $ str );
124124 }
125125
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+
126136 public function testOrder () {
127137 $ str = TestSelect::create ()
128138 ->field ('a ' )
You can’t perform that action at this time.
0 commit comments