Skip to content

struct Athena::ORM::Driver::Postgres
inherits Athena::ORM::Driver #

The postgres driver shard (will/crystal-pg), using AORM::Platforms::Postgres.

The shard only accepts numbered parameter placeholders ($1, $2, ...), so the ? placeholders in statements are numbered when they're prepared. It doesn't report generated identifiers either, so #last_insert_id asks the server.

Methods#

#database_platform(connection : DB::Connection) : Platforms::Platform#

Returns the platform of the database connection is to.

View source

#last_insert_id(connection : DB::Connection, reported_id : Int64) : Int64#

Returns the identifier generated by the last statement executed on connection, for which the driver shard reported reported_id.

Raises AORM::Exceptions::NoIdentityValue if that statement didn't generate one.

Returns the value most recently generated by a sequence in connection's session (SELECT LASTVAL()). The driver shard raises if no sequence was used yet.

View source

#prepare(connection : DB::Connection, sql : String) : DB::Statement#

Returns the statement executing sql on connection.

View source