DbDefaults.object
上传用户:xiao730204
上传日期:2007-01-04
资源大小:141k
文件大小:3k
- <?php
- class DbDefaults extends BaseObject {
- var $driver;
- var $user_name;
- var $password;
- var $server_name;
- var $server_port;
- var $db_name;
- var $persistent_mode;
- var $connect_string;
- Function DbDefaults(
- $user_name = '',
- $password = '',
- $server_name = '',
- $server_port = '',
- $db_name = '',
- $persistent_mode = true,
- $connect_string = ''
- ) {
- $this->BaseObject( 'DbDefaults' );
- $this->user_name = $user_name;
- $this->password = $password;
- $this->server_name = $server_name;
- $this->server_port = $server_port;
- $this->db_name = $db_name;
- $this->persistent_mode = $persistent_mode;
- $this->connect_string = $connect_string;
- }
- Function Build_MysqlConnectString() {
- $this->connect_string = $this->server_name;
- if ( $this->server_port != '' ) {
- $this->connect_string .= ':' . $this->port_name;
- }
- }
- Function Build_OracleConnectString() {
- $this->connect_string = $this->user_name;
- /* Add the password string */
- if ( $this->password != '' ) {
- $this->connect_string .= '/' . $this->password;
- }
- /* Post fix the tns name if needed */
- if ( $this->db_name != '' ) {
- $this->connect_string .= '@' . $this->db_name;
- }
- }
- Function Build_PostgresConnectString() {
- //order based on pg_pConnect docs
- // dbname, port, host, tty, options, user, password
- // Note: Choosing to ignore tty and options for now
- //$this->connect_string = $this->server_name;
- if ( $this->db_name != '' ) {
- $this->connect_string .= ' dbname=' . $this->db_name;
- }
- if ( $this->server_port != '' ) {
- $this->connect_string .= ' port=' . $this->port_name;
- }
- if ( $this->server_name != '' ) {
- $this->connect_string .= ' host=' . $this->server_name;
- }
- if ( $this->user_name != '' ) {
- $this->connect_string .= ' user=' . $this->user_name;
- }
- if ( $this->password != '' ) {
- $this->connect_string .= ' password=' . $this->password;
- }
- $this->connect_string = trim( $this->connect_string );
- //echo "conn= " . $this->connect_string . "n";
- }
- Function CopyDbDefaults( $db_defaults_obj ) {
- $this->driver = $db_defaults_obj->driver;
- $this->user_name = $db_defaults_obj->user_name;
- $this->password = $db_defaults_obj->password;
- $this->server_name = $db_defaults_obj->server_name;
- $this->db_name = $db_defaults_obj->db_name;
- $this->persistent_mode = $db_defaults_obj->persistent_mode;
- }
- Function DebugDump() {
- $debug = new Debug();
- $debug->prefix = 'DbDefaults';
- $debug->Message( 'Debug dump start' );
- $debug->Message( 'driver : ' . $this->driver );
- $debug->Message( 'user_name : ' . $this->user_name );
- $debug->Message( 'password : ' . $this->password );
- $debug->Message( 'server_name : ' . $this->server_name );
- $debug->Message( 'db_name : ' . $this->db_name );
- $debug->Message( 'persistent_mode : ' . $this->persitent_mode );
- $debug->Message( 'Debug dump end' );
- }
- }
- ?>