Class: OCI8::Metadata::Column
Overview
Metadata for a sequence.
This is returned by:
-
OCI8::Metadata::Table#columns
Instance Method Summary collapse
-
#char_size ⇒ Object
returns the column character length which is the number of characters allowed in the column.
-
#char_used? ⇒ Boolean
returns the type of length semantics of the column.
-
#charset_form ⇒ Object
The character set form, if the column is of a string/character type.
-
#charset_id ⇒ Object
The character set id, if the column is of a string/character type.
-
#charset_name ⇒ Object
The character set name, if the column is of a string/character type.
-
#data_size ⇒ Object
The maximum size of the column.
-
#data_type ⇒ Object
the datatype of the column.
- #data_type_string ⇒ Object (also: #type_string)
-
#fsprecision ⇒ Object
The fractional seconds precision of a datetime or interval.
-
#inspect ⇒ Object
:nodoc:.
-
#lfprecision ⇒ Object
The leading field precision of an interval.
-
#name ⇒ Object
column name.
-
#nullable? ⇒ Boolean
Returns 0 if null values are not permitted for the column.
-
#precision ⇒ Object
The precision of numeric columns.
-
#scale ⇒ Object
The scale of numeric columns.
-
#schema_name ⇒ Object
Returns a string with the schema name under which the type has been created.
- #to_s ⇒ Object
-
#type_metadata ⇒ Object
to type metadata if possible.
-
#type_name ⇒ Object
Returns a string which is the type name.
Methods inherited from Base
#obj_id, #obj_name, #obj_schema
Instance Method Details
#char_size ⇒ Object
returns the column character length which is the number of characters allowed in the column. It is the counterpart of OCI8::Metadata::Column#data_size which gets the byte length.
1309 1310 1311 |
# File 'lib/oci8/metadata.rb', line 1309 def char_size attr_get_ub2(OCI_ATTR_CHAR_SIZE) end |
#char_used? ⇒ Boolean
returns the type of length semantics of the column.
:byte
-
byte-length semantics
:char
-
character-length semantics.
(unavailable on Oracle 8.1 or lower)
1302 1303 1304 |
# File 'lib/oci8/metadata.rb', line 1302 def char_used? attr_get_ub1(OCI_ATTR_CHAR_USED) != 0 end |
#charset_form ⇒ Object
The character set form, if the column is of a string/character type
1395 1396 1397 |
# File 'lib/oci8/metadata.rb', line 1395 def charset_form __charset_form end |
#charset_id ⇒ Object
The character set id, if the column is of a string/character type
1390 1391 1392 |
# File 'lib/oci8/metadata.rb', line 1390 def charset_id attr_get_ub2(OCI_ATTR_CHARSET_ID) end |
#charset_name ⇒ Object
The character set name, if the column is of a string/character type
1419 1420 1421 |
# File 'lib/oci8/metadata.rb', line 1419 def charset_name __charset_name(charset_id) end |
#data_size ⇒ Object
The maximum size of the column. This length is returned in bytes and not characters for strings and raws. This returns character length multiplied by NLS ratio for character-length semantics columns when using Oracle 9i or upper.
1327 1328 1329 |
# File 'lib/oci8/metadata.rb', line 1327 def data_size attr_get_ub2(OCI_ATTR_DATA_SIZE) end |
#data_type ⇒ Object
the datatype of the column.
1332 1333 1334 |
# File 'lib/oci8/metadata.rb', line 1332 def data_type __data_type end |
#data_type_string ⇒ Object Also known as: type_string
1423 1424 1425 |
# File 'lib/oci8/metadata.rb', line 1423 def data_type_string __data_type_string end |
#fsprecision ⇒ Object
The fractional seconds precision of a datetime or interval.
(unavailable on Oracle 8.1 or lower)
1406 1407 1408 |
# File 'lib/oci8/metadata.rb', line 1406 def fsprecision attr_get_ub1(OCI_ATTR_FSPRECISION) end |
#inspect ⇒ Object
:nodoc:
1432 1433 1434 |
# File 'lib/oci8/metadata.rb', line 1432 def inspect # :nodoc: "#<#{self.class.name}: #{name} #{__data_type_string}>" end |
#lfprecision ⇒ Object
The leading field precision of an interval
(unavailable on Oracle 8.1 or lower)
1413 1414 1415 |
# File 'lib/oci8/metadata.rb', line 1413 def lfprecision attr_get_ub1(OCI_ATTR_LFPRECISION) end |
#name ⇒ Object
column name
1337 1338 1339 |
# File 'lib/oci8/metadata.rb', line 1337 def name attr_get_string(OCI_ATTR_NAME) end |
#nullable? ⇒ Boolean
Returns 0 if null values are not permitted for the column
1358 1359 1360 |
# File 'lib/oci8/metadata.rb', line 1358 def nullable? __boolean(OCI_ATTR_IS_NULL) end |
#precision ⇒ Object
The precision of numeric columns. If the precision is nonzero and scale is -127, then it is a FLOAT, else it is a NUMBER(precision, scale). For the case when precision is 0, NUMBER(precision, scale) can be represented simply as NUMBER.
1345 1346 1347 |
# File 'lib/oci8/metadata.rb', line 1345 def precision __is_implicit? ? attr_get_sb2(OCI_ATTR_PRECISION) : attr_get_ub1(OCI_ATTR_PRECISION) end |
#scale ⇒ Object
The scale of numeric columns. If the precision is nonzero and scale is -127, then it is a FLOAT, else it is a NUMBER(precision, scale). For the case when precision is 0, NUMBER(precision, scale) can be represented simply as NUMBER.
1353 1354 1355 |
# File 'lib/oci8/metadata.rb', line 1353 def scale attr_get_sb1(OCI_ATTR_SCALE) end |
#schema_name ⇒ Object
Returns a string with the schema name under which the type has been created
1374 1375 1376 1377 |
# File 'lib/oci8/metadata.rb', line 1374 def schema_name rv = attr_get_string(OCI_ATTR_SCHEMA_NAME) rv.length == 0 ? nil : rv end |
#to_s ⇒ Object
1428 1429 1430 |
# File 'lib/oci8/metadata.rb', line 1428 def to_s %Q{"#{name}" #{__data_type_string}} end |
#type_metadata ⇒ Object
to type metadata if possible
1380 1381 1382 1383 1384 1385 1386 1387 |
# File 'lib/oci8/metadata.rb', line 1380 def case attr_get_ub2(OCI_ATTR_DATA_TYPE) when 108, 110 # named_type or ref (OCI8::Metadata::Type) else nil end end |
#type_name ⇒ Object
Returns a string which is the type name. The returned value will contain the type name if the datatype is :named_type
or :ref
. If the datatype is :named_type
, the name of the named datatype’s type is returned. If the datatype is :ref
, the type name of the named datatype pointed to by the REF is returned
1368 1369 1370 1371 |
# File 'lib/oci8/metadata.rb', line 1368 def type_name rv = attr_get_string(OCI_ATTR_TYPE_NAME) rv.length == 0 ? nil : rv end |