Skip to content

Commit 6fcd6c9

Browse files
committed
Changing parameters counter to use .count
1 parent 13e9c2c commit 6fcd6c9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mysql-async/src/main/scala/com/github/mauricio/async/db/mysql/MySQLConnection.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ class MySQLConnection(
234234

235235
def sendPreparedStatement(query: String, values: Seq[Any]): Future[QueryResult] = {
236236
this.validateIsReadyForQuery()
237-
val totalParameters = query.foldLeft(0) { (acc, c) => if ( c == '?' ) acc + 1 else acc }
237+
val totalParameters = query.count( _ == '?')
238238
if ( values.length != totalParameters ) {
239239
throw new InsufficientParametersException(totalParameters, values)
240240
}

0 commit comments

Comments
 (0)