Re: DBD::PG question - Mailing list pgsql-interfaces

From Greg Stark
Subject Re: DBD::PG question
Date
Msg-id 878y46z5c9.fsf@stark.xeocode.com
Whole thread Raw
In response to DBD::PG question  (Frank Bax <fbax@sympatico.ca>)
List pgsql-interfaces
Frank Bax <fbax@sympatico.ca> writes:

> In a perl script using DBI and DBD:Pg, I need to drop/create a table:
>    $dbp->{RaiseError} = 0;
>    $dbp->do( "DROP TABLE $table" );
>    $dbp->{RaiseError} = 1;
>    $dbp->do( "CREATE TABLE $table ..." );
> 
> If the table does not exist, the "DROP TABLE" produces an error message; but
> script doesn't die because RaiseError was set to zero.  Is there a way to
> suppress this error message and then reset the change so an error in create
> *is* seen?


I think it looks something like this:

{ local($dbp->{RaiseError}) = 0; local($dbp->{PrintError}) = 0; $dbp->do( "DROP TABLE $table" );
}
$dbp->do( "CREATE TABLE $table ..." );


-- 
greg



pgsql-interfaces by date:

Previous
From: Frank Bax
Date:
Subject: Re: DBD::PG question
Next
From: Marvin Bellamy
Date:
Subject: libpq: Newbie help w/ data type conversions on queries and updates