Example #1
0
 public function testBind()
 {
     $statement = new Statement("select * from test where id = :one", $this->connection);
     $string = $statement->toStringBindVariables();
     $this->assertSame('', $string);
     $statement->bind(array(':one' => 1, ':two' => 2));
     $string = $statement->toStringBindVariables();
     $this->assertSame(':one => 1', trim($string));
 }
Example #2
0
 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();
 }
Example #3
0
 /**
  * @param number $startTime microtime
  */
 protected function log($startTime)
 {
     if (!empty($this->logger)) {
         $this->logger->log($startTime, $this->statement->getSql(), $this->statement->toStringBindVariables());
     }
 }
Example #4
0
 /**
  * @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();
 }