X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema%2FLoader%2FDBI%2FSybase%2FCommon.pm;h=7e46f49781c13e9de9c36d5ce5d7e1eb11c54fe2;hb=023596033b27c52ba85a41181004cf960d84fb75;hp=676efd8a5b6c965ca9fd1ddfb0a948ee376f5c3c;hpb=243c6ebce7ae31cd4234b3125b177d4d0c86bcc7;p=dbsrgits%2FDBIx-Class-Schema-Loader.git diff --git a/lib/DBIx/Class/Schema/Loader/DBI/Sybase/Common.pm b/lib/DBIx/Class/Schema/Loader/DBI/Sybase/Common.pm index 676efd8..7e46f49 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/Sybase/Common.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/Sybase/Common.pm @@ -3,25 +3,24 @@ package DBIx::Class::Schema::Loader::DBI::Sybase::Common; use strict; use warnings; use base 'DBIx::Class::Schema::Loader::DBI'; -use Carp::Clan qw/^DBIx::Class/; -use Class::C3; +use mro 'c3'; -our $VERSION = '0.05003'; +our $VERSION = '0.07036_03'; =head1 NAME -DBIx::Class::Schema::Loader::DBI::Sybase::Common - Common functions for Sybase +DBIx::Class::Schema::Loader::DBI::Sybase::Common - Common methods for Sybase and MSSQL =head1 DESCRIPTION -See L. +See L and L. =cut # DBD::Sybase doesn't implement get_info properly -sub _build_quoter { '"' } -sub _build_namesep { '.' } +sub _build_quote_char { '[]' } +sub _build_name_sep { '.' } sub _setup { my $self = shift; @@ -30,38 +29,6 @@ sub _setup { $self->schema->storage->sql_maker->quote_char([qw/[ ]/]); $self->schema->storage->sql_maker->name_sep('.'); - $self->{db_schema} ||= $self->_build_db_schema; -} - -sub _build_db_schema { - my $self = shift; - my $dbh = $self->schema->storage->dbh; - - local $dbh->{FetchHashKeyName} = 'NAME_lc'; - - my $test_table = "_loader_test_$$"; - - my $db_schema = 'dbo'; # default - - eval { - $dbh->do("create table $test_table (id integer)"); - 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; - $dbh->do("drop table $test_table"); - }; - my $exception = $@; - eval { $dbh->do("drop table $test_table") }; - carp "Could not determine db_schema, defaulting to $db_schema : $exception" - if $exception; - - return $db_schema; } # remove 'IDENTITY' from column data_type @@ -80,6 +47,8 @@ sub _columns_info_for { L, L, +L, +L, L L, L,