Failed Conditions
Pull Request — master (#2849)
by Luís
63:28
created

testQuotesTableNameInListTableColumnsSQL()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Doctrine\Tests\DBAL\Platforms;
4
5
use Doctrine\DBAL\DBALException;
6
use Doctrine\DBAL\Platforms\SqlitePlatform;
7
use Doctrine\DBAL\Schema\Column;
8
use Doctrine\DBAL\Schema\Table;
9
use Doctrine\DBAL\Schema\TableDiff;
10
use Doctrine\DBAL\Types\Type;
11
12
class SqlitePlatformTest extends AbstractPlatformTestCase
13
{
14
    public function createPlatform()
15
    {
16
        return new SqlitePlatform;
17
    }
18
19
    public function getGenerateTableSql()
20
    {
21
        return 'CREATE TABLE test (id INTEGER NOT NULL, test VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))';
22
    }
23
24
    public function getGenerateTableWithMultiColumnUniqueIndexSql()
25
    {
26
        return array(
27
            'CREATE TABLE test (foo VARCHAR(255) DEFAULT NULL, bar VARCHAR(255) DEFAULT NULL)',
28
            'CREATE UNIQUE INDEX UNIQ_D87F7E0C8C73652176FF8CAA ON test (foo, bar)',
29
        );
30
    }
31
32
    public function testGeneratesSqlSnippets()
33
    {
34
        self::assertEquals('REGEXP', $this->_platform->getRegexpExpression(), 'Regular expression operator is not correct');
35
        self::assertEquals('SUBSTR(column, 5, LENGTH(column))', $this->_platform->getSubstringExpression('column', 5), 'Substring expression without length is not correct');
36
        self::assertEquals('SUBSTR(column, 0, 5)', $this->_platform->getSubstringExpression('column', 0, 5), 'Substring expression with length is not correct');
37
    }
38
39 View Code Duplication
    public function testGeneratesTransactionCommands()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
40
    {
41
        self::assertEquals(
42
            'PRAGMA read_uncommitted = 0',
43
            $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_UNCOMMITTED)
44
        );
45
        self::assertEquals(
46
            'PRAGMA read_uncommitted = 1',
47
            $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_COMMITTED)
48
        );
49
        self::assertEquals(
50
            'PRAGMA read_uncommitted = 1',
51
            $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_REPEATABLE_READ)
52
        );
53
        self::assertEquals(
54
            'PRAGMA read_uncommitted = 1',
55
            $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_SERIALIZABLE)
56
        );
57
    }
58
59
    public function testPrefersIdentityColumns()
60
    {
61
        self::assertTrue($this->_platform->prefersIdentityColumns());
62
    }
63
64
    public function testIgnoresUnsignedIntegerDeclarationForAutoIncrementalIntegers()
65
    {
66
        self::assertSame(
67
            'INTEGER',
68
            $this->_platform->getIntegerTypeDeclarationSQL(array('autoincrement' => true, 'unsigned' => true))
69
        );
70
    }
71
72
    /**
73
     * @group DBAL-752
74
     * @group DBAL-924
75
     */
76
    public function testGeneratesTypeDeclarationForTinyIntegers()
77
    {
78
        self::assertEquals(
79
            'TINYINT',
80
            $this->_platform->getTinyIntTypeDeclarationSQL(array())
0 ignored issues
show
Bug introduced by
The method getTinyIntTypeDeclarationSQL() does not exist on Doctrine\DBAL\Platforms\AbstractPlatform. Did you maybe mean getBigIntTypeDeclarationSQL()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
81
        );
82
        self::assertEquals(
83
            'INTEGER',
84
            $this->_platform->getTinyIntTypeDeclarationSQL(array('autoincrement' => true))
0 ignored issues
show
Bug introduced by
The method getTinyIntTypeDeclarationSQL() does not exist on Doctrine\DBAL\Platforms\AbstractPlatform. Did you maybe mean getBigIntTypeDeclarationSQL()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
85
        );
86
        self::assertEquals(
87
            'INTEGER',
88
            $this->_platform->getTinyIntTypeDeclarationSQL(
0 ignored issues
show
Bug introduced by
The method getTinyIntTypeDeclarationSQL() does not exist on Doctrine\DBAL\Platforms\AbstractPlatform. Did you maybe mean getBigIntTypeDeclarationSQL()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
89
                array('autoincrement' => true, 'primary' => true)
90
            )
91
        );
92
        self::assertEquals(
93
            'TINYINT',
94
            $this->_platform->getTinyIntTypeDeclarationSQL(array('unsigned' => false))
0 ignored issues
show
Bug introduced by
The method getTinyIntTypeDeclarationSQL() does not exist on Doctrine\DBAL\Platforms\AbstractPlatform. Did you maybe mean getBigIntTypeDeclarationSQL()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
95
        );
96
        self::assertEquals(
97
            'TINYINT UNSIGNED',
98
            $this->_platform->getTinyIntTypeDeclarationSQL(array('unsigned' => true))
0 ignored issues
show
Bug introduced by
The method getTinyIntTypeDeclarationSQL() does not exist on Doctrine\DBAL\Platforms\AbstractPlatform. Did you maybe mean getBigIntTypeDeclarationSQL()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
99
        );
100
    }
