Hi all,

thanks for the quick solution to my previous __FUNCTION__ question. I have another problem:

I try to execute the following SQL query in PostGreSQL 8.1. However, it gives errors since DBI::execute() automatically quotes when it inserts its arguments into the SQL query. Is there any way to change the quoting behavior of DBI::execute():

# make SQL statement
my $qry = "ALTER TABLE mytable ALTER COLUMN ? TYPE double precision;

# prepare SQL-statement
my $qry_sth = $dbh->prepare($qry);

# execute SQL statement with user-defined column name added
$qry_sth->execute($col_name);

which results in the following query being executed:
ALTER TABLE mytable ALTER COLUMN 'column_name' TYPE double precision


The inserted variable, which is an identifier, will receive single quotes by DBI::execute(). PostGreSQL gives an error, since it only accepts unquoted identifiers. How can I change DBI::prepare() or DBI::execute default behavior, so that added values go unquoted?

I have the idea that this should be done by adding some statement handling attribute to the $qry_sth object, but the DBI documentation is not very explicit about it.

thanks for any help,
Bram







--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to