[Jifty-commit] r503 - Jifty-DBI/trunk/lib/Jifty Jifty-DBI/trunk/lib/Jifty/DBI Jifty-DBI/trunk/lib/Jifty/DBI/Collection Jifty-DBI/trunk/lib/Jifty/DBI/Handle Jifty-DBI/trunk/lib/Jifty/DBI/Record

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Sat Jan 14 12:26:02 EST 2006


Author: jesse
Date: Sat Jan 14 12:26:00 2006
New Revision: 503

Modified:
   /   (props changed)
   Jifty-DBI/trunk/lib/Jifty/DBI.pm
   Jifty-DBI/trunk/lib/Jifty/DBI/Collection.pm
   Jifty-DBI/trunk/lib/Jifty/DBI/Collection/Unique.pm
   Jifty-DBI/trunk/lib/Jifty/DBI/Column.pm
   Jifty-DBI/trunk/lib/Jifty/DBI/Filter/DateTime.pm
   Jifty-DBI/trunk/lib/Jifty/DBI/Filter/Truncate.pm
   Jifty-DBI/trunk/lib/Jifty/DBI/Filter/utf8.pm
   Jifty-DBI/trunk/lib/Jifty/DBI/Handle.pm
   Jifty-DBI/trunk/lib/Jifty/DBI/Handle/Informix.pm
   Jifty-DBI/trunk/lib/Jifty/DBI/Handle/ODBC.pm
   Jifty-DBI/trunk/lib/Jifty/DBI/Handle/Oracle.pm
   Jifty-DBI/trunk/lib/Jifty/DBI/Handle/Pg.pm
   Jifty-DBI/trunk/lib/Jifty/DBI/Handle/SQLite.pm
   Jifty-DBI/trunk/lib/Jifty/DBI/Handle/Sybase.pm
   Jifty-DBI/trunk/lib/Jifty/DBI/Record.pm
   Jifty-DBI/trunk/lib/Jifty/DBI/Record/Cachable.pm
   Jifty-DBI/trunk/lib/Jifty/DBI/Schema.pm
   Jifty-DBI/trunk/lib/Jifty/DBI/SchemaGenerator.pm

Log:
 r22398 at truegrounds:  jesse | 2006-01-14 12:23:22 -0500
 * Just to break every possible patch. (and to make maintenance a bit easier), perltidied the source.


Modified: Jifty-DBI/trunk/lib/Jifty/DBI.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI.pm	(original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI.pm	Sat Jan 14 12:26:00 2006
@@ -1,11 +1,9 @@
 package Jifty::DBI;
-use warnings; 
+use warnings;
 use strict;
 
-
 our $VERSION = '0.10';
 
-
 =head1 NAME
 
 Jifty::DBI - An object-relational persistence framework

Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Collection.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Collection.pm	(original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Collection.pm	Sat Jan 14 12:26:00 2006
@@ -3,7 +3,6 @@
 use warnings;
 use strict;
 
-
 =head1 NAME
 
 Jifty::DBI::Collection - Encapsulate SQL queries and rows in simple
@@ -56,7 +55,6 @@
 use base qw/Class::Accessor/;
 __PACKAGE__->mk_accessors(qw/pager/);
 
-
 =head1 METHODS
 
 =head2 new
@@ -101,19 +99,18 @@
         handle => undef,
         @_
     );
-    $self->_handle( $args{'handle'} ) if ($args{'handle'});
+    $self->_handle( $args{'handle'} ) if ( $args{'handle'} );
     $self->clean_slate();
 }
 
-
 sub _init_pager {
     my $self = shift;
-    $self->pager(Data::Page->new);
+    $self->pager( Data::Page->new );
 
     $self->pager->total_entries(0);
     $self->pager->entries_per_page(10);
     $self->pager->current_page(1);
-} 
+}
 
 =head2 clean_slate
 
@@ -152,7 +149,7 @@
 
     $self->implicit_clauses();
     $self->_is_limited(0);
-} 
+}
 
 =head2 implicit_clauses
 
@@ -161,7 +158,7 @@
 
 =cut
 
-sub implicit_clauses {}
+sub implicit_clauses { }
 
 =head2 _handle [DBH]
 
@@ -245,7 +242,7 @@
     my $all  = shift || 0;
 
     my $query_string = $self->build_select_count_query();
-    my $records     = $self->_handle->simple_query($query_string);
+    my $records      = $self->_handle->simple_query($query_string);
     return 0 unless $records;
 
     my @row = $records->fetchrow_array();
@@ -274,7 +271,7 @@
     $self->_handle->apply_limits( $statementref, $self->rows_per_page,
         $self->first_row );
 
-    # XXX TODO: refactor me, once we figure out the last place that columns could be set
+# XXX TODO: refactor me, once we figure out the last place that columns could be set
     $$statementref =~ s/main\.\*/CORE::join(', ', @{$self->{columns}})/eg
         if $self->{columns}
         and @{ $self->{columns} };
@@ -291,7 +288,7 @@
 sub _distinct_query {
     my $self         = shift;
     my $statementref = shift;
-    $self->_handle->distinct_query($statementref, $self);
+    $self->_handle->distinct_query( $statementref, $self );
 }
 
 =head2 _build_joins
@@ -318,8 +315,7 @@
     my $self = shift;
     if ( %{ $self->{'leftjoins'} } ) {
         return (1);
-    }
-    else {
+    } else {
         return ( @{ $self->{'aliases'} } );
     }
 
@@ -337,8 +333,7 @@
             $limit_clause .= $self->first_row . ", ";
         }
         $limit_clause .= $self->rows_per_page;
-    }
-    else {
+    } else {
         $limit_clause = "";
     }
     return $limit_clause;
@@ -355,8 +350,7 @@
     my $self = shift;
     if (@_) {
         $self->{'is_limited'} = shift;
-    }
-    else {
+    } else {
         return ( $self->{'is_limited'} );
     }
 }
@@ -375,18 +369,18 @@
 
     my $query_string = $self->_build_joins . " ";
 
-    if ( $self->_is_limited ) { 
-        $query_string .= $self->_where_clause . " "
+    if ( $self->_is_limited ) {
+        $query_string .= $self->_where_clause . " ";
     }
     if ( $self->_is_joined ) {
-     # DISTINCT query only required for multi-table selects
-        $self->_distinct_query(\$query_string);
-     } else {
-         $query_string = "SELECT main.* FROM $query_string";
+
+        # DISTINCT query only required for multi-table selects
+        $self->_distinct_query( \$query_string );
+    } else {
+        $query_string = "SELECT main.* FROM $query_string";
         $query_string .= $self->_group_clause;
         $query_string .= $self->_order_clause;
-     }
- 
+    }
 
     $self->_apply_limits( \$query_string );
 
