本文整理汇总了PHP中db2_num_rows函数的典型用法代码示例。如果您正苦于以下问题:PHP db2_num_rows函数的具体用法?PHP db2_num_rows怎么用?PHP db2_num_rows使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db2_num_rows函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rowCount
/**
*
* @return integer number of rows updated
*/
public function rowCount()
{
if (!$this->_stmt) {
return false;
}
$num = db2_num_rows($this->_stmt);
if ($num === false) {
throw new Zend_Db_Statement_Db2_Exception(db2_stmt_errormsg($this->_stmt), db2_stmt_error($this->_stmt));
}
return db2_num_rows($this->_stmt);
}
示例2: insert
function insert()
{
$conn = $this->connect();
if ($conn == true) {
$sql = "SELECT name from helloworld";
$stmt = db2_exec($conn, $sql);
$num_rows = db2_num_rows($stmt);
if ($num_rows == 0 || $num_rows == "") {
$sql = "INSERT INTO helloworld(NAME) VALUES ('Hello World')";
$stmt = db2_exec($conn, $sql);
}
}
}
示例3: _initrs
function _initrs()
{
global $ADODB_COUNTRECS;
$this->_numOfRows = $ADODB_COUNTRECS ? @db2_num_rows($this->_queryID) : -1;
$this->_numOfFields = @db2_num_fields($this->_queryID);
// some silly drivers such as db2 as/400 and intersystems cache return _numOfRows = 0
if ($this->_numOfRows == 0) {
$this->_numOfRows = -1;
}
}
示例4: lastNumRows
/**
* 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) {
return db2_num_rows($this->_result);
}
return null;
}
示例5: affectedRows
/**
* Returns the number of rows affected by the last query or 0
* @return Integer: the number of rows affected by the last query
*/
public function affectedRows()
{
if (!is_null($this->mAffectedRows)) {
// Forced result for simulated queries
return $this->mAffectedRows;
}
if (empty($this->mLastResult)) {
return 0;
}
return db2_num_rows($this->mLastResult);
}
示例6: getAffectedRows
/**
* Get affected rows
*
* @return integer
*/
public function getAffectedRows()
{
return db2_num_rows($this->resource);
}
示例7: dbi_affected_rows
function dbi_affected_rows($conn, $res)
{
if (strcmp($GLOBALS['db_type'], 'mysql') == 0) {
return mysql_affected_rows($conn);
} elseif (strcmp($GLOBALS['db_type'], 'mysqli') == 0) {
return $conn->affected_rows;
} elseif (strcmp($GLOBALS['db_type'], 'mssql') == 0) {
return mssql_rows_affected($conn);
} elseif (strcmp($GLOBALS['db_type'], 'oracle') == 0) {
return $GLOBALS['oracle_statement'] >= 0 ? OCIRowCount($GLOBALS['oracle_statement']) : -1;
} elseif (strcmp($GLOBALS['db_type'], 'postgresql') == 0) {
return pg_affected_rows($res);
} elseif (strcmp($GLOBALS['db_type'], 'odbc') == 0) {
return odbc_num_rows($res);
} elseif (strcmp($GLOBALS['db_type'], 'ibm_db2') == 0) {
return db2_num_rows($res);
} elseif (strcmp($GLOBALS['db_type'], 'ibase') == 0) {
return ibase_affected_rows($conn);
} elseif (strcmp($GLOBALS['db_type'], 'sqlite') == 0) {
return sqlite_changes($conn);
} else {
dbi_fatal_error('dbi_free_result (): ' . translate('db_type not defined.'));
}
}
示例8: dbi_affected_rows
/**
* Returns the number of rows affected by the last INSERT, UPDATE or DELETE.
*
* <b>Note:</b> Use the {@link dbi_error()} function to get error information
* if the connection fails.
*
* @param resource $conn The database connection
* @param resource $res The database query resource returned from
* the {@link dbi_query()} function.
*
* @return int The number or database rows affected.
*/
function dbi_affected_rows($conn, $res)
{
if (strcmp($GLOBALS["db_type"], "mysql") == 0) {
return mysql_affected_rows($conn);
} else {
if (strcmp($GLOBALS["db_type"], "mysqli") == 0) {
return mysqli_affected_rows($conn);
} else {
if (strcmp($GLOBALS["db_type"], "mssql") == 0) {
return mssql_affected_rows($conn);
} else {
if (strcmp($GLOBALS["db_type"], "oracle") == 0) {
if ($GLOBALS["oracle_statement"] >= 0) {
return OCIRowCount($GLOBALS["oracle_statement"]);
} else {
return -1;
}
} else {
if (strcmp($GLOBALS["db_type"], "postgresql") == 0) {
return pg_affected_rows($res);
} else {
if (strcmp($GLOBALS["db_type"], "odbc") == 0) {
return odbc_num_rows($res);
} else {
if (strcmp($GLOBALS["db_type"], "ibm_db2") == 0) {
return db2_num_rows($res);
} else {
if (strcmp($GLOBALS["db_type"], "ibase") == 0) {
return ibase_affected_rows($conn);
} else {
dbi_fatal_error("dbi_free_result(): db_type not defined.");
}
}
}
}
}
}
}
}
}
示例9: lastNumRows
/**
* {@inheritdoc}
*/
public function lastNumRows()
{
return $this->result ? db2_num_rows($this->result) : false;
}
示例10: execute
public function execute($bind_params = false)
{
$ret_val = false;
//----------------------------------------------
// Check Statement Resource
//----------------------------------------------
if (!$this->stmt) {
$this->gen_error('Invalid statement resource.');
return false;
}
//----------------------------------------------
// Check Bind Parameters
//----------------------------------------------
if (!is_array($bind_params)) {
$this->gen_error('Binding parameters must be passed as an array.');
return false;
}
$this->bind_params = $bind_params;
//----------------------------------------------
// Execute Query
//----------------------------------------------
$exec_status = @db2_execute($this->stmt, $bind_params);
//----------------------------------------------
// Check for Errors
//----------------------------------------------
if (!$exec_status) {
if ($this->check_and_print_stmt_error($this->stmt)) {
return false;
}
$this->gen_error('Prepared query execution failed.');
return false;
}
//----------------------------------------------
// Create Data Result Object if Necessary
//----------------------------------------------
if ($this->stmt && gettype($this->stmt) != 'boolean') {
//----------------------------------------------
// Affected Rows
//----------------------------------------------
$this->affected_rows = db2_num_rows($this->stmt);
$ret_val = $this->affected_rows;
//----------------------------------------------
// Create Data Result Object
//----------------------------------------------
$this->data_result = new data_result($this->stmt, $this->data_src);
//----------------------------------------------
// Last Insert ID
//----------------------------------------------
$this->last_id = db2_last_insert_id($this->handle);
}
//----------------------------------------------
// Return Data Result Object if it exists
//----------------------------------------------
if ($this->data_result) {
$this->num_rows = $this->data_result->num_rows();
$this->num_fields = $this->data_result->num_fields();
$ret_val = $this->data_result;
}
//----------------------------------------------
// Check for Errors
//----------------------------------------------
if ($this->check_and_print_stmt_error($this->stmt)) {
return false;
}
return $ret_val;
}
示例11: rowCount
/**
* {@inheritdoc}
*/
public function rowCount()
{
return (int) @db2_num_rows($this->_stmt);
}
示例12: set_num_rows
public function set_num_rows()
{
$this->num_recs = db2_num_rows($this->resource);
}
示例13: getAffectedRows
/**
* Get number of rows affected by query
*
* @return int
*/
public function getAffectedRows()
{
switch ($this->model) {
case "MYSQLI":
$return = $this->handler->affected_rows;
break;
case "MYSQL_PDO":
case "SQLITE_PDO":
case "ORACLE_PDO":
case "DBLIB_PDO":
$return = $this->raw_data->rowCount();
break;
case "DB2":
$return = db2_num_rows($this->raw_data);
break;
case "POSTGRESQL":
$return = pg_affected_rows($this->raw_data);
break;
}
return $return;
}
示例14: rowCount
/**
* {@inheritdoc}
*/
public function rowCount()
{
return @db2_num_rows($this->_stmt) ?: 0;
}
示例15: numRows
/**
* Number of rows in a result
*
* @param mixed $result
* @return integer
* @access public
* @author Thorsten Rinne <thorsten@phpmyfaq.de>
* @since 2005-04-16
*/
function numRows($result)
{
return db2_num_rows($result);
}