dblink = null; } // ---------------------------------------------------------- public function connect( ) { $this->dblink = new mysqli( self::HOST, self::USER, self::PASS, self::NAME, self::PORT ); if ($this->dblink->connect_errno) { if ( debug_on() ) { die( ' Connect ERROR: (' . $this->dblink->connect_errno . ') ' . $this->dblink->connect_error ); } else { die( kMSG_DB_ERROR ); } } } // ---------------------------------------------------------- public function close( ) { $this->dblink->close(); $this->dblink = null; } // ---------------------------------------------------------- public function query( $query_str ) { $result = $this->dblink->query( $query_str ); if (!$result) { if ( debug_on() ) { die( ' Query ERROR: (' . $this->dblink->errno . ') ' . $this->dblink->error ); } else { die( kMSG_QUERY_ERROR ); } } return $result; } // ---------------------------------------------------------- public function free_result( $result ) { $result->close(); } // ---------------------------------------------------------- public function fetch( $result ) { return $result->fetch_array(); } // ---------------------------------------------------------- public function num_rows( $result ) { return $result->num_rows; } // ---------------------------------------------------------- public function affected_rows( ) { return $this->dblink->affected_rows; } // ---------------------------------------------------------- public function insert_id( ) { return $this->dblink->insert_id; } // ---------------------------------------------------------- public function info( ) { return $this->dblink->info; } // ---------------------------------------------------------- public function query_select( $query_str ) { $q_str = 'SELECT ' . $query_str; return $this->query($q_str); } // ---------------------------------------------------------- public function query_insert( $query_str ) { $q_str = 'INSERT ' . $query_str; if ($this->query($q_str)) { return $this->dblink->insert_id; } else { return -1; } } // ---------------------------------------------------------- public function query_update( $query_str ) { $q_str = 'UPDATE ' . $query_str; if ($this->query($q_str)) { return $this->dblink->affected_rows; } else { return -1; } } // ---------------------------------------------------------- public function query_delete( $query_str ) { $q_str = 'DELETE ' . $query_str; if ($this->query($q_str)) { return $this->dblink->affected_rows; } else { return -1; } } // ---------------------------------------------------------- public function real_escape_string( $str ) { return $this->dblink->real_escape_string($str); } } // -------------------------------------------------------------- ?>