[Asterisk-Dev] ASTCC AGI using Postgres DB

Michael K. Rodriguez michael at voipalliance.net
Tue Oct 19 15:48:39 MST 2004


Answer to my own question:
The sub routine 
$sth = $dbh->prepare("SELECT * FROM trunks where name=" .
$dbh->quote($trunk));

does send the SQL statement with a quoted value. The pg table clounm must be
VARCHAR to remove padded spacing to select the proper {tech}. I initially
had the pg table data type as a CHAR(10).

-michael


On 10/19/04 3:17 PM, "Michael K. Rodriguez" <michael at voipalliance.net>
wrote:

> I am trying to modify the ASTCC AGI to use postgres as the backend database.
> I have edited the DBI to connect successful to the database. The AGI runs
> properly till it gets to the selection of the trunk. The database insert to
> the cdrs table with CHANUNAVAIL.
> 
> It seems to me that the SELECT statement on the sub trytrunk() is not using
> simple quotes for the select statement
> Example
> $sth = $dbh->prepare("SELECT * FROM trunks where name=" .
> $dbh->quote($trunk));
> 
> When I query the DB with SELECT * FROM trunks where name =IAXtrunk; Response
> with no iaxtrunk column found
> 
> When I query the DB with SELECT * FROM trunks where name='IAXtrunk' DB
> response with a record set.
> PG DB table: 
> name varchar(40)
> tech varchar(10)
> path varchar(40)
> 
> Any ideas?
> 
> Debian 2.4.26
> Asterisk stable
> PG 7.4
> 
> -Michael Rodriguez
> 
> 
> _______________________________________________
> Asterisk-Dev mailing list
> Asterisk-Dev at lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-dev
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-dev





More information about the asterisk-dev mailing list