本文整理汇总了PHP中oci_field_size函数的典型用法代码示例。如果您正苦于以下问题:PHP oci_field_size函数的具体用法?PHP oci_field_size怎么用?PHP oci_field_size使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了oci_field_size函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: _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;
}
示例4: _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;
}
示例5: FieldSize
public function FieldSize($statement, $field)
{
return oci_field_size($statement, $field);
}
示例6: getColumnsMeta
/**
* Returns metadata for all columns in a result set.
*
* @return array
*/
public function getColumnsMeta()
{
$count = oci_num_fields($this->resultSet);
$meta = array();
for ($i = 1; $i <= $count; $i++) {
// items 'name' and 'table' are required
$meta[] = array('name' => oci_field_name($this->resultSet, $i), 'table' => NULL, 'type' => oci_field_type($this->resultSet, $i), 'size' => oci_field_size($this->resultSet, $i), 'scale' => oci_field_scale($this->resultSet, $i), 'precision' => oci_field_precision($this->resultSet, $i));
}
return $meta;
}
示例7: getField
public function getField($field)
{
set_error_handler(static::getErrorHandler());
$name = oci_field_name($this->resource, $field);
$precision = oci_field_precision($this->resource, $field);
$scale = oci_field_scale($this->resource, $field);
$size = oci_field_size($this->resource, $field);
$rawType = oci_field_type_raw($this->resource, $field);
$type = oci_field_type($this->resource, $field);
$value = oci_field_is_null($this->resource, $field) ? null : oci_result($this->resource, $field);
$field = new Oci8Field($name, $value, $size, $precision, $scale, $type, $rawType);
restore_error_handler();
return $field;
}
示例8: get_columns
public function get_columns($stmt = null)
{
$stmt = is_null($stmt) ? $this->__cur : $stmt;
$cols = array();
$ncol = oci_num_fields($stmt);
for ($i = 1; $i <= $ncol; $i++) {
$cols[] = array('native_type' => oci_field_type($stmt, $i), 'flags' => array(), 'name' => oci_field_name($stmt, $i), 'len' => oci_field_size($stmt, $i), 'pdo_type' => oci_field_type_raw($stmt, $i));
}
return $cols;
}
示例9: getColumnMeta
/**
* Returns metadata for a column in a result set.
*
* @param int #column The 0-indexed column in the result set.
* @return array Returns an associative array representing the metadata for a single column
*/
public function getColumnMeta($column)
{
if (!is_int($column)) {
throw new OCIException($this->setErrorInfo('0A000', '9999', "Invalid Column type specfied: {$column}. Expecting an int."));
}
$column++;
return ['native_type' => oci_field_type($this->stmt, $column), 'driver:decl_type' => oci_field_type_raw($this->stmt, $column), 'name' => oci_field_name($this->stmt, $column), 'len' => oci_field_size($this->stmt, $column), 'precision' => oci_field_precision($this->stmt, $column)];
}
示例10: columnData
public function columnData()
{
if (empty($this->query)) {
return false;
}
$columns = array();
for ($i = 1, $c = $this->num_fields(); $i <= $c; $i++) {
$field = new stdClass();
$field->name = oci_field_name($this->query, $i);
$field->type = oci_field_type($this->query, $i);
$field->maxLength = oci_field_size($this->query, $i);
$columns[] = $field;
}
return $columns;
}
示例11: getColumnMeta
/**
* Returns metadata for a column in a result set.
* The array returned by this function is patterned after that
* returned by \PDO::getColumnMeta(). It includes the following
* elements:
* native_type
* driver:decl_type
* flags
* name
* table
* len
* precision
* pdo_type
*
* @param int $column The 0-indexed column in the result set.
* @return array An associative array containing the above metadata values
* for a single column.
*/
public function getColumnMeta($column)
{
// Columns in oci8 are 1-based; add 1 if it's a number
if (is_numeric($column)) {
$column++;
}
$meta = array();
$meta['native_type'] = oci_field_type($this->sth, $column);
$meta['driver:decl_type'] = oci_field_type_raw($this->sth, $column);
$meta['flags'] = array();
$meta['name'] = oci_field_name($this->sth, $column);
$meta['table'] = null;
$meta['len'] = oci_field_size($this->sth, $column);
$meta['precision'] = oci_field_precision($this->sth, $column);
$meta['pdo_type'] = null;
$meta['is_null'] = oci_field_is_null($this->sth, $column);
return $meta;
}
示例12: getColumnMeta
public static function getColumnMeta($index, $sql)
{
if ($sql && $index >= 0) {
$newmeta = array();
$newmeta["name"] = oci_field_name($sql, $index + 1);
$newmeta["native_type"] = oci_field_type($sql, $index + 1);
$newmeta["len"] = oci_field_size($sql, $index + 1);
return $newmeta;
}
return false;
}
示例13: getColumnMeta
public function getColumnMeta($column)
{
if ($column >= $this->columnCount()) {
return false;
}
$column++;
$result = array();
$result['native_type'] = oci_field_type($this->_result, $column);
if (oci_field_is_null($this->_result, $column)) {
$result['flags'] = 'is_null';
}
$result['name'] = oci_field_name($this->_result, $column);
$result['len'] = oci_field_size($this->_result, $column);
$result['precision'] = oci_field_precision($this->_result, $column) . '.' . oci_field_scale($this->_result, $column);
$result['pdo_type'] = PDO::PARAM_STR;
return $result;
}
示例14: getColumnLength
/**
* Returns the length of the specified column
*
* @access public
* @param integer $Column
* @return integer
*/
function getColumnLength($iColumn)
{
if ((is_int($iColumn) or is_string($iColumn)) && $iColumn < oci_num_fields($id)) {
$id = $this->curs_id ? $this->curs_id : $this->stmt_id;
if (is_int($iColumn)) {
$iColumn++;
return oci_field_size($id, $iColumn);
} else {
return false;
}
} else {
if ($this->db_debug) {
log_message('error', 'Class CI_DB_oci10_result ' . "\t" . 'Method ' . __METHOD__ . ' ' . PHP_EOL . "\t\t" . 'Wrong parameter ' . $iColumn . '. Nb Max COlumns : ' . oci_num_fields($id) . PHP_EOL . " Connexion data " . PHP_EOL . " username : " . $this->username . PHP_EOL . " hostname : " . $this->hostname . PHP_EOL . " database : " . $this->database . PHP_EOL . " dbdriver : " . $this->dbdriver . PHP_EOL . " dbprefix : " . $this->dbprefix . PHP_EOL . " port : " . $this->port);
return $this->display_error('db_wrong_parameter', $iColumn);
}
return false;
}
}
示例15: columnData
public function columnData($col = '')
{
if (empty($this->query)) {
return false;
}
$columns = [];
$count = $this->numFields();
for ($i = 1; $i <= $count; $i++) {
$fieldName = oci_field_name($this->query, $i);
$columns[$fieldName] = new \stdClass();
$columns[$fieldName]->name = $fieldName;
$columns[$fieldName]->type = oci_field_type($this->query, $i);
$columns[$fieldName]->maxLength = oci_field_size($this->query, $i);
$columns[$fieldName]->primaryKey = NULL;
$columns[$fieldName]->default = NULL;
}
if (isset($columns[$col])) {
return $columns[$col];
}
return $columns;
}