101
102
    /**
103
     * @group DBAL-752
104
     * @group DBAL-924
105
     */
106 View Code Duplication
    public function testGeneratesTypeDeclarationForSmallIntegers()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
107
    {
108
        self::assertEquals(
109
            'SMALLINT',
110
            $this->_platform->getSmallIntTypeDeclarationSQL(array())
111
        );
112
        self::assertEquals(
113
            'INTEGER',
114
            $this->_platform->getSmallIntTypeDeclarationSQL(array('autoincrement' => true))
115
        );
116
        self::assertEquals(
117
            'INTEGER',
118
            $this->_platform->getTinyIntTypeDeclarationSQL(array('autoincrement' => true, 'unsigned' => true))
0 ignored issues
show
Bug introduced by
The method getTinyIntTypeDeclarationSQL() does not exist on Doctrine\DBAL\Platforms\AbstractPlatform. Did you maybe mean getBigIntTypeDeclarationSQL()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
119
        );
120
        self::assertEquals(
121
            'INTEGER',
122
            $this->_platform->getSmallIntTypeDeclarationSQL(
123
                array('autoincrement' => true, 'primary' => true)
124
            )
125
        );
126
        self::assertEquals(
127
            'SMALLINT',
128
            $this->_platform->getSmallIntTypeDeclarationSQL(array('unsigned' => false))
129
        );
130
        self::assertEquals(
131
            'SMALLINT UNSIGNED',
132
            $this->_platform->getSmallIntTypeDeclarationSQL(array('unsigned' => true))
133
        );
134
    }
135
136
    /**
137
     * @group DBAL-752
138
     * @group DBAL-924
139
     */
140 View Code Duplication
    public function testGeneratesTypeDeclarationForMediumIntegers()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
141
    {
142
        self::assertEquals(
143
            'MEDIUMINT',
144
            $this->_platform->getMediumIntTypeDeclarationSQL(array())
0 ignored issues
show
Bug introduced by
It seems like you code against a specific sub-type and not the parent class Doctrine\DBAL\Platforms\AbstractPlatform as the method getMediumIntTypeDeclarationSQL() does only exist in the following sub-classes of Doctrine\DBAL\Platforms\AbstractPlatform: Doctrine\DBAL\Platforms\SqlitePlatform. Maybe you want to instanceof check for one of these explicitly?

Let’s take a look at an example:

abstract class User
{
    /** @return string */
    abstract public function getPassword();
}

class MyUser extends User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the parent class:

    abstract class User
    {
        /** @return string */
        abstract public function getPassword();
    
        /** @return string */
        abstract public function getDisplayName();
    }
    
Loading history...
145
        );
146
        self::assertEquals(
147
            'INTEGER',
148
            $this->_platform->getMediumIntTypeDeclarationSQL(array('autoincrement' => true))
0 ignored issues
show
Bug introduced by
It seems like you code against a specific sub-type and not the parent class Doctrine\DBAL\Platforms\AbstractPlatform as the method getMediumIntTypeDeclarationSQL() does only exist in the following sub-classes of Doctrine\DBAL\Platforms\AbstractPlatform: Doctrine\DBAL\Platforms\SqlitePlatform. Maybe you want to instanceof check for one of these explicitly?

Let’s take a look at an example:

abstract class User
{
    /** @return string */
    abstract public function getPassword();
}

class MyUser extends User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the parent class:

    abstract class User
    {
        /** @return string */
        abstract public function getPassword();
    
        /** @return string */
        abstract public function getDisplayName();
    }
    
Loading history...
149
        );
150
        self::assertEquals(
151
            'INTEGER',
152
            $this->_platform->getMediumIntTypeDeclarationSQL(array('autoincrement' => true, 'unsigned' => true))
0 ignored issues
show
Bug introduced by
It seems like you code against a specific sub-type and not the parent class Doctrine\DBAL\Platforms\AbstractPlatform as the method getMediumIntTypeDeclarationSQL() does only exist in the following sub-classes of Doctrine\DBAL\Platforms\AbstractPlatform: Doctrine\DBAL\Platforms\SqlitePlatform. Maybe you want to instanceof check for one of these explicitly?

Let’s take a look at an example:

abstract class User
{
    /** @return string */
    abstract public function getPassword();
}

class MyUser extends User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the parent class:

    abstract class User
    {
        /** @return string */
        abstract public function getPassword();
    
        /** @return string */
        abstract public function getDisplayName();
    }
    
Loading history...
153
        );
154
        self::assertEquals(
155
            'INTEGER',
156
            $this->_platform->getMediumIntTypeDeclarationSQL(
0 ignored issues
show
Bug introduced by
It seems like you code against a specific sub-type and not the parent class Doctrine\DBAL\Platforms\AbstractPlatform as the method getMediumIntTypeDeclarationSQL() does only exist in the following sub-classes of Doctrine\DBAL\Platforms\AbstractPlatform: Doctrine\DBAL\Platforms\SqlitePlatform. Maybe you want to instanceof check for one of these explicitly?

Let’s take a look at an example:

abstract class User
{
    /** @return string */
    abstract public function getPassword();
}

class MyUser extends User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the parent class:

    abstract class User
    {
        /** @return string */
        abstract public function getPassword();
    
        /** @return string */
        abstract public function getDisplayName();
    }
    
Loading history...
157
                array('autoincrement' => true, 'primary' => true)
158
            )
159
        );
160
        self::assertEquals(
161
            'MEDIUMINT',
162
            $this->_platform->getMediumIntTypeDeclarationSQL(array('unsigned' => false))
0 ignored issues
show
Bug introduced by
It seems like you code against a specific sub-type and not the parent class Doctrine\DBAL\Platforms\AbstractPlatform as the method getMediumIntTypeDeclarationSQL() does only exist in the following sub-classes of Doctrine\DBAL\Platforms\AbstractPlatform: Doctrine\DBAL\Platforms\SqlitePlatform. Maybe you want to instanceof check for one of these explicitly?

Let’s take a look at an example:

abstract class User
{
    /** @return string */
    abstract public function getPassword();
}

class MyUser extends User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the parent class:

    abstract class User
    {
        /** @return string */
        abstract public function getPassword();
    
        /** @return string */
        abstract public function getDisplayName();
    }
    
Loading history...
163
        );
164
        self::assertEquals(
165
            'MEDIUMINT UNSIGNED',
166
            $this->_platform->getMediumIntTypeDeclarationSQL(array('unsigned' => true))
0 ignored issues
show
Bug introduced by
It seems like you code against a specific sub-type and not the parent class Doctrine\DBAL\Platforms\AbstractPlatform as the method getMediumIntTypeDeclarationSQL() does only exist in the following sub-classes of Doctrine\DBAL\Platforms\AbstractPlatform: Doctrine\DBAL\Platforms\SqlitePlatform. Maybe you want to instanceof check for one of these explicitly?

Let’s take a look at an example:

abstract class User
{
    /** @return string */
    abstract public function getPassword();
}

class MyUser extends User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the parent class:

    abstract class User
    {
        /** @return string */
        abstract public function getPassword();
    
        /** @return string */
        abstract public function getDisplayName();
    }
    
Loading history...
167
        );
168
    }
