· May 13, 2016 1m read

mySQL data importer tool


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!

Discussion (3)0
Log in or sign up to continue

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.