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

Source for file sptpl_db_mysql.php

Documentation is available at sptpl_db_mysql.php

  1. <?php
  2.  
  3. /**
  4. * sptpl_db_mysql.php
  5. *
  6. * Mysql access module
  7. *
  8. * require: sptpl_db.php
  9. *
  10. * @copyright sptpl_db_mysql.php is part of Sptpl project {@link http://www.andrioli.com/en/sptpl.html} and it is LGPL
  11. * @author Andrioli Darvin <darvin (inside) andrioli (dot) com>
  12. * @version $Header: d:\cvs/classistd/sptpl/sptpl_db_mysql.php,v 2.1 2005/03/02 21:00:54 Darvin Exp $
  13. */
  14. /*
  15. * +-------------------------------------------------------------------------+
  16. * | Sptpl |
  17. * +-------------------------------------------------------------------------+
  18. * | Copyright (c) 2003-2005 Andrioli Darvin |
  19. * | Email <darvin (inside) andrioli (dot) com> |
  20. * | Web http://www.andrioli.com/en/sptpl.html |
  21. * | Download http://www.phpclasses.org/browse.html/package/1326.html |
  22. * | |
  23. * +-------------------------------------------------------------------------+
  24. * | This library is free software; you can redistribute it and/or modify |
  25. * | it under the terms of the GNU Lesser General Public License as |
  26. * | published by the Free Software Foundation; either version 2 of the |
  27. * | License, or (at your option) any later version. |
  28. * | |
  29. * | This library is distributed in the hope that it will be useful, but |
  30. * | WITHOUT ANY WARRANTY; without even the implied warranty of |
  31. * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
  32. * | Lesser General Public License for more details. |
  33. * | |
  34. * | You should have received a copy of the GNU Lesser General Public |
  35. * | License along with this library; if not, write to the Free Software |
  36. * | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
  37. * +-------------------------------------------------------------------------+
  38. */
  39.  
  40.  
  41. class db_mysql extends CDB {
  42.  
  43. function db_mysql()
  44. {
  45. }
  46.  
  47. function DbOpen($DBSystem,$DBUser,$DBPasswd,$DBName)
  48. {
  49. if(($this->DbConn=mysql_connect($DBSystem,$DBUser,$DBPasswd))===FALSE)
  50. {
  51. // Errore di select del db
  52. trigger_error("Error during connection to the server ".$DBSystem,E_USER_ERROR);
  53. }
  54. if(!mysql_select_db($DBName,$this->DbConn))
  55. {
  56. // Errore di select del db
  57. trigger_error("I cannot select the db ".$DBName,E_USER_ERROR);
  58. }
  59. }
  60.  
  61. function DbExecSql($sql)
  62. {
  63. if(($this->DbResult=mysql_query($sql))===FALSE)
  64. {
  65. // Errore di select del db
  66. trigger_error("Error into sql statement. Sql string: ".$sql.".Err:". mysql_errno() . ": " . mysql_error());
  67. }
  68. // ToTrace($sql);
  69. return(TRUE);
  70. }
  71.  
  72. function DbGetValue()
  73. {
  74. // ToTrace("Prima ".$GLOBALS['debug']->Dump($this->DbValue));
  75. return(mysql_fetch_array($this->DbResult));
  76. // ToTrace("Dopo ".$GLOBALS['debug']->Dump($this->DbValue));
  77. // MyDebug(mysql_fetch_array($this->DbResult));
  78.  
  79. }
  80.  
  81. function DbClose()
  82. {
  83. mysql_close($this->DbConn);
  84. }
  85.  
  86. }
  87. ?>

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