169
170 View Code Duplication
    public function testGeneratesTypeDeclarationForIntegers()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
171
    {
172
        self::assertEquals(
173
            'INTEGER',
174
            $this->_platform->getIntegerTypeDeclarationSQL(array())
175
        );
176
        self::assertEquals(
177
            'INTEGER',
178
            $this->_platform->getIntegerTypeDeclarationSQL(array('autoincrement' => true))
179
        );
180
        self::assertEquals(
181
            'INTEGER',
182
            $this->_platform->getIntegerTypeDeclarationSQL(array('autoincrement' => true, 'unsigned' => true))
183
        );
184
        self::assertEquals(
185
            'INTEGER',
186
            $this->_platform->getIntegerTypeDeclarationSQL(
187
                array('autoincrement' => true, 'primary' => true)
188
            )
189
        );
190
        self::assertEquals(
191
            'INTEGER',
192
            $this->_platform->getIntegerTypeDeclarationSQL(array('unsigned' => false))
193
        );
194
        self::assertEquals(
195
            'INTEGER UNSIGNED',
196
            $this->_platform->getIntegerTypeDeclarationSQL(array('unsigned' => true))
197
        );
198
    }
199
200
    /**
201
     * @group DBAL-752
202
     * @group DBAL-924
203
     */
204 View Code Duplication
    public function testGeneratesTypeDeclarationForBigIntegers()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
205
    {
206
        self::assertEquals(
207
            'BIGINT',
208
            $this->_platform->getBigIntTypeDeclarationSQL(array())
209
        );
210
        self::assertEquals(
211
            'INTEGER',
212
            $this->_platform->getBigIntTypeDeclarationSQL(array('autoincrement' => true))
213
        );
214
        self::assertEquals(
215
            'INTEGER',
216
            $this->_platform->getBigIntTypeDeclarationSQL(array('autoincrement' => true, 'unsigned' => true))
217
        );
218
        self::assertEquals(
219
            'INTEGER',
220
            $this->_platform->getBigIntTypeDeclarationSQL(
221
                array('autoincrement' => true, 'primary' => true)
222
            )
223
        );
224
        self::assertEquals(
225
            'BIGINT',
226
            $this->_platform->getBigIntTypeDeclarationSQL(array('unsigned' => false))
227
        );
228
        self::assertEquals(
229
            'BIGINT UNSIGNED',
230
            $this->_platform->getBigIntTypeDeclarationSQL(array('unsigned' => true))
231
        );
232
    }
