Revision history for DBIx::Class
+0.06001
+ - Added fix for quoting with single table
+
0.06000
- Lots of documentation improvements
- Minor tweak to related_resultset to prevent it storing a searched rs
sub select {
my ($self, $table, $fields, $where, $order, @rest) = @_;
+ $table = $self->_quote($table) unless ref($table);
@rest = (-1) unless defined $rest[0];
local $self->{having_bind} = [];
my ($sql, @ret) = $self->SUPER::select(
return wantarray ? ($sql, @ret, @{$self->{having_bind}}) : $sql;
}
+sub insert {
+ my $self = shift;
+ my $table = shift;
+ $table = $self->_quote($table) unless ref($table);
+ $self->SUPER::insert($table, @_);
+}
+
+sub update {
+ my $self = shift;
+ my $table = shift;
+ $table = $self->_quote($table) unless ref($table);
+ $self->SUPER::update($table, @_);
+}
+
+sub delete {
+ my $self = shift;
+ my $table = shift;
+ $table = $self->_quote($table) unless ref($table);
+ $self->SUPER::delete($table, @_);
+}
+
sub _emulate_limit {
my $self = shift;
if ($_[3] == -1) {
} elsif (ref $from eq 'HASH') {
return $self->_make_as($from);
} else {
- return $from;
+ return $from; # would love to quote here but _table ends up getting called
+ # twice during an ->select without a limit clause due to
+ # the way S::A::Limit->select works. should maybe consider
+ # bypassing this and doing S::A::select($self, ...) in
+ # our select method above. meantime, quoting shims have
+ # been added to select/insert/update/delete here
}
}
eval "use DBD::SQLite";
plan $@
? ( skip_all => 'needs DBD::SQLite for testing' )
- : ( tests => 6 );
+ : ( tests => 7 );
}
use lib qw(t/lib);
{ join => 'artist' });
cmp_ok($rs->count,'==', 1,"join quoted with brackets.");
+my %data = (
+ name => 'Bill',
+ order => '12'
+);
+DBICTest->schema->storage->sql_maker->quote_char('`');
+DBICTest->schema->storage->sql_maker->name_sep('.');
+cmp_ok(DBICTest->schema->storage->sql_maker->update('group', \%data), 'eq', 'UPDATE `group` SET `name` = ?, `order` = ?', "quoted table names for UPDATE");