@@ -407,14 +401,13 @@
     my $query_string = $self->_build_joins . " ";
 
     if ( $self->_is_limited ) {
-        $query_string .= $self->_where_clause . " "
+        $query_string .= $self->_where_clause . " ";
     }
 
     # DISTINCT query only required for multi-table selects
     if ( $self->_is_joined ) {
         $query_string = $self->_handle->distinct_count( \$query_string );
-    }
-    else {
+    } else {
         $query_string = "SELECT count(main.id) FROM " . $query_string;
     }
 
@@ -444,8 +437,7 @@
         my $item = ( $self->{'items'}[ $self->{'itemscount'} ] );
         $self->{'itemscount'}++;
         return ($item);
-    }
-    else {    #we've gone through the whole list. reset the count.
+    } else {    #we've gone through the whole list. reset the count.
         $self->goto_first_item();
         return (undef);
     }
@@ -554,10 +546,10 @@
     my $self = shift;
     if (@_) {
         $self->{record_class} = shift if (@_);
-    }
-    elsif ( not $self->{record_class} ) {
+    } elsif ( not $self->{record_class} ) {
         my $class = ref($self);
-        $class =~ s/Collection$// or die "Can't guess record class from $class";
+        $class =~ s/Collection$//
+            or die "Can't guess record class from $class";
         $self->{record_class} = $class;
     }
     return $self->{record_class};
@@ -586,7 +578,7 @@
 
 sub unlimit {
     my $self = shift;
-    
+
     $self->clean_slate();
     $self->_is_limited(-1);
 }
@@ -675,9 +667,9 @@
 
     # We need to be passed a column and a value, at very least
     die "Must provide a column to limit"
-      unless defined $args{column};
+        unless defined $args{column};
     die "Must provide a value to limit to"
-      unless defined $args{value};
+        unless defined $args{value};
 
     #since we're changing the search criteria, we need to redo the search
     $self->redo_search();
@@ -687,16 +679,13 @@
         #If it's a like, we supply the %s around the search term
         if ( $args{'operator'} =~ /LIKE/i ) {
             $args{'value'} = $args{'value'};
-        }
-        elsif ( $args{'operator'} =~ /MATCHES/i ) {
+        } elsif ( $args{'operator'} =~ /MATCHES/i ) {
             $args{'value'}    = "%" . $args{'value'} . "%";
             $args{'operator'} = "LIKE";
-        }
-        elsif ( $args{'operator'} =~ /STARTSWITH/i ) {
+        } elsif ( $args{'operator'} =~ /STARTSWITH/i ) {
             $args{'value'}    = $args{'value'} . "%";
             $args{'operator'} = "LIKE";
-        }
-        elsif ( $args{'operator'} =~ /ENDSWITH/i ) {
+        } elsif ( $args{'operator'} =~ /ENDSWITH/i ) {
             $args{'value'}    = "%" . $args{'value'};
             $args{'operator'} = "LIKE";
         }
@@ -760,8 +749,7 @@
 
     if ( $args{'subclause'} ) {
         $Clause = $args{'subclause'};
-    }
-    else {
+    } else {
         $Clause = $qualified_column;
     }
 
@@ -776,8 +764,7 @@
     if ( $args{'leftjoin'} ) {
         $restriction = \$self->{'leftjoins'}{ $args{'leftjoin'} }{'criteria'}
             {"$Clause"};
-    }
-    else {
+    } else {
         $restriction = \$self->{'restrictions'}{"$Clause"};
     }
 
@@ -816,8 +803,7 @@
 
         $$restriction = $prefix . $clause;
 
-    }
-    else {
+    } else {
         $$restriction .= $args{'entry_aggregator'} . $prefix . $clause;
     }
 
@@ -827,8 +813,7 @@
 
     if ( defined( $args{'alias'} ) ) {
         return ( $args{'alias'} );
-    }
-    else {
+    } else {
         return (1);
     }
 }
@@ -844,8 +829,7 @@
     my $restriction = \$self->{'restrictions'}{"$clause"};
     if ( !$$restriction ) {
         $$restriction = " ) ";
-    }
-    else {
+    } else {
         $$restriction .= " ) ";
     }
 }