233
234 View Code Duplication
    public function testGeneratesTypeDeclarationForStrings()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
235
    {
236
        self::assertEquals(
237
            'CHAR(10)',
238
            $this->_platform->getVarcharTypeDeclarationSQL(
239
                array('length' => 10, 'fixed' => true)
240
            )
241
        );
242
        self::assertEquals(
243
            'VARCHAR(50)',
244
            $this->_platform->getVarcharTypeDeclarationSQL(array('length' => 50)),
245
            'Variable string declaration is not correct'
246
        );
247
        self::assertEquals(
248
            'VARCHAR(255)',
249
            $this->_platform->getVarcharTypeDeclarationSQL(array()),
250
            'Long string declaration is not correct'
251
        );
252
    }
253
254
    public function getGenerateIndexSql()
255
    {
256
        return 'CREATE INDEX my_idx ON mytable (user_name, last_login)';
257
    }
258
259
    public function getGenerateUniqueIndexSql()
260
    {
261
        return 'CREATE UNIQUE INDEX index_name ON test (test, test2)';
262
    }
263
264
    /**
265
     * @expectedException \Doctrine\DBAL\DBALException
266
     */
267
    public function testGeneratesForeignKeyCreationSql()
268
    {
269
        parent::testGeneratesForeignKeyCreationSql();
270
    }
271
272
    /**
273
     * @expectedException \Doctrine\DBAL\DBALException
274
     */
275
    public function testGeneratesConstraintCreationSql()
276
    {
277
        parent::testGeneratesConstraintCreationSql();
278
    }
279
280
    public function getGenerateForeignKeySql()
281
    {
282
        return null;
283
    }
284
285
    public function testModifyLimitQuery()
286
    {
287
        $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user', 10, 0);
288
        self::assertEquals('SELECT * FROM user LIMIT 10 OFFSET 0', $sql);
289
    }
290
291
    public function testModifyLimitQueryWithEmptyOffset()
292
    {
293
        $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user', 10);
294
        self::assertEquals('SELECT * FROM user LIMIT 10', $sql);
295
    }
296
297
    public function testModifyLimitQueryWithOffsetAndEmptyLimit()
298
    {
299
        $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user', null, 10);
300
        self::assertEquals('SELECT * FROM user LIMIT -1 OFFSET 10', $sql);
301
    }
302
303
    public function getGenerateAlterTableSql()
304
    {
305
        return array(
306
            "CREATE TEMPORARY TABLE __temp__mytable AS SELECT id, bar, bloo FROM mytable",
307
            "DROP TABLE mytable",
308
            "CREATE TABLE mytable (id INTEGER NOT NULL, baz VARCHAR(255) DEFAULT 'def' NOT NULL, bloo BOOLEAN DEFAULT '0' NOT NULL, quota INTEGER DEFAULT NULL, PRIMARY KEY(id))",
309
            "INSERT INTO mytable (id, baz, bloo) SELECT id, bar, bloo FROM __temp__mytable",
310
            "DROP TABLE __temp__mytable",
311
            "ALTER TABLE mytable RENAME TO userlist",
312
        );
313
    }
314
315
    /**
316
     * @group DDC-1845
317
     */
318
    public function testGenerateTableSqlShouldNotAutoQuotePrimaryKey()
319
    {
320
        $table = new \Doctrine\DBAL\Schema\Table('test');
321
        $table->addColumn('"like"', 'integer', array('notnull' => true, 'autoincrement' => true));
322
        $table->setPrimaryKey(array('"like"'));
323
324
        $createTableSQL = $this->_platform->getCreateTableSQL($table);
325
        self::assertEquals(
326
            'CREATE TABLE test ("like" INTEGER NOT NULL, PRIMARY KEY("like"))',
327
            $createTableSQL[0]
328
        );
329
    }
330
331 View Code Duplication
    public function testAlterTableAddColumns()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
332
    {
333
        $diff                        = new TableDiff('user');
334
        $diff->addedColumns['foo']   = new Column('foo', Type::getType('string'));
335
        $diff->addedColumns['count'] = new Column('count', Type::getType('integer'), array('notnull' => false, 'default' => 1));
336
337
        $expected = array(
338
            'ALTER TABLE user ADD COLUMN foo VARCHAR(255) NOT NULL',
339
            'ALTER TABLE user ADD COLUMN count INTEGER DEFAULT 1',
340
        );
341
342
        self::assertEquals($expected, $this->_platform->getAlterTableSQL($diff));
343
    }
344
345
    /**
346
     * @dataProvider complexDiffProvider
347
     */
348
    public function testAlterTableAddComplexColumns(TableDiff $diff) : void
349
    {
350
        $this->expectException(DBALException::class);
351
352
        $this->_platform->getAlterTableSQL($diff);
353
    }
