use strict;
use warnings;
-use base 'DBIx::Class::Schema::Loader::DBI';
+use base qw/
+ DBIx::Class::Schema::Loader::DBI
+ DBIx::Class::Schema::Loader::DBI::Sybase::Common
+/;
use Carp::Clan qw/^DBIx::Class/;
use Class::C3;
=cut
-sub _rebless {
- my $self = shift;
-
- $self->schema->storage->sql_maker->quote_char([qw/[ ]/])
- unless $self->schema->storage->sql_maker->quote_char;
-
- $self->schema->storage->sql_maker->name_sep('.')
- unless $self->schema->storage->sql_maker->name_sep;
-}
-
sub _setup {
my $self = shift;
$self->next::method(@_);
-
- $self->{db_schema} ||= $self->_determine_db_schema;
+ $self->{db_schema} ||= $self->_build_db_schema;
+ $self->_set_quote_char_and_name_sep;
}
-sub _determine_db_schema {
- my $self = shift;
- my $dbh = $self->schema->storage->dbh;
-
- my $test_table = "_loader_test_$$";
- $dbh->do("create table $test_table (id integer)");
-
- my $db_schema = 'dbo'; # default
-
- eval {
- my $sth = $dbh->prepare('sp_tables');
- $sth->execute;
- while (my $row = $sth->fetchrow_hashref) {
- next unless $row->{TABLE_NAME} eq $test_table;
-
- $db_schema = $row->{TABLE_OWNER};
- last;
- }
- $sth->finish;
- };
- my $exception = $@;
- $dbh->do("drop table $test_table");
- croak $exception if $exception;
-
- return $db_schema;
-}
-
-
-# DBD::Sybase doesn't implement get_info properly
-#sub _build_quoter { [qw/[ ]/] }
-sub _build_quoter { '"' }
-sub _build_namesep { '.' }
-
sub _table_pk_info {
my ($self, $table) = @_;
my $dbh = $self->schema->storage->dbh;
Justin Hunter C<justin.d.hunter@gmail.com>
+=head1 CONTRIBUTORS
+
+Rafael Kitover <rkitover@cpan.org>
+
=cut
1;