@@ -860,8 +844,8 @@
 }
 
 sub _where_clause {
-    my $self = shift;
-    my  $where_clause = '';
+    my $self         = shift;
+    my $where_clause = '';
 
     # Go through all the generic restrictions and build up the
     # "generic_restrictions" subclause.  That's the only one that the
@@ -871,13 +855,13 @@
 
     #Go through all restriction types. Build the where clause from the
     #Various subclauses.
-    
+
     my @subclauses;
     foreach my $subclause ( sort keys %{ $self->{'subclauses'} } ) {
         push @subclauses, $self->{'subclauses'}{"$subclause"};
     }
 
-    $where_clause = " WHERE " . join ( ' AND ', @subclauses) if ( @subclauses  );
+    $where_clause = " WHERE " . join( ' AND ', @subclauses ) if (@subclauses);
 
     return ($where_clause);
 
@@ -947,9 +931,9 @@
 =cut
 
 sub order_by {
-     my $self = shift;
-     my @args = @_;
- 
+    my $self = shift;
+    my @args = @_;
+
     unless ( UNIVERSAL::isa( $args[0], 'HASH' ) ) {
         @args = {@args};
     }
@@ -957,8 +941,6 @@
     $self->redo_search();
 }
 
-
-
 =head2 _order_clause
 
 returns the ORDER BY clause for the search.
@@ -971,7 +953,7 @@
     return '' unless $self->{'order_by'};
 
     my $clause = '';
-    foreach my $row ( @{$self->{'order_by'}} ) {
+    foreach my $row ( @{ $self->{'order_by'} } ) {
 
         my %rowhash = (
             alias  => 'main',
@@ -981,8 +963,7 @@
         );
         if ( $rowhash{'order'} =~ /^des/i ) {
             $rowhash{'order'} = "DESC";
-        }
-        else {
+        } else {
             $rowhash{'order'} = "ASC";
         }
 
@@ -991,8 +972,7 @@
             $clause .= $rowhash{'function'};
             $clause .= $rowhash{'order'};
 
-        }
-        elsif ( ( $rowhash{'alias'} )
+        } elsif ( ( $rowhash{'alias'} )
             and ( $rowhash{'column'} ) )
         {
 
@@ -1006,7 +986,6 @@
     return $clause;
 }
 
-
 =head2 group_by_cols DEPRECATED
 
 *DEPRECATED*. Use group_by method.
@@ -1050,7 +1029,6 @@
     $self->redo_search();
 }
 
-
 =head2 _group_clause
 
 Private function to return the "GROUP BY" clause for this query.
@@ -1061,13 +1039,12 @@
     my $self = shift;
     return '' unless $self->{'group_by'};
 
-     my $row;
-     my $clause;
- 
-    foreach $row ( @{$self->{'group_by'}} ) {
-         my %rowhash = ( alias => 'main',
-
+    my $row;
+    my $clause;
 
+    foreach $row ( @{ $self->{'group_by'} } ) {
+        my %rowhash = (
+            alias => 'main',
 
             column => undef,
             %$row
@@ -1076,8 +1053,7 @@
             $clause .= ( $clause ? ", " : " " );
             $clause .= $rowhash{'function'};
 
-        }
-        elsif ( ( $rowhash{'alias'} )
+        } elsif ( ( $rowhash{'alias'} )
             and ( $rowhash{'column'} ) )
         {
 
@@ -1086,12 +1062,11 @@
             $clause .= $rowhash{'column'};
         }
     }
-     if ($clause) {
-	return " GROUP BY" . $clause . " ";
-     }
-     else {
-	return '';
-     }
+    if ($clause) {
+        return " GROUP BY" . $clause . " ";
+    } else {
+        return '';
+    }
 }
 
 =head2 new_alias table_OR_CLASS
@@ -1110,8 +1085,7 @@
 
     if ( $refers_to->can('table') ) {
         $table = $refers_to->table;
-    }
-    else {
+    } else {
         $table = $refers_to;
     }
 
@@ -1180,7 +1154,6 @@
 
 }
 
-
 =head2 set_page_info [per_page => NUMBER,] [current_page => NUMBER]
 
 Sets the current page (one-based) and number of items per page on the
@@ -1193,22 +1166,21 @@
 =cut
 
 sub set_page_info {
-  my $self = shift;
-  my %args = (
-    per_page => undef,
-    current_page => undef, # 1-based
-    @_
-  );
-  
-  $self->pager->total_entries($self->count_all)
-              ->entries_per_page($args{'per_page'})
-              ->current_page($args{'current_page'});
-  
-  $self->rows_per_page($args{'per_page'});
-  $self->first_row($self->pager->first);
-  
-}
+    my $self = shift;
+    my %args = (
+        per_page     => undef,
+        current_page => undef,    # 1-based
+        @_
+    );
+
+    $self->pager->total_entries( $self->count_all )
+        ->entries_per_page( $args{'per_page'} )
+        ->current_page( $args{'current_page'} );
 
+    $self->rows_per_page( $args{'per_page'} );
+    $self->first_row( $self->pager->first );
+
+}
 
 =head2 rows_per_page
 
@@ -1354,8 +1326,7 @@
 
     if ( $self->_items_counter == $self->count ) {
         return (1);
-    }
-    else {
+    } else {
         return (0);
     }
 }
@@ -1392,8 +1363,7 @@
         if ( my $alias = $args{alias} ) {
             $alias =~ s/_\d+$//;
             $alias;
-        }
-        else {
+        } else {
             $self->table;
         }
     };
@@ -1412,8 +1382,7 @@
         # If we want to call a simple function on the column
         elsif ( $func !~ /\(/ ) {
             $name = "\U$func\E($name)";
-        }
-        else {
+        } else {
             $name = $func;
         }
 
@@ -1477,7 +1446,7 @@
         @_
     );
 
-    my $table = $args{table}  or die;
+    my $table  = $args{table}  or die;
     my $column = $args{column} or die;
     return grep { $_ eq $column } $self->columns_in_db($table);
 }
@@ -1509,23 +1478,21 @@
     return ( refers_to => $class, %args );
 }
 
-
 =head2 Clone
 
 Returns copy of the current object with all search restrictions.
 
 =cut
 
