Example #1
0
File: fbsql.php Project: roojs/pear
 /**
  * Determines the number of rows affected by a data maniuplation query
  *
  * 0 is returned for queries that don't manipulate data.
  *
  * @return int  the number of rows.  A DB_Error object on failure.
  */
 function affectedRows()
 {
     if ($this->_last_query_manip) {
         $result = @fbsql_affected_rows($this->connection);
     } else {
         $result = 0;
     }
     return $result;
 }
 function _affectedrows()
 {
     return fbsql_affected_rows($this->_connectionID);
 }
Example #3
0
 /**
  * Gets the number of rows affected by the data manipulation
  * query.  For other queries, this function returns 0.
  *
  * @return number of rows affected by the last query
  */
 function affectedRows()
 {
     if (DB::isManip($this->last_query)) {
         $result = @fbsql_affected_rows($this->connection);
     } else {
         $result = 0;
     }
     return $result;
 }
 /**
  * Send a query to the database and return any results
  *
  * @access public
  *
  * @param string  $query  the SQL query
  * @param mixed   $types  array that contains the types of the columns in
  *                        the result set
  *
  * @return mixed a result handle or MDB_OK on success, a MDB error on failure
  */
 function query($query, $types = NULL)
 {
     $this->debug("Query: {$query}");
     $ismanip = MDB::isManip($query);
     $this->last_query = $query;
     $first = $this->first_selected_row;
     $limit = $this->selected_row_limit;
     $this->first_selected_row = $this->selected_row_limit = 0;
     $result = $this->connect();
     if (MDB::isError($result)) {
         return $result;
     }
     if ($limit > 0) {
         if (!$ismanip) {
             $query = str_replace('SELECT', "SELECT TOP({$first},{$limit})", $query);
         }
     }
     if ($this->database_name != '') {
         if (!@fbsql_select_db($this->database_name, $this->connection)) {
             return $this->fbsqlRaiseError();
         }
     }
     // Add ; to the end of the query. This is required by FrontBase
     $query .= ';';
     if ($result = @fbsql_query($query, $this->connection)) {
         if ($ismanip) {
             $this->affected_rows = @fbsql_affected_rows($this->connection);
             return MDB_OK;
         } else {
             $result_value = intval($result);
             $this->highest_fetched_row[$result_value] = -1;
             if ($types != NULL) {
                 if (!is_array($types)) {
                     $types = array($types);
                 }
                 if (MDB::isError($err = $this->setResultTypes($result, $types))) {
                     $this->freeResult($result);
                     return $err;
                 }
             }
             return $result;
         }
     }
     return $this->fbsqlRaiseError();
 }
 public function affectedRows()
 {
     if (!empty($this->connect)) {
         return fbsql_affected_rows($this->connect);
     } else {
         return false;
     }
 }
Example #6
0
 /**
  * Returns the number of rows affected
  *
  * @param resource $result
  * @param resource $connection
  * @return mixed MDB2 Error Object or the number of rows affected
  * @access private
  */
 function _affectedRows($connection, $result = null)
 {
     if (null === $connection) {
         $connection = $this->getConnection();
         if (MDB2::isError($connection)) {
             return $connection;
         }
     }
     return @fbsql_affected_rows($connection);
 }
Example #7
0
 /**
  * returns the number of rows affected
  *
  * @param resource $result
  * @param resource $connection
  * @return mixed MDB2 Error Object or the number of rows affected
  * @access private
  */
 function _affectedRows($connection, $result = null)
 {
     if (is_null($connection)) {
         $connection = $this->getConnection();
         if (PEAR::isError($connection)) {
             return $connection;
         }
     }
     return @fbsql_affected_rows($connection);
 }