Commit e7202aaa authored by Walt Sorensen's avatar Walt Sorensen Committed by GitHub

Merge branch 'master' into patch-2

parents cc551cbd 7963f131
......@@ -8,7 +8,6 @@ cache:
- $HOME/.composer/cache
php:
- 5.6
- 7.0
- 7.1
- nightly
......@@ -21,10 +20,6 @@ env:
matrix:
fast_finish: true
include:
- php: 5.6
env: DB=mariadb MARIADB_VERSION=10.0
addons:
mariadb: 10.0
- php: 7.0
env: DB=mariadb MARIADB_VERSION=10.0
addons:
......@@ -45,10 +40,6 @@ matrix:
mariadb: 10.0
env: DB=mariadb MARIADB_VERSION=10.0
- php: 5.6
env: DB=mariadb MARIADB_VERSION=10.1
addons:
mariadb: 10.1
- php: 7.0
env: DB=mariadb MARIADB_VERSION=10.1
addons:
......@@ -69,12 +60,6 @@ matrix:
mariadb: 10.1
env: DB=mariadb MARIADB_VERSION=10.1
- php: 5.6
addons:
postgresql: "9.2"
services:
- postgresql
env: DB=pgsql POSTGRESQL_VERSION=9.2
- php: 7.0
addons:
postgresql: "9.2"
......@@ -94,12 +79,6 @@ matrix:
- postgresql
env: DB=pgsql POSTGRESQL_VERSION=9.2
- php: 5.6
addons:
postgresql: "9.3"
services:
- postgresql
env: DB=pgsql POSTGRESQL_VERSION=9.3
- php: 7.0
addons:
postgresql: "9.3"
......@@ -119,12 +98,6 @@ matrix:
- postgresql
env: DB=pgsql POSTGRESQL_VERSION=9.3
- php: 5.6
addons:
postgresql: "9.4"
services:
- postgresql
env: DB=pgsql POSTGRESQL_VERSION=9.4
- php: 7.0
addons:
postgresql: "9.4"
......@@ -144,14 +117,6 @@ matrix:
- postgresql
env: DB=pgsql POSTGRESQL_VERSION=9.4
- php: 5.6
sudo: false
dist: trusty
addons:
postgresql: "9.5"
services:
- postgresql
env: DB=pgsql POSTGRESQL_VERSION=9.5
- php: 7.0
sudo: false
dist: trusty
......@@ -177,14 +142,6 @@ matrix:
- postgresql
env: DB=pgsql POSTGRESQL_VERSION=9.5
- php: 5.6
sudo: false
dist: trusty
addons:
postgresql: "9.6"
services:
- postgresql
env: DB=pgsql POSTGRESQL_VERSION=9.6
- php: 7.0
sudo: false
dist: trusty
......@@ -287,13 +244,12 @@ matrix:
allow_failures:
- php: hhvm
- php: nightly
- php: 5.6
env: DB=pgsql POSTGRESQL_VERSION=9.5
- php: 7.0
env: DB=pgsql POSTGRESQL_VERSION=9.5
- php: 7.1
env: DB=pgsql POSTGRESQL_VERSION=9.5
- php: 5.6
- php: nightly
env: DB=pgsql POSTGRESQL_VERSION=9.6
- php: 7.0
env: DB=pgsql POSTGRESQL_VERSION=9.6
......
......@@ -12,8 +12,8 @@
{"name": "Jonathan Wage", "email": "jonwage@gmail.com"}
],
"require": {
"php": "^5.6 || ^7.0",
"doctrine/common": "~2.4"
"php": "^7.0",
"doctrine/common": "^2.7.1"
},
"require-dev": {
"phpunit/phpunit": "^5.4.6",
......
......@@ -15,7 +15,7 @@ Transaction demarcation with the Doctrine DBAL looks as follows:
try{
// do stuff
$conn->commit();
} catch(Exception $e) {
} catch (\Exception $e) {
$conn->rollBack();
throw $e;
}
......@@ -90,7 +90,7 @@ example:
...
$conn->commit(); // 2 => 1
} catch (Exception $e) {
} catch (\Exception $e) {
$conn->rollBack(); // 2 => 1, transaction marked for rollback only
throw $e;
}
......@@ -98,7 +98,7 @@ example:
...
$conn->commit(); // 1 => 0, "real" transaction committed
} catch (Exception $e) {
} catch (\Exception $e) {
$conn->rollBack(); // 1 => 0, "real" transaction rollback
throw $e;
}
......
......@@ -569,7 +569,7 @@ Please also notice the mapping specific footnotes for additional information.
| | +--------------------------+---------+----------------------------------------------------------+
| | | **SQL Server** | *all* | ``VARCHAR(MAX)`` |
+-------------------+---------------+--------------------------+---------+----------------------------------------------------------+
| **guid ** | ``string`` | **MySQL** | *all* | ``VARCHAR(255)`` [1]_ |
| **guid** | ``string`` | **MySQL** | *all* | ``VARCHAR(255)`` [1]_ |
| | +--------------------------+ | |
| | | **Oracle** | | |
| | +--------------------------+ | |
......
......@@ -79,34 +79,34 @@ class Driver extends AbstractPostgreSQLDriver
$dsn = 'pgsql:';
if (isset($params['host']) && $params['host'] != '') {
$dsn .= 'host=' . $params['host'] . ' ';
$dsn .= 'host=' . $params['host'] . ';';
}
if (isset($params['port']) && $params['port'] != '') {
$dsn .= 'port=' . $params['port'] . ' ';
$dsn .= 'port=' . $params['port'] . ';';
}
if (isset($params['dbname'])) {
$dsn .= 'dbname=' . $params['dbname'] . ' ';
$dsn .= 'dbname=' . $params['dbname'] . ';';
} elseif (isset($params['default_dbname'])) {
$dsn .= 'dbname=' . $params['default_dbname'] . ' ';
$dsn .= 'dbname=' . $params['default_dbname'] . ';';
} else {
// Used for temporary connections to allow operations like dropping the database currently connected to.
// Connecting without an explicit database does not work, therefore "postgres" database is used
// as it is mostly present in every server setup.
$dsn .= 'dbname=postgres' . ' ';
$dsn .= 'dbname=postgres' . ';';
}
if (isset($params['sslmode'])) {
$dsn .= 'sslmode=' . $params['sslmode'] . ' ';
$dsn .= 'sslmode=' . $params['sslmode'] . ';';
}
if (isset($params['sslrootcert'])) {
$dsn .= 'sslrootcert=' . $params['sslrootcert'] . ' ';
$dsn .= 'sslrootcert=' . $params['sslrootcert'] . ';';
}
if (isset($params['application_name'])) {
$dsn .= 'application_name=' . $params['application_name'] . ' ';
$dsn .= 'application_name=' . $params['application_name'] . ';';
}
return $dsn;
......
......@@ -658,25 +658,27 @@ END;';
$tabColumnsTableName = "user_tab_columns";
$colCommentsTableName = "user_col_comments";
$ownerCondition = '';
$tabColumnsOwnerCondition = '';
$colCommentsOwnerCondition = '';
if (null !== $database && '/' !== $database) {
$database = $this->normalizeIdentifier($database);
$database = $this->quoteStringLiteral($database->getName());
$tabColumnsTableName = "all_tab_columns";
$colCommentsTableName = "all_col_comments";
$ownerCondition = "AND c.owner = " . $database;
$tabColumnsOwnerCondition = "AND c.owner = " . $database;
$colCommentsOwnerCondition = "AND d.OWNER = c.OWNER";
}
return "SELECT c.*,
(
SELECT d.comments
FROM $colCommentsTableName d
WHERE d.TABLE_NAME = c.TABLE_NAME
WHERE d.TABLE_NAME = c.TABLE_NAME " . $colCommentsOwnerCondition . "
AND d.COLUMN_NAME = c.COLUMN_NAME
) AS comments
FROM $tabColumnsTableName c
WHERE c.table_name = " . $table . " $ownerCondition
WHERE c.table_name = " . $table . " $tabColumnsOwnerCondition
ORDER BY c.column_name";
}
......
......@@ -35,7 +35,7 @@ class SQLParserUtils
const ESCAPED_SINGLE_QUOTED_TEXT = "'(?:[^'\\\\]|\\\\'?|'')*'";
const ESCAPED_DOUBLE_QUOTED_TEXT = '"(?:[^"\\\\]|\\\\"?)*"';
const ESCAPED_BACKTICK_QUOTED_TEXT = '`(?:[^`\\\\]|\\\\`?)*`';
const ESCAPED_BRACKET_QUOTED_TEXT = '\[(?:[^\]])*\]';
const ESCAPED_BRACKET_QUOTED_TEXT = '(?<!\bARRAY)\[(?:[^\]])*\]';
/**
* Gets an array of the placeholders in an sql statements as keys and their positions in the query string.
......
......@@ -47,7 +47,7 @@ class DriverTest extends AbstractDriverTest
public function getDatabaseParameter()
{
$params = TestUtil::getConnection()->getParams();
$realDatabaseName = $params['dbname'];
$realDatabaseName = isset($params['dbname']) ? $params['dbname'] : '';
$dummyDatabaseName = $realDatabaseName . 'a';
return array(
......
......@@ -3,6 +3,8 @@
namespace Doctrine\Tests\DBAL\Functional\Schema;
use Doctrine\DBAL\Schema;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Types\Type;
use Doctrine\Tests\TestUtil;
class OracleSchemaManagerTest extends SchemaManagerFunctionalTestCase
......@@ -216,4 +218,17 @@ class OracleSchemaManagerTest extends SchemaManagerFunctionalTestCase
$onlineForeignTable->getForeignKey('"Primary_Table_Fk"')->getQuotedForeignColumns($platform)
);
}
public function testListTableColumnsSameTableNamesInDifferentSchemas()
{
$table = $this->createListTableColumns();
$this->_sm->dropAndCreateTable($table);
$otherTable = new Table($table->getName());
$otherTable->addColumn('id', Type::STRING);
TestUtil::getTempConnection()->getSchemaManager()->dropAndCreateTable($otherTable);
$columns = $this->_sm->listTableColumns($table->getName(), $this->_conn->getUsername());
$this->assertCount(7, $columns);
}
}
......@@ -725,7 +725,7 @@ EOD;
(
SELECT d.comments
FROM user_col_comments d
WHERE d.TABLE_NAME = c.TABLE_NAME
WHERE d.TABLE_NAME = c.TABLE_NAME
AND d.COLUMN_NAME = c.COLUMN_NAME
) AS comments
FROM user_tab_columns c
......@@ -738,7 +738,7 @@ EOD;
(
SELECT d.comments
FROM user_col_comments d
WHERE d.TABLE_NAME = c.TABLE_NAME
WHERE d.TABLE_NAME = c.TABLE_NAME
AND d.COLUMN_NAME = c.COLUMN_NAME
) AS comments
FROM user_tab_columns c
......@@ -751,7 +751,7 @@ EOD;
(
SELECT d.comments
FROM all_col_comments d
WHERE d.TABLE_NAME = c.TABLE_NAME
WHERE d.TABLE_NAME = c.TABLE_NAME AND d.OWNER = c.OWNER
AND d.COLUMN_NAME = c.COLUMN_NAME
) AS comments
FROM all_tab_columns c
......
......@@ -34,6 +34,7 @@ class SQLParserUtilsTest extends \Doctrine\Tests\DbalTestCase
array("SELECT '?' FROM foo WHERE bar = ?", true, array(32)),
array("SELECT `?` FROM foo WHERE bar = ?", true, array(32)), // Ticket DBAL-552
array("SELECT [?] FROM foo WHERE bar = ?", true, array(32)),
array('SELECT * FROM foo WHERE jsonb_exists_any(foo.bar, ARRAY[?])', true, array(56)), // Ticket GH-2295
array("SELECT 'Doctrine\DBAL?' FROM foo WHERE bar = ?", true, array(45)), // Ticket DBAL-558
array('SELECT "Doctrine\DBAL?" FROM foo WHERE bar = ?', true, array(45)), // Ticket DBAL-558
array('SELECT `Doctrine\DBAL?` FROM foo WHERE bar = ?', true, array(45)), // Ticket DBAL-558
......@@ -53,6 +54,7 @@ class SQLParserUtilsTest extends \Doctrine\Tests\DbalTestCase
array('SELECT foo::date as date FROM Foo WHERE bar > :start_date AND baz > :start_date', false, array(46 => 'start_date', 68 => 'start_date')), // Ticket GH-259
array('SELECT `d.ns:col_name` FROM my_table d WHERE `d.date` >= :param1', false, array(57 => 'param1')), // Ticket DBAL-552
array('SELECT [d.ns:col_name] FROM my_table d WHERE [d.date] >= :param1', false, array(57 => 'param1')), // Ticket DBAL-552
array('SELECT * FROM foo WHERE jsonb_exists_any(foo.bar, ARRAY[:foo])', false, array(56 => 'foo')), // Ticket GH-2295
array(
<<<'SQLDATA'
SELECT * FROM foo WHERE
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment