Index: core/kernel/application.php IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- core/kernel/application.php (revision 15908) +++ core/kernel/application.php (revision ) @@ -109,7 +109,7 @@ /** * Holds DBConnection * - * @var kDBConnection + * @var IDBConnection * @access public */ public $Conn = null; @@ -1633,11 +1633,11 @@ } /** - * Return ADODB Connection object + * Return object with DB Connection interface * - * Returns ADODB Connection object already connected to the project database, configurable in config.php + * Return object with DB Connection interface already connected to the project database, configurable in config.php * - * @return kDBConnection + * @return IDBConnection * @access public */ public function &GetADODBConnection() Index: core/units/users/users_syncronize.php IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- core/units/users/users_syncronize.php (revision 15908) +++ core/units/users/users_syncronize.php (revision ) @@ -91,7 +91,7 @@ /** * Connection to database * - * @var kDBConnection + * @var IDBConnection * @access public */ var $Conn; \ No newline at end of file Index: core/kernel/db/db_connection.php IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- core/kernel/db/db_connection.php (revision 15908) +++ core/kernel/db/db_connection.php (revision ) @@ -18,7 +18,7 @@ * Multi database connection class * */ - class kDBConnection extends kBase { + class kDBConnection extends kBase implements IDBConnection { /** * Current database type @@ -743,8 +743,6 @@ return !$this->hasError(); } - - /** * Returns auto increment field value from Index: core/install.php IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- core/install.php (revision 15908) +++ core/install.php (revision ) @@ -37,7 +37,7 @@ /** * Connection to database * - * @var kDBConnection + * @var IDBConnection */ var $Conn = null; Index: core/kernel/db/i_db_connection.php IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- core/kernel/db/i_db_connection.php (revision ) +++ core/kernel/db/i_db_connection.php (revision ) @@ -0,0 +1,161 @@ +UTF-8 =================================================================== --- core/units/system_event_subscriptions/system_event_subscription_tp.php (revision 15908) +++ core/units/system_event_subscriptions/system_event_subscription_tp.php (revision ) @@ -105,12 +105,12 @@ protected $_itemTitles = Array (); /** - * Set's references to kApplication and kDBConnection class instances + * Set's references to kApplication and DBConnection interface class instances * * @param kDBList $subscriptions * @access public * @see kApplication - * @see kDBConnection + * @see IDBConnection */ public function __construct($subscriptions) { \ No newline at end of file Index: core/kernel/utility/unit_config.php IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- core/kernel/utility/unit_config.php (revision 15908) +++ core/kernel/utility/unit_config.php (revision ) @@ -334,7 +334,7 @@ /** * Connection to database * - * @var kDBConnection + * @var IDBConnection * @access protected */ protected $Conn = null; Index: core/kernel/startup.php IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- core/kernel/startup.php (revision 15908) +++ core/kernel/startup.php (revision ) @@ -175,6 +175,7 @@ KERNEL_PATH . '/application.php', FULL_PATH . APPLICATION_PATH, KERNEL_PATH . "/kbase.php", + KERNEL_PATH . '/db/i_db_connection.php', KERNEL_PATH . '/db/db_connection.php', KERNEL_PATH . '/db/db_load_balancer.php', KERNEL_PATH . '/utility/event.php', \ No newline at end of file Index: core/kernel/db/db_load_balancer.php IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- core/kernel/db/db_load_balancer.php (revision 15908) +++ core/kernel/db/db_load_balancer.php (revision ) @@ -14,7 +14,7 @@ defined('FULL_PATH') or die('restricted access!'); -class kDBLoadBalancer extends kBase { +class kDBLoadBalancer extends kBase implements IDBConnection { /** * Current database type @@ -599,6 +599,48 @@ } /** + * Returns auto increment field value from + * insert like operation if any, zero otherwise + * + * @return int + * @access public + */ + public function getInsertID() + { + $conn =& $this->openConnection($this->lastUsedIndex); + + return $conn->getInsertID(); + } + + /** + * Returns row count affected by last query + * + * @return int + * @access public + */ + public function getAffectedRows() + { + $conn =& $this->openConnection($this->lastUsedIndex); + + return $conn->getAffectedRows(); + } + + /** + * Returns LIMIT sql clause part for specific db + * + * @param int $offset + * @param int $rows + * @return string + * @access public + */ + public function getLimitClause($offset, $rows) + { + $conn =& $this->openConnection($this->lastUsedIndex); + + return $conn->getLimitClause($offset, $rows); + } + + /** * If it's a string, adds quotes and backslashes (only work since PHP 4.3.0) * Otherwise returns as-is * @@ -628,6 +670,46 @@ } /** + * Escapes strings (only work since PHP 4.3.0) + * + * @param mixed $string + * @return string + * @access public + */ + public function escape($string) + { + $conn =& $this->openConnection($this->lastUsedIndex); + + return $conn->escape($string); + } + + /** + * Returns last error code occurred + * + * @return int + * @access public + */ + public function getErrorCode() + { + $conn =& $this->openConnection($this->lastUsedIndex); + + return $conn->getErrorCode(); + } + + /** + * Returns last error message + * + * @return string + * @access public + */ + public function getErrorMsg() + { + $conn =& $this->openConnection($this->lastUsedIndex); + + return $conn->getErrorMsg(); + } + + /** * Performs insert of given data (useful with small number of queries) * or stores it to perform multiple insert later (useful with large number of queries) * @@ -662,6 +744,48 @@ } /** + * Allows to detect table's presence in database + * + * @param string $table_name + * @param bool $force + * @return bool + * @access public + */ + public function TableFound($table_name, $force = false) + { + $conn =& $this->openConnection($this->lastUsedIndex); + + return $conn->TableFound($table_name, $force); + } + + /** + * Returns query processing statistics + * + * @return Array + * @access public + */ + public function getQueryStatistics() + { + $conn =& $this->openConnection($this->lastUsedIndex); + + return $conn->getQueryStatistics(); + } + + /** + * Get status information from SHOW STATUS in an associative array + * + * @param string $which + * @return Array + * @access public + */ + public function getStatus($which = '%') + { + $conn =& $this->openConnection($this->lastUsedIndex); + + return $conn->getStatus($which); + } + + /** * When undefined method is called, then send it directly to last used slave server connection * * @param string $name @@ -704,5 +828,18 @@ $conn =& $this->openConnection($index); return $conn; + } + + /** + * Get slave replication lag. It will only work if the DB user has the PROCESS privilege. + * + * @return int + * @access public + */ + public function getSlaveLag() + { + $conn =& $this->openConnection($this->lastUsedIndex); + + return $conn->getSlaveLag(); - } + } } Index: core/install/prerequisites.php IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- core/install/prerequisites.php (revision 15908) +++ core/install/prerequisites.php (revision ) @@ -32,7 +32,7 @@ /** * Connection to database * - * @var kDBConnection + * @var IDBConnection * @access protected */ protected $Conn = null; @@ -62,7 +62,7 @@ /** * Checks minimal version, that could be upgradeable * - * @return kDBConnection + * @return IDBConnection */ function getConnection() { \ No newline at end of file Index: core/kernel/kbase.php IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- core/kernel/kbase.php (revision 15908) +++ core/kernel/kbase.php (revision ) @@ -31,7 +31,7 @@ /** * Connection to database * - * @var kDBConnection + * @var IDBConnection * @access protected */ protected $Conn = null; @@ -63,11 +63,11 @@ protected $prefixSpecial = ''; /** - * Set's references to kApplication and kDBConnection class instances + * Set's references to kApplication and DBConnection interface class instances * * @access public * @see kApplication - * @see kDBConnection + * @see IDBConnection */ public function __construct() { Index: core/install/install_toolkit.php IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- core/install/install_toolkit.php (revision 15908) +++ core/install/install_toolkit.php (revision ) @@ -56,7 +56,7 @@ /** * Connection to database * - * @var kDBConnection + * @var IDBConnection */ var $Conn = null; \ No newline at end of file