in reply to Debugging DBD/SQL syntax error
Regarding SQL in Perl, in general it is wise to always have a method of logging the SQL statement you build, especially when rolling SQL on the fly. Plus a method for dumping the values that are to be bound to a prepared statement.
Secondly, in your particular instance, you should be able to scatter prints through the code to see which one of the three statements is causing the trouble. You must narrow it down to one.
Finally, DBI's trace method will let you see exactly what is handed to the underlying DBD driver, with progressively excruciating detail according to how high you crank it up.
Taking a wild guess here now, I'd say that you have a trailing comma after a field or value. e.g. something like insert into t (c1, c2, c3,) values (1,2,3,)
Perl doesn't care about trailing commas in lists; in SQL it is an error.
- another intruder with the mooring in the heart of the Perl
|
|---|