Esempio n. 1
0
 function select($fields, $tables, $where = "", $order_by = "", $group_by = "", $having = "")
 {
     $sql_stat = " select {$fields} from {$tables} ";
     if (!empty($where)) {
         $sql_stat .= "where {$where} ";
     }
     if (!empty($group_by)) {
         $sql_stat .= "group by {$group_by} ";
     }
     if (!empty($order_by)) {
         $sql_stat .= "order by {$order_by} ";
     }
     if (!empty($having)) {
         $sql_stat .= "having {$having} ";
     }
     $this->db_result = @sybase_query($sql_stat) or print "Error";
     $this->db_affected_rows = @sybase_num_rows($this->db_result);
     return $sql_stat;
 }
 /**
  * Number of rows in the result set
  *
  * @access	public
  * @return	integer
  */
 function num_rows()
 {
     return @sybase_num_rows($this->result_id);
 }
 /**
  * Gets the number of rows in a result set
  *
  * This method is not meant to be called directly.  Use
  * DB_result::numRows() instead.  It can't be declared "protected"
  * because DB_result is a separate object.
  *
  * @param resource $result  PHP's query result resource
  *
  * @return int  the number of rows.  A DB_Error object on failure.
  *
  * @see DB_result::numRows()
  */
 function numRows($result)
 {
     $rows = @sybase_num_rows($result);
     if ($rows === false) {
         return $this->sybaseRaiseError();
     }
     return $rows;
 }
 function _initrs()
 {
     global $ADODB_COUNTRECS;
     $this->_numOfRows = $ADODB_COUNTRECS ? @sybase_num_rows($this->_queryID) : -1;
     $this->_numOfFields = @sybase_num_fields($this->_queryID);
 }
Esempio n. 5
0
 /**
  * Returns number of rows in previous resultset. If no previous resultset exists,
  * this returns false.
  *
  * @return integer Number of rows in resultset
  */
 function lastNumRows()
 {
     if ($this->hasResult()) {
         return @sybase_num_rows($this->_result);
     }
     return null;
 }
Esempio n. 6
0
function sql_num_rows($res)
{
    global $dbtype;
    switch ($dbtype) {
        case "MySQL":
            $rows = mysql_num_rows($res);
            return $rows;
            break;
        case "mSQL":
            $rows = msql_num_rows($res);
            return $rows;
            break;
        case "postgres":
        case "postgres_local":
            $rows = pg_numrows($res->get_result());
            return $rows;
            break;
        case "ODBC":
        case "ODBC_Adabas":
            $rows = odbc_num_rows($res);
            return $rows;
            break;
        case "Interbase":
            echo "<BR>Error! PHP dosen't support ibase_numrows!<BR>";
            return $rows;
            break;
        case "Sybase":
            $rows = sybase_num_rows($res);
            return $rows;
            break;
        default:
            break;
    }
}
Esempio n. 7
0
 protected function _num_rows($result_id)
 {
     global $configArray;
     if (strcasecmp($configArray['System']['operatingSystem'], 'windows') == 0) {
         return sybase_num_rows($result_id);
     } else {
         return mssql_num_rows($result_id);
     }
 }
Esempio n. 8
0
 /**
  * Return the number of rows of the current result
  * @return integer
  */
 protected function num_rows()
 {
     return @sybase_num_rows($this->resResult);
 }
Esempio n. 9
0
 function num_rows()
 {
     return sybase_num_rows($this->Query_ID);
 }
 /**
  * Process end of query event.
  *
  * @param   var observable
  * @param   var dbevent
  */
 public function onQueryEnd($obs, $arg)
 {
     $this->cat->info($this->getClassName() . '::onQueryEnd() Query was:', sizeof($this->queries) == 1 ? $this->queries[0] : $this->queries);
     $result = $arg->getArgument();
     $sc = 0;
     $reads = 0;
     foreach (array_keys($this->messages) as $idx) {
         $msg = $this->messages[$idx];
         switch ($msg['msgnumber']) {
             case 3615:
                 $split = sscanf($msg['text'], 'Table: %s scan count %d, logical reads: (regular=%d apf=%d total=%d), physical reads: (regular=%d apf=%d total=%d), apf IOs used=%d');
                 $this->cat->infof('IO(%s): scan count= %d, logical= %d, physical= %d', $split[0], $split[1], $split[4], $split[7]);
                 // Add overall statistics
                 $sc += $split[1];
                 $reads += $split[4] + $split[7];
                 break;
             case 3614:
                 $split = sscanf($msg['text'], 'Total writes for this command: %d');
                 if ($split[0] > 0) {
                     $this->cat->infof('Write-IO: %d', $split[0]);
                 }
                 break;
         }
     }
     $this->cat->infof('Overall stats for query: scan count= %d, reads= %d', $sc, $reads);
     // Retrieve number of rows returned, then calculate average cost of row
     if (1 < ($nrows = sybase_num_rows($result->handle))) {
         $this->cat->infof('Average stats for query: scan count= %0.02f, reads= %0.02f (%d lines)', $sc / $nrows, $reads / $nrows, $nrows);
     }
     $this->queries = $this->messages = array();
 }
Esempio n. 11
0
 /**
  * Number of rows in a result
  *
  * @param   mixed $result
  * @return  integer
  */
 function numRows($result)
 {
     return sybase_num_rows($result);
 }
 function ExecuteScalar($sql)
 {
     $retVal = null;
     if (!$this->conn) {
         $this->Connect();
     }
     $res = sybase_query($sql, $this->conn);
     if ($res) {
         if (sybase_num_rows($res) > 0) {
             $retVal = sybase_result($res, 0, 0);
         }
         sybase_free_result($res);
     }
     return $retVal;
 }
Esempio n. 13
0
 /**
  * Returns number of rows in previous resultset. If no previous resultset exists,
  * this returns false.
  *
  * @return integer Number of rows in resultset
  */
 function lastNumRows()
 {
     if ($this->_result and is_resource($this->_result)) {
         return @sybase_num_rows($this->_result);
     }
     return null;
 }
Esempio n. 14
0
 public function numRows()
 {
     if (!empty($this->query)) {
         return sybase_num_rows($this->query);
     } else {
         return 0;
     }
 }