/[SQLSession]/trunk/lib/SQLSession/Action/DoSQL.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/SQLSession/Action/DoSQL.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 98 by dpavlin, Tue Jan 30 14:08:47 2007 UTC revision 99 by dpavlin, Fri Feb 16 22:20:41 2007 UTC
# Line 62  sub validate_sql_query { Line 62  sub validate_sql_query {
62          }          }
63  }  }
64    
65    use SQLSession::Utils;
66    
67  sub canonicalize_sql_query {  sub canonicalize_sql_query {
68          my $self = shift;          my $self = shift;
69          my $sql = shift;          my $sql = shift;
70    
71          warn "<<<< original SQL:\t$sql";          $sql = Jifty->app_class('Utils')->reformat_sql( $sql );
   
         sub sql_uc {  
                 my ($prefix,$sql,$suff) = @_;  
                 return uc($sql).$suff if (! $prefix || $prefix eq '');  
                 return "\n" . uc($sql) . $suff;  
         }  
   
         $sql =~ s/(\s*)(select|from|inner\s+join|order\s+by|where|group\s+by|having|limit|offset)(\s+)/sql_uc($1,$2,$3)/egis;  
72    
73          warn ">>>> canonicalize SQL:\n$sql";          Jifty->log->debug("cannonicaze SQL: $sql");
74    
75          return $sql;          return $sql;
76  }  }

Legend:
Removed from v.98  
changed lines
  Added in v.99

  ViewVC Help
Powered by ViewVC 1.1.26