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

Source for file sptpl_db_odbc.php

Documentation is available at sptpl_db_odbc.php

  1. <?php
  2.  
  3. /**
  4. *
  5. * sptpl_db_odbc.php
  6. *
  7. * ODBC access module
  8. *
  9. * requires: sptpl_db.php
  10. * @copyright sptpl_db_odbc.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_odbc.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_odbc extends CDB {
  42.  
  43. function db_odbc()
  44. {
  45.  
  46. }
  47.  
  48. function DbOpen($DBSystem,$DBUser,$DBPasswd,$DBName)
  49. {
  50. if(($this->DbConn=odbc_connect($DBSystem,$DBUser,$DBPasswd))===FALSE)
  51. {
  52. // Errore di select del db
  53. trigger_error("Error during connection to the server ".$DBSystem,E_USER_ERROR);
  54. }
  55. /*
  56. if(!mssql_select_db($DBName,$this->DbConn))
  57. {
  58. // Errore di select del db
  59. trigger_error("I cannot select the db ".$DBName,E_USER_ERROR);
  60. }
  61. */
  62. }
  63.  
  64. function DbExecSql($sql)
  65. {
  66. if(($this->DbResult=odbc_exec($this->DbConn,$sql))===FALSE)
  67. {
  68. // Errore di select del db
  69. trigger_error("Error into sql statement. Sql string: ".$sql,E_USER_ERROR);
  70. }
  71. // ToTrace($sql);
  72. return(TRUE);
  73. }
  74.  
  75. function DbGetValue()
  76. {
  77. // ToTrace("Prima ".$GLOBALS['debug']->Dump($this->DbValue));
  78. $tmpArray=array();
  79. $rs_assoc=array();
  80. odbc_fetch_into($this->DbResult,$tmpArray);
  81. foreach ($tmpArray as $key => $value) {
  82. $rs_assoc[odbc_field_name($this->DbResult, $key+1)] = $value;
  83. }
  84. // var_dump($rs_assoc);
  85. return($rs_assoc);
  86. // ToTrace("Dopo ".$GLOBALS['debug']->Dump($this->DbValue));
  87. // MyDebug(mysql_fetch_array($this->DbResult));
  88.  
  89. }
  90. function DbClose()
  91. {
  92. odbc_close($this->DbConn);
  93. }
  94. }
  95.  
  96. ?>

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