Skip to content

Commit

Permalink
Fixed Incorrect arguments to mysqld_stmt_execute
Browse files Browse the repository at this point in the history
This error appears to only happen on CI and not locally, despite
everything running with the same version. I have no idea why this is the
case.

Since I removed the `nil` from the prepared statement, it is possible
that this problem is related to the issues linked below, but I'm not sure. I also
don't really know how to debug in github actions yet, so I don't know
how to confirm if this is indeed the case.

- go-sql-driver/mysql#209
- launchbadge/sqlx#125
- https://stackoverflow.com/questions/16726752/sending-null-in-a-prepared-statement-for-mysql-doesnt-seem-to-work?rq=1
  • Loading branch information
shuhaowu committed Apr 28, 2021
1 parent 736aa9e commit 2ef520f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/helpers/db_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,13 @@ def seed_random_data(connection, database_name: DEFAULT_DB, table_name: DEFAULT_
return if number_of_rows == 0

transaction(connection) do
sqlargs = (["(?,?)"]*number_of_rows).join(", ")
sql = "INSERT INTO #{dbtable} (id, data) VALUES #{sqlargs}"
sqlargs = (["(?)"]*number_of_rows).join(", ")
sql = "INSERT INTO #{dbtable} (data) VALUES #{sqlargs}"
insert_statement = connection.prepare(sql)

rand_rows = []
number_of_rows.times do
rand_rows += [nil, rand_data]
rand_rows += [rand_data]
end

insert_statement.execute(*rand_rows)
Expand Down

0 comments on commit 2ef520f

Please sign in to comment.