5 # The following exit codes are defined and MUST BE CONSISTENT with the
6 # error codes the library uses:
7 $MR_DBMS_ERR = 47836421;
8 $MR_OCONFIG = 47836460;
10 $outfile = '/moira/dcm/sapprint.out';
14 $dbh = DBI->connect("dbi:Oracle:moira", "moira", "moira")
17 $sth = $dbh->prepare("SELECT p.name, p.hwtype, p.location, p.duplexname, p.rp, m.name ".
18 "FROM printers p, machine m ".
19 "WHERE p.rm=m.mach_id AND p.type='SAP'")
22 $sth->execute || exit $MR_DBMS_ERR;
25 open(OUT, ">$outfile") || exit $MR_OCONFIG;
27 while (($name, $hwtype, $location, $duplexname, $rp, $rm) =
28 $sth->fetchrow_array) {
29 $row = "$name:$hwtype $location:$duplexname:rp=$rp:rm=$rm\n";
30 $row .= "$duplexname:$name duplex queue:$duplexname:rp=$duplexname:rm=$rm\n"
31 unless ($duplexname eq "\0");