DBD-MaxDB

 view release on metacpan or  search on metacpan

dbdimp.c  view on Meta::CPAN

               rsetType = String2ResultSetType(val, vl);
               if (rsetType == sth_maxdb_option_unknown){
                 dbd_maxdb_internal_error(sth, DBD_ERR_WRONG_PARAMETER_S, "resultset type must be a number value");
                 break;
               }  
             } else {
                 rsetType = (SQLDBC_Statement_ResultSetType) SvIV(valuesv);
             }
             SQLDBC_PreparedStatement_setResultSetType(imp_sth->m_prepstmt, rsetType);  
             erg = SQLDBC_TRUE;
             break;
          }
          case sth_maxdb_option_FetchSize:{
             int fetchsize;
             if(!SvIOK (valuesv)){
               dbd_maxdb_internal_error(sth, DBD_ERR_WRONG_PARAMETER_S, "resultset concurrency type must be a number value");
               break;
             }
             fetchsize = SvIV(valuesv);
             if (fetchsize <= 0 && fetchsize > 32768){
               dbd_maxdb_internal_error(sth, DBD_ERR_WRONG_PARAMETER_S, "fetchsize must be a value between 1 and 32768");
               break;
             }
             SQLDBC_PreparedStatement_setResultSetFetchSize (imp_sth->m_prepstmt, fetchsize);
             imp_sth->m_fetchSize =  fetchsize;  
             erg = SQLDBC_TRUE;
             break;
          }
          case sth_maxdb_option_RowSetSize:{
             int rowsetsize;
             if(!SvIOK (valuesv)){
               dbd_maxdb_internal_error(sth, DBD_ERR_WRONG_PARAMETER_S, "resultset concurrency type must be a number value");
               break;
             }
             rowsetsize = SvIV(valuesv);
             if (rowsetsize <= 0){
               dbd_maxdb_internal_error(sth, DBD_ERR_WRONG_PARAMETER_S, "rowsetsize must be greater than zero");
               break;
             }
             imp_sth->m_rowSetSize =  rowsetsize;  
             imp_sth->m_rowSetSizeChanged =  SQLDBC_TRUE;  
             erg = SQLDBC_TRUE;
             break;
          }
          case sth_maxdb_option_MaxRows:{
             int maxrows;
             if(!SvIOK (valuesv)){
               dbd_maxdb_internal_error(sth, DBD_ERR_WRONG_PARAMETER_S, "MaxRows must be a number value");
               break;
             }
             maxrows = SvIV(valuesv);
             if (maxrows <= 0){
               dbd_maxdb_internal_error(sth, DBD_ERR_WRONG_PARAMETER_S, "MaxRows must be greater than zero");
               break;
             }
             SQLDBC_PreparedStatement_setMaxRows (imp_sth->m_prepstmt, maxrows);
             erg = SQLDBC_TRUE;
             break;
          }
          case sth_maxdb_option_CursorName:{
             char* cursorname = SvPV(valuesv,kl);
             SQLDBC_PreparedStatement_setCursorName (imp_sth->m_prepstmt, cursorname, kl, SQLDBC_StringEncodingType_Encoding_UTF8) ;
             erg = SQLDBC_TRUE;
             break;
          }
       }
    }  
  DBD_MAXDB_METHOD_RETURN(imp_sth, dbd_maxdb_st_STORE_attrib, erg); 
}

/***************************************************************************
 *
 *  Name:    dbd_maxdb_st_FETCH_attrib
 *
 *  Purpose: Retrieves a statement handles attributes
 *
 *  Input:   sth - statement handle being destroyed
 *           imp_sth - drivers private statement handle data
 *           keysv - attribute name
 *
 *  Returns: NULL for an unknown attribute, "undef" for error,
 *           attribute value otherwise.
 *
 **************************************************************************/
SV* dbd_maxdb_st_FETCH_attrib(SV* sth, imp_sth_t* imp_sth, SV* keysv) {
#if defined(dTHR)
  dTHR;
#endif
  STRLEN kl;
  char *key = SvPV(keysv, kl);
  SV* result = NULL;
  sth_maxdb_option opt;
  D_imp_dbh_from_sth;

  DBD_MAXDB_METHOD_ENTER(imp_sth, dbd_maxdb_st_FETCH_attrib); 

  if (DBIc_DBISTATE(imp_sth)->debug >= 3)
      PerlIO_printf(DBIc_LOGPIO(imp_sth), "          attrib %s \n", key);
                      
  if ((opt = (sth_maxdb_option)analyzeKeyword(key, kl, sth_optionTab, STH_MAXDB_OPTIONTABLESIZE)) != sth_maxdb_option_unknown){
    switch(opt)
    {
      case sth_maxdb_option_CursorName:{
              SQLDBC_Int2 cnameLen = imp_dbh->m_dbmd->getMaxCursorLength +1;
              char *cname = (char*) alloca(cnameLen); 
        SQLDBC_Length bufferLength;
        if( SQLDBC_PreparedStatement_getCursorName (
                          imp_sth->m_prepstmt, 
                          cname, 
                          SQLDBC_StringEncodingType_Encoding_UTF8, 
                          cnameLen, 
                          &bufferLength) != SQLDBC_OK){
               break;
        }
        result = sv_2mortal(newSVpv(cname, bufferLength));
        break;
      }
      case sth_maxdb_option_FetchSize:{
        result = (imp_sth->m_fetchSize)?sv_2mortal(newSViv(imp_sth->m_fetchSize)):&PL_sv_undef;
        break;
      }
      case sth_maxdb_option_MaxRows:{



( run in 1.480 second using v1.01-cache-2.11-cpan-39bf76dae61 )