Alzabo

 view release on metacpan or  search on metacpan

lib/Alzabo/Runtime/Schema.pm  view on Meta::CPAN


This object can only be loaded from a file.  The file is created
whenever a corresponding
L<C<Alzabo::Create::Schema>|Alzabo::Create::Schema> object is saved.

=head1 INHERITS FROM

C<Alzabo::Schema>

=for pod_merge merged

=head1 METHODS

=head2 load_from_file ( name => $schema_name )

Loads a schema from a file.  This is the only constructor for this
class.  It returns an C<Alzabo::Runtime::Schema> object.  Loaded
objects are cached in memory, so future calls to this method may
return the same object.

Throws: L<C<Alzabo::Exception::Params>|Alzabo::Exceptions>,
L<C<Alzabo::Exception::System>|Alzabo::Exceptions>

=head2 set_user ($user)

Sets the username to use when connecting to the database.

=head2 user

Return the username used by the schema when connecting to the database.

=head2 set_password ($password)

Set the password to use when connecting to the database.

=head2 password

Returns the password used by the schema when connecting to the
database.

=head2 set_host ($host)

Set the host to use when connecting to the database.

=head2 host

Returns the host used by the schema when connecting to the database.

=head2 set_port ($port)

Set the port to use when connecting to the database.

=head2 port

Returns the port used by the schema when connecting to the database.

=head2 set_referential_integrity ($boolean)

Turns referential integrity checking on or off.  If it is on, then
when L<C<Alzabo::Runtime::Row>|Alzabo::Runtime::Row> objects are
deleted, updated, or inserted, they will report this activity to any
relevant L<C<Alzabo::Runtime::ForeignKey>|Alzabo::Runtime::ForeignKey>
objects for the row, so that the foreign key objects can take
appropriate action.

This defaults to false.  If your RDBMS supports foreign key
constraints, these should be used instead of Alzabo's built-in
referential integrity checking, as they will be much faster.

=head2 referential_integrity

Returns a boolean value indicating whether this schema will attempt to
maintain referential integrity.

=head2 set_quote_identifiers ($boolean)

If this is true, then all SQL constructed for this schema will have
quoted identifiers (like `Table`.`column` in MySQL).

This defaults to false.  Turning this on adds some overhead to all SQL
generation.

=head2 connect (%params)

Calls the L<C<Alzabo::Driver-E<gt>connect>|Alzabo::Driver/connect>
method for the driver owned by the schema.  The username, password,
host, and port set for the schema will be passed to the driver, as
will any additional parameters given to this method.  See the L<C<<
Alzabo::Driver->connect() method >>|Alzabo::Driver/connect> for more
details.

=head2 disconnect

Calls the L<C<< Alzabo::Driver->disconnect()
>>|Alzabo::Driver/disconnect> method for the driver owned by the
schema.

=head2 join

Joins are done by taking the tables provided in order, and finding a
relation between them.  If any given table pair has more than one
relation, then this method will fail.  The relations, along with the
values given in the optional where clause will then be used to
generate the necessary SQL.  See
L<C<Alzabo::Runtime::JoinCursor>|Alzabo::Runtime::JoinCursor> for more
information.

This method takes the following parameters:

=over 4

=item * join => <see below>

This parameter can either be a simple array reference of tables or an
array reference of array references.  In the latter case, each array
reference should contain two tables.  These array references can also
include an optional modifier specifying a type of join for the two
tables, like 'left_outer_join', an optional foreign key object which
will be used to join the two tables, and an optional where clause used
to restrict the join.



( run in 0.820 second using v1.01-cache-2.11-cpan-98e64b0badf )