I still haven't found a good answer on this one... OH the joy of ODBC! :)

bkw

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:asterisk-dev-
> [EMAIL PROTECTED] On Behalf Of David Creemer
> Sent: Wednesday, June 16, 2004 3:27 PM
> To: [EMAIL PROTECTED]
> Subject: [Asterisk-Dev] cdr_odbc and SQLite
>
> Hi-
>
> I've been looking at cdr_odbc.c (lastest * CVS HEAD). I've tried
> binding to a SQLite DB, with some errant behavior -- character string
> do not make it into the database (but integers do). I installed
> unixODBC from latest source, and have verified that I can connect to
> and read/write to my data source using for example python-odbc.
>
> In looking at the cdr_odbc.c source, I notice that calls to
> SQLBindParameter look like this:
>
>          SQLBindParameter(ODBC_stmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR,
> SQL_CHAR, sizeof(cdr->clid), 0, cdr->clid, 0, NULL);
>
> I've looked at some of the sample ODBC drivers in the unixODBC package
> and this doesn't seem correct. See the txt driver for example.
>
> The following seems to work with txt and SQLite backends:
>
>          SQLLEN flen = 80;
>          SQLBindParameter(ODBC_stmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR,
> SQL_CHAR, sizeof(cdr->clid), 0, cdr->clid, sizeof(cdr->clid), &flen);
>
>
> It seems that at least some ODBC drivers interpret the final field as
> the actual length of the data, and the second to last field as the size
> of the passed in field buffer.
>
> I also think that sizeof( X )  only works as intended above if X is
> defined a char X[80], not if X is "char *X = (char*)malloc(80)". I
> haven't checked all of the cdr-> fields to be sure they meet that
> restriction.
>
> Is my analysis here correct? If so (sorry for newbie question) should I
> just file a bug?
>
> regards,
> -- David
>
> _______________________________________________
> Asterisk-Dev mailing list
> [EMAIL PROTECTED]
> 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
[EMAIL PROTECTED]
http://lists.digium.com/mailman/listinfo/asterisk-dev
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev

Reply via email to