module DBI::DBD::OCI8::BindType

def decorate(b)

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))
  end
  def b.get()
    # get an Oradate from the bind handle,
    # then convert it to a DBI::Date.
    (val = super()) && DBI::Date.new(val.year, val.month, val.day)
  end
end

def decorate(b)

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

def decorate(b)

def decorate(b)
  def b.set(val)
    raise NotImplementedError
  end
  def b.get()
    val = super
    return val if val.nil?
    cur = ::OCI8::Cursor.new(@env, @svc, @ctx, val)
    stmt = DBI::DBD::OCI8::Statement.new(cur)
    DBI::StatementHandle.new(stmt, *DBI_STMT_NEW_ARGS)
  end
end

def fix_type(env, val, length, precision, scale)

def fix_type(env, val, length, precision, scale)
  # bind as an OraDate
  [::OCI8::SQLT_DAT, val, nil]
end

def fix_type(env, val, length, precision, scale)

def fix_type(env, val, length, precision, scale)
  # bind as an OraDate
  [::OCI8::SQLT_DAT, val, nil]
end

def fix_type(env, val, length, precision, scale)

def fix_type(env, val, length, precision, scale)
  raise NotImplementedError unless val.nil?
  [::OCI8::SQLT_RSET, nil, env.alloc(OCIStmt)]
end