Merge 'trunk' into 'oracle-tweaks'
Peter Rabbitson [Fri, 8 May 2009 17:19:25 +0000 (17:19 +0000)]
r6114@Thesaurus (orig r6113):  ribasushi | 2009-05-03 10:23:28 +0200
Bump SQLA ependencies so parenthesis_significant is guaranteed to be there
r6127@Thesaurus (orig r6126):  arcanez | 2009-05-05 09:27:56 +0200
 r6037@mullet (orig r6036):  arcanez | 2009-04-30 01:24:41 -0700
 branch to work on Sybase/MSSQL subtleties
 r6038@mullet (orig r6037):  arcanez | 2009-04-30 01:27:11 -0700
 jump to ::DBI::Sybase::MSSQL if we are using MSSQL through Sybase
 r6062@mullet (orig r6061):  arcanez | 2009-04-30 14:05:24 -0700
 fixes for MSSQL via Sybase
 r6126@mullet (orig r6125):  arcanez | 2009-05-05 00:27:13 -0700
 add a line to Changes and add a CAVEAT

r6164@Thesaurus (orig r6163):  ribasushi | 2009-05-07 19:09:01 +0200
 r6115@Thesaurus (orig r6114):  plu | 2009-05-03 10:39:16 +0200
 new branch to fix $rs->update and $rs->delete using the new as_query method

 r6116@Thesaurus (orig r6115):  plu | 2009-05-03 10:52:07 +0200
 Methods update/delete on resultset use now new as_query method to updated/delete properly on joined/prefetched resultset using a subquery. Therefore some tests have been added and some have been changed as well as the warnings around $rs->update/delete have been removed. Cheers!
 r6117@Thesaurus (orig r6116):  plu | 2009-05-03 11:13:48 +0200
 Using "is" instead of "cmp_ok"
 r6160@Thesaurus (orig r6159):  ribasushi | 2009-05-07 11:58:14 +0200
 Back out skip_parens support in as_query
 r6161@Thesaurus (orig r6160):  ribasushi | 2009-05-07 19:00:48 +0200
 This test is completely borked, needs a rewrite
 r6162@Thesaurus (orig r6161):  ribasushi | 2009-05-07 19:07:19 +0200
 Temporary fix or the IN ( ( ... ) ) problem until we get proper SQLA AST (needs SQLA released with commit 6158 to work)

r6165@Thesaurus (orig r6164):  ribasushi | 2009-05-07 19:11:46 +0200
Changes, remove merged branch
r6169@Thesaurus (orig r6168):  ribasushi | 2009-05-07 19:24:54 +0200
Bump SQLA dependency so -in/-between workarounds overload properly
r6172@Thesaurus (orig r6171):  ribasushi | 2009-05-07 20:49:26 +0200
Cookbook cleanup
r6174@Thesaurus (orig r6173):  ribasushi | 2009-05-08 10:13:30 +0200
Throw away some debugging code
r6175@Thesaurus (orig r6174):  ribasushi | 2009-05-08 10:21:53 +0200
Documentation patch by nniuq
r6176@Thesaurus (orig r6175):  plu | 2009-05-08 10:30:20 +0200
Set NLS_LANG so we  have a predictable date format when using MON
r6177@Thesaurus (orig r6176):  ribasushi | 2009-05-08 12:15:15 +0200
Fix POD
r6179@Thesaurus (orig r6178):  jgoulah | 2009-05-08 16:27:49 +0200
renaming rh performance test so it will show up at the end of test output

1  2 
t/73oracle_inflate.t

diff --combined t/73oracle_inflate.t
@@@ -17,13 -17,13 +17,14 @@@ else 
          plan skip_all => 'needs DateTime and DateTime::Format::Oracle for testing';
      }
      else {
 -        plan tests => 4;
 +        plan tests => 7;
      }
  }
  
  # DateTime::Format::Oracle needs this set
  $ENV{NLS_DATE_FORMAT} = 'DD-MON-YY';
 +$ENV{NLS_TIMESTAMP_FORMAT} = 'YYYY-MM-DD HH24:MI:SSXFF';
+ $ENV{NLS_LANG} = 'AMERICAN_AMERICA.WE8ISO8859P1';
  
  my $schema = DBICTest::Schema->connect($dsn, $user, $pass);
  
  my $col_metadata = $schema->class('Track')->column_info('last_updated_on');
  $schema->class('Track')->add_column( 'last_updated_on' => {
      data_type => 'date' });
 +$schema->class('Track')->add_column( 'last_updated_at' => {
 +    data_type => 'timestamp' });
  
  my $dbh = $schema->storage->dbh;
  
 +#$dbh->do("alter session set nls_timestamp_format = 'YYYY-MM-DD HH24:MI:SSXFF'");
 +
  eval {
    $dbh->do("DROP TABLE track");
  };
 -$dbh->do("CREATE TABLE track (trackid NUMBER(12), cd NUMBER(12), position NUMBER(12), title VARCHAR(255), last_updated_on DATE)");
 +$dbh->do("CREATE TABLE track (trackid NUMBER(12), cd NUMBER(12), position NUMBER(12), title VARCHAR(255), last_updated_on DATE, last_updated_at TIMESTAMP)");
  
  # insert a row to play with
 -my $new = $schema->resultset('Track')->create({ trackid => 1, cd => 1, position => 1, title => 'Track1', last_updated_on => '06-MAY-07' });
 +my $new = $schema->resultset('Track')->create({ trackid => 1, cd => 1, position => 1, title => 'Track1', last_updated_on => '06-MAY-07', last_updated_at => '2009-05-03 21:17:18.5' });
  is($new->trackid, 1, "insert sucessful");
  
  my $track = $schema->resultset('Track')->find( 1 );
@@@ -53,18 -49,11 +54,18 @@@ is( ref($track->last_updated_on), 'Date
  
  is( $track->last_updated_on->month, 5, "DateTime methods work on inflated column");
  
 +#note '$track->last_updated_at => ', $track->last_updated_at;
 +is( ref($track->last_updated_at), 'DateTime', "last_updated_at inflated ok");
 +
 +is( $track->last_updated_at->nanosecond, 500_000_000, "DateTime methods work with nanosecond precision");
 +
  my $dt = DateTime->now();
  $track->last_updated_on($dt);
 +$track->last_updated_at($dt);
  $track->update;
  
  is( $track->last_updated_on->month, $dt->month, "deflate ok");
 +is( int $track->last_updated_at->nanosecond, int $dt->nanosecond, "deflate ok with nanosecond precision");
  
  # clean up our mess
  END {