[Openfirst-cvscommit] base/config dbase.php,1.9,1.10
Brought to you by:
xtimg
From: Tim G. <xt...@us...> - 2004-04-12 19:52:01
|
Update of /cvsroot/openfirst/base/config In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2118 Modified Files: dbase.php Log Message: Add PEAR DB support. Most of the credit for this goes to Daniel Schilling. Index: dbase.php =================================================================== RCS file: /cvsroot/openfirst/base/config/dbase.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** dbase.php 9 Apr 2004 20:00:10 -0000 1.9 --- dbase.php 12 Apr 2004 19:38:09 -0000 1.10 *************** *** 16,23 **** * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License --- 16,19 ---- *************** *** 32,38 **** if(isset($dbasetype) == false) { $dbasetype = "mysql"; } ! if($peardb) { // Include the PEAR Database Abstraction Layer include_once("DB.php"); } --- 28,38 ---- if(isset($dbasetype) == false) { $dbasetype = "mysql"; } ! ! $connectdsn = ""; ! if(isset($peardb) && $peardb) { // Include the PEAR Database Abstraction Layer include_once("DB.php"); + } elseif(! isset($peardb)) { + $peardb = false; } *************** *** 40,45 **** function ofirst_dbconnect($server = "", $username = "", $password = "", $newlink = "", $intclientflags = "") { ! global $dbasetype, $peardb; ! if($dbasetype == "mysql") { if(function_exists("mysql_connect") == false) { die("MySQL support is not available in your version of PHP. To use the openFIRST Web Portal Software, please either enable MySQL support, or choose another database type."); --- 40,49 ---- function ofirst_dbconnect($server = "", $username = "", $password = "", $newlink = "", $intclientflags = "") { ! global $dbasetype, $peardb, $connectdsn; ! echo("CONNECT"); ! if($peardb) { ! $connectdsn = "$dbasetype://$username:$password@$server/"; ! return(0); ! } elseif($dbasetype == "mysql") { if(function_exists("mysql_connect") == false) { die("MySQL support is not available in your version of PHP. To use the openFIRST Web Portal Software, please either enable MySQL support, or choose another database type."); *************** *** 67,76 **** } } ! exit; } function ofirst_select_db($databasename, $linkidentifier = "") { ! global $dbasetype, $peardb; ! if($dbasetype == "mysql") { if(function_exists("mysql_select_db") == false) { die("MySQL support is not available in your version of PHP. To use the openFIRST Web Portal Software, please either enable MySQL support, or choose another database type."); --- 71,83 ---- } } ! exit(0); } function ofirst_select_db($databasename, $linkidentifier = "") { ! global $dbasetype, $peardb, $connectdsn; ! echo "SELECTDB"; ! if($peardb) { ! return($connectdsn =& DB::connect("$connectdsn$databasename")); ! } elseif($dbasetype == "mysql") { if(function_exists("mysql_select_db") == false) { die("MySQL support is not available in your version of PHP. To use the openFIRST Web Portal Software, please either enable MySQL support, or choose another database type."); *************** *** 91,100 **** } } ! exit; } function ofirst_dberrno($linkidentifier = "") { global $dbasetype, $peardb; ! if($dbasetype == "mysql") { if(function_exists("mysql_errno") == false) { die("MySQL support is not available in your version of PHP. To use the openFIRST Web Portal Software, please either enable MySQL support, or choose another database type."); --- 98,113 ---- } } ! exit(0); } function ofirst_dberrno($linkidentifier = "") { global $dbasetype, $peardb; ! if($peardb) { ! if($linkidentifier != "") { ! return(DB_Error::getCode($linkidentifier)); ! } else { ! return(DB_Error::getCode()); ! } ! } elseif($dbasetype == "mysql") { if(function_exists("mysql_errno") == false) { die("MySQL support is not available in your version of PHP. To use the openFIRST Web Portal Software, please either enable MySQL support, or choose another database type."); *************** *** 120,129 **** } } ! exit; } function ofirst_dberror($linkidentifier = "") { global $dbasetype, $peardb; ! if($dbasetype == "mysql") { if(function_exists("mysql_error") == false) { die("MySQL support is not available in your version of PHP. To use the openFIRST Web Portal Software, please either enable MySQL support, or choose another database type."); --- 133,148 ---- } } ! exit(0); } function ofirst_dberror($linkidentifier = "") { global $dbasetype, $peardb; ! if($peardb) { ! if($linkidentifier != "") { ! return(DB_Error::getMessage($linkidentifier)); ! } else { ! return(DB_Error::getMessage()); ! } ! } elseif($dbasetype == "mysql") { if(function_exists("mysql_error") == false) { die("MySQL support is not available in your version of PHP. To use the openFIRST Web Portal Software, please either enable MySQL support, or choose another database type."); *************** *** 149,158 **** } } ! exit; } function ofirst_dbquery($string, $linkidentifier = "", $batchsize = "") { ! global $dbasetype, $peardb; ! if($dbasetype == "mysql") { if(function_exists("mysql_query") == false) { die("MySQL support is not available in your version of PHP. To use the openFIRST Web Portal Software, please either enable MySQL support, or choose another database type."); --- 168,186 ---- } } ! exit(0); } function ofirst_dbquery($string, $linkidentifier = "", $batchsize = "") { ! global $dbasetype, $peardb, $sqlconnection; ! if($peardb) { ! if($batchsize != "") { ! return($sqlconnection->query($string, $linkidentifier, $batchsize)); ! } elseif($linkidentifier != "") { ! return($sqlconnection->query($string, $linkidentifier)); ! } else { ! print_r($sqlconnection); ! return($sqlconnection->query($string)); ! } ! } elseif($dbasetype == "mysql") { if(function_exists("mysql_query") == false) { die("MySQL support is not available in your version of PHP. To use the openFIRST Web Portal Software, please either enable MySQL support, or choose another database type."); *************** *** 186,190 **** function ofirst_dbfetch_object($resource, $rownumber = "") { global $dbasetype, $peardb; ! if($dbasetype == "mysql") { if(function_exists("mysql_fetch_object") == false) { die("MySQL support is not available in your version of PHP. To use the openFIRST Web Portal Software, please either enable MySQL support, or choose another database type."); --- 214,225 ---- function ofirst_dbfetch_object($resource, $rownumber = "") { global $dbasetype, $peardb; ! if($peardb) { ! if($rownumber != "") { ! return(DB_FETCHMODE_OBJECT($resource, $rownumber)); ! } else { ! return(DB_FETCHMODE_OBJECT($resource)); ! } ! ! } elseif($dbasetype == "mysql") { if(function_exists("mysql_fetch_object") == false) { die("MySQL support is not available in your version of PHP. To use the openFIRST Web Portal Software, please either enable MySQL support, or choose another database type."); *************** *** 199,203 **** if(function_exists("odbc_fetch_object") == false) { die("ODBC support is not available in your version of PHP. To use the openFIRST Web Portal Software, please either enable ODBC support, or choose another database type."); ! } if($rownumber != "") { return(odbc_fetch_object($resource, $rownumber)); --- 234,239 ---- if(function_exists("odbc_fetch_object") == false) { die("ODBC support is not available in your version of PHP. To use the openFIRST Web Portal Software, please either enable ODBC support, or choose another database type."); ! ! } if($rownumber != "") { return(odbc_fetch_object($resource, $rownumber)); *************** *** 212,216 **** function ofirst_dbnum_rows($resource) { global $dbasetype, $peardb; ! if($dbasetype == "mysql") { if(function_exists("mysql_num_rows") == false) { die("MySQL support is not available in your version of PHP. To use the openFIRST Web Portal Software, please either enable MySQL support, or choose another database type."); --- 248,258 ---- function ofirst_dbnum_rows($resource) { global $dbasetype, $peardb; ! if($peardb) { ! if($resource != "") { ! return(DB_result::numRows($resource)); ! } else { ! return(DB_result::numRows()); ! } ! } elseif($dbasetype == "mysql") { if(function_exists("mysql_num_rows") == false) { die("MySQL support is not available in your version of PHP. To use the openFIRST Web Portal Software, please either enable MySQL support, or choose another database type."); |