Subject: | [PATCH] Improved TRACE output for '0'/NULL values |
Date: | Tue, 24 Oct 2006 09:54:21 +0200 (CEST) |
To: | bug-Tangram [...] rt.cpan.org |
From: | Mark Lawrence <nomad [...] null.net> |
The included patch (against 2.10) turns the following TRACE fragment:
/* (5, 8, 1161675737, 1161675737, NULL, 6, 0005, NULL, NULL, en) */
into this:
/* (5, 8, 1161675737, 1161675737, 0, 6, 0005, NULL, NULL, en) */
Ie it correctly displays the values that are '0' instead of showing them
as 'NULL'.
--- lib/Tangram/Storage.pm 2006-03-29 07:05:28.000000000 +0200
+++ /tmp/Tangram-2.10/lib/Tangram/Storage.pm 2006-10-24
09:47:07.000000000 +0200
@@ -674,7 +674,7 @@
my @sql = $engine->get_insert_statements($class);
printf $Tangram::TRACE ">-\n%s\n".(@{$fields[$i]}?"-- with:\n /* (%s) */\n":"%s")."...\n",
$sql[$i],
- join(', ', map { $_ || 'NULL' } @state[ @{ $fields[$i] } ] )
+ join(', ', map { defined($_) ? $_ : 'NULL' } @state[ @{ $fields[$i] } ] )
}
my $sth = $sths->[$i];
@@ -752,7 +752,7 @@
my @sql = $engine->get_update_statements($class);
printf $Tangram::TRACE ">-\n%s\n-- with\n /* (%s) */\n...\n", $sql[$i],
- join(', ', map { $_ || 'NULL' } @state[ @{ $fields[$i] } ] )
+ join(', ', map { defined($_) ? $_ : 'NULL' } @state[ @{ $fields[$i] } ] )
}
my $sth = $sths->[$i];
--
Mark Lawrence
http://nomad.rekudos.net/