Written by

Cofounder at snext
Article Blaise ZARKA · May 13, 2016 1m read

mySQL data importer tool

Hi,

If you want to import data from a mySQL export file (exported with mysqldump), you will find here a little script that could help.

Only the INSERT commands in the sql file are executed into Caché. Indices are not computed for better performance.
%NOINDEX, %NOCHECK and %NOLOCK are generated on each INSERT line.

Currently, the file can not contain a "),(" pattern inside the values part of the INSERT command. If this is the case, the line is skipped. This feature may be implemented in the extractValuesList method.

Feel free to improve it as needed. Unfortunately it's not guaranty bug free for the moment!

mysql.tools.xml_0.zip

Comments

Evgeny Shvarov · May 13, 2016

Blaize, thank you!

Would you please upload it to Github?

TIA!

0
Eduard Lebedyuk · May 13, 2016

Some comments on code.

  • rename fileToImport to mysqldumpFile
  • remove 2 references to other classes

That said, it does not work on my sql script on the table creation part, despite throwing no errors (data insert throws an error -  Table not found, but previous  statement which creates the table seems to run okay, but the table does not get created)

UPD: Reread your post, only INSERT, ok.

0
Blaise ZARKA  May 13, 2016 to Eduard Lebedyuk

Eduard, thanks for the comments. I changed the code just before publish it. Big mistake!
It should be fixed now.

0