本文整理汇总了PHP中oci_num_rows函数的典型用法代码示例。如果您正苦于以下问题:PHP oci_num_rows函数的具体用法?PHP oci_num_rows怎么用?PHP oci_num_rows使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了oci_num_rows函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doQuery
/**
Execute an SQL query.
@param $sQueryString The query string
@return weeDatabaseDummyResult Only with SELECT queries: an object for results handling
*/
protected function doQuery($sQueryString)
{
$rStatement = oci_parse($this->rLink, $sQueryString);
$rStatement !== false or burn('DatabaseException', sprintf(_WT("Failed to parse the query with the following error:\n%s"), array_value(oci_error($this->rLink), 'message')));
// oci_execute triggers a warning when the statement could not be executed.
@oci_execute($rStatement, OCI_DEFAULT) or burn('DatabaseException', sprintf(_WT("Failed to execute the query with the following error:\n%s"), array_value(oci_error($rStatement), 'message')));
$this->iNumAffectedRows = oci_num_rows($rStatement);
if (oci_num_fields($rStatement) > 0) {
// TODO: Check whether the silence operator is really required here.
@oci_fetch_all($rStatement, $aRows, 0, -1, OCI_ASSOC | OCI_FETCHSTATEMENT_BY_ROW);
return new weeDatabaseDummyResult($aRows);
}
}
示例2: cargarArray
function cargarArray($FUPE_CD_PROMOTOR, $FUPE_FE_ESTADO_DESDE, $FUPE_FE_ESTADO_HASTA, $queries)
{
include dirname(__FILE__) . '/conectar_ORACLE.php';
//echo $queries.";<br /><br />";
$array = array();
$query = oci_parse($c, $queries);
oci_execute($query);
$error = 0;
$ncols = oci_num_fields($query);
$cont = 0;
$j = 0;
$k = 0;
while ($row = oci_fetch_array($query, OCI_BOTH + OCI_RETURN_NULLS)) {
while ($cont < $ncols) {
$array[$j][$cont] = $row[$cont];
$cont++;
}
$cont = 0;
$k = 0;
$j++;
}
if (oci_num_rows($query) == 0) {
return false;
} else {
return $array;
}
}
示例3: cargarArray
function cargarArray($sentencia)
{
include dirname(__FILE__) . '/conectar_ORACLE.php';
$array = array();
$sentenciaExec = oci_parse($c, $sentencia);
oci_execute($sentenciaExec);
$error = 0;
$k = 0;
$ncols = oci_num_fields($sentenciaExec);
for ($i = 1; $i <= $ncols; ++$i) {
$colname = oci_field_name($sentenciaExec, $i);
$array[0][$k] = $colname;
$k++;
}
$cont = 0;
$j = 1;
$k = 0;
while ($row = oci_fetch_array($sentenciaExec, OCI_BOTH + OCI_RETURN_NULLS)) {
while ($cont < $ncols) {
$array[$j][$cont] = $row[$cont];
$cont++;
}
$cont = 0;
$k = 0;
$j++;
}
if (oci_num_rows($sentenciaExec) == 0) {
oci_free_statement($sentenciaExec);
return false;
} else {
oci_free_statement($sentenciaExec);
return $array;
}
}
示例4: _doExec
protected function _doExec($query)
{
if ($rs = $this->_doQuery($query)) {
return oci_num_rows($rs->id());
} else {
return 0;
}
}
示例5: getRecordCount
/**
* @see ResultSet::getRecordCount()
*/
function getRecordCount()
{
$rows = oci_num_rows($this->result);
if ($rows === false) {
throw new SQLException('Error fetching num rows', $this->conn->nativeError($this->result));
}
return (int) $rows;
}
示例6: get_ams_student
public function get_ams_student($student_id = NULL)
{
$conn = oci_connect('AMS_QUERIES', 'Oo_Hecha1_rohm3', '//192.168.170.171:1522/ACADEMIC');
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
} else {
if ($student_id == NULL) {
$sql = "SELECT * FROM GAOWNER.VIEW_STUDENT_DETAILS";
} else {
$sql = 'SELECT * FROM GAOWNER.VIEW_STUDENT_DETAILS WHERE STUDENT_NO LIKE \'%' . $student_id . '%\'';
}
$rs4 = oci_parse($conn, $sql);
oci_execute($rs4);
$rows = oci_num_rows($rs4);
$t = 0;
while (OCIFetch($rs4)) {
$t++;
$name1 = ociresult($rs4, "SURNAME");
$dob = ociresult($rs4, "DOB");
$gender = ociresult($rs4, "GENDER");
$oname1 = ociresult($rs4, "OTHER_NAMES");
$STUDENT_NO = ociresult($rs4, "STUDENT_NO");
$COURSES = ociresult($rs4, "COURSES");
$GUARDIAN_NAME1 = ociresult($rs4, "GUARDIAN_NAME");
$MOBILE_NO = ociresult($rs4, "MOBILE_NO");
$EMAIL = ociresult($rs4, "EMAIL");
$FACULTIES = ociresult($rs4, "FACULTIES");
// details to be saved
$name = str_replace("'", "", "{$name1}");
$oname = str_replace("'", "", "{$oname1}");
$GUARDIAN_NAME = str_replace("'", "", "{$GUARDIAN_NAME1}");
if (!empty($STUDENT_NO)) {
$exists = $this->student_exists($STUDENT_NO);
$data = array('title' => '', 'Surname' => $name, 'Other_names' => $oname, 'DOB' => $dob, 'contact' => $MOBILE_NO, 'gender' => $gender, 'student_Number' => $STUDENT_NO, 'courses' => $FACULTIES, 'GUARDIAN_NAME' => $GUARDIAN_NAME, 'faculty' => $FACULTIES);
if (!$exists) {
$this->db->insert('student', $data);
} else {
$this->db->where('student_Number', $STUDENT_NO);
$this->db->update('student', $data);
}
$date = date("Y-m-d H:i:s");
// data for patients patient date, visit type, strath number created by and modified by fields
if ($student_id != NULL) {
$patient_data = array('patient_number' => $this->create_patient_number(), 'patient_date' => $date, 'visit_type_id' => 1, 'strath_no' => $STUDENT_NO, 'created_by' => $this->session->userdata('personnel_id'), 'modified_by' => $this->session->userdata('personnel_id'));
$this->db->insert('patients', $patient_data);
return $this->db->insert_id();
}
} else {
$this->session->set_userdata("error_message", "Student could not be found");
return FALSE;
}
}
if ($student_id != NULL) {
return TRUE;
}
}
}
示例7: exec
/**
* 执行一个SQL语句
*
* @param sql 需要执行的SQL语句
*/
public function exec($sql)
{
$this->arrSql[] = $sql;
$result = oci_parse($this->conn, $sql);
if (!oci_execute($result)) {
$e = oci_error($result);
spError("{$sql}<br />执行错误: " . strip_tags($e['message']));
}
$this->num_rows = oci_num_rows($result);
return $result;
}
示例8: exec
public function exec(&$statement)
{
$result =& $this->temp_result;
if (($result = oci_parse($this->link, $statement)) && @oci_execute($result, $this->autocommit ? OCI_COMMIT_ON_SUCCESS : OCI_DEFAULT)) {
if ('SELECT' == oci_statement_type($result)) {
oci_free_statement($result);
$result = null;
return 0;
}
$rows = oci_num_rows($result);
$result = null;
return $rows;
}
return false;
}
示例9: insert
public function insert($sql)
{
$this->last_query = $sql;
$this->stid = oci_parse($this->connection, $sql);
oci_bind_by_name($this->stid, ":ID", $id, 32);
$result = oci_execute($this->stid);
$this->affected_rows_value = oci_num_rows($this->stid);
$committed = oci_commit($this->connection);
//$commited, result from commit currently not analyzed, space for improvement
if ($result) {
return $id;
} else {
return -1;
}
}
示例10: traerSentencia
$descripcionArray[$i][1] = $row[1];
$descripcionArray[$i][2] = 0;
if (in_array($descripcionArray[$i][0], $FILTRO)) {
$descripcionArray[$i][2] = 1;
}
$sentencia = traerSentencia($FE_ESTADO_DESDE, $FE_ESTADO_HASTA, $OWNER, $TABLA_SENTENCIA, $TABLA_CONSULTAR, $TABLA_TITULOS, $i, $SELECT);
// Ejecuto el package que hace cada query y la almaceno en $sentencia.
$sentenciaArray = "sentenciaArray_" . $i;
if (isset($sentencia)) {
${$sentenciaArray} = cargarArray($sentencia);
// Le paso la sentencia, la ejecuto y la guardo en el array con nombre dinamico.
}
//echo $sentencia.";<br />\n\n";
$i++;
}
$cant = oci_num_rows($countTablaExec);
oci_free_statement($countTablaExec);
echo "<input type=\"hidden\" value=\"{$FE_ESTADO_DESDE}\" id=\"FE_ESTADO_DESDE\" />\n\t<input type=\"hidden\" value=\"{$FE_ESTADO_HASTA}\" id=\"FE_ESTADO_HASTA\" />\n\t<input type=\"hidden\" value=\"{$TABLAS}\" id=\"TABLAS\" />\n\t<input type=\"hidden\" value=\"{$OWNER}\" id=\"OWNER\" />\n\t<input type=\"hidden\" value=\"{$SELECT}\" id=\"SELECT\" />\n\t<input type=\"hidden\" value=\"{$NRO_SENTENCIA}\" id=\"NRO_SENTENCIA\" />\n\t<input type=\"hidden\" value=\"{$TABLA_TITULOS}\" id=\"TABLA_TITULOS\" />\n\t\n\t\n\t<div class='container'>\n\t<div class='sixteen columns'>\n\t\t<div id='page-title'>\n\t\t\t<h2>{$TIPO}</h2>\n\t\t\t<div id='bolded-line'></div>\n\t\t</div>\n\t</div>\n\t</div>\n\t<div class='container'>\n\t\t<div class='sixteen columns'>\n\t\t\t<div class='field'>\n\t\t\t\t<input type=\"button\" id=\"boton_descargar_control\" onclick=\"tableroControlMotivosIncidencias()\" value=\"Descargar {$TIPO} (Excel)\"/>\n\t\t\t</div>\n\t\t</div>\n\t\t<div class='sixteen columns'>\n\t\t\t\t<h3>Periodo entre el {$FE_ESTADO_DESDE} y el {$FE_ESTADO_HASTA}</h3>\n\t\t</div>\n\t</div>\n\t<div class='container'>";
echo "<div class='sixteen columns'>";
echo "<h3><a href=\"tableroControl_motivosIncidencias.php\">Volver Atrás</a></h3>";
echo "<table class='standard-table'>";
echo "<tr><th><b>Descripcion</b></th><th><b>Cantidad</b></th>";
echo "<th><b>Ver mas</b></th></tr>";
//$esControlProximo = false;
for ($i = 1; $i <= $cant; $i++) {
$esControl = false;
$esControlProximo = false;
if (strpos($descripcionArray[$i][1], 'Control ') !== false || strpos($descripcionArray[$i][1], 'Gestion Digital') !== false) {
$esControl = true;
}
if ($descripcionArray[$i][2] or $esControl) {
示例11: executeQueryOci
/**
* Execute Queries for Oracle Database
*
* @param type $sql
* @param type $connection
*/
function executeQueryOci($sql, $connection, $aParameter = array())
{
$aDNS = $connection->getDSN();
$sUsername = $aDNS["username"];
$sPassword = $aDNS["password"];
$sHostspec = $aDNS["hostspec"];
$sDatabse = $aDNS["database"];
$sPort = $aDNS["port"];
if ($sPort != "1521") {
// if not default port
$conn = oci_connect($sUsername, $sPassword, $sHostspec . ":" . $sPort . "/" . $sDatabse);
} else {
$conn = oci_connect($sUsername, $sPassword, $sHostspec . "/" . $sDatabse);
}
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
return $e;
}
switch (true) {
case preg_match("/^(SELECT|SHOW|DESCRIBE|DESC|WITH)\\s/i", $sql):
$stid = oci_parse($conn, $sql);
if (count($aParameter) > 0) {
foreach ($aParameter as $key => $val) {
oci_bind_by_name($stid, $key, $val);
}
}
oci_execute($stid, OCI_DEFAULT);
$result = array();
$i = 1;
while ($row = oci_fetch_array($stid, OCI_ASSOC + OCI_RETURN_NULLS)) {
$result[$i++] = $row;
}
oci_free_statement($stid);
oci_close($conn);
return $result;
break;
case preg_match("/^(INSERT|UPDATE|DELETE)\\s/i", $sql):
$stid = oci_parse($conn, $sql);
$isValid = true;
if (count($aParameter) > 0) {
foreach ($aParameter as $key => $val) {
oci_bind_by_name($stid, $key, $val);
}
}
$objExecute = oci_execute($stid, OCI_DEFAULT);
$result = oci_num_rows($stid);
if ($objExecute) {
oci_commit($conn);
} else {
oci_rollback($conn);
$isValid = false;
}
oci_free_statement($stid);
oci_close($conn);
if ($isValid) {
return $result;
} else {
return oci_error();
}
break;
default:
// Stored procedures
$stid = oci_parse($conn, $sql);
$aParameterRet = array();
if (count($aParameter) > 0) {
foreach ($aParameter as $key => $val) {
$aParameterRet[$key] = $val;
// The third parameter ($aParameterRet[$key]) returned a value by reference.
oci_bind_by_name($stid, $key, $aParameterRet[$key]);
}
}
$objExecute = oci_execute($stid, OCI_DEFAULT);
oci_free_statement($stid);
oci_close($conn);
return $aParameterRet;
break;
}
}
示例12: affected_rows
/**
* Affected Rows
*
* @return int
*/
public function affected_rows()
{
return oci_num_rows($this->stmt_id);
}
示例13: update
function update($table, $values, $conds, $fname = 'DatabaseOracle::update', $options = array())
{
global $wgContLang;
$table = $this->tableName($table);
$opts = $this->makeUpdateOptions($options);
$sql = "UPDATE {$opts} {$table} SET ";
$first = true;
foreach ($values as $col => &$val) {
$sqlSet = $this->fieldBindStatement($table, $col, $val, true);
if (!$first) {
$sqlSet = ', ' . $sqlSet;
} else {
$first = false;
}
$sql .= $sqlSet;
}
if ($conds !== array() && $conds !== '*') {
$conds = $this->wrapConditionsForWhere($table, $conds);
$sql .= ' WHERE ' . $this->makeList($conds, LIST_AND);
}
if (($this->mLastResult = $stmt = oci_parse($this->mConn, $sql)) === false) {
$e = oci_error($this->mConn);
$this->reportQueryError($e['message'], $e['code'], $sql, __METHOD__);
return false;
}
foreach ($values as $col => &$val) {
$col_info = $this->fieldInfoMulti($table, $col);
$col_type = $col_info != false ? $col_info->type() : 'CONSTANT';
if ($val === null) {
// do nothing ... null was inserted in statement creation
} elseif ($col_type != 'BLOB' && $col_type != 'CLOB') {
if (is_object($val)) {
$val = $val->getData();
}
if (preg_match('/^timestamp.*/i', $col_type) == 1 && strtolower($val) == 'infinity') {
$val = '31-12-2030 12:00:00.000000';
}
$val = $wgContLang != null ? $wgContLang->checkTitleEncoding($val) : $val;
if (oci_bind_by_name($stmt, ":{$col}", $val) === false) {
$e = oci_error($stmt);
$this->reportQueryError($e['message'], $e['code'], $sql, __METHOD__);
return false;
}
} else {
if (($lob[$col] = oci_new_descriptor($this->mConn, OCI_D_LOB)) === false) {
$e = oci_error($stmt);
throw new DBUnexpectedError($this, "Cannot create LOB descriptor: " . $e['message']);
}
if ($col_type == 'BLOB') {
$lob[$col]->writeTemporary($val);
oci_bind_by_name($stmt, ":{$col}", $lob[$col], -1, SQLT_BLOB);
} else {
$lob[$col]->writeTemporary($val);
oci_bind_by_name($stmt, ":{$col}", $lob[$col], -1, OCI_B_CLOB);
}
}
}
wfSuppressWarnings();
if (oci_execute($stmt, $this->execFlags()) === false) {
$e = oci_error($stmt);
if (!$this->ignore_DUP_VAL_ON_INDEX || $e['code'] != '1') {
$this->reportQueryError($e['message'], $e['code'], $sql, __METHOD__);
return false;
} else {
$this->mAffectedRows = oci_num_rows($stmt);
}
} else {
$this->mAffectedRows = oci_num_rows($stmt);
}
wfRestoreWarnings();
if (isset($lob)) {
foreach ($lob as $lob_v) {
$lob_v->free();
}
}
if (!$this->mTrxLevel) {
oci_commit($this->mConn);
}
oci_free_statement($stmt);
}
示例14: affected_rows
/**
* Número de Filas afectadas en un insert, update ó delete
*
* @param resource $resultQuery
* @return int
*/
function affected_rows($resultQuery = '')
{
if (!$this->id_connection) {
return false;
}
if (!$resultQuery) {
$resultQuery = $this->last_result_query;
if (!$resultQuery) {
return false;
}
}
if (($numberRows = oci_num_rows($resultQuery)) !== false) {
return $numberRows;
} else {
throw new KumbiaException($this->error('Resource invalido para db::affected_rows'));
}
return false;
}
示例15: execute
/**
+----------------------------------------------------------
* 执行语句
+----------------------------------------------------------
* @access public
+----------------------------------------------------------
* @param string $str sql指令
+----------------------------------------------------------
* @return integer
+----------------------------------------------------------
* @throws ThinkExecption
+----------------------------------------------------------
*/
public function execute($str)
{
$this->initConnect(true);
if (!$this->_linkID) {
return false;
}
$this->queryStr = $str;
// 判断新增操作
$flag = false;
if (preg_match("/^\\s*(INSERT\\s+INTO)\\s+(\\w+)\\s+/i", $this->queryStr, $match)) {
$this->table = C("DB_SEQUENCE_PREFIX") . str_ireplace(C("DB_PREFIX"), "", $match[2]);
$flag = (bool) $this->query("SELECT * FROM user_sequences WHERE sequence_name='" . strtoupper($this->table) . "'");
}
//modify by wyfeng at 2009.08.28
//更改事务模式
$this->mode = OCI_COMMIT_ON_SUCCESS;
//释放前次的查询结果
if ($this->queryID) {
$this->free();
}
$this->W(1);
$stmt = oci_parse($this->_linkID, $str);
$this->debug();
if (false === oci_execute($stmt)) {
$this->error();
return false;
} else {
$this->numRows = oci_num_rows($stmt);
$this->lastInsID = $flag ? $this->insert_last_id() : 0;
//modify by wyfeng at 2009.08.28
return $this->numRows;
}
}