本文整理汇总了PHP中odbc_num_rows函数的典型用法代码示例。如果您正苦于以下问题:PHP odbc_num_rows函数的具体用法?PHP odbc_num_rows怎么用?PHP odbc_num_rows使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了odbc_num_rows函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: odbcAdapter
/**
* Constructor method for the adapter. This constructor implements the setting of the
* 3 required properties for the object.
*
* The body of this method was provided by Mario Falomir... Thanks.
*
* @param resource $d The datasource resource
*/
function odbcAdapter($d)
{
parent::RecordSetAdapter($d);
// count number of fields
$fieldcount = odbc_num_fields($d);
$ob = "";
$be = $this->isBigEndian;
$fc = pack('N', $fieldcount);
if (odbc_num_rows($d) > 0) {
$line = odbc_fetch_row($d, 0);
do {
// write all of the array elements
$ob .= "\n" . $fc;
for ($i = 1; $i <= $fieldcount; $i++) {
// write all of the array elements
$value = odbc_result($d, $i);
if (is_string($value)) {
// type as string
$os = $this->_directCharsetHandler->transliterate($value);
//string flag, string length, and string
$len = strlen($os);
if ($len < 65536) {
$ob .= "" . pack('n', $len) . $os;
} else {
$ob .= "\f" . pack('N', $len) . $os;
}
} elseif (is_float($value) || is_int($value)) {
// type as double
$b = pack('d', $value);
// pack the bytes
if ($be) {
// if we are a big-endian processor
$r = strrev($b);
} else {
// add the bytes to the output
$r = $b;
}
$ob .= "" . $r;
} elseif (is_bool($value)) {
//type as bool
$ob .= "";
$ob .= pack('c', $value);
} elseif (is_null($value)) {
// null
$ob .= "";
}
}
} while ($line = odbc_fetch_row($d));
}
$this->serializedData = $ob;
// grab the number of fields
// loop over all of the fields
for ($i = 1; $i <= $fieldcount; $i++) {
// decode each field name ready for encoding when it goes through serialization
// and save each field name into the array
$this->columnNames[$i - 1] = $this->_directCharsetHandler->transliterate(odbc_field_name($d, $i));
}
$this->numRows = odbc_num_rows($d);
}
示例2: head_cus
function head_cus($customer_no)
{
$link = Fconectar();
if ($link) {
// Se define la consulta que va a ejecutarse, como en sql
$sql_datos_cus = "\n\t\t\t\t\tSELECT C.par_cus_no, C.cus_no, C.cus_name, V1.slspsn_name AS Vendedor, V2.slspsn_name AS Cobrador, C.ar_terms_cd \n\t\t\t\t\tFROM\n\t\t\t\t\tARCUSFIL_SQL AS C,\n\t\t\t\t\tARSLMFIL_SQL AS V1,\n\t\t\t\t\tARSLMFIL_SQL AS V2\n\t\t\t\t\tWHERE\n\t\t\t\t\tC.slspsn_no = V1.slspsn_no AND\n\t\t\t\t\tC.collector = V2.slspsn_no AND\n\t\t\t\t\tC.cus_no = '{$customer_no}'\n\t\t\t\t";
// Se ejecuta la consulta y se guardan los resultados
$results = odbc_exec($link, $sql_datos_cus) or die("Error en instruccion SQL {$sql_datos_cus}");
$existe = odbc_num_rows($results);
if ($existe) {
$registro = odbc_fetch_array($results);
$head_cus_no = $registro['cus_no'];
$head_cus_name = $registro['cus_name'];
$head_ar_terms_cd = $registro['ar_terms_cd'];
$head_slspsn_name = $registro['Vendedor'];
$head_collector = $registro['Cobrador'];
} else {
$mensaje = "No existen registros!";
}
} else {
Ferror("No se pudo establecer coneccion con la Base de Datos!");
}
// Se cierra la conexión
odbc_close($link);
echo "\n\t\t<div align='center'>\n\t\t<table width='40%' border='3' cellpadding='0' cellspacing='10' bordercolor='#DCF3A4' align='center'>\n\t\t\t<th colspan='2'>EDADES DE CARTERA POR CLIENTE (Datos hasta: " . date('d-m-Y') . ")</th>\t\n\t\t\t<tr>\n\t\t\t\t<td>Cliente:</td>\n\t\t\t\t<td>(" . number_format($head_cus_no, 0, '', '') . ") - {$head_cus_name}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>Vendedor:</td>\n\t\t\t\t<td>{$head_slspsn_name}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>Cobrador:</td>\n\t\t\t\t<td>{$head_collector}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>Condición de Pago:</td>\n\t\t\t\t<td>{$head_ar_terms_cd}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td colspan='2' align='center'>Generado: " . date('d-m-Y H:i:s') . "</td>\n\t\t\t</tr>\n\t\t</table>\n\t\t</div>\n\t\t";
}
示例3: _retrieveHashValues
private function _retrieveHashValues()
{
$sql = 'Select ' . FIELD_JSON_BLOB . '
From ' . TABLENAME . '
Where ' . FIELD_OAIID . ' = ' . $this->oaiId;
$odbc_result = $this->odbc->exec($sql, 'Hash::_retrieveHashValues');
$num = odbc_num_rows($odbc_result);
if ($num <= 0) {
$this->log(INFO, $this->subject . ' : no hash found');
return false;
}
odbc_longreadlen($odbc_result, ODBC_MAX_LONGREAD_LENGTH);
odbc_fetch_row($odbc_result);
$data = false;
do {
$temp = odbc_result($odbc_result, 1);
if ($temp != null) {
$data .= $temp;
}
} while ($temp != null);
$this->hashesFromStore = json_decode($data, true);
if (!is_array($this->hashesFromStore)) {
$this->log(WARN, 'conversion to JSON failed, not using hash this time');
$this->log(WARN, $data);
return false;
}
$this->log(INFO, $this->subject . ' retrieved hashes from ' . count(array_keys($this->hashesFromStore)) . ' extractors ');
return true;
}
示例4: query
/**
* Execute a query and return the results
* @param string $query
* @param array $params
* @param bool $fetchResult Return a ressource or a an array
* @return resource|array
* @throws Exception
*/
public function query($query, $params = null, $fetchResult = false)
{
$this->checkConnection(true);
$this->log('Query: ' . $query);
if (!empty($params)) {
$this->log('Params: ' . print_r($params, true));
}
$start = microtime(true);
if (empty($params)) {
$res = $this->executeQuery($query);
} else {
$res = $this->executePreparedStatement($query, $params);
}
$end = microtime(true);
$this->log("Execution time: " . ($end - $start) . " seconds");
if ($fetchResult) {
$this->log('Num Rows: ' . odbc_num_rows($res));
$resutlSet = $this->getRows($res);
odbc_free_result($res);
$res = $resutlSet;
$resultSet = null;
$fetch = microtime(true);
$this->log("Fetch time: " . ($fetch - $end) . " seconds");
}
return $res;
}
示例5: ImportData
function ImportData($objOdbc, $objMySql, $strTableName)
{
global $objMySql;
$objMySql->query("TRUNCATE `" . strtolower($strTableName) . '`;');
$objResult = odbc_exec($objOdbc, "SELECT * FROM " . $strTableName . ";");
print "Migrating " . odbc_num_rows($objResult) . " rows of data for " . $strTableName . "... [0]";
$intCount = 0;
while ($arrResult = odbc_fetch_array($objResult)) {
print str_repeat(chr(8), strlen($intCount) + 1);
$intCount++;
print $intCount . ']';
$strColumns = 'pkid';
$strValues = 'NULL';
foreach ($arrResult as $strKey => $strValue) {
$strColumns .= ', `' . strtolower($strKey) . '`';
if (strlen($strValue)) {
$strValues .= ", '" . $objMySql->escape_string($strValue) . "'";
} else {
$strValues .= ', NULL';
}
}
$strSql = sprintf('INSERT INTO `%s` VALUES (%s);', strtolower($strTableName), $strValues);
$objMySql->query($strSql);
}
print " Done.\r\n";
}
示例6: odbcdb_query_value
function odbcdb_query_value($query)
{
$this->result = odbc_exec($this->link, $query);
if ($this->result != FALSE) {
$num_rows = odbc_num_rows($this->result);
}
return $num_rows;
}
示例7: num_rows
function num_rows($res)
{
if ($num = odbc_num_rows($res)) {
return $num;
} else {
return false;
}
}
示例8: getNumRows
public function getNumRows($result)
{
if (!is_resource($result)) {
throw new DbControlException("Ilegal parameter result. Must be valid result resource.");
} else {
return @odbc_num_rows($result);
}
}
示例9: _affected_rows
function _affected_rows()
{
global $ODBC_ID, $last_odbc_result;
if (odbc_num_rows($last_odbc_result) != -1) {
return odbc_num_rows($last_odbc_result);
} else {
return 0;
}
}
示例10: num_rows
/**
* Number of rows in the result set
*
* @return int
*/
public function num_rows()
{
if (is_int($this->num_rows)) {
return $this->num_rows;
}
// Work-around for ODBC subdrivers that don't support num_rows()
if (($this->num_rows = @odbc_num_rows($this->result_id)) === -1) {
$this->num_rows = count($this->result_array());
}
return $this->num_rows;
}
示例11: list_rows
function list_rows($table, $order, $conditions = "")
{
global $dbConn, $dbResult;
$where = "";
if ($conditions != "") {
$where .= " WHERE " . $conditions;
}
$sql = "select * from " . $table . $where . " ORDER BY " . $order;
echo $sql;
$dbResult = odbc_exec($dbConn, $sql);
return odbc_num_rows($dbResult);
}
示例12: doublonContrat
function doublonContrat($num)
{
global $cnx;
$cnx = ouvresylob(1);
$select = "select * from informix.zz_contratmat where num_contratmat = '" . $num . "'";
$result = odbc_exec($cnx, $select);
if (odbc_num_rows($result) == 1) {
$doublon = 1;
} else {
$doublon = 0;
}
}
示例13: __construct
/**
* @see ResultSet::__construct()
*/
public function __construct(Connection $conn, $result, $fetchmode = null)
{
parent::__construct($conn, $result, $fetchmode);
/**
* Some ODBC drivers appear not to handle odbc_num_rows() very well when
* more than one result handle is active at once. For example, the MySQL
* ODBC driver always returns the number of rows for the last executed
* result. For this reason, we'll store the row count here.
*/
$this->numRows = @odbc_num_rows($result->getHandle());
if ($this->numRows == -1) {
throw new SQLException('Error getting record count', $conn->nativeError());
}
}
示例14: __construct
/**
* @see ResultSet::__construct()
*/
public function __construct(Connection $conn, $result, $fetchmode = null)
{
parent::__construct($conn, $result, $fetchmode);
/**
* Some ODBC drivers appear not to handle odbc_num_rows() very well when
* more than one result handle is active at once. For example, the MySQL
* ODBC driver always returns the number of rows for the last executed
* result. For this reason, we'll store the row count here.
*
* Note also that many ODBC drivers do not support this method. In this
* case, getRecordCount() will perform a manual count.
*/
$this->numRows = @odbc_num_rows($result->getHandle());
$this->hasRowCount = $this->numRows != -1;
}
示例15: __construct
public function __construct()
{
global $ODBC, $LD_Items;
$_GET['ProductID'] = (int) $_GET['ProductID'];
$SQL_Q = $this->query("SELECT ConnectStat FROM MEMB_STAT WHERE memb___id='" . $_SESSION['Login'] . "'");
$SQL = mssql_fetch_object($SQL_Q);
if ($SQL->ConnectStat != 0) {
exit(Print_error("<ul><li>Você deve estar offline do jogo para efetuar essa ação!</li></ul>"));
}
$searchKitQ = $ODBC->query("SELECT priceFix FROM Kits WHERE active = 1 AND Number = " . $_GET['ProductID']);
if (odbc_num_rows($searchKitQ) == 0) {
exit(Print_error("<script type=\"text/javascript\">alert(\"Erro kit não cadastrado.\"); window.location='?';</script>"));
}
$searchItensKitQ = $ODBC->query("SELECT * FROM KitsItemsDetails WHERE kitNumber = " . $_GET['ProductID']);
echo "<ul><li>Aguarde em quanto sua compra é processada.</li><br />";
//Inicio Função independente para cobrar o kit
$searchKit = odbc_fetch_object($searchKitQ);
$SQL_Q = $this->query("SELECT " . GOLDCOLUMN . " FROM " . GOLDTABLE . " WHERE " . GOLDMEMBIDENT . " = '" . $_SESSION['Login'] . "'");
$SQL_R = mssql_fetch_row($SQL_Q);
if ($SQL_R[0] < $searchKit->priceFix) {
exit(Print_error("<ul><li>Desculpe, essa compra não pode ser realizada, pois seu saldo de " . GOLDNAME . " é insuficiente.</li></ul>"));
}
$SQL_Q = $this->query("UPDATE " . GOLDTABLE . " SET " . GOLDCOLUMN . " = " . GOLDCOLUMN . "-" . $searchKit->priceFix . " WHERE " . GOLDMEMBIDENT . " = '" . $_SESSION['Login'] . "' AND " . GOLDCOLUMN . " >= " . $searchKit->priceFix . "; select @@rowcount as rows;");
$SQL_R = mssql_fetch_object($SQL_Q);
if ((int) $SQL_R->rows == 0) {
exit(Print_error("<ul><li>Erro ao cobrar pelo kit.</li></ul>"));
}
//Fim Função independente para cobrar o kit
$ODBC->query("UPDATE Kits SET solds=solds+1 WHERE Number=" . $_GET['ProductID']);
$searchLastSoldNumberQ = $ODBC->query("SELECT max(Number) as Numb FROM LogSoldsKits");
$searchLastSoldNumber = odbc_fetch_object($searchLastSoldNumberQ);
$searchLastSoldNumber->Numb = (int) $searchLastSoldNumber->Numb + 1;
$ODBC->query("INSERT INTO LogSoldsKits (login,kitNumber,price,data) VALUES ('{$_SESSION['Login']}', {$_GET['ProductID']}, {$searchKit->priceFix}, '" . time() . "')");
require "sockets.lib.php";
//exit(var_dump($socketLib));
while ($searchItensKit = odbc_fetch_object($searchItensKitQ)) {
//var_dump($searchItensKit);
$LD_FinishBuy = new LD_FinishBuy($searchItensKit->itemNumber, $searchItensKit->fixLVL, $searchItensKit->fixOP, $searchItensKit->fixANC, $searchItensKit->fixSkill == 0 ? "false" : "true", $searchItensKit->fixLuck == 0 ? "false" : "true", $searchItensKit->fixOpEx1 == 0 ? "false" : "true", $searchItensKit->fixOpEx2 == 0 ? "false" : "true", $searchItensKit->fixOpEx3 == 0 ? "false" : "true", $searchItensKit->fixOpEx4 == 0 ? "false" : "true", $searchItensKit->fixOpEx5 == 0 ? "false" : "true", $searchItensKit->fixOpEx6 == 0 ? "false" : "true", $searchItensKit->fixJH, $searchItensKit->fixRefine == 0 ? "false" : "true", $searchItensKit->fixSocket1 == $socketLib['notSocket'] ? "false" : "true", $searchItensKit->fixSocket2 == $socketLib['notSocket'] ? "false" : "true", $searchItensKit->fixSocket3 == $socketLib['notSocket'] ? "false" : "true", $searchItensKit->fixSocket4 == $socketLib['notSocket'] ? "false" : "true", $searchItensKit->fixSocket5 == $socketLib['notSocket'] ? "false" : "true", $searchItensKit->fixSocket1, $searchItensKit->fixSocket2, $searchItensKit->fixSocket3, $searchItensKit->fixSocket4, $searchItensKit->fixSocket5, true);
$ODBC->query("INSERT INTO LogSoldsKitsDetails (NumberSoldKit,login,itemId,itemSerial) VALUES ({$searchLastSoldNumber->Numb}, '{$_SESSION['Login']}', '{$searchItensKit->itemNumber}', '{$LD_Items->Item_Serial}')");
if ($LD_FinishBuy->delivered == true) {
echo "<li>Item: <strong>{$LD_FinishBuy->NAME}</strong>, entregue.</li>";
} else {
echo "<li>Item: <strong>{$LD_FinishBuy->NAME}</strong>, não houve espaço. <br />Libere espaço no bau e reenvie o item pelo histórico de compras.</li>";
}
unset($LD_FinishBuy);
}
echo "<br /><li>Compra finalizada com sucesso!</li></ul>";
}