-use strict;
-use Module::Build;
-
-my %arguments = (
- create_makefile_pl => 'passthrough',
- license => 'perl',
- module_name => 'DBIx::Class',
- requires => {
- 'Cwd' => 3.19,
- 'Data::Page' => 2.00,
- 'Scalar::Util' => 0,
- 'SQL::Abstract' => 1.20,
- 'SQL::Abstract::Limit' => 0.101,
- 'Class::C3' => 0.13,
- 'Storable' => 0,
- 'Class::Data::Accessor' => 0.01,
- 'Carp::Clan' => 0,
- 'DBI' => 1.40,
- 'Module::Find' => 0,
- 'Class::Inspector' => 0,
- },
- build_requires => {
- 'DBD::SQLite' => 1.11,
- },
- create_makefile_pl => 'passthrough',
- create_readme => 1,
- test_files => [ glob('t/*.t'), glob('t/*/*.t') ],
- script_files => [ glob('script/*') ],
-);
-
-Module::Build->new(%arguments)->create_build_script;
-
+# Dear Distribution Packager. This use of require is intentional.
+# Module::Install detects Build.PL usage and acts accordingly.
+require 'Makefile.PL';
- columns_info_for is deprecated, and no longer runs automatically.
You can make it work like before via
__PACKAGE__->column_info_from_storage(1) for now
-
-0.07003 2006-XX-XX XX:XX:XX
+ - Replaced DBIx::Class::AccessorGroup and Class::Data::Accessor with
+ Class::Accessor::Grouped. Only user noticible change is to
+ table_class on ResultSourceProxy::Table (i.e. table objects in
+ schemas) and, resultset_class and result_class in ResultSource.
+ These accessors no longer automatically require the classes when
+ set.
+
+0.07003 2006-11-16 11:52:00
+ - fix for rt.cpan.org #22740 (use $^X instead of hardcoded "perl")
+ - Tweaks to resultset to allow inflate_result to return an array
- Fix UTF8Columns to work under Perl <= 5.8.0
- Fix up new_result in ResultSet to avoid alias-related bugs
- Made new/update/find handle 'single' rel accessor correctly
- Fix NoBindVars to be safer and handle non-true bind values
+ - Don't blow up if columns_info_for returns useless results
+ - Documentation updates
0.07002 2006-09-14 21:17:32
- fix quote tests for recent versions of SQLite
\.tmp$
\.old$
\.bak$
+\..*?\.sw[po]$
\#$
\b\.#
# Skip maint stuff
^maint/
+
+# Dont use Module::Build anymore
+# Build.PL
-# Note: this file was auto-generated by Module::Build::Compat version 0.03
-
- unless (eval "use Module::Build::Compat 0.02; 1" ) {
- print "This module requires Module::Build to install itself.\n";
-
- require ExtUtils::MakeMaker;
- my $yn = ExtUtils::MakeMaker::prompt
- (' Install Module::Build now from CPAN?', 'y');
-
- unless ($yn =~ /^y/i) {
- die " *** Cannot install without Module::Build. Exiting ...\n";
- }
-
- require Cwd;
- require File::Spec;
- require CPAN;
-
- # Save this 'cause CPAN will chdir all over the place.
- my $cwd = Cwd::cwd();
-
- CPAN::Shell->install('Module::Build::Compat');
- CPAN::Shell->expand("Module", "Module::Build::Compat")->uptodate
- or die "Couldn't install Module::Build, giving up.\n";
-
- chdir $cwd or die "Cannot chdir() back to $cwd: $!";
- }
- eval "use Module::Build::Compat 0.02; 1" or die $@;
-
- Module::Build::Compat->run_build_pl(args => \@ARGV);
- require Module::Build;
- Module::Build::Compat->write_makefile(build_class => 'Module::Build');
+use inc::Module::Install 0.64;
+
+name 'DBIx-Class';
+all_from 'lib/DBIx/Class.pm';
+perl_version '5.006001';
+
+requires 'Cwd' => 3.19;
+requires 'Data::Page' => 2.00;
+requires 'Scalar::Util' => 0;
+requires 'SQL::Abstract' => 1.20;
+requires 'SQL::Abstract::Limit' => 0.101;
+requires 'Class::C3' => 0.13;
+requires 'Storable' => 0;
+requires 'Carp::Clan' => 0;
+requires 'DBI' => 1.40;
+requires 'Module::Find' => 0;
+requires 'Class::Inspector' => 0;
+requires 'Class::Accessor::Grouped' => 0;
+
+# Perl 5.8.0 doesn't have utf8::is_utf8()
+requires 'Encode' => 0 if ($] <= 5.008000);
+
+build_requires 'DBD::SQLite' => 1.11;
+
+install_script 'script/dbicadmin';
+
+tests "t/*.t t/*/*.t";
+
+auto_install;
+
+WriteAll;
use warnings;
use vars qw($VERSION);
-use base qw/DBIx::Class::Componentised Class::Data::Accessor/;
+use base qw/DBIx::Class::Componentised Class::Accessor::Grouped/;
+
+sub mk_classdata {
+ my $self = shift;
+ $self->mk_group_accessors('inherited', $_[0]);
+ $self->set_inherited(@_) if @_ > 1;
+}
-sub mk_classdata { shift->mk_classaccessor(@_); }
sub component_base_class { 'DBIx::Class' }
# Always remember to do all digits for the version even if they're 0
ank: Andres Kievsky
+ash: Ash Berlin <ash@cpan.org>
+
blblack: Brandon L. Black <blblack@gmail.com>
bluefeet: Aran Deltac <bluefeet@cpan.org>
+++ /dev/null
-package DBIx::Class::AccessorGroup;
-
-use strict;
-use warnings;
-
-use Carp::Clan qw/^DBIx::Class/;
-
-=head1 NAME
-
-DBIx::Class::AccessorGroup - Lets you build groups of accessors
-
-=head1 SYNOPSIS
-
-=head1 DESCRIPTION
-
-This class lets you build groups of accessors that will call different
-getters and setters.
-
-=head1 METHODS
-
-=head2 mk_group_accessors
-
-=over 4
-
-=item Arguments: $group, @fieldspec
-
-Returns: none
-
-=back
-
-Creates a set of accessors in a given group.
-
-$group is the name of the accessor group for the generated accessors; they
-will call get_$group($field) on get and set_$group($field, $value) on set.
-
-@fieldspec is a list of field/accessor names; if a fieldspec is a scalar
-this is used as both field and accessor name, if a listref it is expected to
-be of the form [ $accessor, $field ].
-
-=cut
-
-sub mk_group_accessors {
- my ($self, $group, @fields) = @_;
-
- $self->_mk_group_accessors('make_group_accessor', $group, @fields);
- return;
-}
-
-
-{
- no strict 'refs';
- no warnings 'redefine';
-
- sub _mk_group_accessors {
- my($self, $maker, $group, @fields) = @_;
- my $class = ref $self || $self;
-
- # So we don't have to do lots of lookups inside the loop.
- $maker = $self->can($maker) unless ref $maker;
-
- foreach my $field (@fields) {
- if( $field eq 'DESTROY' ) {
- carp("Having a data accessor named DESTROY in ".
- "'$class' is unwise.");
- }
-
- my $name = $field;
-
- ($name, $field) = @$field if ref $field;
-
- my $accessor = $self->$maker($group, $field);
- my $alias = "_${name}_accessor";
-
- #warn "$class $group $field $alias";
-
- *{$class."\:\:$name"} = $accessor;
- #unless defined &{$class."\:\:$field"}
-
- *{$class."\:\:$alias"} = $accessor;
- #unless defined &{$class."\:\:$alias"}
- }
- }
-}
-
-=head2 mk_group_ro_accessors
-
-=over 4
-
-=item Arguments: $group, @fieldspec
-
-Returns: none
-
-=back
-
-Creates a set of read only accessors in a given group. Identical to
-<L:/mk_group_accessors> but accessors will throw an error if passed a value
-rather than setting the value.
-
-=cut
-
-sub mk_group_ro_accessors {
- my($self, $group, @fields) = @_;
-
- $self->_mk_group_accessors('make_group_ro_accessor', $group, @fields);
-}
-
-=head2 mk_group_wo_accessors
-
-=over 4
-
-=item Arguments: $group, @fieldspec
-
-Returns: none
-
-=back
-
-Creates a set of write only accessors in a given group. Identical to
-<L:/mk_group_accessors> but accessors will throw an error if not passed a
-value rather than getting the value.
-
-=cut
-
-sub mk_group_wo_accessors {
- my($self, $group, @fields) = @_;
-
- $self->_mk_group_accessors('make_group_wo_accessor', $group, @fields);
-}
-
-=head2 make_group_accessor
-
-=over 4
-
-=item Arguments: $group, $field
-
-Returns: $sub (\CODE)
-
-=back
-
-Returns a single accessor in a given group; called by mk_group_accessors
-for each entry in @fieldspec.
-
-=cut
-
-sub make_group_accessor {
- my ($class, $group, $field) = @_;
-
- my $set = "set_$group";
- my $get = "get_$group";
-
- # Build a closure around $field.
- return sub {
- my $self = shift;
-
- if(@_) {
- return $self->$set($field, @_);
- }
- else {
- return $self->$get($field);
- }
- };
-}
-
-=head2 make_group_ro_accessor
-
-=over 4
-
-=item Arguments: $group, $field
-
-Returns: $sub (\CODE)
-
-=back
-
-Returns a single read-only accessor in a given group; called by
-mk_group_ro_accessors for each entry in @fieldspec.
-
-=cut
-
-sub make_group_ro_accessor {
- my($class, $group, $field) = @_;
-
- my $get = "get_$group";
-
- return sub {
- my $self = shift;
-
- if(@_) {
- my $caller = caller;
- croak("'$caller' cannot alter the value of '$field' on ".
- "objects of class '$class'");
- }
- else {
- return $self->$get($field);
- }
- };
-}
-
-=head2 make_group_wo_accessor
-
-=over 4
-
-=item Arguments: $group, $field
-
-Returns: $sub (\CODE)
-
-=back
-
-Returns a single write-only accessor in a given group; called by
-mk_group_wo_accessors for each entry in @fieldspec.
-
-=cut
-
-sub make_group_wo_accessor {
- my($class, $group, $field) = @_;
-
- my $set = "set_$group";
-
- return sub {
- my $self = shift;
-
- unless (@_) {
- my $caller = caller;
- croak("'$caller' cannot access the value of '$field' on ".
- "objects of class '$class'");
- }
- else {
- return $self->$set($field, @_);
- }
- };
-}
-
-=head2 get_simple
-
-=over 4
-
-=item Arguments: $field
-
-Returns: $value
-
-=back
-
-Simple getter for hash-based objects which returns the value for the field
-name passed as an argument.
-
-=cut
-
-sub get_simple {
- my ($self, $get) = @_;
- return $self->{$get};
-}
-
-=head2 set_simple
-
-=over 4
-
-=item Arguments: $field, $new_value
-
-Returns: $new_value
-
-=back
-
-Simple setter for hash-based objects which sets and then returns the value
-for the field name passed as an argument.
-
-=cut
-
-sub set_simple {
- my ($self, $set, $val) = @_;
- return $self->{$set} = $val;
-}
-
-=head2 get_component_class
-
-=over 4
-
-=item Arguments: $name
-
-Returns: $component_class
-
-=back
-
-Returns the class name for a component; returns an object key if called on
-an object, or attempts to return classdata referenced by _$name if called
-on a class.
-
-=cut
-
-sub get_component_class {
- my ($self, $get) = @_;
- if (ref $self) {
- return $self->{$get};
- } else {
- $get = "_$get";
- return $self->can($get) ? $self->$get : undef;
- }
-}
-
-=head2 set_component_class
-
-=over 4
-
-=item Arguments: $name, $new_component_class
-
-Returns: $new_component_class
-
-=back
-
-Sets a component class name; attempts to require the class before setting
-but does not error if unable to do so. Sets an object key of the given name
-if called or an object or classdata called _$name if called on a class.
-
-=cut
-
-sub set_component_class {
- my ($self, $set, $val) = @_;
- eval "require $val";
- if ($@) {
- my $val_path = $val;
- $val_path =~ s{::}{/}g;
- carp $@ unless $@ =~ /^Can't locate $val_path\.pm/;
- }
- if (ref $self) {
- return $self->{$set} = $val;
- } else {
- $set = "_$set";
- return $self->can($set) ?
- $self->$set($val) :
- $self->mk_classdata($set => $val);
- }
-}
-
-1;
-
-=head1 AUTHORS
-
-Matt S. Trout <mst@shadowcatsystems.co.uk>
-
-=head1 LICENSE
-
-You may distribute this code under the same terms as Perl itself.
-
-=cut
-
PK
Row
ResultSourceProxy::Table
- AccessorGroup/);
+ /);
1;
=item L<DBIx::Class::ResultSourceProxy::Table>
-=item L<DBIx::Class::AccessorGroup>
-
=back
=head1 AUTHORS
that this feature is new as of 0.07, so it may not be perfect yet - bug
reports to the list very much welcome).
+For more help with components, see L<DBIx::Class::Manual::Component>.
+
=cut
__PACKAGE__->load_components(qw/InflateColumn/);
My::DBIC::Schema::Book->belongs_to( author,
'My::DBIC::Schema::Author',
- { 'self.author' => 'foreign.author' } );
+ { 'foreign.author' => 'self.author' } );
Creates a relationship where the calling class stores the foreign class's
primary key in one (or more) of its columns. This relationship defaults to
My::DBIC::Schema::Role->many_to_many( actors => 'actor_roles', 'actor' );
-Creates accessors bridging two relationships; not strictly a relationship in
-its own right, although the accessor will return a resultset or collection of
-objects just as a has_many would.
+Many_to_many is not strictly a relationship in its own right. Instead, it is
+a bridge between two resultsets which provide the same kind of convenience
+accessors as true relationships provide. Although the accessor will return a
+resultset or collection of objects just like has_many does, you cannot call
+C<$related_resultset> and similar methods which operate on true relationships.
In the above example, ActorRoles is the link table class, and Role is the
foreign class. The C<$link_rel_name> parameter is the name of the accessor for
use DBIx::Class::ResultSetColumn;
use base qw/DBIx::Class/;
-__PACKAGE__->load_components(qw/AccessorGroup/);
__PACKAGE__->mk_group_accessors('simple' => qw/result_source result_class/);
=head1 NAME
$attrs->{where}, $attrs
);
- return (@data ? $self->_construct_object(@data) : ());
+ return (@data ? ($self->_construct_object(@data))[0] : ());
}
# _is_unique_query
$self->{all_cache_position} = 1;
return ($self->all)[0];
}
+ if ($self->{stashed_objects}) {
+ my $obj = shift(@{$self->{stashed_objects}});
+ delete $self->{stashed_objects} unless @{$self->{stashed_objects}};
+ return $obj;
+ }
my @row = (
exists $self->{stashed_row}
? @{delete $self->{stashed_row}}
: $self->cursor->next
);
return unless (@row);
- return $self->_construct_object(@row);
+ my ($row, @more) = $self->_construct_object(@row);
+ $self->{stashed_objects} = \@more if @more;
+ return $row;
}
sub _construct_object {
my ($self, @row) = @_;
my $info = $self->_collapse_result($self->{_attrs}{as}, \@row);
- my $new = $self->result_class->inflate_result($self->result_source, @$info);
- $new = $self->{_attrs}{record_filter}->($new)
+ my @new = $self->result_class->inflate_result($self->result_source, @$info);
+ @new = $self->{_attrs}{record_filter}->(@new)
if exists $self->{_attrs}{record_filter};
- return $new;
+ return @new;
}
sub _collapse_result {
# in a table class
__PACKAGE__->load_components(qw/ResultSetManager Core/); # note order!
- __PACKAGE__->load_resultset_components(qw/AlwaysRS/);
# will be removed from the table class and inserted into a
# table-specific resultset class
=head2 load_resultset_components
- # in a table class
- __PACKAGE__->load_components(qw/ResultSetManager Core/); # note order!
- __PACKAGE__->load_resultset_components(qw/AlwaysRS/);
-
C<load_resultset_components> loads components in addition to
C<DBIx::Class::ResultSet> (or whatever you set as
C<base_resultset_class>).
use Storable;
use base qw/DBIx::Class/;
-__PACKAGE__->load_components(qw/AccessorGroup/);
__PACKAGE__->mk_group_accessors('simple' => qw/_ordered_columns
_columns _primaries _unique_constraints name resultset_attributes
schema from _relationships column_info_from_storage source_name
source_info/);
-__PACKAGE__->mk_group_accessors('component_class' => qw/resultset_class
+__PACKAGE__->mk_group_accessors('inherited' => qw/resultset_class
result_class/);
=head1 NAME
=item size
The length of your column, if it is a column type that can have a size
-restriction. This is currently not used by DBIx::Class.
+restriction. This is currently only used by L<DBIx::Class::Schema/deploy>.
=item is_nullable
Set this to a true value for a columns that is allowed to contain
-NULL values. This is currently not used by DBIx::Class.
+NULL values. This is currently only used by L<DBIx::Class::Schema/deploy>.
=item is_auto_increment
Set this to a true value for a column whose value is somehow
automatically set. This is used to determine which columns to empty
-when cloning objects using C<copy>.
+when cloning objects using C<copy>. It is also used by
+L<DBIx::Class::Schema/deploy>.
=item is_foreign_key
Set this to a true value for a column that contains a key from a
-foreign table. This is currently not used by DBIx::Class.
+foreign table. This is currently only used by
+L<DBIx::Class::Schema/deploy>.
=item default_value
Set this to the default value which will be inserted into a column
by the database. Can contain either a value or a function. This is
-currently not used by DBIx::Class.
+currently only used by L<DBIx::Class::Schema/deploy>.
=item sequence
will attempt to retrieve the name of the sequence from the database
automatically.
+=item extras
+
+This is used by L<DBIx::Class::Schema/deploy> and L<SQL::Translator>
+to add extra non-generic data to the column. For example: C<< extras
+=> { unsigned => 1} >> is used by the MySQL producer to set an integer
+column to unsigned. For more details, see
+L<SQL::Translator::Producer::MySQL>.
+
=back
=head2 add_column
and $self->schema and $self->storage )
{
$self->{_columns_info_loaded}++;
- my $info;
- my $lc_info;
+ my $info = {};
+ my $lc_info = {};
# eval for the case of storage without table
eval { $info = $self->storage->columns_info_for( $self->from ) };
unless ($@) {
$lc_info->{lc $realcol} = $info->{$realcol};
}
foreach my $col ( keys %{$self->_columns} ) {
- $self->_columns->{$col} = { %{ $self->_columns->{$col}}, %{$info->{$col} || $lc_info->{lc $col}} };
+ $self->_columns->{$col} = {
+ %{ $self->_columns->{$col} },
+ %{ $info->{$col} || $lc_info->{lc $col} || {} }
+ };
}
}
}
=head2 resultset_class
+` package My::ResultSetClass;
+ use base 'DBIx::Class::ResultSet';
+ ...
+
+ $source->resultset_class('My::ResultSet::Class');
+
Set the class of the resultset, this is useful if you want to create your
own resultset methods. Create your own class derived from
-L<DBIx::Class::ResultSet>, and set it here.
+L<DBIx::Class::ResultSet>, and set it here.
=head2 resultset_attributes
+ $source->resultset_attributes({ order_by => [ 'id' ] });
+
Specify here any attributes you wish to pass to your specialised resultset.
=cut
use warnings;
use base qw/DBIx::Class::ResultSourceProxy/;
-__PACKAGE__->load_components(qw/AccessorGroup/);
-__PACKAGE__->mk_group_accessors('component_class' => 'table_class');
-__PACKAGE__->table_class('DBIx::Class::ResultSource::Table');
+use DBIx::Class::ResultSource::Table;
+
+__PACKAGE__->mk_classdata(table_class => 'DBIx::Class::ResultSource::Table');
__PACKAGE__->mk_classdata('table_alias'); # FIXME: Doesn't actually do
# anything yet!
use base qw/DBIx::Class/;
use Carp::Clan qw/^DBIx::Class/;
-__PACKAGE__->load_components(qw/AccessorGroup/);
-
__PACKAGE__->mk_group_accessors('simple' => 'result_source');
=head1 NAME
use Scalar::Util qw/weaken/;
use Carp::Clan qw/^DBIx::Class/;
-__PACKAGE__->load_components(qw/AccessorGroup/);
__PACKAGE__->mk_group_accessors('simple' => qw/debug debugobj schema/);
package # Hide from PAUSE
use strict;
use warnings;
-use base qw/DBIx::Class::AccessorGroup Class::Data::Accessor/;
+use base qw/Class::Accessor::Grouped/;
+
__PACKAGE__->mk_group_accessors(simple => qw/callback debugfh/);
=head1 NAME
# tests run on windows as well
my $employees = $schema->resultset('Employee');
-my $cmd = qq|perl script/dbicadmin --schema=DBICTest::Schema --class=Employee --tlibs --connect="['dbi:SQLite:dbname=t/var/DBIxClass.db','','']" --force --tlibs|;
+my $cmd = qq|$^X script/dbicadmin --schema=DBICTest::Schema --class=Employee --tlibs --connect="['dbi:SQLite:dbname=t/var/DBIxClass.db','','']" --force --tlibs|;
`$cmd --op=insert --set="{name:'Matt'}"`;
ok( ($employees->count()==1), 'insert count' );
--- /dev/null
+use strict;
+use warnings;
+
+use Test::More;
+
+
+BEGIN {
+ eval "use DBD::SQLite";
+ plan $@
+ ? ( skip_all => 'needs DBD::SQLite for testing' )
+ : ( tests => 8 );
+}
+
+use lib qw(t/lib);
+
+use_ok('DBICTest');
+
+DBICTest->init_schema();
+
+my $sql_maker = DBICTest->schema->storage->sql_maker;
+
+$sql_maker->quote_char('`');
+$sql_maker->name_sep('.');
+
+my ($sql,) = $sql_maker->select(
+ [
+ {
+ 'me' => 'cd'
+ },
+ [
+ {
+ 'artist' => 'artist',
+ '-join_type' => ''
+ },
+ {
+ 'artist.artistid' => 'me.artist'
+ }
+ ]
+ ],
+ [
+ {
+ 'count' => '*'
+ }
+ ],
+ {
+ 'artist.name' => 'Caterwauler McCrae',
+ 'me.year' => 2001
+ },
+ [],
+ undef,
+ undef
+);
+
+is($sql,
+ q/SELECT COUNT( * ) FROM `cd` `me` JOIN `artist` `artist` ON ( `artist`.`artistid` = `me`.`artist` ) WHERE ( `artist`.`name` = ? AND `me`.`year` = ? )/,
+ 'got correct SQL for count query with quoting');
+
+($sql,) = $sql_maker->select(
+ [
+ {
+ 'me' => 'cd'
+ }
+ ],
+ [
+ 'me.cdid',
+ 'me.artist',
+ 'me.title',
+ 'me.year'
+ ],
+ undef,
+ [
+ 'year DESC'
+ ],
+ undef,
+ undef
+);
+
+TODO: {
+ local $TODO = "order_by with quoting needs fixing (ash/castaway)";
+
+ is($sql,
+ q/SELECT `me`.`cdid`, `me`.`artist`, `me`.`title`, `me`.`year` FROM `cd` `me` ORDER BY `year` DESC/,
+ 'quoted ORDER BY with DESC okay');
+}
+
+TODO: {
+ local $TODO = "select attr with star needs fixing (mst/nate)";
+
+ ($sql,) = $sql_maker->select(
+ [
+ {
+ 'me' => 'cd'
+ }
+ ],
+ [
+ 'me.*'
+ ],
+ undef,
+ [],
+ undef,
+ undef
+ );
+
+ is($sql, q/SELECT `me`.* FROM `cd` `me`/, 'select attr with me.* is right');
+}
+
+($sql,) = $sql_maker->select(
+ [
+ {
+ 'me' => 'cd'
+ }
+ ],
+ [
+ 'me.cdid',
+ 'me.artist',
+ 'me.title',
+ 'me.year'
+ ],
+ undef,
+ [
+ \'year DESC'
+ ],
+ undef,
+ undef
+);
+
+is($sql,
+ q/SELECT `me`.`cdid`, `me`.`artist`, `me`.`title`, `me`.`year` FROM `cd` `me` ORDER BY year DESC/,
+ 'did not quote ORDER BY with scalarref');
+
+my %data = (
+ name => 'Bill',
+ order => 12
+);
+
+my @binds;
+
+($sql,@binds) = $sql_maker->update(
+ 'group',
+ {
+ 'order' => '12',
+ 'name' => 'Bill'
+ }
+);
+
+is($sql,
+ q/UPDATE `group` SET `name` = ?, `order` = ?/,
+ 'quoted table names for UPDATE');
+
+$sql_maker->quote_char([qw/[ ]/]);
+
+($sql,) = $sql_maker->select(
+ [
+ {
+ 'me' => 'cd'
+ },
+ [
+ {
+ 'artist' => 'artist',
+ '-join_type' => ''
+ },
+ {
+ 'artist.artistid' => 'me.artist'
+ }
+ ]
+ ],
+ [
+ {
+ 'count' => '*'
+ }
+ ],
+ {
+ 'artist.name' => 'Caterwauler McCrae',
+ 'me.year' => 2001
+ },
+ [],
+ undef,
+ undef
+);
+
+is($sql,
+ q/SELECT COUNT( * ) FROM [cd] [me] JOIN [artist] [artist] ON ( [artist].[artistid] = [me].[artist] ) WHERE ( [artist].[name] = ? AND [me].[year] = ? )/,
+ 'got correct SQL for count query with bracket quoting');
+
+
+($sql,@binds) = $sql_maker->update(
+ 'group',
+ {
+ 'order' => '12',
+ 'name' => 'Bill'
+ }
+);
+
+is($sql,
+ q/UPDATE [group] SET [name] = ?, [order] = ?/,
+ 'bracket quoted table names for UPDATE');