@@ -140,8 +140,8 @@ public function testSelectAliasedFieldsFromTable() {
140
140
$ this ->assertEquals (array ('foo ' => 'Second Article Body ' , 'text ' => 'Second Article Body ' , 'author_id ' => 3 ), $ result ->fetch ('assoc ' ));
141
141
142
142
$ query = new Query ($ this ->connection );
143
- $ exp = $ query ->newExpr ()-> add ( '1 + 1 ' );
144
- $ comp = $ query ->newExpr ()-> add ( ['author_id + ' => 2 ]);
143
+ $ exp = $ query ->newExpr ('1 + 1 ' );
144
+ $ comp = $ query ->newExpr (['author_id + ' => 2 ]);
145
145
$ result = $ query ->select (['text ' => 'body ' , 'two ' => $ exp , 'three ' => $ comp ])
146
146
->from ('articles ' )->execute ();
147
147
$ this ->assertEquals (array ('text ' => 'First Article Body ' , 'two ' => 2 , 'three ' => 3 ), $ result ->fetch ('assoc ' ));
@@ -220,7 +220,7 @@ public function testSelectWithJoinsConditions() {
220
220
$ this ->assertEquals (array ('title ' => 'Second Article ' , 'name ' => 'larry ' ), $ result ->fetch ('assoc ' ));
221
221
222
222
$ query = new Query ($ this ->connection );
223
- $ conditions = $ query ->newExpr ()-> add ( 'author_id = a.id ' );
223
+ $ conditions = $ query ->newExpr ('author_id = a.id ' );
224
224
$ result = $ query
225
225
->select (['title ' , 'name ' ])
226
226
->from ('articles ' )
@@ -258,7 +258,7 @@ public function testSelectAliasedJoins() {
258
258
$ this ->assertEquals (array ('title ' => 'Second Article ' , 'name ' => 'nate ' ), $ result ->fetch ('assoc ' ));
259
259
260
260
$ query = new Query ($ this ->connection );
261
- $ conditions = $ query ->newExpr ()-> add ( 'author_id = a.id ' );
261
+ $ conditions = $ query ->newExpr ('author_id = a.id ' );
262
262
$ result = $ query
263
263
->select (['title ' , 'name ' ])
264
264
->from ('articles ' )
@@ -921,7 +921,7 @@ public function testInValueCast() {
921
921
->where (function ($ exp , $ q ) {
922
922
return $ exp ->in (
923
923
'created ' ,
924
- $ q ->newExpr ()-> add ( "'2007-03-18 10:45:23' " ),
924
+ $ q ->newExpr ("'2007-03-18 10:45:23' " ),
925
925
'datetime '
926
926
);
927
927
})
@@ -936,7 +936,7 @@ public function testInValueCast() {
936
936
->where (function ($ exp , $ q ) {
937
937
return $ exp ->notIn (
938
938
'created ' ,
939
- $ q ->newExpr ()-> add ( "'2007-03-18 10:45:23' " ),
939
+ $ q ->newExpr ("'2007-03-18 10:45:23' " ),
940
940
'datetime '
941
941
);
942
942
})
@@ -1124,8 +1124,7 @@ public function testSelectOrderBy() {
1124
1124
$ this ->assertEquals (['id ' => 2 ], $ result ->fetch ('assoc ' ));
1125
1125
$ this ->assertEquals (['id ' => 3 ], $ result ->fetch ('assoc ' ));
1126
1126
1127
- $ expression = $ query ->newExpr ()
1128
- ->add (['(id + :offset) % 2 ' ]);
1127
+ $ expression = $ query ->newExpr (['(id + :offset) % 2 ' ]);
1129
1128
$ result = $ query
1130
1129
->order ([$ expression , 'id ' => 'desc ' ], true )
1131
1130
->bind (':offset ' , 1 , null )
@@ -1862,8 +1861,7 @@ public function testUpdateMultipleFieldsArray() {
1862
1861
public function testUpdateWithExpression () {
1863
1862
$ query = new Query ($ this ->connection );
1864
1863
1865
- $ expr = $ query ->newExpr ();
1866
- $ expr ->add ('title = author_id ' );
1864
+ $ expr = $ query ->newExpr ('title = author_id ' );
1867
1865
1868
1866
$ query ->update ('articles ' )
1869
1867
->set ($ expr )
@@ -2334,7 +2332,7 @@ public function testQuotingSelectFieldsAndAlias() {
2334
2332
$ this ->assertQuotedQuery ('SELECT <1 \+ 1> AS <foo>$ ' , $ sql );
2335
2333
2336
2334
$ query = new Query ($ this ->connection );
2337
- $ sql = $ query ->select (['foo ' => $ query ->newExpr ()-> add ( '1 + 1 ' )])->sql ();
2335
+ $ sql = $ query ->select (['foo ' => $ query ->newExpr ('1 + 1 ' )])->sql ();
2338
2336
$ this ->assertQuotedQuery ('SELECT \(1 \+ 1\) AS <foo>$ ' , $ sql );
2339
2337
2340
2338
$ query = new Query ($ this ->connection );
@@ -2358,7 +2356,7 @@ public function testQuotingFromAndAlias() {
2358
2356
$ this ->assertQuotedQuery ('FROM <something> AS <foo>$ ' , $ sql );
2359
2357
2360
2358
$ query = new Query ($ this ->connection );
2361
- $ sql = $ query ->select ('* ' )->from (['foo ' => $ query ->newExpr ()-> add ( 'bar ' )])->sql ();
2359
+ $ sql = $ query ->select ('* ' )->from (['foo ' => $ query ->newExpr ('bar ' )])->sql ();
2362
2360
$ this ->assertQuotedQuery ('FROM \(bar\) AS <foo>$ ' , $ sql );
2363
2361
}
2364
2362
@@ -2390,7 +2388,7 @@ public function testQuotingJoinsAndAlias() {
2390
2388
$ this ->assertQuotedQuery ('JOIN <something> <foo> ' , $ sql );
2391
2389
2392
2390
$ query = new Query ($ this ->connection );
2393
- $ sql = $ query ->select ('* ' )->join (['foo ' => $ query ->newExpr ()-> add ( 'bar ' )])->sql ();
2391
+ $ sql = $ query ->select ('* ' )->join (['foo ' => $ query ->newExpr ('bar ' )])->sql ();
2394
2392
$ this ->assertQuotedQuery ('JOIN \(bar\) <foo> ' , $ sql );
2395
2393
}
2396
2394
@@ -2406,7 +2404,7 @@ public function testQuotingGroupBy() {
2406
2404
$ this ->assertQuotedQuery ('GROUP BY <something> ' , $ sql );
2407
2405
2408
2406
$ query = new Query ($ this ->connection );
2409
- $ sql = $ query ->select ('* ' )->group ([$ query ->newExpr ()-> add ( 'bar ' )])->sql ();
2407
+ $ sql = $ query ->select ('* ' )->group ([$ query ->newExpr ('bar ' )])->sql ();
2410
2408
$ this ->assertQuotedQuery ('GROUP BY \(bar\) ' , $ sql );
2411
2409
2412
2410
$ query = new Query ($ this ->connection );
@@ -2453,7 +2451,7 @@ public function testQuotingInsert() {
2453
2451
$ this ->assertQuotedQuery ('INSERT INTO <foo> \(<bar>, <baz>\) ' , $ sql );
2454
2452
2455
2453
$ query = new Query ($ this ->connection );
2456
- $ sql = $ query ->insert ([$ query ->newExpr ()-> add ( 'bar ' )])
2454
+ $ sql = $ query ->insert ([$ query ->newExpr ('bar ' )])
2457
2455
->into ('foo ' )
2458
2456
->where (['something ' => 'value ' ])
2459
2457
->sql ();
0 commit comments