Exemplo n.º 1
0
 /**
  * This function initializes the class.
  *
  * @access public
  * @override
  * @param DB_Connection_Driver $connection  the connection to be used
  * @param string $sql                       the SQL statement to be queried
  * @param integer $mode                     the execution mode to be used
  * @throws Throwable_SQL_Exception          indicates that the query failed
  */
 public function __construct(DB_Connection_Driver $connection, $sql, $mode = NULL)
 {
     $resource = $connection->get_resource();
     $command = @mysqli_query($resource, $sql);
     if ($command === FALSE) {
         throw new Throwable_SQL_Exception('Message: Failed to query SQL statement. Reason: :reason', array(':reason' => @mysqli_error($resource)));
     }
     $this->command = $command;
     $this->record = FALSE;
 }
Exemplo n.º 2
0
 /**
  * This function initializes the class.
  *
  * @access public
  * @override
  * @param DB_Connection_Driver $connection  the connection to be used
  * @param string $sql                       the SQL statement to be queried
  * @param integer $mode                     the execution mode to be used
  * @throws Throwable_SQL_Exception          indicates that the query failed
  *
  * @see http://php.net/manual/en/function.sqlsrv-query.php
  */
 public function __construct(DB_Connection_Driver $connection, $sql, $mode = NULL)
 {
     $resource = $connection->get_resource();
     $command = @sqlsrv_query($resource, $sql);
     if ($command === FALSE) {
         $errors = @sqlsrv_errors(SQLSRV_ERR_ALL);
         $reason = (is_array($errors) and isset($errors[0]['message'])) ? $errors[0]['message'] : 'Unable to perform command.';
         throw new Throwable_SQL_Exception('Message: Failed to query SQL statement. Reason: :reason', array(':reason' => $reason));
     }
     $this->command = $command;
     $this->record = FALSE;
 }
Exemplo n.º 3
0
 /**
  * This function initializes the class.
  *
  * @access public
  * @override
  * @param DB_Connection_Driver $connection  the connection to be used
  * @param string $sql                       the SQL statement to be queried
  * @param integer $mode                     the execution mode to be used
  * @throws Throwable_SQL_Exception          indicates that the query failed
  *
  * @see http://www.php.net/manual/en/function.db2-prepare.php
  * @see http://www.php.net/manual/en/function.db2-execute.php
  * @see http://www.php.net/manual/en/function.db2-stmt-error.php
  */
 public function __construct(DB_Connection_Driver $connection, $sql, $mode = NULL)
 {
     $resource = $connection->get_resource();
     $command = @db2_prepare($resource, $sql);
     if ($command === FALSE) {
         throw new Throwable_SQL_Exception('Message: Failed to query SQL statement. Reason: :reason', array(':reason' => @db2_conn_errormsg($resource)));
     }
     if (!@db2_execute($command)) {
         throw new Throwable_SQL_Exception('Message: Failed to query SQL statement. Reason: :reason', array(':reason' => @db2_stmt_errormsg($command)));
     }
     $this->command = $command;
     $this->record = FALSE;
 }
Exemplo n.º 4
0
 /**
  * This function initializes the class.
  *
  * @access public
  * @override
  * @param DB_Connection_Driver $connection  the connection to be used
  * @param string $sql                       the SQL statement to be queried
  * @param integer $mode                     the execution mode to be used
  * @throws Throwable_SQL_Exception          indicates that the query failed
  */
 public function __construct(DB_Connection_Driver $connection, $sql, $mode = NULL)
 {
     $this->resource = $connection->get_resource();
     $command = @ibase_query($this->resource, $sql);
     if ($command === FALSE) {
         throw new Throwable_SQL_Exception('Message: Failed to query SQL statement. Reason: :reason', array(':reason' => @ibase_errmsg()));
     }
     $this->command = $command;
     $this->record = FALSE;
     $this->blobs = array();
     $count = (int) @ibase_num_fields($command);
     for ($i = 0; $i < $count; $i++) {
         $field = ibase_field_info($command, $i);
         if ($field['type'] == 'BLOB') {
             $this->blobs[] = $field['name'];
         }
     }
 }
Exemplo n.º 5
0
 /**
  * This function initializes the class.
  *
  * @access public
  * @override
  * @param DB_Connection_Driver $connection  the connection to be used
  * @param string $sql                       the SQL statement to be queried
  * @param integer $mode                     the execution mode to be used
  * @throws Throwable_SQL_Exception          indicates that the query failed
  */
 public function __construct(DB_Connection_Driver $connection, $sql, $mode = NULL)
 {
     $resource = $connection->get_resource();
     $command = @oci_parse($resource, trim($sql, "; \t\n\r\v"));
     if ($command === FALSE) {
         $error = @oci_error($resource);
         $reason = (is_array($error) and isset($error['message'])) ? $error['message'] : 'Unable to perform command.';
         throw new Throwable_SQL_Exception('Message: Failed to query SQL statement. Reason: :reason', array(':reason' => $reason));
     }
     if (!is_integer($mode)) {
         $mode = 32;
     }
     if (!oci_execute($command, $mode)) {
         $error = @oci_error($command);
         $reason = (is_array($error) and isset($error['message'])) ? $error['message'] : 'Unable to perform command.';
         throw new Throwable_SQL_Exception('Message: Failed to query SQL statement. Reason: :reason', array(':reason' => $reason));
     }
     $this->command = $command;
     $this->record = FALSE;
 }