DB2Platform.php 20 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
<?php
/*
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * This software consists of voluntary contributions made by many individuals
Benjamin Eberlei's avatar
Benjamin Eberlei committed
16
 * and is licensed under the MIT license. For more information, see
17
 * <http://www.doctrine-project.org>.
Benjamin Morel's avatar
Benjamin Morel committed
18
 */
19 20 21

namespace Doctrine\DBAL\Platforms;

22
use Doctrine\DBAL\Schema\Identifier;
23 24 25
use Doctrine\DBAL\Schema\Index;
use Doctrine\DBAL\Schema\TableDiff;

26
class DB2Platform extends AbstractPlatform
27
{
Steve Müller's avatar
Steve Müller committed
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
    /**
     * {@inheritdoc}
     */
    public function getBinaryMaxLength()
    {
        return 32704;
    }

    /**
     * {@inheritdoc}
     */
    public function getBinaryDefaultLength()
    {
        return 1;
    }

44
    /**
45
     * {@inheritDoc}
46 47 48
     */
    public function getBlobTypeDeclarationSQL(array $field)
    {
49 50
        // todo blob(n) with $field['length'];
        return 'BLOB(1M)';
51 52
    }

53 54 55
    /**
     * {@inheritDoc}
     */
56 57 58 59 60 61 62 63 64 65
    public function initializeDoctrineTypeMappings()
    {
        $this->doctrineTypeMapping = array(
            'smallint'      => 'smallint',
            'bigint'        => 'bigint',
            'integer'       => 'integer',
            'time'          => 'time',
            'date'          => 'date',
            'varchar'       => 'string',
            'character'     => 'string',
Steve Müller's avatar
Steve Müller committed
66 67
            'varbinary'     => 'binary',
            'binary'        => 'binary',
68
            'clob'          => 'text',
69
            'blob'          => 'blob',
70
            'decimal'       => 'decimal',
71 72
            'double'        => 'float',
            'real'          => 'float',
73 74 75 76
            'timestamp'     => 'datetime',
        );
    }

77
    /**
78
     * {@inheritDoc}
79
     */
80
    protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed)
81 82 83 84 85
    {
        return $fixed ? ($length ? 'CHAR(' . $length . ')' : 'CHAR(255)')
                : ($length ? 'VARCHAR(' . $length . ')' : 'VARCHAR(255)');
    }

Steve Müller's avatar
Steve Müller committed
86 87 88 89 90 91 92 93
    /**
     * {@inheritdoc}
     */
    protected function getBinaryTypeDeclarationSQLSnippet($length, $fixed)
    {
        return $fixed ? 'BINARY(' . ($length ?: 255) . ')' : 'VARBINARY(' . ($length ?: 255) . ')';
    }

94
    /**
95
     * {@inheritDoc}
96 97 98 99 100 101 102 103
     */
    public function getClobTypeDeclarationSQL(array $field)
    {
        // todo clob(n) with $field['length'];
        return 'CLOB(1M)';
    }

    /**
104
     * {@inheritDoc}
105 106 107 108 109 110 111
     */
    public function getName()
    {
        return 'db2';
    }

    /**
112
     * {@inheritDoc}
113 114 115 116 117 118 119
     */
    public function getBooleanTypeDeclarationSQL(array $columnDef)
    {
        return 'SMALLINT';
    }

    /**
120
     * {@inheritDoc}
121 122 123
     */
    public function getIntegerTypeDeclarationSQL(array $columnDef)
    {
124
        return 'INTEGER' . $this->_getCommonIntegerTypeDeclarationSQL($columnDef);
125 126 127
    }

    /**
128
     * {@inheritDoc}
129 130 131
     */
    public function getBigIntTypeDeclarationSQL(array $columnDef)
    {
132
        return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($columnDef);
133 134 135
    }

    /**
136
     * {@inheritDoc}
137 138 139
     */
    public function getSmallIntTypeDeclarationSQL(array $columnDef)
    {
140
        return 'SMALLINT' . $this->_getCommonIntegerTypeDeclarationSQL($columnDef);
141 142 143
    }

    /**
144
     * {@inheritDoc}
145 146 147
     */
    protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef)
    {
148 149 150 151
        $autoinc = '';
        if ( ! empty($columnDef['autoincrement'])) {
            $autoinc = ' GENERATED BY DEFAULT AS IDENTITY';
        }
152

153
        return $autoinc;
154 155
    }

156 157
    /**
     * {@inheritdoc}
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
     */
    public function getBitAndComparisonExpression($value1, $value2)
    {
        return 'BITAND(' . $value1 . ', ' . $value2 . ')';
    }

    /**
     * {@inheritdoc}
     */
    public function getBitOrComparisonExpression($value1, $value2)
    {
        return 'BITOR(' . $value1 . ', ' . $value2 . ')';
    }

    /**
     * {@inheritdoc}
174
     */
175 176 177 178 179 180 181 182 183 184 185 186 187
    protected function getDateArithmeticIntervalExpression($date, $operator, $interval, $unit)
    {
        switch ($unit) {
            case self::DATE_INTERVAL_UNIT_WEEK:
                $interval *= 7;
                $unit = self::DATE_INTERVAL_UNIT_DAY;
                break;

            case self::DATE_INTERVAL_UNIT_QUARTER:
                $interval *= 3;
                $unit = self::DATE_INTERVAL_UNIT_MONTH;
                break;
        }
188

189
        return $date . ' ' . $operator . ' ' . $interval . ' ' . $unit;
190 191 192 193 194 195 196 197 198 199
    }

    /**
     * {@inheritdoc}
     */
    public function getDateDiffExpression($date1, $date2)
    {
        return 'DAYS(' . $date1 . ') - DAYS(' . $date2 . ')';
    }

200
    /**
201
     * {@inheritDoc}
202 203 204
     */
    public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration)
    {
205 206 207 208
        if (isset($fieldDeclaration['version']) && $fieldDeclaration['version'] == true) {
            return "TIMESTAMP(0) WITH DEFAULT";
        }

209 210 211 212
        return 'TIMESTAMP(0)';
    }

    /**
213
     * {@inheritDoc}
214 215 216 217 218 219 220
     */
    public function getDateTypeDeclarationSQL(array $fieldDeclaration)
    {
        return 'DATE';
    }

    /**
221
     * {@inheritDoc}
222 223 224 225 226 227
     */
    public function getTimeTypeDeclarationSQL(array $fieldDeclaration)
    {
        return 'TIME';
    }

228 229 230 231 232 233 234 235
    /**
     * {@inheritdoc}
     */
    public function getTruncateTableSQL($tableName, $cascade = false)
    {
        return 'TRUNCATE ' . $tableName . ' IMMEDIATE';
    }

236
    /**
237
     * This code fragment is originally from the Zend_Db_Adapter_Db2 class, but has been edited.
238 239
     *
     * @license New BSD License
Benjamin Morel's avatar
Benjamin Morel committed
240 241
     *
     * @param string $table
Christophe Coevoet's avatar
Christophe Coevoet committed
242
     * @param string $database
Benjamin Morel's avatar
Benjamin Morel committed
243
     *
244 245
     * @return string
     */
246
    public function getListTableColumnsSQL($table, $database = null)
