source: trunk/third/moira/gen/asa-db.gen @ 25198

Revision 25198, 805 bytes checked in by jdreed, 13 years ago (diff)
In moira: * Snapshot moira@r4042 (6/28/11) * Update version number to include moira revision number
  • 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/asa-db.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, clearid, first, last, type FROM users WHERE status = 1 ORDER BY login")
20    || exit $MR_DBMS_ERR;
21
22$sth->execute || exit $MR_DBMS_ERR;
23
24while (($login, $clearid, $first, $last, $type) = $sth->fetchrow_array) {
25    $row = "$login\t$clearid\t$first\t$last\t$type\n";
26    $row =~ s/\0//g;
27    print OUT $row;
28}
29
30close(OUT);
31$dbh->disconnect;
32
33exit 0;
Note: See TracBrowser for help on using the repository browser.