aboutsummaryrefslogtreecommitdiffstats
path: root/cdr
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-07-27 23:21:23 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-07-27 23:21:23 +0000
commit2ebdd5fd1dfcc4ac7a53f0e6ad4e661888cb7cf5 (patch)
tree577d2f88c6895c95feda51e73e385c9ae77fe5b1 /cdr
parentdfcfc3f22a896703782a4cbbd8ab957708c1b7fa (diff)
Some ODBC drivers don't set the CHAR_OCTET_LENGTH field correctly.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@77603 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'cdr')
-rw-r--r--cdr/cdr_adaptive_odbc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/cdr/cdr_adaptive_odbc.c b/cdr/cdr_adaptive_odbc.c
index 8c3b1e5ff..12e982069 100644
--- a/cdr/cdr_adaptive_odbc.c
+++ b/cdr/cdr_adaptive_odbc.c
@@ -198,6 +198,13 @@ static int load_config(void)
SQLGetData(stmt, 11, SQL_C_SHORT, &entry->nullable, sizeof(entry->nullable), NULL);
SQLGetData(stmt, 16, SQL_C_LONG, &entry->octetlen, sizeof(entry->octetlen), NULL);
+ /* Specification states that the octenlen should be the maximum number of bytes
+ * returned in a char or binary column, but it seems that some drivers just set
+ * it to NULL. (Bad Postgres! No biscuit!) */
+ if (entry->octetlen == 0)
+ entry->octetlen = entry->size;
+
+ ast_verb(10, "Found %s column with type %hd with len %ld, octetlen %ld, and numlen (%hd,%hd)\n", entry->name, entry->type, entry->size, entry->octetlen, entry->decimals, entry->radix);
/* Insert column info into column list */
AST_LIST_INSERT_TAIL(&(tableptr->columns), entry, list);
res = 0;