コード例 #1
0
ファイル: ExecutorTest.php プロジェクト: winkbrace/oracle
 /**
  * test if the correct bind variable is used in case of overlap
  * Example: you could have :reseller or :resellersoort, and only :resellersoort is in the query
  * We don't want to attempt to bind :reseller in this case
  * I copied this test from BinderTest, because I absolutely want to make sure the query executes as expected
  */
 public function testOverlappingBindVariableNames()
 {
     $sql = "select *\n                from   dm_resellers r\n                join   dm_resellersoort rs on r.soortcode = rs.soortcode\n                where  rs.soortcode = :resellersoort";
     $statement = new Statement($sql, new Connection('dm'));
     $statement->bind(array(':reseller' => 'Tele2', ':resellersoort' => 1));
     $result = $statement->execute();
     $this->assertTrue($result);
 }
コード例 #2
0
ファイル: Error.php プロジェクト: winkbrace/oracle
 public function render()
 {
     // if error_reporting = 0 (hide all errors in production) don't show the error
     if (error_reporting() === 0) {
         return null;
     }
     $data = array('id' => 'sql' . mt_rand(0, 9999), 'error_message' => $this->getErrorMessage(), 'known_error_message' => $this->knownErrorMessage(), 'sql' => $this->statement->getSql(), 'binds' => $this->statement->toStringBindVariables());
     $view = $this->createErrorView($data);
     return $view->render();
 }
コード例 #3
0
ファイル: Fetcher.php プロジェクト: winkbrace/oracle
 protected function setNumRows()
 {
     // oci_num_rows will return the number of fetched rows so far for a SELECT statement
     // for all other query types this is fine
     // If the user has fetched records in a while loop, the num rows will be the amount of rows fetched so far.
     // When the user hasn't fetched anything yet, we will fetch the complete result and return the count.
     $this->numRows = oci_num_rows($this->statement->getResource());
     if ($this->statement->getStatementType() == 'SELECT' && empty($this->numRows)) {
         $this->fetchAll();
         // unlike fetchResult, this will only fetch the result when result is empty
         $this->numRows = $this->result->count();
     }
 }
コード例 #4
0
ファイル: Binder.php プロジェクト: winkbrace/oracle
 /**
  * Bind a variable for a procedure with an OUT parameter (size is required)
  * the out parameter can be fetched with getOutParameter($name)
  *
  * @param string $bind
  * @param string $name
  * @param int $size
  *
  * @return bool success
  */
 public function bindOutParameter($bind, $name, $size)
 {
     return oci_bind_by_name($this->statement->getResource(), $bind, $this->outParameters[$name], $size);
 }
コード例 #5
0
ファイル: Executor.php プロジェクト: winkbrace/oracle
 /**
  * Rollback
  */
 public function rollback()
 {
     return oci_rollback($this->statement->getConnectionResource());
 }
コード例 #6
0
ファイル: ErrorTest.php プロジェクト: winkbrace/oracle
 /**
  * @param $sql
  * @return Error
  */
 protected function runStatementToFail($sql)
 {
     $statement = new Statement($sql, $this->connection);
     $statement->execute();
     return new Error($statement);
 }
コード例 #7
0
ファイル: Debug.php プロジェクト: winkbrace/oracle
 /**
  * @return string
  */
 public function render()
 {
     $data = array('sql' => $this->statement->getSql(), 'binds' => $this->statement->toStringBindVariables(), 'schema' => $this->statement->getSchema());
     $view = new SimpleView(__DIR__ . '/debug.phtml', $data);
     return $view->render();
 }
コード例 #8
0
ファイル: StatementTest.php プロジェクト: winkbrace/oracle
 public function testGetSchema()
 {
     $statement = new Statement("select * from test", $this->connection);
     $this->assertEquals('TEST', $statement->getSchema());
 }