$this->generator = $generator;
}
+ /**
+ * Release all resources
+ */
+ public function dispose() {
+ if ($this->generator) {
+ $this->generator->dispose();
+ $this->generator = null;
+ }
+ $this->mdb = null;
+ }
+
/**
* This function will execute an array of SQL commands, returning
* true/false if any error is found and stopping/continue as desired.
$this->mdb = $mdb; // this creates circular reference - the other link must be unset when closing db
}
+ /**
+ * Release all resources
+ */
+ public function dispose() {
+ $this->mdb = null;
+ }
+
/**
* Given one string (or one array), ends it with statement_end
*/
return $cfg;
}
- //TODO: preconfigure_dbconnection(): Decide if this should be declared as abstract because all adodb drivers will need it
/**
* Adodb preconnection routines, ususally sets up needed defines;
*/
- protected function preconfigure_dbconnection() {
- // empty
- }
+ protected abstract function preconfigure_dbconnection();
public function connect($dbhost, $dbuser, $dbpass, $dbname, $dbpersist, $prefix, array $dboptions=null) {
$this->dbhost = $dbhost;
return true;
}
- //TODO: configure_dbconnection(): Decide if this should be declared as abstract because all adodb drivers will need it
/**
* Adodb post connection routines, usually sets up encoding,e tc.
*/
- protected function configure_dbconnection() {
- // empty
+ protected abstract function configure_dbconnection();
+
+ /**
+ * Close database connection and release all resources
+ * and memory (especially circular memory references).
+ * Do NOT use connect() again, create a new instance if needed.
+ */
+ public function dispose() {
+ if ($this->db) {
+ $this->db->Close();
+ }
+ parent::dispose();
}
//TODO: make all dblibraries return this info in a structured way (new server_info class or so, like database_column_info class)
*/
public abstract function connect($dbhost, $dbuser, $dbpass, $dbname, $dbpersist, $prefix, array $dboptions=null);
+ /**
+ * Close database connection and release all resources
+ * and memory (especially circular memory references).
+ * Do NOT use connect() again, create a new instance if needed.
+ */
+ public function dispose() {
+ if ($this->database_manager) {
+ $this->database_manager->dispose();
+ $this->database_manager = null;
+ }
+ $this->columns = array();
+ }
+
/**
* Returns database server info array
* @return array