[prev in list] [next in list] [prev in thread] [next in thread] 

List:       asterisk-dev
Subject:    [asterisk-dev] cdr_odbc.c is broken in trunk
From:       Nick Gorham <nick () lurcher ! org>
Date:       2008-01-10 11:18:03
Message-ID: 4785FEEB.6040500 () lurcher ! org
[Download RAW message or body]

Hi,

The change to use prepare_cb() in odbc_log became broken in r88182.

The code calls SQLBindParameter on a local variable (timestr) but as it 
now doesn't call SQLExecute in the same function when it finally gets to 
SQLExecute that variable is out of scope.

I dont know if I can pass attachments to this list, so the fixed cdr can 
be found here http://www.lurcher.org/~nick/cdr_odbc.c

The code contained the following lines

        /* We really should only have to do this once.  But for some
         * strange reason if I don't it blows holes in memory like
         * like a shotgun.  So we just do this so its safe.
         */

The "strange reason", as I have tried to report several times now via 
the forum, is that the memory passed to SQLBindParameter is not 
referenced until the SQLExecute, that the point of binding parameters, 
you pass the address of the storage, then before the SQLExecute you set 
the values you intend to use.

-- 
Nick Gorham
Easysoft and unixODBC


_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic