phpDocumentor SpoolTemplate
[ Back ] [ class tree: SpoolTemplate ] [ index: SpoolTemplate ] [ all elements ]

Source for file sptpl_db_pgsql.php

Documentation is available at sptpl_db_pgsql.php

  1. <?php
  2.  
  3. /*
  4. * sptpl_db_pgsql.php
  5. *
  6. * Postgresql access module
  7. *
  8. * require: sptpl_db.php
  9. *
  10. * Author: Igor Támara igor@tamarapatino.org
  11. *
  12. * License: The same of SpTpl
  13. *
  14. */
  15. class db_pgsql extends CDB {
  16.  
  17. function db_pgsql()
  18. {
  19. }
  20. function DbOpen($DBSystem,$DBUser,$DBPasswd,$DBName)
  21. {
  22. if ($DBSystem!=null) {
  23. $a="host=".$DBSystem;
  24. }
  25. if ($DBUser!=null) {
  26. $a.=" user=".$DBUser;
  27. }
  28. if ($DBPasswd!=null) {
  29. $a.=" password=".$DBPasswd;
  30. }
  31. if ($DBName!=null) {
  32. $a.=" dbname=$DBName";
  33. }
  34. if(($this->DbConn=pg_connect($a))===FALSE)
  35. {
  36. // Error connectig to the database
  37. trigger_error("Error during connection to the server ".$DBSystem,E_USER_ERROR);
  38. }
  39. }
  40. function DbExecSql($sql)
  41. {
  42. if(($this->DbResult=pg_query($this->DbConn,$sql))===FALSE)
  43. {
  44. // Error during select
  45. trigger_error("Error in sql statement. Sql string: ".$sql." Error:". pg_lasterror());
  46. }
  47. return(TRUE);
  48. }
  49.  
  50. function DbGetValue()
  51. {
  52. return(pg_fetch_array($this->DbResult));
  53. }
  54. function DbClose()
  55. {
  56. pg_close($this->DbConn);
  57. }
  58. }
  59. ?>

Documentation generated on Mon, 28 Mar 2005 15:13:23 +0200 by phpDocumentor 1.3.0RC3