source: trunk/third/moira/gen/ua-elect.gen @ 26024

Revision 26024, 819 bytes checked in by jdreed, 11 years ago (diff)
In moira: * Snapshot moira at r4113 to pick up new firewall-related changes
  • Property svn:executable set to *
Line 
1#!/moira/bin/perl -Tw
2# $Id: ua-elect.gen 4113 2013-05-28 14:29:10Z zacheiss $
3
4# The following exit codes are defined and MUST BE CONSISTENT with the
5# error codes the library uses:
6$MR_DBMS_ERR = 47836421;
7$MR_OCONFIG = 47836460;
8
9$outfile = '/moira/dcm/ua-elect.out';
10
11umask 022;
12open(OUT, ">$outfile") || exit $MR_OCONFIG;
13
14use DBI;
15
16$dbh = DBI->connect("dbi:Oracle:moira", "moira", "moira")
17    || exit $MR_DBMS_ERR;
18
19$sth = $dbh->prepare("SELECT login, type FROM users WHERE (status = 1 OR status = 2 OR status = 10 OR status = 11) AND type LIKE '20%' " .
20                     "ORDER BY type, login")
21    || exit $MR_DBMS_ERR;
22
23$sth->execute || exit $MR_DBMS_ERR;
24
25while (($login, $type) = $sth->fetchrow_array) {
26    $row = "$login\t$type\n";
27    $row =~ s/\0//g;
28    print OUT $row;
29}
30
31close(OUT);
32$dbh->disconnect;
33
34exit 0;
Note: See TracBrowser for help on using the repository browser.