Skip to content

Commit cf7e075

Browse files
committed
Adding a query with limits
1 parent c71e87a commit cf7e075

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

mysql-async/src/test/scala/com/github/mauricio/async/db/mysql/PreparedStatementsSpec.scala

+32-2
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,6 @@ class PreparedStatementsSpec extends Specification with ConnectionHelper {
245245

246246
"read a timestamp with microseconds" in {
247247

248-
249-
250248
val create =
251249
"""CREATE TEMPORARY TABLE posts (
252250
id INT NOT NULL AUTO_INCREMENT,
@@ -346,6 +344,38 @@ class PreparedStatementsSpec extends Specification with ConnectionHelper {
346344
}
347345
}
348346

347+
"bind parameters on a prepared statement with limit" in {
348+
349+
val create = """CREATE TEMPORARY TABLE posts (
350+
| id INT NOT NULL AUTO_INCREMENT,
351+
| some_text TEXT not null,
352+
| primary key (id) )""".stripMargin
353+
354+
val insert = "insert into posts (some_text) values (?)"
355+
val select = "select * from posts limit 100"
356+
357+
withConnection {
358+
connection =>
359+
executeQuery(connection, create)
360+
361+
1.until(10).foreach { index =>
362+
executePreparedStatement(connection, insert, "this is some text here")
363+
}
364+
365+
val row = executeQuery(connection, select).rows.get(0)
366+
367+
row("id") === 1
368+
row("some_text") === "this is some text here"
369+
370+
val queryRow = executeQuery(connection, select).rows.get(0)
371+
372+
queryRow("id") === 1
373+
queryRow("some_text") === "this is some text here"
374+
375+
376+
}
377+
}
378+
349379
}
350380

351381
}

0 commit comments

Comments
 (0)