[MKDoc-commit] Fixed SQL to work when no surveys have been filled
out for a period.
sam at mkdoc.demon.co.uk
sam at mkdoc.demon.co.uk
Mon Mar 20 16:35:15 GMT 2006
Log Message:
-----------
Fixed SQL to work when no surveys have been filled out for a period.
Tags:
----
mkdoc-1-6
Modified Files:
--------------
mkd/tools:
ufi_survey_mailer.pl
-------------- next part --------------
Index: ufi_survey_mailer.pl
===================================================================
RCS file: /var/spool/cvs/mkd/tools/Attic/ufi_survey_mailer.pl,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -Ltools/ufi_survey_mailer.pl -Ltools/ufi_survey_mailer.pl -u -r1.1.2.4 -r1.1.2.5
--- tools/ufi_survey_mailer.pl
+++ tools/ufi_survey_mailer.pl
@@ -145,9 +145,11 @@
# find editors of missing ones
my $results = $dbh->selectall_arrayref(
'SELECT Centre_ID, Centre_Name
- FROM Centre_Details
- WHERE Centre_ID NOT IN (' . join(',', ('?') x @$exists) . ')
- ORDER BY Centre_Name',
+ FROM Centre_Details ' .
+ (@$exists ?
+ (' WHERE Centre_ID NOT IN (' . join(',', ('?') x @$exists) . ')') :
+ '') .
+ ' ORDER BY Centre_Name',
undef, @$exists);
my @missing = map { { id => $_->[0], name => $_->[1] } } @$results;
@@ -239,8 +241,10 @@
# find editors of missing ones
my $missing = $dbh->selectcol_arrayref(
'SELECT DISTINCT(Editor_ID)
- FROM Editor_Centre
- WHERE Centre_ID NOT IN (' . join(',', ('?') x @$exists) . ')',
+ FROM Editor_Centre ' .
+ (@$exists ?
+ (' WHERE Centre_ID NOT IN (' . join(',', ('?') x @$exists) . ')') :
+ ''),
undef, @$exists);
return $missing || [];
More information about the MKDoc-commit
mailing list