From: Marcus Ramberg Date: Mon, 24 Oct 2005 08:39:02 +0000 (+0000) Subject: release of 0.30002. X-Git-Tag: v0.05005~193 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8c130052c896cf7499a9062fedffacecb1e7a058;p=dbsrgits%2FDBIx-Class.git release of 0.30002. added info about ->table --- diff --git a/Changes b/Changes index 7a42577..d48fe37 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,6 @@ Revision history for DBIx::Class -0.03002 +0.03002 2005-10-20 22:35:00 - Minor bugfix to new (Row.pm) - Schema doesn't die if it can't load a class (Schema.pm) - New UUID columns plugin (UUIDColumns.pm) diff --git a/MANIFEST b/MANIFEST index d15342e..f9561a3 100644 --- a/MANIFEST +++ b/MANIFEST @@ -32,6 +32,12 @@ lib/DBIx/Class/Cursor.pm lib/DBIx/Class/DB.pm lib/DBIx/Class/Exception.pm lib/DBIx/Class/InflateColumn.pm +lib/DBIx/Class/Manual.pod +lib/DBIx/Class/Manual/Cookbook.pod +lib/DBIx/Class/Manual/FAQ.pod +lib/DBIx/Class/Manual/Intro.pod +lib/DBIx/Class/Manual/Troubleshooting.pod +lib/DBIx/Class/ObjectCache.pm lib/DBIx/Class/PK.pm lib/DBIx/Class/PK/Auto.pm lib/DBIx/Class/PK/Auto/MSSQL.pm diff --git a/META.yml b/META.yml index 285ba8e..2773a4a 100644 --- a/META.yml +++ b/META.yml @@ -1,6 +1,6 @@ --- name: DBIx-Class -version: 0.03001 +version: 0.03002 author: - Matt S. Trout abstract: Extensible and flexible object <-> relational mapper. @@ -22,7 +22,7 @@ provides: file: lib/DBIx/Class/Storage/DBI.pm DBIx::Class: file: lib/DBIx/Class.pm - version: 0.03001 + version: 0.03002 DBIx::Class::AccessorGroup: file: lib/DBIx/Class/AccessorGroup.pm DBIx::Class::CDBICompat: @@ -89,6 +89,8 @@ provides: file: lib/DBIx/Class/Exception.pm DBIx::Class::InflateColumn: file: lib/DBIx/Class/InflateColumn.pm + DBIx::Class::ObjectCache: + file: lib/DBIx/Class/ObjectCache.pm DBIx::Class::PK: file: lib/DBIx/Class/PK.pm DBIx::Class::PK::Auto: @@ -133,6 +135,8 @@ provides: file: lib/DBIx/Class/Table.pm DBIx::Class::Test::SQLite: file: lib/DBIx/Class/Test/SQLite.pm + DBIx::Class::UUIDColumns: + file: lib/DBIx/Class/UUIDColumns.pm DBIx::ContextualFetch::st: file: lib/DBIx/Class/CDBICompat/ImaDBI.pm -generated_by: Module::Build version 0.2611 +generated_by: Module::Build version 0.2607 diff --git a/README b/README index 7083759..ea0c835 100644 --- a/README +++ b/README @@ -24,32 +24,47 @@ DESCRIPTION IRC: irc.perl.org#dbix-class QUICKSTART - If you're using Class::DBI, replacing + If you're using Class::DBI, and want an easy and fast way of migrating + to DBIx::Class look at DBIx::Class::CDBICompat. - use base qw/Class::DBI/; + There are two ways of using DBIx::Class, the 'simple' and the 'schema' + one. - with + The 'simple' way of using DBIx::Class needs less classes than the + 'schema' way but doesn't give you the ability to use different database + connections. - use base qw/DBIx::Class/; - __PACKAGE__->load_components(qw/CDBICompat Core DB/); + Some examples where different database connections are useful are: - will probably get you started. + different users with different rights different databases with the same + schema. - If you're using AUTO_INCREMENT for your primary columns, you'll also - want yo load the approriate PK::Auto subclass - e.g. +Simple + First you need to create a base class all other classes inherit from. - __PACKAGE__->load_components(qw/CDBICompat PK::Auto::SQLite Core DB/); + Look at DBIx::Class::DB how to do this - (with is what ::Test::SQLite does to present the - Class::DBI::Test::SQLite interface) + Next you need to create a class for every table you want to use with + DBIx::Class. - If you fancy playing around with DBIx::Class from scratch, then read the - docs for DBIx::Class::Table, ::Row, ::Schema, ::DB and ::Relationship, + Look at DBIx::Class::Table how to do this. - use base qw/DBIx::Class/; - __PACKAGE__->load_components(qw/Core DB/); + Schema + With this approach the table classes inherit directly from + DBIx::Class::Core, although it might be a good idea to create a 'parent' + class for all table classes which inherits from DBIx::Class::Core and + adds additional methods needed by all table classes, e.g. reading a + config file, loading auto primary key support. - and have a look at t/lib/DBICTest.pm for a brief example. + Look at DBIx::Class::Schema how to do this. + + If you need more hand-holding, check out the introduction in the manual + below. + +SEE ALSO + DBIx::Class::Core - DBIC Core Classes + DBIx::Class::CDBICompat - Class::DBI Compat layer. + DBIx::Class::Manual - User's manual. AUTHOR Matt S. Trout diff --git a/lib/DBIx/Class/Schema.pm b/lib/DBIx/Class/Schema.pm index eb3246c..116ac2e 100644 --- a/lib/DBIx/Class/Schema.pm +++ b/lib/DBIx/Class/Schema.pm @@ -112,6 +112,15 @@ as well as dbh connection info, and creates a L class as well as subclasses for each of your database classes in this namespace, using this connection. +It will also setup a ->table method on the target class, which lets you +resolve database classes based on the schema component name, for example + + MyApp::DB->table('Foo') # returns MyApp::DB::Foo, + # which ISA MyApp::Schema::Foo + +This is the recommended API for accessing Schema generated classes, and +using it might give you instant advantages with future versions of DBIC. + =cut sub compose_connection {