[Rt-commit] [svn] r1314 - in DBIx-SearchBuilder/trunk: . SearchBuilder/Handle t

jesse at pallas.eruditorum.org jesse at pallas.eruditorum.org
Sat Aug 7 17:03:55 EDT 2004


Author: jesse
Date: Sat Aug  7 17:03:54 2004
New Revision: 1314

Modified:
   DBIx-SearchBuilder/trunk/   (props changed)
   DBIx-SearchBuilder/trunk/SearchBuilder/Handle/Sybase.pm
   DBIx-SearchBuilder/trunk/t/00.load.t
Log:
 ----------------------------------------------------------------------
 r8312 at tinbook:  jesse | 2004-07-31T20:22:01.420179Z
 
 Checking in the sybase handle. Doesn't work well yet.
 
 ----------------------------------------------------------------------


Modified: DBIx-SearchBuilder/trunk/SearchBuilder/Handle/Sybase.pm
==============================================================================
--- DBIx-SearchBuilder/trunk/SearchBuilder/Handle/Sybase.pm	(original)
+++ DBIx-SearchBuilder/trunk/SearchBuilder/Handle/Sybase.pm	Sat Aug  7 17:03:54 2004
@@ -1,4 +1,4 @@
-# $Header: /home/jesse/DBIx-SearchBuilder/history/SearchBuilder/Handle/mysql.pm,v 1.8 2001/10/12 05:27:05 jesse Exp $
+# $Header: /home/jesse/DBIx-SearchBuilder/history/SearchBuilder/Handle/Sybase.pm,v 1.8 2001/10/12 05:27:05 jesse Exp $
 
 package DBIx::SearchBuilder::Handle::Sybase;
 use DBIx::SearchBuilder::Handle;
@@ -9,7 +9,7 @@
 
 =head1 NAME
 
-  DBIx::SearchBuilder::Handle::mysql -- a mysql specific Handle object
+  DBIx::SearchBuilder::Handle::Sybase -- a Sybase specific Handle object
 
 =head1 SYNOPSIS
 
@@ -39,22 +39,27 @@
 
 =cut
 
-sub Insert  {
-    my $self = shift;
+sub Insert {
+    my $self  = shift;
 
-    my $sth = $self->SUPER::Insert(@_);
-    if (!$sth) {
-	    return ($sth);
-     }
-    my $sql = 'SELECT @@identity';
-    my @row = $self->FetchResult($sql);
-    # TODO: Propagate Class::ReturnValue up here.
-    unless ($row[0]) {
-            return(undef);
-    }   
-    $self->{'id'} = $row[0];
+    my $table = shift;
+    my %pairs = @_;
+    my $sth   = $self->SUPER::Insert( $table, %pairs );
+    if ( !$sth ) {
+        return ($sth);
+    }
     
-    return ($self->{'id'});
+    # Can't select identity column if we're inserting the id by hand.
+    unless ($pairs{'id'}) {
+        my @row = $self->FetchResult('SELECT @@identity');
+
+        # TODO: Propagate Class::ReturnValue up here.
+        unless ( $row[0] ) {
+            return (undef);
+        }
+        $self->{'id'} = $row[0];
+    }
+    return ( $self->{'id'} );
 }
 
 
@@ -64,7 +69,7 @@
 
 =head2 DatabaseVersion
 
-return the mysql version, trimming off any -foo identifier
+return the database version, trimming off any -foo identifier
 
 =cut
 
@@ -79,16 +84,59 @@
 
 =head2 CaseSensitive 
 
-Returns undef, since mysql's searches are not case sensitive by default 
+Returns undef, since Sybase's searches are not case sensitive by default 
 
 =cut
 
 sub CaseSensitive {
     my $self = shift;
-    return(undef);
+    return(1);
+}
+
+
+# }}}
+
+
+sub ApplyLimits {
+    my $self = shift;
+    my $statementref = shift;
+    my $per_page = shift;
+    my $first = shift;
+
+}
+
+
+=head2 DistinctQuery STATEMENTREFtakes an incomplete SQL SELECT statement and massages it to return a DISTINCT result set.
+
+
+=cut
+
+sub DistinctQuery {
+    my $self = shift;
+    my $statementref = shift;
+    my $table = shift;
+
+    # Wrapper select query in a subselect as Oracle doesn't allow
+    # DISTINCT against CLOB/BLOB column types.
+    $$statementref = "SELECT main.* FROM ( SELECT DISTINCT main.id FROM $$statementref ) distinctquery, $table main WHERE (main.id = distinctquery.id) ";
+
 }
 
+# {{{ BinarySafeBLOBs
+
+=head2 BinarySafeBLOBs
+
+Return undef, as Oracle doesn't support binary-safe CLOBS
+
+
+=cut
+
+sub BinarySafeBLOBs {
+    my $self = shift;
+    return(undef);
+}
 
 # }}}
 
+# }}}
 

Modified: DBIx-SearchBuilder/trunk/t/00.load.t
==============================================================================
--- DBIx-SearchBuilder/trunk/t/00.load.t	(original)
+++ DBIx-SearchBuilder/trunk/t/00.load.t	Sat Aug  7 17:03:54 2004
@@ -1,4 +1,4 @@
-use Test::More tests=>11;
+use Test::More tests=>12;
 
 BEGIN { use_ok( "DBIx::SearchBuilder" ); }
 BEGIN { use_ok( "DBIx::SearchBuilder::Handle" ); }
@@ -8,6 +8,7 @@
 BEGIN { use_ok( "DBIx::SearchBuilder::Handle::ODBC" ); }
 BEGIN { use_ok( "DBIx::SearchBuilder::Handle::Oracle" ); }
 BEGIN { use_ok( "DBIx::SearchBuilder::Handle::Pg" ); }
+BEGIN { use_ok( "DBIx::SearchBuilder::Handle::Sybase" ); }
 BEGIN { use_ok( "DBIx::SearchBuilder::Handle::SQLite" ); }
 BEGIN { use_ok( "DBIx::SearchBuilder::Record" ); }
 BEGIN { use_ok( "DBIx::SearchBuilder::Record::Cachable" ); }


More information about the Rt-commit mailing list