DBD-drizzle

 view release on metacpan or  search on metacpan

dbdimp.c  view on Meta::CPAN

    drizzle_column_st *col= drizzle_column_next(imp_sth->result);

    SV *sv= AvARRAY(av)[i]; /* Note: we (re)use the SV in the AV	*/

    if (field)
    {
      STRLEN len= lengths[i];
      if (ChopBlanks)
      {
        while (len && field[len-1] == ' ')
        {	--len; }
      }
      sv_setpvn(sv, field, len);
      /* UTF8 */
      /*HELMUT*/
#if defined(sv_utf8_decode)
        if (imp_dbh->enable_utf8 && !(drizzle_column_flags(col) & DRIZZLE_COLUMN_FLAGS_BINARY))
#endif
          sv_utf8_decode(sv);
      /* END OF UTF8 */
    }
    else
      (void) SvOK_off(sv);  /*  Field is NULL, return undef  */
  }

  if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)
    PerlIO_printf(DBILOGFP, "\t<- dbd_st_fetch, %d cols\n", num_fields);

  return av;

}

/***************************************************************************
 *
 *  Name:    dbd_st_finish
 *
 *  Purpose: Called for freeing a drizzle result
 *
 *  Input:   sth - statement handle being finished
 *           imp_sth - drivers private statement handle data
 *
 *  Returns: TRUE for success, FALSE otherwise; do_error() will
 *           be called in the latter case
 *
 **************************************************************************/

int dbd_st_finish(SV* sth, imp_sth_t* imp_sth) {
  D_imp_xxh(sth);

#if defined (dTHR)
  dTHR;
#endif

  if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)
  {
    PerlIO_printf(DBILOGFP, "\n--> dbd_st_finish\n");
  }


  /*
    Cancel further fetches from this cursor.
    We don't close the cursor till DESTROY.
    The application may re execute it.
  */
  if (imp_sth && imp_sth->result)
  {
    /*
      Clean-up previous result set(s) for sth to prevent
      'Commands out of sync' error
    */
    drizzle_st_free_result_sets(sth, imp_sth);
  }

  DBIc_ACTIVE_off(imp_sth);
  if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)
  {
    PerlIO_printf(DBILOGFP, "\n<-- dbd_st_finish\n");
  }
  return 1;
}


/**************************************************************************
 *
 *  Name:    dbd_st_destroy
 *
 *  Purpose: Our part of the statement handles destructor
 *
 *  Input:   sth - statement handle being destroyed
 *           imp_sth - drivers private statement handle data
 *
 *  Returns: Nothing
 *
 **************************************************************************/

void dbd_st_destroy(SV *sth, imp_sth_t *imp_sth) {
  D_imp_xxh(sth);

#if defined (dTHR)
  dTHR;
#endif

  int i;

  /* Free values allocated by dbd_bind_ph */
  if (imp_sth->params)
  {
    free_param(imp_sth->params, DBIc_NUM_PARAMS(imp_sth));
    imp_sth->params= NULL;
  }

  if (imp_sth->unbuffered_result && imp_sth->row)
  {
    drizzle_row_free(imp_sth->result, imp_sth->row);
    imp_sth->row= NULL;
  }
  /* This causes a double-free */
  /*if (imp_sth->result)
  {
    drizzle_result_free(imp_sth->result);
    imp_sth->result= NULL;
  }



( run in 0.676 second using v1.01-cache-2.11-cpan-5837b0d9d2c )