selenamarie is
16 years ago
at DBIx::Class meeting with perlmongers!
latest #46
selenamarie says
16 years ago
we're going to have charcoal colored shirts.
selenamarie says
16 years ago
i asked for sparkles for color, but might not happen.
selenamarie says
16 years ago
schwern brought donuts!
立即下載
selenamarie says
16 years ago
i said i would improve on SQL by eliminating NULLS
selenamarie says
16 years ago
someone pitched samy.pl/sql++/
selenamarie says
16 years ago
(that's the URL Jay is referencing)
selenamarie says
16 years ago
we just started the podcast, so time to say naughty things!
selenamarie says
16 years ago
object: is a group of columns, (a table), that has indexes
selenamarie says
16 years ago
BEER is our example: beer has many distributors, with a brewer, and a name!
selenamarie says
16 years ago
can add indexes add_unique_indexes()
selenamarie says
16 years ago
belongs_to is the opposite end of has_many
selenamarie says
16 years ago
has_one, might_have means that, and many_to_many is pretty complicated
selenamarie says
16 years ago
create $schema from the Beer::Schema, and then ->connect($dsn) just like Class::-DBI
selenamarie says
16 years ago
err. Class:\:-DBI
selenamarie says
16 years ago
"Chained Result Sets are what DBIC Great"
selenamarie wishes
16 years ago
the code was bigger :-)
selenamarie says
16 years ago
create_ddl_dir() creates table statements
selenamarie says
16 years ago
$schema->deploy() - creates database for you!
selenamarie says
16 years ago
now for the tests!
selenamarie says
16 years ago
the big thing to understand going from Class::-DBI to DBIx::Class
selenamarie says
16 years ago
is that everything from DBIx::Class is a Result Set!
selenamarie says
16 years ago
in the top level Schema - lots of ppl put in an init_schema() function to parse YAML, set things up, etc.
selenamarie says
16 years ago
this results in much shorter tests! (testing with SQLite, instead of DB Brand X)
selenamarie says
16 years ago
live debugging!
selenamarie says
16 years ago
showing some code examples using beer from YAPC Asia
selenamarie says
16 years ago
(g_doh)
selenamarie says
16 years ago
thx for the fix!
selenamarie says
16 years ago
DBIx::Class will create the foreign key refs automatically
selenamarie says
16 years ago
there were some weird things -- i think the more interesting case is what cheeseinspector did at PDXPUG
selenamarie says
16 years ago
where you're taking an ORM and modeling a DB that already exists. i think that's much harder.
selenamarie says
16 years ago
DBIx::Class::QueryLog::Analyzer - useful for debugging!
selenamarie says
16 years ago
caching q: example of an attribute held in the object, versus pulling from the DB - you can force a recall at any point.
selenamarie says
16 years ago
jay recommends doing everything in a transaction.
selenamarie says
16 years ago
$schema->txn_do( blah blah );
selenamarie says
16 years ago
(that's how to do a transaction)
selenamarie says
16 years ago
DBIx::Class::Schema::Loader
selenamarie says
16 years ago
one liner from the docs:
selenamarie says
16 years ago
perl -MDBIx::Class::Schema::Loader=make_schema_at,dump_to_dir:./lib \
selenamarie says
16 years ago
-e 'make_schema_at("My::Schema", { debug => 1 }, [ "dbi:-Pg:dbname=foo","postgres" ])'
selenamarie says
16 years ago
try Carp::REPL - read-eval-print-loop on die and or warn
selenamarie says
16 years ago
time for practical beer!
back to top