@@ -21,8 +21,8 @@ public function testSimple(): void {
21
21
$ database = TestHelper::getDatabase ();
22
22
if ($ database != NULL ) {
23
23
$ query = new QueryImpl ($ database , 'dual ' );
24
- $ query ->add (Restrictions::eq ('aName ' , 'aValue ' ));
25
- $ query ->addOrder (Order::asc ('anotherName ' ));
24
+ $ query ->where (Restrictions::eq ('aName ' , 'aValue ' ));
25
+ $ query ->orderBy (Order::asc ('anotherName ' ));
26
26
$ this ->assertEquals ('SELECT * FROM `dual` WHERE (`aName` = \'aValue \') ORDER BY `anotherName` ' , $ query ->getSelectSql ());
27
27
}
28
28
}
@@ -41,7 +41,7 @@ public function testSimpleProjection(): void {
41
41
$ database = TestHelper::getDatabase ();
42
42
if ($ database != NULL ) {
43
43
$ query = new QueryImpl ($ database , 'dual ' );
44
- $ query ->setProjection (Projections::rowCount ('cnt ' ));
44
+ $ query ->select (Projections::rowCount ('cnt ' ));
45
45
$ this ->assertEquals ('SELECT COUNT(*) AS `cnt` FROM `dual` ' , $ query ->getSelectSql ());
46
46
}
47
47
}
@@ -50,7 +50,7 @@ public function testSetColumns(): void {
50
50
$ database = TestHelper::getDatabase ();
51
51
if ($ database != NULL ) {
52
52
$ query = new QueryImpl ($ database , 'dual ' );
53
- $ query ->setColumns (Projections::property ('column1 ' ), Projections::property ('column2 ' ));
53
+ $ query ->select (Projections::property ('column1 ' ), Projections::property ('column2 ' ));
54
54
$ this ->assertEquals ('SELECT `column1`, `column2` FROM `dual` ' , $ query ->getSelectSql ());
55
55
}
56
56
}
@@ -59,7 +59,7 @@ public function testCombineColumns(): void {
59
59
$ database = TestHelper::getDatabase ();
60
60
if ($ database != NULL ) {
61
61
$ query = new QueryImpl ($ database , 'dual ' );
62
- $ query ->setColumns (Projections::properties ('column1 ' , 'column2 ' ));
62
+ $ query ->select (Projections::properties ('column1 ' , 'column2 ' ));
63
63
$ this ->assertEquals ('SELECT `column1`, `column2` FROM `dual` ' , $ query ->getSelectSql ());
64
64
}
65
65
}
@@ -68,7 +68,7 @@ public function testAddColumns(): void {
68
68
$ database = TestHelper::getDatabase ();
69
69
if ($ database != NULL ) {
70
70
$ query = new QueryImpl ($ database , 'dual ' );
71
- $ query ->addColumns (Projections::property ('column1 ' ))->addColumns (Projections::property ('column2 ' ));
71
+ $ query ->select (Projections::property ('column1 ' ))->select (Projections::property ('column2 ' ));
72
72
$ this ->assertEquals ('SELECT `column1`, `column2` FROM `dual` ' , $ query ->getSelectSql ());
73
73
}
74
74
}
@@ -77,7 +77,7 @@ public function testJoin(): void {
77
77
$ database = TestHelper::getDatabase ();
78
78
if ($ database != NULL ) {
79
79
$ query = new QueryImpl ($ database , 'dual ' , NULL , 'a ' );
80
- $ query ->createJoinedQuery ('otherTable ' , 'b ' , Restrictions::eqProperty (array ('a ' , 'details ' ), array ('b ' , 'uid ' )));
80
+ $ query ->createJoin ('otherTable ' , 'b ' , Restrictions::eqProperty (array ('a ' , 'details ' ), array ('b ' , 'uid ' )));
81
81
$ this ->assertEquals ('SELECT `a`.* FROM `dual` AS `a` INNER JOIN `otherTable` AS `b` ON `a`.`details` = `b`.`uid` ' , $ query ->getSelectSql ());
82
82
}
83
83
}
@@ -151,7 +151,7 @@ public function testDeleteWhereSql(): void {
151
151
$ database = TestHelper::getDatabase ();
152
152
if ($ database != NULL ) {
153
153
$ query = new QueryImpl ($ database , 'dual ' );
154
- $ query ->add (Restrictions::eq ('attr3 ' , 'value3 ' ));
154
+ $ query ->where (Restrictions::eq ('attr3 ' , 'value3 ' ));
155
155
$ this ->assertEquals ("DELETE FROM `dual` WHERE (`attr3` = 'value3') " , $ query ->getDeleteSql ());
156
156
}
157
157
}
@@ -161,10 +161,10 @@ public function testGroupBySql(): void {
161
161
if ($ database != NULL ) {
162
162
$ query = new QueryImpl ($ database , 'dual ' );
163
163
$ query
164
- ->addColumns (Projections::property ('attr1 ' ), Projections::rowCount ('cnt ' ))
165
- ->add (Restrictions::eq ('attr3 ' , 'value3 ' ))
164
+ ->select (Projections::property ('attr1 ' ), Projections::rowCount ('cnt ' ))
165
+ ->where (Restrictions::eq ('attr3 ' , 'value3 ' ))
166
166
->groupBy (Projections::property ('attr1 ' ));
167
- $ this ->assertEquals ("SELECT `attr1`, COUNT(*) AS `cnt` FROM `dual` GROUP BY `attr1` WHERE (`attr3` = 'value3') " , $ query ->getSelectSql ());
167
+ $ this ->assertEquals ("SELECT `attr1`, COUNT(*) AS `cnt` FROM `dual` WHERE (`attr3` = 'value3') GROUP BY `attr1` " , $ query ->getSelectSql ());
168
168
}
169
169
}
170
170
@@ -173,11 +173,11 @@ public function testHavingSql(): void {
173
173
if ($ database != NULL ) {
174
174
$ query = new QueryImpl ($ database , 'dual ' );
175
175
$ query
176
- ->addColumns (Projections::property ('attr1 ' ), Projections::rowCount ('cnt ' ))
177
- ->add (Restrictions::eq ('attr3 ' , 'value3 ' ))
176
+ ->select (Projections::property ('attr1 ' ), Projections::rowCount ('cnt ' ))
177
+ ->where (Restrictions::eq ('attr3 ' , 'value3 ' ))
178
178
->groupBy (Projections::property ('attr1 ' ))
179
179
->having (Restrictions::eq ('attr1 ' , 'value1 ' ));
180
- $ this ->assertEquals ("SELECT `attr1`, COUNT(*) AS `cnt` FROM `dual` GROUP BY `attr1` HAVING (`attr1 ` = 'value1 ') WHERE (`attr3 ` = 'value3 ') " , $ query ->getSelectSql ());
180
+ $ this ->assertEquals ("SELECT `attr1`, COUNT(*) AS `cnt` FROM `dual` WHERE (`attr3 ` = 'value3 ') GROUP BY `attr1` HAVING (`attr1 ` = 'value1 ') " , $ query ->getSelectSql ());
181
181
}
182
182
}
183
183
0 commit comments