Exemple #1
0
 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;
 }
Exemple #2
0
 /**
  * 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;
 }
 public function FieldIsNull($statement, $field)
 {
     return oci_field_is_null($statement, $field);
 }
Exemple #4
0
 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;
 }
Exemple #5
0
/**
 * @todo add missing keys like in from mysqli_query (orgname, orgtable, flags, decimals)
 */
function PMA_DBI_get_fields_meta($result, $table = null)
{
    $fields = array();
    $num_fields = oci_num_fields($result);
    for ($i = 1; $i <= $num_fields; $i++) {
        $field = array();
        $field['name'] = oci_field_name($result, $i);
        $field['type'] = oci_field_type($result, $i);
        $field['max_length'] = oci_field_size($result, $i);
        $field['not_null'] = oci_field_is_null($result, $i);
        $field['table'] = $table;
        $fields[] = (object) $field;
        //$fields[] = oci_fetch_field($result, $i);
    }
    return $fields;
}
Exemple #6
0
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;
}
 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;
 }