- <?php
-
- /**
- *
- * sptpl_db_odbc.php
- *
- * ODBC access module
- *
- * requires: sptpl_db.php
- * @copyright sptpl_db_odbc.php is part of Sptpl project {@link http://www.andrioli.com/en/sptpl.html} and it is LGPL
- * @author Andrioli Darvin <darvin (inside) andrioli (dot) com>
- * @version $Header: d:\cvs/classistd/sptpl/sptpl_db_odbc.php,v 2.1 2005/03/02 21:00:54 Darvin Exp $
- */
- /*
- * +-------------------------------------------------------------------------+
- * | Sptpl |
- * +-------------------------------------------------------------------------+
- * | Copyright (c) 2003-2005 Andrioli Darvin |
- * | Email <darvin (inside) andrioli (dot) com> |
- * | Web http://www.andrioli.com/en/sptpl.html |
- * | Download http://www.phpclasses.org/browse.html/package/1326.html |
- * | |
- * +-------------------------------------------------------------------------+
- * | This library is free software; you can redistribute it and/or modify |
- * | it under the terms of the GNU Lesser General Public License as |
- * | published by the Free Software Foundation; either version 2 of the |
- * | License, or (at your option) any later version. |
- * | |
- * | This library is distributed in the hope that it will be useful, but |
- * | WITHOUT ANY WARRANTY; without even the implied warranty of |
- * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
- * | Lesser General Public License for more details. |
- * | |
- * | You should have received a copy of the GNU Lesser General Public |
- * | License along with this library; if not, write to the Free Software |
- * | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
- * +-------------------------------------------------------------------------+
- */
-
-
- class db_odbc extends CDB {
-
- function db_odbc()
- {
-
- }
-
- function DbOpen($DBSystem,$DBUser,$DBPasswd,$DBName)
- {
- if(($this->DbConn=odbc_connect($DBSystem,$DBUser,$DBPasswd))===FALSE)
- {
- // Errore di select del db
- trigger_error("Error during connection to the server ".$DBSystem,E_USER_ERROR);
- }
- /*
- if(!mssql_select_db($DBName,$this->DbConn))
- {
- // Errore di select del db
- trigger_error("I cannot select the db ".$DBName,E_USER_ERROR);
- }
- */
- }
-
- function DbExecSql($sql)
- {
- if(($this->DbResult=odbc_exec($this->DbConn,$sql))===FALSE)
- {
- // Errore di select del db
- trigger_error("Error into sql statement. Sql string: ".$sql,E_USER_ERROR);
- }
- // ToTrace($sql);
- return(TRUE);
- }
-
- function DbGetValue()
- {
- // ToTrace("Prima ".$GLOBALS['debug']->Dump($this->DbValue));
- $tmpArray=array();
- $rs_assoc=array();
- odbc_fetch_into($this->DbResult,$tmpArray);
- foreach ($tmpArray as $key => $value) {
- $rs_assoc[odbc_field_name($this->DbResult, $key+1)] = $value;
- }
- // var_dump($rs_assoc);
- return($rs_assoc);
- // ToTrace("Dopo ".$GLOBALS['debug']->Dump($this->DbValue));
- // MyDebug(mysql_fetch_array($this->DbResult));
-
- }
- function DbClose()
- {
- odbc_close($this->DbConn);
- }
- }
-
- ?>