@@ -35,12 +35,12 @@ class DatabaseFacadeTest extends DatabaseBaseTest {
3535 " id1" | " nice set" | 1000
3636 " id2" | " another set" | 2000 }
3737
38- PRICES . createQuery (). should == [" ID" | " DESCRIPTION" | " PRICE" ] {
38+ PRICES . query (). should == [" ID" | " DESCRIPTION" | " PRICE" ] {
3939 ___________________________________
4040 " id1" | " nice set" | 1000
4141 " id2" | " another set" | 2000 }
4242
43- db. createQuery (" select * from PRICES where id='id2'" ). should ==
43+ db. query (" select * from PRICES where id='id2'" ). should ==
4444 [" ID" | " DESCRIPTION" | " PRICE" ] {
4545 __________________________________
4646 " id2" | " another set" | 2000 }
@@ -82,7 +82,7 @@ class DatabaseFacadeTest extends DatabaseBaseTest {
8282 cell. guid | " nice set" | true | " card" | cell. above + 10 // cell.above refers values above and can be modified with simple math operations
8383 cell. guid | " another set" | permute(true , false ) | permute(" rts" , " fps" ) | cell. above + 20 } // permute generates additional rows generating new rows with all the permutations
8484
85- doc. capture(' db-setup-permute-table' , PRICES . query())
85+ doc. capture(' db-setup-permute-table' , PRICES . query(). tableData() )
8686 PRICES . query(). numberOfRows(). should == 6
8787 }
8888
@@ -93,7 +93,7 @@ class DatabaseFacadeTest extends DatabaseBaseTest {
9393 def PRICES = db. table(" PRICES" )
9494 PRICES << data. csv. table(' prices-db.csv' )
9595
96- doc. capture(' db-setup-csv-table' , PRICES . query())
96+ doc. capture(' db-setup-csv-table' , PRICES . query(). tableData() )
9797 PRICES . should == [ " *ID" | " DESCRIPTION" | " AVAILABLE" | " TYPE" | " PRICE" ] {
9898 __________________________________________________________
9999 " id1" | " description1" | true | " card" | 200
@@ -118,7 +118,7 @@ class DatabaseFacadeTest extends DatabaseBaseTest {
118118 setupPrices()
119119
120120 // query without where clause start
121- def prices = db. createQuery (" select * from PRICES" )
121+ def prices = db. query (" select * from PRICES" )
122122 prices. should == [" ID" | " DESCRIPTION" | " PRICE" ] {
123123 ___________________________________
124124 " id1" | " nice set" | 1000
@@ -130,7 +130,7 @@ class DatabaseFacadeTest extends DatabaseBaseTest {
130130 void " query table with select statement and param" () {
131131 setupPrices()
132132 // query with where clause start
133- def prices = db. createQuery (" select * from PRICES where id=:id" , [id : " id1" ])
133+ def prices = db. query (" select * from PRICES where id=:id" , [id : " id1" ])
134134 prices. should == [" ID" | " DESCRIPTION" | " PRICE" ] {
135135 ___________________________________
136136 " id1" | " nice set" | 1000 }
@@ -141,7 +141,7 @@ class DatabaseFacadeTest extends DatabaseBaseTest {
141141 void " create query is lazy" () {
142142 setupPrices()
143143 // query with where clause start
144- def prices = db. createQuery (" select * from PRICES" )
144+ def prices = db. query (" select * from PRICES" )
145145
146146 prices. shouldNot == []
147147 db. update(" delete from PRICES" )
@@ -154,7 +154,7 @@ class DatabaseFacadeTest extends DatabaseBaseTest {
154154 setupPrices()
155155 // query with where clause start
156156 def PRICES = db. table(" PRICES" )
157- def numberOfItems = PRICES . createCountQuery ()
157+ def numberOfItems = PRICES . queryCount ()
158158
159159 numberOfItems. shouldNot == 0
160160 db. update(" delete from PRICES" )
@@ -166,7 +166,7 @@ class DatabaseFacadeTest extends DatabaseBaseTest {
166166 void " query table to match one row and assert against map" () {
167167 setupPrices()
168168 // query with where clause start
169- def prices = db. createQuery (" select * from PRICES where id=:id" , [id : " id1" ])
169+ def prices = db. query (" select * from PRICES where id=:id" , [id : " id1" ])
170170 prices. should == [ID : " id1" , " DESCRIPTION" : " nice set" , PRICE : 1000 ]
171171 // query with where clause end
172172 }
@@ -175,15 +175,15 @@ class DatabaseFacadeTest extends DatabaseBaseTest {
175175 void " query table to match one row using single param shortcut and assert against map" () {
176176 setupPrices()
177177 // query with where clause start
178- def prices = db. createQuery (" select * from PRICES where id=:id or external_id=:id" , " id1" )
178+ def prices = db. query (" select * from PRICES where id=:id or external_id=:id" , " id1" )
179179 prices. should == [ID : " id1" , " DESCRIPTION" : " nice set" , PRICE : 1000 ]
180180 // query with where clause end
181181 }
182182
183183 @Test
184184 void " query table to match multiple row and assert against map" () {
185185 setupPrices()
186- def prices = db. createQuery (" select * from PRICES" )
186+ def prices = db. query (" select * from PRICES" )
187187
188188 code {
189189 prices. should == [ID : " id1" , " DESCRIPTION" : " nice set" , PRICE : 1000 ]
@@ -194,7 +194,7 @@ class DatabaseFacadeTest extends DatabaseBaseTest {
194194 void " query table with select statement and array param" () {
195195 setupPrices()
196196 // query with where clause start
197- def prices = db. createQuery (" select * from PRICES where id in (:ids)" , [ids : [" id1" , " id2" ]])
197+ def prices = db. query (" select * from PRICES where id in (:ids)" , [ids : [" id1" , " id2" ]])
198198 prices. should == [" ID" | " DESCRIPTION" | " PRICE" ] {
199199 ___________________________________
200200 " id1" | " nice set" | 1000
@@ -213,7 +213,7 @@ class DatabaseFacadeTest extends DatabaseBaseTest {
213213 }
214214
215215 // query with where clause start
216- def count = db. createQuery (" select count(*) from PRICES" )
216+ def count = db. query (" select count(*) from PRICES" )
217217 count. should == 2
218218
219219 // event happen somewhere to increase the number of rows...
@@ -227,7 +227,7 @@ class DatabaseFacadeTest extends DatabaseBaseTest {
227227 void " should query single value" () {
228228 setupPrices()
229229
230- def price = db. createQuery (" select price from PRICES where id='id1'" )
230+ def price = db. query (" select price from PRICES where id='id1'" )
231231 price. should == 1000
232232 price. shouldNot == 2000
233233 }
@@ -237,7 +237,7 @@ class DatabaseFacadeTest extends DatabaseBaseTest {
237237 setupPrices()
238238
239239 // query single value params start
240- def price = db. createQuery (" select price from PRICES where id=:id" , [id : ' id1' ])
240+ def price = db. query (" select price from PRICES where id=:id" , [id : ' id1' ])
241241 price. should == 1000
242242 price. shouldNot == 2000
243243 // query single value params end
@@ -247,8 +247,8 @@ class DatabaseFacadeTest extends DatabaseBaseTest {
247247 void " value returned from query is a special wrapper value" () {
248248 setupPrices()
249249 // single value access start
250- def price = db. createQuery (" select price from PRICES where id=:id" , [id : ' id1' ])
251- if (price. querySingleValue () > 100 ) {
250+ def price = db. query (" select price from PRICES where id=:id" , [id : ' id1' ])
251+ if (price. singleValue () > 100 ) {
252252 println (" do something" )
253253 }
254254 // single value access end
@@ -265,10 +265,10 @@ class DatabaseFacadeTest extends DatabaseBaseTest {
265265 @Test
266266 void " should run updates with params" () {
267267 def PRICES = setupPrices()
268- doc. capture(' db-before-update' , PRICES . query())
268+ doc. capture(' db-before-update' , PRICES . query(). tableData() )
269269
270270 db. update(" update PRICES set price=:price where id=:id" , [id : ' id2' , price : 4000 ])
271- doc. capture(' db-after-update' , PRICES . query())
271+ doc. capture(' db-after-update' , PRICES . query(). tableData() )
272272
273273 PRICES . should == [" ID" | " DESCRIPTION" | " PRICE" ] {
274274 ___________________________________
0 commit comments