Class: OCI8::BindType::Number
- Inherits:
-
Object
- Object
- OCI8::BindType::Number
- Defined in:
- lib/oci8/bindtype.rb
Overview
get/set Number (for OCI8::SQLT_NUM)
Class Method Summary collapse
Class Method Details
.create(con, val, param, max_array_size) ⇒ Object
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 |
# File 'lib/oci8/bindtype.rb', line 58 def self.create(con, val, param, max_array_size) if param.is_a? OCI8::Metadata::Base precision = param.precision scale = param.scale end if scale == -127 if precision == 0 # NUMBER declared without its scale and precision. (Oracle 9.2.0.3 or above) klass = OCI8::BindType::Mapping[:number_no_prec_setting] else # FLOAT or FLOAT(p) klass = OCI8::BindType::Float end elsif scale == 0 if precision == 0 # NUMBER whose scale and precision is unknown # or # NUMBER declared without its scale and precision. (Oracle 9.2.0.2 or below) klass = OCI8::BindType::Mapping[:number_unknown_prec] else # NUMBER(p, 0) klass = OCI8::BindType::Integer end else # NUMBER(p, s) if precision < 15 # the precision of double. klass = OCI8::BindType::Float else # use BigDecimal instead klass = OCI8::BindType::BigDecimal end end klass.new(con, val, nil, max_array_size) end |