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

Revision 25817, 804 bytes checked in by jdreed, 11 years ago (diff)
In moira: * Re-snapshot moira at r4097 to pick up Status 10 (Suspended) (Trac: #1295) * Remove our addusr.1 and namespace.1 in favor of upstreams (Trac: #918) * Build-dep on OpenSSL and pass new configure flag per moira r4091
  • Property svn:executable set to *
Line 
1#!/moira/bin/perl -Tw
2# $Id: ua-elect.gen 4097 2013-02-11 14:54:53Z 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) 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.