本文整理汇总了PHP中OCIFetchInto函数的典型用法代码示例。如果您正苦于以下问题:PHP OCIFetchInto函数的具体用法?PHP OCIFetchInto怎么用?PHP OCIFetchInto使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OCIFetchInto函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchRow
/**
* Fetches a row from the current result set.
*
* @access public
* @return array
*/
function fetchRow()
{
$row = @OCIFetchInto($this->result, $result, OCI_ASSOC);
if (is_array($row)) {
return array_change_key_case($result, CASE_LOWER);
}
return false;
}
示例2: fetchRow
/**
* Fetches a row from the current result set.
*
* @access public
* @return array
*/
function fetchRow()
{
if (is_resource($this->result)) {
if (@OCIFetchInto($this->result, $result, OCI_ASSOC)) {
return array_change_key_case($result, CASE_LOWER);
}
} else {
return false;
}
}
示例3: oci8Adapter
/**
* 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 oci8Adapter($d)
{
parent::RecordSetAdapter($d);
$fieldcount = ocinumcols($d);
for ($j = 0; $j < $fieldcount; $j++) {
$this->columnNames[] = ocicolumnname($d, $j + 1);
}
$i = 0;
while (OCIFetchInto($d, $line, OCI_NUM + OCI_RETURN_LOBS + OCI_RETURN_NULLS)) {
$this->rows[] = $line;
}
}
示例4: oci8Adapter
/**
* 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 oci8Adapter($d)
{
parent::RecordSetAdapter($d);
$fieldcount = ocinumcols($d);
$ob = "";
$be = $this->isBigEndian;
$fc = pack('N', $fieldcount);
$i = 0;
while (OCIFetchInto($d, $line, OCI_NUM + OCI_RETURN_LOBS + OCI_RETURN_NULLS)) {
// write all of the array elements
$ob .= "\n" . $fc;
foreach ($line as $value) {
// write all of the array elements
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 .= "";
}
}
$i++;
}
$this->serializedData = $ob;
for ($j = 0; $j < $fieldcount; $j++) {
$this->columnNames[] = $this->_charsetHandler->transliterate(ocicolumnname($d, $j + 1));
}
$this->numRows = $i;
}
示例5: read
public function read($id)
{
$query = "SELECT " . self::$_table["saveHandler"]["options"]["dataColumn"] . " FROM " . self::$_table["saveHandler"]["options"]["name"] . " WHERE " . self::$_table["saveHandler"]["options"]["primary"][0] . " = '" . $id . "'";
$stmt = OCIParse(self::$_db, $query);
if ($stmt) {
$result = OCIExecute($stmt);
if (OCIFetchInto($stmt, $result, OCI_ASSOC + OCI_RETURN_LOBS)) {
$ret = $result[self::$_table["saveHandler"]["options"]["dataColumn"]];
} else {
$ret = false;
}
OCIFreeStatement($stmt);
} else {
$ret = false;
}
return $ret;
}
示例6: registro_db
/**
* @name registro_db
* @param string cadena_sql
* @param int numero
* @return boolean
* @access public
*/
function registro_db($cadena_sql, $numero)
{
unset($this->registro);
if (!is_resource($this->enlace)) {
return FALSE;
}
//echo "Ejemplo: ".$cadena_sql."<br>";
$cadenaParser = OCIParse($this->enlace, $cadena_sql);
$busqueda = OCIExecute($cadenaParser);
if ($busqueda) {
$j = 0;
while (OCIFetchInto($cadenaParser, $row, OCI_RETURN_NULLS)) {
$a = 0;
$un_campo = 0;
$campos = count($row);
while ($a < $campos) {
$this->registro[$j][$un_campo] = $row[$a++];
$un_campo++;
}
$j++;
//$this->registro[$j][$un_campo] = $salida[$j][$un_campo];
//echo $this->registro[$j][$un_campo];
}
$this->conteo = $j--;
//echo $this->conteo;
@OCIFreeCursor($cadenaParser);
return $this->conteo;
} else {
unset($this->registro);
$this->error = oci_error();
//echo $this->error();
return 0;
}
}
示例7: fetchInto
/**
* Fetch a row and insert the data into an existing array.
*
* @param $result oci8 result identifier
* @param $arr (reference) array where data from the row is stored
* @param $fetchmode how the array data should be indexed
* @param $rownum the row number to fetch (not yet supported)
*
* @return int DB_OK on success, a DB error code on failure
*/
function fetchInto($result, &$arr, $fetchmode = DB_FETCHMODE_DEFAULT, $rownum=NULL)
{
if ($rownum !== NULL) {
return $this->raiseError(DB_ERROR_NOT_CAPABLE);
}
if ($fetchmode == DB_FETCHMODE_DEFAULT) {
$fetchmode = $this->fetchmode;
}
if ($fetchmode & DB_FETCHMODE_ASSOC) {
$moredata = @OCIFetchInto($result,$arr,OCI_ASSOC+OCI_RETURN_NULLS+OCI_RETURN_LOBS);
} else {
$moredata = @OCIFetchInto($result,$arr,OCI_RETURN_NULLS+OCI_RETURN_LOBS);
}
if (!$moredata) {
return NULL;
}
return DB_OK;
}
示例8: _fillBuffer
/**
* Fill the row buffer
*
* @param int $rownum row number upto which the buffer should be filled
if the row number is null all rows are ready into the buffer
* @return boolean true on success, false on failure
* @access protected
*/
function _fillBuffer($rownum = null)
{
if (isset($this->buffer) && is_array($this->buffer)) {
if (is_null($rownum)) {
if (!end($this->buffer)) {
return false;
}
} elseif (isset($this->buffer[$rownum])) {
return (bool) $this->buffer[$rownum];
}
}
$row = true;
while ((is_null($rownum) || $this->buffer_rownum < $rownum) && ($row = @OCIFetchInto($this->result, $buffer, OCI_RETURN_NULLS))) {
++$this->buffer_rownum;
// remove additional column at the end
if ($this->offset > 0) {
array_pop($buffer);
}
if (empty($this->types)) {
foreach (array_keys($buffer) as $key) {
if (is_a($buffer[$key], 'oci-lob')) {
$buffer[$key] = $buffer[$key]->load();
}
}
}
$this->buffer[$this->buffer_rownum] = $buffer;
}
if (!$row) {
++$this->buffer_rownum;
$this->buffer[$this->buffer_rownum] = false;
return false;
}
return true;
}
示例9: db_fetch_array
function db_fetch_array($res)
{
global $db_type;
global $debug;
if ($db_type == "mysql") {
$ar = mysql_fetch_array($res, MYSQL_NUM);
return $ar;
} else {
if ($db_type == "oracle") {
$ar = array();
OCIFetchInto($res, $ar, OCI_NUM + OCI_RETURN_LOBS);
return $ar;
}
}
}
示例10: next_record
function next_record()
{
if (0 == OCIFetchInto($this->Parse, $result, OCI_ASSOC + OCI_RETURN_NULLS)) {
if ($this->Debug) {
printf("<br>ID: %d,Rows: %d<br>\n", $this->Link_ID, $this->num_rows());
}
$this->Row += 1;
$errno = OCIError($this->Parse);
if (1403 == $errno) {
# 1043 means no more records found
$this->Error = "";
$this->disconnect();
$stat = 0;
} else {
$this->Error = OCIError($this->Parse);
if ($this->Debug) {
printf("<br>Error: %s", $this->Error["message"]);
}
$stat = 0;
}
} else {
for ($ix = 1; $ix <= OCINumcols($this->Parse); $ix++) {
$col = strtoupper(OCIColumnname($this->Parse, $ix));
$colreturn = strtolower($col);
$this->Record["{$colreturn}"] = $result["{$col}"];
if ($this->Debug) {
echo "<b>[{$col}]</b>:" . $result["{$col}"] . "<br>\n";
}
}
$stat = 1;
}
return $stat;
}
示例11: query
function query($query)
{
/*
this function execute a query on a database MySQL using a SQL statement passed in the variable $query
and returns an array $rec with the result recordset.
Use this function ONLY with SELECT statements, if you want to execute INSERT or UPDATE
use the function query_execute().
*/
$rec = array();
include './config/registry_oracle_db.php';
//putenv("ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0");
# open connection to db
$conn = oci_connect($user_db, $password_db, $db) or die("Could not connect to Oracle database!") or die(ocierror());
//$rec=array();
# execute the EXEC query
$statement = ociparse($conn, $query);
$risultato = ociexecute($statement);
# open db
//$rec=array();
# execute the EXEC query
while (OCIFetchInto($statement, $row)) {
$rec[] = $row;
//print_r($row);
}
//OCIFetchInto ($statement, $row, OCI_ASSOC);
return $rec;
# close connection
oci_close($conn);
}
示例12: addDatasetsFromDatabase
function addDatasetsFromDatabase($query_result, $ctrlField, $valueField, $datsetParamArray = "", $link = "")
{
# Initialize variables
$paramset = "";
$tempContrl = "";
if (is_array($datsetParamArray) == false) {
$datsetParamArray = array();
}
# Calculate total no of array elements in datsetParamArray
$arrLimit = count($datsetParamArray);
$i = 1;
$tempParam = "";
if ($this->DataBaseType == "mysql") {
##### For My SQL Connection
$FieldArray = explode($this->del, $valueField);
if (count($FieldArray) > 1) {
### Muli Series
# fetching recordset
while ($row = mysql_fetch_array($query_result)) {
# Add Category
$this->addCategory($row[$ctrlField]);
}
$k = 0;
# Add daatset for multiple fields
foreach ($FieldArray as $FieldName) {
if ($k < $arrLimit) {
$tempParam = $datsetParamArray[$k];
} else {
$tempParam = "";
}
# Add Dataset with adddataset() function
$this->addDataset($FieldName, $tempParam);
# rewind query result
mysql_data_seek($query_result, 0);
while ($row = mysql_fetch_array($query_result)) {
# Generating URL link
if ($link == "") {
$paramset = "";
} else {
# Generating URL link from getLinkFromPattern
$paramset = "link=" . urlencode($this->getLinkFromPattern($row, $link));
}
# add value to dataset
$this->addChartData($row[$FieldName], $paramset, "");
}
$k++;
}
} else {
### Single Series
# fetching recordset
while ($row = mysql_fetch_array($query_result)) {
# Creating Control break depending on ctrlField
# if ctrlField value changes then dataset will be Generated
if ($tempContrl != $row[$ctrlField]) {
if ($i <= $arrLimit) {
$tempParam = $datsetParamArray[$i - 1];
} else {
$tempParam = "";
}
# Add Dataset with adddataset() function
$this->addDataset($row[$ctrlField], $tempParam);
$tempContrl = $row[$ctrlField];
$i++;
}
# Generating URL link
if ($link == "") {
$paramset = "";
} else {
# Generating URL link from getLinkFromPattern
$paramset = "link=" . urlencode($this->getLinkFromPattern($row, $link));
}
# add value to dataset
$this->addChartData($row[$valueField], $paramset, "");
}
}
} elseif ($this->DataBaseType == "oracle") {
# For Oracle Connection
# fetching recordset
while (OCIFetchInto($query_result, $row, OCI_ASSOC)) {
# Create Control break depending on ctrlField
# if ctrlField value changes then dataset will be Generated
if ($tempContrl != $row[$ctrlField]) {
if ($i <= $arrLimit) {
$tempParam = $datsetParamArray[$i - 1];
} else {
$tempParam = "";
}
# add Dataset
$this->addDataset($row[$ctrlField], $tempParam);
$tempContrl = $row[$ctrlField];
$i++;
}
# Generating URL link
if ($link == "") {
$paramset = "";
} else {
# Generating URL link from getLinkFromPattern
$paramset = "link=" . urlencode($this->getLinkFromPattern($row, $link));
}
# add value to dataset
//.........这里部分代码省略.........
示例13: DBGetQuery
function DBGetQuery($result, $arrayType = 1, $encode = true)
{
// Devuelve la siguiente fila dentro del result-array..
/*
if ($arrayType == 0)
$row = oci_fetch_array($result, OCI_NUM + OCI_RETURN_NULLS);
if ($arrayType == 1)
$row = oci_fetch_array($result, OCI_ASSOC + OCI_RETURN_NULLS);
if ($arrayType == 2)
$row = oci_fetch_array($result, OCI_ASSOC + OCI_NUM + OCI_RETURN_NULLS);
LO IDEAL SERIA USAR ESTO QUE ESTA COMENTADO EN LUGAR DE "OCIFETCHINTO" (QUE QUEDÓ OBSOLETO), PERO HAY QUE TENER CUIDADO, AL MENOS, CON LA FUNCION EXISTESQLORACLE QUE FALLA
EN LA ULTIMA LINEA (RETURN (COUNT($ROW) > 0);), SI SE CORRIGE ESO, SE PODRIA USAR..
*/
if ($arrayType == 0) {
OCIFetchInto($result, $row, OCI_NUM + OCI_RETURN_NULLS);
}
if ($arrayType == 1) {
OCIFetchInto($result, $row, OCI_ASSOC + OCI_RETURN_NULLS);
}
if ($arrayType == 2) {
OCIFetchInto($result, $row, OCI_ASSOC + OCI_NUM + OCI_RETURN_NULLS);
}
return adminXSS($row, $encode);
}
示例14: fetchInto
/**
* Fetch a row and return data in an array.
*
* @param resource $result result identifier
* @param int $fetchmode how the array data should be indexed
* @param int $rownum the row number to fetch
* @return mixed data array or NULL on success, a MDB error on failure
* @access public
*/
function fetchInto($result, $fetchmode = MDB_FETCHMODE_DEFAULT, $rownum = NULL)
{
$result_value = intval($result);
if (!isset($this->current_row[$result_value])) {
return $this->raiseError(MDB_ERROR, NULL, NULL, 'fetchInto: attemped to fetch on an unknown query result');
}
if ($fetchmode == MDB_FETCHMODE_DEFAULT) {
$fetchmode = $this->fetchmode;
}
if (is_null($rownum)) {
$rownum = $this->current_row[$result_value] + 1;
}
if (!isset($this->results[$result_value][$rownum]) && (!isset($this->results[$result_value][$this->highest_fetched_row[$result_value]]) || $this->results[$result_value][$this->highest_fetched_row[$result_value]] !== FALSE)) {
if (isset($this->limits[$result_value])) {
// upper limit
if ($rownum > $this->limits[$result_value][1]) {
// are all previous rows fetched so that we can set the end
// of the result set and not have any "holes" in between?
if ($rownum == 0 || isset($this->results[$result_value]) && count($this->results[$result_value]) == $rownum) {
$this->highest_fetched_row[$result_value] = $rownum;
$this->current_row[$result_value] = $rownum;
$this->results[$result_value][$rownum] = FALSE;
}
if ($this->options['autofree']) {
$this->freeResult($result);
}
return NULL;
}
// offset skipping
if (MDB::isError($this->_skipLimitOffset($result))) {
$this->current_row[$result_value] = 0;
$this->results[$result_value] = array(FALSE);
if ($this->options['autofree']) {
$this->freeResult($result);
}
return NULL;
}
}
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]);
}
if (!isset($this->results[$result_value][$rownum]) && (!isset($this->results[$result_value][$this->highest_fetched_row[$result_value]]) || $this->results[$result_value][$this->highest_fetched_row[$result_value]] !== FALSE)) {
while ($this->current_row[$result_value] < $rownum && @OCIFetchInto($result, $buffer, OCI_RETURN_NULLS)) {
++$this->current_row[$result_value];
$this->results[$result_value][$this->current_row[$result_value]] = $buffer;
}
// end of result set reached
if ($this->current_row[$result_value] < $rownum) {
++$this->current_row[$result_value];
$this->results[$result_value][$this->current_row[$result_value]] = FALSE;
}
}
$this->highest_fetched_row[$result_value] = max($this->highest_fetched_row[$result_value], $this->current_row[$result_value]);
} else {
++$this->current_row[$result_value];
}
if (isset($this->results[$result_value][$rownum]) && $this->results[$result_value][$rownum]) {
$row = $this->results[$result_value][$rownum];
} else {
if ($this->options['autofree']) {
$this->freeResult($result);
}
return NULL;
}
if ($fetchmode & MDB_FETCHMODE_ASSOC) {
$column_names = $this->getColumnNames($result);
foreach ($column_names as $name => $i) {
$column_names[$name] = $row[$i];
}
$row = $column_names;
}
if (isset($this->result_types[$result_value])) {
$row = $this->convertResultRow($result, $row);
}
return $row;
}
示例15: _fillBuffer
/**
* Fill the row buffer
*
* @param int $rownum row number upto which the buffer should be filled
if the row number is null all rows are ready into the buffer
* @return boolean true on success, false on failure
* @access private
*/
function _fillBuffer($rownum = null)
{
if (isset($this->buffer) && is_array($this->buffer)) {
if (is_null($rownum)) {
if (!end($this->buffer)) {
return false;
}
} else {
if (isset($this->buffer[$rownum])) {
return (bool) $this->buffer[$rownum];
}
}
}
if (!$this->_skipLimitOffset()) {
return false;
}
$row = true;
while ((is_null($rownum) || $this->buffer_rownum < $rownum) && (!isset($this->limits) || $this->buffer_rownum < $this->limits['limit']) && ($row = @OCIFetchInto($this->result, $buffer, OCI_RETURN_NULLS))) {
++$this->buffer_rownum;
$this->buffer[$this->buffer_rownum] = $buffer;
}
if (!$row) {
++$this->buffer_rownum;
$this->buffer[$this->buffer_rownum] = false;
return false;
} elseif (isset($this->limits) && $this->buffer_rownum >= $this->limits['limit']) {
++$this->buffer_rownum;
$this->buffer[$this->buffer_rownum] = false;
}
return true;
}