247
    {
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288
        // We do the funky subquery and join syscat.columns.default this crazy way because
        // as of db2 v10, the column is CLOB(64k) and the distinct operator won't allow a CLOB,
        // it wants shorter stuff like a varchar.
        return "
        SELECT
          cols.default,
          subq.*
        FROM (
               SELECT DISTINCT
                 c.tabschema,
                 c.tabname,
                 c.colname,
                 c.colno,
                 c.typename,
                 c.nulls,
                 c.length,
                 c.scale,
                 c.identity,
                 tc.type AS tabconsttype,
                 k.colseq,
                 CASE
                 WHEN c.generated = 'D' THEN 1
                 ELSE 0
                 END     AS autoincrement
               FROM syscat.columns c
                 LEFT JOIN (syscat.keycoluse k JOIN syscat.tabconst tc
                     ON (k.tabschema = tc.tabschema
                         AND k.tabname = tc.tabname
                         AND tc.type = 'P'))
                   ON (c.tabschema = k.tabschema
                       AND c.tabname = k.tabname
                       AND c.colname = k.colname)
               WHERE UPPER(c.tabname) = UPPER('" . $table . "')
               ORDER BY c.colno
             ) subq
          JOIN syscat.columns cols
            ON subq.tabschema = cols.tabschema
               AND subq.tabname = cols.tabname
               AND subq.colno = cols.colno
        ORDER BY subq.colno
        ";
289 290
    }

Benjamin Morel's avatar
Benjamin Morel committed
291 292 293
    /**
     * {@inheritDoc}
     */
294 295
    public function getListTablesSQL()
    {
296
        return "SELECT NAME FROM SYSIBM.SYSTABLES WHERE TYPE = 'T'";
297 298 299
    }

    /**
300
     * {@inheritDoc}
301 302 303 304 305 306
     */
    public function getListViewsSQL($database)
    {
        return "SELECT NAME, TEXT FROM SYSIBM.SYSVIEWS";
    }

307 308 309
    /**
     * {@inheritDoc}
     */
310
    public function getListTableIndexesSQL($table, $currentDatabase = null)
311
    {
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326
        return "SELECT   idx.INDNAME AS key_name,
                         idxcol.COLNAME AS column_name,
                         CASE
                             WHEN idx.UNIQUERULE = 'P' THEN 1
                             ELSE 0
                         END AS primary,
                         CASE
                             WHEN idx.UNIQUERULE = 'D' THEN 1
                             ELSE 0
                         END AS non_unique
                FROM     SYSCAT.INDEXES AS idx
                JOIN     SYSCAT.INDEXCOLUSE AS idxcol
                ON       idx.INDSCHEMA = idxcol.INDSCHEMA AND idx.INDNAME = idxcol.INDNAME
                WHERE    idx.TABNAME = UPPER('" . $table . "')
                ORDER BY idxcol.COLSEQ ASC";
327 328
    }

Benjamin Morel's avatar
Benjamin Morel committed
329 330 331
    /**
     * {@inheritDoc}
     */
332 333
    public function getListTableForeignKeysSQL($table)
    {
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358
        return "SELECT   fkcol.COLNAME AS local_column,
                         fk.REFTABNAME AS foreign_table,
                         pkcol.COLNAME AS foreign_column,
                         fk.CONSTNAME AS index_name,
                         CASE
                             WHEN fk.UPDATERULE = 'R' THEN 'RESTRICT'
                             ELSE NULL
                         END AS on_update,
                         CASE
                             WHEN fk.DELETERULE = 'C' THEN 'CASCADE'
                             WHEN fk.DELETERULE = 'N' THEN 'SET NULL'
                             WHEN fk.DELETERULE = 'R' THEN 'RESTRICT'
                             ELSE NULL
                         END AS on_delete
                FROM     SYSCAT.REFERENCES AS fk
                JOIN     SYSCAT.KEYCOLUSE AS fkcol
                ON       fk.CONSTNAME = fkcol.CONSTNAME
                AND      fk.TABSCHEMA = fkcol.TABSCHEMA
                AND      fk.TABNAME = fkcol.TABNAME
                JOIN     SYSCAT.KEYCOLUSE AS pkcol
                ON       fk.REFKEYNAME = pkcol.CONSTNAME
                AND      fk.REFTABSCHEMA = pkcol.TABSCHEMA
                AND      fk.REFTABNAME = pkcol.TABNAME
                WHERE    fk.TABNAME = UPPER('" . $table . "')
                ORDER BY fkcol.COLSEQ ASC";
359 360
    }

Benjamin Morel's avatar
Benjamin Morel committed
361 362 363
    /**
     * {@inheritDoc}
     */
364 365 366 367 368
    public function getCreateViewSQL($name, $sql)
    {
        return "CREATE VIEW ".$name." AS ".$sql;
    }

Benjamin Morel's avatar
Benjamin Morel committed
369 370 371
    /**
     * {@inheritDoc}
     */
372 373 374 375 376
    public function getDropViewSQL($name)
    {
        return "DROP VIEW ".$name;
    }

377 378 379
    /**
     * {@inheritDoc}
     */
380 381 382 383 384
    public function getCreateDatabaseSQL($database)
    {
        return "CREATE DATABASE ".$database;
    }

385 386 387
    /**
     * {@inheritDoc}
     */
388 389
    public function getDropDatabaseSQL($database)
    {
390
        return "DROP DATABASE " . $database;
391 392
    }

393 394 395
    /**
     * {@inheritDoc}
     */
396 397 398 399
    public function supportsCreateDropDatabase()
    {
        return false;
    }
400

401
    /**
402
     * {@inheritDoc}
403 404 405 406 407 408
     */
    public function supportsReleaseSavepoints()
    {
        return false;
    }

409
    /**
410
     * {@inheritDoc}
411 412 413
     */
    public function getCurrentDateSQL()
    {
414
        return 'CURRENT DATE';
415 416 417
    }

    /**
418
     * {@inheritDoc}
419 420 421
     */
    public function getCurrentTimeSQL()
    {
422
        return 'CURRENT TIME';
423 424 425
    }

    /**
426
     * {@inheritDoc}
427
     */
428
    public function getCurrentTimestampSQL()
429
    {
430
        return "CURRENT TIMESTAMP";
431
    }
432 433

    /**
434
     * {@inheritDoc}
435 436 437 438 439 440 441
     */
    public function getIndexDeclarationSQL($name, Index $index)
    {
        return $this->getUniqueConstraintDeclarationSQL($name, $index);
    }

    /**
442
     * {@inheritDoc}
443 444 445 446 447 448 449 450
     */
    protected function _getCreateTableSQL($tableName, array $columns, array $options = array())
    {
        $indexes = array();
        if (isset($options['indexes'])) {
            $indexes = $options['indexes'];
        }
        $options['indexes'] = array();
451

452 453
        $sqls = parent::_getCreateTableSQL($tableName, $columns, $options);

454
        foreach ($indexes as $definition) {
455 456 457 458 459 460
            $sqls[] = $this->getCreateIndexSQL($definition, $tableName);
        }
        return $sqls;
    }

    /**
461
     * {@inheritDoc}
462 463 464 465
     */
    public function getAlterTableSQL(TableDiff $diff)
    {
        $sql = array();
466
        $columnSql = array();
467 468

        $queryParts = array();
469
        foreach ($diff->addedColumns as $column) {
470 471
            if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) {
                continue;
472 473
            }

474 475 476 477 478 479 480 481 482 483 484 485
            $columnDef = $column->toArray();
            $queryPart = 'ADD COLUMN ' . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnDef);

            // Adding non-nullable columns to a table requires a default value to be specified.
            if ( ! empty($columnDef['notnull']) &&
                ! isset($columnDef['default']) &&
                empty($columnDef['autoincrement'])
            ) {
                $queryPart .= ' WITH DEFAULT';
            }

            $queryParts[] = $queryPart;
486 487
        }

488
        foreach ($diff->removedColumns as $column) {
489 490
            if ($this->onSchemaAlterTableRemoveColumn($column, $diff, $columnSql)) {
                continue;
491 492
            }

493
            $queryParts[] =  'DROP COLUMN ' . $column->getQuotedName($this);
494 495
        }

496
        foreach ($diff->changedColumns as $columnDiff) {
497 498
            if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) {
                continue;
499 500
            }

501
            /* @var $columnDiff \Doctrine\DBAL\Schema\ColumnDiff */
502
            $column = $columnDiff->column;
