作者:span2
项目:Kalla
/**
* 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;
}
作者:BackupTheBerlio
项目:nxwcms-sv
/**
* 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;
}
}
作者:FalconG
项目:DrEvon
/**
* 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;
}
}
作者:kseco
项目:civicr
/**
* 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;
}
作者:marcelocaixet
项目:zf
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;
}
作者:kipuprojec
项目:cor
/**
* @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;
}
}
作者:joeymeta
项目:v
/**
* 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;
}
作者:Rudi971
项目:luci
/**
* 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;
}
作者:adamfranc
项目:segue-1.
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;
}
}
}
作者:butc
项目:asterisk-cdr-plu
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;
}
作者:athoncop
项目:atho
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);
}
作者:Suba-Sa
项目:Major-Projec
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
//.........这里部分代码省略.........
作者:javierlo
项目:FuentesWe
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);
}
作者:GeekyNinj
项目:LifesavingCA
/**
* 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;
}
作者:GeekyNinj
项目:LifesavingCA
/**
* 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;
}
作者:pamcru
项目:unimedj
static function fetch_array($query)
{
$query = OCIFetchInto($query, $row, OCI_BOTH);
return $row;
}
作者:BackupTheBerlio
项目:campusma
/**
* get a searchresult from the String by searching in all name fields.
* Result is saved in the view class.
*
* Concept: look in the table fm_obj for the number. if it is found look for further information
* Concatenate ALL fields of fm_obj in where the number is found with all lines in the two tables
* where the ID is equal
*
*/
function getXYZByRoomNumber($searchParam)
{
$numResults = 0;
$sql = "SELECT DISTINCT " . $this->coordColumnX . "," . $this->coordColumnY . "," . $this->roomNamesColumn . "," . $this->roomNumberColumn . "," . $this->personTitelColumn . "," . $this->personNameColumn . "," . $this->personSurnameColumn . "," . $this->aboutStringColumn . " FROM (" . "(SELECT DISTINCT * FROM fm_obj WHERE LOWER(" . $this->roomNumberColumn . ") = LOWER('" . $searchParam . "')) o " . "INNER JOIN fm_stra a USING (OBJ_ID)) " . "LEFT OUTER JOIN fm_stpe p USING (OBJ_ID) ";
//print $sql;
$stmt = ociparse($this->conn, $sql);
ociexecute($stmt);
while (OCIFetchInto($stmt, $row, OCI_ASSOC)) {
$numResults++;
//print_r($row);
array_push($this->theView->result, new Room(isset($row[$this->coordColumnX]) && isset($row[$this->coordColumnY]) ? $row[$this->coordColumnX] . " " . $row[$this->coordColumnY] : null, isset($row[$this->roomNamesColumn]) ? $row[$this->roomNamesColumn] : null, isset($row[$this->roomNumberColumn]) ? $row[$this->roomNumberColumn] : null, isset($row[$this->personTitelColumn]) && isset($row[$this->personNameColumn]) && isset($row[$this->personSurnameColumn]) ? $row[$this->personTitelColumn] . " " . $row[$this->personNameColumn] . " " . $row[$this->personSurnameColumn] : null, "beispiel.jpg", isset($row[$this->aboutStringColumn]) ? $row[$this->aboutStringColumn] : null));
}
//print count($this->theView->rooms);
return $numResults;
}
作者:greendev
项目:freeradius-server-wase
function da_sql_fetch_array($statement, $config)
{
OCIFetchInto($statement, $temprow, OCI_ASSOC);
$row = array_change_key_case($temprow, CASE_LOWER);
if ($config[sql_debug] == 'true') {
print "<b>DEBUG(SQL,OCI DRIVER): Query Result: <pre>";
print_r($row);
print "</b></pre>\n";
}
return $row;
}
作者:BackupTheBerlio
项目:zv
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, $column_names)) {
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) && OCIFetchInto($result, $this->results[$result_value][$this->current_row[$result_value] + 1]); $this->current_row[$result_value]++) {
}
}
$this->rows[$result_value] = $this->current_row[$result_value] + 1;
}
return $this->rows[$result_value];
}
作者:javierlo
项目:FuentesWe
function DBGetQuery($result, $arrayType = 1, $encode = true)
{
// Devuelve la siguiente fila dentro del result-array..
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);
}