... | ... |
@@ -1,3 +1,5 @@ |
1 |
+0,1671 |
|
2 |
+ - added environment variable DBIX_CUSTOM_DEBUG |
|
1 | 3 |
0.1670 |
2 | 4 |
- removed EXPERIMETNAL select() column hash option. it's a little complex. |
3 | 5 |
- added EXPERIMENTAL select() param option. |
... | ... |
@@ -19,6 +19,8 @@ use DBIx::Custom::Tag; |
19 | 19 |
use DBIx::Custom::Util; |
20 | 20 |
use Encode qw/encode_utf8 decode_utf8/; |
21 | 21 |
|
22 |
+use constant DEBUG => $ENV{DBIX_CUSTOM_DEBUG} || 0; |
|
23 |
+ |
|
22 | 24 |
our @COMMON_ARGS = qw/table query filter type/; |
23 | 25 |
|
24 | 26 |
__PACKAGE__->attr( |
... | ... |
@@ -495,6 +497,9 @@ sub execute { |
495 | 497 |
}; |
496 | 498 |
$self->_croak($@, qq{. Following SQL is executed. "$query->{sql}"}) if $@; |
497 | 499 |
|
500 |
+ # Output SQL for debug |
|
501 |
+ warn $query->sql . "\n" if DEBUG; |
|
502 |
+ |
|
498 | 503 |
# Select statement |
499 | 504 |
if ($sth->{NUM_OF_FIELDS}) { |
500 | 505 |
|
... | ... |
@@ -2756,6 +2761,13 @@ Updata parameter tag. |
2756 | 2761 |
|
2757 | 2762 |
{update_param NAME1 NAME2} -> set NAME1 = ?, NAME2 = ? |
2758 | 2763 |
|
2764 |
+=head1 ENVIRONMENT VARIABLE |
|
2765 |
+ |
|
2766 |
+=head2 C<DBIX_CUSTOM_DEBUG> |
|
2767 |
+ |
|
2768 |
+If environment variable C<DBIX_CUSTOM_DEBUG> is set to true, |
|
2769 |
+executed SQL is printed to STDERR. |
|
2770 |
+ |
|
2759 | 2771 |
=head1 STABILITY |
2760 | 2772 |
|
2761 | 2773 |
L<DBIx::Custom> is stable. APIs keep backword compatible |