X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FManual%2FIntro.pod;h=43e60cf8ef5012b9609502bfc70f611bf5f7b771;hb=3f073ddff92999c67b2e68af9d5ece580c66bffd;hp=62b0fd20c126e3b0d10d3a19c8e42b8c2fefc43b;hpb=7f613f3abf507feffb920890d245d325520d55c0;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Manual/Intro.pod b/lib/DBIx/Class/Manual/Intro.pod index 62b0fd2..43e60cf 100644 --- a/lib/DBIx/Class/Manual/Intro.pod +++ b/lib/DBIx/Class/Manual/Intro.pod @@ -184,7 +184,6 @@ that contain this tables foreign key in one of their columns: More information about the various types of relationships available, and how you can design your own, can be found in L. - =head2 Using L This is an external module, and not part of the L @@ -195,26 +194,20 @@ Here's a simple setup: package My::Schema; use base qw/DBIx::Class::Schema::Loader/; - __PACKAGE__->load_from_connection( - connect_info = [ 'dbi:SQLite:/home/me/myapp/my.db' ] - ); + __PACKAGE__->loader_options( relationships => 1 ); 1; -This should be equivalent to the manual setup in the section above. +The actual autoloading process will occur when you create a connected +instance of your schema below. + L takes lots of other options. For more information, consult its documentation. =head2 Connecting -L already contains the connection info for the -database, so to get started all you need to do is create an instance of your -class: - - my $schema = My::Schema->new(); - -To connect to your manually created Schema, you also need to provide the -connection details: +To connect to your Schema, you also need to provide the connection details. +The arguments are the same as you would use for L: my $schema = My::Schema->connect('dbi:SQLite:/home/me/myapp/my.db'); @@ -226,9 +219,19 @@ a second database you want to access: Note that L does not cache connections for you. If you use multiple connections, you need to do this manually. -To execute some sql statements on every connect you can pass them to your schema after the connect: +To execute some sql statements on every connect you can add them as an option +in a special fifth argument to connect, like so: + + my $another_schema = My::Schema->connect( + $dsn, + $user, + $password, + $attrs, + { on_connect_do => \@on_connect_sql_statments } + ); - $schema->storage->on_connect_do(\@on_connect_sql_statments); +For more information about this and other special C-time options, +see L. =head2 Basic usage