503
            $queryParts[] =  'ALTER ' . ($columnDiff->getOldColumnName()->getQuotedName($this)) . ' '
504
                    . $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray());
505 506
        }

507
        foreach ($diff->renamedColumns as $oldColumnName => $column) {
508 509
            if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $column, $diff, $columnSql)) {
                continue;
510 511
            }

512 513 514 515
            $oldColumnName = new Identifier($oldColumnName);

            $queryParts[] =  'RENAME COLUMN ' . $oldColumnName->getQuotedName($this) .
                ' TO ' . $column->getQuotedName($this);
516 517
        }

518 519
        $tableSql = array();

520
        if ( ! $this->onSchemaAlterTable($diff, $tableSql)) {
521
            if (count($queryParts) > 0) {
522
                $sql[] = 'ALTER TABLE ' . $diff->getName()->getQuotedName($this) . ' ' . implode(" ", $queryParts);
523
            }
524

525 526
            // Some table alteration operations require a table reorganization.
            if ( ! empty($diff->removedColumns) || ! empty($diff->changedColumns)) {
527
                $sql[] = "CALL SYSPROC.ADMIN_CMD ('REORG TABLE " . $diff->getName()->getQuotedName($this) . "')";
528 529
            }

530 531 532 533 534
            $sql = array_merge(
                $this->getPreAlterTableIndexForeignKeySQL($diff),
                $sql,
                $this->getPostAlterTableIndexForeignKeySQL($diff)
            );
535

536
            if ($diff->newName !== false) {
537
                $sql[] =  'RENAME TABLE ' . $diff->getName()->getQuotedName($this) . ' TO ' . $diff->getNewName()->getQuotedName($this);
538
            }
539 540
        }

541
        return array_merge($sql, $tableSql, $columnSql);
542 543
    }

544 545 546 547 548 549
    /**
     * {@inheritDoc}
     */
    protected function getPreAlterTableIndexForeignKeySQL(TableDiff $diff)
    {
        $sql = array();
550
        $table = $diff->getName()->getQuotedName($this);
551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577

        foreach ($diff->removedIndexes as $remKey => $remIndex) {
            foreach ($diff->addedIndexes as $addKey => $addIndex) {
                if ($remIndex->getColumns() == $addIndex->getColumns()) {
                    if ($remIndex->isPrimary()) {
                        $sql[] = 'ALTER TABLE ' . $table . ' DROP PRIMARY KEY';
                    } elseif ($remIndex->isUnique()) {
                        $sql[] = 'ALTER TABLE ' . $table . ' DROP UNIQUE ' . $remIndex->getQuotedName($this);
                    } else {
                        $sql[] = $this->getDropIndexSQL($remIndex, $table);
                    }

                    $sql[] = $this->getCreateIndexSQL($addIndex, $table);

                    unset($diff->removedIndexes[$remKey]);
                    unset($diff->addedIndexes[$addKey]);

                    break;
                }
            }
        }

        $sql = array_merge($sql, parent::getPreAlterTableIndexForeignKeySQL($diff));

        return $sql;
    }

578 579 580 581 582
    /**
     * {@inheritdoc}
     */
    protected function getRenameIndexSQL($oldIndexName, Index $index, $tableName)
    {
583 584 585 586 587
        if (strpos($tableName, '.') !== false) {
            list($schema) = explode('.', $tableName);
            $oldIndexName = $schema . '.' . $oldIndexName;
        }

588 589 590
        return array('RENAME INDEX ' . $oldIndexName . ' TO ' . $index->getQuotedName($this));
    }

591 592 593
    /**
     * {@inheritDoc}
     */
594 595
    public function getDefaultValueDeclarationSQL($field)
    {
596 597
        if ( ! empty($field['autoincrement'])) {
            return '';
598 599
        }

600 601 602 603 604 605
        if (isset($field['version']) && $field['version']) {
            if ((string)$field['type'] != "DateTime") {
                $field['default'] = "1";
            }
        }

606 607 608
        return parent::getDefaultValueDeclarationSQL($field);
    }

