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

Revision 24447, 773 bytes checked in by broder, 15 years ago (diff)
In moira: * New SVN snapshot.
  • Property svn:executable set to *
Line 
1#!/moira/bin/perl -Tw
2# $Id: ua-elect.gen 3990 2010-03-11 16:44:43Z 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 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.