/**
  *
  * Метод класса, возвращает коллекцию.
  *
  * @param array $array
  * @param string $type - default 'USER_DEF_VARCHAR_ARRAY'
  * @return OCI
  */
 public function createOciCollection(array $array, $type = 'USER_DEF_VARCHAR_ARRAY')
 {
     $collection = oci_new_collection($this->getDbLink(), $type);
     foreach ($array as $value) {
         $collection->append($value);
     }
     return $collection;
 }
Beispiel #2
0
 /**
  * Special non PDO function
  * Allocates new collection object
  *
  * @param string $typeName Should be a valid named type (uppercase).
  * @param string $schema Should point to the scheme, where the named type was created.
  *  The name of the current user is the default value.
  * @return \OCI_Collection
  */
 public function getNewCollection($typeName, $schema)
 {
     return oci_new_collection($this->dbh, $typeName, $schema);
 }
Beispiel #3
0
 /**
  * Binds a parameter to the specified variable name
  *
  * @param string $parameter Parameter identifier. For a prepared statement
  *   using named placeholders, this will be a parameter name of the form
  *   :name. For a prepared statement using question mark placeholders, this
  *   will be the 1-indexed position of the parameter.
  * @param mixed $variable Name of the PHP variable to bind to the SQL
  *   statement parameter.
  * @param int $dataType Explicit data type for the parameter using the
  *   PDO::PARAM_* constants.
  * @param int $maxLength Length of the data type. To indicate that a
  *   parameter is an OUT parameter from a stored procedure, you must
  *   explicitly set the length.
  * @param array $options [optional]
  * @return bool TRUE on success or FALSE on failure.
  * @todo Map PDO datatypes to oci8 datatypes and implement support for
  *   datatypes and length.
  */
 public function bindParam($parameter, &$variable, $dataType = PDO::PARAM_STR, $maxLength = -1, $options = null)
 {
     //Replace the first @oci8param to a pseudo named parameter
     if (is_numeric($parameter)) {
         $parameter = ':autoparam' . $parameter;
     }
     //Adapt the type
     switch ($dataType) {
         case PDO::PARAM_BOOL:
             $oci_type = SQLT_INT;
             break;
         case PDO::PARAM_NULL:
             $oci_type = SQLT_CHR;
             break;
         case PDO::PARAM_INT:
             $oci_type = SQLT_INT;
             break;
         case PDO::PARAM_STR:
             $oci_type = SQLT_CHR;
             break;
         case PDO::PARAM_LOB:
             $oci_type = OCI_B_BLOB;
             // create a new descriptor for blob
             $variable = $this->_pdoOci8->getNewDescriptor();
             break;
         case PDO::PARAM_STMT:
             $oci_type = OCI_B_CURSOR;
             // Result sets require a cursor
             $variable = $this->_pdoOci8->getNewCursor();
             break;
         case SQLT_NTY:
             $oci_type = SQLT_NTY;
             $schema = isset($options['schema']) ? $options['schema'] : '';
             $type_name = isset($options['type_name']) ? $options['type_name'] : '';
             // set params required to use custom type.
             $variable = oci_new_collection($this->_pdoOci8->_dbh, $type_name, $schema);
             break;
         default:
             $oci_type = SQLT_CHR;
             break;
     }
     // Bind the parameter
     $result = oci_bind_by_name($this->_sth, $parameter, $variable, $maxLength, $oci_type);
     return $result;
 }
 public function NewCollection($typename, $schema = null)
 {
     return oci_new_collection($this->conn_handle, $typename, $schema);
 }
 /**
  * @desc    Set bind according parameters and type (INPUT / OUTPUT)
  *
  * @author  Eric TINOCO <*****@*****.**>
  * 
  * @date    2009/04/23
  * @version 1.0
  * 
  * @param   array $aBind
  * @param   string $sType
  * 
  * @return  mixed
  * 
  */
 function _setBind(&$aBind, $sType = 'INPUT')
 {
     if (isset($aBind['VARIABLE']) && !empty($aBind['VARIABLE']) && (isset($aBind['VALUE']) || is_null($aBind['VALUE']))) {
         if (isset($aBind['TYPE']) && $aBind['TYPE'] === $this->_iCollectionType && is_array($aBind['VALUES'])) {
             // Create an OCI-Collection object
             if (false !== isset($aBind['ORA_TYPE'])) {
                 $oCollection = @oci_new_collection($this->conn_id, $aBind['ORA_TYPE']);
             } else {
                 return false;
             }
             // Append some category IDs to the collection;
             $iMaxj = count($aBind['VALUE']);
             for ($j = 0; $j < $iMaxj; $j++) {
                 $oCollection->append($aBind['VALUE'][$j]);
             }
             unset($j, $iMaxj);
             // Bind the collection to the parameter
             $bBind = @oci_bind_by_name($this->stmt_id, $aBind['VARIABLE'], $oCollection, -1, $aBind['TYPE']);
             unset($oCollection);
         } elseif (isset($aBind['TYPE']) && $aBind['TYPE'] === $this->_iCursorType) {
             if ($sType == 'OUTPUT') {
                 $aBind['VALUE'] = $this->getCursor();
                 if ($aBind['VALUE'] === false) {
                     $bBind = false;
                 }
                 $this->_bOutputCursors = true;
             }
             // Bind the cursor resource to the Oracle argument
             $bBind = @oci_bind_by_name($this->stmt_id, trim($aBind['VARIABLE']), $aBind['VALUE'], -1, $aBind['TYPE']);
         } elseif (isset($aBind['TYPE'])) {
             if ($aBind['TYPE'] == $this->_iDefaultType) {
                 if ($sType == 'OUTPUT') {
                     $iLength = 4000;
                 } else {
                     $iLength = mb_strlen($aBind['VALUE']);
                 }
             } else {
                 $iLength = -1;
             }
             $bBind = @oci_bind_by_name($this->stmt_id, trim($aBind['VARIABLE']), $aBind['VALUE'], $iLength, $aBind['TYPE']);
         } else {
             $bBind = @oci_bind_by_name($this->stmt_id, trim($aBind['VARIABLE']), $aBind['VALUE'], -1);
         }
         return $bBind;
     } else {
         if (!isset($aBind['VARIABLE']) || empty($aBind['VARIABLE'])) {
             return false;
         } else {
             return false;
         }
     }
 }
Beispiel #6
0
 public function getNewCollection($tdo, $schema = null)
 {
     set_error_handler(static::getErrorHandler());
     $collection = oci_new_collection($this->resource, $tdo, $schema);
     restore_error_handler();
     return $collection;
 }
Beispiel #7
0
 /**
  * Special non PDO function used to allocate a new collection object.
  *
  * @param string $tdo    Should be a valid named type (uppercase).
  * @param string $schema Should point to the scheme, where the named type was created.
  *                       The name of the current user is the default value.
  * @return mixed New collection on success, FALSE on error.
  */
 public function getNewCollection($tdo, $schema = null)
 {
     return oci_new_collection($this->dbh, $tdo, $schema);
 }
Beispiel #8
-1
 /**
  * Creates a new collection object.
  * Returns the collection object or <b>FALSE</b> if an error occurs.
  * @param string $name Should be a valid named type (uppercase). 
  * @return boolean|object 
  **/
 public function newCollection($name)
 {
     return oci_new_collection($this->conn, $name);
 }