X-Git-Url: https://git.cyclocoop.org/%7B%7B%20url_for%28%27user%27%2C%20userid=session.user.id%29%20%7D%7D?a=blobdiff_plain;f=includes%2Flibs%2Frdbms%2Fdatabase%2FIDatabase.php;h=876821319ea7ab21de4d055c5f959ec40adbb3b8;hb=d5284e941419e4544b8f73b77e9abc59693b0f7e;hp=11bc67b2e2d608bda4d916f353169ba18a39d1e6;hpb=4c7e4575f59a6d4b1ef2e9b06d84f5a6b7514c90;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/rdbms/database/IDatabase.php b/includes/libs/rdbms/database/IDatabase.php index 11bc67b2e2..876821319e 100644 --- a/includes/libs/rdbms/database/IDatabase.php +++ b/includes/libs/rdbms/database/IDatabase.php @@ -87,11 +87,11 @@ interface IDatabase { /** @var int Combine list with OR clauses */ const LIST_OR = 4; - /** @var int Enable debug logging */ + /** @var int Enable debug logging of all SQL queries */ const DBO_DEBUG = 1; - /** @var int Disable query buffering (only one result set can be iterated at a time) */ + /** @var int Unused since 1.34 */ const DBO_NOBUFFER = 2; - /** @var int Ignore query errors (internal use only!) */ + /** @var int Unused since 1.31 */ const DBO_IGNORE = 4; /** @var int Automatically start a transaction before running a query if none is active */ const DBO_TRX = 8; @@ -138,28 +138,6 @@ interface IDatabase { */ public function getServerInfo(); - /** - * Turns buffering of SQL result sets on (true) or off (false). Default is "on". - * - * Unbuffered queries are very troublesome in MySQL: - * - * - If another query is executed while the first query is being read - * out, the first query is killed. This means you can't call normal - * Database functions while you are reading an unbuffered query result - * from a normal Database connection. - * - * - Unbuffered queries cause the MySQL server to use large amounts of - * memory and to hold broad locks which block other queries. - * - * If you want to limit client-side memory, it's almost always better to - * split up queries into batches using a LIMIT clause than to switch off - * buffering. - * - * @param null|bool $buffer - * @return null|bool The previous value of the flag - */ - public function bufferResults( $buffer = null ); - /** * Gets the current transaction level. * @@ -319,13 +297,7 @@ interface IDatabase { /** * Set a flag for this connection * - * @param int $flag DBO_* constants from Defines.php: - * - DBO_DEBUG: output some debug info (same as debug()) - * - DBO_NOBUFFER: don't buffer results (inverse of bufferResults()) - * - DBO_TRX: automatically start transactions - * - DBO_DEFAULT: automatically sets DBO_TRX if not in command line mode - * and removes it in command line mode - * - DBO_PERSISTENT: use persistant database connection + * @param int $flag One of (IDatabase::DBO_DEBUG, IDatabase::DBO_TRX) * @param string $remember IDatabase::REMEMBER_* constant [default: REMEMBER_NOTHING] */ public function setFlag( $flag, $remember = self::REMEMBER_NOTHING ); @@ -333,13 +305,7 @@ interface IDatabase { /** * Clear a flag for this connection * - * @param int $flag DBO_* constants from Defines.php: - * - DBO_DEBUG: output some debug info (same as debug()) - * - DBO_NOBUFFER: don't buffer results (inverse of bufferResults()) - * - DBO_TRX: automatically start transactions - * - DBO_DEFAULT: automatically sets DBO_TRX if not in command line mode - * and removes it in command line mode - * - DBO_PERSISTENT: use persistant database connection + * @param int $flag One of (IDatabase::DBO_DEBUG, IDatabase::DBO_TRX) * @param string $remember IDatabase::REMEMBER_* constant [default: REMEMBER_NOTHING] */ public function clearFlag( $flag, $remember = self::REMEMBER_NOTHING ); @@ -355,11 +321,7 @@ interface IDatabase { /** * Returns a boolean whether the flag $flag is set for this connection * - * @param int $flag DBO_* constants from Defines.php: - * - DBO_DEBUG: output some debug info (same as debug()) - * - DBO_NOBUFFER: don't buffer results (inverse of bufferResults()) - * - DBO_TRX: automatically start transactions - * - DBO_PERSISTENT: use persistant database connection + * @param int $flag One of the class IDatabase::DBO_* constants * @return bool */ public function getFlag( $flag ); @@ -468,8 +430,10 @@ interface IDatabase { public function lastError(); /** - * Get the number of rows affected by the last write query - * @see https://www.php.net/mysql_affected_rows + * Get the number of rows affected by the last write query. + * Similar to https://www.php.net/mysql_affected_rows but includes rows matched + * but not changed (ie. an UPDATE which sets all fields to the same value they already have). + * To get the old mysql_affected_rows behavior, include non-equality of the fields in WHERE. * * @return int */ @@ -695,10 +659,14 @@ interface IDatabase { * and then the first rows are taken until the limit is reached. LIMIT * is applied to a result set after OFFSET. * - * - FOR UPDATE: Boolean: lock the returned rows so that they can't be + * - LOCK IN SHARE MODE: Boolean: lock the returned rows so that they can't be * changed until the next COMMIT. Cannot be used with aggregate functions * (COUNT, MAX, etc., but also DISTINCT). * + * - FOR UPDATE: Boolean: lock the returned rows so that they can't be + * changed nor read with LOCK IN SHARE MODE until the next COMMIT. + * Cannot be used with aggregate functions (COUNT, MAX, etc., but also DISTINCT). + * * - DISTINCT: Boolean: return only unique result rows. * * - GROUP BY: May be either an SQL fragment string naming a field or @@ -723,16 +691,11 @@ interface IDatabase { * And also the following boolean MySQL extensions, see the MySQL manual * for documentation: * - * - LOCK IN SHARE MODE * - STRAIGHT_JOIN - * - HIGH_PRIORITY * - SQL_BIG_RESULT * - SQL_BUFFER_RESULT * - SQL_SMALL_RESULT * - SQL_CALC_FOUND_ROWS - * - SQL_CACHE - * - SQL_NO_CACHE - * * * @param string|array $join_conds Join conditions * @@ -945,7 +908,6 @@ interface IDatabase { * for logging and profiling. * @param array $options An array of UPDATE options, can be: * - IGNORE: Ignore unique key conflicts - * - LOW_PRIORITY: MySQL-specific, see MySQL manual. * @return bool Return true if no exception was thrown (deprecated since 1.33) * @throws DBError */ @@ -1135,8 +1097,8 @@ interface IDatabase { * * @param string $db * @return bool True unless an exception was thrown - * @throws DBConnectionError If databasesAreIndependent() is true and an error occurs - * @throws DBError + * @throws DBConnectionError If databasesAreIndependent() is true and connection change fails + * @throws DBError On query error or if database changes are disallowed * @deprecated Since 1.32 Use selectDomain() instead */ public function selectDB( $db ); @@ -1149,8 +1111,9 @@ interface IDatabase { * This should only be called by a load balancer or if the handle is not attached to one * * @param string|DatabaseDomain $domain + * @throws DBConnectionError If databasesAreIndependent() is true and connection change fails + * @throws DBError On query error, if domain changes are disallowed, or the domain is invalid * @since 1.32 - * @throws DBConnectionError */ public function selectDomain( $domain );