Example #1
0
 /**
  * Execute
  *
  * @param  ParameterContainer $parameters
  * @return mixed
  */
 public function execute($parameters = null)
 {
     if (!$this->isPrepared) {
         $this->prepare();
     }
     /** START Standard ParameterContainer Merging Block */
     if (!$this->parameterContainer instanceof ParameterContainer) {
         if ($parameters instanceof ParameterContainer) {
             $this->parameterContainer = $parameters;
             $parameters = null;
         } else {
             $this->parameterContainer = new ParameterContainer();
         }
     }
     if (is_array($parameters)) {
         $this->parameterContainer->setFromArray($parameters);
     }
     if ($this->parameterContainer->count() > 0) {
         $this->bindParametersFromContainer();
     }
     /** END Standard ParameterContainer Merging Block */
     if ($this->profiler) {
         $this->profiler->profilerStart($this);
     }
     if ($this->driver->getConnection()->inTransaction()) {
         $ret = @oci_execute($this->resource, OCI_NO_AUTO_COMMIT);
     } else {
         $ret = @oci_execute($this->resource, OCI_COMMIT_ON_SUCCESS);
     }
     if ($this->profiler) {
         $this->profiler->profilerFinish();
     }
     if ($ret === false) {
         $e = oci_error($this->resource);
         throw new Exception\RuntimeException($e['message'], $e['code']);
     }
     $result = $this->driver->createResult($this->resource);
     return $result;
 }
Example #2
0
 /**
  * {@inheritDoc}
  */
 public function execute($sql)
 {
     if (!$this->isConnected()) {
         $this->connect();
     }
     if ($this->profiler) {
         $this->profiler->profilerStart($sql);
     }
     $ociStmt = oci_parse($this->resource, $sql);
     if ($this->inTransaction) {
         $valid = @oci_execute($ociStmt, OCI_NO_AUTO_COMMIT);
     } else {
         $valid = @oci_execute($ociStmt, OCI_COMMIT_ON_SUCCESS);
     }
     if ($this->profiler) {
         $this->profiler->profilerFinish($sql);
     }
     if ($valid === false) {
         $e = oci_error($ociStmt);
         throw new Exception\InvalidQueryException($e['message'], $e['code']);
     }
     $resultPrototype = $this->driver->createResult($ociStmt);
     return $resultPrototype;
 }