DBIx-Class
view release on metacpan or search on metacpan
lib/DBIx/Class/Manual/FAQ.pod view on Meta::CPAN
# Now returns the correct new value:
$result->somecolumn()
To update and refresh at once, chain your calls:
$result->update({ 'somecolumn' => { -ident => 'othercolumn' } })->discard_changes;
=item .. store JSON/YAML in a column and have it deflate/inflate automatically?
You can use L<DBIx::Class::InflateColumn> to accomplish YAML/JSON storage transparently.
If you want to use JSON, then in your table schema class, do the following:
use JSON;
__PACKAGE__->add_columns(qw/ ... my_column ../)
__PACKAGE__->inflate_column('my_column', {
inflate => sub { jsonToObj(shift) },
deflate => sub { objToJson(shift) },
});
lib/DBIx/Class/ResultSet.pm view on Meta::CPAN
To create one row for this resultset, pass a hashref of key/value
pairs representing the columns of the table and the values you wish to
store. If the appropriate relationships are set up, foreign key fields
can also be passed an object representing the foreign row, and the
value will be set to its primary key.
To create related objects, pass a hashref of related-object column values
B<keyed on the relationship name>. If the relationship is of type C<multi>
(L<DBIx::Class::Relationship/has_many>) - pass an arrayref of hashrefs.
The process will correctly identify columns holding foreign keys, and will
transparently populate them from the keys of the corresponding relation.
This can be applied recursively, and will work correctly for a structure
with an arbitrary depth and width, as long as the relationships actually
exists and the correct column data has been supplied.
Instead of hashrefs of plain related data (key/value pairs), you may
also pass new or inserted objects. New objects (not inserted yet, see
L</new_result>), will be inserted into their appropriate tables.
Effectively a shortcut for C<< ->new_result(\%col_data)->insert >>.
lib/DBIx/Class/Storage/DBI/ADO.pm view on Meta::CPAN
use namespace::clean;
=head1 NAME
DBIx::Class::Storage::DBI::ADO - Support for L<DBD::ADO>
=head1 DESCRIPTION
This class provides a mechanism for discovering and loading a sub-class
for a specific ADO backend, as well as some workarounds for L<DBD::ADO>. It
should be transparent to the user.
=cut
sub _rebless { shift->_determine_connector_driver('ADO') }
# cleanup some warnings from DBD::ADO
# RT#65563, not fixed as of DBD::ADO v2.98
sub _dbh_get_info {
my $self = shift;
lib/DBIx/Class/Storage/DBI/ADO/Microsoft_SQL_Server.pm view on Meta::CPAN
such as C<varbinary> column data comes back padded with trailing C<NULL> chars.
The Cursor class for this driver
(L<DBIx::Class::Storage::DBI::ADO::Microsoft_SQL_Server::Cursor>) removes them,
of course if your binary data is actually C<NULL> padded that may be an issue to
keep in mind when using this driver.
=head2 uniqueidentifier columns
uniqueidentifier columns come back from ADO wrapped in braces and must be
submitted to the MSSQL ADO driver wrapped in braces. We take care of this
transparently in this driver and the associated Cursor class
(L<DBIx::Class::Storage::DBI::ADO::Microsoft_SQL_Server::Cursor>) so that you
don't have to use braces in most cases (except in literal SQL, in those cases
you will have to add the braces yourself.)
=head2 fractional seconds
Fractional seconds with L<DBIx::Class::InflateColumn::DateTime> are not
currently supported, datetimes are truncated at the second.
=cut
lib/DBIx/Class/Storage/DBI/ODBC.pm view on Meta::CPAN
}
}
=head1 NAME
DBIx::Class::Storage::DBI::ODBC - Base class for ODBC drivers
=head1 DESCRIPTION
This class simply provides a mechanism for discovering and loading a sub-class
for a specific ODBC backend. It should be transparent to the user.
=head1 FURTHER QUESTIONS?
Check the list of L<additional DBIC resources|DBIx::Class/GETTING HELP/SUPPORT>.
=head1 COPYRIGHT AND LICENSE
This module is free software L<copyright|DBIx::Class/COPYRIGHT AND LICENSE>
by the L<DBIx::Class (DBIC) authors|DBIx::Class/AUTHORS>. You can
redistribute it and/or modify it under the same terms as the
lib/DBIx/Class/Storage/DBI/Oracle.pm view on Meta::CPAN
1;
=head1 NAME
DBIx::Class::Storage::DBI::Oracle - Base class for Oracle driver
=head1 DESCRIPTION
This class simply provides a mechanism for discovering and loading a sub-class
for a specific version Oracle backend. It should be transparent to the user.
For Oracle major versions < 9 it loads the ::Oracle::WhereJoins subclass,
which unrolls the ANSI join style DBIC normally generates into entries in
the WHERE clause for compatibility purposes. To force usage of this version
no matter the database version, add
__PACKAGE__->storage_type('::DBI::Oracle::WhereJoins');
to your Schema class.
lib/DBIx/Class/Storage/DBI/Replicated/Introduction.pod view on Meta::CPAN
presumes you have the basics down.
=head1 DESCRIPTION
L<DBIx::Class> supports a framework for using database replication. This system
is integrated completely, which means once it's setup you should be able to
automatically just start using a replication cluster without additional work or
changes to your code. Some caveats apply, primarily related to the proper use
of transactions (you are wrapping all your database modifying statements inside
a transaction, right ;) ) however in our experience properly written DBIC will
work transparently with Replicated storage.
Currently we have support for MySQL native replication, which is relatively
easy to install and configure. We also currently support single master to one
or more replicants (also called 'slaves' in some documentation). However the
framework is not specifically tied to the MySQL framework and supporting other
replication systems or topographies should be possible. Please bring your
patches and ideas to the #dbix-class IRC channel or the mailing list.
For an easy way to start playing with MySQL native replication, see:
L<MySQL::Sandbox>.
lib/DBIx/Class/Storage/DBI/Sybase/ASE.pm view on Meta::CPAN
carp_once
'Your DBD::Sybase is too old to support '
.'DBIx::Class::InflateColumn::DateTime, please upgrade!';
# FIXME - in retrospect this is a rather bad US-centric choice
# of format. Not changing as a bugwards compat, though in reality
# the only piece that sees the results of $dt object formatting
# (as opposed to parsing) is the database itself, so theoretically
# changing both this SET command and the formatter definition of
# ::S::D::Sybase::ASE::DateTime::Format below should be safe and
# transparent
$dbh->do('SET DATEFORMAT mdy');
}
}
sub _exec_txn_begin {
my $self = shift;
# bulkLogin=1 connections are always in a transaction, and can only call BEGIN
t/101populate_rs.t view on Meta::CPAN
my ($cd1, $cd2) = $girl->cds->search({},{order_by=>'year'});
ok( $cd1->title eq "My First CD", "Got Expected CD Title");
ok( $cd2->title eq "Yet More Tweeny-Pop crap", "Got Expected CD Title");
}
HAS_MANY_WITH_PKS: {
## This group tests the ability to specify the PK in the parent and let
## DBIC transparently pass the PK down to the Child and also let's the
## child create any other needed PK's for itself.
my $aid = $art_rs->get_column('artistid')->max || 0;
my $first_aid = ++$aid;
my $artists = [
{
artistid => $first_aid,
name => 'PK_Angsty-Whiny Girl',
( run in 0.940 second using v1.01-cache-2.11-cpan-0a6323c29d9 )