requires 'Class::C3::Componentised' => '1.0005';
requires 'Carp::Clan' => 0;
requires 'Class::Inspector' => 0;
-requires 'DBIx::Class' => '0.07006';
+requires 'DBIx::Class' => '0.08109';
requires 'Class::Unload' => 0;
install_script 'script/dbicdump';
my $dbh = $self->schema->storage->dbh;
my $DBMS_VERSION = @{$dbh->selectrow_arrayref(qq{sp_server_info \@attribute_id=1})}[2];
if ($DBMS_VERSION =~ /^Microsoft /i) {
- my $subclass = 'DBIx::Class::Schema::Loader::DBI::MSSQL';
+ $DBMS_VERSION =~ s/\s/_/g;
+ my $subclass = "DBIx::Class::Schema::Loader::DBI::Sybase::$DBMS_VERSION";
if ($self->load_optional_class($subclass) && !$self->isa($subclass)) {
bless $self, $subclass;
$self->_rebless;
--- /dev/null
+package DBIx::Class::Schema::Loader::DBI::Sybase::Microsoft_SQL_Server;
+
+use strict;
+use warnings;
+use base 'DBIx::Class::Schema::Loader::DBI::MSSQL';
+use Carp::Clan qw/^DBIx::Class/;
+use Class::C3;
+
+our $VERSION = '0.04999_06';
+
+=head1 NAME
+
+DBIx::Class::Schema::Loader::DBI::Sybase::Microsoft_SQL_Server - Subclass for
+using MSSQL through DBD::Sybase
+
+=head1 DESCRIPTION
+
+See L<DBIx::Class::Schema::Loader::Base>.
+
+Subclasses L<DBIx::Class::Schema::Loader::DBI::MSSQL>.
+
+=cut
+
+# Returns an array of table names
+sub _tables_list {
+ my $self = shift;
+
+ my ($table, $type) = @_ ? @_ : ('%', '%');
+
+ my $dbh = $self->schema->storage->dbh;
+ my @tables = $dbh->tables(undef, $self->db_schema, $table, $type);
+
+ return @tables;
+}
+
+=head1 SEE ALSO
+
+L<DBIx::Class::Schema::Loader::DBI::Sybase>,
+L<DBIx::Class::Schema::Loader::DBI::MSSQL>,
+L<DBIx::Class::Schema::Loader::DBI>
+L<DBIx::Class::Schema::Loader>, L<DBIx::Class::Schema::Loader::Base>,
+
+=head1 AUTHOR
+
+Rafael Kitover <rkitover@cpan.org>
+
+=cut
+
+1;
use lib qw(t/lib);
use dbixcsl_common_tests;
+use dbixcsl_mssql_extra_tests;
my $dsn = $ENV{DBICTEST_MSSQL_DSN} || '';
my $user = $ENV{DBICTEST_MSSQL_USER} || '';
my $password = $ENV{DBICTEST_MSSQL_PASS} || '';
my $tester = dbixcsl_common_tests->new(
- vendor => 'Microsoft',
+ vendor => 'mssql',
auto_inc_pk => 'INTEGER IDENTITY NOT NULL PRIMARY KEY',
dsn => $dsn,
user => $user,
password => $password,
+ extra => dbixcsl_mssql_extra_tests->extra,
);
if( !$dsn || !$user ) {
use strict;
use lib qw(t/lib);
use dbixcsl_common_tests;
+use dbixcsl_mssql_extra_tests;
my $dsn = $ENV{DBICTEST_MSSQL_ODBC_DSN} || '';
my $user = $ENV{DBICTEST_MSSQL_ODBC_USER} || '';
my $password = $ENV{DBICTEST_MSSQL_ODBC_PASS} || '';
my $tester = dbixcsl_common_tests->new(
- vendor => 'Microsoft',
+ vendor => 'mssql',
auto_inc_pk => 'INTEGER IDENTITY NOT NULL PRIMARY KEY',
dsn => $dsn,
user => $user,
password => $password,
+ extra => dbixcsl_mssql_extra_tests->extra,
);
if( !$dsn || !$user ) {
+++ /dev/null
-use strict;
-use lib qw(t/lib);
-use Test::More;
-use DBI;
-
-my $DUMP_DIR;
-BEGIN {
- $DUMP_DIR = './t/_common_dump';
-}
-
-use lib $DUMP_DIR;
-use DBIx::Class::Schema::Loader 'make_schema_at', "dump_to_dir:$DUMP_DIR";
-use File::Path;
-
-my $dsn = $ENV{DBICTEST_MSSQL_ODBC_DSN} ||
- $ENV{DBICTEST_MSSQL_DSN} || '';
-
-my $user = $ENV{DBICTEST_MSSQL_ODBC_USER} ||
- $ENV{DBICTEST_MSSQL_USER} || '';
-
-my $password = $ENV{DBICTEST_MSSQL_ODBC_PASS} ||
- $ENV{DBICTEST_MSSQL_PASS} || '';
-
-if( !$dsn || !$user ) {
- plan skip_all =>
-'You need to set the DBICTEST_MSSQL_ODBC_DSN (or DBICTEST_MSSQL_DSN), _USER,' .
-' and _PASS environment variables';
- exit;
-}
-
-plan tests => 3;
-
-my $dbh = DBI->connect($dsn, $user, $password, {
- RaiseError => 1, PrintError => 0
-});
-
-eval { $dbh->do('DROP TABLE [loadertest.dot]') };
-$dbh->do(q{
- CREATE TABLE [loadertest.dot] (
- id INT IDENTITY NOT NULL PRIMARY KEY,
- dat VARCHAR(8)
- )
-});
-
-rmtree $DUMP_DIR;
-
-eval {
- make_schema_at(
- 'TestSL::Schema',
- {
- use_namespaces => 1,
- constraint => qr/^loadertest\.dot\z/
- },
- [ $dsn, $user, $password, ]
- );
-};
-
-ok !$@, 'table name with . parsed correctly';
-diag $@ if $@;
-
-#system qq{$^X -pi -e 's/"test\.dot"/\\\\"[loadertest.dot]"/' t/_common_dump/TestSL/Schema/Result/TestDot.pm};
-#diag do { local ($/, @ARGV) = (undef, "t/_common_dump/TestSL/Schema/Result/TestDot.pm"); <> };
-#do "t/_common_dump/TestSL/Schema/Result/TestDot.pm";
-
-eval 'use TestSL::Schema';
-ok !$@, 'loaded schema';
-diag $@ if $@;
-
-TODO: {
- local $TODO = q{this is really a DBIC test to check if the table is usable,
-and it doesn't work in the released version yet};
-
- eval {
- my $rs = TestSL::Schema->resultset('LoadertestDot');
- my $row = $rs->create({ dat => 'foo' });
- $row->update({ dat => 'bar' });
- $row = $rs->find($row->id);
- $row->delete;
- };
- ok !$@, 'used table from DBIC succeessfully';
- diag $@ if $@;
-}
-
-rmtree $DUMP_DIR;
-
-$dbh->do('DROP TABLE [loadertest.dot]');
my $debug = ($self->{verbose} > 1) ? 1 : 0;
my %loader_opts = (
- constraint => qr/^(?:\S+\.)?(?:$self->{vendor}_)?loader_test[0-9]+s?$/i,
+ constraint =>
+ qr/^(?:\S+\.)?(?:$self->{vendor}_)?loader_test[0-9]+(?!.*_)/i,
relationships => 1,
additional_classes => 'TestAdditional',
additional_base_classes => 'TestAdditionalBase',
--- /dev/null
+package dbixcsl_mssql_extra_tests;
+
+use Test::More;
+
+sub extra { +{
+ create => [
+ qq{
+ CREATE TABLE [mssql_loader_test1.dot] (
+ id INT IDENTITY NOT NULL PRIMARY KEY,
+ dat VARCHAR(8)
+ )
+ },
+ ],
+ drop => [ qw/ [mssql_loader_test1.dot] / ],
+ count => 4,
+ run => sub {
+ my ($schema, $monikers, $classes) = @_;
+
+ ok((my $rs = eval { $schema->resultset('MssqlLoaderTest1Dot') }),
+ 'got a resultset');
+
+ ok((my $from = eval { $rs->result_source->from }),
+ 'got an $rsrc->from');
+
+ is ref($from), 'SCALAR', '->table is a scalar ref';
+
+ is eval { $$from }, '[mssql_loader_test1.dot]',
+ '->table name is correct';
+ },
+}}
+
+1;