NAME
IO::Async::Pg::Util - Utility functions for IO::Async::Pg
SYNOPSIS
use IO::Async::Pg::Util qw(convert_placeholders parse_dsn);
my ($sql, $bind) = convert_placeholders(
'SELECT * FROM users WHERE id = :id',
{ id => 42 }
);
# $sql = 'SELECT * FROM users WHERE id = $1'
# $bind = [42]
FUNCTIONS
convert_placeholders($sql, \%params)
Converts named placeholders (:name) to PostgreSQL positional placeholders ($1, $2, etc).
Returns ($converted_sql, \@bind_values).
parse_dsn($uri)
Parses a PostgreSQL URI and returns a hashref with:
{
dbi_dsn => 'dbi:Pg:...',
user => 'username',
password => 'password',
}
safe_dsn($uri)
Returns the DSN with the password masked for logging.
AUTHOR
John Napiorkowski <jjn1056@yahoo.com>