本文整理汇总了PHP中OCIRowCount函数的典型用法代码示例。如果您正苦于以下问题:PHP OCIRowCount函数的具体用法?PHP OCIRowCount怎么用?PHP OCIRowCount使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OCIRowCount函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: db_affected_rows
function db_affected_rows($res)
{
global $db_type;
global $debug;
global $_connect_id;
if ($db_type == "mysql") {
return mysql_affected_rows($_connect_id);
} else {
if ($db_type == "oracle") {
return OCIRowCount($res);
}
}
}
示例2: affected_rows
function affected_rows()
{
return OCIRowCount($this->Parse);
}
示例3: free_results
/**
* db::free_results()
*
* @return
**/
function free_results()
{
global $GonxAdmin;
switch ($GonxAdmin["dbtype"]) {
case "mysql":
return mysql_free_result($this->dbQryResult);
break;
case "postgresql":
return pg_freeresult($this->dbQryResult);
break;
case "oracle":
return OCIRowCount($this->Link_ID);
break;
case "sqlite":
break;
case "mssql":
return mssql_free_result($this->dbQryResult);
break;
}
}
示例4: _doQuery
//.........这里部分代码省略.........
}
if (!MDB::isError($success)) {
if ($statement = @OCIParse($this->connection, $query)) {
if ($lobs) {
for (reset($this->clobs[$prepared_query]), $clob = 0; $clob < count($this->clobs[$prepared_query]); $clob++, next($this->clobs[$prepared_query])) {
$position = key($this->clobs[$prepared_query]);
if (!@OCIBindByName($statement, ':clob' . $position, $descriptors[$position], -1, OCI_B_CLOB)) {
$success = $this->oci8RaiseError(NULL, 'Do query: Could not bind clob upload descriptor');
break;
}
}
if (!MDB::isError($success)) {
for (reset($this->blobs[$prepared_query]), $blob = 0; $blob < count($this->blobs[$prepared_query]); $blob++, next($this->blobs[$prepared_query])) {
$position = key($this->blobs[$prepared_query]);
if (!@OCIBindByName($statement, ':blob' . $position, $descriptors[$position], -1, OCI_B_BLOB)) {
$success = $this->oci8RaiseError(NULL, 'Do query: Could not bind blob upload descriptor');
break;
}
}
}
}
if (!MDB::isError($success)) {
if ($result = @OCIExecute($statement, $lobs == 0 && $this->auto_commit ? OCI_COMMIT_ON_SUCCESS : OCI_DEFAULT)) {
if ($lobs) {
for (reset($this->clobs[$prepared_query]), $clob = 0; $clob < count($this->clobs[$prepared_query]); $clob++, next($this->clobs[$prepared_query])) {
$position = key($this->clobs[$prepared_query]);
$clob_stream = $this->prepared_queries[$prepared_query - 1]['Values'][$position - 1];
for ($value = ''; !$this->endOfLOB($clob_stream);) {
if ($this->readLOB($clob_stream, $data, $this->getOption('lob_buffer_length')) < 0) {
$success = $this->raiseError();
break;
}
$value .= $data;
}
if (!MDB::isError($success) && !$descriptors[$position]->save($value)) {
$success = $this->oci8RaiseError(NULL, 'Do query: Could not upload clob data');
}
}
if (!MDB::isError($success)) {
for (reset($this->blobs[$prepared_query]), $blob = 0; $blob < count($this->blobs[$prepared_query]); $blob++, next($this->blobs[$prepared_query])) {
$position = key($this->blobs[$prepared_query]);
$blob_stream = $this->prepared_queries[$prepared_query - 1]['Values'][$position - 1];
for ($value = ''; !$this->endOfLOB($blob_stream);) {
if ($this->readLOB($blob_stream, $data, $this->getOption('lob_buffer_length')) < 0) {
$success = $this->raiseError();
break;
}
$value .= $data;
}
if (!MDB::isError($success) && !$descriptors[$position]->save($value)) {
$success = $this->oci8RaiseError(NULL, 'Do query: Could not upload blob data');
}
}
}
}
if ($this->auto_commit) {
if ($lobs) {
if (MDB::isError($success)) {
if (!@OCIRollback($this->connection)) {
$success = $this->oci8RaiseError(NULL, 'Do query: ' . $success->getUserinfo() . ' and then could not rollback LOB updating transaction');
}
} else {
if (!@OCICommit($this->connection)) {
$success = $this->oci8RaiseError(NULL, 'Do query: Could not commit pending LOB updating transaction');
}
}
}
} else {
$this->uncommitedqueries++;
}
if (!MDB::isError($success)) {
switch (@OCIStatementType($statement)) {
case 'SELECT':
$result_value = intval($statement);
$this->current_row[$result_value] = -1;
if ($limit > 0) {
$this->limits[$result_value] = array($first, $limit, 0);
}
$this->highest_fetched_row[$result_value] = -1;
break;
default:
$this->affected_rows = @OCIRowCount($statement);
@OCIFreeCursor($statement);
break;
}
$result = $statement;
}
} else {
return $this->oci8RaiseError($statement, 'Do query: Could not execute query');
}
}
} else {
return $this->oci8RaiseError(NULL, 'Do query: Could not parse query');
}
}
for (reset($descriptors), $descriptor = 0; $descriptor < count($descriptors); $descriptor++, next($descriptors)) {
@OCIFreeDesc($descriptors[key($descriptors)]);
}
return $result;
}
示例5: getNumRows
public function getNumRows($name)
{
return OCIRowCount($this->result[$name]);
}
示例6: 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.");
}
}
}
}
}
}
}
}
}
示例7: query
function query($query)
{
// For reg expressions
$query = trim($query);
$return_value = 0;
// Flush cached values..
$this->flush();
// Log how the function was called
$this->func_call = "\$db->query(\"{$query}\")";
// Keep track of the last query for debug..
$this->last_query = $query;
// Parses the query and returns a statement..
if (!($stmt = OCIParse($this->dbh, $query))) {
$this->print_error("Last Query", $query);
} elseif (!($this->result = OCIExecute($stmt))) {
$this->print_error("Last Query", $query);
}
$this->num_queries++;
// If query was an insert
if (preg_match('/^(insert|delete|update|create)\\s+/i', $query)) {
// num afected rows
$return_value = $this->rows_affected = OCIRowCount($stmt);
} else {
// Get column information
if ($num_cols = @OCINumCols($stmt)) {
// Fetch the column meta data
for ($i = 1; $i <= $num_cols; $i++) {
$this->col_info[$i - 1]->name = OCIColumnName($stmt, $i);
$this->col_info[$i - 1]->type = OCIColumnType($stmt, $i);
$this->col_info[$i - 1]->size = OCIColumnSize($stmt, $i);
}
}
// If there are any results then get them
if ($this->num_rows = @OCIFetchStatement($stmt, $results)) {
// Convert results into object orientated results..
// Due to Oracle strange return structure - loop through columns
foreach ($results as $col_title => $col_contents) {
$row_num = 0;
// then - loop through rows
foreach ($col_contents as $col_content) {
$this->last_result[$row_num]->{$col_title} = $col_content;
$row_num++;
}
}
}
// num result rows
$return_value = $this->num_rows;
}
// If debug ALL queries
$this->trace || $this->debug_all ? $this->debug() : null;
return $return_value;
}
示例8: DoQuery
//.........这里部分代码省略.........
$this->SetOCIError("Do query", "Could not bind clob upload descriptor", OCIError($statement));
$success = 0;
break;
}
}
if ($success) {
for (Reset($this->blobs[$prepared_query]), $blob = 0; $blob < count($this->blobs[$prepared_query]); $blob++, Next($this->blobs[$prepared_query])) {
$position = Key($this->blobs[$prepared_query]);
if (!OCIBindByName($statement, ":blob" . $position, $descriptors[$position], -1, OCI_B_BLOB)) {
$this->SetOCIError("Do query", "Could not bind blob upload descriptor", OCIError($statement));
$success = 0;
break;
}
}
}
}
if ($success) {
if ($result = @OCIExecute($statement, $lobs == 0 && $this->auto_commit ? OCI_COMMIT_ON_SUCCESS : OCI_DEFAULT)) {
if ($lobs) {
for (Reset($this->clobs[$prepared_query]), $clob = 0; $clob < count($this->clobs[$prepared_query]); $clob++, Next($this->clobs[$prepared_query])) {
$position = Key($this->clobs[$prepared_query]);
$clob_stream = $this->prepared_queries[$prepared_query - 1]["Values"][$position - 1];
for ($value = ""; !MetabaseEndOfLOB($clob_stream);) {
if (MetabaseReadLOB($clob_stream, $data, $this->lob_buffer_length) < 0) {
$this->SetError("Do query", MetabaseLOBError($clob));
$success = 0;
break;
}
$value .= $data;
}
if ($success && !$descriptors[$position]->save($value)) {
$this->SetOCIError("Do query", "Could not upload clob data", OCIError($statement));
$success = 0;
}
}
if ($success) {
for (Reset($this->blobs[$prepared_query]), $blob = 0; $blob < count($this->blobs[$prepared_query]); $blob++, Next($this->blobs[$prepared_query])) {
$position = Key($this->blobs[$prepared_query]);
$blob_stream = $this->prepared_queries[$prepared_query - 1]["Values"][$position - 1];
for ($value = ""; !MetabaseEndOfLOB($blob_stream);) {
if (MetabaseReadLOB($blob_stream, $data, $this->lob_buffer_length) < 0) {
$this->SetError("Do query", MetabaseLOBError($blob));
$success = 0;
break;
}
$value .= $data;
}
if ($success && !$descriptors[$position]->save($value)) {
$this->SetOCIError("Do query", "Could not upload blob data", OCIError($statement));
$success = 0;
}
}
}
}
if ($this->auto_commit) {
if ($lobs) {
if ($success) {
if (!OCICommit($this->connection)) {
$this->SetOCIError("Do query", "Could not commit pending LOB updating transaction", OCIError());
$success = 0;
}
} else {
if (!OCIRollback($this->connection)) {
$this->SetOCIError("Do query", $this->Error() . " and then could not rollback LOB updating transaction", OCIError());
}
}
}
} else {
$this->uncommitedqueries++;
}
if ($success) {
switch (OCIStatementType($statement)) {
case "SELECT":
$result_value = intval($statement);
$this->current_row[$result_value] = -1;
if ($limit > 0) {
$this->limits[$result_value] = array($first, $limit, 0);
}
$this->highest_fetched_row[$result_value] = -1;
break;
default:
$this->affected_rows = OCIRowCount($statement);
OCIFreeCursor($statement);
break;
}
$result = $statement;
}
} else {
$this->SetOCIError("Do query", "Could not execute query", OCIError($statement));
}
}
} else {
$this->SetOCIError("Do query", "Could not parse query", OCIError($statement));
}
}
for (Reset($descriptors), $descriptor = 0; $descriptor < count($descriptors); $descriptor++, Next($descriptors)) {
@OCIFreeDesc($descriptors[Key($descriptors)]);
}
return $result;
}
示例9: execute_request
//.........这里部分代码省略.........
// eko ( "<P>There are $nrows records containing your criteria. ($requete)</P>" ) ;
if ($nrows) {
// le nom des colonnes a ramener n'a pas été spécifié ou est *
if (!isset($tab_cols)) {
$ncols = OCINumCols($stmt);
for ($k = 1; $k <= $ncols; $k++) {
$tab_cols[] = OCIColumnName($stmt, $k);
}
}
for ($j = 0; $j < $nrows; $j++) {
if (isset($tab_cols) and is_array($tab_cols)) {
while (list($key, $val) = each($tab_cols)) {
if (isset(${$val})) {
${$val} .= $results[$val][$j] . "§";
} else {
${$val} = $results[$val][$j] . "§";
}
}
}
reset($tab_cols);
}
}
//Construction des tableaux de colonnes
if (isset($tab_cols) and is_array($tab_cols)) {
while (list($key, $val) = each($tab_cols)) {
// on retire le dernier |
${$val} = substr(${$val}, 0, strlen(${$val}) - 1);
$resultats[$val] = explode("§", ${$val});
}
}
$INDIC_SVC[2] = $nrows;
break;
case "INSERT":
$nrows = OCIRowCount($stmt);
$INDIC_SVC[2] = $nrows;
break;
case "UPDATE":
case "DELETE":
$nrows = OCIRowCount($stmt);
$INDIC_SVC[2] = $nrows;
break;
}
}
}
oci_close($conn);
break;
case "LDAP":
// Connexion au serveur LDAP
$ds = @ldap_connect($value_config['host']);
$bind = @ldap_bind($ds);
if ($ds) {
// On eclate les instructions LDAP dans un tableau
$instructions_ldap = explode("##", $requete);
$chemin = $instructions_ldap[0];
$filtre = $instructions_ldap[1];
// Fin de gestion du code sql
// Execution de la requete
$sr = ldap_search($ds, $chemin, $filtre);
// le nom des colonnes a ramener n'a pas été spécifié ou est *
if (!isset($tab_cols)) {
$entry = ldap_first_entry($ds, $sr);
$attrs = ldap_get_attributes($ds, $entry);
for ($l = 0; $l < sizeof($attrs); $l++) {
$tab_cols[] = $attrs[$l];
}
}
示例10: affected
/** returns rownum of affected rows */
function affected($stmt = FALSE)
{
if (!$stmt) {
$stmt = $this->stmt;
}
return @OCIRowCount($stmt);
}
示例11: countrows
function countrows()
{
return OCIRowCount($this->statement);
}
示例12: query
function query($query)
{
//去掉查询语句的前后空格
$query = trim($query);
$return_value = 0;
//清空缓存..
$this->flush();
//记录此函数如何被调用,用于调试...
$this->func_call = "\$db->query(\"{$query}\")";
//跟踪最后查询语句,用于调试..
$this->last_query = $query;
//解析查询语句
if (!($stmt = OCIParse($this->dbh, $query))) {
$this->print_error();
} elseif (!($this->result = OCIExecute($stmt))) {
$this->print_error();
}
$this->num_queries++;
//执行insert, delete, update, replace操作
if (preg_match('/^(insert|delete|update|create)\\s+/i', $query)) {
//获取操作所影响的记录行数
$return_value = $this->rows_affected = OCIRowCount($stmt);
} else {
//获取字段信息
if ($num_cols = @OCINumCols($stmt)) {
for ($i = 1; $i <= $num_cols; $i++) {
$this->col_info[$i - 1]->name = OCIColumnName($stmt, $i);
$this->col_info[$i - 1]->type = OCIColumnType($stmt, $i);
$this->col_info[$i - 1]->size = OCIColumnSize($stmt, $i);
}
}
//获取查询结果
if ($this->num_rows = @OCIFetchStatement($stmt, $results)) {
//将结果集转变成对象,因为oracle的返回结果比较奇怪:)
foreach ($results as $col_title => $col_contents) {
$row_num = 0;
//循环所有的行
foreach ($col_contents as $col_content) {
$this->last_result[$row_num]->{$col_title} = $col_content;
$row_num++;
}
}
}
//获取查询结果行数
$return_value = $this->num_rows;
}
//是否显示所有的查询信息
$this->debug_all ? $this->debug() : null;
return $return_value;
}
示例13: 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.'));
}
}
示例14: _affectedRows
/**
* 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 @OCIRowCount($result);
}
示例15: Affected_Rows
function Affected_Rows()
{
return OCIRowCount($this->_stmt);
}