Ok. First one was simple. Keyword and opening bracket must be separated by a blank, e.g.
'.. MYTABLE(..' // wrong
'.. MYTABLE (..' // great
'..)values(..' // wrong
'..) values (..' // great
All field contents have to be bracketed by double apostrophes, e.g.
q.sql.add('''Florian Klaempfl'',');
except it's an integer value, e.g.
q.sql.add('1,');
Date values seem to be put as formatted strings. Unfortunately, my MySQL does not know Joost. His example, '1-jan-1975' works here as '1975.1.1' only. Guess this is a config issue.
Now what about LOAD DATA?
I still have no idea where to look for it. I learned TSQLQuery is descending Tbufdataset <- TDBDataSet <- TDataset <- TComponent and assume there is somewhere an option to load from a CSV text file or stream.
But how to push it forward to MySQL?
Wolfram
// Wolfram Kläger, 14.02.2008 22:49
Show quoted text 18 lines
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?