PG::
TypeMapByColumn class
Superclass | PG::TypeMap |
Included Modules |
This type map casts values by a coder assigned per field/column.
Each PG::TypeMapByColumn
has a fixed list of either encoders or decoders, that is defined at TypeMapByColumn.new
. A type map with encoders is usable for type casting query bind parameters and COPY data for PG::Connection#put_copy_data
. A type map with decoders is usable for type casting of result values and COPY data from PG::Connection#get_copy_data
.
PG::TypeMapByColumn
objects are in particular useful in conjunction with prepared statements, since they can be cached alongside with the statement handle.
This type map strategy is also used internally by PG::TypeMapByOid
, when the number of rows of a result set exceeds a given limit.
Public Class Methods
Builds a new type map and assigns a list of coders for the given column. coders
must be an Array of PG::Coder
objects or nil
values. The length of the Array corresponds to the number of columns or bind parameters this type map is usable for.
A nil
value will forward the given field to the default_type_map
.
Public Instance Methods
Array of PG::Coder
objects. The length of the Array corresponds to the number of columns or bind parameters this type map is usable for.
Returns the type oids of the assigned coders.