dbms.ini.php
上传用户:jiangbw
上传日期:2022-03-16
资源大小:49k
文件大小:7k
- <?
- /*======================================================================*
- || #################################################################### ||
- || # BUILD UNDER PHP SCRIPTNET 3.2.1 FRAMEWORK ||
- || # ---------------------------------------------------------------- # ||
- || # Code2Art Open Source Software. All Rights Reserved. ||
- || # This file should be redistributed in whole or significant part. # ||
- || # ------------------ SCRIPTNET IS FREE SOFTWARE ------------------ # ||
- || # http://www.code2art.com | http://www.code2art.com/scriptnet # ||
- || # Copyleft by Benediktus Ardian Hersanto, SE # ||
- || # Sorry if this framework is still unavailable for public # ||
- || # because I still searching on my own head. # ||
- || #################################################################### ||
- *======================================================================*/
- /*======================================================================*
- || #################################################################### ||
- || DBF to MySQL Bulk Converter 2.0 ||
- ||______________________________________________________________________||
- || This utility was developed on 2006, since this were used to be on ||
- || my own library. But I think I should share it to you, because I ||
- || need to save my work on Internet (I don't believe on my own HD drive)||
- || it always crash and had a terrible bad sectors. ||
- || Thanks to all person who download this utility, I hope you enjoy it. ||
- || ||
- || Regards, ||
- || Benediktus Ardian Hersanto,SE (ardie_b@yahoo.com) ||
- /*======================================================================*/
- // ---------------------------------------------------------------------//
- // Free to use for everyone who understand PHP
- // ---------------------------------------------------------------------//
- // Last Change : 15.01.2007
- // CHANGES :
- // - DB_TYPE switch to DB_DRIVER
- // - ADDED DB_PORT
- // --------------------------------------------------------------------------------
- // Free to use to everyone who understand PHP
- // --------------------------------------------------------------------------------
- /*
- *@author B. Ardian Hersanto
- *@copyright GNU as long as you're friends of mine, just kidding
- *@package DBComponents
- */
- // CONNECTION TYPE CONSTANT (Don't change the constant value or it will not work)
- define('MYSQL', 0x00);
- //define('MYSQLI', 0x01); enabled for PHP 5 extension only unless you have this extension for PHP 4
- //define('PDOMYSQL', 0x02); enabled for PHP 5 extension only unless you have this extension for PHP 4
- define('MAXDB', 0x03);
- define('ODBC', 0x04);
- define('POSTGRE', 0x05);
- //define('PDOPOSTGRE',0x06); enabled for PHP 5 extension only unless you have this extension for PHP 4
- define('MSSQL', 0x07);
- //define('PDOMSSQL', 0x08); enabled for PHP 5 extension only unless you have this extension for PHP 4
- class DBMS {
-
- var $driver_name = "db";
- var $HOSTNAME;
- var $USERNAME;
- var $PASSWORD;
- var $DATABASE;
- var $PORT;
- var $SERVER_TYPE;
-
- function DBMS() {
- $this->HOSTNAME = (defined('DB_HOST'))?DB_HOST:'';
- $this->USERNAME = (defined('DB_USER'))?DB_USER:'';
- $this->PASSWORD = (defined('DB_PASS'))?DB_PASS:'';
- $this->DATABASE = (defined('DB_NAME'))?DB_NAME:'';
- $this->PORT = (defined('DB_PORT'))?DB_PORT:'';
- $this->SERVER_TYPE = (defined('DB_DRIVER'))?DB_DRIVER:'';
- $this->driver_name = (defined('DB_HANDLE'))?DB_HANDLE:$this->driver_name;
- $this->LoadLibraryInterface();
- }
-
- function LoadLibraryInterface() {
- if (is_string($this->SERVER_TYPE)) $this->SERVER_TYPE = strtoupper($this->SERVER_TYPE);
- if(!defined('DB_LOADED')) {
- switch ($this->SERVER_TYPE) {
- case MYSQL :
- $lib_dir = str_replace('\','/',dirname(__FILE__));
- $filename = $lib_dir.'/mysql.lib.' . FILE_EXT;
- if(file_exists($filename)) {
- $this->driver = $filename;
- include($filename);
- $driver = $this->driver_name;
- global $$driver;
- $$driver = new MySQL;
- } else {
- if(PHPVERSION>=401) trigger_error('<b>Library file not found :</b> '.$filename.' not exists',E_USER_ERROR);
- if(PHPVERSION<401) die('<b>Library file not found :</b> '.$filename.' not exists');
- }
- break;
- case MAXDB :
- $lib_dir = str_replace('\','/',dirname(__FILE__));
- $filename = $lib_dir.'/maxdb.lib.' . $file_ext;
- if(file_exists($filename)) {
- $this->driver = $filename;
- include($filename);
- $driver = $this->driver_name;
- global $$driver;
- $$driver = new MAXDB;
- } else {
- if(PHPVERSION>=401) trigger_error('<b>Library file not found :</b> '.$filename.' not exists',E_USER_ERROR);
- if(PHPVERSION<401) die('<b>Library file not found :</b> '.$filename.' not exists');
- }
- break;
- case ODBC :
- $lib_dir = str_replace('\','/',dirname(__FILE__));
- $filename = $lib_dir.'/odbc.lib.' . $file_ext;
- if(file_exists($filename)) {
- $this->driver = $filename;
- include($filename);
- $driver = $this->driver_name;
- global $$driver;
- $$driver = new ODBC;
- } else {
- if(PHPVERSION>=401) trigger_error('<b>Library file not found :</b> '.$filename.' not exists',E_USER_ERROR);
- if(PHPVERSION<401) die('<b>Library file not found :</b> '.$filename.' not exists');
- }
- break;
- case POSTGRE :
- $lib_dir = str_replace('\','/',dirname(__FILE__));
- $filename = $lib_dir.'/postgre.lib.' . $file_ext;
- if(file_exists($filename)) {
- $this->driver = $filename;
- include($filename);
- $driver = $this->driver_name;
- global $$driver;
- $$driver = new POSTGRE;
- } else {
- if(PHPVERSION>=401) trigger_error('<b>Library file not found :</b> '.$filename.' not exists',E_USER_ERROR);
- if(PHPVERSION<401) die('<b>Library file not found :</b> '.$filename.' not exists');
- }
- break;
- case MSSQL :
- $lib_dir = str_replace('\','/',dirname(__FILE__));
- $filename = $lib_dir.'/mssql.lib.' . $file_ext;
- if(file_exists($filename)) {
- $this->driver = $filename;
- include($filename);
- $driver = $this->driver_name;
- global $$driver;
- $$driver = new MSSQL;
- } else {
- if(PHPVERSION>=401) trigger_error('<b>Library file not found :</b> '.$filename.' not exists',E_USER_ERROR);
- if(PHPVERSION<401) die('<b>Library file not found :</b> '.$filename.' not exists');
- }
- break;
- }
- define('DB_LOADED',true);
- }
-
- // Registering Destructor
- global $_DESTRUCTORS;
- $_DESTRUCTORS[$this->driver_name] = "_destroy";
-
- }
- }
- ?>