I'm coding a library to compare two MySQL databases.
Sources can be a SQL string, SQL file or a MySQL database connection.
Use regular expressions to parse tables/alter/indexes form sources is terrible and with a lot of possible syntaxes.
I have the script to generate a SQL string from any source, and now I need to import this SQL into a temporal database, to launch the DESCRIBE table and parse this text. Is a lot of more easy and clean than originals sources.
There are any way to create a memory/temporal MySQL database from PHP PDO without user and password credentials?
I have same script to SQLite, that allow to create memory connections with:
$db1 = new PDO('sqlite::memory:');
$db1->exec($sql);
$tables = [];
foreach ($db1->query('.tables') as $table) {
$q = $db1->prepare('.schema ?');
$q->execute([$table]);
$tables[$table] = $q->fetchAll();
}
There is a lot of more easy to compare databases.
How can I do this with MySQL?
Thanks :)
Aucun commentaire:
Enregistrer un commentaire