[Bast-commits] r6425 - in
branches/DBIx-Class-Schema-Loader/odbc-mssql/lib/DBIx/Class/Schema/Loader:
. DBI
caelum at dev.catalyst.perl.org
caelum at dev.catalyst.perl.org
Mon May 25 23:45:11 GMT 2009
Author: caelum
Date: 2009-05-25 23:45:11 +0000 (Mon, 25 May 2009)
New Revision: 6425
Modified:
branches/DBIx-Class-Schema-Loader/odbc-mssql/lib/DBIx/Class/Schema/Loader/DBI.pm
branches/DBIx-Class-Schema-Loader/odbc-mssql/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm
Log:
make quoter/name_sep builders overridable methods
Modified: branches/DBIx-Class-Schema-Loader/odbc-mssql/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm
===================================================================
--- branches/DBIx-Class-Schema-Loader/odbc-mssql/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm 2009-05-25 22:51:08 UTC (rev 6424)
+++ branches/DBIx-Class-Schema-Loader/odbc-mssql/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm 2009-05-25 23:45:11 UTC (rev 6425)
@@ -34,6 +34,11 @@
$self->{db_schema} ||= 'dbo';
}
+# 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;
Modified: branches/DBIx-Class-Schema-Loader/odbc-mssql/lib/DBIx/Class/Schema/Loader/DBI.pm
===================================================================
--- branches/DBIx-Class-Schema-Loader/odbc-mssql/lib/DBIx/Class/Schema/Loader/DBI.pm 2009-05-25 22:51:08 UTC (rev 6424)
+++ branches/DBIx-Class-Schema-Loader/odbc-mssql/lib/DBIx/Class/Schema/Loader/DBI.pm 2009-05-25 23:45:11 UTC (rev 6425)
@@ -46,14 +46,8 @@
}
# Set up the default quoting character and name seperators
- $self->{_quoter} = $dbh->get_info(29)
- || $self->schema->storage->sql_maker->quote_char
- || q{"};
-
- $self->{_namesep} = $dbh->get_info(41)
- || $self->schema->storage->sql_maker->name_sep
- || q{.};
-
+ $self->{_quoter} = $self->_build_quoter;
+ $self->{_namesep} = $self->_build_namesep;
# For our usage as regex matches, concatenating multiple quoter
# values works fine (e.g. s/\Q<>\E// if quoter was [ '<', '>' ])
if( ref $self->{_quoter} eq 'ARRAY') {
@@ -65,6 +59,22 @@
$self;
}
+sub _build_quoter {
+ my $self = shift;
+ my $dbh = $self->schema->storage->dbh;
+ return $dbh->get_info(29)
+ || $self->schema->storage->sql_maker->quote_char
+ || q{"};
+}
+
+sub _build_namesep {
+ my $self = shift;
+ my $dbh = $self->schema->storage->dbh;
+ return $dbh->get_info(41)
+ || $self->schema->storage->sql_maker->name_sep
+ || q{.};
+}
+
# Override this in vendor modules to do things at the end of ->new()
sub _setup { }
@@ -79,7 +89,8 @@
my $dbh = $self->schema->storage->dbh;
my @tables = $dbh->tables(undef, $self->db_schema, $table, $type);
- s/\Q$self->{_quoter}\E//g for @tables;
+
+ s/\Q$self->{_quoter}\E//g for @tables;
s/^.*\Q$self->{_namesep}\E// for @tables;
return @tables;
More information about the Bast-commits
mailing list