Skip to content

Commit 598cc27

Browse files
committed
Type coersion for 32-bit platforms
The result type of strlen changes with word size, but mysql_stmt_prepare's third argument is fixed as an unsigned long. This explicitly coerces the type to match. On 64-bit it's optimized away.
1 parent e942086 commit 598cc27

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Sources/MySQL/Connection.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public final class Connection {
6060
// Prepares the created statement
6161
// This parses `?` in the query and
6262
// prepares them to attach parameterized bindings.
63-
guard mysql_stmt_prepare(statement, query, strlen(query)) == 0 else {
63+
guard mysql_stmt_prepare(statement, query, UInt(strlen(query))) == 0 else {
6464
throw Error.prepare(error)
6565
}
6666

0 commit comments

Comments
 (0)