X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FManual%2FSchemaIntro.pod;h=1e6707ee4fe2913682defa086722a89f66b97ec0;hb=f109ee4aa6c7f7cc4eaf6cd15b6d67c2ebcf8702;hp=02ac2e6f8dfa1736807217c9b7618a28e0918dbc;hpb=80c90f5d6c31d3464041a6e927495ed205c7a32d;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Manual/SchemaIntro.pod b/lib/DBIx/Class/Manual/SchemaIntro.pod index 02ac2e6..1e6707e 100644 --- a/lib/DBIx/Class/Manual/SchemaIntro.pod +++ b/lib/DBIx/Class/Manual/SchemaIntro.pod @@ -27,8 +27,8 @@ Or load classes by namespace: # load My::Schema::Album, My::Schema::Artist and My::OtherSchema::LinerNotes __PACKAGE__->load_classes( { - 'My::Schema' => qw/ Album Artist /, - 'My::OtherSchema' => qw/ LinerNotes / + 'My::Schema' => [qw/ Album Artist /], + 'My::OtherSchema' => [qw/ LinerNotes /] } ); @@ -70,6 +70,8 @@ If you have a multi-column primary key, just pass a list instead: __PACKAGE__->set_primary_key( qw/ albumid artistid / ); +=begin hide + You can define relationships for any of your classes. L will automatically fill in the correct namespace, so if you want to say "a My::Schema::Album object belongs to a My::Schema::Artist object" you do not @@ -77,6 +79,8 @@ need to include the namespace when declaring the relationship: __PACKAGE__->belongs_to('artist' => 'Artist'); +=end hide + That's all you need in terms of setup. =head2 Usage @@ -93,6 +97,10 @@ a second database you want to access: Note that L does not cache connnections 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: + + $schema->storage->on_connect_do(\@on_connect_sql_statments); + The simplest way to get a record is by primary key: my $schema = My::Schema->connect( ... ); @@ -102,7 +110,7 @@ This will run a C