-sub clone
-{
+sub clone {
     my $self = shift;
 
     my $obj = bless {}, ref($self);
     %$obj = %$self;
 
-    $obj->redo_search(); # clean out the object of data
-    
-    $obj->{$_} = Clone::clone($obj->{$_}) for ( $self->_cloned_attributes );
+    $obj->redo_search();    # clean out the object of data
+
+    $obj->{$_} = Clone::clone( $obj->{$_} ) for ( $self->_cloned_attributes );
     return $obj;
 }
 
@@ -1538,18 +1505,16 @@
 the list.
 
 =cut
- 
-sub _cloned_attributes
-{
+
+sub _cloned_attributes {
     return qw(
         aliases
         left_joins
         subclauses
         restrictions
     );
- }
- 
- 
+}
+
 1;
 __END__
 

Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Collection/Unique.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Collection/Unique.pm	(original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Collection/Unique.pm	Sat Jan 14 12:26:00 2006
@@ -6,7 +6,6 @@
 our @EXPORT  = qw(AddRecord);
 our $VERSION = "0.01";
 
-
 sub add_record {
     my $self   = shift;
     my $record = shift;

Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Column.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Column.pm	(original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Column.pm	Sat Jan 14 12:26:00 2006
@@ -16,7 +16,7 @@
     length
     mandatory
     virtual
-    distinct 
+    distinct
     refers_to by
     alias_for_column
     since until

Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Filter/DateTime.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Filter/DateTime.pm	(original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Filter/DateTime.pm	Sat Jan 14 12:26:00 2006
@@ -61,8 +61,7 @@
     my $dt = $parser->parse_datetime($$value_ref);
     if ($dt) {
         $$value_ref = $dt;
-    }
-    else {
+    } else {
         return;
     }
 }

Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Filter/Truncate.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Filter/Truncate.pm	(original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Filter/Truncate.pm	Sat Jan 14 12:26:00 2006
@@ -17,8 +17,7 @@
     my $truncate_to;
     if ( $column->length && !$column->is_numeric ) {
         $truncate_to = $column->length;
-    }
-    elsif ( $column->type && $column->type =~ /char\((\d+)\)/ ) {
+    } elsif ( $column->type && $column->type =~ /char\((\d+)\)/ ) {
         $truncate_to = $1;
     }
 

Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Filter/utf8.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Filter/utf8.pm	(original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Filter/utf8.pm	Sat Jan 14 12:26:00 2006
@@ -36,8 +36,7 @@
 
     if ( Encode::is_utf8($$value_ref) ) {
         $$value_ref = Encode::encode_utf8($$value_ref);
-    }
-    else {
+    } else {
 
         # if value has no utf8 flag but filter on the stack
         # we do double encoding, and stop on the first bad characters

Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Handle.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Handle.pm	(original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Handle.pm	Sat Jan 14 12:26:00 2006
@@ -285,8 +285,7 @@
     my $self = shift;
     if ( $self->dbh ) {
         return ( $self->dbh->disconnect() );
-    }
-    else {
+    } else {
         return;
     }
 }
@@ -364,8 +363,7 @@
     ## Look and see if the column is being updated via a SQL function.
     if ( $args{'is_sql_function'} ) {
         $query .= $args{'value'} . ' ';
-    }
-    else {
+    } else {
         $query .= '? ';
         push( @bind, $args{'value'} );
     }
@@ -410,7 +408,7 @@
 =cut
 
 sub simple_query {
-    my $self        = shift;
+    my $self         = shift;
     my $query_string = shift;
     my @bind_values;
     @bind_values = (@_) if (@_);
@@ -420,8 +418,7 @@
         if ($DEBUG) {
             die "$self couldn't prepare the query '$query_string'"
                 . $self->dbh->errstr . "\n";
-        }
-        else {
+        } else {
             warn "$self couldn't prepare the query '$query_string'"
                 . $self->dbh->errstr . "\n";
             my $ret = Class::ReturnValue->new();
@@ -469,8 +466,7 @@
             die "$self couldn't execute the query '$query_string'"
                 . $self->dbh->errstr . "\n";
 
-        }
-        else {
+        } else {
             Carp::cluck "$self couldn't execute the query '$query_string'";
 
             my $ret = Class::ReturnValue->new();
@@ -504,8 +500,7 @@
     my $sth         = $self->simple_query( $query, @bind_values );
     if ($sth) {
         return ( $sth->fetchrow );
-    }
-    else {
+    } else {
         return ($sth);
     }
 }
@@ -614,13 +609,13 @@
 
 sub _make_clause_case_insensitive {
     my $self     = shift;
-    my $column    = shift;
+    my $column   = shift;
     my $operator = shift;
     my $value    = shift;
 
     if ( $value !~ /^\d+$/ ) {    # don't downcase integer values
         $column = "lower($column)";
-        $value = lc($value);
+        $value  = lc($value);
     }
     return ( $column, $operator, $value, undef );
 }
@@ -639,8 +634,7 @@
     $TRANSDEPTH++;
     if ( $TRANSDEPTH > 1 ) {
         return ($TRANSDEPTH);
-    }
-    else {
+    } else {
         return ( $self->dbh->begin_work );
     }
 }
@@ -662,8 +656,7 @@
 
     if ( $TRANSDEPTH == 0 ) {
         return ( $self->dbh->commit );
-    }
-    else {    #we're inside a transaction
+    } else {    #we're inside a transaction
         return ($TRANSDEPTH);
     }
 }
@@ -678,30 +671,29 @@
 =cut
 
 sub rollback {
-     my $self = shift;
+    my $self  = shift;
     my $force = shift;
 
-   my $dbh = $self->dbh;
-    unless( $dbh ) {
+    my $dbh = $self->dbh;
+    unless ($dbh) {
         $TRANSDEPTH = 0;
         return;
     }
- 
-    #unless ($TRANSDEPTH) {Carp::confess("Attempted to rollback a transaction with none in progress")};
-     if ($force) {
-         $TRANSDEPTH = 0;
-        return($dbh->rollback);
-     }
- 
-    $TRANSDEPTH-- if ($TRANSDEPTH >= 1);
-     if ($TRANSDEPTH == 0 ) {
-        return($dbh->rollback);
-     } else { #we're inside a transaction
-         return($TRANSDEPTH);
-     }
 
-}
+#unless ($TRANSDEPTH) {Carp::confess("Attempted to rollback a transaction with none in progress")};
+    if ($force) {
+        $TRANSDEPTH = 0;
+        return ( $dbh->rollback );
+    }
+
+    $TRANSDEPTH-- if ( $TRANSDEPTH >= 1 );
+    if ( $TRANSDEPTH == 0 ) {
+        return ( $dbh->rollback );
+    } else {    #we're inside a transaction
+        return ($TRANSDEPTH);
+    }
 
+}
 
 =head2 force_rollback
 
@@ -798,8 +790,7 @@
                 $args{'table2'} = $1;
                 $alias = $2;
 
-            }
-            else {
+            } else {
                 push @new_aliases, $old_alias;
             }
         }
@@ -822,8 +813,7 @@
                     $args{'table2'} = $1;
                     $alias = $2;
 
-                }
-                else {
+                } else {
                     push @new_aliases, $old_alias;
                 }
             }
@@ -846,8 +836,7 @@
 
         $string = " LEFT JOIN " . $args{'table2'} . " $alias ";
 
-    }
-    else {
+    } else {
 
         $string = " JOIN " . $args{'table2'} . " $alias ";
 
@@ -856,14 +845,14 @@
     my $criterion;
     if ( $args{'expression'} ) {
         $criterion = $args{'expression'};
-    }
-    else {
+    } else {
         $criterion = $args{'alias1'} . "." . $args{'column1'};
     }
 
     $args{'collection'}->{'leftjoins'}{"$alias"}{'alias_string'} = $string;
     $args{'collection'}->{'leftjoins'}{"$alias"}{'entry_aggregator'}
-          = $args{'entry_aggregator'} if ( $args{'entry_aggregator'} );
+        = $args{'entry_aggregator'}
+        if ( $args{'entry_aggregator'} );
     $args{'collection'}->{'leftjoins'}{"$alias"}{'depends_on'}
         = $args{'alias1'};
     $args{'collection'}->{'leftjoins'}{"$alias"}{'criteria'}
@@ -900,8 +889,7 @@
             = " $args{'alias1'}.$args{'column1'} $args{'operator'} $alias.$args{'column2'}";
 
         return ($alias);
-    }
-    else {
+    } else {
         $sb->Jifty::DBI::Collection::limit(
             entry_aggregator => 'AND',
             quote_value      => 0,
@@ -939,19 +927,20 @@
         if ( !$sb->{'leftjoins'}{$join}{'depends_on'}
             || $seen_aliases{ $sb->{'leftjoins'}{$join}{'depends_on'} } )
         {
-            $join_clause .= $sb->{'leftjoins'}{$join}{'alias_string'} . " ON ";
-          
-            my @criteria = values %{ $sb->{'leftjoins'}{$join}{'criteria'} } ;
-            my $entry_aggregator =  $sb->{'leftjoins'}{$join}{'entry_aggregator'}  || 'AND';
-            my $criteria = CORE::join( " $entry_aggregator ", map { " ( $_ ) " } @criteria);  
+            $join_clause
+                .= $sb->{'leftjoins'}{$join}{'alias_string'} . " ON ";
 
-            $join_clause .= "( ".$criteria. " ) ";
-            $join_clause = "(" .$join_clause .")";
+            my @criteria = values %{ $sb->{'leftjoins'}{$join}{'criteria'} };
+            my $entry_aggregator
+                = $sb->{'leftjoins'}{$join}{'entry_aggregator'} || 'AND';
+            my $criteria = CORE::join( " $entry_aggregator ",
+                map {" ( $_ ) "} @criteria );
 
+            $join_clause .= "( " . $criteria . " ) ";
+            $join_clause = "(" . $join_clause . ")";
 
             $seen_aliases{$join} = 1;
-        }
-        else {
+        } else {
             push( @keys, $join );
             die "Unsatisfied dependency chain in joins @keys"
                 if $seen{"@keys"}++;
@@ -970,17 +959,16 @@
 =cut
 
 sub distinct_query {
-    my $self = shift;
+    my $self         = shift;
     my $statementref = shift;
-    my $sb = shift;
- 
-     # Prepend select query for DBs which allow DISTINCT on all column types.
-     $$statementref = "SELECT DISTINCT main.* FROM $$statementref";
+    my $sb           = shift;
+
+    # Prepend select query for DBs which allow DISTINCT on all column types.
+    $$statementref = "SELECT DISTINCT main.* FROM $$statementref";
 
     $$statementref .= $sb->_group_clause;
     $$statementref .= $sb->_order_clause;
 }
- 
 
 =head2 distinct_count STATEMENTREF 
 

Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Handle/Informix.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Handle/Informix.pm	(original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Handle/Informix.pm	Sat Jan 14 12:26:00 2006
@@ -108,8 +108,7 @@
         my $status = $self->dbh->disconnect();
         $self->dbh(undef);
         return $status;
-    }
-    else {
+    } else {
         return;
     }
 }
@@ -121,26 +120,28 @@
 
 =cut
 
- sub distinct_query {
-     my $self = shift;
-     my $statementref = shift;
-    my $sb = shift;
-    my $table = $sb->table;
- 
-    if ($sb->_order_clause =~ /(?<!main)\./) {
+sub distinct_query {
+    my $self         = shift;
+    my $statementref = shift;
+    my $sb           = shift;
+    my $table        = $sb->table;
+
+    if ( $sb->_order_clause =~ /(?<!main)\./ ) {
+
         # Don't know how to do ORDER BY when the DISTINCT is in a subquery
-        warn "Query will contain duplicate rows; don't how how to ORDER BY across DISTINCT";
-       $$statementref = "SELECT main.* FROM $$statementref";
+        warn
+            "Query will contain duplicate rows; don't how how to ORDER BY across DISTINCT";
+        $$statementref = "SELECT main.* FROM $$statementref";
     } else {
+
         # Wrapper select query in a subselect as Informix doesn't allow
         # DISTINCT against CLOB/BLOB column types.
-        $$statementref = "SELECT * FROM $table main WHERE id IN ( SELECT DISTINCT main.id FROM $$statementref )";
+        $$statementref
+            = "SELECT * FROM $table main WHERE id IN ( SELECT DISTINCT main.id FROM $$statementref )";
     }
     $$statementref .= $sb->_group_clause;
     $$statementref .= $sb->_order_clause;
- }
- 
- 
+}
 
 1;
 

Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Handle/ODBC.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Handle/ODBC.pm	(original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Handle/ODBC.pm	Sat Jan 14 12:26:00 2006
@@ -79,8 +79,8 @@
     my $statementref = shift;
 
     my $sb = shift;
- 
-     $$statementref = "SELECT main.* FROM $$statementref";
+
+    $$statementref = "SELECT main.* FROM $$statementref";
     $$statementref .= $sb->_group_clause;
     $$statementref .= $sb->_order_clause;
 }

Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Handle/Oracle.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Handle/Oracle.pm	(original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Handle/Oracle.pm	Sat Jan 14 12:26:00 2006
@@ -66,8 +66,7 @@
 
     if ( $attribs{'Id'} || $attribs{'id'} ) {
         $unique_id = ( $attribs{'Id'} ? $attribs{'Id'} : $attribs{'id'} );
-    }
-    else {
+    } else {
 
         $query_string = "SELECT " . $table . "_seq.nextval FROM DUAL";
 
@@ -75,8 +74,7 @@
         if ( !$sth ) {
             if ($main::debug) {
                 die "Error with $query_string";
-            }
-            else {
+            } else {
                 return (undef);
             }
         }
@@ -98,8 +96,7 @@
     unless ($sth) {
         if ($main::debug) {
             die "Error with $query_string: " . $self->dbh->errstr;
-        }
-        else {
+        } else {
             return (undef);
         }
     }
@@ -139,8 +136,7 @@
         && $args{'SID'} )
     {
         $dsn .= "host=$args{'Host'};sid=$args{'SID'}";
-    }
-    else {
+    } else {
         $dsn .= "$args{'Database'}"
             if ( defined $args{'Database'} && $args{'Database'} );
     }
@@ -174,14 +170,14 @@
 =cut
 
 sub blob_params {
-    my $self  = shift;
+    my $self   = shift;
     my $column = shift;
 
     #my $type = shift;
     # Don't assign to key 'value' as it is defined later.
     return (
         {   ora_column => $column,
-            ora_type  => ORA_CLOB,
+            ora_type   => ORA_CLOB,
         }
     );
 }
@@ -243,30 +239,38 @@
 
 =cut
 
- 
- sub distinct_query {
-     my $self = shift;
+sub distinct_query {
+    my $self         = shift;
     my $statementref = shift;
-    my $sb = shift;
-    my $table = $sb->Table;
+    my $sb           = shift;
+    my $table        = $sb->Table;
 
     # Wrapp select query in a subselect as Oracle doesn't allow
-     # DISTINCT against CLOB/BLOB column types.
-    if ($sb->_order_clause =~ /(?<!main)\./) {
+    # DISTINCT against CLOB/BLOB column types.
+    if ( $sb->_order_clause =~ /(?<!main)\./ ) {
+
         # If we are ordering by something not in 'main', we need to GROUP
         # BY and adjust the ORDER_BY accordingly
-        local $sb->{group_by} = [@{$sb->{group_by} || []}, {column => 'id'}];
-        local $sb->{order_by} = [map {($_->{alias} and $_->{alias} ne "main") ? {%{$_}, column => "min(".$_->{column}.")"}: $_} @{$sb->{order_by}}];
+        local $sb->{group_by}
+            = [ @{ $sb->{group_by} || [] }, { column => 'id' } ];
+        local $sb->{order_by} = [
+            map {
+                ( $_->{alias} and $_->{alias} ne "main" )
+                    ? { %{$_}, column => "min(" . $_->{column} . ")" }
+                    : $_
+                } @{ $sb->{order_by} }
+        ];
         my $group = $sb->_group_clause;
         my $order = $sb->_order_clause;
-        $$statementref = "SELECT main.* FROM ( SELECT main.id FROM $$statementref $group $order ) distinctquery, $table main WHERE (main.id = distinctquery.id)";
+        $$statementref
+            = "SELECT main.* FROM ( SELECT main.id FROM $$statementref $group $order ) distinctquery, $table main WHERE (main.id = distinctquery.id)";
     } else {
-        $$statementref = "SELECT main.* FROM ( SELECT DISTINCT main.id FROM $$statementref ) distinctquery, $table main WHERE (main.id = distinctquery.id) ";
+        $$statementref
+            = "SELECT main.* FROM ( SELECT DISTINCT main.id FROM $$statementref ) distinctquery, $table main WHERE (main.id = distinctquery.id) ";
         $$statementref .= $sb->_group_clause;
         $$statementref .= $sb->_order_clause;
     }
- }
- 
+}
 
 =head2 binary_safe_blobs
 

Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Handle/Pg.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Handle/Pg.pm	(original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Handle/Pg.pm	Sat Jan 14 12:26:00 2006
@@ -51,11 +51,11 @@
 
 sub insert {
     my $self  = shift;
-     my $table = shift;
+    my $table = shift;
     my %args  = (@_);
     my $sth   = $self->SUPER::insert( $table, %args );
 
-     unless ($sth) {
+    unless ($sth) {
         return ($sth);
     }
 
@@ -71,10 +71,9 @@
     $seqsth->execute;
     $self->{'id'} = $seqsth->fetchrow_array();
 
-   return ( $self->{'id'} );
+    return ( $self->{'id'} );
 }
 
-
 =head2 id_sequence_name TABLE
 
 Takes a TABLE name and returns the name of the  sequence of the primary key for that table.
@@ -85,7 +84,9 @@
     my $self  = shift;
     my $table = shift;
 
-    return $self->{'_sequences'}{$table} if (exists $self->{'_sequences'}{$table});
+    return $self->{'_sequences'}{$table}
+        if ( exists $self->{'_sequences'}{$table} );
+
     #Lets get the id of that row we just inserted
     my $seq;
     my $colinfosth = $self->dbh->column_info( undef, undef, lc($table), '%' );
@@ -100,17 +101,16 @@
         }
 
     }
-            my $ret = Class::ReturnValue->new();
-           $ret->as_error(
-                errno   => '-1',
-                message => "Found no sequence for $table",
-                do_backtrace => undef
-            );
-           return ( $ret->return_value );
- 
- }
- 
- 
+    my $ret = Class::ReturnValue->new();
+    $ret->as_error(
+        errno        => '-1',
+        message      => "Found no sequence for $table",
+        do_backtrace => undef
+    );
+    return ( $ret->return_value );
+
+}
+
 =head2 binary_safe_blobs
 
 Return undef, as no current version of postgres supports binary-safe
@@ -161,7 +161,7 @@
 
 sub _make_clause_case_insensitive {
     my $self     = shift;
-    my $column    = shift;
+    my $column   = shift;
     my $operator = shift;
     my $value    = shift;
 
@@ -173,11 +173,9 @@
     if ( $operator =~ /LIKE/i ) {
         $operator =~ s/LIKE/ILIKE/ig;
         return ( $column, $operator, $value );
-    }
-    elsif ( $operator =~ /=/ ) {
+    } elsif ( $operator =~ /=/ ) {
         return ( "LOWER($column)", $operator, $value, "LOWER(?)" );
-    }
-    else {
+    } else {
         $self->SUPER::_make_clause_case_insensitive( $column, $operator,
             $value );
     }
@@ -190,22 +188,31 @@
 =cut
 
 sub distinct_query {
-    my $self = shift;
+    my $self         = shift;
     my $statementref = shift;
-    my $sb = shift;
-    my $table = $sb->table;
+    my $sb           = shift;
+    my $table        = $sb->table;
+
+    if ( $sb->_order_clause =~ /(?<!main)\./ ) {
 
-    if ($sb->_order_clause =~ /(?<!main)\./) {
         # If we are ordering by something not in 'main', we need to GROUP
         # BY and adjust the ORDER_BY accordingly
-        local $sb->{group_by} = [@{$sb->{group_by} || []}, {column => 'id'}];
-        local $sb->{order_by} = [map {($_->{alias} and $_->{alias} ne "main") ? {%{$_}, column => "min(".$_->{column}.")"}: $_} @{$sb->{order_by}}];
+        local $sb->{group_by}
+            = [ @{ $sb->{group_by} || [] }, { column => 'id' } ];
+        local $sb->{order_by} = [
+            map {
+                ( $_->{alias} and $_->{alias} ne "main" )
+                    ? { %{$_}, column => "min(" . $_->{column} . ")" }
+                    : $_
+                } @{ $sb->{order_by} }
+        ];
         my $group = $sb->_group_clause;
         my $order = $sb->_order_clause;
-        $$statementref = "SELECT main.* FROM ( SELECT main.id FROM $$statementref $group $order ) distinctquery, $table main WHERE (main.id = distinctquery.id)";
+        $$statementref
+            = "SELECT main.* FROM ( SELECT main.id FROM $$statementref $group $order ) distinctquery, $table main WHERE (main.id = distinctquery.id)";
     } else {
         $$statementref = "SELECT DISTINCT main.* FROM $$statementref";
-       $$statementref .= $sb->_group_clause;
+        $$statementref .= $sb->_group_clause;
         $$statementref .= $sb->_order_clause;
     }
 }

Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Handle/SQLite.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Handle/SQLite.pm	(original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Handle/SQLite.pm	Sat Jan 14 12:26:00 2006
@@ -137,8 +137,7 @@
             $join_clause .= ") ";
 
             $seen_aliases{$join} = 1;
-        }
-        else {
+        } else {
             push( @keys, $join );
             die "Unsatisfied dependency chain in Joins @keys"
                 if $seen{"@keys"}++;

Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Handle/Sybase.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Handle/Sybase.pm	(original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Handle/Sybase.pm	Sat Jan 14 12:26:00 2006
@@ -93,24 +93,27 @@
 =cut
 
 sub distinct_query {
-     my $self = shift;
-     my $statementref = shift;
-    my $sb = shift;
-    my $table = $sb->table;
+    my $self         = shift;
+    my $statementref = shift;
+    my $sb           = shift;
+    my $table        = $sb->table;
+
+    if ( $sb->_order_clause =~ /(?<!main)\./ ) {
 
-    if ($sb->_order_clause =~ /(?<!main)\./) {
         # Don't know how to do ORDER BY when the DISTINCT is in a subquery
-        warn "Query will contain duplicate rows; don't how how to ORDER BY across DISTINCT";
+        warn
+            "Query will contain duplicate rows; don't how how to ORDER BY across DISTINCT";
         $$statementref = "SELECT main.* FROM $$statementref";
     } else {
-       # Wrapper select query in a subselect as Sybase doesn't allow
+
+        # Wrapper select query in a subselect as Sybase 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) ";
+        $$statementref
+            = "SELECT main.* FROM ( SELECT DISTINCT main.id FROM $$statementref ) distinctquery, $table main WHERE (main.id = distinctquery.id) ";
     }
     $$statementref .= $sb->_group_clause;
     $$statementref .= $sb->_order_clause;
 }
- 
 
 =head2 binary_safe_blobs
 

Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Record.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Record.pm	(original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Record.pm	Sat Jan 14 12:26:00 2006
@@ -16,7 +16,6 @@
 
 our $VERSION = '0.01';
 
-
 Jifty::DBI::Record->mk_classdata('COLUMNS');
 
 =head1 NAME
@@ -120,18 +119,15 @@
                 $_[0]->_to_record( $column_name,
                     $_[0]->__value($column_name) );
             };
-        }
-        elsif (
+        } elsif (
             UNIVERSAL::isa( $column->refers_to, "Jifty::DBI::Collection" ) )
         {
             *{$AUTOLOAD} = sub { $_[0]->_collection_value($column_name) };
-        }
-        else {
+        } else {
             *{$AUTOLOAD} = sub { return ( $_[0]->_value($column_name) ) };
         }
         goto &$AUTOLOAD;
-    }
-    elsif ( $action eq 'write' ) {
+    } elsif ( $action eq 'write' ) {
         return ( 0, 'Immutable column' ) unless $column->writable;
 
         if ( UNIVERSAL::isa( $column->refers_to, "Jifty::DBI::Record" ) ) {
@@ -144,16 +140,14 @@
                 return (
                     $self->_set( column => $column_name, value => $val ) );
             };
-        }
-        else {
+        } else {
             *{$AUTOLOAD} = sub {
                 return (
                     $_[0]->_set( column => $column_name, value => $_[1] ) );
             };
         }
         goto &$AUTOLOAD;
-    }
-    elsif ( $action eq 'validate' ) {
+    } elsif ( $action eq 'validate' ) {
         *{$AUTOLOAD}
             = sub { return ( $_[0]->_validate( $column_name, $_[1] ) ) };
         goto &$AUTOLOAD;
@@ -184,13 +178,11 @@
     if ( $method =~ /^.*::set_(\w+)$/o ) {
         $column_name = $1;
         $action      = 'write';
-    }
-    elsif ( $method =~ /^.*::validate_(\w+)$/o ) {
+    } elsif ( $method =~ /^.*::validate_(\w+)$/o ) {
         $column_name = $1;
         $action      = 'validate';
 
-    }
-    elsif ( $method =~ /^.*::(\w+)$/o ) {
+    } elsif ( $method =~ /^.*::(\w+)$/o ) {
         $column_name = $1;
         $action      = 'read';
 
@@ -282,8 +274,8 @@
     my $column_name = shift;
     my $value       = shift;
 
-    my $column    = $self->column($column_name);
-    my $classname = $column->refers_to();
+    my $column        = $self->column($column_name);
+    my $classname     = $column->refers_to();
     my $remote_column = $column->by() || 'id';
 
     return       unless defined $value;
@@ -293,7 +285,7 @@
     # XXX TODO FIXME we need to figure out the right way to call new here
     # perhaps the handle should have an initiializer for records/collections
     my $object = $classname->new( $self->_handle );
-    $object->load_by_cols($remote_column => $value );
+    $object->load_by_cols( $remote_column => $value );
     return $object;
 }
 
@@ -310,7 +302,7 @@
     return unless UNIVERSAL::isa( $classname, 'Jifty::DBI::Collection' );
 
     my $coll = $classname->new( handle => $self->_handle );
-    $coll->limit( column =>  $column->by(), value => $self->id );
+    $coll->limit( column => $column->by(), value => $self->id );
     return $coll;
 }
 
@@ -342,9 +334,13 @@
 
 sub columns {
     my $self = shift;
-    return ( sort { 
-         ((($b->type||'') eq 'serial') <=> (($a->type||'') eq 'serial')) or 
-            ( $a->name cmp $b->name) } values %{ $self->COLUMNS } );
+    return (
+        sort {
+            ( ( ( $b->type || '' ) eq 'serial' )
+                <=> ( ( $a->type || '' ) eq 'serial' ) )
+                or ( $a->name cmp $b->name )
+            } values %{ $self->COLUMNS }
+    );
 }
 
 # sub {{{ readable_attributes
@@ -372,7 +368,6 @@
     return sort map { $_->name } grep { $_->writable } $self->columns;
 }
 
-
 =head2 record values
 
 As you've probably already noticed, C<Jifty::DBI::Record> autocreates methods for your
@@ -452,7 +447,6 @@
     return $value;
 }
 
-
 =head2 __value
 
 Takes a column name and returns that column's value. Subclasses should
@@ -478,7 +472,7 @@
     #Carp::confess unless ($column);
 
     if ( !$self->{'fetched'}{ $column->name } and my $id = $self->id() ) {
-        my $pkey        = $self->_primary_key();
+        my $pkey         = $self->_primary_key();
         my $query_string = "SELECT "
             . $column->name
             . " FROM "
@@ -580,8 +574,8 @@
     }
 
     my $method = "validate_" . $column->name;
-    my ($ok, $msg) = $self->$method( $args{'value'} );
-    unless ( $ok ) {
+    my ( $ok, $msg ) = $self->$method( $args{'value'} );
+    unless ($ok) {
         $ret->as_array( 0, 'Illegal value for ' . $column->name );
         $ret->as_error(
             errno        => 3,
@@ -631,8 +625,7 @@
 
         # XXX TODO primary_keys
         $self->load_by_cols( id => $self->id );
-    }
-    else {
+    } else {
         $self->{'values'}->{ $column->name } = $unmunged_value;
         $self->{'decoded'}{ $column->name } = 0;
     }
@@ -651,9 +644,9 @@
 =cut
 
 sub _validate {
-    my $self  = shift;
+    my $self   = shift;
     my $column = shift;
-    my $value = shift;
+    my $value  = shift;
 
  #Check type of input
  #If it's null, are nulls permitted?
@@ -706,23 +699,20 @@
                 $op       = $hash{$key}->{operator};
                 $value    = $hash{$key}->{value};
                 $function = $hash{$key}->{function} || "?";
-            }
-            else {
+            } else {
                 $op    = '=';
                 $value = $hash{$key};
             }
 
             push @phrases, "$key $op $function";
             push @bind,    $value;
-        }
-        else {
+        } else {
             push @phrases, "($key IS NULL OR $key = ?)";
             my $column = $self->column($key);
 
             if ( $column->is_numeric ) {
                 push @bind, 0;
-            }
-            else {
+            } else {
                 push @bind, '';
             }
 
@@ -780,9 +770,9 @@
 =cut
 
 sub _load_from_sql {
-    my $self        = shift;
+    my $self         = shift;
     my $query_string = shift;
-    my @bind_values = (@_);
+    my @bind_values  = (@_);
 
     my $sth = $self->_handle->simple_query( $query_string, @bind_values );
 
@@ -843,9 +833,9 @@
     my $self    = shift;
     my %attribs = @_;
 
-    if ($self->can('before_create')) {
-    my $before_ret = $self->before_create( \%attribs ) ;
-    return ($before_ret) unless ($before_ret);
+    if ( $self->can('before_create') ) {
+        my $before_ret = $self->before_create( \%attribs );
+        return ($before_ret) unless ($before_ret);
     }
 
     foreach my $column_name ( keys %attribs ) {
@@ -882,7 +872,7 @@
         }
     }
     my $ret = $self->_handle->insert( $self->table, %attribs );
-    $self->after_create(\$ret) if $self->can('after_create');
+    $self->after_create( \$ret ) if $self->can('after_create');
     return ($ret);
 }
 
@@ -910,9 +900,9 @@
 
 sub delete {
     my $self = shift;
-    if ($self->can('before_delete')) {
-     my $before_ret = $self->before_delete();
-     return $before_ret unless ($before_ret);
+    if ( $self->can('before_delete') ) {
+        my $before_ret = $self->before_delete();
+        return $before_ret unless ($before_ret);
     }
     my $ret = $self->__delete;
     $self->after_delete( \$ret ) if $self->can('after_delete');
@@ -937,12 +927,11 @@
 
     $where =~ s/AND\s$//;
     my $query_string = "DELETE FROM " . $self->table . ' ' . $where;
-    my $return      = $self->_handle->simple_query( $query_string, @bind );
+    my $return       = $self->_handle->simple_query( $query_string, @bind );
 
     if ( UNIVERSAL::isa( 'Class::ReturnValue', $return ) ) {
         return ($return);
-    }
-    else {
+    } else {
         return (1);
     }
 }

Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Record/Cachable.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Record/Cachable.pm	(original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Record/Cachable.pm	Sat Jan 14 12:26:00 2006
@@ -196,7 +196,7 @@
 }
 
 sub __Value {
-    my $self  = shift;
+    my $self   = shift;
     my $column = shift;
     return ( $self->SUPER::__value($column) );
 }
@@ -241,8 +241,7 @@
 
         if ( ref($value) eq "HASH" ) {
             $value = ( $value->{operator} || '=' ) . $value->{value};
-        }
-        else {
+        } else {
             $value = "=" . $value;
         }
         $cache_key .= $key . $value . ',';
@@ -308,8 +307,7 @@
     # If the alternate key is really the primary one
     elsif ( $self->_record_cache->fetch($alternate_key) ) {
         return ($alternate_key);
-    }
-    else {    # empty!
+    } else {    # empty!
         return (undef);
     }
 

Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Schema.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Schema.pm	(original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Schema.pm	Sat Jan 14 12:26:00 2006
@@ -21,7 +21,7 @@
         name     => $name,
         readable => 1,
         writable => 1,
-        virtual => 0,
+        virtual  => 0,
         @_,
     );
     my @original = @args;
@@ -34,7 +34,7 @@
 
     if ( my $refclass = $column->refers_to ) {
         $refclass->require();
-        $column->type('integer') unless ($column->type);
+        $column->type('integer') unless ( $column->type );
 
         if ( UNIVERSAL::isa( $refclass, 'Jifty::DBI::Record' ) ) {
             if ( $name =~ /(.*)_id$/ ) {
@@ -47,14 +47,10 @@
                 $virtual_column->alias_for_column($name);
             }
             $column->by('id') unless $column->by;
-        }
-        elsif (
-                UNIVERSAL::isa( $refclass, 'Jifty::DBI::Collection' ) 
-            ) {
+        } elsif ( UNIVERSAL::isa( $refclass, 'Jifty::DBI::Collection' ) ) {
             $column->by('id') unless $column->by;
             $column->virtual('1');
-        }
-        else {
+        } else {
             warn "Error: $refclass neither Record nor Collection";
         }
     }
@@ -129,7 +125,7 @@
 
 sub is ($) {
     my $thing = shift;
-    ref $thing eq "ARRAY" ? _list(@{$thing}) : _item($thing);
+    ref $thing eq "ARRAY" ? _list( @{$thing} ) : _item($thing);
 }
 
 sub by ($) {
@@ -137,7 +133,7 @@
 }
 
 sub are (@) {
-    _item([@_]);
+    _item( [@_] );
 }
 
 sub on ($) {
@@ -145,13 +141,19 @@
 }
 
 sub _list {
-    defined wantarray or die "Cannot add traits in void context -- check for misspelled preceding comma as a semicolon";
-    wantarray or die "Cannot call list traits in scalar context -- check for unneccessary 'is'";
+    defined wantarray
+        or die
+        "Cannot add traits in void context -- check for misspelled preceding comma as a semicolon";
+    wantarray
+        or die
+        "Cannot call list traits in scalar context -- check for unneccessary 'is'";
     @_;
 }
 
 sub _item {
-    defined wantarray or die "Cannot add traits in void context -- check for misspelled preceding comma as a semicolon";
+    defined wantarray
+        or die
+        "Cannot add traits in void context -- check for misspelled preceding comma as a semicolon";
     $_[0];
 }
 

Modified: Jifty-DBI/trunk/lib/Jifty/DBI/SchemaGenerator.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/SchemaGenerator.pm	(original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/SchemaGenerator.pm	Sat Jan 14 12:26:00 2006
@@ -9,7 +9,6 @@
 
 our $VERSION = '0.01';
 
-
 # Public accessors
 __PACKAGE__->mk_accessors(qw(handle));
 
@@ -190,7 +189,7 @@
 
     my @cols;
 
-    for my $column (  @columns ) {
+    for my $column (@columns) {
 
         # Skip "Virtual" columns - (foreign keys to collections)
         next if $column->virtual;
@@ -198,11 +197,11 @@
 
         push @cols,
             DBIx::DBSchema::Column->new(
-            {   name    => $column->name,
-                type    => $column->type,
-                null    => $column->mandatory ? 0 : 1,
-                distinct    => $column->distinct,
-                default => $column->default,
+            {   name     => $column->name,
+                type     => $column->type,
+                null     => $column->mandatory ? 0 : 1,
+                distinct => $column->distinct,
+                default  => $column->default,
             }
             );
     }


More information about the Jifty-commit mailing list