[fpc-pascal] MySQL insert, load data

Wolfram Kl├Ąger wolfram.klaeger at web.de
Thu Feb 14 22:49:38 CET 2008


Along Joost's examples I managed to get connected, create a table, put a
query, get the result, and insert a single row. But when I try to insert
several rows at once, I get an EDatabaseError "near" to first char of
second row.

...
q.SQL.Clear;
q.Add('insert into MYTABLE(c1, c2, ..) values ');
q.Add('(r1v1, r1v2, ..),');
q.Add('(r2v1, r2v1, ..),');
..
q.Add(';');

What am I missing or is multiple insert not supported?

Alternatively, MySQL provides the LOAD DATA [LOCAL] INFILE statement. So
far I was not able to find a special sqldb wrapper for it. Is it done
via ExecuteDirect?

Wolfram



More information about the fpc-pascal mailing list