@@ -51,318 +51,318 @@ |
||
| 51 | 51 | * @since 6.0.0 |
| 52 | 52 | */ |
| 53 | 53 | interface IDBConnection { |
| 54 | - /** |
|
| 55 | - * @deprecated 22.0.0 this is an internal event |
|
| 56 | - */ |
|
| 57 | - public const ADD_MISSING_INDEXES_EVENT = self::class . '::ADD_MISSING_INDEXES'; |
|
| 58 | - |
|
| 59 | - /** |
|
| 60 | - * @deprecated 22.0.0 this is an internal event |
|
| 61 | - */ |
|
| 62 | - public const CHECK_MISSING_INDEXES_EVENT = self::class . '::CHECK_MISSING_INDEXES'; |
|
| 63 | - |
|
| 64 | - /** |
|
| 65 | - * @deprecated 22.0.0 this is an internal event |
|
| 66 | - */ |
|
| 67 | - public const ADD_MISSING_PRIMARY_KEYS_EVENT = self::class . '::ADD_MISSING_PRIMARY_KEYS'; |
|
| 68 | - |
|
| 69 | - /** |
|
| 70 | - * @deprecated 22.0.0 this is an internal event |
|
| 71 | - */ |
|
| 72 | - public const CHECK_MISSING_PRIMARY_KEYS_EVENT = self::class . '::CHECK_MISSING_PRIMARY_KEYS'; |
|
| 73 | - |
|
| 74 | - /** |
|
| 75 | - * @deprecated 22.0.0 this is an internal event |
|
| 76 | - */ |
|
| 77 | - public const ADD_MISSING_COLUMNS_EVENT = self::class . '::ADD_MISSING_COLUMNS'; |
|
| 78 | - |
|
| 79 | - /** |
|
| 80 | - * @deprecated 22.0.0 this is an internal event |
|
| 81 | - */ |
|
| 82 | - public const CHECK_MISSING_COLUMNS_EVENT = self::class . '::CHECK_MISSING_COLUMNS'; |
|
| 83 | - |
|
| 84 | - /** |
|
| 85 | - * Gets the QueryBuilder for the connection. |
|
| 86 | - * |
|
| 87 | - * @return \OCP\DB\QueryBuilder\IQueryBuilder |
|
| 88 | - * @since 8.2.0 |
|
| 89 | - */ |
|
| 90 | - public function getQueryBuilder(); |
|
| 91 | - |
|
| 92 | - /** |
|
| 93 | - * Used to abstract the ownCloud database access away |
|
| 94 | - * @param string $sql the sql query with ? placeholder for params |
|
| 95 | - * @param int $limit the maximum number of rows |
|
| 96 | - * @param int $offset from which row we want to start |
|
| 97 | - * @return IPreparedStatement The prepared statement. |
|
| 98 | - * @since 6.0.0 |
|
| 99 | - * @throws Exception since 21.0.0 |
|
| 100 | - */ |
|
| 101 | - public function prepare($sql, $limit = null, $offset = null): IPreparedStatement; |
|
| 102 | - |
|
| 103 | - /** |
|
| 104 | - * Executes an, optionally parameterized, SQL query. |
|
| 105 | - * |
|
| 106 | - * If the query is parameterized, a prepared statement is used. |
|
| 107 | - * If an SQLLogger is configured, the execution is logged. |
|
| 108 | - * |
|
| 109 | - * @param string $sql The SQL query to execute. |
|
| 110 | - * @param string[] $params The parameters to bind to the query, if any. |
|
| 111 | - * @param array $types The types the previous parameters are in. |
|
| 112 | - * @return IResult The executed statement. |
|
| 113 | - * @since 8.0.0 |
|
| 114 | - * @throws Exception since 21.0.0 |
|
| 115 | - */ |
|
| 116 | - public function executeQuery(string $sql, array $params = [], $types = []): IResult; |
|
| 117 | - |
|
| 118 | - /** |
|
| 119 | - * Executes an SQL INSERT/UPDATE/DELETE query with the given parameters |
|
| 120 | - * and returns the number of affected rows. |
|
| 121 | - * |
|
| 122 | - * This method supports PDO binding types as well as DBAL mapping types. |
|
| 123 | - * |
|
| 124 | - * @param string $sql The SQL query. |
|
| 125 | - * @param array $params The query parameters. |
|
| 126 | - * @param array $types The parameter types. |
|
| 127 | - * @return int The number of affected rows. |
|
| 128 | - * @since 8.0.0 |
|
| 129 | - * @throws Exception since 21.0.0 |
|
| 130 | - * |
|
| 131 | - * @deprecated 21.0.0 use executeStatement |
|
| 132 | - */ |
|
| 133 | - public function executeUpdate(string $sql, array $params = [], array $types = []): int; |
|
| 134 | - |
|
| 135 | - /** |
|
| 136 | - * Executes an SQL INSERT/UPDATE/DELETE query with the given parameters |
|
| 137 | - * and returns the number of affected rows. |
|
| 138 | - * |
|
| 139 | - * This method supports PDO binding types as well as DBAL mapping types. |
|
| 140 | - * |
|
| 141 | - * @param string $sql The SQL query. |
|
| 142 | - * @param array $params The query parameters. |
|
| 143 | - * @param array $types The parameter types. |
|
| 144 | - * @return int The number of affected rows. |
|
| 145 | - * @since 21.0.0 |
|
| 146 | - * @throws Exception since 21.0.0 |
|
| 147 | - */ |
|
| 148 | - public function executeStatement($sql, array $params = [], array $types = []): int; |
|
| 149 | - |
|
| 150 | - /** |
|
| 151 | - * Used to get the id of the just inserted element |
|
| 152 | - * @param string $table the name of the table where we inserted the item |
|
| 153 | - * @return int the id of the inserted element |
|
| 154 | - * @since 6.0.0 |
|
| 155 | - * @throws Exception since 21.0.0 |
|
| 156 | - * @deprecated 21.0.0 use \OCP\DB\QueryBuilder\IQueryBuilder::getLastInsertId |
|
| 157 | - */ |
|
| 158 | - public function lastInsertId(string $table): int; |
|
| 159 | - |
|
| 160 | - /** |
|
| 161 | - * Insert a row if the matching row does not exists. To accomplish proper race condition avoidance |
|
| 162 | - * it is needed that there is also a unique constraint on the values. Then this method will |
|
| 163 | - * catch the exception and return 0. |
|
| 164 | - * |
|
| 165 | - * @param string $table The table name (will replace *PREFIX* with the actual prefix) |
|
| 166 | - * @param array $input data that should be inserted into the table (column name => value) |
|
| 167 | - * @param array|null $compare List of values that should be checked for "if not exists" |
|
| 168 | - * If this is null or an empty array, all keys of $input will be compared |
|
| 169 | - * Please note: text fields (clob) must not be used in the compare array |
|
| 170 | - * @return int number of inserted rows |
|
| 171 | - * @throws Exception used to be the removed dbal exception, since 21.0.0 it's \OCP\DB\Exception |
|
| 172 | - * @since 6.0.0 - parameter $compare was added in 8.1.0, return type changed from boolean in 8.1.0 |
|
| 173 | - * @deprecated 15.0.0 - use unique index and "try { $db->insert() } catch (UniqueConstraintViolationException $e) {}" instead, because it is more reliable and does not have the risk for deadlocks - see https://github.com/nextcloud/server/pull/12371 |
|
| 174 | - */ |
|
| 175 | - public function insertIfNotExist(string $table, array $input, array $compare = null); |
|
| 176 | - |
|
| 177 | - |
|
| 178 | - /** |
|
| 179 | - * |
|
| 180 | - * Insert a row if the row does not exist. Eventual conflicts during insert will be ignored. |
|
| 181 | - * |
|
| 182 | - * Implementation is not fully finished and should not be used! |
|
| 183 | - * |
|
| 184 | - * @param string $table The table name (will replace *PREFIX* with the actual prefix) |
|
| 185 | - * @param array $values data that should be inserted into the table (column name => value) |
|
| 186 | - * @return int number of inserted rows |
|
| 187 | - * @since 16.0.0 |
|
| 188 | - */ |
|
| 189 | - public function insertIgnoreConflict(string $table,array $values) : int; |
|
| 190 | - |
|
| 191 | - /** |
|
| 192 | - * Insert or update a row value |
|
| 193 | - * |
|
| 194 | - * @param string $table |
|
| 195 | - * @param array $keys (column name => value) |
|
| 196 | - * @param array $values (column name => value) |
|
| 197 | - * @param array $updatePreconditionValues ensure values match preconditions (column name => value) |
|
| 198 | - * @return int number of new rows |
|
| 199 | - * @throws Exception used to be the removed dbal exception, since 21.0.0 it's \OCP\DB\Exception |
|
| 200 | - * @throws PreconditionNotMetException |
|
| 201 | - * @since 9.0.0 |
|
| 202 | - */ |
|
| 203 | - public function setValues($table, array $keys, array $values, array $updatePreconditionValues = []): int; |
|
| 204 | - |
|
| 205 | - /** |
|
| 206 | - * Create an exclusive read+write lock on a table |
|
| 207 | - * |
|
| 208 | - * Important Note: Due to the nature how locks work on different DBs, it is |
|
| 209 | - * only possible to lock one table at a time. You should also NOT start a |
|
| 210 | - * transaction while holding a lock. |
|
| 211 | - * |
|
| 212 | - * @param string $tableName |
|
| 213 | - * @throws Exception since 21.0.0 |
|
| 214 | - * @since 9.1.0 |
|
| 215 | - */ |
|
| 216 | - public function lockTable($tableName): void; |
|
| 217 | - |
|
| 218 | - /** |
|
| 219 | - * Release a previous acquired lock again |
|
| 220 | - * |
|
| 221 | - * @throws Exception since 21.0.0 |
|
| 222 | - * @since 9.1.0 |
|
| 223 | - */ |
|
| 224 | - public function unlockTable(): void; |
|
| 225 | - |
|
| 226 | - /** |
|
| 227 | - * Start a transaction |
|
| 228 | - * @since 6.0.0 |
|
| 229 | - * @throws Exception since 21.0.0 |
|
| 230 | - */ |
|
| 231 | - public function beginTransaction(): void; |
|
| 232 | - |
|
| 233 | - /** |
|
| 234 | - * Check if a transaction is active |
|
| 235 | - * |
|
| 236 | - * @return bool |
|
| 237 | - * @since 8.2.0 |
|
| 238 | - */ |
|
| 239 | - public function inTransaction(): bool; |
|
| 240 | - |
|
| 241 | - /** |
|
| 242 | - * Commit the database changes done during a transaction that is in progress |
|
| 243 | - * @since 6.0.0 |
|
| 244 | - * @throws Exception since 21.0.0 |
|
| 245 | - */ |
|
| 246 | - public function commit(): void; |
|
| 247 | - |
|
| 248 | - /** |
|
| 249 | - * Rollback the database changes done during a transaction that is in progress |
|
| 250 | - * @since 6.0.0 |
|
| 251 | - * @throws Exception since 21.0.0 |
|
| 252 | - */ |
|
| 253 | - public function rollBack(): void; |
|
| 254 | - |
|
| 255 | - /** |
|
| 256 | - * Gets the error code and message as a string for logging |
|
| 257 | - * @return string |
|
| 258 | - * @since 6.0.0 |
|
| 259 | - * @deprecated 21.0.0 doesn't return anything meaningful |
|
| 260 | - */ |
|
| 261 | - public function getError(): string; |
|
| 262 | - |
|
| 263 | - /** |
|
| 264 | - * Fetch the SQLSTATE associated with the last database operation. |
|
| 265 | - * |
|
| 266 | - * @return integer The last error code. |
|
| 267 | - * @since 8.0.0 |
|
| 268 | - * @deprecated 21.0.0 doesn't return anything anymore |
|
| 269 | - */ |
|
| 270 | - public function errorCode(); |
|
| 271 | - |
|
| 272 | - /** |
|
| 273 | - * Fetch extended error information associated with the last database operation. |
|
| 274 | - * |
|
| 275 | - * @return array The last error information. |
|
| 276 | - * @since 8.0.0 |
|
| 277 | - * @deprecated 21.0.0 doesn't return anything anymore |
|
| 278 | - */ |
|
| 279 | - public function errorInfo(); |
|
| 280 | - |
|
| 281 | - /** |
|
| 282 | - * Establishes the connection with the database. |
|
| 283 | - * |
|
| 284 | - * @return bool |
|
| 285 | - * @throws Exception since 21.0.0 |
|
| 286 | - * @since 8.0.0 |
|
| 287 | - */ |
|
| 288 | - public function connect(): bool; |
|
| 289 | - |
|
| 290 | - /** |
|
| 291 | - * Close the database connection |
|
| 292 | - * @since 8.0.0 |
|
| 293 | - */ |
|
| 294 | - public function close(): void; |
|
| 295 | - |
|
| 296 | - /** |
|
| 297 | - * Quotes a given input parameter. |
|
| 298 | - * |
|
| 299 | - * @param mixed $input Parameter to be quoted. |
|
| 300 | - * @param int $type Type of the parameter. |
|
| 301 | - * @return mixed The quoted parameter. |
|
| 302 | - * @since 8.0.0 |
|
| 303 | - */ |
|
| 304 | - public function quote($input, $type = IQueryBuilder::PARAM_STR); |
|
| 305 | - |
|
| 306 | - /** |
|
| 307 | - * Gets the DatabasePlatform instance that provides all the metadata about |
|
| 308 | - * the platform this driver connects to. |
|
| 309 | - * |
|
| 310 | - * @return \Doctrine\DBAL\Platforms\AbstractPlatform The database platform. |
|
| 311 | - * @since 8.0.0 |
|
| 312 | - */ |
|
| 313 | - public function getDatabasePlatform(); |
|
| 314 | - |
|
| 315 | - /** |
|
| 316 | - * Drop a table from the database if it exists |
|
| 317 | - * |
|
| 318 | - * @param string $table table name without the prefix |
|
| 319 | - * @throws Exception since 21.0.0 |
|
| 320 | - * @since 8.0.0 |
|
| 321 | - */ |
|
| 322 | - public function dropTable(string $table): void; |
|
| 323 | - |
|
| 324 | - /** |
|
| 325 | - * Check if a table exists |
|
| 326 | - * |
|
| 327 | - * @param string $table table name without the prefix |
|
| 328 | - * @return bool |
|
| 329 | - * @throws Exception since 21.0.0 |
|
| 330 | - * @since 8.0.0 |
|
| 331 | - */ |
|
| 332 | - public function tableExists(string $table): bool; |
|
| 333 | - |
|
| 334 | - /** |
|
| 335 | - * Escape a parameter to be used in a LIKE query |
|
| 336 | - * |
|
| 337 | - * @param string $param |
|
| 338 | - * @return string |
|
| 339 | - * @since 9.0.0 |
|
| 340 | - */ |
|
| 341 | - public function escapeLikeParameter(string $param): string; |
|
| 342 | - |
|
| 343 | - /** |
|
| 344 | - * Check whether or not the current database support 4byte wide unicode |
|
| 345 | - * |
|
| 346 | - * @return bool |
|
| 347 | - * @since 11.0.0 |
|
| 348 | - */ |
|
| 349 | - public function supports4ByteText(): bool; |
|
| 350 | - |
|
| 351 | - /** |
|
| 352 | - * Create the schema of the connected database |
|
| 353 | - * |
|
| 354 | - * @return Schema |
|
| 355 | - * @throws Exception since 21.0.0 |
|
| 356 | - * @since 13.0.0 |
|
| 357 | - */ |
|
| 358 | - public function createSchema(): Schema; |
|
| 359 | - |
|
| 360 | - /** |
|
| 361 | - * Migrate the database to the given schema |
|
| 362 | - * |
|
| 363 | - * @param Schema $toSchema |
|
| 364 | - * @throws Exception since 21.0.0 |
|
| 365 | - * @since 13.0.0 |
|
| 366 | - */ |
|
| 367 | - public function migrateToSchema(Schema $toSchema): void; |
|
| 54 | + /** |
|
| 55 | + * @deprecated 22.0.0 this is an internal event |
|
| 56 | + */ |
|
| 57 | + public const ADD_MISSING_INDEXES_EVENT = self::class . '::ADD_MISSING_INDEXES'; |
|
| 58 | + |
|
| 59 | + /** |
|
| 60 | + * @deprecated 22.0.0 this is an internal event |
|
| 61 | + */ |
|
| 62 | + public const CHECK_MISSING_INDEXES_EVENT = self::class . '::CHECK_MISSING_INDEXES'; |
|
| 63 | + |
|
| 64 | + /** |
|
| 65 | + * @deprecated 22.0.0 this is an internal event |
|
| 66 | + */ |
|
| 67 | + public const ADD_MISSING_PRIMARY_KEYS_EVENT = self::class . '::ADD_MISSING_PRIMARY_KEYS'; |
|
| 68 | + |
|
| 69 | + /** |
|
| 70 | + * @deprecated 22.0.0 this is an internal event |
|
| 71 | + */ |
|
| 72 | + public const CHECK_MISSING_PRIMARY_KEYS_EVENT = self::class . '::CHECK_MISSING_PRIMARY_KEYS'; |
|
| 73 | + |
|
| 74 | + /** |
|
| 75 | + * @deprecated 22.0.0 this is an internal event |
|
| 76 | + */ |
|
| 77 | + public const ADD_MISSING_COLUMNS_EVENT = self::class . '::ADD_MISSING_COLUMNS'; |
|
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * @deprecated 22.0.0 this is an internal event |
|
| 81 | + */ |
|
| 82 | + public const CHECK_MISSING_COLUMNS_EVENT = self::class . '::CHECK_MISSING_COLUMNS'; |
|
| 83 | + |
|
| 84 | + /** |
|
| 85 | + * Gets the QueryBuilder for the connection. |
|
| 86 | + * |
|
| 87 | + * @return \OCP\DB\QueryBuilder\IQueryBuilder |
|
| 88 | + * @since 8.2.0 |
|
| 89 | + */ |
|
| 90 | + public function getQueryBuilder(); |
|
| 91 | + |
|
| 92 | + /** |
|
| 93 | + * Used to abstract the ownCloud database access away |
|
| 94 | + * @param string $sql the sql query with ? placeholder for params |
|
| 95 | + * @param int $limit the maximum number of rows |
|
| 96 | + * @param int $offset from which row we want to start |
|
| 97 | + * @return IPreparedStatement The prepared statement. |
|
| 98 | + * @since 6.0.0 |
|
| 99 | + * @throws Exception since 21.0.0 |
|
| 100 | + */ |
|
| 101 | + public function prepare($sql, $limit = null, $offset = null): IPreparedStatement; |
|
| 102 | + |
|
| 103 | + /** |
|
| 104 | + * Executes an, optionally parameterized, SQL query. |
|
| 105 | + * |
|
| 106 | + * If the query is parameterized, a prepared statement is used. |
|
| 107 | + * If an SQLLogger is configured, the execution is logged. |
|
| 108 | + * |
|
| 109 | + * @param string $sql The SQL query to execute. |
|
| 110 | + * @param string[] $params The parameters to bind to the query, if any. |
|
| 111 | + * @param array $types The types the previous parameters are in. |
|
| 112 | + * @return IResult The executed statement. |
|
| 113 | + * @since 8.0.0 |
|
| 114 | + * @throws Exception since 21.0.0 |
|
| 115 | + */ |
|
| 116 | + public function executeQuery(string $sql, array $params = [], $types = []): IResult; |
|
| 117 | + |
|
| 118 | + /** |
|
| 119 | + * Executes an SQL INSERT/UPDATE/DELETE query with the given parameters |
|
| 120 | + * and returns the number of affected rows. |
|
| 121 | + * |
|
| 122 | + * This method supports PDO binding types as well as DBAL mapping types. |
|
| 123 | + * |
|
| 124 | + * @param string $sql The SQL query. |
|
| 125 | + * @param array $params The query parameters. |
|
| 126 | + * @param array $types The parameter types. |
|
| 127 | + * @return int The number of affected rows. |
|
| 128 | + * @since 8.0.0 |
|
| 129 | + * @throws Exception since 21.0.0 |
|
| 130 | + * |
|
| 131 | + * @deprecated 21.0.0 use executeStatement |
|
| 132 | + */ |
|
| 133 | + public function executeUpdate(string $sql, array $params = [], array $types = []): int; |
|
| 134 | + |
|
| 135 | + /** |
|
| 136 | + * Executes an SQL INSERT/UPDATE/DELETE query with the given parameters |
|
| 137 | + * and returns the number of affected rows. |
|
| 138 | + * |
|
| 139 | + * This method supports PDO binding types as well as DBAL mapping types. |
|
| 140 | + * |
|
| 141 | + * @param string $sql The SQL query. |
|
| 142 | + * @param array $params The query parameters. |
|
| 143 | + * @param array $types The parameter types. |
|
| 144 | + * @return int The number of affected rows. |
|
| 145 | + * @since 21.0.0 |
|
| 146 | + * @throws Exception since 21.0.0 |
|
| 147 | + */ |
|
| 148 | + public function executeStatement($sql, array $params = [], array $types = []): int; |
|
| 149 | + |
|
| 150 | + /** |
|
| 151 | + * Used to get the id of the just inserted element |
|
| 152 | + * @param string $table the name of the table where we inserted the item |
|
| 153 | + * @return int the id of the inserted element |
|
| 154 | + * @since 6.0.0 |
|
| 155 | + * @throws Exception since 21.0.0 |
|
| 156 | + * @deprecated 21.0.0 use \OCP\DB\QueryBuilder\IQueryBuilder::getLastInsertId |
|
| 157 | + */ |
|
| 158 | + public function lastInsertId(string $table): int; |
|
| 159 | + |
|
| 160 | + /** |
|
| 161 | + * Insert a row if the matching row does not exists. To accomplish proper race condition avoidance |
|
| 162 | + * it is needed that there is also a unique constraint on the values. Then this method will |
|
| 163 | + * catch the exception and return 0. |
|
| 164 | + * |
|
| 165 | + * @param string $table The table name (will replace *PREFIX* with the actual prefix) |
|
| 166 | + * @param array $input data that should be inserted into the table (column name => value) |
|
| 167 | + * @param array|null $compare List of values that should be checked for "if not exists" |
|
| 168 | + * If this is null or an empty array, all keys of $input will be compared |
|
| 169 | + * Please note: text fields (clob) must not be used in the compare array |
|
| 170 | + * @return int number of inserted rows |
|
| 171 | + * @throws Exception used to be the removed dbal exception, since 21.0.0 it's \OCP\DB\Exception |
|
| 172 | + * @since 6.0.0 - parameter $compare was added in 8.1.0, return type changed from boolean in 8.1.0 |
|
| 173 | + * @deprecated 15.0.0 - use unique index and "try { $db->insert() } catch (UniqueConstraintViolationException $e) {}" instead, because it is more reliable and does not have the risk for deadlocks - see https://github.com/nextcloud/server/pull/12371 |
|
| 174 | + */ |
|
| 175 | + public function insertIfNotExist(string $table, array $input, array $compare = null); |
|
| 176 | + |
|
| 177 | + |
|
| 178 | + /** |
|
| 179 | + * |
|
| 180 | + * Insert a row if the row does not exist. Eventual conflicts during insert will be ignored. |
|
| 181 | + * |
|
| 182 | + * Implementation is not fully finished and should not be used! |
|
| 183 | + * |
|
| 184 | + * @param string $table The table name (will replace *PREFIX* with the actual prefix) |
|
| 185 | + * @param array $values data that should be inserted into the table (column name => value) |
|
| 186 | + * @return int number of inserted rows |
|
| 187 | + * @since 16.0.0 |
|
| 188 | + */ |
|
| 189 | + public function insertIgnoreConflict(string $table,array $values) : int; |
|
| 190 | + |
|
| 191 | + /** |
|
| 192 | + * Insert or update a row value |
|
| 193 | + * |
|
| 194 | + * @param string $table |
|
| 195 | + * @param array $keys (column name => value) |
|
| 196 | + * @param array $values (column name => value) |
|
| 197 | + * @param array $updatePreconditionValues ensure values match preconditions (column name => value) |
|
| 198 | + * @return int number of new rows |
|
| 199 | + * @throws Exception used to be the removed dbal exception, since 21.0.0 it's \OCP\DB\Exception |
|
| 200 | + * @throws PreconditionNotMetException |
|
| 201 | + * @since 9.0.0 |
|
| 202 | + */ |
|
| 203 | + public function setValues($table, array $keys, array $values, array $updatePreconditionValues = []): int; |
|
| 204 | + |
|
| 205 | + /** |
|
| 206 | + * Create an exclusive read+write lock on a table |
|
| 207 | + * |
|
| 208 | + * Important Note: Due to the nature how locks work on different DBs, it is |
|
| 209 | + * only possible to lock one table at a time. You should also NOT start a |
|
| 210 | + * transaction while holding a lock. |
|
| 211 | + * |
|
| 212 | + * @param string $tableName |
|
| 213 | + * @throws Exception since 21.0.0 |
|
| 214 | + * @since 9.1.0 |
|
| 215 | + */ |
|
| 216 | + public function lockTable($tableName): void; |
|
| 217 | + |
|
| 218 | + /** |
|
| 219 | + * Release a previous acquired lock again |
|
| 220 | + * |
|
| 221 | + * @throws Exception since 21.0.0 |
|
| 222 | + * @since 9.1.0 |
|
| 223 | + */ |
|
| 224 | + public function unlockTable(): void; |
|
| 225 | + |
|
| 226 | + /** |
|
| 227 | + * Start a transaction |
|
| 228 | + * @since 6.0.0 |
|
| 229 | + * @throws Exception since 21.0.0 |
|
| 230 | + */ |
|
| 231 | + public function beginTransaction(): void; |
|
| 232 | + |
|
| 233 | + /** |
|
| 234 | + * Check if a transaction is active |
|
| 235 | + * |
|
| 236 | + * @return bool |
|
| 237 | + * @since 8.2.0 |
|
| 238 | + */ |
|
| 239 | + public function inTransaction(): bool; |
|
| 240 | + |
|
| 241 | + /** |
|
| 242 | + * Commit the database changes done during a transaction that is in progress |
|
| 243 | + * @since 6.0.0 |
|
| 244 | + * @throws Exception since 21.0.0 |
|
| 245 | + */ |
|
| 246 | + public function commit(): void; |
|
| 247 | + |
|
| 248 | + /** |
|
| 249 | + * Rollback the database changes done during a transaction that is in progress |
|
| 250 | + * @since 6.0.0 |
|
| 251 | + * @throws Exception since 21.0.0 |
|
| 252 | + */ |
|
| 253 | + public function rollBack(): void; |
|
| 254 | + |
|
| 255 | + /** |
|
| 256 | + * Gets the error code and message as a string for logging |
|
| 257 | + * @return string |
|
| 258 | + * @since 6.0.0 |
|
| 259 | + * @deprecated 21.0.0 doesn't return anything meaningful |
|
| 260 | + */ |
|
| 261 | + public function getError(): string; |
|
| 262 | + |
|
| 263 | + /** |
|
| 264 | + * Fetch the SQLSTATE associated with the last database operation. |
|
| 265 | + * |
|
| 266 | + * @return integer The last error code. |
|
| 267 | + * @since 8.0.0 |
|
| 268 | + * @deprecated 21.0.0 doesn't return anything anymore |
|
| 269 | + */ |
|
| 270 | + public function errorCode(); |
|
| 271 | + |
|
| 272 | + /** |
|
| 273 | + * Fetch extended error information associated with the last database operation. |
|
| 274 | + * |
|
| 275 | + * @return array The last error information. |
|
| 276 | + * @since 8.0.0 |
|
| 277 | + * @deprecated 21.0.0 doesn't return anything anymore |
|
| 278 | + */ |
|
| 279 | + public function errorInfo(); |
|
| 280 | + |
|
| 281 | + /** |
|
| 282 | + * Establishes the connection with the database. |
|
| 283 | + * |
|
| 284 | + * @return bool |
|
| 285 | + * @throws Exception since 21.0.0 |
|
| 286 | + * @since 8.0.0 |
|
| 287 | + */ |
|
| 288 | + public function connect(): bool; |
|
| 289 | + |
|
| 290 | + /** |
|
| 291 | + * Close the database connection |
|
| 292 | + * @since 8.0.0 |
|
| 293 | + */ |
|
| 294 | + public function close(): void; |
|
| 295 | + |
|
| 296 | + /** |
|
| 297 | + * Quotes a given input parameter. |
|
| 298 | + * |
|
| 299 | + * @param mixed $input Parameter to be quoted. |
|
| 300 | + * @param int $type Type of the parameter. |
|
| 301 | + * @return mixed The quoted parameter. |
|
| 302 | + * @since 8.0.0 |
|
| 303 | + */ |
|
| 304 | + public function quote($input, $type = IQueryBuilder::PARAM_STR); |
|
| 305 | + |
|
| 306 | + /** |
|
| 307 | + * Gets the DatabasePlatform instance that provides all the metadata about |
|
| 308 | + * the platform this driver connects to. |
|
| 309 | + * |
|
| 310 | + * @return \Doctrine\DBAL\Platforms\AbstractPlatform The database platform. |
|
| 311 | + * @since 8.0.0 |
|
| 312 | + */ |
|
| 313 | + public function getDatabasePlatform(); |
|
| 314 | + |
|
| 315 | + /** |
|
| 316 | + * Drop a table from the database if it exists |
|
| 317 | + * |
|
| 318 | + * @param string $table table name without the prefix |
|
| 319 | + * @throws Exception since 21.0.0 |
|
| 320 | + * @since 8.0.0 |
|
| 321 | + */ |
|
| 322 | + public function dropTable(string $table): void; |
|
| 323 | + |
|
| 324 | + /** |
|
| 325 | + * Check if a table exists |
|
| 326 | + * |
|
| 327 | + * @param string $table table name without the prefix |
|
| 328 | + * @return bool |
|
| 329 | + * @throws Exception since 21.0.0 |
|
| 330 | + * @since 8.0.0 |
|
| 331 | + */ |
|
| 332 | + public function tableExists(string $table): bool; |
|
| 333 | + |
|
| 334 | + /** |
|
| 335 | + * Escape a parameter to be used in a LIKE query |
|
| 336 | + * |
|
| 337 | + * @param string $param |
|
| 338 | + * @return string |
|
| 339 | + * @since 9.0.0 |
|
| 340 | + */ |
|
| 341 | + public function escapeLikeParameter(string $param): string; |
|
| 342 | + |
|
| 343 | + /** |
|
| 344 | + * Check whether or not the current database support 4byte wide unicode |
|
| 345 | + * |
|
| 346 | + * @return bool |
|
| 347 | + * @since 11.0.0 |
|
| 348 | + */ |
|
| 349 | + public function supports4ByteText(): bool; |
|
| 350 | + |
|
| 351 | + /** |
|
| 352 | + * Create the schema of the connected database |
|
| 353 | + * |
|
| 354 | + * @return Schema |
|
| 355 | + * @throws Exception since 21.0.0 |
|
| 356 | + * @since 13.0.0 |
|
| 357 | + */ |
|
| 358 | + public function createSchema(): Schema; |
|
| 359 | + |
|
| 360 | + /** |
|
| 361 | + * Migrate the database to the given schema |
|
| 362 | + * |
|
| 363 | + * @param Schema $toSchema |
|
| 364 | + * @throws Exception since 21.0.0 |
|
| 365 | + * @since 13.0.0 |
|
| 366 | + */ |
|
| 367 | + public function migrateToSchema(Schema $toSchema): void; |
|
| 368 | 368 | } |
@@ -54,32 +54,32 @@ discard block |
||
| 54 | 54 | /** |
| 55 | 55 | * @deprecated 22.0.0 this is an internal event |
| 56 | 56 | */ |
| 57 | - public const ADD_MISSING_INDEXES_EVENT = self::class . '::ADD_MISSING_INDEXES'; |
|
| 57 | + public const ADD_MISSING_INDEXES_EVENT = self::class.'::ADD_MISSING_INDEXES'; |
|
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | 60 | * @deprecated 22.0.0 this is an internal event |
| 61 | 61 | */ |
| 62 | - public const CHECK_MISSING_INDEXES_EVENT = self::class . '::CHECK_MISSING_INDEXES'; |
|
| 62 | + public const CHECK_MISSING_INDEXES_EVENT = self::class.'::CHECK_MISSING_INDEXES'; |
|
| 63 | 63 | |
| 64 | 64 | /** |
| 65 | 65 | * @deprecated 22.0.0 this is an internal event |
| 66 | 66 | */ |
| 67 | - public const ADD_MISSING_PRIMARY_KEYS_EVENT = self::class . '::ADD_MISSING_PRIMARY_KEYS'; |
|
| 67 | + public const ADD_MISSING_PRIMARY_KEYS_EVENT = self::class.'::ADD_MISSING_PRIMARY_KEYS'; |
|
| 68 | 68 | |
| 69 | 69 | /** |
| 70 | 70 | * @deprecated 22.0.0 this is an internal event |
| 71 | 71 | */ |
| 72 | - public const CHECK_MISSING_PRIMARY_KEYS_EVENT = self::class . '::CHECK_MISSING_PRIMARY_KEYS'; |
|
| 72 | + public const CHECK_MISSING_PRIMARY_KEYS_EVENT = self::class.'::CHECK_MISSING_PRIMARY_KEYS'; |
|
| 73 | 73 | |
| 74 | 74 | /** |
| 75 | 75 | * @deprecated 22.0.0 this is an internal event |
| 76 | 76 | */ |
| 77 | - public const ADD_MISSING_COLUMNS_EVENT = self::class . '::ADD_MISSING_COLUMNS'; |
|
| 77 | + public const ADD_MISSING_COLUMNS_EVENT = self::class.'::ADD_MISSING_COLUMNS'; |
|
| 78 | 78 | |
| 79 | 79 | /** |
| 80 | 80 | * @deprecated 22.0.0 this is an internal event |
| 81 | 81 | */ |
| 82 | - public const CHECK_MISSING_COLUMNS_EVENT = self::class . '::CHECK_MISSING_COLUMNS'; |
|
| 82 | + public const CHECK_MISSING_COLUMNS_EVENT = self::class.'::CHECK_MISSING_COLUMNS'; |
|
| 83 | 83 | |
| 84 | 84 | /** |
| 85 | 85 | * Gets the QueryBuilder for the connection. |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | * @return int number of inserted rows |
| 187 | 187 | * @since 16.0.0 |
| 188 | 188 | */ |
| 189 | - public function insertIgnoreConflict(string $table,array $values) : int; |
|
| 189 | + public function insertIgnoreConflict(string $table, array $values) : int; |
|
| 190 | 190 | |
| 191 | 191 | /** |
| 192 | 192 | * Insert or update a row value |