本文整理汇总了PHP中ocicolumntype函数的典型用法代码示例。如果您正苦于以下问题:PHP ocicolumntype函数的具体用法?PHP ocicolumntype怎么用?PHP ocicolumntype使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ocicolumntype函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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);
}
示例3: DBfetch
function DBfetch(&$cursor)
{
global $DB;
$result = false;
if (isset($DB['DB']) && !empty($DB['DB'])) {
switch ($DB['TYPE']) {
case 'MYSQL':
$result = mysql_fetch_assoc($cursor);
break;
case 'POSTGRESQL':
$result = pg_fetch_assoc($cursor);
break;
case 'ORACLE':
if (ocifetchinto($cursor, $row, OCI_ASSOC + OCI_RETURN_NULLS)) {
$result = array();
foreach ($row as $key => $value) {
$result[strtolower($key)] = str_in_array(strtolower(ocicolumntype($cursor, $key)), array('varchar', 'varchar2', 'blob', 'clob')) && is_null($value) ? '' : $value;
}
}
break;
case 'SQLITE3':
if ($cursor) {
$result = array_shift($cursor);
if (is_null($result)) {
$result = false;
}
}
break;
}
}
return $result;
}
示例4: FieldType
function FieldType($rsMain, $i)
{
return ocicolumntype($rsMain, $i + 1);
}
示例5: main
//.........这里部分代码省略.........
$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) {
$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";
示例6: 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;
}
示例7: 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;
}
示例8: 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;
}
示例9: 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;
}
示例10: ocibindbyname
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();
ocifreestatement();
ociinternaldebug();
ociloadlob();
ocilogoff();