[Asterisk-Dev] ast_data pgsql

Rob Gagnon rob at networkip.net
Fri Jul 16 14:52:37 MST 2004


In fact, I committed one piece of code (that would work) by changing the
SQL.  Then I decided to just fix it permanently.

The SQL is back to SELECT *, but the code now checks the field names instead
of just their positions.

This change is going to be needed anyhow, when I finally complete the
configurable SQL portion of the program.

Rob

PS:  Thanks for finding this Dimitri

----- Original Message ----- 
From: "Rob Gagnon" <rob at networkip.net>
To: <asterisk-dev at lists.digium.com>
Sent: Friday, July 16, 2004 4:33 PM
Subject: Re: [Asterisk-Dev] ast_data pgsql


> :-)  I see the error in the code now.  I am fixing it, and maybe by the
time
> you get this, it will be available at
>
> http://svn.asteriskdocs.org/res_data
>
> The issue is that the Default SQL I changed code to a little while back
has
> a SELECT *, but the code to read the fields is positional for that
> data_pgsql function
>
> Eventually, it will scan the row for the field name it needs, and this
will
> make it more able to handle queries of this sort.
>
> Rob
>
> ----- Original Message ----- 
> From: "Dmitri Pavlenkov" <dmitri at im1.com>
> To: <asterisk-dev at lists.digium.com>
> Sent: Friday, July 16, 2004 2:57 PM
> Subject: [Asterisk-Dev] ast_data pgsql
>
>
> I think everything's setup correctly, and yet extension lookup is not
> working:
>
> iptel1=> \d extensions
>                               Table "public.extensions"
>    Column    |          Type          |                   Modifiers
>
> -------------+------------------------+---------------------------------
> --------------
>  context     | character varying(40)  | not null default
> 'default'::character varying
>  extension   | character varying(20)  | not null
>  priority    | integer                | not null default 1
>  application | character varying(20)  | not null
>  args        | character varying(100) | not null default ''::character
> varying
> Indexes: extensions_pkey primary key btree (context, extension,
> priority)
>
> iptel1=> select * from extensions
> iptel1-> ;
>  context | extension | priority | application |      args
> ---------+-----------+----------+-------------+-----------------
>  dbtest  | s         |        1 | Festival    | test successful
>  im1     | 999       |        1 | Goto        | dbtest|s|1
> (2 rows)
>
> paska*CLI> show data pgsql status
> ========================================================================
> ======
> Database: iptel1 at db.x.x:5432
> Queries Handled:
>      EXTENSION_LOOKUP
> ID      In/Out  Reads   Writes  Deletes Status
>   1     In           8       0       0  Connected 0 days, 00:03:48
>   2     In           0       0       0  Connected 0 days, 00:03:48
>   3     In           0       0       0  Connected 0 days, 00:03:48
> ========================================================================
> ======
>
>  == Request:
>   == ==== Packet Dump ====
>   == Query Type: SIP_FIND_USER
>   == (100)Name = (STR)"dmitri"
>   == ==== End of Packet Dump ====
>   == Response:
>   == Request:
>   == ==== Packet Dump ====
>   == Query Type: SIP_FIND_USER
>   == (100)Name = (STR)"dmitri"
>   == ==== End of Packet Dump ====
>   == Response:
>   == Request:
>   == ==== Packet Dump ====
>   == Query Type: SIP_FIND_USER
>   == (100)Name = (STR)"dmitri"
>   == ==== End of Packet Dump ====
>   == Response:
>   == Request:
>   == ==== Packet Dump ====
>   == Query Type: EXTENSION_LOOKUP
>   == (114)Extension = (STR)"999"
>   == (110)Context = (STR)"im1"
>   == (115)Priority = (INT)1
>   == (134)Action = (INT)0
>   == ==== End of Packet Dump ====
>   == Response:
>   == ==== Packet Dump ====
>   == Query Type: EXTENSION_LOOKUP
>   == (20)DataSource = (STR)"pgsql"
>   == (10)ErrorNumber = (INT)-9
>   == (11)ErrorMessage = (STR)"Not found"
>   == ==== End of Packet Dump ====
>   == Request:
>   == ==== Packet Dump ====
>   == Query Type: EXTENSION_LOOKUP
>   == (114)Extension = (STR)"999"
>   == (110)Context = (STR)"im1"
>   == (115)Priority = (INT)1
>   == (134)Action = (INT)3
>   == ==== End of Packet Dump ====
>   == Response:
>   == ==== Packet Dump ====
>   == Query Type: EXTENSION_LOOKUP
>   == (20)DataSource = (STR)"pgsql"
>   == (114)Extension = (STR)"im1"
>   == (116)Application = (STR)"999"
>   == (117)Arguments = (STR)"1"
>   == (10)ErrorNumber = (INT)0
>   == (11)ErrorMessage = (STR)"OK"
>   == ==== End of Packet Dump ====
>   == Request:
>   == ==== Packet Dump ====
>   == Query Type: SIP_FIND_USER
>   == (100)Name = (STR)"dmitri"
>   == ==== End of Packet Dump ====
>   == Response:
>
>
> Dmitri Pavlenkov
> Technical Support
> Im1 Web Hosting
>
>
> _______________________________________________
> 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
>
> _______________________________________________
> 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