354
355
    public function complexDiffProvider() : array
356
    {
357
        $date                       = new TableDiff('user');
358
        $date->addedColumns['time'] = new Column('time', Type::getType('date'), array('default' => 'CURRENT_DATE'));
359
360
361
        $id                     = new TableDiff('user');
362
        $id->addedColumns['id'] = new Column('id', Type::getType('integer'), array('autoincrement' => true));
363
364
        return [
365
            'date column with default value' => [$date],
366
            'id column with auto increment'  => [$id],
367
        ];
368
    }
369
370
    public function testCreateTableWithDeferredForeignKeys()
371
    {
372
        $table = new Table('user');
373
        $table->addColumn('id', 'integer');
374
        $table->addColumn('article', 'integer');
375
        $table->addColumn('post', 'integer');
376
        $table->addColumn('parent', 'integer');
377
        $table->setPrimaryKey(array('id'));
378
        $table->addForeignKeyConstraint('article', array('article'), array('id'), array('deferrable' => true));
379
        $table->addForeignKeyConstraint('post', array('post'), array('id'), array('deferred' => true));
380
        $table->addForeignKeyConstraint('user', array('parent'), array('id'), array('deferrable' => true, 'deferred' => true));
381
382
        $sql = array(
383
            'CREATE TABLE user ('
384
                . 'id INTEGER NOT NULL, article INTEGER NOT NULL, post INTEGER NOT NULL, parent INTEGER NOT NULL'
385
                . ', PRIMARY KEY(id)'
386
                . ', CONSTRAINT FK_8D93D64923A0E66 FOREIGN KEY (article) REFERENCES article (id) DEFERRABLE INITIALLY IMMEDIATE'
387
                . ', CONSTRAINT FK_8D93D6495A8A6C8D FOREIGN KEY (post) REFERENCES post (id) NOT DEFERRABLE INITIALLY DEFERRED'
388
                . ', CONSTRAINT FK_8D93D6493D8E604F FOREIGN KEY (parent) REFERENCES user (id) DEFERRABLE INITIALLY DEFERRED'
389
                . ')',
390
            'CREATE INDEX IDX_8D93D64923A0E66 ON user (article)',
391
            'CREATE INDEX IDX_8D93D6495A8A6C8D ON user (post)',
392
            'CREATE INDEX IDX_8D93D6493D8E604F ON user (parent)',
393
        );
394
395
        self::assertEquals($sql, $this->_platform->getCreateTableSQL($table));
396
    }
397
398
    public function testAlterTable()
399
    {
400
        $table = new Table('user');
401
        $table->addColumn('id', 'integer');
402
        $table->addColumn('article', 'integer');
403
        $table->addColumn('post', 'integer');
404
        $table->addColumn('parent', 'integer');
405
        $table->setPrimaryKey(array('id'));
406
        $table->addForeignKeyConstraint('article', array('article'), array('id'), array('deferrable' => true));
407
        $table->addForeignKeyConstraint('post', array('post'), array('id'), array('deferred' => true));
408
        $table->addForeignKeyConstraint('user', array('parent'), array('id'), array('deferrable' => true, 'deferred' => true));
409
        $table->addIndex(array('article', 'post'), 'index1');
410
411
        $diff                           = new TableDiff('user');
412
        $diff->fromTable                = $table;
413
        $diff->newName                  = 'client';
414
        $diff->renamedColumns['id']     = new \Doctrine\DBAL\Schema\Column('key', \Doctrine\DBAL\Types\Type::getType('integer'), array());
415
        $diff->renamedColumns['post']   = new \Doctrine\DBAL\Schema\Column('comment', \Doctrine\DBAL\Types\Type::getType('integer'), array());
416
        $diff->removedColumns['parent'] = new \Doctrine\DBAL\Schema\Column('comment', \Doctrine\DBAL\Types\Type::getType('integer'), array());
417
        $diff->removedIndexes['index1'] = $table->getIndex('index1');
418
419
        $sql = array(
420
            'DROP INDEX IDX_8D93D64923A0E66',
421
            'DROP INDEX IDX_8D93D6495A8A6C8D',
422
            'DROP INDEX IDX_8D93D6493D8E604F',
423
            'DROP INDEX index1',
424
            'CREATE TEMPORARY TABLE __temp__user AS SELECT id, article, post FROM user',
425
            'DROP TABLE user',
426
            'CREATE TABLE user ('
427
                . '"key" INTEGER NOT NULL, article INTEGER NOT NULL, comment INTEGER NOT NULL'
428
                . ', PRIMARY KEY("key")'
429
                . ', CONSTRAINT FK_8D93D64923A0E66 FOREIGN KEY (article) REFERENCES article (id) DEFERRABLE INITIALLY IMMEDIATE'
430
                . ', CONSTRAINT FK_8D93D6495A8A6C8D FOREIGN KEY (comment) REFERENCES post (id) NOT DEFERRABLE INITIALLY DEFERRED'
431
                . ')',
432
            'INSERT INTO user ("key", article, comment) SELECT id, article, post FROM __temp__user',
433
            'DROP TABLE __temp__user',
434
            'ALTER TABLE user RENAME TO client',
435
            'CREATE INDEX IDX_8D93D64923A0E66 ON client (article)',
436
            'CREATE INDEX IDX_8D93D6495A8A6C8D ON client (comment)',
437
        );
438
439
        self::assertEquals($sql, $this->_platform->getAlterTableSQL($diff));
440
    }
