コード例 #1
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();
 }
コード例 #2
0
ファイル: StatementTest.php プロジェクト: winkbrace/oracle
 /**
  * test that sql is sanitized on construct
  */
 public function testSetSql()
 {
     $sql = "select *" . "\r\n\r\n" . "from" . "\r\n\r\n" . "user_tables";
     $statement = new Statement($sql, $this->connection);
     $sql = $statement->getSql();
     // \r\n should be replaced with \n everywhere
     $this->assertNotContains("\r\n", $sql);
     // remove empty lines
     $this->assertEquals("select *\nfrom\nuser_tables", $sql);
 }
コード例 #3
0
ファイル: Binder.php プロジェクト: winkbrace/oracle
 /**
  * Check if the bind variable exists in the sql
  * With this check, we can use the binds for all reports without the need to define
  * which bind variables to use for which reports
  *
  * @param string $bind
  * @return boolean
  */
 protected function bindVariableUsedInSql($bind)
 {
     $sql = $this->statement->getSql();
     if (strpos($sql, $bind) === false) {
         return false;
     }
     // strip the ':' which is a word boundary character
     $checkBind = ltrim($bind, ':');
     // make sure the bind variable is not part of another bind variable (e.g. :reseller vs. :resellersoort)
     $pattern = '/:\\b' . $checkBind . '\\b/i';
     return preg_match($pattern, $sql) === 1;
 }
コード例 #4
0
ファイル: Executor.php プロジェクト: winkbrace/oracle
 /**
  * @param number $startTime microtime
  */
 protected function log($startTime)
 {
     if (!empty($this->logger)) {
         $this->logger->log($startTime, $this->statement->getSql(), $this->statement->toStringBindVariables());
     }
 }
コード例 #5
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();
 }