Module: DB::Postgres::Native

Extended by:
FFI::Library
Defined in:
lib/db/postgres/native.rb,
lib/db/postgres/native/field.rb,
lib/db/postgres/native/types.rb,
lib/db/postgres/native/result.rb,
lib/db/postgres/native/connection.rb

Defined Under Namespace

Modules: IO, Types Classes: Connection, Result

Constant Summary collapse

DEFAULT_TYPES =

These are hard coded OIDs.

{
  16 => Types::Boolean,
  
  20 => Types::Integer,
  21 => Types::Integer,
  23 => Types::Integer,
  
  114 => JSON,
  
  700 => Types::Float,
  701 => Types::Float,
  
  1082 => Date,
  1083 => Types::DateTime,
  1114 => Types::DateTime,
  
  1700 => Types::Decimal,
  
  3500 => Types::Symbol,
}

Class Method Summary collapse

Class Method Details

.array_of_strings(values) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/db/postgres/native/connection.rb', line 28

def self.array_of_strings(values)
  array = FFI::MemoryPointer.new(:pointer, values.size + 1)
  
  pointers = values.map do |value|
    FFI::MemoryPointer.from_string(value.to_s)
  end
  
  array.write_array_of_pointer(pointers)
  
  return array
end