Class: DBI::DBD::OCI8::BindType::DBITimestamp
- Inherits:
-
OCI8::BindType::OraDate
- Object
- OCI8::BindType::OraDate
- DBI::DBD::OCI8::BindType::DBITimestamp
- Defined in:
- lib/DBD/OCI8/OCI8.rb
Overview
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.decorate(b) ⇒ Object
504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 |
# File 'lib/DBD/OCI8/OCI8.rb', line 504 def decorate(b) def b.set(val) # convert val to an OraDate, # then set it to the bind handle. super(val && OraDate.new(val.year, val.month, val.day, val.respond_to?(:hour) ? val.hour : 0, val.respond_to?(:min) ? val.min : 0, val.respond_to?(:sec) ? val.sec : 0)) end def b.get() # get an Oradate from the bind handle, # then convert it to a DBI::Timestamp. (val = super()) && DBI::Timestamp.new(val.year, val.month, val.day, val.hour, val.minute, val.second) end end |
.fix_type(env, val, length, precision, scale) ⇒ Object
500 501 502 503 |
# File 'lib/DBD/OCI8/OCI8.rb', line 500 def fix_type(env, val, length, precision, scale) # bind as an OraDate [::OCI8::SQLT_DAT, val, nil] end |
Instance Method Details
#get ⇒ Object
415 416 417 418 419 420 421 |
# File 'lib/DBD/OCI8/OCI8.rb', line 415 def get() # get an Oradate from the bind handle, # then convert it to a DBI::Timestamp. val = super() return nil if val.nil? DBI::Timestamp.new(val.year, val.month, val.day, val.hour, val.minute, val.second) end |
#set(val) ⇒ Object
407 408 409 410 411 412 413 414 |
# File 'lib/DBD/OCI8/OCI8.rb', line 407 def set(val) # convert val to an OraDate, # then set it to the bind handle. super(val && OraDate.new(val.year, val.month, val.day, val.respond_to?(:hour) ? val.hour : 0, val.respond_to?(:min) ? val.min : 0, val.respond_to?(:sec) ? val.sec : 0)) end |