Skip to content

Commit cf8e924

Browse files
MyXQL: quote locks (#443)
Closes #441.
1 parent 0efa366 commit cf8e924

4 files changed

Lines changed: 5 additions & 5 deletions

File tree

Earthfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ integration-test-mysql:
9999
--pull "mysql:$MYSQL"
100100
RUN set -e; \
101101
timeout=$(expr $(date +%s) + 30); \
102-
docker run --name mysql --network=host -d -e MYSQL_ROOT_PASSWORD=root "mysql:$MYSQL"; \
102+
docker run --name mysql --network=host -d -e MYSQL_ROOT_PASSWORD=root "mysql:$MYSQL" --sql_mode="ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,ANSI_QUOTES"; \
103103
# wait for mysql to start
104104
while ! mysqladmin ping --host=127.0.0.1 --port=3306 --protocol=TCP --silent; do \
105105
test "$(date +%s)" -le "$timeout" || (echo "timed out waiting for mysql"; exit 1); \

integration_test/myxql/migrations_test.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ defmodule Ecto.Integration.MigrationsTest do
1616
end
1717

1818
describe "Migrator" do
19-
@get_lock_command ~s[SELECT GET_LOCK("ecto_Ecto.Integration.PoolRepo", -1)]
20-
@release_lock_command ~s[SELECT RELEASE_LOCK("ecto_Ecto.Integration.PoolRepo")]
19+
@get_lock_command ~s[SELECT GET_LOCK('ecto_Ecto.Integration.PoolRepo', -1)]
20+
@release_lock_command ~s[SELECT RELEASE_LOCK('ecto_Ecto.Integration.PoolRepo')]
2121
@create_table_sql ~s[CREATE TABLE IF NOT EXISTS `log_mode_table`]
2222
@create_table_log "create table if not exists log_mode_table"
2323
@drop_table_sql ~s[DROP TABLE IF EXISTS `log_mode_table`]

integration_test/sql/migration.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ defmodule Ecto.Integration.MigrationTest do
515515
assert [0] ==
516516
PoolRepo.all from p in "alter_col_migration", select: p.from_no_default_to_default
517517

518-
query = "INSERT INTO alter_col_migration (from_not_null_to_null) VALUES ('foo')"
518+
query = "INSERT INTO `alter_col_migration` (\"from_not_null_to_null\") VALUES ('foo')"
519519
assert catch_error(PoolRepo.query!(query))
520520

521521
:ok = down(PoolRepo, num, AlterColumnMigration, log: false)

lib/ecto/adapters/myxql.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ defmodule Ecto.Adapters.MyXQL do
248248

249249
{:ok, result} =
250250
transaction(meta, opts, fn ->
251-
lock_name = "\"ecto_#{inspect(repo)}\""
251+
lock_name = "\'ecto_#{inspect(repo)}\'"
252252

253253
try do
254254
{:ok, _} = Ecto.Adapters.SQL.query(meta, "SELECT GET_LOCK(#{lock_name}, -1)", [], opts)

0 commit comments

Comments
 (0)