441
442
    protected function getQuotedColumnInPrimaryKeySQL()
443
    {
444
        return array(
445
            'CREATE TABLE "quoted" ("create" VARCHAR(255) NOT NULL, PRIMARY KEY("create"))',
446
        );
447
    }
448
449
    protected function getQuotedColumnInIndexSQL()
450
    {
451
        return array(
452
            'CREATE TABLE "quoted" ("create" VARCHAR(255) NOT NULL)',
453
            'CREATE INDEX IDX_22660D028FD6E0FB ON "quoted" ("create")',
454
        );
455
    }
456
457
    protected function getQuotedNameInIndexSQL()
458
    {
459
        return array(
460
            'CREATE TABLE test (column1 VARCHAR(255) NOT NULL)',
461
            'CREATE INDEX "key" ON test (column1)',
462
        );
463
    }
464
465
    protected function getQuotedColumnInForeignKeySQL()
466
    {
467
        return array(
468
            'CREATE TABLE "quoted" (' .
469
            '"create" VARCHAR(255) NOT NULL, foo VARCHAR(255) NOT NULL, "bar" VARCHAR(255) NOT NULL, ' .
470
            'CONSTRAINT FK_WITH_RESERVED_KEYWORD FOREIGN KEY ("create", foo, "bar") REFERENCES "foreign" ("create", bar, "foo-bar") NOT DEFERRABLE INITIALLY IMMEDIATE, ' .
471
            'CONSTRAINT FK_WITH_NON_RESERVED_KEYWORD FOREIGN KEY ("create", foo, "bar") REFERENCES foo ("create", bar, "foo-bar") NOT DEFERRABLE INITIALLY IMMEDIATE, ' .
472
            'CONSTRAINT FK_WITH_INTENDED_QUOTATION FOREIGN KEY ("create", foo, "bar") REFERENCES "foo-bar" ("create", bar, "foo-bar") NOT DEFERRABLE INITIALLY IMMEDIATE)',
473
        );
474
    }
475
476
    protected function getBinaryDefaultLength()
477
    {
478
        return 0;
479
    }
480
481
    protected function getBinaryMaxLength()
482
    {
483
        return 0;
484
    }
485
486 View Code Duplication
    public function testReturnsBinaryTypeDeclarationSQL()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
