Esempio n. 1
0
 /**
  * Executes a prepared statement
  *
  * @param array $inputParams
  * @return bool
  */
 public function execute($inputParams = null)
 {
     $mode = OCI_COMMIT_ON_SUCCESS;
     if ($this->_pdoOci8->isTransaction()) {
         $mode = OCI_DEFAULT;
     }
     // Set up bound parameters, if passed in
     if (is_array($inputParams)) {
         foreach ($inputParams as $key => $value) {
             $this->bindParam($key, $value);
         }
     }
     return oci_execute($this->_sth, $mode);
 }
Esempio n. 2
0
 /**
  * Binds a parameter to the specified variable name
  *
  * @param string $parameter
  * @param mixed $variable
  * @param int $dataType
  * @param int $maxLength
  * @param array $options
  * @return bool
  * @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_INT;
             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 = SQLT_BLOB;
             break;
         case \PDO::PARAM_STMT:
             $oci_type = OCI_B_CURSOR;
             //Result sets require a cursor
             $variable = $this->_pdoOci8->getNewCursor();
             break;
     }
     //Bind the parameter
     $result = oci_bind_by_name($this->_sth, $parameter, $variable, $maxLength, $oci_type);
     return $result;
 }
Esempio n. 3
0
 /**
  * Tests quoting a string
  */
 public function testQuote()
 {
     $strToQuote = "O'Reilly";
     $quotedStr = "'O''Reilly'";
     $this->assertEquals($quotedStr, $this->_object->quote($strToQuote));
 }