# will get the same rdbms version). _determine_supports_X does not need to
# exist on a driver, as we ->can for it before calling.
-my @capabilities = (qw/insert_returning placeholders typeless_placeholders/);
-__PACKAGE__->mk_group_accessors( dbms_capability => map { "_supports_$_" } @capabilities );
-__PACKAGE__->mk_group_accessors( use_dbms_capability => map { "_use_$_" } @capabilities );
-
+__PACKAGE__->mk_dbi_capability_accessors (qw/insert_returning placeholders typeless_placeholders/);
+sub mk_dbi_capability_accessors {
+ my $class = shift;
+ $class->mk_group_accessors( dbms_capability => map { "_supports_$_" } @_ );
+ $class->mk_group_accessors( use_dbms_capability => map { "_use_$_" } @_ );
+}
# Each of these methods need _determine_driver called before itself
# in order to function reliably. This is a purely DRY optimization
__PACKAGE__->sql_maker_class('DBIx::Class::SQLAHacks::MySQL');
-__PACKAGE__->mk_group_accessors(simple => qw/_bit_as/);
+__PACKAGE__->mk_dbi_capability_accessors(qw/bit_as_unsigned/);
+__PACKAGE__->mk_group_accessors(inherited => qw/_cast_bit_bit_as/);
sub with_deferred_fk_checks {
my ($self, $sub) = @_;
$self->_do_query(q|SET SQL_AUTO_IS_NULL = 0|);
}
+sub connect_call_bit_as_unsigned {
+ my $self = shift;
+
+ $self->_bit_as('UNSIGNED');
+}
+
sub _dbh_last_insert_id {
my ($self, $dbh, $source, $col) = @_;
$dbh->{mysql_insertid};
=cut
-sub connect_call_bit_as_unsigned {
- my $self = shift;
-
- $self->_bit_as('UNSIGNED');
-}
sub bind_attribute_by_data_type {
my $self = shift;
my ($data_type) = @_;
- my $res = $self->next::method(@_) || {};
+ my $res = $self->next::method(@_);
- if ($data_type && $self->_bit_as && lc($data_type) eq 'bit') {
+ if ($data_type && lc($data_type) eq 'bit' && $self->_bit_as && ) {
$res->{TYPE} = SQL_INTEGER;
}
use strict;
-use warnings;
+use warnings;
use Test::More;
use Test::Exception;
$dbh->do("CREATE TABLE bitfield_test (id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, bitfield_1 BIT(1));");
}
-#'dbi:mysql:host=localhost;database=dbic_test', 'dbic_test', '');
-
-# make sure sqlt_type overrides work (::Storage::DBI::mysql does this)
+# make sure sqlt_type overrides work (::Storage::DBI::mysql does this)
{
my $schema = DBICTest::Schema->connect($dsn, $user, $pass);