Class: OracleDB::DataTypeInfo
- Inherits:
-
Object
- Object
- OracleDB::DataTypeInfo
- Defined in:
- lib/oracledb/info_types.rb,
ext/oracledb/rboradb_info_types.c
Instance Method Summary collapse
- #client_size_in_bytes ⇒ Object
- #db_size_in_bytes ⇒ Object
- #default_native_type ⇒ Object
- #fs_precision ⇒ Object
- #object_type ⇒ Object
- #oci_type_code ⇒ Object
- #oracle_type ⇒ Object
- #precision ⇒ Object
- #scale ⇒ Object
- #size_in_chars ⇒ Object
- #to_s ⇒ Object
Instance Method Details
#client_size_in_bytes ⇒ Object
20 21 22 |
# File 'lib/oracledb/info_types.rb', line 20 def client_size_in_bytes @client_size_in_bytes end |
#db_size_in_bytes ⇒ Object
16 17 18 |
# File 'lib/oracledb/info_types.rb', line 16 def db_size_in_bytes @db_size_in_bytes end |
#default_native_type ⇒ Object
8 9 10 |
# File 'lib/oracledb/info_types.rb', line 8 def default_native_type @default_native_type end |
#fs_precision ⇒ Object
36 37 38 |
# File 'lib/oracledb/info_types.rb', line 36 def fs_precision @fs_precision end |
#object_type ⇒ Object
40 41 42 |
# File 'lib/oracledb/info_types.rb', line 40 def object_type @object_type end |
#oci_type_code ⇒ Object
12 13 14 |
# File 'lib/oracledb/info_types.rb', line 12 def oci_type_code @oci_type_code end |
#oracle_type ⇒ Object
4 5 6 |
# File 'lib/oracledb/info_types.rb', line 4 def oracle_type @oracle_type end |
#precision ⇒ Object
28 29 30 |
# File 'lib/oracledb/info_types.rb', line 28 def precision @precision end |
#scale ⇒ Object
32 33 34 |
# File 'lib/oracledb/info_types.rb', line 32 def scale @scale end |
#size_in_chars ⇒ Object
24 25 26 |
# File 'lib/oracledb/info_types.rb', line 24 def size_in_chars @size_in_chars end |
#to_s ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/oracledb/info_types.rb', line 44 def to_s case @oracle_type when :varchar "VARCHAR2(#{@db_size_in_bytes})" when :nvarchar "NVARCHAR(#{@size_in_chars})" when :char "CHAR(#{@db_size_in_bytes})" when :nchar "NCHAR(#{@size_in_chars})" when :rowid "ROWID" when :raw "RAW(#{@db_size_in_bytes})" when :native_float "BINARY_FLOAT" when :native_double "BINARY_DOUBLE" when :number if @precision != 0 && @scale == -127 if @precision == 126 "FLOAT" else "FLOAT(#{@precision})" end elsif @precision == 0 "NUMBER" elsif @scale == 0 "NUMBER(#{@precision})" else "NUMBER(#{@precision}, #{@scale})" end when :date "DATE" when :timestamp if @fs_precision == 6 "TIMESTAMP" else "TIMESTAMP(#{@fs_precision})" end when :timestamp_tz if @fs_precision == 6 "TIMESTAMP WITH TIME ZONE" else "TIMESTAMP(#{@fs_precision}) WITH TIME ZONE" end when :timestamp_ltz if @fs_precision == 6 "TIMESTAMP WITH LOCAL TIME ZONE" else "TIMESTAMP(#{@fs_precision}) WITH LOCAL TIME ZONE" end when :interval_ds if @precision == 2 && @fs_precision == 6 "INTERVAL DAY TO SECOND" else "INTERVAL DAY(#{@precision}) TO SECOND(#{@fs_precision})" end when :interval_ym if @precision == 2 "INTERVAL YEAR TO MONTH" else "INTERVAL YEAR(#{@precision}) TO MONTH" end when :clob "CLOB" when :nclob "NCLOB" when :blob "BLOB" when :bfile "BFILE" when :stmt "REF CURSOR" when :boolean "BOOLEAN" when :object if @object_type "#{@object_type.schema}.#{@object_type.name}" else "OBJECT" end when :long_varchar "LONG" when :long_raw "LONG RAW" when :json "JSON" else @oracle_type.to_s end end |