[Rt-commit] rt branch, 4.0/oracle-fixes, updated. rt-3.9.7-1135-g946da7c

Ruslan Zakirov ruz at bestpractical.com
Wed Dec 29 17:26:23 EST 2010


The branch, 4.0/oracle-fixes has been updated
       via  946da7ceddf6009c1cc5df6998f17b39d271d98a (commit)
       via  038efdafc7f1754f2c566eee0227c02633947306 (commit)
       via  ee9de2eac4095926b787d72977a4f450448694c0 (commit)
      from  d506f086a6de318dc33a7236d269179e1f40389f (commit)

Summary of changes:
 lib/RT/Articles.pm                          |   12 ++++++-
 lib/RT/Tickets.pm                           |   47 +++++++++++++++++----------
 share/html/Admin/Queues/Modify.html         |    2 +-
 share/html/Elements/QueueSummaryByLifecycle |    2 +-
 4 files changed, 42 insertions(+), 21 deletions(-)

- Log -----------------------------------------------------------------
commit ee9de2eac4095926b787d72977a4f450448694c0
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Thu Dec 30 01:20:39 2010 +0300

    no =/!= operators for CLOBs on Oracle

diff --git a/lib/RT/Articles.pm b/lib/RT/Articles.pm
index 4f66a87..4025d13 100644
--- a/lib/RT/Articles.pm
+++ b/lib/RT/Articles.pm
@@ -323,6 +323,14 @@ sub LimitCustomField {
 
     # TODO this should deal with starts with and ends with
 
+    my $fix_op = sub {
+        my $op = shift;
+        return $op unless RT->Config->Get('DatabaseType') eq 'Oracle';
+        return 'MATCHES' if $op eq '=';
+        return 'NOT MATCHES' if $op eq '!=';
+        return $op;
+    };
+
     my $clause = $args{'SUBCLAUSE'} || $ObjectValuesAlias;
     
     if ( $args{'OPERATOR'} eq '!=' || $args{'OPERATOR'} =~ /^not like$/i ) {
@@ -356,8 +364,8 @@ sub LimitCustomField {
     else {
         $self->SUPER::Limit(
             ALIAS           => $ObjectValuesAlias,
-            FIELD           => 'Largecontent',
-            OPERATOR        => $args{'OPERATOR'},
+            FIELD           => 'LargeContent',
+            OPERATOR        => $fix_op->($args{'OPERATOR'}),
             VALUE           => $value,
             QUOTEVALUE      => $args{'QUOTEVALUE'},
             ENTRYAGGREGATOR => $args{'ENTRYAGGREGATOR'},

commit 038efdafc7f1754f2c566eee0227c02633947306
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Thu Dec 30 01:21:46 2010 +0300

    use TO_CHAR on CLOB column when we run a range operator

diff --git a/lib/RT/Tickets.pm b/lib/RT/Tickets.pm
index 85f3c33..66ac24c 100644
--- a/lib/RT/Tickets.pm
+++ b/lib/RT/Tickets.pm
@@ -1423,11 +1423,24 @@ sub _CustomFieldLimit {
         = $self->ClassifySQLOperation( $op );
 
     my $fix_op = sub {
-        my $op = shift;
-        return $op unless RT->Config->Get('DatabaseType') eq 'Oracle';
-        return 'MATCHES' if $op eq '=';
-        return 'NOT MATCHES' if $op eq '!=';
-        return $op;
+        return @_ unless RT->Config->Get('DatabaseType') eq 'Oracle';
+
+        my %args = @_;
+        return %args unless $args{'FIELD'} eq 'LargeContent';
+        
+        my $op = $args{'OPERATOR'};
+        if ( $op eq '=' ) {
+            $args{'OPERATOR'} = 'MATCHES';
+        }
+        elsif ( $op eq '!=' ) {
+            $args{'OPERATOR'} = 'NOT MATCHES';
+        }
+        elsif ( $op =~ /^[<>]=?$/ ) {
+            # XXX: VERY DIRTY HACK
+            $args{'ALIAS'} = 'TO_CHAR( '. $args{'ALIAS'};
+            $args{'FIELD'} .= ')'; #, 1, '. (length($args{'VALUE'}) + 1) .')';
+        }
+        return %args;
     };
 
     if ( $cf && $cf->Type eq 'IPAddress' ) {
@@ -1552,13 +1565,13 @@ sub _CustomFieldLimit {
         # if column is defined then deal only with it
         # otherwise search in Content and in LargeContent
         if ( $column ) {
-            $self->_SQLLimit(
+            $self->_SQLLimit( $fix_op->(
                 ALIAS      => $TicketCFs,
                 FIELD      => $column,
-                OPERATOR   => ($column ne 'LargeContent'? $op : $fix_op->($op)),
+                OPERATOR   => $op,
                 VALUE      => $value,
                 %rest
-            );
+            ) );
             $self->_CloseParen;
             $self->_CloseParen;
             $self->_CloseParen;
@@ -1642,13 +1655,13 @@ sub _CustomFieldLimit {
                         ENTRYAGGREGATOR => 'OR'
                     );
                     $self->_CloseParen;
-                    $self->_SQLLimit(
+                    $self->_SQLLimit( $fix_op->(
                         ALIAS           => $TicketCFs,
                         FIELD           => 'LargeContent',
-                        OPERATOR        => $fix_op->($op),
+                        OPERATOR        => $op,
                         VALUE           => $value,
                         ENTRYAGGREGATOR => 'AND',
-                    );
+                    ) );
                 }
             }
             else {
@@ -1677,13 +1690,13 @@ sub _CustomFieldLimit {
                     ENTRYAGGREGATOR => 'OR'
                 );
                 $self->_CloseParen;
-                $self->_SQLLimit(
+                $self->_SQLLimit( $fix_op->(
                     ALIAS           => $TicketCFs,
                     FIELD           => 'LargeContent',
-                    OPERATOR        => $fix_op->($op),
+                    OPERATOR        => $op,
                     VALUE           => $value,
                     ENTRYAGGREGATOR => 'AND',
-                );
+                ) );
                 $self->_CloseParen;
             }
             $self->_CloseParen;
@@ -1733,13 +1746,13 @@ sub _CustomFieldLimit {
         # if column is defined then deal only with it
         # otherwise search in Content and in LargeContent
         if ( $column ) {
-            $self->SUPER::Limit(
+            $self->SUPER::Limit( $fix_op->(
                 LEFTJOIN   => $TicketCFs,
                 ALIAS      => $TicketCFs,
                 FIELD      => $column,
-                OPERATOR   => ($column ne 'LargeContent'? $op : $fix_op->($op)),
+                OPERATOR   => $op,
                 VALUE      => $value,
-            );
+            ) );
         }
         else {
             $self->SUPER::Limit(

commit 946da7ceddf6009c1cc5df6998f17b39d271d98a
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Thu Dec 30 01:23:40 2010 +0300

    get rid of uninit warnings (Oracle specific)

diff --git a/share/html/Admin/Queues/Modify.html b/share/html/Admin/Queues/Modify.html
index 85a29a5..995f69c 100755
--- a/share/html/Admin/Queues/Modify.html
+++ b/share/html/Admin/Queues/Modify.html
@@ -61,7 +61,7 @@
 </tr>
 
 <tr><td align="right"><&|/l&>Description</&>:</td>
-<td colspan="3"><input name="Description" value="<% ($Create) ? "" : $QueueObj->Description %>" size="60" /></td>
+<td colspan="3"><input name="Description" value="<% $Create ? "" : $QueueObj->Description || '' %>" size="60" /></td>
 </tr>
 
 <tr><td align="right"><&|/l&>Lifecycle</&>:</td>
diff --git a/share/html/Elements/QueueSummaryByLifecycle b/share/html/Elements/QueueSummaryByLifecycle
index cba4e5f..ddb6234 100644
--- a/share/html/Elements/QueueSummaryByLifecycle
+++ b/share/html/Elements/QueueSummaryByLifecycle
@@ -98,7 +98,7 @@ $m->callback( CallbackName => 'Filter', Queues => \@queues );
 @queues = map {
     {  id          => $_->Id,
        Name        => $_->Name,
-       Description => $_->Description,
+       Description => $_->Description || '',
        Lifecycle   => $_->Lifecycle->Name,
     }
 } grep $_, @queues;

-----------------------------------------------------------------------


More information about the Rt-commit mailing list