本文整理汇总了PHP中oci_num_fields函数的典型用法代码示例。如果您正苦于以下问题:PHP oci_num_fields函数的具体用法?PHP oci_num_fields怎么用?PHP oci_num_fields使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了oci_num_fields函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doQuery
/**
Execute an SQL query.
@param $sQueryString The query string
@return weeDatabaseDummyResult Only with SELECT queries: an object for results handling
*/
protected function doQuery($sQueryString)
{
$rStatement = oci_parse($this->rLink, $sQueryString);
$rStatement !== false or burn('DatabaseException', sprintf(_WT("Failed to parse the query with the following error:\n%s"), array_value(oci_error($this->rLink), 'message')));
// oci_execute triggers a warning when the statement could not be executed.
@oci_execute($rStatement, OCI_DEFAULT) or burn('DatabaseException', sprintf(_WT("Failed to execute the query with the following error:\n%s"), array_value(oci_error($rStatement), 'message')));
$this->iNumAffectedRows = oci_num_rows($rStatement);
if (oci_num_fields($rStatement) > 0) {
// TODO: Check whether the silence operator is really required here.
@oci_fetch_all($rStatement, $aRows, 0, -1, OCI_ASSOC | OCI_FETCHSTATEMENT_BY_ROW);
return new weeDatabaseDummyResult($aRows);
}
}
示例2: o_fetch_all
public function o_fetch_all($query, $action, $params = array(), $f_mode)
{
$result = array();
$this->execute($query, $action, $params);
$result["count"] = oci_num_fields($this->stid);
oci_fetch_all($this->stid, $res, 0, -1, $f_mode);
$result["data"] = $res;
$this->stid = null;
return $result;
}
示例3: cargarArray
function cargarArray($FUPE_CD_PROMOTOR, $FUPE_FE_ESTADO_DESDE, $FUPE_FE_ESTADO_HASTA, $queries)
{
include dirname(__FILE__) . '/conectar_ORACLE.php';
//echo $queries.";<br /><br />";
$array = array();
$query = oci_parse($c, $queries);
oci_execute($query);
$error = 0;
$ncols = oci_num_fields($query);
$cont = 0;
$j = 0;
$k = 0;
while ($row = oci_fetch_array($query, OCI_BOTH + OCI_RETURN_NULLS)) {
while ($cont < $ncols) {
$array[$j][$cont] = $row[$cont];
$cont++;
}
$cont = 0;
$k = 0;
$j++;
}
if (oci_num_rows($query) == 0) {
return false;
} else {
return $array;
}
}
示例4: 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;
}
}
示例5: 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;
}
示例6: num_fields
/**
* Number of fields in the result set
*
* @access public
* @return integer
*/
public function num_fields()
{
$count = @oci_num_fields($this->stmt_id);
// if we used a limit we subtract it
if ($this->limit_used) {
$count = $count - 1;
}
return $count;
}
示例7: 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;
}
示例8: __construct
/**
* @param Statement $statement
*/
public function __construct(Statement $statement)
{
$this->statement = $statement;
$this->statement->execute(Executor::NO_COMMIT);
// no reason to auto-commit after SELECT statements
// set attributes
$this->numFields = oci_num_fields($this->statement->getResource());
$this->setColumnNames();
$this->setColumnTypes();
}
示例9: oci_num_fields
public static function oci_num_fields($connection, $statement)
{
self::checkOCIExtension('oci_num_fields');
$columnCount = @oci_num_fields($statement);
if ($columnCount === FALSE) {
$error = oci_error($connection);
throw new IllegalStateException(t('Could not retrieve the number of result columns in a statement: @error', array('@error' => t($error['message']))));
}
return $columnCount;
}
示例10: 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;
}
示例11: 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;
}
示例12: oci_free_statement
echo "<td>" . $row[$NUM_COL] . "</td>";
}
$NUM_COL++;
}
echo "<td><a href='inicio_vermas.php?ESTADO={$NUM_HREF}'>Ver más</a></td>";
echo "</tr>";
$NUM_COL = 0;
$NUM_HREF++;
}
echo "</table>\n";
echo "</div>";
oci_free_statement($Duplicados1);
echo "<div class='sixteen columns'>";
echo "<h3>Procesos Automaticos</h3>";
echo "<table class='standard-table'>";
$ncols = oci_num_fields($Controles1);
echo "<tr>\n";
for ($i = 1; $i <= $ncols; ++$i) {
$colname = oci_field_name($Controles1, $i);
echo " <th><b>" . htmlentities($colname, ENT_QUOTES) . "</b></th>\n";
}
echo "</tr>\n";
while ($row = oci_fetch_array($Controles1, OCI_BOTH + OCI_RETURN_NULLS)) {
//Genero las columnas dinamicamente
echo "<tr>";
while ($NUM_COL < $ncols) {
if ($NUM_COL == 1) {
if ($row[$NUM_COL] == 0) {
echo "<td class=\"vacio\">" . $row[$NUM_COL] . "</td>";
} else {
echo "<td class=\"lleno\">" . $row[$NUM_COL] . "</td>";
示例13: querY
function querY($type, $host, $user, $pass, $db = '', $query)
{
$res = '';
switch ($type) {
case 'MySQL':
if (!function_exists('mysql_connect')) {
return 0;
}
$link = mysql_connect($host, $user, $pass);
if ($link) {
if (!empty($db)) {
mysql_select_db($db, $link);
}
$result = mysql_query($query, $link);
while ($data = mysql_fetch_row($result)) {
$res .= implode('|-|-|-|-|-|', $data) . '|+|+|+|+|+|';
}
$res .= '[+][+][+]';
for ($i = 0; $i < mysql_num_fields($result); $i++) {
$res .= mysql_field_name($result, $i) . '[-][-][-]';
}
mysql_close($link);
return $res;
}
break;
case 'MSSQL':
if (!function_exists('mssql_connect')) {
return 0;
}
$link = mssql_connect($host, $user, $pass);
if ($link) {
if (!empty($db)) {
mssql_select_db($db, $link);
}
$result = mssql_query($query, $link);
while ($data = mssql_fetch_row($result)) {
$res .= implode('|-|-|-|-|-|', $data) . '|+|+|+|+|+|';
}
$res .= '[+][+][+]';
for ($i = 0; $i < mssql_num_fields($result); $i++) {
$res .= mssql_field_name($result, $i) . '[-][-][-]';
}
mssql_close($link);
return $res;
}
break;
case 'Oracle':
if (!function_exists('ocilogon')) {
return 0;
}
$link = ocilogon($user, $pass, $db);
if ($link) {
$stm = ociparse($link, $query);
ociexecute($stm, OCI_DEFAULT);
while ($data = ocifetchinto($stm, $data, OCI_ASSOC + OCI_RETURN_NULLS)) {
$res .= implode('|-|-|-|-|-|', $data) . '|+|+|+|+|+|';
}
$res .= '[+][+][+]';
for ($i = 0; $i < oci_num_fields($stm); $i++) {
$res .= oci_field_name($stm, $i) . '[-][-][-]';
}
return $res;
}
break;
case 'PostgreSQL':
if (!function_exists('pg_connect')) {
return 0;
}
$link = pg_connect("host={$host} dbname={$db} user={$user} password={$pass}");
if ($link) {
$result = pg_query($link, $query);
while ($data = pg_fetch_row($result)) {
$res .= implode('|-|-|-|-|-|', $data) . '|+|+|+|+|+|';
}
$res .= '[+][+][+]';
for ($i = 0; $i < pg_num_fields($result); $i++) {
$res .= pg_field_name($result, $i) . '[-][-][-]';
}
pg_close($link);
return $res;
}
break;
}
return 0;
}
示例14: columnCount
/**
* {@inheritdoc}
*/
public function columnCount()
{
return oci_num_fields($this->_sth);
}
示例15: dirname
include dirname(__FILE__) . "/header.php";
include dirname(__FILE__) . '/conectar_ORACLE.php';
$FE_ESTADO_DESDE = $_REQUEST["FE_ESTADO_DESDE"];
$FE_ESTADO_HASTA = $_REQUEST["FE_ESTADO_HASTA"];
if (!empty($FE_ESTADO_DESDE) && !empty($FE_ESTADO_HASTA)) {
include dirname(__FILE__) . "/queries/query_controlTK.php";
$query1 = oci_parse($c, $query);
oci_execute($query1);
echo "<input type=\"hidden\" value=\"{$FE_ESTADO_DESDE}\" id=\"FE_ESTADO_DESDE\" />\n<input type=\"hidden\" value=\"{$FE_ESTADO_HASTA}\" id=\"FE_ESTADO_HASTA\" />\n<div class='container'>\n\t<div class='sixteen columns'>\n\t\t<div id='page-title'>\n\t\t\t<h2>Control TeleMarketing</h2>\n\t\t\t<div id='bolded-line'></div>\n\t\t</div>\n\t</div>\n</div>\n<div class='container'>\n\t<div class='sixteen columns'>\n\t\t<div class='field'>\n\t\t\t<input type=\"button\" id=\"boton_descargar_control\" onclick=\"controlTK()\" value=\"Descargar Planilla de Control TeleMarketing (Excel)\"/>\n\t\t</div>\n\t</div>\n\t<div class='sixteen columns'>\n\t\t\t<h3>Carga entre el {$FE_ESTADO_DESDE} y el {$FE_ESTADO_HASTA}</h3>\n\t</div>\n</div>\n<div class='container'>";
$NUM_COL = 0;
$NUM_HREF = 0;
echo "<div class='sixteen columns'>";
echo "<h3><a href=\"controlTK.php\">Volver Atrás</a></h3>";
echo "<table class='standard-table'>";
$ncols = oci_num_fields($query1);
echo "<tr>\n";
for ($i = 1; $i <= $ncols; ++$i) {
$colname = oci_field_name($query1, $i);
echo " <th><b>" . htmlentities($colname, ENT_QUOTES) . "</b></th>\n";
}
echo "<th><b>Ver más</b></th>";
echo "</tr>\n";
while ($row = oci_fetch_array($query1, OCI_BOTH + OCI_RETURN_NULLS)) {
//Genero las columnas dinamicamente
echo "<tr>";
while ($NUM_COL < $ncols) {
if ($NUM_COL == 0) {
$FLAG = $row[$NUM_COL];
if (substr($FLAG, 0, 3) == 'Con' || substr($FLAG, 0, 3) == 'Sin') {
echo "<td><span class=\"control\">" . $row[$NUM_COL] . "</span></td>";