[asterisk-commits] tilghman: trunk r77603 - /trunk/cdr/cdr_adaptive_odbc.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jul 27 18:21:23 CDT 2007


Author: tilghman
Date: Fri Jul 27 18:21:23 2007
New Revision: 77603

URL: http://svn.digium.com/view/asterisk?view=rev&rev=77603
Log:
Some ODBC drivers don't set the CHAR_OCTET_LENGTH field correctly.

Modified:
    trunk/cdr/cdr_adaptive_odbc.c

Modified: trunk/cdr/cdr_adaptive_odbc.c
URL: http://svn.digium.com/view/asterisk/trunk/cdr/cdr_adaptive_odbc.c?view=diff&rev=77603&r1=77602&r2=77603
==============================================================================
--- trunk/cdr/cdr_adaptive_odbc.c (original)
+++ trunk/cdr/cdr_adaptive_odbc.c Fri Jul 27 18:21:23 2007
@@ -198,6 +198,13 @@
 			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;




More information about the asterisk-commits mailing list