/postgree/pg.pl

http://cupsfilter.googlecode.com/ · Perl · 27 lines · 14 code · 5 blank · 8 comment · 2 complexity · 88268cb276c97679e1c9ab606d2bdea7 MD5 · raw file

  1. #!/usr/bin/perl
  2. use DBI;
  3. # ??? ???? ??????
  4. $dbname = "CupsLog";
  5. # ??? ????????????
  6. $username = "postgres";
  7. # ??????
  8. $password = "pg";
  9. # ??? ??? IP ????? ???????
  10. $dbhost = "localhost";
  11. # ????
  12. $dbport = "5432";
  13. # ?????
  14. $dboptions = "-e";
  15. # ????????
  16. $dbtty = "ansi";
  17. $dbh = DBI->connect("dbi:PgPP:dbname=$dbname;host=$dbhost;port=$dbport;options=$dboptions;tty=$dbtty","$username","$password",{PrintError => 0});
  18. if ($DBI::err != 0) {
  19. print $DBI::errstr."\n";
  20. exit($DBI::err);
  21. }
  22. $dbh->disconnect();