[DB-SIG] oracledb module 0.2pre1

Richard Jones richard.jones@fulcrum.com.au
Fri, 11 Dec 1998 15:55:04 +1100


    Strangenesses occur in the 0.2pre1 oracledb module when fetchall() is 
called. Basically, the description gets doubled up. I added the following 
simple fix (which works for me, but I was really only guessing ;)


      Richard

[This isn't a diff or anything really useful - but then I only added 4 lines]

static int
oraCurs_OutputBindings(oraCursObject *self)
{
    sb2 vtype;
    sb4 vsize;
    sb1 name[256];
    /*sb2 tempvar;*/
    sb4 nsize = sizeof(name);
    sword pos = 1;
    sb4 dsize;
    sb2 prec, scale, nullok;

    if (self->cda[0].ft != 4) { /* Stop here if not a SELECT ! */
        self->n_columns = 0;
        return 1;
    }
+   if (self->description) {
+       Py_DECREF(self->description);
+   }
+   self->description = PyList_New(0);
    while (odescr(self->cda, pos, &vsize, &vtype,
                  name, &nsize, &dsize, &prec, &scale, &nullok) == 0) {
        PyObject *new_tuple;

        name[nsize] = 0;
        if (vtype == SQLT_LNG) {
            vsize = self->max_output;
        }