DB-Object

 view release on metacpan or  search on metacpan

lib/DB/Object/Postgres/Tables.pm  view on Meta::CPAN

Supported lock types are:

=over 4

=item C<ACCESS SHARE>

=item C<ROW SHARE>

=item C<ROW EXCLUSIVE>

=item C<SHARE UPDATE EXCLUSIVE>

=item C<SHARE>

=item C<SHARE ROW EXCLUSIVE>

=item C<EXCLUSIVE>

=item C<ACCESS EXCLUSIVE>

=back

See L<PostgreSQL documentation for more information|https://www.postgresql.org/docs/9.5/explicit-locking.html>

=head2 on_conflict

A convenient wrapper to L<DB::Object::Postgres::Query/on_conflict>

=head2 optimize

Not implemented in PostgreSQL.

=head2 parent

This will return the parent table if the current table inherits from another table.

=head2 qualified_name

This return a fully qualified name to be used as a prefix to columns in queries.

If L<DB::Object::Tables/prefixed> is greater than 2, the database name will be added.

If there is a schema defined and the L<DB::Object::Tables/prefixed> is greater than 1, the schema will be added.

At minimum, the table name is added.

    $tbl->prefixed(2);
    $tbl->qualified_name;
    # Would return something like: mydb.my_schema.my_table

    $tbl->prefixed(1);
    $tbl->qualified_name;
    # Would return only: my_table

=head2 rename

Provided with a new table name, and this will prepare the necessary query to rename the table and return the statement handler.

If it is called in void context, the statement handler is executed immediately.

    # Get the prefs table object
    my $tbl = $dbh->pref;
    $tbl->rename( 'prefs' );
    # Would issue a statement handler for the query: ALTER TABLE pref RENAME TO prefs

See L<PostgreSQL documentation for more information|https://www.postgresql.org/docs/9.5/sql-altertable.html>

=head2 repair

Not implemented in PostgreSQL.

=head2 stat

Not implemented in PostgreSQL.

=head2 structure

This returns, in list context, an hash and, in scalar context, an hash reference of the table structure.

The hash, or hash reference returned contains the column name and its definition.

The data returned is cached, so it fetches the information from PostgreSQL only once.

This method will also set the following object properties:

=over 4

=item * L<DB::Object::Tables/type>

The table type.

=item * L<DB::Object::Tables/schema>

The table schema.

=item * C<default>

A column name to default value hash reference

=item * C<fields>

A column name to field position (integer) hash reference

=item * C<null>

A column name to a boolean representing whether the column is nullable or not.

=item * L<DB::Object::Tables/primary>

An array reference of column names that are used as primary key for the table.

=item * C<structure>

A column name to its sql definition

=item * C<types>

A column name to column data type hash reference

=back

=head2 table_info

This is an alias for L<DB::Object::Postgres/table_info>



( run in 0.576 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )