Pg: Add "$hex" pseudo-type
This commit is contained in:
parent
baf0f90bd5
commit
15954f4ad5
6 changed files with 63 additions and 15 deletions
18
FU/Pg.pm
18
FU/Pg.pm
|
|
@ -619,7 +619,21 @@ supported. C<undef> always converts to SQL C<NULL>.
|
|||
=item bytea
|
||||
|
||||
The C<bytea> type represents arbitrary binary data and this module will pass
|
||||
that along as raw binary strings.
|
||||
that along as raw binary strings. If you prefer to work with hex strings
|
||||
instead, use:
|
||||
|
||||
$conn->set_type(bytea => '$hex');
|
||||
|
||||
The I<bytea> and the I<$hex> (pseudo-)types can be applied to any other type to
|
||||
convert between the PostgreSQL binary wire format and Perl strings. For
|
||||
example, if you prefer to receive integers as big-endian hex strings, you can
|
||||
do that:
|
||||
|
||||
$conn->set_type(int4 => recv => '$hex');
|
||||
|
||||
Or to treat UUIDs as 16-byte strings:
|
||||
|
||||
$conn->set_type(uuid => 'bytea');
|
||||
|
||||
=item timestamp / timestamptz
|
||||
|
||||
|
|
@ -724,8 +738,6 @@ C<set_type()> to configure appropriate conversions for these types.
|
|||
|
||||
=back
|
||||
|
||||
I<TODO:> Some handy special types for overriding common conversions.
|
||||
|
||||
I<TODO:> Methods to convert between the various formats.
|
||||
|
||||
I<TODO:> Methods to query type info.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue