Closed acicovic closed 4 years ago
I think it's because of wrong escape character? In your query it uses "
, but MySQL should probably use `
What's your connection string?
Which persistence connection sub-class is it using?
Calls like the following work normally:
$app->add(MigratorConsole::class)
->migrateModels([
new Address($db),
new Bank($db)
]);
My connection string is mysql://root@localhost/myinvoice
(local environment, root without password). I don't have a custom escape character defined and I never had any similar problems with ATK Data.
About your last question, if you still need an answer to this, can you give me a quick indication on where I could put a breakpoint to debug this?
Thanks.
Are you using $app->dbConnect(...)
when connecting ?
Try var_dump(get_class($app->db))
Yes, I use dbConnect
var_dump
returns atk4\data\Persistence\SQL
And what about var_dump(get_class($app->db->connection))
and var_dump(get_class($app->db->connection->dsql()))
dsql() should return Query_MySQL class.
atk4\dsql\Connection
atk4\dsql\Query_MySQL
So everything seems normal?
yes everything seems normal, but strangely it still use "
as escape char in sql.
OK, maybe I will try to debug it.
This is probably specific to my configuration and I have no time to troubleshoot it for the time being. I will close this issue and re-open if needed.
Hi,
This code (and similar operations) gives me exceptions.
error:"SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '\"test\" (\"id\" bigint unsigned not null primary key autoincrement)' at line 1"
query:"create table \"test\" (\"id\" bigint unsigned not null primary key autoincrement)"
I'm using MariaDB 10.2.31 and PHP 7.4.5, with all ATK packages to latest stable versions.
Can anyone reproduce this?