'%server %user %password %database', 'connect' => '%server %user %password %database', 'query' => '%link %query', 'error_num' => '%link', 'error_str' => '%link', 'escape_string' => '%link %string', 'fetch_assoc' => '%result', 'fetch_object' => '%result', 'free_result' => '%result', 'insert_id' => '%link', 'num_rows' => '%result', 'affected_rows' => '%result' ); // ################################################################### /** * Constructor */ function __construct(&$registry) { $this->registry =& $registry; // because ivars and call_user_func() are conspiring against us... foreach ($this->commands AS $key => $string) { if (strpos($string, '$this->') !== false) { $this->commands["$key"] = array($this, str_replace('$this->', '', $string)); } } } // ################################################################### /** * (PHP 4) Constructor */ function DB_Abstract(&$registry) { $this->__construct($registry); } // ################################################################### /** * Initializes the class and all subclasses under a common package name * * @access protected * * @return string The package name */ function init_as_package() { if (!defined('ISSO_DB_LAYER')) { define('ISSO_DB_LAYER', get_class($this)); trigger_error('ISSO_DB_LAYER was defined automatically by DB::init_as_package(). Define the constant yourself to remove this warning', E_USER_WARNING); } return 'db'; } // ################################################################### /** * Connect to a the specified database * * @access public * * @param string Server name * @param string User name * @param string Password * @param string Database name * @param bool Use p-connect? * * @return bool Result of connect */ function connect($server, $user, $password, $database, $pconnect) { $this->registry->check_isso_fields(get_class($this)); if ($this->dblink == false) { $this->dblink = call_user_func(($pconnect ? $this->commands['pconnect'] : $this->commands['connect']), $server, $user, $password, $database); if ($this->dblink == false) { $this->error('DB-Link == false, cannot connect'); return false; } return true; } } // ################################################################### /** * Send a query to the open database link * * @access public * * @param string Query string * * @return integer Result */ function query($string) { $this->querystr = $string; $this->result = call_user_func($this->commands['query'], $this->dblink, $string); $this->history[] = $string; if (defined('ISSO_SHOW_QUERIES_LIVE')) { if (constant('ISSO_SHOW_QUERIES_LIVE')) { print($this->querystr . '
\n"; $this->registry->message('Database Error in `' . $this->registry->application . '`', $message_prepped, 3); exit; } } } /*=====================================================================*\ || ################################################################### || # $HeadURL$ || # $Id$ || ################################################################### \*=====================================================================*/ ?>"; $message_prepped .= "\n\t» Query:\n
" . htmlspecialchars($this->querystr) ."\n
"; $message_prepped .= "\n\t» Error Number: " . $this->errnum . "\n
"; $message_prepped .= "\n\t» Error Message: " . $this->errstr . "\n
"; $message_prepped .= "\n\t» Additional Notes: " . $message . "\n
"; $message_prepped .= "\n\t» File: " . $_SERVER['PHP_SELF'] . "\n"; $message_prepped .= "\n\n