当前位置: 首页>>代码示例>>PHP>>正文


PHP oci_field_precision函数代码示例

本文整理汇总了PHP中oci_field_precision函数的典型用法代码示例。如果您正苦于以下问题:PHP oci_field_precision函数的具体用法?PHP oci_field_precision怎么用?PHP oci_field_precision使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了oci_field_precision函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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

示例2: _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

示例3: 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

示例4: _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

示例5: 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

示例6: 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

示例7: 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;
 }
开发者ID:laiello,项目名称:webuntucms,代码行数:15,代码来源:oracle.php

示例8: FieldPrecition

 public function FieldPrecition($statement, int $field)
 {
     return oci_field_precision($statement, $field);
 }
开发者ID:Zniel,项目名称:fl_crtlpanel_self_dev,代码行数:4,代码来源:pm_oracle.class.php

示例9: 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;
 }
开发者ID:jpina,项目名称:oci8,代码行数:14,代码来源:Oci8Statement.php

示例10: 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

示例11: oci_field_precision

    public static function oci_field_precision($connection, $statement, $fieldNumber) {
        self::checkOCIExtension('oci_field_precision');

        $precision = @oci_field_precision($statement, $fieldNumber);
        if ($precision === FALSE) {
            $error = self::oci_error($statement);
            throw new IllegalStateException(t(
                'Could not retrieve the precision of a field (field number: %fieldNumber): %error',
                array('%fieldNumber' => $fieldNumber, '%error' => t($error['message']))));
        }

        return $precision;
    }
开发者ID:reisystems-india,项目名称:GovDashboard-Community,代码行数:13,代码来源:OCIImplHelper.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("&", "&amp;", $value);
                        $value = str_replace("<", "&lt;", $value);
                        $value = str_replace(">", "&gt;", $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: getColumnPrecision

 /**
  * Returns the precision of the specified column
  *
  * @access public
  * @param  integer $Column
  * @return integer
  */
 function getColumnPrecision($iColumn)
 {
     if (is_int($iColumn) or is_string($iColumn)) {
         $id = $this->curs_id ? $this->curs_id : $this->stmt_id;
         if (is_int($iColumn) && oci_num_fields($id)) {
             $iColumn++;
             return oci_field_precision($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;
     }
 }
开发者ID:rotac,项目名称:ci_package-abstraction,代码行数:25,代码来源:oci10_result.php

示例14: oracleMetadata

function oracleMetadata(&$db)
{
    $id = $db->Query_ID;
    $META = new stdClass();
    #echo "SQL=".$db->LastSQL."<br>";
    #echo "Columnas =".OCINumcols($id)."<br>";
    $META->cols = array();
    for ($ix = 1; $ix <= OCINumcols($id); $ix++) {
        $col = oci_field_name($id, $ix);
        $type = oci_field_type_raw($id, $ix);
        $presicion = oci_field_precision($id, $ix);
        $escala = oci_field_scale($id, $ix);
        $standarType = MetaStandardType("Oracle", $type, $escala);
        $META->colsbyname["{$col}"] = new stdClass();
        $META->colsbyname["{$col}"]->{"type"} = $standarType;
        $META->colsbyname["{$col}"]->{"precision"} = $presicion;
        $META->colsbyname["{$col}"]->{"scale"} = $escala;
        $META->colsbyname["{$col}"]->{"size"} = oci_field_size($id, $ix);
        $META->colsbyname["{$col}"]->{"is_null"} = oci_field_is_null($id, $ix);
        $META->colsbyname["{$col}"]->{"type_raw"} = $type;
        $META->cols[$ix - 1] = new stdClass();
        $META->cols[$ix - 1]->{"type"} = $standarType;
        $META->cols[$ix - 1]->{"precision"} = $presicion;
        $META->cols[$ix - 1]->{"scale"} = $escala;
        $META->cols[$ix - 1]->{"size"} = oci_field_size($id, $ix);
        $META->cols[$ix - 1]->{"is_null"} = oci_field_is_null($id, $ix);
        $META->cols[$ix - 1]->{"type_raw"} = $type;
        //if($db->Debug)
        #echo"<b>[$col]</b>:"
        #.$META->colsbyname["$col"]->type
        #.' '.$META->colsbyname["$col"]->size
        #.' Presicion='.$META->colsbyname["$col"]->precision
        #.' Ecala='.$META->colsbyname["$col"]->scale
        #.' '.$META->colsbyname["$col"]->is_null
        #.' type='.$META->colsbyname["$col"]->type_raw
        #.' '."<br>\n";
    }
    return $META;
}
开发者ID:santo-s,项目名称:do_sql.js,代码行数:39,代码来源:metadato_4.php

示例15: getColumnMeta

 public function getColumnMeta($column)
 {
     if ($column >= $this->columnCount()) {
         return false;
     }
     $column++;
     $result = array('native_type' => oci_field_type($this->_result, $column), 'name' => oci_field_name($this->_result, $column), 'len' => oci_field_size($this->_result, $column), 'precision' => oci_field_precision($this->_result, $column) . '.' . oci_field_scale($this->_result, $column), 'pdo_type' => EhrlichAndreas_Pdo_Abstract::PARAM_STR);
     if (oci_field_is_null($this->_result, $column)) {
         $result['flags'] = 'is_null';
     }
     return $result;
 }
开发者ID:ehrlichandreas,项目名称:ehrlichandreas1-pdo,代码行数:12,代码来源:Statement.php


注:本文中的oci_field_precision函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。