in reply to Re^2: Eval error on connectd DBI handle
in thread Eval error on connectd DBI handle
Note that quoting or placeholder functions will not work for database identifiers like table names
DBI has a quote_identifier() method that handles all required quoting of database identifiers. Unfortunately, you can't use placeholders for identifiers, so you have to call quote_identifier() manually, like this:
my $cmd='create table '.$dbh->quote_identifier($tablename); $dbh->do($cmd);
And by the way: There is also a quote() method in DBI. For all but some very exotic cases, just forget that it exists and use placeholders. I think quote() should die or at least warn when being called from non-DBI, non-DBD code. It is usually just wrong to use it instead of using placeholders. See Re: Counting rows Sqlite, Re^2: Massive Memory Leak, Re^3: Variable interpolation in a file to be read in, Re^5: Variable interpolation in a file to be read in for more details.
Alexander
|
|---|