DBD-Solid

 view release on metacpan or  search on metacpan

Solid.xs  view on Meta::CPAN

    ST(0) = dbd_db_rollback(dbh) ? &sv_yes : &sv_no;

void
disconnect(dbh)
    SV *	dbh
    CODE:
    D_imp_dbh(dbh);
    if ( !DBIc_ACTIVE(imp_dbh) ) {
	XSRETURN_YES;
    }
    /* Check for disconnect() being called whilst refs to cursors	*/
    /* still exists. This needs some more thought.			*/
    if (DBIc_ACTIVE_KIDS(imp_dbh) && DBIc_WARN(imp_dbh) && !dirty) {
	warn("disconnect(%s) invalidates %d active cursor(s)",
	    SvPV(dbh,na), (int)DBIc_ACTIVE_KIDS(imp_dbh));
    }
    ST(0) = dbd_db_disconnect(dbh) ? &sv_yes : &sv_no;


void
DESTROY(dbh)
    SV *	dbh
    PPCODE:
    D_imp_dbh(dbh);

dbdimp.c  view on Meta::CPAN

/* --------------------------------------------------------
* Prepare SQL statement.  Relies on dbd_preparse.
* --------------------------------------------------------- */
int dbd_st_prepare( SV* sth, char* statement, SV* attribs )
   {
   D_imp_sth(sth);
   D_imp_dbh_from_sth;
   RETCODE rc;
   dTHR;
   SV** svp;
   char cname[128];    /* cursorname */

   imp_sth->done_desc = 0;

   /* Deprecated as of ODBC 3.x.  --mms */
   /*rc = SQLAllocStmt(imp_dbh->hdbc, &imp_sth->hstmt);
   solid_error(sth, rc, "st_prepare/SQLAllocStmt"); */

   rc = SQLAllocHandle( SQL_HANDLE_STMT, imp_dbh->hdbc, &imp_sth->hstmt );
   solid_error( sth, rc, "st_prepare/SQLAllocHandle/Stmt" );
   

dbdimp.c  view on Meta::CPAN

   imp_sth->n_result_cols = -1;
   imp_sth->RowCount = -1;
   imp_sth->eod = -1;

   /* @@@ DBI Bug ??? */
   DBIc_set( imp_sth, DBIcf_LongTruncOk,
             DBIc_is(imp_dbh, DBIcf_LongTruncOk) );
   
   DBIc_LongReadLen(imp_sth) = DBIc_LongReadLen(imp_dbh);

   sprintf( cname, "dbd_cursor_%X", imp_sth->hstmt );
   rc = SQLSetCursorName( imp_sth->hstmt, cname, strlen(cname) );

   if( rc != SQL_SUCCESS )
      warn("dbd_prepare: can't set cursor name, rc = %d", rc);

   if( dbis->debug >= 2 )
	fprintf(DBILOGFP, "    CursorName is '%s', rc=%d\n", cname, rc);

   if( attribs )
      {
      if( (svp=hv_fetch((HV*)SvRV(attribs), "blob_size",9, 0)) != NULL )
         {
         int len = SvIV( *svp );
         DBIc_LongReadLen( imp_sth ) = len;

dbdimp.c  view on Meta::CPAN

* -------------------------------- */
int dbd_st_finish( SV* sth )
   {
   D_imp_sth( sth );
   D_imp_dbh_from_sth;
   D_imp_drh_from_dbh;
   RETCODE rc;
   dTHR;
   int ret = 1;

   /* Cancel further fetches from this cursor.
   * We don't close the cursor till DESTROY (dbd_st_destroy). 
   * The application may re execute(...) it. */

   if( DBIc_ACTIVE(imp_sth) && imp_dbh->hdbc != SQL_NULL_HDBC )
      {
      rc = SQLFreeStmt( imp_sth->hstmt, SQL_CLOSE );
      solid_error( sth, rc, "st_finish/SQLFreeStmt(SQL_CLOSE)" );

      if( rc != SQL_SUCCESS )
         ret = 0;

dbdimp.c  view on Meta::CPAN

   {
   D_imp_sth( sth );
   STRLEN kl;
   dTHR;
   char* key = SvPV(keysv,kl);
   int i;
   SV* retsv = NULL;
   T_st_params* par;
   int n_fields;
   imp_fbh_t* fbh;
   char cursor_name[256];
   SWORD cursor_name_len;
   RETCODE rc;
   int par_index;

   for( par = S_st_fetch_params; par->len > 0; par++ )
      if( par->len == kl && strEQ(key, par->str) )
         break;

   if( par->len <= 0 )
      return Nullsv;

dbdimp.c  view on Meta::CPAN

         av = newAV();
         retsv = newRV(sv_2mortal((SV*)av));
         while( --i >= 0 )
            {
            av_store(av, i, newSViv(imp_sth->fbh[i].ColLength));
            }
      break;

      case 9:     /* CursorName */
         rc = SQLGetCursorName( imp_sth->hstmt,
               cursor_name,
               sizeof(cursor_name),
               &cursor_name_len);
      
         solid_error( sth, rc, "st_FETCH/SQLGetCursorName" );
      
         if( rc != SQL_SUCCESS )
            {
            if( dbis->debug >= 1 )
               {
               fprintf(DBILOGFP,
                  "SQLGetCursorName returned %d in dbd_st_FETCH\n", rc);
               }
            return Nullsv;
            }
         retsv = newSVpv( cursor_name, cursor_name_len );
      break;

      case 10:    /* blob_size */
         if( DBIc_WARN(imp_sth) )
            warn("Depreciated feature 'blob_size'. "
                 "Please use 'solid_blob_size' instead.");

      /* fall through */
      case 12:    /* solid_blob_size */
      case 15:    /* LongReadLen */



( run in 0.252 second using v1.01-cache-2.11-cpan-4d50c553e7e )