本文整理汇总了PHP中ocicolumnname函数的典型用法代码示例。如果您正苦于以下问题:PHP ocicolumnname函数的具体用法?PHP ocicolumnname怎么用?PHP ocicolumnname使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ocicolumnname函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
}
示例2: 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;
}
示例3: field_data
/**
* Field data
*
* Generates an array of objects containing field meta-data
*
* @access public
* @return array
*/
function field_data()
{
$retval = array();
$fieldCount = $this->num_fields();
for ($c = 1; $c <= $fieldCount; $c++) {
$F = new stdClass();
$F->name = ocicolumnname($this->stmt_id, $c);
$F->type = ocicolumntype($this->stmt_id, $c);
$F->max_length = ocicolumnsize($this->stmt_id, $c);
$retval[] = $F;
}
return $retval;
}
示例4: foreach
$querys = @explode(';', $_POST['db_query']);
foreach ($querys as $num => $query) {
if (strlen($query) > 5) {
echo "<font face=Verdana size=-2 color=green><b>Query#" . $num . " : " . htmlspecialchars($query) . "</b></font><br>";
$stat = @ociparse($db, $query);
@ociexecute($stat);
if ($error = @ocierror()) {
echo "<table width=100%><tr><td><font face=Verdana size=-2>Error : <b>" . $error['message'] . "</b></font></td></tr></table><br>";
} else {
$rowcount = @ocirowcount($stat);
if ($rowcount != 0) {
echo "<table width=100%><tr><td><font face=Verdana size=-2>affected rows : <b>" . $rowcount . "</b></font></td></tr></table><br>";
} else {
echo "<table width=100%><tr>";
for ($j = 1; $j <= @ocinumcols($stat); $j++) {
echo "<td bgcolor=#cccccc><font face=Verdana size=-2><b> " . htmlspecialchars(@ocicolumnname($stat, $j)) . " </b></font></td>";
}
echo "</tr>";
while (ocifetch($stat)) {
echo "<tr>";
for ($j = 1; $j <= @ocinumcols($stat); $j++) {
echo "<td><font face=Verdana size=-2> " . htmlspecialchars(@ociresult($stat, $j)) . " </font></td>";
}
echo "</tr>";
}
echo "</table><br>";
}
@ocifreestatement($stat);
}
}
}
示例5: write_data
function write_data($table_name)
{
global $db;
$ary_type = $ary_name = array();
// Grab all of the data from current table.
$sql = "SELECT *\n\t\t\tFROM {$table_name}";
$result = $db->sql_query($sql);
$i_num_fields = ocinumcols($result);
for ($i = 0; $i < $i_num_fields; $i++) {
$ary_type[$i] = ocicolumntype($result, $i + 1);
$ary_name[$i] = ocicolumnname($result, $i + 1);
}
$sql_data = '';
while ($row = $db->sql_fetchrow($result)) {
$schema_vals = $schema_fields = array();
// Build the SQL statement to recreate the data.
for ($i = 0; $i < $i_num_fields; $i++) {
// Oracle uses uppercase - we use lowercase
$str_val = $row[strtolower($ary_name[$i])];
if (preg_match('#char|text|bool|raw|clob#i', $ary_type[$i])) {
$str_quote = '';
$str_empty = "''";
$str_val = sanitize_data_oracle($str_val);
} else {
if (preg_match('#date|timestamp#i', $ary_type[$i])) {
if (empty($str_val)) {
$str_quote = '';
} else {
$str_quote = "'";
}
} else {
$str_quote = '';
$str_empty = 'NULL';
}
}
if (empty($str_val) && $str_val !== '0') {
$str_val = $str_empty;
}
$schema_vals[$i] = $str_quote . $str_val . $str_quote;
$schema_fields[$i] = '"' . $ary_name[$i] . '"';
}
// Take the ordered fields and their associated data and build it
// into a valid sql statement to recreate that field in the data.
$sql_data = "INSERT INTO {$table_name} (" . implode(', ', $schema_fields) . ') VALUES (' . implode(', ', $schema_vals) . ")\n/\n";
$this->flush($sql_data);
}
$db->sql_freeresult($result);
}
示例6: main
//.........这里部分代码省略.........
}
}
if (empty($str_val) && $str_val !== '0') {
$str_val = $str_empty;
}
$schema_vals[$i] = $str_quote . $str_val . $str_quote;
$schema_fields[$i] = "'" . $ary_name[$i] . "'";
}
// Take the ordered fields and their associated data and build it
// into a valid sql statement to recreate that field in the data.
$sql_data .= "INSERT INTO {$table_name} (" . implode(', ', $schema_fields) . ') VALUES(' . implode(', ', $schema_vals) . ");\n";
if ($store == true) {
$write($fp, $sql_data);
}
if ($download == true) {
if (!empty($oper)) {
echo $oper($sql_data);
} else {
echo $sql_data;
}
}
$sql_data = '';
}
$db->sql_freeresult($result);
break;
case 'oracle':
$ary_type = $ary_name = array();
// Grab all of the data from current table.
$sql = "SELECT *\n\t\t\t\t\t\t\t\t\t\t\tFROM {$table_name}";
$result = $db->sql_query($sql);
$i_num_fields = ocinumcols($result);
for ($i = 0; $i < $i_num_fields; $i++) {
$ary_type[$i] = ocicolumntype($result, $i);
$ary_name[$i] = ocicolumnname($result, $i);
}
while ($row = $db->sql_fetchrow($result)) {
$schema_vals = $schema_fields = array();
// Build the SQL statement to recreate the data.
for ($i = 0; $i < $i_num_fields; $i++) {
$str_val = $row[$ary_name[$i]];
if (preg_match('#char|text|bool#i', $ary_type[$i])) {
$str_quote = "'";
$str_empty = '';
$str_val = addslashes($str_val);
} else {
if (preg_match('#date|timestamp#i', $ary_type[$i])) {
if (empty($str_val)) {
$str_quote = '';
} else {
$str_quote = "'";
}
} else {
$str_quote = '';
$str_empty = 'NULL';
}
}
if (empty($str_val) && $str_val !== '0') {
$str_val = $str_empty;
}
$schema_vals[$i] = $str_quote . $str_val . $str_quote;
$schema_fields[$i] = '"' . $ary_name[$i] . "'";
}
// Take the ordered fields and their associated data and build it
// into a valid sql statement to recreate that field in the data.
$sql_data .= "INSERT INTO {$table_name} (" . implode(', ', $schema_fields) . ') VALUES(' . implode(', ', $schema_vals) . ");\n";
if ($store == true) {
示例7: selectLimit
/**
* 分页算法从 adodb 修改
*/
function selectLimit($sql, $length = 'ALL', $offset = 0)
{
if (strpos($sql, '/*+') !== false) {
$sql = str_replace('/*+ ', '/*+FIRST_ROWS ', $sql);
} else {
$sql = preg_replace('/^[ \\t\\n]*SELECT/i', 'SELECT /*+FIRST_ROWS*/', $sql);
}
$selectOffsetAlg1 = 100;
$inputarr = array();
if ($offset < $selectOffsetAlg1) {
if ($length > 0) {
if ($offset > 0) {
$length += $offset;
}
$sql = "SELECT * FROM ({$sql}) WHERE ROWNUM <= :length";
$inputarr['length'] = $length;
}
$stmt = $this->execute($sql, $inputarr);
for ($i = 0; $i < $offset; $i++) {
ocifetch($stmt);
}
return $stmt;
} else {
// Algorithm by Tomas V V Cox, from PEAR DB oci8.php
// Let Oracle return the name of the columns
$qfields = "SELECT * FROM ({$sql}) WHERE NULL = NULL";
$stmt = ociparse($this->conn, $qfields);
if (!$stmt) {
return false;
}
if (is_array($inputarr)) {
foreach (array_keys($inputarr) as $k) {
ocibindbyname($stmt, $k, $inputarr[$k], -1);
}
}
if (!ociexecute($stmt, OCI_DEFAULT)) {
ocifreestatement($stmt);
return false;
}
$ncols = ocinumcols($stmt);
for ($i = 1; $i <= $ncols; $i++) {
$cols[] = '"' . ocicolumnname($stmt, $i) . '"';
}
ocifreestatement($stmt);
$fields = implode(', ', $cols);
$length += $offset;
$offset += 1;
// in Oracle rownum starts at 1
$sql = "SELECT {$fields} FROM " . "(SELECT rownum as adodb_rownum, {$fields} FROM " . "({$sql})" . ' WHERE rownum <= :adodb_nrows) WHERE adodb_rownum >= :adodb_offset';
$inputarr['adodb_nrows'] = $length;
$inputarr['adodb_offset'] = $offset;
return $this->execute($sql, $inputarr);
}
}
示例8: fetch_field
/**
* Get column information
* @param int
* @return object
*/
protected function fetch_field($intOffset)
{
// Oracle starts row counting at 1
++$intOffset;
$arrData['name'] = @ocicolumnname($this->resResult, $intOffset);
$arrData['max_length'] = @ocicolumnsize($this->resResult, $intOffset);
$arrData['not_null'] = @ocicolumnisnull($this->resResult, $intOffset);
$arrData['type'] = @ocicolumntype($this->resResult, $intOffset);
return $arrData;
}
示例9: field_data
/**
* Field data
*
* Generates an array of objects containing field meta-data
*
* @access public
* @return array
*/
function field_data()
{
$retval = array();
$fieldCount = $this->num_fields();
for ($c = 1; $c <= $fieldCount; $c++) {
$F = new stdClass();
$F->name = ocicolumnname($this->stmt_id, $c);
$F->type = ocicolumntype($this->stmt_id, $c);
$F->max_length = ocicolumnsize($this->stmt_id, $c);
$F->length = $this->getColumnLength($c);
$F->longest = $this->getColumnLongest($c);
$F->primary_key = $this->isColumnPrimaryKey($c);
$F->unique = $this->isColumnUnique($c);
$F->part_of_key = $this->isColumnPartOfKey($c);
$F->autoIncrement = $this->isColumnAutoIncrement($c);
$retval[] = $F;
}
return $retval;
}
示例10: fetch_field
/**
* Get the column information
* @param integer
* @return object
*/
protected function fetch_field($intOffset)
{
++$intOffset;
// Oracle starts row counting at 1
$objData = new stdClass();
$objData->name = @ocicolumnname($this->resResult, $intOffset);
$objData->max_length = @ocicolumnsize($this->resResult, $intOffset);
$objData->not_null = @ocicolumnisnull($this->resResult, $intOffset);
$objData->type = @ocicolumntype($this->resResult, $intOffset);
return $objData;
}
示例11: db_get_query_rows
/**
* Get the rows returned from a SELECT query.
*
* @param resource The query result pointer
* @param ?integer Whether to start reading from (NULL: irrelevant for this forum driver)
* @return array A list of row maps
*/
function db_get_query_rows($stmt, $start = NULL)
{
$out = array();
$i = 0;
$num_fields = ocinumcols($stmt);
$types = array();
$names = array();
for ($x = 1; $x <= $num_fields; $x++) {
$types[$x] = ocicolumntype($stmt, $x);
$names[$x] = strtolower(ocicolumnname($stmt, $x));
}
while (ocifetch($stmt)) {
if (is_null($start) || $i >= $start) {
$newrow = array();
for ($j = 1; $j <= $num_fields; $j++) {
$v = ociresult($stmt, $j);
if (is_object($v)) {
$v = $v->load();
}
// For CLOB's
if ($v === false) {
fatal_exit(do_lang_tempcode('QUERY_FAILED', ocierror($stmt)));
}
$name = $names[$j];
$type = $types[$j];
if ($type == 'NUMBER') {
if (!is_null($v)) {
$newrow[$name] = intval($v);
} else {
$newrow[$name] = NULL;
}
} else {
if ($v == ' ') {
$v = '';
}
$newrow[$name] = $v;
}
}
$out[] = $newrow;
}
$i++;
}
return $out;
}
示例12: db_fieldname
/**
* db_fieldname() - Returns the number of rows changed in the last query
*
* @param string Query result set handle
* @param int Column number
*/
function db_fieldname($lhandle, $fnumber)
{
return @ocicolumnname($lhandle, $fnumber);
}
示例13: get_columns
function get_columns()
{
$this->columns = array();
$this->get_num_fields();
switch ($this->db) {
case 'MySQL':
for ($i = 0; $i < $this->num_fields; $i++) {
if (@mysql_field_name($this->res, $i) !== false) {
$this->columns[] = @mysql_field_name($this->res, $i);
}
}
break;
case 'MSSQL':
for ($i = 0; $i < $this->num_fields; $i++) {
if (@mssql_field_name($this->res, $i) !== false) {
$this->columns[] = @mssql_field_name($this->res, $i);
}
}
break;
case 'PostgreSQL':
for ($i = 0; $i < $this->num_fields; $i++) {
if (@pg_field_name($this->res, $i) !== false) {
$this->columns[] = @pg_field_name($this->res, $i);
}
}
break;
case 'Oracle':
for ($i = 0; $i < $this->num_fields; $i++) {
if (@ocicolumnname($this->res, $i) !== false) {
$this->columns[] = @ocicolumnname($this->res, $i);
}
}
break;
}
}
示例14: mcrypt_ecb
mcrypt_ecb();
mcrypt_cbc();
mcrypt_cfb();
mcrypt_ofb();
ocibindbyname();
ocicancel();
ocicloselob();
ocicollappend();
ocicollassign();
ocicollassignelem();
ocicollgetelem();
ocicollmax();
ocicollsize();
ocicolltrim();
ocicolumnisnull();
ocicolumnname();
ocicolumnprecision();
ocicolumnscale();
ocicolumnsize();
ocicolumntype();
ocicolumntyperaw();
ocicommit();
ocidefinebyname();
ocierror();
ociexecute();
ocifetch();
ocifetchinto();
ocifetchstatement();
ocifreecollection();
ocifreecursor();
ocifreedesc();