/** * 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 FieldTypeRaw($statement, int $field) { return oci_field_type_raw($statement, $field); }
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; }
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; }
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; }
/** * 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)]; }