__PACKAGE__->cursor_class('DBIx::Class::Storage::DBI::Cursor');
__PACKAGE__->mk_group_accessors('inherited' => qw/
- sql_maker_class sql_limit_dialect sql_quote_char sql_name_sep
+ sql_limit_dialect sql_quote_char sql_name_sep
/);
-__PACKAGE__->sql_name_sep('.');
+__PACKAGE__->mk_group_accessors('component_class' => qw/sql_maker_class datetime_parser_type/);
__PACKAGE__->sql_maker_class('DBIx::Class::SQLMaker');
+__PACKAGE__->datetime_parser_type('DateTime::Format::MySQL'); # historic default
+
+__PACKAGE__->sql_name_sep('.');
__PACKAGE__->mk_group_accessors('simple' => qw/
_connect_info _dbi_connect_info _dbic_connect_attributes _driver_determined
no strict qw/refs/;
no warnings qw/redefine/;
*{__PACKAGE__ ."::$meth"} = subname $meth => sub {
- if (not $_[0]->_driver_determined and not $_[0]->{_in_determine_driver}) {
+ if (
+ # only fire when invoked on an instance, a valid class-based invocation
+ # would e.g. be setting a default for an inherited accessor
+ ref $_[0]
+ and
+ ! $_[0]->_driver_determined
+ and
+ ! $_[0]->{_in_determine_driver}
+ ) {
$_[0]->_determine_driver;
# This for some reason crashes and burns on perl 5.8.1
my $cref = $_[0]->can ($meth);
goto $cref;
}
+
goto $orig;
};
}
my ($self) = @_;
unless ($self->_sql_maker) {
my $sql_maker_class = $self->sql_maker_class;
- $self->ensure_class_loaded ($sql_maker_class);
my %opts = %{$self->_sql_maker_opts||{}};
my $dialect =
=head2 datetime_parser_type
-Defines (returns) the datetime parser class - currently hardwired to
-L<DateTime::Format::MySQL>
-
-=cut
-
-sub datetime_parser_type { "DateTime::Format::MySQL"; }
+Defines the datetime parser class - currently defaults to L<DateTime::Format::MySQL>
=head2 build_datetime_parser
sub build_datetime_parser {
my $self = shift;
my $type = $self->datetime_parser_type(@_);
- $self->ensure_class_loaded ($type);
return $type;
}
=cut
+__PACKAGE__->datetime_parser_type (
+ 'DBIx::Class::Storage::DBI::ADO::Microsoft_SQL_Server::DateTime::Format'
+);
+
sub _rebless {
my $self = shift;
$self->_identity_method('@@identity');
}
}
-sub datetime_parser_type {
- 'DBIx::Class::Storage::DBI::ADO::Microsoft_SQL_Server::DateTime::Format'
-}
-
package # hide from PAUSE
DBIx::Class::Storage::DBI::ADO::Microsoft_SQL_Server::DateTime::Format;
__PACKAGE__->sql_limit_dialect ('RowNumberOver');
__PACKAGE__->sql_quote_char ('"');
+__PACKAGE__->datetime_parser_type('DateTime::Format::DB2');
sub _dbh_last_insert_id {
my ($self, $dbh, $source, $col) = @_;
return @res ? $res[0] : undef;
}
-sub datetime_parser_type { "DateTime::Format::DB2"; }
1;
__PACKAGE__->sql_limit_dialect ('SkipFirst');
__PACKAGE__->sql_quote_char ('"');
+__PACKAGE__->datetime_parser_type (
+ 'DBIx::Class::Storage::DBI::Informix::DateTime::Format'
+);
+
__PACKAGE__->mk_group_accessors('simple' => '__last_insert_id');
$ENV{GL_DATETIME} = "%Y-%m-%d %H:%M:%S%F5";
}
-sub datetime_parser_type {
- 'DBIx::Class::Storage::DBI::Informix::DateTime::Format'
-}
-
package # hide from PAUSE
DBIx::Class::Storage::DBI::Informix::DateTime::Format;
__PACKAGE__->_use_insert_returning (1);
__PACKAGE__->sql_limit_dialect ('FirstSkip');
__PACKAGE__->sql_quote_char ('"');
+__PACKAGE__->datetime_parser_type(
+ 'DBIx::Class::Storage::DBI::InterBase::DateTime::Format'
+);
sub _sequence_fetch {
my ($self, $nextval, $sequence) = @_;
$self->_get_dbh->{ib_time_all} = 'ISO';
}
-sub datetime_parser_type {
- 'DBIx::Class::Storage::DBI::InterBase::DateTime::Format'
-}
package # hide from PAUSE
DBIx::Class::Storage::DBI::InterBase::DateTime::Format;
__PACKAGE__->sql_quote_char([qw/[ ]/]);
+__PACKAGE__->datetime_parser_type (
+ 'DBIx::Class::Storage::DBI::MSSQL::DateTime::Format'
+);
+
+
__PACKAGE__->new_guid('NEWID()');
sub _set_identity_insert {
$self->_get_dbh->do("ROLLBACK TRANSACTION $name");
}
-sub datetime_parser_type {
- 'DBIx::Class::Storage::DBI::MSSQL::DateTime::Format'
-}
-
sub sqlt_type { 'SQLServer' }
sub sql_limit_dialect {
=cut
+__PACKAGE__->datetime_parser_type ('DBIx::Class::Storage::DBI::ODBC::Firebird::DateTime::Format');
+
# XXX seemingly no equivalent to ib_time_all from DBD::InterBase via ODBC
sub connect_call_datetime_setup { 1 }
# releasing savepoints doesn't work, but that shouldn't matter
sub _svp_release { 1 }
-sub datetime_parser_type {
- 'DBIx::Class::Storage::DBI::ODBC::Firebird::DateTime::Format'
-}
-
package # hide from PAUSE
DBIx::Class::Storage::DBI::ODBC::Firebird::DateTime::Format;
use mro 'c3';
__PACKAGE__->sql_maker_class('DBIx::Class::SQLMaker::Oracle');
+__PACKAGE__->datetime_parser_type('DateTime::Format::Oracle');
sub _determine_supports_insert_returning {
my $self = shift;
This sets the proper DateTime::Format module for use with
L<DBIx::Class::InflateColumn::DateTime>.
-=cut
-
-sub datetime_parser_type { return "DateTime::Format::Oracle"; }
-
=head2 connect_call_datetime_setup
Used as:
__PACKAGE__->sql_limit_dialect ('LimitOffset');
__PACKAGE__->sql_quote_char ('"');
+__PACKAGE__->datetime_parser_type ('DateTime::Format::Pg');
# Ask for a DBD::Pg with array support
warn __PACKAGE__.": DBD::Pg 2.9.2 or greater is strongly recommended\n"
return 'PostgreSQL';
}
-sub datetime_parser_type { return "DateTime::Format::Pg"; }
-
sub bind_attribute_by_data_type {
my ($self,$data_type) = @_;
__PACKAGE__->sql_maker_class('DBIx::Class::SQLMaker::SQLite');
__PACKAGE__->sql_limit_dialect ('LimitOffset');
__PACKAGE__->sql_quote_char ('"');
+__PACKAGE__->datetime_parser_type ('DateTime::Format::SQLite');
sub backup {
$self->next::method($schema, $type, $version, $dir, $sqltargs, @rest);
}
-sub datetime_parser_type { return "DateTime::Format::SQLite"; }
-
=head2 connect_call_use_foreign_keys
Used as:
__PACKAGE__->sql_limit_dialect ('RowCountOrGenericSubQ');
__PACKAGE__->sql_quote_char ([qw/[ ]/]);
+__PACKAGE__->datetime_parser_type('DateTime::Format::Sybase');
__PACKAGE__->mk_group_accessors('simple' =>
qw/_identity _blob_log_on_update _writer_storage _is_extra_storage
}
}
-sub datetime_parser_type { "DateTime::Format::Sybase" }
# ->begin_work and such have no effect with FreeTDS but we run them anyway to
# let the DBD keep any state it needs to.
use mro 'c3';
use Carp::Clan qw/^DBIx::Class/;
+__PACKAGE__->datetime_parser_type(
+ 'DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server::DateTime::Format'
+);
+
sub _rebless {
my $self = shift;
my $dbh = $self->_get_dbh;
}
}
-sub datetime_parser_type {
- 'DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server::DateTime::Format'
-}
package # hide from PAUSE
DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server::DateTime::Format;