[Bast-commits] r7095 - in DBIx-Class/0.08/branches/mssql_money_type:
lib/DBIx/Class/Storage/DBI/ODBC t
caelum at dev.catalyst.perl.org
caelum at dev.catalyst.perl.org
Thu Jul 23 15:01:37 GMT 2009
Author: caelum
Date: 2009-07-23 15:01:37 +0000 (Thu, 23 Jul 2009)
New Revision: 7095
Modified:
DBIx-Class/0.08/branches/mssql_money_type/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm
DBIx-Class/0.08/branches/mssql_money_type/t/746mssql.t
Log:
add test for updating money value to NULL
Modified: DBIx-Class/0.08/branches/mssql_money_type/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm
===================================================================
--- DBIx-Class/0.08/branches/mssql_money_type/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm 2009-07-23 14:34:06 UTC (rev 7094)
+++ DBIx-Class/0.08/branches/mssql_money_type/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm 2009-07-23 15:01:37 UTC (rev 7095)
@@ -44,9 +44,8 @@
my $col_info = $self->_resolve_column_info($ident, [keys %$fields]);
for my $col (keys %$fields) {
- if ($col_info->{$col}{data_type} eq 'money') {
+ if ($col_info->{$col}{data_type} =~ /^money\z/i) {
my $val = $fields->{$col};
-
$fields->{$col} = \['CAST(? AS MONEY)', [ $col => $val ]];
}
}
Modified: DBIx-Class/0.08/branches/mssql_money_type/t/746mssql.t
===================================================================
--- DBIx-Class/0.08/branches/mssql_money_type/t/746mssql.t 2009-07-23 14:34:06 UTC (rev 7094)
+++ DBIx-Class/0.08/branches/mssql_money_type/t/746mssql.t 2009-07-23 15:01:37 UTC (rev 7095)
@@ -12,7 +12,7 @@
plan skip_all => 'Set $ENV{DBICTEST_MSSQL_ODBC_DSN}, _USER and _PASS to run this test'
unless ($dsn && $user);
-plan tests => 31;
+plan tests => 33;
my $schema = DBICTest::Schema->connect($dsn, $user, $pass);
@@ -105,6 +105,12 @@
is $rs->find($row->id)->amount, '200.00', 'updated money value round-trip';
+lives_ok {
+ $row->update({ amount => undef });
+} 'updated a money value to NULL';
+
+is $rs->find($row->id)->amount, undef,'updated money value to NULL round-trip';
+
$schema->storage->dbh_do (sub {
my ($storage, $dbh) = @_;
eval { $dbh->do("DROP TABLE Owners") };
More information about the Bast-commits
mailing list