487
    {
488
        self::assertSame('BLOB', $this->_platform->getBinaryTypeDeclarationSQL(array()));
489
        self::assertSame('BLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 0)));
490
        self::assertSame('BLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 9999999)));
491
492
        self::assertSame('BLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true)));
493
        self::assertSame('BLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 0)));
494
        self::assertSame('BLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 9999999)));
495
    }
496
497
    /**
498
     * @group DBAL-234
499
     */
500
    protected function getAlterTableRenameIndexSQL()
501
    {
502
        return array(
503
            'CREATE TEMPORARY TABLE __temp__mytable AS SELECT id FROM mytable',
504
            'DROP TABLE mytable',
505
            'CREATE TABLE mytable (id INTEGER NOT NULL, PRIMARY KEY(id))',
506
            'INSERT INTO mytable (id) SELECT id FROM __temp__mytable',
507
            'DROP TABLE __temp__mytable',
508
            'CREATE INDEX idx_bar ON mytable (id)',
509
        );
510
    }
511
512
    /**
513
     * @group DBAL-234
514
     */
515
    protected function getQuotedAlterTableRenameIndexSQL()
516
    {
517
        return array(
518
            'CREATE TEMPORARY TABLE __temp__table AS SELECT id FROM "table"',
519
            'DROP TABLE "table"',
520
            'CREATE TABLE "table" (id INTEGER NOT NULL, PRIMARY KEY(id))',
521
            'INSERT INTO "table" (id) SELECT id FROM __temp__table',
522
            'DROP TABLE __temp__table',
523
            'CREATE INDEX "select" ON "table" (id)',
524
            'CREATE INDEX "bar" ON "table" (id)',
525
        );
526
    }
527
528
    /**
529
     * {@inheritdoc}
530
     */
531
    protected function getQuotedAlterTableRenameColumnSQL()
532
    {
533
        return array(
534
            'CREATE TEMPORARY TABLE __temp__mytable AS SELECT unquoted1, unquoted2, unquoted3, "create", "table", "select", "quoted1", "quoted2", "quoted3" FROM mytable',
535
            'DROP TABLE mytable',
536
            'CREATE TABLE mytable (unquoted INTEGER NOT NULL --Unquoted 1
537
, "where" INTEGER NOT NULL --Unquoted 2
538
, "foo" INTEGER NOT NULL --Unquoted 3
539
, reserved_keyword INTEGER NOT NULL --Reserved keyword 1
540
, "from" INTEGER NOT NULL --Reserved keyword 2
541
, "bar" INTEGER NOT NULL --Reserved keyword 3
542
, quoted INTEGER NOT NULL --Quoted 1
543
, "and" INTEGER NOT NULL --Quoted 2
544
, "baz" INTEGER NOT NULL --Quoted 3
545
)',
546
            'INSERT INTO mytable (unquoted, "where", "foo", reserved_keyword, "from", "bar", quoted, "and", "baz") SELECT unquoted1, unquoted2, unquoted3, "create", "table", "select", "quoted1", "quoted2", "quoted3" FROM __temp__mytable',
547
            'DROP TABLE __temp__mytable',
548
        );
549
    }
550
551
    /**
552
     * {@inheritdoc}
553
     */
554
    protected function getQuotedAlterTableChangeColumnLengthSQL()
555
    {
556
        return array(
557
            'CREATE TEMPORARY TABLE __temp__mytable AS SELECT unquoted1, unquoted2, unquoted3, "create", "table", "select" FROM mytable',
558
            'DROP TABLE mytable',
559
            'CREATE TABLE mytable (unquoted1 VARCHAR(255) NOT NULL --Unquoted 1
560
, unquoted2 VARCHAR(255) NOT NULL --Unquoted 2
561
, unquoted3 VARCHAR(255) NOT NULL --Unquoted 3
562
, "create" VARCHAR(255) NOT NULL --Reserved keyword 1
563
, "table" VARCHAR(255) NOT NULL --Reserved keyword 2
564
, "select" VARCHAR(255) NOT NULL --Reserved keyword 3
565
)',
566
            'INSERT INTO mytable (unquoted1, unquoted2, unquoted3, "create", "table", "select") SELECT unquoted1, unquoted2, unquoted3, "create", "table", "select" FROM __temp__mytable',
567
            'DROP TABLE __temp__mytable',
568
        );
569
    }
570
571
    /**
572
     * @group DBAL-807
573
     */
574
    public function testAlterTableRenameIndexInSchema()
575
    {
576
        $this->markTestIncomplete(
577
            'Test currently produces broken SQL due to SQLLitePlatform::getAlterTable being broken ' .
578
            'when used with schemas.'
579
        );
580
    }
581
582
    /**
583
     * @group DBAL-807
584
     */
585
    public function testQuotesAlterTableRenameIndexInSchema()
586
    {
587
        $this->markTestIncomplete(
588
            'Test currently produces broken SQL due to SQLLitePlatform::getAlterTable being broken ' .
589
            'when used with schemas.'
590
        );
591
    }
592
593
    /**
594
     * @group DBAL-423
595
     */
596
    public function testReturnsGuidTypeDeclarationSQL()
597
    {
598
        self::assertSame('CHAR(36)', $this->_platform->getGuidTypeDeclarationSQL(array()));
599
    }
600
601
    /**
602
     * {@inheritdoc}
603
     */
604
    public function getAlterTableRenameColumnSQL()
605
    {
606
        return array(
607
            'CREATE TEMPORARY TABLE __temp__foo AS SELECT bar FROM foo',
608
            'DROP TABLE foo',
609
            'CREATE TABLE foo (baz INTEGER DEFAULT 666 NOT NULL --rename test
610
)',
611
            'INSERT INTO foo (baz) SELECT bar FROM __temp__foo',
612
            'DROP TABLE __temp__foo',
613
        );
614
    }
615
616
    /**
617
     * {@inheritdoc}
618
     */
619
    protected function getQuotesTableIdentifiersInAlterTableSQL()
620
    {
621
        return array(
622
            'DROP INDEX IDX_8C736521A81E660E',
623
            'DROP INDEX IDX_8C736521FDC58D6C',
624
            'CREATE TEMPORARY TABLE __temp__foo AS SELECT fk, fk2, id, fk3, bar FROM "foo"',
625
            'DROP TABLE "foo"',
626
            'CREATE TABLE "foo" (fk2 INTEGER NOT NULL, fk3 INTEGER NOT NULL, fk INTEGER NOT NULL, war INTEGER NOT NULL, ' .
627
            'bar INTEGER DEFAULT NULL, bloo INTEGER NOT NULL, ' .
628
            'CONSTRAINT fk2 FOREIGN KEY (fk2) REFERENCES fk_table2 (id) NOT DEFERRABLE INITIALLY IMMEDIATE, ' .
629
            'CONSTRAINT fk_add FOREIGN KEY (fk3) REFERENCES fk_table (id) NOT DEFERRABLE INITIALLY IMMEDIATE)',
630
            'INSERT INTO "foo" (fk, fk2, war, fk3, bar) SELECT fk, fk2, id, fk3, bar FROM __temp__foo',
631
            'DROP TABLE __temp__foo',
632
            'ALTER TABLE "foo" RENAME TO "table"',
633
            'CREATE INDEX IDX_8C736521A81E660E ON "table" (fk)',
634
            'CREATE INDEX IDX_8C736521FDC58D6C ON "table" (fk2)',
635
        );
636
    }
637
638
    /**
639
     * {@inheritdoc}
640
     */
641
    protected function getCommentOnColumnSQL()
642
    {
643
        return array(
644
            'COMMENT ON COLUMN foo.bar IS \'comment\'',
645
            'COMMENT ON COLUMN "Foo"."BAR" IS \'comment\'',
646
            'COMMENT ON COLUMN "select"."from" IS \'comment\'',
647
        );
648
    }
649
650
    protected function getInlineColumnCommentDelimiter()
651
    {
652
        return "\n";
653
    }
654
655
    protected function getInlineColumnRegularCommentSQL()
656
    {
657
        return "--Regular comment\n";
658
    }
659
660
    protected function getInlineColumnCommentRequiringEscapingSQL()
661
    {
662
        return "--Using inline comment delimiter \n-- works\n";
663
    }
664
665
    protected function getInlineColumnEmptyCommentSQL()
666
    {
667
        return "--\n";
668
    }
669
670
    /**
671
     * {@inheritdoc}
672
     */
673
    protected function getQuotesReservedKeywordInUniqueConstraintDeclarationSQL()
674
    {
675
        return 'CONSTRAINT "select" UNIQUE (foo)';
676
    }
677
678
    /**
679
     * {@inheritdoc}
680
     */
681
    protected function getQuotesReservedKeywordInIndexDeclarationSQL()
682
    {
683
        return 'INDEX "select" (foo)';
684
    }
685
686
    /**
687
     * {@inheritdoc}
688
     */
689
    protected function getQuotesReservedKeywordInTruncateTableSQL()
690
    {
691
        return 'DELETE FROM "select"';
692
    }
693
694
    /**
695
     * {@inheritdoc}
696
     */
697
    protected function getAlterStringToFixedStringSQL()
698
    {
699
        return array(
700
            'CREATE TEMPORARY TABLE __temp__mytable AS SELECT name FROM mytable',
701
            'DROP TABLE mytable',
702
            'CREATE TABLE mytable (name CHAR(2) NOT NULL)',
703
            'INSERT INTO mytable (name) SELECT name FROM __temp__mytable',
704
            'DROP TABLE __temp__mytable',
705
        );
706
    }
707
708
    /**
709
     * {@inheritdoc}
710
     */
711
    protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL()
712
    {
713
        return array(
714
            'DROP INDEX idx_foo',
715
            'DROP INDEX idx_bar',
716
            'CREATE TEMPORARY TABLE __temp__mytable AS SELECT foo, bar, baz FROM mytable',
717
            'DROP TABLE mytable',
718
            'CREATE TABLE mytable (foo INTEGER NOT NULL, bar INTEGER NOT NULL, baz INTEGER NOT NULL, CONSTRAINT fk_foo FOREIGN KEY (foo) REFERENCES foreign_table (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT fk_bar FOREIGN KEY (bar) REFERENCES foreign_table (id) NOT DEFERRABLE INITIALLY IMMEDIATE)',
719
            'INSERT INTO mytable (foo, bar, baz) SELECT foo, bar, baz FROM __temp__mytable',
720
            'DROP TABLE __temp__mytable',
721
            'CREATE INDEX idx_bar ON mytable (bar)',
722
            'CREATE INDEX idx_foo_renamed ON mytable (foo)',
723
        );
724
    }
725
726
    /**
727
     * @group DBAL-2436
728
     */
729
    public function testQuotesTableNameInListTableConstraintsSQL()
730
    {
731
        self::assertContains("'Foo''Bar\\'", $this->_platform->getListTableConstraintsSQL("Foo'Bar\\"), '', true);
732
    }
733
734
    /**
735
     * @group DBAL-2436
736
     */
737
    public function testQuotesTableNameInListTableColumnsSQL()
738
    {
739
        self::assertContains("'Foo''Bar\\'", $this->_platform->getListTableColumnsSQL("Foo'Bar\\"), '', true);
740
    }
741
742
    /**
743
     * @group DBAL-2436
744
     */
745
    public function testQuotesTableNameInListTableIndexesSQL()
746
    {
747
        self::assertContains("'Foo''Bar\\'", $this->_platform->getListTableIndexesSQL("Foo'Bar\\"), '', true);
748
    }
749
750
    /**
751
     * @group DBAL-2436
752
     */
753
    public function testQuotesTableNameInListTableForeignKeysSQL()
754
    {
755
        self::assertContains("'Foo''Bar\\'", $this->_platform->getListTableForeignKeysSQL("Foo'Bar\\"), '', true);
756
    }
757
}
758