本文整理汇总了PHP中oci_field_name函数的典型用法代码示例。如果您正苦于以下问题:PHP oci_field_name函数的具体用法?PHP oci_field_name怎么用?PHP oci_field_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了oci_field_name函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
}
示例2: fetchAndUpdateFacultyInfo
function fetchAndUpdateFacultyInfo($query, $conn, $nextPage)
{
$stid = oci_parse($conn, $query);
var_dump($query);
oci_execute($stid);
echo "<form action=\"{$nextPage}?user=FACULTY\">";
echo "<table border='1'>\n";
while ($row = oci_fetch_array($stid, OCI_ASSOC + OCI_RETURN_NULLS)) {
$i = 1;
foreach ($row as $item) {
echo "<tr>\n";
$column_name = oci_field_name($stid, $i);
echo "<td> {$column_name} </td>\n";
if ($column_name == "UnityId" || $column_name == "FacultyNo" || $column_name == "Balance" || $column_name == "Type" || $column_name == "Category" || $column_name == "isHeld" || $column_name == "Department") {
echo " <td>" . "<input type=\"text\" name=\"{$column_name}\" value=\"{$item}\" readonly>" . "</td>\n";
} else {
echo " <td>" . "<input type=\"text\" name=\"{$column_name}\" value=\"{$item}\" >" . "</td>\n";
}
$i++;
echo "</tr>\n";
}
}
echo "</table>\n";
echo "<input type=\"submit\" value=\"Update\">";
echo "</form>";
}
示例3: GetData
function GetData($_start, $_count = 999999)
{
$_tpl_select_command = "SELECT {fields} FROM ( SELECT a.*, rownum rnum FROM ({SelectCommand}) a WHERE rownum <= " . ($_start + $_count) . " ) WHERE rnum >= " . $_start . " {where} {orderby} {groupby}";
//Fields
$_fields = "";
$_fld_array = array();
$_st_id = oci_parse($this->_Link, $this->SelectCommand);
if ($_st_id) {
oci_execute($_st_id);
$_num_fields = oci_num_fields($_st_id);
for ($i = 1; $i <= $_num_fields; $i++) {
array_push($_fld_array, '"' . oci_field_name($_st_id, $i) . '"');
}
}
for ($i = 0; $i < sizeof($_fld_array); $i++) {
$_fields .= ", " . $_fld_array[$i];
}
if ($_fields != "") {
$_fields = substr($_fields, 2);
}
//Filters
$_where = "";
$_filters = $this->Filters;
for ($i = 0; $i < sizeof($_filters); $i++) {
$_where .= " and " . $this->GetFilterExpression($_filters[$i]);
}
//Order
$_orderby = "";
$_orders = $this->Sorts;
for ($i = 0; $i < sizeof($_orders); $i++) {
$_orderby .= ", " . $_orders[$i]->Field . " " . $_orders[$i]->Order;
}
if ($_orderby != "") {
$_orderby = "ORDER BY " . substr($_orderby, 2);
}
//Group
$_groupby = "";
$_groups = $this->Groups;
for ($i = 0; $i < sizeof($_groups); $i++) {
$_groupby .= ", " . $_groups[$i]->Field;
}
if ($_groupby != "") {
$_groupby = "GROUP BY " . substr($_groupby, 2);
}
$_select_command = str_replace("{fields}", $_fields, $_tpl_select_command);
$_select_command = str_replace("{SelectCommand}", $this->SelectCommand, $_select_command);
$_select_command = str_replace("{where}", $_where, $_select_command);
$_select_command = str_replace("{orderby}", $_orderby, $_select_command);
$_select_command = str_replace("{groupby}", $_groupby, $_select_command);
$_rows = array();
$_st_id = oci_parse($this->_Link, $_select_command);
if ($_st_id) {
oci_execute($_st_id);
while ($_row = oci_fetch_array($_st_id, OCI_ASSOC + OCI_RETURN_NULLS)) {
array_push($_rows, $_row);
}
}
return $_rows;
}
示例4: getResultFields
public function getResultFields()
{
if (empty($this->resultFields)) {
$numFields = oci_num_fields($this->resource);
for ($i = 0; $i < $numFields; $i++) {
$this->resultFields[$i] = array("name" => oci_field_name($this->resource, $i + 1), "type" => oci_field_type($this->resource, $i + 1));
}
}
return $this->resultFields;
}
示例5: oci_field_name
public static function oci_field_name($connection, $statement, $fieldNumber)
{
self::checkOCIExtension('oci_field_name');
$name = @oci_field_name($statement, $fieldNumber);
if ($name === FALSE) {
$error = oci_error($connection);
throw new IllegalStateException(t('Could not retrieve the name of a field (field number: @fieldNumber) from the statement: @error', array('@fieldNumber' => $fieldNumber, '@error' => t($error['message']))));
}
return $name;
}
示例6: field_data
public function field_data()
{
$retval = array();
for ($c = 1, $fieldCount = $this->num_fields(); $c <= $fieldCount; $c++) {
$F = new stdClass();
$F->name = oci_field_name($this->stmt_id, $c);
$F->type = oci_field_type($this->stmt_id, $c);
$F->max_length = oci_field_size($this->stmt_id, $c);
$retval[] = $F;
}
return $retval;
}
示例7: fetchAssoc
function fetchAssoc()
{
if ($this->cursor >= $this->nrows) {
return false;
}
$row = $this->rows[$this->cursor++];
$ret = array();
foreach ($row as $k => $v) {
$lc = strtolower(oci_field_name($this->stmt, $k + 1));
$ret[$lc] = $v;
$ret[$k] = $v;
}
return $ret;
}
示例8: paginate
function paginate($start, $limit)
{
// Extract the fields being selected (swiped from PEAR::DB)
$sql = "SELECT * FROM ({$this->sql}) WHERE 1=1";
$stmt = new lmbOciStatement($this->connection, $sql);
$queryId = $this->connection->executeStatement($stmt->getStatement());
$ncols = oci_num_fields($queryId);
$cols = array();
for ($i = 1; $i <= $ncols; $i++) {
$cols[] = '"' . oci_field_name($queryId, $i) . '"';
}
$fields = implode(',', $cols);
// Build the paginated query...
$sql = "SELECT {$fields} FROM" . " (SELECT rownum as linenum, {$fields} FROM" . " ({$this->sql})" . ' WHERE rownum <= ' . ($start + $limit) . ') WHERE linenum >= ' . ++$start;
$this->sql = $sql;
}
示例9: fetchInfo
function fetchInfo($query, $conn)
{
$stid = oci_parse($conn, $query);
var_dump($query);
oci_execute($stid);
while ($row = oci_fetch_array($stid, OCI_ASSOC + OCI_RETURN_NULLS)) {
$i = 1;
echo "<tr>\n";
foreach ($row as $item) {
$column_name = oci_field_name($stid, $i);
echo " <td>" . $item . "</td>\n";
$i++;
}
echo "</tr>\n";
}
}
示例10: getFields
/**
* Returns an array of fields according to columns in the result.
*
* @return \Bitrix\Main\Entity\ScalarField[]
*/
public function getFields()
{
if ($this->resultFields == null) {
$this->resultFields = array();
if (is_resource($this->resource)) {
$numFields = oci_num_fields($this->resource);
if ($numFields > 0 && $this->connection) {
$helper = $this->connection->getSqlHelper();
for ($i = 1; $i <= $numFields; $i++) {
$name = oci_field_name($this->resource, $i);
$type = oci_field_type($this->resource, $i);
$parameters = array("precision" => oci_field_precision($this->resource, $i), "scale" => oci_field_scale($this->resource, $i), "size" => oci_field_size($this->resource, $i));
$this->resultFields[$name] = $helper->getFieldByColumnType($name, $type, $parameters);
}
}
}
}
return $this->resultFields;
}
示例11: _FetchField
function _FetchField($fieldOffset = -1)
{
global $QUERCUS;
$fld = new ADOFieldObject();
if (!empty($QUERCUS)) {
$fld->name = oci_field_name($this->_queryID, $fieldOffset);
$fld->type = oci_field_type($this->_queryID, $fieldOffset);
$fld->max_length = oci_field_size($this->_queryID, $fieldOffset);
//if ($fld->name == 'VAL6_NUM_12_4') $fld->type = 'NUMBER';
switch ($fld->type) {
case 'string':
$fld->type = 'VARCHAR';
break;
case 'real':
$fld->type = 'NUMBER';
break;
}
} else {
$fieldOffset += 1;
$fld->name = oci_field_name($this->_queryID, $fieldOffset);
$fld->type = oci_field_type($this->_queryID, $fieldOffset);
$fld->max_length = oci_field_size($this->_queryID, $fieldOffset);
}
switch ($fld->type) {
case 'NUMBER':
$p = oci_field_precision($this->_queryID, $fieldOffset);
$sc = oci_field_scale($this->_queryID, $fieldOffset);
if ($p != 0 && $sc == 0) {
$fld->type = 'INT';
}
$fld->scale = $p;
break;
case 'CLOB':
case 'NCLOB':
case 'BLOB':
$fld->max_length = -1;
break;
}
return $fld;
}
示例12: _getColumnMeta
private function _getColumnMeta($stmt, $columnIndex = 0)
{
$meta['name'] = \strtoupper(oci_field_name($stmt, $columnIndex + 1));
$meta['len'] = oci_field_size($stmt, $columnIndex + 1);
$type = oci_field_type($stmt, $columnIndex + 1);
$rType = 'C';
if ($type == "VARCHAR") {
$rType = 'C';
} elseif ($type == "CHAR") {
$rType = 'C';
} elseif ($type == "NUMBER") {
$rType = 'N';
} elseif ($type == "DATE") {
$rType = 'D';
} elseif ($type == "TIMESTAMP") {
$rType = 'D';
} elseif ($type == "BLOB") {
$rType = 'O';
} elseif ($type == "CLOB") {
$rType = 'O';
}
$meta['type'] = $rType;
return $meta;
}
示例13: getResultColumns
/**
* Returns metadata for all columns in a result set.
* @return array
*/
public function getResultColumns()
{
$count = oci_num_fields($this->resultSet);
$columns = array();
for ($i = 1; $i <= $count; $i++) {
$columns[] = array('name' => oci_field_name($this->resultSet, $i), 'table' => NULL, 'fullname' => oci_field_name($this->resultSet, $i), 'nativetype' => oci_field_type($this->resultSet, $i));
}
return $columns;
}
示例14: _execute
/**
* Executes a prepared statement.
*
* @param array $params OPTIONAL Values to bind to parameter placeholders.
* @return bool
* @throws \Zend\Db\Statement\Exception
*/
public function _execute(array $params = null)
{
$connection = $this->_adapter->getConnection();
if (!$this->_stmt) {
return false;
}
if ($params !== null) {
if (!is_array($params)) {
$params = array($params);
}
$error = false;
foreach (array_keys($params) as $name) {
if (!@oci_bind_by_name($this->_stmt, $name, $params[$name], -1)) {
$error = true;
break;
}
}
if ($error) {
throw new OracleException(oci_error($this->_stmt));
}
}
$retval = @oci_execute($this->_stmt, $this->_adapter->_getExecuteMode());
if ($retval === false) {
throw new OracleException(oci_error($this->_stmt));
}
$this->_keys = array();
if ($field_num = oci_num_fields($this->_stmt)) {
for ($i = 1; $i <= $field_num; $i++) {
$name = oci_field_name($this->_stmt, $i);
$this->_keys[] = $name;
}
}
$this->_values = array();
if ($this->_keys) {
$this->_values = array_fill(0, count($this->_keys), null);
}
return $retval;
}
示例15: header
<?php
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=OGP.OLO.xls");
include "config/connect.php";
$sql = OCIParse($connect, "SELECT * FROM SB_OLO WHERE STAT_SERVICE <> 'Closed'");
ociexecute($sql);
echo "<table border='1'>\n";
$ncols = oci_num_fields($sql);
echo "<tr>\n";
for ($i = 1; $i <= $ncols; ++$i) {
$colname = oci_field_name($sql, $i);
echo " <th><b>" . htmlentities($colname, ENT_QUOTES) . "</b></th>\n";
}
echo "</tr>\n";
while (($row = oci_fetch_array($sql, OCI_ASSOC + OCI_RETURN_NULLS)) != false) {
echo "<tr>\n";
foreach ($row as $therow) {
echo " <td>" . ($therow !== null ? htmlentities($therow, ENT_QUOTES) : " ") . "</td>\n";
}
echo "</tr>\n";
}
echo "</table>\n";