本文整理汇总了PHP中oci_field_type函数的典型用法代码示例。如果您正苦于以下问题:PHP oci_field_type函数的具体用法?PHP oci_field_type怎么用?PHP oci_field_type使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了oci_field_type函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: db_columnType
function db_columnType($oStmt, $iPos)
{
return oci_field_type($oStmt, $iPos);
}
开发者ID:brustj,项目名称:tracmor,代码行数:4,代码来源:db_oracle_php5.php
示例2: 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;
}
开发者ID:spas-viktor,项目名称:books,代码行数:10,代码来源:oracleresult.php
示例3: oci_field_type
public static function oci_field_type($connection, $statement, $fieldNumber)
{
self::checkOCIExtension('oci_field_type');
$type = @oci_field_type($statement, $fieldNumber);
if ($type === FALSE) {
$error = oci_error($connection);
throw new IllegalStateException(t("Could not retrieve field's (field number: @fieldNumber) data type: @error", array('@fieldNumber' => $fieldNumber, '@error' => t($error['message']))));
}
return $type;
}
开发者ID:ecs-hk,项目名称:Checkbook,代码行数:10,代码来源:OCIImplHelper.php
示例4: 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;
}
开发者ID:pepegarcia,项目名称:publicidadoficialdemo-1,代码行数:12,代码来源:oci8_result.php
示例5: db_getfieldslist
/**
* @param String strSQL
* @return Array
*/
public function db_getfieldslist($strSQL)
{
$res = array();
$qResult = $this->connectionObj->query($strSQL);
$fieldsNumber = $qResult->numFields();
for ($i = 0; $i < $fieldsNumber; $i++) {
$stype = oci_field_type($qResult->getQueryHandle(), $i + 1);
$ntype = $this->getFieldTypeNumber($stype);
$res[$i] = array("fieldname" => $qResult->fieldName($i), "type" => $ntype, "is_nullable" => 0);
}
return $res;
}
开发者ID:ryanblanchard,项目名称:Dashboard,代码行数:16,代码来源:OracleInfo.php
示例6: db_getfieldslist
function db_getfieldslist($strSQL)
{
global $conn;
$res=array();
$rs=db_query($strSQL,$conn);
for($i=0;$i<db_numfields($rs);$i++)
{
$stype=oci_field_type($rs,$i+1);
$ntype=db_fieldtypenum($stype);
$res[$i]=array("fieldname"=>db_fieldname($rs,$i),"type"=>$ntype,"is_nullable"=>0);
}
return $res;
}
开发者ID:helbertfurbino,项目名称:sgmofinanceiro,代码行数:13,代码来源:dbinfo.ora.php
示例7: GetFields
function GetFields()
{
$_fields = array();
$_st_id = oci_parse($this->_Link, $this->SelectCommand);
if ($_st_id) {
oci_execute($_st_id);
//$_result = pg_query($this->_Link,$this->SelectCommand);
$_num_fields = oci_num_fields($_st_id);
for ($i = 1; $i <= $_num_fields; $i++) {
$_field = array("Name" => oci_field_name($_st_id, $i), "Type" => oci_field_type($_st_id, $i), "Not_Null" => 0);
array_push($_fields, $_field);
}
}
return $_fields;
}
开发者ID:skydel,项目名称:universal-online-exam,代码行数:15,代码来源:OracleDataSource.php
示例8: 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;
}
开发者ID:Satariall,项目名称:izurit,代码行数:24,代码来源:oracleresult.php
示例9: _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;
}
开发者ID:ceryxSeidor,项目名称:ProyectoPruebaWSV2,代码行数:40,代码来源:adodb-oci8quercus.inc.php
示例10: _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;
}
开发者ID:joshuacoddingyou,项目名称:php,代码行数:24,代码来源:platform.php
示例11: DBfetch
/**
* Returns the next data set from a DB resource or false if there are no more results.
*
* @param resource $cursor
* @param bool $convertNulls convert all null values to string zeroes
*
* @return array|bool
*/
function DBfetch($cursor, $convertNulls = true)
{
global $DB;
$result = false;
if (!isset($DB['DB']) || empty($DB['DB']) || is_bool($cursor)) {
return $result;
}
switch ($DB['TYPE']) {
case ZBX_DB_MYSQL:
$result = mysqli_fetch_assoc($cursor);
if (!$result) {
mysqli_free_result($cursor);
}
break;
case ZBX_DB_POSTGRESQL:
if (!($result = pg_fetch_assoc($cursor))) {
pg_free_result($cursor);
}
break;
case ZBX_DB_ORACLE:
if ($row = oci_fetch_assoc($cursor)) {
$result = array();
foreach ($row as $key => $value) {
$field_type = strtolower(oci_field_type($cursor, $key));
// Oracle does not support NULL values for string fields, so if the string is empty, it will return NULL
// convert it to an empty string to be consistent with other databases
$value = str_in_array($field_type, array('varchar', 'varchar2', 'blob', 'clob')) && is_null($value) ? '' : $value;
if (is_object($value) && strpos($field_type, 'lob') !== false) {
$value = $value->load();
}
$result[strtolower($key)] = $value;
}
}
break;
case ZBX_DB_DB2:
if (!($result = db2_fetch_assoc($cursor))) {
db2_free_result($cursor);
} else {
// cast all of the values to string to be consistent with other DB drivers: all of them return
// only strings.
foreach ($result as &$value) {
if ($value !== null) {
$value = (string) $value;
}
}
unset($value);
}
break;
case ZBX_DB_SQLITE3:
if ($DB['TRANSACTIONS'] == 0) {
lock_sqlite3_access();
}
if (!($result = $cursor->fetchArray(SQLITE3_ASSOC))) {
unset($cursor);
} else {
// cast all of the values to string to be consistent with other DB drivers: all of them return
// only strings.
foreach ($result as &$value) {
$value = (string) $value;
}
unset($value);
}
if ($DB['TRANSACTIONS'] == 0) {
unlock_sqlite3_access();
}
break;
}
if ($result) {
if ($convertNulls) {
foreach ($result as $key => $val) {
if (is_null($val)) {
$result[$key] = '0';
}
}
}
return $result;
}
return false;
}
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:87,代码来源:db.inc.php
示例12: sti_oracle_get_data
function sti_oracle_get_data($connection_string, $data_source_name, $query)
{
$info = sti_oracle_parse_connection_string($connection_string);
if ($info["privilege"] == "") {
$conn = oci_connect($info["user_id"], $info["password"], $info["database"], $info["charset"]);
} else {
$conn = oci_pconnect($info["user_id"], $info["password"], $info["database"], $info["charset"], $info["privilege"]);
}
if ($conn === false) {
$err = ocierror();
return "ServerError:Could not connect {$err['message']}";
}
$query = sti_parse_query_parameters($query);
$stmt = oci_parse($conn, $query);
if ($stmt === false) {
$err = oci_error($conn);
return "ServerError:Parse Error {$err['message']}";
} else {
if (strpos($query, "cursor") !== false) {
$curs = oci_new_cursor($conn);
oci_bind_by_name($stmt, "cursor", $curs, -1, OCI_B_CURSOR);
}
if (oci_execute($stmt, OCI_COMMIT_ON_SUCCESS) === true) {
if (isset($curs)) {
if (oci_execute($curs, OCI_DEFAULT) === false) {
$err = oci_error();
return "ServerError:Cursor Execute Error {$err['message']}";
}
$stmt_curs = $curs;
} else {
$stmt_curs = $stmt;
}
$ncols = oci_num_fields($stmt_curs);
$column_names = array();
$column_types = array();
for ($i = 1; $i <= $ncols; $i++) {
$column_names[] = oci_field_name($stmt_curs, $i);
$column_type = oci_field_type($stmt_curs, $i);
$column_precision = oci_field_precision($stmt_curs, $i);
$column_types[] = sti_oracle_get_column_type($column_type, $column_precision);
}
$xml_output = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Database>";
oci_fetch_all($stmt_curs, $data);
for ($i = 0; $i < count($data[$column_names[0]]); $i++) {
$xml_output .= "<{$data_source_name}>";
for ($j = 0; $j < count($column_names); $j++) {
$value = $data[$column_names[$j]][$i];
if ($column_types[$j] == "base64Binary") {
$value = base64_encode($value);
}
if ($column_types[$j] == "dateTime" && strlen($value) > 0 && strpos($value, ".") > 0) {
$values = preg_split("/\\./", $value);
if (count($values) >= 3) {
if (strlen($values[2]) > 2) {
$value = $values[2] . '-' . $values[1] . '-' . $values[0];
} else {
$value = ((int) $values[2] >= 30 ? '19' . $values[2] : '20' . $values[2]) . '-' . $values[1] . '-' . $values[0];
}
}
} else {
$value = str_replace("&", "&", $value);
$value = str_replace("<", "<", $value);
$value = str_replace(">", ">", $value);
}
$xml_output .= "<{$column_names[$j]}>{$value}</{$column_names[$j]}>";
}
$xml_output .= "</{$data_source_name}>";
}
$xml_output .= "</Database>";
if (isset($curs)) {
oci_free_statement($curs);
}
oci_free_statement($stmt);
} else {
$err = ocierror($stmt);
return "ServerError:Execute Error {$err['message']} {$query}";
}
}
return $xml_output;
}
开发者ID:abdulghanni,项目名称:gsm,代码行数:80,代码来源:database_oracle.php
示例13: getColumnMeta
/**
* Returns metadata for a column in a result set
*
* @param integer $column The 0-indexed column in the result set.
*
* @return array Associative meta data array with the following structure:
*
* native_type The PHP native type used to represent the column value.
* driver:decl_ type The SQL type used to represent the column value in the database. If the column in the result set is the result of a function, this value is not returned by PDOStatement->getColumnMeta().
* flags Any flags set for this column.
* name The name of this column as returned by the database.
* len The length of this column. Normally -1 for types other than floating point decimals.
* precision The numeric precision of this column. Normally 0 for types other than floating point decimals.
* pdo_type The type of this column as represented by the PDO::PARAM_* constants.
*/
public function getColumnMeta($column)
{
if (is_integer($column)) {
$internal_column = $column + 1;
} else {
$internal_column = $column;
}
$data = array();
$data['native_type'] = oci_field_type($this->statement, $internal_column);
$data['flags'] = "";
$data['len'] = oci_field_size($this->statement, $internal_column);
$data['name'] = oci_field_name($this->statement, $internal_column);
$data['precision'] = oci_field_precision($this->statement, $internal_column);
return $data;
}
开发者ID:TeamCodeStudio,项目名称:fpmoz,代码行数:30,代码来源:Oracle.php
示例14: 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;
}
开发者ID:snelg,项目名称:pdo-via-oci8,代码行数:36,代码来源:Statement.php
示例15: _FetchField
/**
* Get column information in the Recordset object.
* fetchField() can be used in order to obtain information about fields
* in a certain query result. If the field offset isn't specified, the next
* field that wasn't yet retrieved by fetchField() is retrieved
*
* @return object containing field information
*/
function _FetchField($fieldOffset = -1)
{
$fld = new ADOFieldObject();
$fieldOffset += 1;
$fld->name = oci_field_name($this->_queryID, $fieldOffset);
if (ADODB_ASSOC_CASE == ADODB_ASSOC_CASE_LOWER) {
$fld->name = strtolower($fld->name);
}
$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;
}
开发者ID:advancingdesign,项目名称:ADOdb,代码行数:35,代码来源:adodb-oci8.inc.php
示例16: 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;
}
开发者ID:Deepab23,项目名称:clinic,代码行数:17,代码来源:oci_statement.php
示例17: metadata
public function metadata($tablename = null)
{
$ncols = oci_num_fields($this->statement);
if ($ncols) {
$column_names = array();
$column_types = array();
$column_sizes = array();
for ($i = 1; $i <= $ncols; $i++) {
$column_names[$i] = oci_field_name($this->statement, $i);
}
for ($i = 1; $i <= $ncols; $i++) {
$column_types[$i] = oci_field_type($this->statement, $i);
}
for ($i = 1; $i <= $ncols; $i++) {
$column_sizes[$i] = oci_field_size($this->statement, $i);
}
return new OracleMetadata($column_names, $column_types, $column_sizes, $this->rows(), $tablename);
} else {
throw new Exception('No metadata to fetch');
}
}
开发者ID:Evan-github,项目名称:oracle-oci-helper,代码行数:21,代码来源:oracle-oci-helper.php
示例18: oci_connect
if (!in_array($_SERVER["REMOTE_ADDR"], $cfg["sapos_get_data"]["allowed_ip"])) {
exit;
}
$oci_db = "(DESCRIPTION =\n (ADDRESS = (PROTOCOL = TCP)(HOST = " . $cfg["sapos_get_data"]["oracle"]["host"] . ")(PORT = " . $cfg["sapos_get_data"]["oracle"]["port"] . "))\n (CONNECT_DATA = (SERVICE_NAME =" . $cfg["sapos_get_data"]["oracle"]["db"] . "))\n )";
$oci_conn = oci_connect($cfg["sapos_get_data"]["oracle"]["user"], $cfg["sapos_get_data"]["oracle"]["pass"], $oci_db, 'UTF8');
$sql = "SELECT * FROM " . $cfg["sapos_get_data"]["db"]["stationen"]["entries"];
$statement = oci_parse($oci_conn, $sql);
oci_execute($statement);
$i = 0;
$insert_sql = array();
while ($row = oci_fetch_array($statement, OCI_ASSOC)) {
// echo "<pre>".print_r($row,true)."</pre>";
$insert_a = array();
$insert_b = array();
foreach ($row as $key => $value) {
switch (oci_field_type($statement, $key)) {
case "VARCHAR2":
$psql_type = "character varying(200)";
$psql_value = "'" . addslashes($value) . "'";
break;
case "CHAR":
$psql_type = "text";
$psql_value = "'" . addslashes($value) . "'";
break;
case "NUMBER":
if (strstr($value, ".")) {
$psql_type = "float";
} else {
$psql_type = "integer";
}
$psql_value = str_replace(",", ".", $value);
开发者ID:BackupTheBerlios,项目名称:ewebuki-bvv-svn,代码行数:31,代码来源:sapos_get_data.inc.php
示例19: field_info
function field_info($query, $count)
{
if ($this->debug) {
echo "<pre style=\"color : green\">Getting column information {$this->dbpath} <p style=\"color:purple;\"> {$query} </p></pre>";
}
$nooffields = 0;
//Validate the sql statement and make adjustments
switch ($this->dbtype) {
/* Firebird Functionality */
case "firebird":
//write some things here
$col_info = ibase_field_info($query, $count);
break;
/* SQLite Functionality */
/* SQLite Functionality */
case "sqlite":
putenv("TMP=" . $this->tmppath);
$name = sqlite_field_name($query, $count);
//echo $name;
$col_info["alias"] = $name;
$col_info["name"] = $name;
break;
/* Oracle Functionality */
/* Oracle Functionality */
case "oracle":
$column_name = oci_field_name($query, $count);
$column_type = oci_field_type($query, $count);
$column_size = oci_field_size($query, $count);
$column_prec = oci_field_precision($query, $count);
$column_scale = oci_field_scale($query, $count);
$col_info["name"] = $column_name;
$col_info["alias"] = $column_name;
$col_info["length"] = $column_size;
$col_info["prec"] = $column_prec;
$col_info["type"] = $column_type;
$col_info["scale"] = $column_scale;
break;
/* PGSQL Functionality */
/* PGSQL Functionality */
case "pgsql":
$col_info["name"] = pg_field_name($query, $count);
$col_info["alias"] = NULL;
// always set to NULL
$col_info["relation"] = NULL;
// always set to NULL
$col_info["length"] = pg_field_size($query, $count);
$col_info["type"] = pg_field_type($query, $count);
break;
}
if ($this->debug) {
echo "<pre style=\"color : blue\">Column Info fetched for Column {$count} \n </pre>";
}
return $col_info;
}
开发者ID:mortalerror,项目名称:ultimatesims,代码行数:54,代码来源:cdeclass.php
示例20: setColumnTypes
/**
* store the column types of the query
*/
protected function setColumnTypes()
{
if (empty($this->columnTypes)) {
$columns = $this->getColumnNames();
foreach ($columns as $column) {
$this->columnTypes[$column] = oci_field_type($this->statement->getResource(), $column);
}
}
}
开发者ID:winkbrace,项目名称:oracle,代码行数:12,代码来源:Fetcher.php
注:本文中的oci_field_type函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论