[asterisk-commits] tilghman: branch 1.6.1 r164355 - in /branches/1.6.1: ./ cdr/cdr_pgsql.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Dec 15 12:27:28 CST 2008
Author: tilghman
Date: Mon Dec 15 12:27:28 2008
New Revision: 164355
URL: http://svn.digium.com/view/asterisk?view=rev&rev=164355
Log:
Merged revisions 164349 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r164349 | tilghman | 2008-12-15 12:09:58 -0600 (Mon, 15 Dec 2008) | 4 lines
When querying for the structure of the CDR table, remove the schema, if it
exists.
(Closes issue #14058)
........
Modified:
branches/1.6.1/ (props changed)
branches/1.6.1/cdr/cdr_pgsql.c
Propchange: branches/1.6.1/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.
Modified: branches/1.6.1/cdr/cdr_pgsql.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/cdr/cdr_pgsql.c?view=diff&rev=164355&r1=164354&r2=164355
==============================================================================
--- branches/1.6.1/cdr/cdr_pgsql.c (original)
+++ branches/1.6.1/cdr/cdr_pgsql.c Mon Dec 15 12:27:28 2008
@@ -476,12 +476,20 @@
if (PQstatus(conn) != CONNECTION_BAD) {
char sqlcmd[512];
char *fname, *ftype, *flen, *fnotnull, *fdef;
+ char *tableptr;
int i, rows;
ast_debug(1, "Successfully connected to PostgreSQL database.\n");
connected = 1;
+ /* Remove any schema name from the table */
+ if ((tableptr = strrchr(table, '.'))) {
+ tableptr++;
+ } else {
+ tableptr = table;
+ }
+
/* Query the columns */
- snprintf(sqlcmd, sizeof(sqlcmd), "select a.attname, t.typname, a.attlen, a.attnotnull, d.adsrc from pg_class c, pg_type t, pg_attribute a left outer join pg_attrdef d on a.atthasdef and d.adrelid = a.attrelid and d.adnum = a.attnum where c.oid = a.attrelid and a.atttypid = t.oid and (a.attnum > 0) and c.relname = '%s' order by c.relname, attnum", table);
+ snprintf(sqlcmd, sizeof(sqlcmd), "select a.attname, t.typname, a.attlen, a.attnotnull, d.adsrc from pg_class c, pg_type t, pg_attribute a left outer join pg_attrdef d on a.atthasdef and d.adrelid = a.attrelid and d.adnum = a.attnum where c.oid = a.attrelid and a.atttypid = t.oid and (a.attnum > 0) and c.relname = '%s' order by c.relname, attnum", tableptr);
result = PQexec(conn, sqlcmd);
if (PQresultStatus(result) != PGRES_TUPLES_OK) {
pgerror = PQresultErrorMessage(result);
More information about the asterisk-commits
mailing list