609
    /**
610
     * {@inheritDoc}
611 612 613 614 615 616
     */
    public function getEmptyIdentityInsertSQL($tableName, $identifierColumnName)
    {
        return 'INSERT INTO ' . $tableName . ' (' . $identifierColumnName . ') VALUES (DEFAULT)';
    }

Benjamin Morel's avatar
Benjamin Morel committed
617 618 619
    /**
     * {@inheritDoc}
     */
620 621 622 623 624 625
    public function getCreateTemporaryTableSnippetSQL()
    {
        return "DECLARE GLOBAL TEMPORARY TABLE";
    }

    /**
626
     * {@inheritDoc}
627 628 629 630 631 632
     */
    public function getTemporaryTableName($tableName)
    {
        return "SESSION." . $tableName;
    }

633 634 635
    /**
     * {@inheritDoc}
     */
636
    protected function doModifyLimitQuery($query, $limit, $offset = null)
637 638 639 640 641 642 643 644 645 646 647
    {
        if ($limit === null && $offset === null) {
            return $query;
        }

        $limit = (int)$limit;
        $offset = (int)(($offset)?:0);

        // Todo OVER() needs ORDER BY data!
        $sql = 'SELECT db22.* FROM (SELECT ROW_NUMBER() OVER() AS DC_ROWNUM, db21.* '.
               'FROM (' . $query . ') db21) db22 WHERE db22.DC_ROWNUM BETWEEN ' . ($offset+1) .' AND ' . ($offset+$limit);
648

649 650 651 652
        return $sql;
    }

    /**
653
     * {@inheritDoc}
654 655 656 657 658 659
     */
    public function getLocateExpression($str, $substr, $startPos = false)
    {
        if ($startPos == false) {
            return 'LOCATE(' . $substr . ', ' . $str . ')';
        }
660 661

        return 'LOCATE(' . $substr . ', ' . $str . ', '.$startPos.')';
662 663 664
    }

    /**
665
     * {@inheritDoc}
666
     */
667
    public function getSubstringExpression($value, $from, $length = null)
668
    {
669
        if ($length === null) {
670 671
            return 'SUBSTR(' . $value . ', ' . $from . ')';
        }
672 673

        return 'SUBSTR(' . $value . ', ' . $from . ', ' . $length . ')';
674 675
    }

676 677 678
    /**
     * {@inheritDoc}
     */
679 680 681 682 683
    public function supportsIdentityColumns()
    {
        return true;
    }

684 685 686
    /**
     * {@inheritDoc}
     */
687 688 689 690
    public function prefersIdentityColumns()
    {
        return true;
    }
691 692

    /**
693
     * {@inheritDoc}
694 695 696 697 698 699 700
     *
     * DB2 returns all column names in SQL result sets in uppercase.
     */
    public function getSQLResultCasing($column)
    {
        return strtoupper($column);
    }
701

Benjamin Morel's avatar
Benjamin Morel committed
702 703 704
    /**
     * {@inheritDoc}
     */
705 706 707 708
    public function getForUpdateSQL()
    {
        return ' WITH RR USE AND KEEP UPDATE LOCKS';
    }
709

710 711 712
    /**
     * {@inheritDoc}
     */
713 714 715 716
    public function getDummySelectSQL()
    {
        return 'SELECT 1 FROM sysibm.sysdummy1';
    }
717 718

    /**
719 720
     * {@inheritDoc}
     *
721 722 723 724 725 726 727 728
     * DB2 supports savepoints, but they work semantically different than on other vendor platforms.
     *
     * TODO: We have to investigate how to get DB2 up and running with savepoints.
     */
    public function supportsSavepoints()
    {
        return false;
    }
729

730 731 732
    /**
     * {@inheritDoc}
     */
733 734 735 736
    protected function getReservedKeywordsClass()
    {
        return 'Doctrine\DBAL\Platforms\Keywords\DB2Keywords';
    }
737
}