From: Matt S Trout <mst@shadowcat.co.uk>
Date: Fri, 27 Jan 2006 14:26:41 +0000 (+0000)
Subject: limit_dialect accessor for DBIC::Abstract
X-Git-Tag: v0.05005~93
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7be93b0768bf9b0a2c1b3d5f191ba7fd2f9937ac;p=dbsrgits%2FDBIx-Class.git

limit_dialect accessor for DBIC::Abstract
---

diff --git a/README b/README
index de87f30..ef34f92 100644
--- a/README
+++ b/README
@@ -97,6 +97,12 @@ CONTRIBUTORS
 
     Todd Lipcon
 
+    Daniel Westermann-Clark <danieltwc@cpan.org>
+
+    Alexander Hartmaier <alex_hartmaier@hotmail.com>
+
+    Zbigniew Lukasiak
+
 LICENSE
     You may distribute this code under the same terms as Perl itself.
 
diff --git a/lib/DBIx/Class.pm b/lib/DBIx/Class.pm
index 84fc24a..51e56bd 100644
--- a/lib/DBIx/Class.pm
+++ b/lib/DBIx/Class.pm
@@ -141,6 +141,8 @@ Zbigniew Lukasiak
 
 Nigel Metheringham <nigelm@cpan.org>
 
+Jesper Krogh
+
 =head1 LICENSE
 
 You may distribute this code under the same terms as Perl itself.
diff --git a/lib/DBIx/Class/Manual/Cookbook.pod b/lib/DBIx/Class/Manual/Cookbook.pod
index c22e947..2a8d17b 100644
--- a/lib/DBIx/Class/Manual/Cookbook.pod
+++ b/lib/DBIx/Class/Manual/Cookbook.pod
@@ -560,4 +560,18 @@ database schema:
 
 The schema update can be deployed to customers using the same method as before.
 
+=head2 Setting limit dialect for SQL::Abstract::Limit
+
+In some cases, SQL::Abstract::Limit cannot determine the dialect of the remote
+SQL-server by looking at the database-handle. This is a common problem when
+using the DBD::JDBC, since the DBD-driver only know that in has a Java-driver
+available, not which JDBC-driver the Java component has loaded.
+This specifically sets the limit_dialect to Microsoft SQL-server (Se more names
+in SQL::Abstract::Limit -documentation.
+
+  __PACKAGE__->storage->sql_maker->limit_dialect('mssql');
+
+The JDBC-bridge is one way of getting access to a MSSQL-server from a platform
+that Microsoft doesn't deliver native client libraries for. (e.g. Linux)
+
 =cut
diff --git a/lib/DBIx/Class/Relationship/Base.pm b/lib/DBIx/Class/Relationship/Base.pm
index c97635e..d10a7db 100644
--- a/lib/DBIx/Class/Relationship/Base.pm
+++ b/lib/DBIx/Class/Relationship/Base.pm
@@ -108,7 +108,7 @@ sub search_related {
 
 =head2 count_related
 
-  My::Table->count_related('relname', $cond, $attrs);
+  $obj->count_related('relname', $cond, $attrs);
 
 =cut
 
diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm
index 37547d2..47f88df 100644
--- a/lib/DBIx/Class/Storage/DBI.pm
+++ b/lib/DBIx/Class/Storage/DBI.pm
@@ -132,6 +132,16 @@ sub _quote {
   return $self->SUPER::_quote($label);
 }
 
+# Accessor for setting limit dialect. This is useful
+# for JDBC-bridge among others where the remote SQL-dialect cannot
+# be determined by the name of the driver alone.
+#
+sub limit_dialect {
+    my $self = shift;
+    $self->{limit_dialect} = shift if @_;
+    return $self->{limit_dialect};
+}
+
 } # End of BEGIN block
 
 use base qw/DBIx::Class/;