summaryrefslogtreecommitdiff
path: root/includes/db/IORMTable.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/db/IORMTable.php')
-rw-r--r--includes/db/IORMTable.php91
1 files changed, 80 insertions, 11 deletions
diff --git a/includes/db/IORMTable.php b/includes/db/IORMTable.php
index 99413f99..36865655 100644
--- a/includes/db/IORMTable.php
+++ b/includes/db/IORMTable.php
@@ -23,7 +23,7 @@
* @file
* @ingroup ORM
*
- * @licence GNU GPL v2 or later
+ * @license GNU GPL v2 or later
* @author Jeroen De Dauw < jeroendedauw@gmail.com >
*/
@@ -97,6 +97,8 @@ interface IORMTable {
* Selects the the specified fields of the records matching the provided
* conditions and returns them as DBDataObject. Field names get prefixed.
*
+ * @see DatabaseBase::select()
+ *
* @since 1.20
*
* @param array|string|null $fields
@@ -104,7 +106,8 @@ interface IORMTable {
* @param array $options
* @param string|null $functionName
*
- * @return ORMResult
+ * @return ORMResult The result set
+ * @throws DBQueryError if the query failed (even if the database was in ignoreErrors mode)
*/
public function select( $fields = null, array $conditions = array(),
array $options = array(), $functionName = null );
@@ -136,6 +139,7 @@ interface IORMTable {
* @param null|string $functionName
*
* @return ResultWrapper
+ * @throws DBQueryError if the query failed (even if the database was in ignoreErrors mode)
*/
public function rawSelect( $fields = null, array $conditions = array(),
array $options = array(), $functionName = null );
@@ -230,6 +234,15 @@ interface IORMTable {
public function has( array $conditions = array() );
/**
+ * Checks if the table exists
+ *
+ * @since 1.21
+ *
+ * @return boolean
+ */
+ public function exists();
+
+ /**
* Returns the amount of matching records.
* Condition field names get prefixed.
*
@@ -299,6 +312,71 @@ interface IORMTable {
public function setReadDb( $db );
/**
+ * Get the ID of the any foreign wiki to use as a target for database operations
+ *
+ * @since 1.20
+ *
+ * @return String|bool The target wiki, in a form that LBFactory understands (or false if the local wiki is used)
+ */
+ public function getTargetWiki();
+
+ /**
+ * Set the ID of the any foreign wiki to use as a target for database operations
+ *
+ * @param string|bool $wiki The target wiki, in a form that LBFactory understands (or false if the local wiki shall be used)
+ *
+ * @since 1.20
+ */
+ public function setTargetWiki( $wiki );
+
+ /**
+ * Get the database type used for read operations.
+ * This is to be used instead of wfGetDB.
+ *
+ * @see LoadBalancer::getConnection
+ *
+ * @since 1.20
+ *
+ * @return DatabaseBase The database object
+ */
+ public function getReadDbConnection();
+
+ /**
+ * Get the database type used for read operations.
+ * This is to be used instead of wfGetDB.
+ *
+ * @see LoadBalancer::getConnection
+ *
+ * @since 1.20
+ *
+ * @return DatabaseBase The database object
+ */
+ public function getWriteDbConnection();
+
+ /**
+ * Get the database type used for read operations.
+ *
+ * @see wfGetLB
+ *
+ * @since 1.20
+ *
+ * @return LoadBalancer The database load balancer object
+ */
+ public function getLoadBalancer();
+
+ /**
+ * Releases the lease on the given database connection. This is useful mainly
+ * for connections to a foreign wiki. It does nothing for connections to the local wiki.
+ *
+ * @see LoadBalancer::reuseConnection
+ *
+ * @param DatabaseBase $db the database
+ *
+ * @since 1.20
+ */
+ public function releaseConnection( DatabaseBase $db );
+
+ /**
* Update the records matching the provided conditions by
* setting the fields that are keys in the $values param to
* their corresponding values.
@@ -381,15 +459,6 @@ interface IORMTable {
public function unprefixFieldName( $fieldName );
/**
- * Get an instance of this class.
- *
- * @since 1.20
- *
- * @return IORMTable
- */
- public static function singleton();
-
- /**
* Get an array with fields from a database result,
* that can be fed directly to the constructor or
* to setFields.