@@ -15,7 +15,7 @@ class MySQLSampleSpec extends FlatSpec with Matchers with DBSettings with Loggin
1515 val al = AsyncLover .syntax(" al" )
1616
1717 it should " select a single value" in {
18- val id = NamedDB (' mysql ).autoCommit { implicit s =>
18+ val id = NamedDB (" mysql" ).autoCommit { implicit s =>
1919 withSQL {
2020 insert.into(AsyncLover ).namedValues(
2121 column.name -> " Eric" ,
@@ -24,15 +24,15 @@ class MySQLSampleSpec extends FlatSpec with Matchers with DBSettings with Loggin
2424 column.createdAt -> createdTime)
2525 }.updateAndReturnGeneratedKey.apply()
2626 }
27- val resultFuture : Future [Option [AsyncLover ]] = NamedAsyncDB (' mysql ).withPool { implicit s =>
27+ val resultFuture : Future [Option [AsyncLover ]] = NamedAsyncDB (" mysql" ).withPool { implicit s =>
2828 withSQL { select.from(AsyncLover as al ).where.eq(al.id, id) }.map(AsyncLover (al)).single.future()
2929 }
3030 val result = Await .result(resultFuture, 5 .seconds)
3131 result.isDefined should be(true )
3232 }
3333
3434 it should " select values as a Iterable" in {
35- val resultsFuture : Future [Iterable [AsyncLover ]] = NamedAsyncDB (' mysql ).withPool { implicit s =>
35+ val resultsFuture : Future [Iterable [AsyncLover ]] = NamedAsyncDB (" mysql" ).withPool { implicit s =>
3636 withSQL {
3737 select.from(AsyncLover as al )
3838 .where.isNotNull(al.birthday) // mysql-async 0.2.4 cannot parse nullable date value.
@@ -44,7 +44,7 @@ class MySQLSampleSpec extends FlatSpec with Matchers with DBSettings with Loggin
4444 }
4545
4646 it should " select values as a List" in {
47- val resultsFuture : Future [List [AsyncLover ]] = NamedAsyncDB (' mysql ).withPool { implicit s =>
47+ val resultsFuture : Future [List [AsyncLover ]] = NamedAsyncDB (" mysql" ).withPool { implicit s =>
4848 withSQL {
4949 select.from(AsyncLover as al )
5050 .where.isNotNull(al.birthday) // mysql-async 0.2.4 cannot parse nullable date value.
@@ -56,7 +56,7 @@ class MySQLSampleSpec extends FlatSpec with Matchers with DBSettings with Loggin
5656 }
5757
5858 it should " read values with convenience methods" in {
59- val generatedIdFuture : Future [Long ] = NamedAsyncDB (' mysql ).withPool { implicit s =>
59+ val generatedIdFuture : Future [Long ] = NamedAsyncDB (" mysql" ).withPool { implicit s =>
6060 withSQL {
6161 insert.into(AsyncLover ).namedValues(
6262 column.name -> " Eric" ,
@@ -67,7 +67,7 @@ class MySQLSampleSpec extends FlatSpec with Matchers with DBSettings with Loggin
6767 }
6868 // in AsyncLover#apply we are using get with typebinders, specialized getters should work
6969 val generatedId = Await .result(generatedIdFuture, 5 .seconds)
70- val created = NamedDB (' mysql ).readOnly { implicit s =>
70+ val created = NamedDB (" mysql" ).readOnly { implicit s =>
7171 withSQL { select.from(AsyncLover as al ).where.eq(al.id, generatedId) }.map((rs : WrappedResultSet ) => {
7272 AsyncLover (
7373 id = rs.get[Long ](al.resultName.id),
@@ -87,7 +87,7 @@ class MySQLSampleSpec extends FlatSpec with Matchers with DBSettings with Loggin
8787 }
8888
8989 it should " return generated key" in {
90- val generatedIdFuture : Future [Long ] = NamedAsyncDB (' mysql ).withPool { implicit s =>
90+ val generatedIdFuture : Future [Long ] = NamedAsyncDB (" mysql" ).withPool { implicit s =>
9191 withSQL {
9292 insert.into(AsyncLover ).namedValues(
9393 column.name -> " Eric" ,
@@ -99,7 +99,7 @@ class MySQLSampleSpec extends FlatSpec with Matchers with DBSettings with Loggin
9999 }
100100 // the generated key should be found
101101 val generatedId = Await .result(generatedIdFuture, 5 .seconds)
102- val created = NamedDB (' mysql ).readOnly { implicit s =>
102+ val created = NamedDB (" mysql" ).readOnly { implicit s =>
103103 withSQL { select.from(AsyncLover as al ).where.eq(al.id, generatedId) }.map(AsyncLover (al)).single.apply()
104104 }.get
105105 created.id should equal(generatedId)
@@ -111,7 +111,7 @@ class MySQLSampleSpec extends FlatSpec with Matchers with DBSettings with Loggin
111111
112112 it should " update" in {
113113 // updating queries should be successful
114- NamedDB (' mysql ) autoCommit { implicit s =>
114+ NamedDB (" mysql" ) autoCommit { implicit s =>
115115 withSQL { delete.from(AsyncLover ).where.eq(column.id, 1004 ) }.update.apply()
116116 withSQL {
117117 insert.into(AsyncLover ).namedValues(
@@ -122,21 +122,21 @@ class MySQLSampleSpec extends FlatSpec with Matchers with DBSettings with Loggin
122122 column.createdAt -> createdTime)
123123 }.update.apply()
124124 }
125- val deletion : Future [Int ] = NamedAsyncDB (' mysql ).withPool { implicit s =>
125+ val deletion : Future [Int ] = NamedAsyncDB (" mysql" ).withPool { implicit s =>
126126 withSQL { delete.from(AsyncLover ).where.eq(column.id, 1004 ) }.update.future()
127127 }
128128 Await .result(deletion, 5 .seconds)
129129
130130 // should be committed
131- val deleted = NamedDB (' mysql ).readOnly { implicit s =>
131+ val deleted = NamedDB (" mysql" ).readOnly { implicit s =>
132132 withSQL { select.from(AsyncLover as al ).where.eq(al.id, 1004 ) }.map(AsyncLover (al)).single.apply()
133133 }
134134 deleted.isDefined should be(false )
135135 }
136136
137137 it should " execute" in {
138138 // execution should be successful
139- val id = NamedDB (' mysql ).autoCommit { implicit s =>
139+ val id = NamedDB (" mysql" ).autoCommit { implicit s =>
140140 withSQL {
141141 insert.into(AsyncLover ).namedValues(
142142 column.name -> " Chris" ,
@@ -145,13 +145,13 @@ class MySQLSampleSpec extends FlatSpec with Matchers with DBSettings with Loggin
145145 column.createdAt -> createdTime)
146146 }.updateAndReturnGeneratedKey.apply()
147147 }
148- val deletion : Future [Boolean ] = NamedAsyncDB (' mysql ).withPool { implicit s =>
148+ val deletion : Future [Boolean ] = NamedAsyncDB (" mysql" ).withPool { implicit s =>
149149 withSQL { delete.from(AsyncLover ).where.eq(column.id, id) }.execute.future()
150150 }
151151 Await .result(deletion, 5 .seconds)
152152
153153 // should be committed
154- val deleted = NamedDB (' mysql ).readOnly { implicit s =>
154+ val deleted = NamedDB (" mysql" ).readOnly { implicit s =>
155155 withSQL { select.from(AsyncLover as al ).where.eq(al.id, id) }.map(AsyncLover (al)).single.apply()
156156 }
157157 deleted.isDefined should be(false )
@@ -160,7 +160,7 @@ class MySQLSampleSpec extends FlatSpec with Matchers with DBSettings with Loggin
160160 it should " update in a local transaction" in {
161161 (1 to 10 ).foreach { _ =>
162162
163- val generatedIdFuture : Future [Long ] = NamedAsyncDB (' mysql ).localTx { implicit tx =>
163+ val generatedIdFuture : Future [Long ] = NamedAsyncDB (" mysql" ).localTx { implicit tx =>
164164 withSQL(insert.into(AsyncLover ).namedValues(
165165 column.name -> " Patric" ,
166166 column.rating -> 2 ,
@@ -169,7 +169,7 @@ class MySQLSampleSpec extends FlatSpec with Matchers with DBSettings with Loggin
169169 ).updateAndReturnGeneratedKey.future
170170 }
171171 val generatedId = Await .result(generatedIdFuture, 5 .seconds)
172- val created = NamedDB (' mysql ).readOnly { implicit s =>
172+ val created = NamedDB (" mysql" ).readOnly { implicit s =>
173173 withSQL { select.from(AsyncLover as al ).where.eq(al.id, generatedId) }.map(AsyncLover (al)).single.apply()
174174 }.get
175175 created.id should equal(generatedId)
@@ -183,10 +183,10 @@ class MySQLSampleSpec extends FlatSpec with Matchers with DBSettings with Loggin
183183 it should " rollback in a local transaction" in {
184184 (1 to 10 ).foreach { _ =>
185185
186- NamedDB (' mysql ).autoCommit { implicit s =>
186+ NamedDB (" mysql" ).autoCommit { implicit s =>
187187 withSQL { delete.from(AsyncLover ).where.eq(column.id, 1003 ) }.update.apply()
188188 }
189- val failureFuture : Future [Unit ] = NamedAsyncDB (' mysql ).localTx { implicit tx =>
189+ val failureFuture : Future [Unit ] = NamedAsyncDB (" mysql" ).localTx { implicit tx =>
190190 import FutureImplicits ._
191191 for {
192192 _ <- insert.into(AsyncLover ).namedValues(
@@ -208,7 +208,7 @@ class MySQLSampleSpec extends FlatSpec with Matchers with DBSettings with Loggin
208208 failureFuture.value.get.isFailure should be(true )
209209
210210 // should be rolled back
211- val notCreated = NamedDB (' mysql ).readOnly { implicit s =>
211+ val notCreated = NamedDB (" mysql" ).readOnly { implicit s =>
212212 withSQL { select.from(AsyncLover as al ).where.eq(al.id, 1003 ) }.map(AsyncLover (al)).single.apply()
213213 }
214214 notCreated.isDefined should be(false )
@@ -218,7 +218,7 @@ class MySQLSampleSpec extends FlatSpec with Matchers with DBSettings with Loggin
218218 it should " provide transaction by AsyncTx.withSQLBuilders" in {
219219 (1 to 10 ).foreach { _ =>
220220
221- val deletionAndCreation : Future [Seq [AsyncQueryResult ]] = NamedAsyncDB (' mysql ).withPool { implicit s =>
221+ val deletionAndCreation : Future [Seq [AsyncQueryResult ]] = NamedAsyncDB (" mysql" ).withPool { implicit s =>
222222 AsyncTx .withSQLBuilders(
223223 delete.from(AsyncLover ).where.eq(column.id, 997 ),
224224 insert.into(AsyncLover ).namedValues(
@@ -233,7 +233,7 @@ class MySQLSampleSpec extends FlatSpec with Matchers with DBSettings with Loggin
233233 deletionAndCreation.value.get.get.size should be(2 )
234234
235235 // should be found
236- val created = NamedDB (' mysql ).readOnly { implicit s =>
236+ val created = NamedDB (" mysql" ).readOnly { implicit s =>
237237 withSQL { select.from(AsyncLover as al ).where.eq(al.id, 997 ) }.map(AsyncLover (al)).single.apply()
238238 }.get
239239 created.id should equal(997 )
@@ -247,10 +247,10 @@ class MySQLSampleSpec extends FlatSpec with Matchers with DBSettings with Loggin
247247 it should " provide transactional deletion by AsyncTx.withSQLBuilders" in {
248248 (1 to 10 ).foreach { _ =>
249249
250- NamedDB (' mysql ).autoCommit { implicit s =>
250+ NamedDB (" mysql" ).autoCommit { implicit s =>
251251 withSQL { delete.from(AsyncLover ).where.eq(column.id, 998 ) }.update.apply()
252252 }
253- val creationAndDeletion : Future [Seq [AsyncQueryResult ]] = NamedAsyncDB (' mysql ).withPool { implicit s =>
253+ val creationAndDeletion : Future [Seq [AsyncQueryResult ]] = NamedAsyncDB (" mysql" ).withPool { implicit s =>
254254 AsyncTx .withSQLBuilders(
255255 insert.into(AsyncLover ).namedValues(
256256 column.id -> 998 ,
@@ -265,7 +265,7 @@ class MySQLSampleSpec extends FlatSpec with Matchers with DBSettings with Loggin
265265 creationAndDeletion.value.get.get.size should be(2 )
266266
267267 // should be committed
268- val deleted = NamedDB (' mysql ).readOnly { implicit s =>
268+ val deleted = NamedDB (" mysql" ).readOnly { implicit s =>
269269 withSQL { select.from(AsyncLover as al ).where.eq(al.id, 998 ) }.map(AsyncLover (al)).single.apply()
270270 }
271271 deleted.isDefined should be(false )
@@ -275,7 +275,7 @@ class MySQLSampleSpec extends FlatSpec with Matchers with DBSettings with Loggin
275275 it should " rollback in a transaction when using AsyncTx.withSQLs" in {
276276 (1 to 10 ).foreach { _ =>
277277
278- val failure : Future [Seq [AsyncQueryResult ]] = NamedAsyncDB (' mysql ).withPool { implicit s =>
278+ val failure : Future [Seq [AsyncQueryResult ]] = NamedAsyncDB (" mysql" ).withPool { implicit s =>
279279 AsyncTx .withSQLs(
280280 insert.into(AsyncLover ).namedValues(
281281 column.id -> 999 ,
@@ -294,7 +294,7 @@ class MySQLSampleSpec extends FlatSpec with Matchers with DBSettings with Loggin
294294 }
295295 failure.value.get.isSuccess should be(false )
296296
297- val notFound = NamedDB (' mysql ).readOnly { implicit s =>
297+ val notFound = NamedDB (" mysql" ).readOnly { implicit s =>
298298 withSQL { select.from(AsyncLover as al ).where.eq(al.id, 999 ) }.map(AsyncLover (al)).single.apply()
299299 }
300300 notFound.isDefined should be(false )
0 commit comments