[DBAL-521] [GH-320] Fixed calculation of differences of columns Created: 17/May/13  Updated: 17/May/13

Status: Open
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of hason:

Url: https://github.com/doctrine/dbal/pull/320

Message:






[DBAL-518] [GH-318] Update Type.php Created: 15/May/13  Updated: 17/May/13  Resolved: 17/May/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Won't Fix Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of vincequeiroz:

Url: https://github.com/doctrine/dbal/pull/318

Message:

Camel case methods names.



 Comments   
Comment by Doctrine Bot [ 17/May/13 ]

A related Github Pull-Request [GH-318] was closed:
https://github.com/doctrine/dbal/pull/318





[DBAL-520] [GH-319] Delete unnecessary "use PDO" statement Created: 16/May/13  Updated: 16/May/13

Status: Open
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of alexpods:

Url: https://github.com/doctrine/dbal/pull/319

Message:






[DBAL-519] MasterSlave connection does not keep Slave connections when there is a transaction Created: 15/May/13  Updated: 15/May/13

Status: Open
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Improvement Priority: Major
Reporter: Ananda Agrawal Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

while doing a transaction (as a result of ORM persist),
the connect function sets the forceMasterAsSlave which result on setting
slave to master,

on future selects, even if keepSlave is set to true
and connecting to 'slave' as ->connect('slave')
we will get master connections

I assume we need to check keepSlave when forcing slaves to master






[DBAL-516] [GH-316] Fixed generated sql for postgres substring function Created: 15/May/13  Updated: 15/May/13  Resolved: 15/May/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Guilherme Blanco
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of stefk:

Url: https://github.com/doctrine/dbal/pull/316

Message:

Currently, the postgres dbal platform generates the following sql code for the substring function : `SUBSTR('foo', 1, 2)`
where in postgres, it should be :
`SUBSTRING('foo' FROM 1 FOR 2)`
This pull request simply fixes that issue.



 Comments   
Comment by Doctrine Bot [ 15/May/13 ]

A related Github Pull-Request [GH-316] was closed:
https://github.com/doctrine/dbal/pull/316

Comment by Marco Pivetta [ 15/May/13 ]

merged





[DBAL-517] [GH-317] Conditionaly upgrade utf8 to utf8mb4 for MySQL 5.5.3 Created: 15/May/13  Updated: 15/May/13

Status: Open
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of nicolas-grekas:

Url: https://github.com/doctrine/dbal/pull/317

Message:

See http://dev.mysql.com/doc/refman/5.5/en/charset-unicode-utf8mb4.html

As utf8mb4 is a superset of utf8, this should be transparent and backward compatible.
For those really requiring the "utf8" meant by MySQL, they can use explicitely the utf8mb3 charset.
But IMHO by default, Doctrine should really use utf8mb4, which is what everybody expect from a charset named "utf8".






[DBAL-324] SchemaManager should first look into comment instead of infer the type first. Created: 17/Aug/12  Updated: 14/May/13

Status: Open
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Guilherme Blanco Assignee: Guilherme Blanco
Resolution: Unresolved Votes: 0
Labels: None


 Description   

When using schema tool, Doctrine tries to infer the Doctrine type via the mapped types in Platform.
It should first try to read from the comment; if found, ignore the Database type inference.



 Comments   
Comment by Benjamin Eberlei [ 29/Aug/12 ]

Why is this a bug? Can you say some more about why we need to do this and what error occurs?

Comment by Guilherme Blanco [ 29/Aug/12 ]

This issue is strictly correlated to the commit I've done here: https://github.com/doctrine/dbal/commit/e25c774dde971dc4afd40648e9ccd0af53b34ce9

Mainly, we may have legacy database that we do know how Doctrine should operate. Under this circumstance, we may want to add a comment to the field defining the Doctrine DBAL type.
Even though after doing this, Doctrine still complains (in my situation, a SET column type) that it's unable to handle this column type.

That happens because MySQL Schema Manager (and others) first looks for the column type:
https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php#L112
https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php#L312
which automatically fails.

But if we first try to look for the commented data type:
https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php#L884
And forget about the rest if it finds one definition there, it would allow even unknown data types to be managed instead of forcing to define the DBAL Type compatible.

Comment by Steve Tauber [ 14/May/13 ]

This also applies for a type of yaml.
Example:

/** @Column(type="yaml") */
protected $data = array();

./scripts/doctrine orm:schema-tool:update --dump-sql
ALTER TABLE meta CHANGE data data LONGTEXT NOT NULL;

Very frustrating.... Might be related to http://www.doctrine-project.org/jira/browse/DBAL-42





[DBAL-514] [GH-314] Remove unnecessary code from Connection::insert Created: 13/May/13  Updated: 14/May/13  Resolved: 14/May/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Guilherme Blanco
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of deeky666:

Url: https://github.com/doctrine/dbal/pull/314

Message:

This is a tiny optimization in the <code>Connection::insert</code> method that remove an unnecessary <code>foreach</code> loop an some unneeded variable assignments.
If this is not desired, just close this PR



 Comments   
Comment by Doctrine Bot [ 14/May/13 ]

A related Github Pull-Request [GH-314] was closed:
https://github.com/doctrine/dbal/pull/314

Comment by Marco Pivetta [ 14/May/13 ]

merged





[DBAL-515] [GH-315] Shard description requires an 'id' not 'name' Created: 14/May/13  Updated: 14/May/13  Resolved: 14/May/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of johannes:

Url: https://github.com/doctrine/dbal/pull/315

Message:



 Comments   
Comment by Doctrine Bot [ 14/May/13 ]

A related Github Pull-Request [GH-315] was closed:
https://github.com/doctrine/dbal/pull/315

Comment by Marco Pivetta [ 14/May/13 ]

merged





[DBAL-513] downloading from github Created: 12/May/13  Updated: 12/May/13  Resolved: 12/May/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Blocker
Reporter: Maarten Bogaert Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

https://api.github.com/repos/doctrine/dbal/zipball/2.3.4:

500: Internal Server Error



 Comments   
Comment by Maarten Bogaert [ 12/May/13 ]

ok never mind, after a while the problem resolved itself and the zipball can be downloaded again





[DBAL-480] [GH-296] PDO bug workaround Created: 02/Apr/13  Updated: 09/May/13  Resolved: 09/May/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Won't Fix Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of dasmfm:

Url: https://github.com/doctrine/dbal/pull/296

Message:

In combination of PHP 5.4 and Doctrine 2 (upto 2.4Beta1) there's a bug with "boolean" type of field.
Ref link:��http://stackoverflow.com/questions/10242312/pdo-bindvalue-with-pdoparam-bool-causes-statement-execute-to-fail-silently

This patch binds int instead of bool and everything goes working fine.



 Comments   
Comment by Doctrine Bot [ 09/May/13 ]

A related Github Pull-Request [GH-296] was closed:
https://github.com/doctrine/dbal/pull/296

Comment by Benjamin Eberlei [ 09/May/13 ]

Not fixing PHP bugs or adding workarounds.

You need to pass an integer (1 or 0) instead of a boolean to make it working. This is how we do it in the ORM.





[DBAL-508] MySqlSchemaManager accessing undefined index tableColumn[comment] Created: 30/Apr/13  Updated: 09/May/13  Resolved: 09/May/13

Status: Resolved
Project: Doctrine DBAL
Component/s: Schema Managers
Affects Version/s: 2.3.3
Fix Version/s: 2.4

Type: Bug Priority: Trivial
Reporter: Martin Kuckert Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None
Environment:

Linux 3.2.0-24-generic-pae #39-Ubuntu,
mysql Ver 14.14 Distrib 5.5.31, for debian-linux-gnu (i686) using readline 6.2



 Description   

in the method Doctrine\DBAL\Schema\MySqlSchemaManager::_getPortableTableColumnDefinition the index "comment" in the array $tableColumn is accessed without ensuring that this index is set. This leads to an Undefined index: comment warning in E_ALL-environments.

This method is triggered e.g. by the Doctrine\ORM\Tools\SchemaTool getUpdateSchemaSql method.



 Comments   
Comment by Benjamin Eberlei [ 01/May/13 ]

Can't really explain this, the key has to be existant. This is only called with information from MysqlPlatform#getListTableColumnsSQL().

Comment by Martin Kuckert [ 02/May/13 ]

I've just found the issue. The main problem is the usage of 'DESCRIBE ' . $table; in the getListTableColumnsSQL, if there's no $database set. describe does not return the comment column, but 'show full columns from ' . $table; does.
At the basis of the missing $database value was my own DBAL\Driver implementation not properly returning the currently connected database. So $database was NULL and the alternate code path was executed, so resulting in no comment-property.

Seems like an uncovered code path instead of a bug in a real environment.

Comment by Benjamin Eberlei [ 09/May/13 ]

Special case fixed for 2.4





[DBAL-362] [GH-214] The "bindParam" method of OCI8Statement is not using the "length" parameter Created: 06/Oct/12  Updated: 09/May/13  Resolved: 09/May/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Invalid Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of theUniC:

Url: https://github.com/doctrine/dbal/pull/214

Message:

I've fixed the ```OCI8Statement::bindParam``` method in order to pass the "length" parameter when the type is not a LOB

https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php#L112

As noted on the description of the function on the PHP manual (for the IN binds), this is leading to a truncation of the values to the size of the PHP variable.

http://www.php.net/manual/en/function.oci-bind-by-name.php



 Comments   
Comment by Doctrine Bot [ 09/May/13 ]

A related Github Pull-Request [GH-214] was closed:
https://github.com/doctrine/dbal/pull/214





[DBAL-371] DBALException doesn't forward the SQL exception code Created: 24/Oct/12  Updated: 09/May/13  Resolved: 09/May/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Minor
Reporter: Matthieu Napoli Assignee: Benjamin Eberlei
Resolution: Won't Fix Votes: 0
Labels: None


 Description   

PDO exceptions carry the SQL error code. However DBALException doesn't forward any error code from the SQL exception.

Here is a (really poor/quick) example of usage:

try {
    $em->flush();
} catch (DBALException $e) {
    if ($e->getCode() === 23000) {
        echo '';
    } else {
        throw $e;
    }
}

I think I found where the problem is:

public static function driverExceptionDuringQuery(\Exception $driverEx, $sql, array $params = array())
{
    $msg = "An exception occurred while executing '".$sql."'";
    if ($params) {
        $msg .= " with params ".json_encode($params);
    }
    $msg .= ":\n\n".$driverEx->getMessage();

    return new self($msg, 0, $driverEx);
}

In return new self($msg, 0, $driverEx);, the exception is created with an error code of 0.

Is there a reason for this: is that that the driver exception may not always have a defined error code? (for example if the sql driver is not PDO or the SQL system doesn't support that, but in this case then the error code would be 0 would that be a problem?)



 Comments   
Comment by Matthieu Napoli [ 24/Oct/12 ]

Pull request here: https://github.com/doctrine/dbal/pull/221

Comment by Doctrine Bot [ 09/May/13 ]

A related Github Pull-Request [GH-221] was closed:
https://github.com/doctrine/dbal/pull/221





[DBAL-388] [GH-231] Update lib/Doctrine/DBAL/Types/BlobType.php Created: 21/Nov/12  Updated: 09/May/13  Resolved: 09/May/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.3.4
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of mikemeier:

Url: https://github.com/doctrine/dbal/pull/231

Message:

If allow_url_fopen isnt enabled, fopen will return false.



 Comments   
Comment by Doctrine Bot [ 09/May/13 ]

A related Github Pull-Request [GH-231] was closed:
https://github.com/doctrine/dbal/pull/231





[DBAL-501] [GH-309] Parameter parsing fixes Created: 21/Apr/13  Updated: 09/May/13  Resolved: 09/May/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.3.4
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of lstrojny:

Url: https://github.com/doctrine/dbal/pull/309

Message:

Fix for #301 has been reverted to address http://www.doctrine-project.org/jira/browse/DBAL-496. This fix addresses both issues in a consistent manner and ads a few more tests.



 Comments   
Comment by Doctrine Bot [ 09/May/13 ]

A related Github Pull-Request [GH-309] was closed:
https://github.com/doctrine/dbal/pull/309





[DBAL-512] Update schema not working on MsSql due to no support for alter identity Created: 06/May/13  Updated: 06/May/13

Status: Open
Project: Doctrine DBAL
Component/s: None
Affects Version/s: 2.2.2
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Flip Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Symfony 2.1, SQL Server 2008, driver: pdo_sqlsrv



 Description   

When running: php app/console doctrine:schema:update --force

[Doctrine\DBAL\DBALException]
An exception occurred while executing 'ALTER TABLE tableName ALTER COLUMN id INT IDENTITY NOT NULL':

SQLSTATE[42000]: [Microsoft][SQL Server Native Client 11.0][SQL Server]Incorrect syntax near the keyword 'IDENTITY'.

According to this stackoverflow http://stackoverflow.com/a/1049305/1833322 MSSQL does not support this query.






[DBAL-504] DBAL Enum fields migration issue / PostgreSQL Created: 24/Apr/13  Updated: 06/May/13

Status: Awaiting Feedback
Project: Doctrine DBAL
Component/s: Drivers, Schema Managers
Affects Version/s: 2.3.3
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: jos de witte Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 1
Labels: None
Environment:

postgresql


Issue Links:
Duplicate
is duplicated by DDC-2238 doctrine:schema:update partially broken Resolved

 Description   

When using Custom Doctrine DBAL Enums the migration created using diff

works fine the first time.

However the next time it generates a SQL statement trying to change to field type to INT from integer; (Redundant)
and a truncated statement:

"ALTER schemaname.fieldname SET" .. And that's it.



 Comments   
Comment by Tom Vogt [ 01/May/13 ]

Doesn't only happen on Enums. I don't use any enums and I have this problem. I use a couple of geo (postGIS) fields (point, linestring, polygon) as well as array fields, so either or all of those might be causing it, too.

Comment by Benjamin Eberlei [ 04/May/13 ]

We did some changes for PostgreSQL column diffs lately, can you verify this bug still exists on the 2.3 Branch of DBAL?

Comment by Tom Vogt [ 06/May/13 ]

I'm running this on Symfony2 with this composer.json config:

"doctrine/orm": "2.3.*",
"doctrine/doctrine-bundle": ">=2.1",

and I'm still getting this issue today.





[DBAL-407] Refactor exceptions Created: 07/Jan/13  Updated: 06/May/13

Status: Open
Project: Doctrine DBAL
Component/s: Drivers, Platforms, Schema Managers
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Improvement Priority: Major
Reporter: Bart van den Burg Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 1
Labels: None


 Description   

It's currently rather hard to figure out what went wrong when for example a DBALException was thrown. You have to actually match the message in it, or read the status code of the ->getPrevious() exception, which can be different for all drivers (as https://github.com/jackalope/jackalope-doctrine-dbal/issues/80 shows).

I'd suggest creating new exception classes for all situations and throwing them instead. If they extend the DBAL Exception and pass the message to it as it is right now, there will be no BC break.

If this were to be done, on which branch should this be applied?



 Comments   
Comment by Christophe Coevoet [ 07/Jan/13 ]

This should be done in the master branch.

Another solution, avoiding to create many classes, would be to use the exception code, which is always kept as 0 currently (the default value of the Exception class). You could have a code for each case (with constants in the DBALException class) and then checking $e->getCode() to identify what went wrong.

Comment by Bart van den Burg [ 07/Jan/13 ]

I'd prefer actual named exceptions. It makes catching them simpler. However, adding some code defined in DBAL would be an acceptable alternative.

try {
    /* ... /*
} catch (NoSuchTableException $e) {
    // do something
} catch (DuplicateKeyException $e) {
    // do something else
}

v.s.

try {
    /* ... /*
} catch (DBALException $e) {
    if ($e->getCode() == DBALException::NO_SUCH_TABLE) {
        // do something
    } elseif ($e->getCode() == DBALException::DUPLICATE_KEY) {
        // do something else
    } else {
        throw $e;
    }
}
Comment by Christopher Davis [ 06/May/13 ]

I would also prefer named exceptions. You're going to have a lot of problems providing the "code" value in DBALException in any case: SQLSTATE codes are alphanumeric, and will cause warnings/errors when creating new exception.

Besides we can get the SQL state code now:

    try {
        // ...
    } catch (\Doctrine\DBAL\DBALException $e) {
        $code = $e->getPrevious()->getCode();
        // do stuff with $code
    }

The problem is that there are a lot of error codes defined in the ANSI SQL standard: http://www.postgresql.org/docs/9.2/static/errcodes-appendix.html

Maybe throwing an specific exception for each "class" of SQLSTATE codes? So if the error code from a PDO exception starts with 23, DBAL would throw `\Doctrine\DBAL\Exception\IntegrityConstraintViolationException`.

This also seems like the logic to handle throwing exceptions should be contained in the platforms as some implementations may differ. You could have a method in `AbstractPlatform` that takes care of the ANSI SQLSTATE error code classes and leave it up subclasses to deal with platform specific cases. Whenever `Connection` catches a `PDOException`, dispatch it to the platform to deal with.

Example: https://gist.github.com/chrisguitarguy/e021918900e93dca304d

Thoughts?

Comment by Matthieu Napoli [ 06/May/13 ]

I have implemented a thing of that kind in a personal project (on top of Doctrine). It is really useful to be able to catch a ForeignKeyViolationException, and get with entity/field caused the problem (for that my EntityManager wrapper parse the exception message).

However, note that exception codes differ from DB engines. In my case, I did it quick and used MySQL error codes, but managing different RDBMS implies more work.





[DBAL-409] [GH-245] Added support for column collation Created: 08/Jan/13  Updated: 04/May/13

Status: Open
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: New Feature Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of hason:

Url: https://github.com/doctrine/dbal/pull/245

Message:






[DBAL-499] [GH-307] Postgres fix for a possible unavailable dbname Created: 19/Apr/13  Updated: 04/May/13  Resolved: 04/May/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of antonioribeiro:

Url: https://github.com/doctrine/dbal/pull/307

Message:



 Comments   
Comment by Doctrine Bot [ 04/May/13 ]

A related Github Pull-Request [GH-307] was closed:
https://github.com/doctrine/dbal/pull/307





[DBAL-469] [GH-290] Quote sequence name in PostgreSQL before grabbing information about it Created: 22/Mar/13  Updated: 04/May/13  Resolved: 04/May/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Invalid Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of mrkrstphr:

Url: https://github.com/doctrine/dbal/pull/290

Message:



 Comments   
Comment by Benjamin Eberlei [ 22/Mar/13 ]

A related Github Pull-Request [GH-290] was closed
https://github.com/doctrine/dbal/pull/290

Comment by Benjamin Eberlei [ 04/May/13 ]

Closed by author





[DBAL-511] Schema\ColumnDiff incorrect with default varchar value and postgresql Created: 01/May/13  Updated: 04/May/13  Resolved: 04/May/13

Status: Resolved
Project: Doctrine DBAL
Component/s: Schema Managers
Affects Version/s: None
Fix Version/s: 2.4, 2.3.4
Security Level: All

Type: Bug Priority: Major
Reporter: Richard Hinkamp Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None
Environment:

Ubuntu 12.04.2 LTS
PHP 5.3.10-1ubuntu3.6
PostgreSQL(libpq) Version => 9.1.8



 Description   

I have a Schema\Table with a column:

$usersTable->addColumn("lastip", "string", array("length" => 32, "default" => ""));

When I use Schema\Comparator on this table I get a ColumnDiff:

object(Doctrine\DBAL\Schema\ColumnDiff)[554]
  public 'oldColumnName' => string 'lastip' (length=6)
  public 'column' => 
    object(Doctrine\DBAL\Schema\Column)[481]
      protected '_type' => 
        object(Doctrine\DBAL\Types\StringType)[278]
      protected '_length' => int 32
      protected '_precision' => int 10
      protected '_scale' => int 0
      protected '_unsigned' => boolean false
      protected '_fixed' => boolean false
      protected '_notnull' => boolean true
      protected '_default' => string '' (length=0)
      protected '_autoincrement' => boolean false
      protected '_platformOptions' => 
        array
          empty
      protected '_columnDefinition' => null
      protected '_comment' => null
      protected '_customSchemaOptions' => 
        array
          empty
      protected '_name' => string 'lastip' (length=6)
      protected '_namespace' => null
      protected '_quoted' => boolean false
  public 'changedProperties' => 
    array
      0 => string 'default' (length=7)
  public 'fromColumn' => 
    object(Doctrine\DBAL\Schema\Column)[293]
      protected '_type' => 
        object(Doctrine\DBAL\Types\StringType)[278]
      protected '_length' => int 32
      protected '_precision' => int 10
      protected '_scale' => int 0
      protected '_unsigned' => boolean false
      protected '_fixed' => boolean false
      protected '_notnull' => boolean true
      protected '_default' => string '''::character varying' (length=21)
      protected '_autoincrement' => boolean false
      protected '_platformOptions' => 
        array
          empty
      protected '_columnDefinition' => null
      protected '_comment' => string '' (length=0)
      protected '_customSchemaOptions' => 
        array
          empty
      protected '_name' => string 'lastip' (length=6)
      protected '_namespace' => null
      protected '_quoted' => boolean false

With "default" postgresql adds "::character varying" when it's a varchar.

This gives a alter sql query:

ALTER TABLE bolt_users ALTER lastip SET  DEFAULT ''

After executing this, the next time it's the ColumnDiff again. Should the "::character varying" part be ignored by doctrine? Because then the schema will be valid.

Using Doctrine 2.4.0-BETA1 (38b1a340c5ec7c58be1883696c1f956bed5b7f0c)



 Comments   
Comment by Benjamin Eberlei [ 01/May/13 ]

Duplicate of DBAL-483

Comment by Richard Hinkamp [ 02/May/13 ]

Hmm that's not a duplicate. The default column handling works great in mysql, sqlite and with integer/date/etc fields in postgres, just not with varchar and postgres. I think doctrine should handle the "::character varying" part which postgres adds to the default value of a varchar field.

Comment by Benjamin Eberlei [ 04/May/13 ]

Yes you are right, fixed the underlying issue now.





[DBAL-394] Unsigned integers are not respected by the schema tool for assocations Created: 30/Nov/12  Updated: 03/May/13  Resolved: 01/May/13

Status: Resolved
Project: Doctrine DBAL
Component/s: Schema Managers
Affects Version/s: 2.3
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Jonathan Ingram Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 1
Labels: None


 Description   

Before commenting, I've done so much debugging and searching into this issue and if I missed something major, I apologise.

From what I understand, the ORM doesn't care about unsigned. That's fair enough. That leaves it to DBAL to handle it.

However, it's not possible to successfully use something like the following table without having the schema manager complain.

CREATE TABLE `account` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '(DC2Type:unsigned_integer)',
  `user_id` int(10) unsigned DEFAULT NULL COMMENT '(DC2Type:unsigned_integer)',
  PRIMARY KEY (`id`),
  KEY `IDX_7D3656A461220EA6` (`user_id`)
) ENGINE=InnoDB

In that code, I'm using a custom type "unsigned_integer" that extends the DBAL integer type with this:

    public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
    {
        $fieldDeclaration['unsigned'] = true;

        return $platform->getIntegerTypeDeclarationSQL($fieldDeclaration);
    }

The reason for this is because the ORM won't map unsigned ints for me. Combined with this is an event listener for the class metadata. Something like this:

    /**
     * Maps additional metadata.
     *
     * Specifically, if there exist an unsigned integer field, attach the
     * "unsigned" option to it. This is required because the Doctrine ORM does
     * not do this and we are using "UNSIGNED INT"s in our MySQL columns.
     * Without this. the Doctrine Schema Tool will complain about column
     * differences.
     *
     * Note: there is no performance impact in doing this because the class
     * metadata should be cached after the first request.
     *
     * @param LoadClassMetadataEventArgs $eventArgs
     */
    public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)
    {
        foreach ($eventArgs->getClassMetadata()->fieldMappings as &$mapping) {
            if (isset($mapping['type']) && UnsignedIntegerType::UNSIGNED_INTEGER === $mapping['type']) {
                if (!isset($mapping['options'])) {
                    $mapping['options'] = array();
                }

                $mapping['options']['unsigned'] = true;
            }
        }
    }

Now, in the example table above, the schema tool will honour the "id" column, however it won't honour the association join column no matter what I do. My attempts include adding an event listener for class meta data as above (basically tricking the ORM) and also adding an event listener for the schema events.

The other day on GitHub there was a commit (https://github.com/doctrine/doctrine2/commit/a27be2fab61b1cfde4d2ecbc729a4a68816fca76) to help with this, but it's still not all working.

Also, comments and issues on the Jira tracker have said how there's legacy code related to "unsigned" and "default", but I can't tell what's legacy and what's allowed, especially when there's a commit like that one above.

By the way, I have found that the simple unsigned field mapping works. E.g.:

    fields:
        counter:
            type: integer
            column: counter
            options:
                unsigned: true

If it helps at all, here's the YAML mapping file for the above table/entity:

Account:
    type: entity
    table: account
    id:
        id:
            type: unsigned_integer
            generator:
                strategy: AUTO
    manyToOne:
        creator:
            targetEntity: User
            joinColumn:
                name: user_id
                referencedColumnName: id # Note: user table id is also unsigned_integer

Is it possible to 1) fix this or 2) let me know if I'm just doing something wrong?

Note: as I said above, I know that Doctrine DBAL and ORM does not care so much for unsigned ints because of portability, etc. but it seems that because of that commit above (24 days ago), there's a half-implememented/legacy solution going on here.

Cheers,
Jon



 Comments   
Comment by Benjamin Eberlei [ 01/May/13 ]

This was fixed in 657a54da

Comment by Gaetan Rousseau [ 03/May/13 ]

This was not fixed. We can use the option "unsigned" for the fields but not the id.

If someone has a solution or if you can fix this, that would be really cool !

Comment by Gaetan Rousseau [ 03/May/13 ]

After some research with a co-worker we've found a solution to our little problem.

To fix this you just have to add these lines in the YamlDriver (Doctrine/ORM/Mapping/Driver/YamlDriver.php) in the function "loadMetadataForClass", line 265 in the 2.3.3 version of Doctrine ORM :

if (isset($idElement['options'])) {
   $mapping['options'] = $idElement['options'];
}

Just before the :

$metadata->mapField($mapping);

And that an example of schema :

Entities\Test:
  type: entity
  table: Test
  id:
    id:
      type: integer
      options:
        unsigned: true
      generator:
        strategy: AUTO
  fields:
    testField:
      type: smallint
      options:
        unsigned: true

With this, the id can be unsigned without using special type of column, and yes just with this little if
It has been tested in more complexes schemas and all is going well.

In fact, maybe it could be interesting to use the function "columnToArray" like it's used for the other fields.
In the two cases you must care about what you put in your "options" section.





[DBAL-313] When creating foreign key constraints, the AbstractPlatform class does not quote the referenced table. Created: 06/Aug/12  Updated: 01/May/13  Resolved: 01/May/13

Status: Resolved
Project: Doctrine DBAL
Component/s: Platforms
Affects Version/s: 2.2.2
Fix Version/s: None
Security Level: All

Type: Bug Priority: Minor
Reporter: Marc-André Joyal Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

I have a table that is using a reserved MySQL keyword (right) and it's quoted in all the generated SQL but not in the foreign key constraint.

When I use doctrine.php orm:schema-tool:create I get this SQL line:
ALTER TABLE website ADD CONSTRAINT FK_476F5DE7B196EE6E FOREIGN KEY (right_id) REFERENCES right (id)



 Comments   
Comment by Fabio B. Silva [ 26/Aug/12 ]

Hi,

Could you try it with doctrine 2.3 ?
There are lot of changes about quotes.
if it fails even with 2.3 changes please attach your entities.

Thanks..

Comment by Padraig O'Sullivan [ 30/Aug/12 ]

I verified this is fixed in trunk by creating a test. Worth creating pull request to add test case?

public function testQuotedForeignKeySQL()
{   
    $tableOld = new Table("website");
    $tableOld->addColumn('right_id', 'integer');
    $tableOld->addUnnamedForeignKeyConstraint('right', array('right_id'), array('id'));

    $sqls = array();
    foreach ($tableOld->getForeignKeys() AS $fk) {
        $sqls[] = $this->platform->getCreateForeignKeySQL($fk, $tableOld);
    }   

    $this->assertEquals(array("ALTER TABLE website ADD CONSTRAINT FK_476F5DE754976835 FOREIGN KEY (right_id) REFERENCES `right` (id)"), $sqls);
}  
Comment by Christophe Coevoet [ 30/Aug/12 ]

Can you paste your mapping for your right entity ?

Comment by Alexander [ 09/Feb/13 ]

Can you provide us with more feedback?

Comment by Benjamin Eberlei [ 01/May/13 ]

Seems fixed as per comment of Patrick.





[DBAL-239] CI 2 + DOCTRINE 2 + SQLSERVER 2005 PDO_SQLSRV.DLL Created: 23/Mar/12  Updated: 01/May/13  Resolved: 01/May/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: M. David Zainuri Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None
Environment:

os:windows xp
sqlserver2005



 Description   

Hi, master...

Please help me,
i was integration : ci2+doctrine2+pdo_mysql status is OK http://103.28.148.89/ci2doctrine2
php.ini http://103.28.148.89 ===> phpinfo()

But ci2+doctrine2+pdo_sqlsrv. Show bugs this :

"Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[IMSSP]: This extension requires either the Microsoft SQL Server 2008 Native Client (SP1 or later) or the Microsoft SQL Server 2008 R2 Native Client ODBC Driver to communicate with SQL Server. Neither of those ODBC Drivers are currently installed. Access the following URL to download the Microsoft SQL Server 2008 R2 Native Client ODBC driver for x86: http://go.microsoft.com/fwlink/?LinkId=163712' in C:\xampp\htdocs\sqlserver\application\third_party\doctrine-orm\Doctrine\DBAL\Driver\PDOConnection.php:36 Stack trace: #0 C:\xampp\htdocs\sqlserver\application\third_party\doctrine-orm\Doctrine\DBAL\Driver\PDOConnection.php(36): PDO->_construct('sqlsrv:server=B...', 'sa', 'password', Array) #1 C:\xampp\htdocs\sqlserver\application\third_party\doctrine-orm\Doctrine\DBAL\Driver\PDOSqlsrv\Driver.php(38): Doctrine\DBAL\Driver\PDOConnection->_construct('sqlsrv:server=B...', 'sa', 'password', Array) #2 C:\xampp\htdocs\sqlserver\application\third_party\doct in C:\xampp\htdocs\sqlserver\application\third_party\doctrine-orm\Doctrine\DBAL\Driver\PDOConnection.php on line 36"

Thanks
GBU



 Comments   
Comment by M. David Zainuri [ 25/Mar/12 ]

This Problem is resolve with SQL Server 2008.

But i have new problem, paging is Error

"Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: [Microsoft][SQL Server Native Client 10.0][SQL Server]The multi-part identifier "c0_.group_company_code" could not be bound.' in C:\xampp\htdocs\sqlserver\application\third_party\doctrine-orm\Doctrine\DBAL\Connection.php:577 Stack trace: #0 C:\xampp\htdocs\sqlserver\application\third_party\doctrine-orm\Doctrine\DBAL\Connection.php(577): PDO->query('WITH outer_tbl ...') #1 C:\xampp\htdocs\sqlserver\application\third_party\doctrine-orm\Doctrine\ORM\Query\Exec\SingleSelectExecutor.php(46): Doctrine\DBAL\Connection->executeQuery('WITH outer_tbl ...', Array, Array) #2 C:\xampp\htdocs\sqlserver\application\third_party\doctrine-orm\Doctrine\ORM\Query.php(274): Doctrine\ORM\Query\Exec\SingleSelectExecutor->execute(Object(Doctrine\DBAL\Connection), Array, Array) #3 C:\xampp\htdocs\sqlserver\application\third_party\doctrine-orm\Doctrine\ORM\AbstractQuery.php(539): Doctrine\ORM\Query->_doExecute() #4 C:\xampp\htdocs\sqlserver\application\third_party\doctri in C:\xampp\htdocs\sqlserver\application\third_party\doctrine-orm\Doctrine\DBAL\Connection.php on line 577"

This link http://103.28.148.89/sqlserver/index.php/company_group/posts/list_company_group

Any body help...

Thanks

Comment by M. David Zainuri [ 25/Mar/12 ]

Problem Resolve

go into:
Doctrine\DBAL\Platforms\MsSqlPlatform

Find:

$over = preg_replace('/\"[^,]*\".\"([^,]*)\"/i', '"inner_tbl"."$1"', $orderby);

Add before:

                    # Get Columns
                    $columns = array();
                    if(preg_match_all('/([a-zA-Z][0-9]+_\.[a-zA-Z0-9\-_]+)\sAS\s([a-zA-Z0-9\-\_]+)/', $query, $matched)) {
                        for($i=0; $i<count($matched[1]); ++$i)
                        {
                            $columns[$matched[1][$i]] = $matched[2][$i];
                        }
                    }
                    
                    # Replace columns with their alias in the "orderby" statement
                    if(preg_match_all('/([a-zA-Z][0-9]+_\.[a-zA-Z0-9\-_]+)\s/i', $orderby, $matches)) {
                        foreach($matches[1] as $column)
                        {
                            $orderby = preg_replace('/'.$column.'/', $columns[$column], $orderby);
                        }
                    }

Thanks on issue this link "http://www.doctrine-project.org/jira/browse/DBAL-82?page=com.atlassian.jira.plugin.system.issuetabpanels%3Achangehistory-tabpanel"

Comment by Benjamin Eberlei [ 05/May/12 ]

CAn you post the query that leads to this error? I cant reproduce it with SQL Server 2008

Comment by Benjamin Eberlei [ 01/May/13 ]

This was fixed in other issues already





[DBAL-356] [GH-209] Added query micro-optimization Created: 30/Sep/12  Updated: 01/May/13  Resolved: 01/May/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of dlsniper:

Url: https://github.com/doctrine/dbal/pull/209

Message:

This adds a micro-optimization to the query and also exposes better the function calls to the profilers like XDebug or XHProf.



 Comments   
Comment by Doctrine Bot [ 01/May/13 ]

A related Github Pull-Request [GH-209] was closed:
https://github.com/doctrine/dbal/pull/209





[DBAL-453] PostgreSqlSchemaManager::getSchemaSearchPaths does not work for secondary schemas Created: 24/Feb/13  Updated: 01/May/13  Resolved: 01/May/13

Status: Resolved
Project: Doctrine DBAL
Component/s: Schema Managers
Affects Version/s: 2.3.2
Fix Version/s: 2.3.4
Security Level: All

Type: Bug Priority: Major
Reporter: Roger Hunwicks Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None
Environment:

Postgresql 9.1 on Ubuntu 12.04



 Description   

PostgreSqlSchemaManager::getSchemaSearchPaths() uses "SHOW search_path" to get the current search path for the connection and explodes it using a comma delimiter. On my installation Postgresql 9.1 on Ubuntu 12.04 "SHOW search__path" returns the schemas in the search path separated by ", " (i.e. a comma followed by a space). This means that the array of schemas returned by getSchemaSearchPaths() will including a leading space on the schema names for the second and subsequent schemas in the search list.

This is a particular problem if you call PostgreSqlSchemaManager::getExistingSchemaSearchPaths() because that calls determineExistingSchemaSearchPaths() which filters the list from getSchemaSearchPaths() to make sure they are in the list of schemas in the database (as returned from getSchemaNames(). The second and subsequent schemas in the search path still have a leading space when they are compared to the array of schema names, and consequently they do not match and are not included in the array returned by getExistingSchemaSearchPaths().

I think that getSchemaSearchPaths should trim the leading space from the schemas.



 Comments   
Comment by Benjamin Eberlei [ 01/May/13 ]

Fixed in 2.3.4





[DBAL-482] SQL Server Schema Manager returns incorrect value for autoincrement on IDENTITY columns Created: 03/Apr/13  Updated: 01/May/13  Resolved: 01/May/13

Status: Resolved
Project: Doctrine DBAL
Component/s: Schema Managers
Affects Version/s: 2.2, 2.3, 2.3.3
Fix Version/s: 2.3.4
Security Level: All

Type: Bug Priority: Minor
Reporter: William Schaller Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: schematool, sqlserver, sqlsrv
Environment:

SQL Server



 Description   

When calculating table diffs, SQLServerSchemaManager returns column definitions for identity columns with _autoincrement set to FALSE.

This causes the schema update SQL generation to pump out a
ALTER TABLE x ALTER COLUMN id INT IDENTITY NOT NULL
for every single identity column in the schema.

The culprit is in DBAL\Schema\SQLServerSchemaManager, starting at line 43:

        $dbType = strtolower($tableColumn['TYPE_NAME']);
        $dbType = strtok($dbType, '(), ');

        $autoincrement = false;
        if (stripos($dbType, 'identity')) {
            $dbType = trim(str_ireplace('identity', '', $dbType));
            $autoincrement = true;
        }

When the column in question is an identity int column, the TYPE_NAME is "int identity". The second line of the snippet drops the "identity" signifier, causing the following lines that determine autoincrement to do nothing.

I simply moved the second line to below the autoincrement block ie:

        $dbType = strtolower($tableColumn['TYPE_NAME']);

        $autoincrement = false;
        if (stripos($dbType, 'identity')) {
            $dbType = trim(str_ireplace('identity', '', $dbType));
            $autoincrement = true;
        }

        $dbType = strtok($dbType, '(), ');

This change solves this issue for me, and as far as I can tell, has no other consequences.



 Comments   
Comment by Benjamin Eberlei [ 01/May/13 ]

Fixed for 2.3.4 and was fixed for 2.4 in a different way already.





[DBAL-412] PostgreSqlSchemaManager::listTableColumns() fails if there are columns defined by domains in multiple schemas Created: 08/Jan/13  Updated: 01/May/13  Resolved: 01/May/13

Status: Resolved
Project: Doctrine DBAL
Component/s: Platforms, Schema Managers
Affects Version/s: 2.3.1
Fix Version/s: 2.3.4
Security Level: All

Type: Bug Priority: Major
Reporter: Roger Hunwicks Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None
Environment:

Postgresql 9.1



 Description   

We use Postgresql Domains to ensure consistent column definitions across multiple tables. We also have multiple schemas in a database. Therefore we can have two domains defined in the same database with the same name, but in different schemas.

In this situation, PostgreSqlSchemaManager::listTableColumns() fails when called for a table with a column defined by one of those domains. This means that PostgreSqlSchemaManager::createSchema() also fails for a schema containing such a table.

```
SQLSTATE[21000]: Cardinality violation: 7 ERROR: more than one row returned by a subquery used as an expression
```

This happens because of an error in the query definition in PostgreSqlPlatform::getListTableColumnsSQL(). The domain_complete_type column in the query is defined by matching the name only, without reference to the schema:

(SELECT format_type(t2.typbasetype, t2.typtypmod) FROM   
  pg_catalog.pg_type t2                                                        
                       WHERE t2.typtype = 'd' AND t2.typname = format_type(a.atttypid, a.atttypmod)) AS domain_complete_type,                             

The error can be corrected by making sure that the correct domain is matched by using the OID instead of the name to match:

(SELECT format_type(t2.typbasetype, t2.typtypmod) FROM   
  pg_catalog.pg_type t2                                                        
                       WHERE t2.typtype = 'd' AND t2.oid = a.atttypid) AS domain_complete_type

I can create a GitHub PR if it helps.



 Comments   
Comment by Benjamin Eberlei [ 01/May/13 ]

Fixed





[DBAL-490] [GH-303] Fixed a PHP warning in DBALException::driverExceptionDuringQuery() Created: 09/Apr/13  Updated: 01/May/13  Resolved: 01/May/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.3.4
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of BenMorel:

Url: https://github.com/doctrine/dbal/pull/303

Message:

When a query parameter contains binary data, `driverExceptionDuringQuery()` generates a PHP warning. This is because it internally uses `json_encode()`, which expects valid UTF-8 strings (at least in PHP 5.4.13).

This PR removes the warning with the `@` operator. `json_encode()` will still return a string representation, replacing the binary data with `null`.

I added a test that fails before the fix.



 Comments   
Comment by Doctrine Bot [ 01/May/13 ]

A related Github Pull-Request [GH-303] was closed:
https://github.com/doctrine/dbal/pull/303





[DBAL-500] [GH-308] added index flags to schema table Created: 20/Apr/13  Updated: 01/May/13  Resolved: 01/May/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of bamarni:

Url: https://github.com/doctrine/dbal/pull/308

Message:

This would allow, for example, to create some fulltext indexes with the MysqlPlatform, by passing the "fulltext" flag.



 Comments   
Comment by Doctrine Bot [ 01/May/13 ]

A related Github Pull-Request [GH-308] was closed:
https://github.com/doctrine/dbal/pull/308





[DBAL-361] [GH-213] fixed bug on schema comparator, prevent multiple rename candidates for a single original field Created: 04/Oct/12  Updated: 01/May/13  Resolved: 01/May/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.3.4
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of leedavis81:

Url: https://github.com/doctrine/dbal/pull/213

Message:

Starting with the following Entity
```
/**

  • @Table(name="user")
  • @Entity
    */
    class User { /** * @var integer $id * @Column(name="id", type="integer", length=4) * @Id * @GeneratedValue(strategy="IDENTITY") */ private $id; /** * @var \DateTime $date_alerted_email * @Column(name="date_alerted", type="datetime", nullable=true) */ private $date_alerted; }

    ```
    Upon making the following alterations (remove date_alerted, and add two additional columns of the same type but different names):
    ```
    /**

  • @Table(name="user")
  • @Entity
    */
    class User { /** * @var integer $id * @Column(name="id", type="integer", length=4) * @Id * @GeneratedValue(strategy="IDENTITY") */ private $id; /** * @var \DateTime $date_alerted_email * @Column(name="date_alerted_email", type="datetime", nullable=true) */ private $date_alerted_email; /** * @var \DateTime $date_alerted_js * @Column(name="date_alerted_js", type="datetime", nullable=true) */ private $date_alerted_js; }

    ```
    The doctrine cli schema tool used to run the update (dump sql) produces the following result:
    ```
    ALTER TABLE user CHANGE date_alerted date_alerted_js DATETIME DEFAULT NULL
    ```
    Expected result:
    ```
    ALTER TABLE message ADD date_alerted_js DATETIME DEFAULT NULL, CHANGE date_alerted date_alerted_email DATETIME DEFAULT NULL
    ```

    1. What went wrong

Upon running diffTable($from, $to) in \Doctrine\DBAL\Schema\Comparator.php line 69 both new columns are added to the "addedColumns" array, and the one removed column is correctly present in the removedColumns array.

The first iteration on detectColumnRenamings (line 272) puts the two NEW columns up as rename candidates as expected, however they share the original field name.

When iterating over the rename candidates no further checks are done and these entries are added to the renamedColumns array. The last overwrites the original as they share the same array key and the original gets ignored.

My change checks the renamedColumns array for the existence of the old column name. It only becomes a rename candidate if the original field hasn't already used previously. Otherwise it remains in the addedColumns array.

In the example above these changes will produce 1 change column and 1 add column as expected.



 Comments   
Comment by Lee Davis [ 18/Apr/13 ]

Is there anything else I need to do to get this to be merged? It's quite a frustrating issue that causes me to run an update twice to ensure changes to the DB have been correctly applied.

This bug also affects the migrations tool.

Pull request has been created https://github.com/doctrine/dbal/pull/213

Comment by Doctrine Bot [ 01/May/13 ]

A related Github Pull-Request [GH-213] was closed:
https://github.com/doctrine/dbal/pull/213





[DBAL-495] [GH-305] [DDC-2110] fixed problem with existing columns (postgresql) Created: 15/Apr/13  Updated: 01/May/13  Resolved: 01/May/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.3.4
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of MatthiasLohr:

Url: https://github.com/doctrine/dbal/pull/305

Message:

Fixed http://www.doctrine-project.org/jira/browse/DDC-2110. While selecting the configured search_path, ```"$user"``` is not replaced with the name of the current user. This commit will do the replacing.



 Comments   
Comment by Matthias Lohr [ 15/Apr/13 ]

This is a pull request for a fix for DDC-2110.

Comment by Doctrine Bot [ 01/May/13 ]

A related Github Pull-Request [GH-305] was closed:
https://github.com/doctrine/dbal/pull/305





[DBAL-510] Schema tool does not recognize existing columns Created: 31/Oct/12  Updated: 01/May/13  Resolved: 01/May/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: 2.3
Fix Version/s: 2.3.4
Security Level: All

Type: Bug Priority: Major
Reporter: Matthias Lohr Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None
Environment:

Ubuntu 8.04 with PHP 5.3.2 and PostgreSQL 8.4/9.1 (errors on both versions)


Attachments: Text File phpunit_with_tap.txt    

 Description   

I'm using doctrine with symfony. The first schema update is working, the table exists with all defined columns.
When i now run the schema update a second time (without code changes), doctrine tries to create the columns - but they already exists:

$ php app/console doctrine:schema:update --dump-sql
CREATE SEQUENCE users_id_seq INCREMENT BY 1 MINVALUE 1 START 1;
CREATE TABLE users (id INT NOT NULL, email VARCHAR(255) NOT NULL, password VARCHAR(255) DEFAULT NULL, salt VARCHAR(255) DEFAULT NULL, realname VARCHAR(255) NOT NULL, roles TEXT NOT NULL, PRIMARY KEY(id))
$ php app/console doctrine:schema:update --force
Updating database schema...
Database schema updated successfully! "2" queries were executed
$ php app/console doctrine:schema:update --dump-sql
ALTER TABLE users ADD id INT NOT NULL;
ALTER TABLE users ADD email VARCHAR(255) NOT NULL;
ALTER TABLE users ADD password VARCHAR(255) DEFAULT NULL;
ALTER TABLE users ADD salt VARCHAR(255) DEFAULT NULL;
ALTER TABLE users ADD realname VARCHAR(255) NOT NULL;
ALTER TABLE users ADD roles TEXT NOT NULL;
ALTER TABLE users ADD PRIMARY KEY (id)

Doctrine seems to ignore existing columns.

PHPUnit segfaults because of a backslash prepended to a FQCN and has a failure in the tests run so far (see attached PHPUnit output).



 Comments   
Comment by Benjamin Eberlei [ 06/Jan/13 ]

Can i see your entity definition? This works normally, there must be something different in your environment.

Comment by Matthias Lohr [ 06/Jan/13 ]

I have the same problem in another project, so i'll give you the definitions from there. Here's the console output.

$ php -v
PHP 5.3.10-1ubuntu3.4 with Suhosin-Patch (cli) (built: Sep 12 2012 18:59:41) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies

$ psql --version
psql (PostgreSQL) 9.1.7
contains support for command-line editing

$ php app/console doctrine:schema:update --dump-sql
CREATE TABLE invoices (id INT NOT NULL, number VARCHAR(255) NOT NULL, PRIMARY KEY(id));
CREATE TABLE items (id INT NOT NULL, label VARCHAR(255) NOT NULL, price DOUBLE PRECISION DEFAULT NULL, withTax BOOLEAN NOT NULL, PRIMARY KEY(id));
CREATE TABLE clients (id INT NOT NULL, label VARCHAR(255) NOT NULL, PRIMARY KEY(id))

$ php app/console doctrine:schema:update --force
Updating database schema...
Database schema updated successfully! "3" queries were executed

$ php app/console doctrine:schema:update --dump-sql
ALTER TABLE invoices ADD id INT NOT NULL;
ALTER TABLE invoices ADD number VARCHAR(255) NOT NULL;
ALTER TABLE invoices ADD PRIMARY KEY (id);
ALTER TABLE items ADD id INT NOT NULL;
ALTER TABLE items ADD label VARCHAR(255) NOT NULL;
ALTER TABLE items ADD price DOUBLE PRECISION DEFAULT NULL;
ALTER TABLE items ADD withTax BOOLEAN NOT NULL;
ALTER TABLE items ADD PRIMARY KEY (id);
ALTER TABLE clients ADD id INT NOT NULL;
ALTER TABLE clients ADD label VARCHAR(255) NOT NULL;
ALTER TABLE clients ADD PRIMARY KEY (id)

$ php app/console doctrine:schema:update --force
Updating database schema...
                                                                   
  [Doctrine\DBAL\DBALException]                                                                   
  An exception occurred while executing 'ALTER TABLE invoices ADD id INT NOT NULL':               
                                                                                                  
  SQLSTATE[42701]: Duplicate column: 7 ERROR:  column "id" of relation "invoices" already exists  
                                                                                                  
                                                                                      
  [PDOException]                                                                                  
  SQLSTATE[42701]: Duplicate column: 7 ERROR:  column "id" of relation "invoices" already exists  
Client.php
<?php

namespace LohrTec\PureInvoiceBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 * @ORM\Table(name="clients")
 */
class Client {

	/**
	 * client id
	 *
	 * @ORM\Id
	 * @ORM\Column(type="integer")
	 * @ORM\GeneratedValue(strategy="AUTO")
	 * @var int
	 */
	private $id;

	/**
	 * client label
	 *
	 * @ORM\Column(type="string")
	 * @var string
	 */
	private $label;


	public function getId() {
		return $this->id;
	}

	public function getLabel() {
		return $this->label;
	}

	public function setLabel($label) {
		$this->label = $label;
	}

}
Invoice.php
<?php

namespace LohrTec\PureInvoiceBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 * @ORM\Table(name="invoices")
 */
class Invoice {

	/**
	 * client id
	 *
	 * @ORM\Id
	 * @ORM\Column(type="integer")
	 * @ORM\GeneratedValue(strategy="AUTO")
	 * @var int
	 */
	private $id;

	/**
	 * invoice number
	 *
	 * @ORM\Column(type="string")
	 * @var string
	 */
	private $number;

}
Item.php
<?php

namespace LohrTec\PureInvoiceBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 * @ORM\Table(name="items")
 */
class Item {

	/**
	 * item id
	 *
	 * @ORM\Id
	 * @ORM\Column(type="integer")
	 * @ORM\GeneratedValue(strategy="AUTO")
	 * @var int
	 */
	private $id;

	/**
	 * item label
	 *
	 * @ORM\Column(type="string")
	 * @var string
	 */
	private $label = '';

	/**
	 * item default price
	 *
	 * @ORM\Column(type="float", nullable=true)
	 * @var float
	 */
	private $price = null;

	/**
	 * false: pre tax price, true: post tax price
	 *
	 * @ORM\Column(type="boolean")
	 * @var boolean
	 */
	private $withTax = 1;

	public function __construct($label, $price = null, $withTax = null) {
		$this->setLabel($label);
		$this->setPrice($price, $withTax);
	}

	public function getId() {
		return $this->id;
	}

	public function getLabel() {
		return $this->label;
	}

	public function getPrice() {
		return $this->price;
	}

	public function priceIsTaxed() {
		return $this->withTax;
	}

	public function setLabel($label) {
		$this->label = $label;
	}

	public function setPrice($price, $withTax = null) {
		$this->price = $price;
		if ($withTax !== null) $this->withTax = ($withTax?true:false);
	}

	public function setPriceIsTaxed($isTaxed) {
		$this->withTax = $isTaxed;
	}

}
Comment by Adrien Brault [ 15/Apr/13 ]

This happens when the schema in which your tables are, is the first one in the list of `show search_path;`.
A simple workaround I'm using is to add a dumb schema at the beginning of search_path `ALTER USER youruser SET search_path = foo,yourschema,public;`.

Comment by Adrien Brault [ 15/Apr/13 ]

FYI, \Doctrine\DBAL\Platforms\PostgreSqlPlatform::getTableWhereClause doesnt seem to work when the $table has no "." in it. (Which happen when the schema is the first in the search_path ...).

Comment by Matthias Lohr [ 15/Apr/13 ]

Hey, thank you very much for for your information!

Comment by Matthias Lohr [ 15/Apr/13 ]

Ok, it's not the problem with the position of your schema, but the default schema is "$user" and that seems not to be parsed/replaced with the username! 'ALTER USER youruser SET search_path TO yoursearchpath, public;' works for me.

Comment by Matthias Lohr [ 15/Apr/13 ]

Fixed it (https://github.com/doctrine/dbal/pull/305).





[DBAL-489] [GH-302] [DBAL-374] Fix asset identfier quotation Created: 08/Apr/13  Updated: 01/May/13

Status: In Progress
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Improvement Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of deeky666:

Url: https://github.com/doctrine/dbal/pull/302

Message:

This PR introduces a real solution for the issues discussed in DBAL-374(http://www.doctrine-project.org/jira/browse/DBAL-374).
It adds the possibility to retrieve quoted column names from <code>Index</code> and <code>ForeignKeyConstraint</code> assets if it is necessary (e.g. column name is a keyword reserved by the platform).
In general column names are wrapped into an abstraction class <code>Identifier</code> which inherits from <code>AbstractAsset</code> inside <code>Index</code> and <code>ForeignKeyConstraint</code>. This allows to get a quoted representation of each column name via the <code>AbstractAsset::getQuotedName</code>.
All platforms are updated to make use of the new functionality.






[DBAL-483] default values make orm:validate-schema fail Created: 04/Apr/13  Updated: 01/May/13  Resolved: 01/May/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.3.4
Security Level: All

Type: Bug Priority: Major
Reporter: Till Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 1
Labels: schematool
Environment:

MySQL, PHP 5.3, Doctrine 2.3



 Description   
% ./bin/doctrine.php --env=development orm:schema-tool:update --dump-sql                                                                                                  
ALTER TABLE groups CHANGE active active TINYINT(1) DEFAULT '1' NOT NULL;
ALTER TABLE module ADD root_order INT DEFAULT 0 NOT NULL
% ./bin/doctrine.php --env=development orm:schema-tool:update --force
Updating database schema...
Database schema updated successfully! "2" queries were executed
% ./bin/doctrine.php --env=development orm:schema-tool:update --dump-sql                                                                                                  ALTER TABLE groups CHANGE active active TINYINT(1) DEFAULT '1' NOT NULL;
ALTER TABLE module CHANGE root_order root_order INT DEFAULT 0 NOT NULL

My entities define these columns like this:

Group
    /**
     * @ORM\Column(name="active", type="boolean", options={"default":true})
     */
    private $active = true;
Module
    /**
     * @ORM\Column(name="root_order", type="integer", options={"default":0})
     */
    private $rootOrder = 0;


 Comments   
Comment by Felix Kaser [ 30/Apr/13 ]

We are having the same issue. Is there any workaround for this?

Comment by Felix Kaser [ 30/Apr/13 ]

I've investigated a bit and noticed several things:

  • looks like doctrine does not (officially?) support setting of default options in the annotation. It is recommended to use the instance default ($rootOrder = 0).
  • in the comparator class the Column->getDefault() is compared, but I found out that in one table (I guess the one from mysql) the default is set directly, in the other one (I guess the doctrine one generated from the annotations) the default is empty but the customSchemaOptions["default"] is set.

So based on this I would say:

  • the $column->getDefault needs to be checked against the other $column->getCustomSchemaOption("default") and vice versa

Please correct me if I'm wrong





[DBAL-264] Support for UIDs in PostgreSQL Created: 30/Apr/12  Updated: 29/Apr/13

Status: Awaiting Feedback
Project: Doctrine DBAL
Component/s: Platforms
Affects Version/s: 2.3
Fix Version/s: None
Security Level: All

Type: New Feature Priority: Major
Reporter: ross neacoders Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Please add support for uuid datatype in PostgreSQL



 Comments   
Comment by Darrell Hamilton [ 12/Oct/12 ]

It seems the only missing piece is the implementation of the getGuidExpression method in the PostgreSqlPlatform class.

Details on generating UUIDs from postgres can be found here:

http://www.postgresql.org/docs/current/static/uuid-ossp.html

Things that would need to be addressed:

1) It requires the uuid-ossp module to be installed in the database. Solve with documentation or ...?

2) There isn't just one function. Just pick one or make it configurable with a sane default?

Comment by Ross Cousens [ 10/Dec/12 ]

I have implemented this for my own project, using what I think is a sane default:

public function getGuidExpression()

{ return 'uuid_generate_v4()'; }

The other issue I think that needs addressing is that the extension must be loaded into the current database upon creation. Either this is a deal-breaker right here (relying on a PGSQL plugin that's not available by default)

OR

If not, maybe schema:update/create needs to check for whether postgresql is being used, whether there is a guid type/generator being used in an entity, and then either execute CREATE EXTENSION uuid-ossp;, and failing that return an exception that informs the user that uuid-ossp must be available as an extension before GUID generation can be used in entities.

Can someone explain to me please the position on this currently? Is it not ok to rely on non-core/standard functionality?

Comment by Mark Badolato [ 25/Apr/13 ]

Is there any sort of decision on this item? I was trying to use UUID with Postgres and finally got it to work by adding

public function getGuidExpression()

{ return 'UUID_GENERATE_V4()'; }

and went to submit a patch, then found this ticket and see that it's the exact same solution that Ross Cousens submitted above. I'd really like to not maintain my own fork of the repository just to have this change in place, and it seems like a reasonable fix (barring the uuid-ossp extension not being a Postgres default extension). Can we get this in there so it's available, and worry about the issue of informing the user about the extension at a later point?

Or is there an easy way that anyone knows that I can add the function to my own class (in a Symfony2 project) that would extend PostgreSqlPlatform.php and add the function, without the need for me to fork Doctrine and add it on my own?

Thanks,
--mark

Comment by Mark Badolato [ 25/Apr/13 ]

Pull request submitted

https://github.com/doctrine/dbal/pull/312

Comment by Ross Cousens [ 26/Apr/13 ]

I hope this gets accepted but I fear it won't.

The original complaint against implementing GUID for the PostgreSQL platform driver was because a) it required a separate extension to be enabled on the server itself b) and there were a number of GUID generation functions available.

To use anything but v4 would be asinine unless some external constraint was forcing you to use the older generation algorithms, so I think argument b is mostly moot. Argument a can easily be solved with documentation, programmatically as well (would require more work) or just left as is because the error back from postgresql is very verbose. Cannot find function uuid_generate_v4. Google it, see that extension is required, see that it's available in PostgreSQL contrib packages, enable it, and voila it works.

Comment by Mark Badolato [ 26/Apr/13 ]

Agreed, and I think that having SOMETHING that is usable (and has a very clear message that you need to install an extension) is better than nothing. The implementation can be expanded later to cover the extension not existing, or using something other than v4, etc. But this should be good enough for most people and it seems silly not to have, or at least not have a way to override and provide it.

I was looking at the Symfony configs to see if there was a way to define my own platform class that could then just extend the current PostgreSqlPlatform class and add a the function, but that doesn't seem to be doable (or I just missed it)

Comment by Mark Badolato [ 27/Apr/13 ]

I just saw that this got merged into master. As soon as this hits 2.3* I can do away with the manual UUID generation for id's that we're currently doing

Thanks much Benjamin!

Comment by Ross Cousens [ 29/Apr/13 ]

Yay, I am happy that this has been accepted and will make it through to next release. Thank you Mark/Benjamin!





[DBAL-503] [GH-311] [WIP] Fixed CS Created: 23/Apr/13  Updated: 27/Apr/13  Resolved: 27/Apr/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Improvement Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Invalid Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of hason:

Url: https://github.com/doctrine/dbal/pull/311

Message:



 Comments   
Comment by Doctrine Bot [ 27/Apr/13 ]

A related Github Pull-Request [GH-311] was closed:
https://github.com/doctrine/dbal/pull/311





[DBAL-506] [GH-312] [DBAL-264] Support for UIDs in PostgreSQL Created: 25/Apr/13  Updated: 27/Apr/13  Resolved: 27/Apr/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of mbadolato:

Url: https://github.com/doctrine/dbal/pull/312

Message:

Add getGuidExpression() to PostgreSqlPlatform so that UUID support
works properly



 Comments   
Comment by Doctrine Bot [ 27/Apr/13 ]

A related Github Pull-Request [GH-312] was closed:
https://github.com/doctrine/dbal/pull/312





[DBAL-507] [GH-313] Enhanced Master-Slave Connection Created: 26/Apr/13  Updated: 27/Apr/13  Resolved: 27/Apr/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Won't Fix Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of andrejhudec:

Url: https://github.com/doctrine/dbal/pull/313

Message:

Q A
-------------
Bug fix? no
New feature? yes
BC breaks? no?
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT

Current implementation of MasterSlaveConnection is very restrictive. The slave is picked up only when `executeQuery` is used. If appliacation uses `prepare` method in queries, every `SELECT` is done on master and this is bad for performance of master.

This PR changes how and when it picks the slave or master:

1. Slave if master was never picked before and ONLY if `getWrappedConnection`, `query`, `prepare`, or `executeQuery` is used and the query begins with `SELECT` (case insensitive) string.

2. Master picked when `exec`, `executeUpdate`, `insert`, `delete`, `update`, `createSavepoint`, `releaseSavepoint`, `beginTransaction`, `rollback`, `commit` is called.

3. Master picked when `query`, `prepare` or `executeQuery` is called and the query doesn't begin with `SELECT` (case insensitive) string.

4. If master was picked once during the lifetime of the connection it will always get picked afterwards.

5. One slave connection is randomly picked ONCE during a request.



 Comments   
Comment by Doctrine Bot [ 27/Apr/13 ]

A related Github Pull-Request [GH-313] was closed:
https://github.com/doctrine/dbal/pull/313





[DBAL-384] Missing TIMESTAMP support Created: 16/Nov/12  Updated: 27/Apr/13  Resolved: 27/Apr/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: 2.0, 2.1, 2.2, 2.3
Fix Version/s: 2.2.2

Type: Improvement Priority: Minor
Reporter: Harrie Bos Assignee: Benjamin Eberlei
Resolution: Won't Fix Votes: 0
Labels: None

Attachments: Text File timestamp.patch    

 Description   

Here's a fix to add support for a TIMESTAMP field in the database.



 Comments   
Comment by Florin Patan [ 18/Nov/12 ]

@Benjamin should I create a PR for this on GH?

Comment by Harrie Bos [ 18/Nov/12 ]

I think it should be fixed in one of the next releases

Comment by frank [ 26/Apr/13 ]

this aint working.. further more i used... http://www.doctrine-project.org/jira/secure/attachment/11350/timestamp.patch

which includes a bit more.. like the actual timestamp.php

but still getting error

Could not convert database value "0000000016E2BCF7" to Doctrine Type timestamp. Expected format: Y-m-d H:i:s

500 Internal Server Error - ConversionException

Comment by Benjamin Eberlei [ 27/Apr/13 ]

Please add this as a custom type to your own project if you need it, this is not going to be part of DBAL Core





[DBAL-474] SchemaManager / Connection on PostgreSQL platform does not respect filterExpression for sequences Created: 27/Mar/13  Updated: 24/Apr/13

Status: Awaiting Feedback
Project: Doctrine DBAL
Component/s: Schema Managers
Affects Version/s: 2.2.2
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: jos de witte Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: postgresql, schematool
Environment:

Windows & Linux



 Description   

Dear Symfony team,

the filterExpression on AbstractSchemaManager seems not to work for sequences.

This only happens under postgres.

It seems the way the sequences are handled are the culprit: It tries to get min_value etc of sequences without matching sequence names to the filter expression in advance.

If for example access to the sequences is denied, (Different schema without permissions for the current entity manager), any higher-level ORM operations like generating migration versions fail.

--------------------- UPDATE

the context is when using migrations. Positive regexp expressions do not limit the migration to a single schema. eg ^schemaname.$
Instead, all sequences on the current database are returned.
When trying to limit a migration to a single schema consecutively this doesn't work.
We are using a per-schema connection, so this results in a lot of hassle for us.



 Comments   
Comment by Benjamin Eberlei [ 14/Apr/13 ]

Can you paste an exception trace? I see that filtering is applied to sequences, but your description seems to indicate this happens due to an SQL query much earlier?

Comment by jos de witte [ 24/Apr/13 ]

Dear Benjamin,

the context is when using migrations. Positive regexp expressions do not limit the migration to a single schema. eg ^schemaname.$
Instead, all sequences on the current database are returned.
When trying to limit a migration to a single schema consecutively this doesn't work.
We are using a per-schema connection, so this results in a lot of hassle for us.





[DBAL-505] Issue whenusing serial columns in PostgreSQL Created: 24/Apr/13  Updated: 24/Apr/13

Status: Open
Project: Doctrine DBAL
Component/s: Drivers, Platforms, Schema Managers
Affects Version/s: 2.3.3
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: jos de witte Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None
Environment:

PostgreSQL



 Description   

When using Doctrine ORM mapping fields like this:

/**

  • @var integer
    *
  • @ORM\Column(name="id", type="integer", nullable=false)
  • @ORM\Id
  • @ORM\GeneratedValue(strategy="IDENTITY")
  • @ORM\SequenceGenerator(sequenceName="schemaname.tablename_id_seq", allocationSize=1, initialValue=1)
    */
    private $id;

It first creates the migration perfectly as a serial column with the correct schema.

However when making a new migration diff it generates DROP statements for every sequence for these id, so we have to remove them manually every time.






[DBAL-502] [GH-310] fix function name in exception text Created: 23/Apr/13  Updated: 23/Apr/13  Resolved: 23/Apr/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of pscheit:

Url: https://github.com/doctrine/dbal/pull/310

Message:



 Comments   
Comment by Doctrine Bot [ 23/Apr/13 ]

A related Github Pull-Request [GH-310] was closed:
https://github.com/doctrine/dbal/pull/310

Comment by Marco Pivetta [ 23/Apr/13 ]

merged





[DBAL-442] Break the query building with multiple from parts Created: 10/Feb/13  Updated: 22/Apr/13  Resolved: 22/Apr/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: 2.3.2
Fix Version/s: 2.4
Security Level: All

Type: Bug Priority: Major
Reporter: Denis Vasilev Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: mysql


 Description   

For example:

$queryBuilder
    ->select('DISTINCT c.id')
    ->from('Campaigns', 'c')
    ->leftJoin('c', 'CampaignOperations', 'od', 'od.campaignId = c.id AND od.operation = :operation')
    ->from('BannerGroups', 'bg')
    ->innerJoin('bg', 'BannerGroupStrategies', 'bgs', 'bgs.groupId = bg.id AND bgs.advSystem = :system')
    ->where('bg.campaignId = c.id');

Builded the query:

SELECT DISTINCT c.id FROM Campaigns s 
  LEFT JOIN CampaignOperations od ON (od.campaignId = c.id AND od.operation = :operation)
  INNER JOIN BannerGroupStrategies bgs ON (bgs.groupId = bg.id AND bgs.advSystem = :system), 
  BannerGroups bg
  WHERE (bg.campaignId = c.id)

If this query execute on mysql, we get error:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'bg.id' in 'on clause'

Expected result:

SELECT DISTINCT c.id FROM Campaigns s 
  LEFT JOIN CampaignOperations od ON (od.campaignId = c.id AND od.operation = :operation),
  BannerGroups bg
  INNER JOIN BannerGroupStrategies bgs ON (bgs.groupId = bg.id AND bgs.advSystem = :system)
  WHERE (bg.campaignId = c.id)

Regression after patch https://github.com/doctrine/dbal/pull/175



 Comments   
Comment by Denis Vasilev [ 10/Feb/13 ]

https://github.com/doctrine/dbal/pull/270

Comment by Fabio B. Silva [ 22/Apr/13 ]

Fixed by : https://github.com/doctrine/dbal/commit/99574240f332a814ec193b6e7a88abb6a457f061





[DBAL-496] "Undefined index" errors when using prepared statements Created: 16/Apr/13  Updated: 21/Apr/13  Resolved: 20/Apr/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Blocker
Reporter: Lukas Kahwe Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

Since a few days we are seeing errors like this in the Jackalope Doctrine DBAL test suite when using prepared statements:
https://travis-ci.org/jackalope/jackalope-doctrine-dbal/jobs/6350278#L117



 Comments   
Comment by Marco Pivetta [ 16/Apr/13 ]

First failure I can see is at https://travis-ci.org/jackalope/jackalope-doctrine-dbal/jobs/6347501 - is there any other relevant failure before that one?

Comment by Marco Pivetta [ 16/Apr/13 ]

The notice is thrown in in

Doctrine\DBAL\SQLParserUtils::expandListParameters

Can be reproduced with parameters:

$query:

UPDATE phpcr_nodes SET sort_order = CASE CONCAT(
          namespace,
          (CASE namespace WHEN '' THEN '' ELSE ':' END),
          local_name
        ) WHEN :name0 THEN :order0 WHEN :name1 THEN :order1 WHEN :name2 THEN :order2 WHEN :name3 THEN :order3 WHEN :name4 THEN :order4 ELSE sort_order END WHERE parent = :absPath

$params:

array(
    ':absPath' => '/topic',
    ':name0' => 'page3',
    ':order0' => 0,
    ':name1' => 'page1',
    ':order1' => 1,
    ':name2' => 'page2',
    ':order2' => 2,
    ':name3' => 'page3',
    ':order3' => 3,
    ':name4' => 'page4',
    ':order4' => 4,
)

$types:

array()
Comment by David Buchmann [ 17/Apr/13 ]

are we doing something wrong or is this a regression in dbal?

should we for now force an older version of doctrine-dbal? (this would be annyoing however, as we would run into version conflicts with doctrine-commons then i think)

Comment by Daniel Leech [ 17/Apr/13 ]

Seems this is caused by: https://github.com/doctrine/dbal/commit/64647f9e55749147b738cdba9378fa0401fadcbf

Comment by Fabio B. Silva [ 18/Apr/13 ]

I think the problem here is the ':' on the parameter key, which i'm not sure if are suported for DBAL.
Before #DBAL-488 it does not apply 'SQLParserUtils::expandListParameters' for parameters without types.

Comment by Benjamin Eberlei [ 20/Apr/13 ]

Reverted in master and 2.3

Comment by Fabio B. Silva [ 20/Apr/13 ]

Benjamin, Not sure if we should consider this one related to #DBAL-488.
It just show us another unsupported/unexpected behavior.

Actually, it will keep failing with any parameter key starting with ':' when types are given.

For instance :

$query:

SELECT * FROM foo WHERE bar = :bar

$params:

array(':bar'=>'Some String')

$types:

array(':bar'=>\PDO::PARAM_STR)
Comment by Lars Strojny [ 21/Apr/13 ]

Here is a successor for the fix from PR 301, @Fabio, could you test that with your code base: https://github.com/doctrine/dbal/pull/309





[DBAL-373] Indexes and uniqueConstraints has been ignored Created: 26/Oct/12  Updated: 20/Apr/13

Status: Awaiting Feedback
Project: Doctrine DBAL
Component/s: Schema Managers
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Minor
Reporter: Diego Oliveira Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Ubuntu 12.04 with MySQL 5.5 and PHP 5.4


Attachments: Text File dbal-fixing-373.patch     Text File orm-fixing-373.patch    

 Description   

I using the Doctrine Migrations and when I declared my entity with the indexes section, the index name has been ignored. It's like this:

indexes:
IDX_ADDRESS_CITY:
columns: city_id

but, the diff tools ignore it and give me this code:
$this->addSql("CREATE INDEX IDX_7299B5238BAC62AF ON tb_address (city_id)");

and it should be:
$this->addSql("CREATE INDEX IDX_ADDRESS_CITY ON tb_address (city_id)");

Notice: I open the same bug on the migrations repository in github and @kimhemsoe told me to open here, since this is generated by DBAL component.



 Comments   
Comment by Padraig O'Sullivan [ 11/Dec/12 ]

Did you specify an index name in the indexes property for your entity in your PHP file? In this case, you should have something like:

indexes={@Index(name="IDX_ADDRESS_CITY", columns={"city_id"})}

That should result in the correct SQL being generated. If I modify the above to:

indexes={@Index(columns={"city_id"})}

I also get a migration that has SQL with an auto-generated index name.

Comment by Diego Oliveira [ 02/Feb/13 ]

Yes I did specify a name, as you can see:

uniqueConstraints:
    UNIQUE_STATE_SLUG:
        columns: slug
indexes:
    IDX_USER_ADDRESS:
        columns: address_id

I don't try do to it using annotations because I choose do use yaml to describe my entities. I will take a look on the source code to see if I can fix it and send a PR.

Comment by Diego Oliveira [ 02/Apr/13 ]

I already sent this patch to Guilherme Blanco, but I guess he doesn't have time to take a look on it.

I guess my solution it's not ideal, but it solve the problem and can be a base to make a better solution.

Comment by Benjamin Eberlei [ 20/Apr/13 ]

Diego Oliveira the fix doesn't seem too nice with the additional boolean flag.

I would rather like to fix the root cause instead of adding this solution.

Comment by Benjamin Eberlei [ 20/Apr/13 ]

The issue is tricky, because we cannot just move the index definitions above, they will need the columns, however that directly generates the index in the schema tool. Maybe if the gather join column methods would check if they can add an index already it would work.





[DBAL-375] Warning "Udefined index dbname" while creating database with oci8 driver Created: 31/Oct/12  Updated: 20/Apr/13

Status: Open
Project: Doctrine DBAL
Component/s: Drivers
Affects Version/s: 2.2.2, 2.3.1
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: pavel patrin Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 1
Labels: dbname, oci8


 Description   

In config specified:

doctrine:
dbal:
driver: "oci8"
host: "localhost"
port: "1521"
dbname: "orcl50"
user: "SYSTEM"
password: "123456"
charset: UTF8

When i create database (with symfony 2, doctrine:database:create), got that error:

=====================================
Could not create database for connection named orcl50
Notice: Undefined index: dbname in /path/to/symfony/vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/OCI8/Driver.php line 67
=====================================

If i comment "unset($params['dbname'])" in CreateDatabaseDoctrineCommand.php:54 all works fine.



 Comments   
Comment by Kris Willis [ 13/Nov/12 ]

I'm experiencing the same issue and your fix appears to work for me too; thanks!

Comment by Benjamin Eberlei [ 20/Apr/13 ]

on Oracle CREATE DATABASE is actually a CREATE USER. I am not sure the command should allow to do this.





[DBAL-487] DBAL's SqlitePlatform does not allow for fields of type 'integer unsigned'. Whether they exist already or not. Created: 05/Apr/13  Updated: 20/Apr/13  Resolved: 20/Apr/13

Status: Resolved
Project: Doctrine DBAL
Component/s: Platforms
Affects Version/s: 2.3.3
Fix Version/s: 2.3.4

Type: Bug Priority: Minor
Reporter: Richard Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

I'm getting the following error when I'm merely requesting schemaManager->listTables() on an SQLite DB with several columns set to 'integer unsigned'.

PHP Fatal error: Uncaught exception 'Doctrine\DBAL\DBALException' with message 'Unknown database type integer unsigned requested, Doctrine\DBAL\Platforms\SqlitePlatform may not support it.' in /..snip../vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php:321

$ sqlite3 --version
3.7.14.1



 Comments   
Comment by Benjamin Eberlei [ 20/Apr/13 ]

Fixed





[DBAL-498] [GH-306] [DBAL-497] Fixed SQL Server platform replacing 'FROM' in column names during limit Created: 18/Apr/13  Updated: 20/Apr/13  Resolved: 18/Apr/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Guilherme Blanco
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of shaneneuerburg:

Url: https://github.com/doctrine/dbal/pull/306

Message:

The regex used to replace the FROM clause was in a "starts with" form, which also matched column names that start with the word "FROM". This resulted in column names being replaced with the logic used for limiting, breaking the query once pagination is used. I added a whitespace requirement after "FROM' in the regex as well as a trailing whitespace in the replacement.



 Comments   
Comment by Doctrine Bot [ 18/Apr/13 ]

A related Github Pull-Request [GH-306] was closed:
https://github.com/doctrine/dbal/pull/306

Comment by Marco Pivetta [ 18/Apr/13 ]

merged





[DBAL-497] SQLServerPlatform modifies limit query incorrectly when column names start with "from" Created: 18/Apr/13  Updated: 20/Apr/13  Resolved: 20/Apr/13

Status: Resolved
Project: Doctrine DBAL
Component/s: Platforms
Affects Version/s: 2.3.3
Fix Version/s: 2.4
Security Level: All

Type: Bug Priority: Major
Reporter: Shane Neuerburg Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: sqlserver
Environment:

OS X using FreeTDS driver, unixODBC
SQL Server 2008



 Description   

I am working with a table that has columns that start with the word "from" (fromNumber, fromCity, etc). When SQLServerPlatform->doModifyLimitQuery is called, "from" in the names are incorrectly replaced. I suggest adding a whitespace requirement after FROM in the preg_replace on this line:
https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php#L848

So this:

$query = preg_replace('/\sFROM/i', ", ROW_NUMBER() OVER ($over) AS doctrine_rownum FROM", $query);

Becomes this:

$query = preg_replace('/\sFROM\s/i', ", ROW_NUMBER() OVER ($over) AS doctrine_rownum FROM ", $query);


 Comments   
Comment by Shane Neuerburg [ 18/Apr/13 ]

Pull request:
https://github.com/doctrine/dbal/pull/306





[DBAL-494] [GH-304] Fix for DBAL-442 Created: 14/Apr/13  Updated: 14/Apr/13  Resolved: 14/Apr/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Guilherme Blanco
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of yethee:

Url: https://github.com/doctrine/dbal/pull/304

Message:



 Comments   
Comment by Doctrine Bot [ 14/Apr/13 ]

A related Github Pull-Request [GH-304] was closed:
https://github.com/doctrine/dbal/pull/304





[DBAL-431] [GH-261] Fix OFFSET without LIMIT cause MySQL syntax error. Created: 29/Jan/13  Updated: 14/Apr/13  Resolved: 14/Apr/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of Everus:

Url: https://github.com/doctrine/dbal/pull/261

Message:

MySQL OFFSET require LIMIT.
So fixed it to use the biggest limit possible as it recommended in http://dev.mysql.com/doc/refman/5.0/en/select.html#id4651990



 Comments   
Comment by Doctrine Bot [ 14/Apr/13 ]

A related Github Pull-Request [GH-261] was closed:
https://github.com/doctrine/dbal/pull/261





[DBAL-420] Schema Drop SQL incorrect on PostgreSQL with entities with GeneratedValue(strategy="IDENTITY") Created: 23/Jan/13  Updated: 14/Apr/13  Resolved: 14/Apr/13

Status: Resolved
Project: Doctrine DBAL
Component/s: Schema Managers
Affects Version/s: 2.3.2
Fix Version/s: 2.3.4
Security Level: All

Type: Bug Priority: Major
Reporter: Adam Ashley Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 1
Labels: postgresql, schematool
Environment:

Symfony 2.1, PHP5.4, PostgreSQL 9.1 on Ubuntu 12.04



 Description   

This problem is probably related to #DBAL-54. However that was closed by the raiser as he changed his Entity model and it went away.

When schema drop is run the following error occurs:
Doctrine\DBAL\DBALException: An exception occurred while executing 'DROP SEQUENCE radacct_radacctid_seq':

SQLSTATE[2BP01]: Dependent objects still exist: 7 ERROR: cannot drop sequence radacct_radacctid_seq because other objects depend on it
DETAIL: default for table radacct column radacctid depends on sequence radacct_radacctid_seq
HINT: Use DROP ... CASCADE to drop the dependent objects too.

The source of this problem is the difference between strategy="IDENTITY" and strategy="SEQUENCE"

With SEQUENCE doctrine creates the table schema with field type BIGINT and no specified. It then creates a seperate sequence and as far as I can tell takes care of getting and inserting the next id number itself.

With IDENTITY doctrine creates the table schema with field type BIGSERIAL and no specified default. Now postgres automatically creates a sequence and creates the column with type BIGINT and sets the DEFAULT to the pgpsql statement required to get the nextval from the sequence.

At this point the two differently configured tables will work successfully and identically, except SEQUENCE tables will only get a correct new ID when run through the doctrine code while IDENTITY tables will get the correct new ID whenever an insert is done to the table.

Because in the case of an IDENTITY field postgresql creates the field with a default value refering to the sequence the sequence can not be deleted before the table reference is removed.

For my case I need the IDENTITY fields to work as we have a RADIUS server that needs to insert into one table which is managed and mapped to an entity in Doctrine.

Swapping the order of DROP TABLE and DROP SEQUENCE commands in Doctrine/DBAL/Schema/Visitor/DropSchemaSqlCollector.php in getQueries() line 159. Does not work as a quick fix. The following error occurs as the sequence is quite correctly be dropped along with the table.

Doctrine\DBAL\DBALException: An exception occurred while executing 'DROP SEQUENCE radacct_radacctid_seq':

SQLSTATE[42P01]: Undefined table: 7 ERROR: sequence "radacct_radacctid_seq" does not exist



 Comments   
Comment by Adam Ashley [ 24/Jan/13 ]

This issue also appears to affect Doctrine_Migrations. Generated migrations try to drop and recreate automatically generated sequences associated with SERIAL fields making a mess of the database.

Comment by Benjamin Eberlei [ 22/Mar/13 ]

A related Github Pull-Request [GH-289] was opened
https://github.com/doctrine/dbal/pull/289

Comment by Adrien Crivelli [ 12/Apr/13 ]

@Adam Ashley, could you test whether https://github.com/doctrine/dbal/pull/289 solve your issue ?

Comment by Doctrine Bot [ 14/Apr/13 ]

A related Github Pull-Request [GH-289] was closed:
https://github.com/doctrine/dbal/pull/289





[DBAL-429] [GH-259] fix named_token Created: 28/Jan/13  Updated: 14/Apr/13  Resolved: 14/Apr/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.3.4
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of dready:

Url: https://github.com/doctrine/dbal/pull/259

Message:

Regex Token Pattern for NAMED_TOKEN does not support sql cast operator ::

For example a query like this:
Select mydate::date from mytable;

will return a place holder ':date' instead of ignoring this.

fixed by adjusting the regex to ignore the operator.



 Comments   
Comment by Doctrine Bot [ 14/Apr/13 ]

A related Github Pull-Request [GH-259] was closed:
https://github.com/doctrine/dbal/pull/259





[DBAL-432] [GH-262] Add Symfony Console dependency to composer.json Created: 29/Jan/13  Updated: 14/Apr/13  Resolved: 14/Apr/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of BenMorel:

Url: https://github.com/doctrine/dbal/pull/262

Message:

The DBAL component offers a command-line tool based on Symfony Console, but this one is not present as a dependency in `composer.json`.

This PR adds the dependency.



 Comments   
Comment by Doctrine Bot [ 14/Apr/13 ]

A related Github Pull-Request [GH-262] was closed:
https://github.com/doctrine/dbal/pull/262





[DBAL-445] [GH-271] added the possibility to use column names as keys for the types in Connection::insert() Created: 12/Feb/13  Updated: 14/Apr/13  Resolved: 14/Apr/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of fabpot:

Url: https://github.com/doctrine/dbal/pull/271

Message:

The Connection::insert() method takes an array of types as its third argument:

$conn->insert('foo', array('foo' => 'foo', 'date' => new \DateTime()), array(2 => 'datetime'));

But without looking at the implementation, I'm sure you would have written the following instead:

$conn->insert('foo', array('foo' => 'foo', 'date' => new \DateTime()), array('date' => 'datetime'));

But unfortunately, that's does not work. This commit add support for this, and of course, the old way still works.



 Comments   
Comment by Doctrine Bot [ 14/Apr/13 ]

A related Github Pull-Request [GH-271] was closed:
https://github.com/doctrine/dbal/pull/271





[DBAL-443] [GH-270] Fix for DBAL-442 Created: 10/Feb/13  Updated: 14/Apr/13  Resolved: 14/Apr/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Invalid Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of yethee:

Url: https://github.com/doctrine/dbal/pull/270

Message:



 Comments   
Comment by Doctrine Bot [ 14/Apr/13 ]

A related Github Pull-Request [GH-270] was closed:
https://github.com/doctrine/dbal/pull/270

Comment by Benjamin Eberlei [ 14/Apr/13 ]

Invalid branch





[DBAL-475] [GH-293] Add SAP SQL Anywhere database vendor Created: 28/Mar/13  Updated: 14/Apr/13

Status: Open
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: New Feature Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of deeky666:

Url: https://github.com/doctrine/dbal/pull/293

Message:

This PR adds the driver and DBAL for SAP SQL Anywhere databases. It distinguishes between versions 10 and below (base <code>SQLAnywherePlatform</code>), 11 (<code>SQLAnywhere11Platform</code>) and 12 (<code>SQLAnywherer12Platform</code>), similar to Microsoft SQL Server.
Most of the functional tests pass but there are some exceptions:

  • <code>DataAccessTest::testFetchAllWithTypes</code>
    <pre>
    Failed asserting that two strings are equal.
      • Expected
        +++ Actual
        @@ @@
        -'2010-01-01 10:10:10'
        +'2010-01-01 10:10:10.000'
        </pre>
        The test is not aware of the datetime format string of the platform, which differs in SQL Anywhere. Therefore it fails. In SQL Anywhere a datetime is stored with second fractions by default.
        IMO I have two options here. Changing the default timestamp format for data output in the driver on every connection so that it fits <code>Y-m-d H:i:s</code> and changing the date format strings in the platforms or modifying the test to be aware of the platform specific datetime format.
  • <code>MasterSlaveConnectionTest::testKeepSlaveBeginTransactionStaysOnMaster</code>
    The test simply hangs up here and I don't exactly know why. When I change the value for insert in line 95 to some other value than 30 it perfectly works. Any help would be appreciated here.
  • <code>ModifyLimitQueryTest::testModifyLimitQueryGroupBy</code>
    <pre>
    Failed asserting that two arrays are equal.
      • Expected
        +++ Actual
        @@ @@
        Array (
    • 0 => 1
    • 1 => 2
      ++ 0 => 2
      ++ 1 => 1
      )
      </pre>
      The test does not tell the SELECT statement to order the result, thus the result is not deterministic and returns the results in wrong order.
      IMO the test should be fixed so that the result is ordered correctly. Then the test will pass for SQL Anywhere.
  • <code>TemporaryTableTest</code>
    <pre>Exception: [Doctrine\DBAL\DBALException] An exception occurred while executing 'CREATE GLOBAL TEMPORARY TABLE temporary (id INT NOT NULL)':
    SQLSTATE [42W04] [-131] Syntaxfehler bei 'temporary' in Zeile 1
    With queries:
    SQL: 'DROP TABLE temporary' Params:
    SQL: 'CREATE GLOBAL TEMPORARY TABLE temporary (id INT NOT NULL)' Params:
    SQL: 'DROP TABLE nontemporary' Params:</pre>
    The tests use the unquoted keyword "temporary" reserved by SQL Anywhere for the temporary table name to create.
    I cannot quote the name of the temporary table in the platform as the method <code>getTemporaryTableName</code> expects a string and not an instance of <code>Doctrine\DBAL\Schema\Table</code> as parameter.
    Either the tests should use a non reserved keyword as temporary table name or the temporary table name has to be quoted in the platform (but I don't know exactly how).
  • <code>TemporaryTableTest::testDropTemporaryTableNotAutoCommitTransaction</code>
    <pre>In an event of an error this result has one row, because of an implicit commit.
    Failed asserting that two arrays are equal.
      • Expected
        +++ Actual
        @@ @@
        Array (
        ++ 0 => Array (...)
        )
        </pre>
        The test fails because of an implicit commit during the transaction (drop temporary table) which inserts the first value. I couldn't find a solution for this problem. Seems to be the same problem as reported in DDC-1337(http://www.doctrine-project.org/jira/browse/DDC-1337).
  • <code>WriteTest::testLastInsertIdNoSequenceGiven</code>
    <pre>Failed asserting that 14 is false.</pre>
    I don't exactly know why the test expects the lastInsertId to be false here. Using the same connection for 14 inserts into a newly created autoincrement table should result in lastInsertId = 14 IMO. Is this a bug in the test? How do other vendors behave here?

I hope this addition is appreciated and any feedback/help on the above issues would be welcomed.






[DBAL-488] [GH-301] Fixing issue when number of positional parameters != number of given types Created: 08/Apr/13  Updated: 14/Apr/13  Resolved: 14/Apr/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.3.4
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of lstrojny:

Url: https://github.com/doctrine/dbal/pull/301

Message:

When passing incomplete type information to `Connection::query()`, `SQLParserUtils` currently behaves the wrong way as it ignores all typing information instead falling back to a default (`PDO::PARAM_STR`). I don���t know this place very well, so please review carefully.



 Comments   
Comment by Doctrine Bot [ 08/Apr/13 ]

A related Github Pull-Request [GH-301] was closed:
https://github.com/doctrine/dbal/pull/301





[DBAL-491] Oracle platform should not support dropping database Created: 10/Apr/13  Updated: 14/Apr/13  Resolved: 14/Apr/13

Status: Resolved
Project: Doctrine DBAL
Component/s: Platforms
Affects Version/s: 2.3.3
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Raymond Kolbe Assignee: Benjamin Eberlei
Resolution: Won't Fix Votes: 0
Labels: None
Environment:

RHEL w/Oracle



 Description   

It appears that attempting to run the Doctrine ORM test suite against an Oracle database causes the following exception:

[root@raymond-kolbe-1 orm]# /usr/local/zend/bin/phpunit -c oracle.xml
PHPUnit 3.7.19 by Sebastian Bergmann.

Configuration read from /home/rkolbe/sites/trainingv2/vendor/doctrine/orm/oracle.xml

......................SSSSSS...........................E

Time: 1 second, Memory: 68.75Mb

There was 1 error:

1) Doctrine\Tests\ORM\Functional\AdvancedAssociationTest::testIssue
Doctrine\DBAL\DBALException: An exception occurred while executing 'DROP USER rkolbe CASCADE':

ORA-01940: cannot drop a user that is currently connected

/home/rkolbe/sites/trainingv2/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:47
/home/rkolbe/sites/trainingv2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php:189
/home/rkolbe/sites/trainingv2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Connection.php:112
/home/rkolbe/sites/trainingv2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:791
/home/rkolbe/sites/trainingv2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php:816
/home/rkolbe/sites/trainingv2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php:306
/home/rkolbe/sites/trainingv2/vendor/doctrine/orm/tests/Doctrine/Tests/TestUtil.php:66
/home/rkolbe/sites/trainingv2/vendor/doctrine/orm/tests/Doctrine/Tests/OrmFunctionalTestCase.php:315
/home/rkolbe/sites/trainingv2/vendor/doctrine/orm/tests/Doctrine/Tests/ORM/Functional/AdvancedAssociationTest.php:17

Caused by
Doctrine\DBAL\Driver\OCI8\OCI8Exception: ORA-01940: cannot drop a user that is currently connected

/home/rkolbe/sites/trainingv2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Exception.php:28
/home/rkolbe/sites/trainingv2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php:189
/home/rkolbe/sites/trainingv2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Connection.php:112
/home/rkolbe/sites/trainingv2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:791
/home/rkolbe/sites/trainingv2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php:816
/home/rkolbe/sites/trainingv2/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php:306
/home/rkolbe/sites/trainingv2/vendor/doctrine/orm/tests/Doctrine/Tests/TestUtil.php:66
/home/rkolbe/sites/trainingv2/vendor/doctrine/orm/tests/Doctrine/Tests/OrmFunctionalTestCase.php:315
/home/rkolbe/sites/trainingv2/vendor/doctrine/orm/tests/Doctrine/Tests/ORM/Functional/AdvancedAssociationTest.php:17

FAILURES!
Tests: 56, Assertions: 98, Errors: 1, Skipped: 6.

After investigating, I asked myself "Should Doctrine support dropping a "database"?" It should not, and here is why.

1) Oracle does not consider a "database" the same way MySQL and other vendors do. A "schema" is the database and this is the "user". Dropping a "database" drops the user. How would we recreate the database for testing purposes (read: DBAL drops and recreates the database)?

2) Oracle platform in DBAL does not support creating a database. Is this something we wish to support? I'm not sure how we would recreate a schema, since creating a schema is the same as creating a user. This is something we don't support on any platform. Also note, the return value of supportsCreateDropDatabase() is misleading as it says Oracle does support this feature.

Although this issue originated in Doctrine ORM, the root cause is the Oracle platform implementation in DBAL. I propose we remove support for dropping "databases" in Oracle since there is no way to create them.



 Comments   
Comment by Benjamin Eberlei [ 14/Apr/13 ]

That is why you have to have two users configured in the phpunit.xml, the temporary user deletes the first user and recreates him. This works perfectly fine for us. I am not sure we should remove this.

Comment by Benjamin Eberlei [ 14/Apr/13 ]

Closing as won't fix, anything else is an enhancement, depends on the arguments for removing this approach





[DBAL-493] Schema\Comparator incorrect diff with sqlite and unsigned integer Created: 12/Apr/13  Updated: 14/Apr/13  Resolved: 14/Apr/13

Status: Resolved
Project: Doctrine DBAL
Component/s: Schema Managers
Affects Version/s: 2.4
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Richard Hinkamp Assignee: Benjamin Eberlei
Resolution: Can't Fix Votes: 0
Labels: None
Environment:

php 5.3.10-1ubuntu3.6
SQLite Library => 3.7.9



 Description   

Using the Schema\Comparator to diff a table in sqlite with a unsigned integer. When creating the table and comparing it with the same definition it gives a diff which is not expected:

Unable to find source-code formatter for language: php. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
 
$schema = new \Doctrine\DBAL\Schema\Schema();
$usersTable = $schema->createTable("test_users");
$usersTable->addColumn("id", "integer", array("unsigned" => true, 'autoincrement' => true));
$usersTable->setPrimaryKey(array("id"));
$usersTable->addColumn("username", "string", array("length" => 32));
$usersTable->addIndex( array( 'username' ) );
$usersTable->addColumn("password", "string", array("length" => 64));

$platform = new \Doctrine\DBAL\Platforms\SqlitePlatform();
$queries = $platform->getCreateTableSQL($usersTable);
foreach($queries as $query) {
    $conn->query($query);
}

$tableDetail = $sm->listTableDetails($usersTable->getName());
$comparator = new \Doctrine\DBAL\Schema\Comparator();
$diff = $comparator->diffTable($tableDetail, $usersTable);
if ($diff) {
    print(implode("\n",$platform->getAlterTableSQL($diff)));
} else {
    print("no diff");
}

Expect result:

 
no diff

Actual result:

 
DROP INDEX IDX_1F5D03E2F85E0677
CREATE TEMPORARY TABLE __temp__test_users AS SELECT id, username, password FROM test_users
DROP TABLE test_users
CREATE TABLE test_users (id INTEGER NOT NULL, username VARCHAR(32) NOT NULL, password VARCHAR(64) NOT NULL, PRIMARY KEY(id))
INSERT INTO test_users (id, username, password) SELECT id, username, password FROM __temp__test_users
DROP TABLE __temp__test_users
CREATE INDEX IDX_1F5D03E2F85E0677 ON test_users (username)

When setting unsigned to false everything works. Shouldn't Doctrine know unsigned is not supported in sqlite?



 Comments   
Comment by Benjamin Eberlei [ 14/Apr/13 ]

SQLite doesn't have the notion of unsigned. You have to remote the "unsigned" => true flag to stop confusing Sqlite and the Comparision and it will work.





[DBAL-492] Foreign keys always changed with postgres non standard schema. Created: 11/Apr/13  Updated: 14/Apr/13  Resolved: 14/Apr/13

Status: Resolved
Project: Doctrine DBAL
Component/s: Schema Managers
Affects Version/s: 2.3.2, 2.3.3
Fix Version/s: 2.3.4
Security Level: All

Type: Bug Priority: Major
Reporter: Mārtiņš Šulcs Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None
Environment:

postgres



 Description   

Starting with this https://github.com/doctrine/dbal/commit/b84cda24335207d4e60afc88fa161317d94b6370#diff-0 all foreign keys in non standard schema all always different, because table1 doesn't contain a schema name in it but table2 does.



 Comments   
Comment by Benjamin Eberlei [ 14/Apr/13 ]

Fixed and waiting in 2.3 release branch for next mini





[DBAL-402] Fatal error: Uncaught exception Created: 29/Dec/12  Updated: 08/Apr/13

Status: Open
Project: Doctrine DBAL
Component/s: Drivers
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Blocker
Reporter: Ruslan Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: dql, oracle


 Description   
Fatal error: Uncaught exception 'Doctrine\DBAL\Driver\OCI8\OCI8Exception' with message 'ORA-00904: "T0"."ID": invalid identifier' in /var/www/doctrine/doctrine/lib/vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Exception.php on line 28 Doctrine\DBAL\Driver\OCI8\OCI8Exception: ORA-00904: "T0"."ID": invalid identifier in /var/www/doctrine/doctrine/lib/vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Exception.php on line 28

Call Stack: 0.0002 665368
1. {main}() /var/www/doctrine/doctrine/tools/sandbox/index.php:0 0.3389 6023864
2. Doctrine\ORM\EntityManager->find() /var/www/doctrine/doctrine/tools/sandbox/index.php:71 0.3514 8264024
3. Doctrine\ORM\Persisters\BasicEntityPersister->load() /var/www/doctrine/doctrine/lib/Doctrine/ORM/EntityManager.php:444 0.3521 8413576 
4. Doctrine\DBAL\Connection->executeQuery() /var/www/doctrine/doctrine/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php:725 0.3532 8625920
5. Doctrine\DBAL\Driver\OCI8\OCI8Statement->execute() /var/www/doctrine/doctrine/lib/vendor/doctrine-dbal/lib/Doctrine/DBAL/Connection.php:635 Variables in local scope (#5): $hasZeroIndex = *uninitialized* $key = *uninitialized* $params = NULL $ret = FALSE $val = *uninitialized* 


 Comments   
Comment by Benjamin Eberlei [ 06/Jan/13 ]

Format code sample

Comment by Benjamin Eberlei [ 04/Apr/13 ]

What is wrong here? The error alone is not very helpful





[DBAL-451] [GH-276] DBAL-446 Created: 19/Feb/13  Updated: 06/Apr/13  Resolved: 06/Apr/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Duplicate Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of nemekzg:

Url: https://github.com/doctrine/dbal/pull/276

Message:

Fix for DBAL-446 with a proper test case and two general test cases.






[DBAL-486] [GH-300] Improve list SQL Server table indexes Created: 04/Apr/13  Updated: 06/Apr/13  Resolved: 06/Apr/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of deeky666:

Url: https://github.com/doctrine/dbal/pull/300

Message:

This PR improves listing table indexes in SQL Server. Currently table indexes are retrieved in the platform via a stored procedure <code>sp_helpindex</code> which causes problems with some SQL Server drivers like ODBC that cannot retrieve information from stored procedure calls. Table indexes are retrieved via native system tables now, which seems cleaner and is more flexible concerning which information to retrieve.
Additionally code duplication in <code>SQLServerSchemaManager::_getPortableTableIndexesList</code> is removed and simplified by this PR.



 Comments   
Comment by Benjamin Eberlei [ 06/Apr/13 ]

A related Github Pull-Request [GH-300] was closed
https://github.com/doctrine/dbal/pull/300





[DBAL-484] [GH-298] Fix SQL Server default constraints Created: 04/Apr/13  Updated: 06/Apr/13  Resolved: 06/Apr/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of deeky666:

Url: https://github.com/doctrine/dbal/pull/298

Message:

This PR fixes altering column default values. In SQL Server column default values are stored in constraints. <code>CREATE TABLE</code> statements with column declarations like <code>some_column NVARCHAR(50) NOT NULL DEFAULT 'default value'</code> internally creates a default constraint with an automatically generated name in the the system table `sys.default_constraints`. <code>ALTER TABLE</code> statements do not support the <code>DEFAULT</code> clause in column alteration declarations, leading in SQL syntax errors. Thus changing a column's default value is currently not possible.
To alter a column's default value, the old column's default constraint hast to be dropped and recreated again. As a default constraint has to be referenced by name to be dropped, we need to create each default constraint with an own unique name. This PR generates separate statements for default constraint declarations. It generates a unique name consisting of the table name and the column name the default constraint is created for.
<code>DF_TABLE_NAME_HASH%_%COLUMN_NAME_HASH%</code>



 Comments   
Comment by Benjamin Eberlei [ 06/Apr/13 ]

A related Github Pull-Request [GH-298] was closed
https://github.com/doctrine/dbal/pull/298





[DBAL-485] [GH-299] Fix list SQL Server composite foreign keys Created: 04/Apr/13  Updated: 06/Apr/13  Resolved: 06/Apr/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of deeky666:

Url: https://github.com/doctrine/dbal/pull/299

Message:

This PR fixes listing composite foreign keys in <code>SQLServerSchemaManager</code>. Currently the schema manager creates a foreign key object for each column in a foreign key constraint returned by the platform's <code>listTableForeignKeysSQL</code>, This is ok for foreign keys consisting of only one column but fails for composite foreign key constraints. The test <code>testListForeignKeysComposite</code> in <code>SQLServerSchemaManagerTest</code> currently fails but is fixed with this PR.



 Comments   
Comment by Benjamin Eberlei [ 06/Apr/13 ]

A related Github Pull-Request [GH-299] was closed
https://github.com/doctrine/dbal/pull/299





[DBAL-472] Oracle schema modification - incorrect SQL to change the nullable status of column Created: 26/Mar/13  Updated: 04/Apr/13

Status: Open
Project: Doctrine DBAL
Component/s: Schema Managers
Affects Version/s: 2.3.2
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Andy Park Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Centos 6 PHP 5.3.3 Oracle 11g



 Description   

When updating the nullable status of a column the sql generated is

ALTER TABLE MET MODIFY (METAR VARCHAR2(2000) DEFAULT NULL)

This will set the default column value to null but does not modify the nullable status of the column. The correct sql would be

ALTER TABLE MET MODIFY (METAR VARCHAR2(2000) NULL)

The field definition changed from

metar:
type: string
length: 2000
nullable: false
column: METAR

to

metar:
type: string
length: 2000
nullable: true
column: METAR



 Comments   
Comment by Benjamin Eberlei [ 04/Apr/13 ]

Works for me strangely.





[DBAL-444] OraclePlatform getSequenceNextValSQL not handling case/quoting properly on 11g Created: 10/Feb/13  Updated: 04/Apr/13

Status: In Progress
Project: Doctrine DBAL
Component/s: Platforms
Affects Version/s: 2.3.2
Fix Version/s: 2.4
Security Level: All

Type: Bug Priority: Major
Reporter: Max Milaney Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: oci8, oracle, sequence
Environment:

PHP version 5.4.11
Oracle 11g Instant Client version 11.2.0.3.0
Oracle Database 11g Enterprise Edition version 11.2.0.3.0 (x64)
OCI8 DBAL driver


Attachments: File example.php    

 Description   

I have an installer script that uses ORM SchemaTool to create the entities in the DB and then populates with basic data using basic EM->persist calls via ORM.

Sequence objects are created, and when using the 10g Instant Client everything worked correctly, however, upon upgrade to latest version of the Instant Client Oracle seems to be expecting consistent case for these schema objects. It appears as if they are being created with a quoted name as they are created in lowercase. OraclePlatform::getSequenceNextValSQL, however, generates "SELECT entity_id_seq.nextval FROM DUAL" and this fails with error "General error: 2289 OCIStmtExecute: ORA-02289: sequence does not exist".

Executing "SELECT "entity_id_seq".nextval FROM DUAL" directly on the DB returns the correct value.

I believe this may also impact the code in http://www.doctrine-project.org/jira/browse/DBAL-278



 Comments   
Comment by Max Milaney [ 10/Mar/13 ]

Hi there,
Wondering if there is any update on this? I'm having to use a workaround in my applications.
Cheers,
Max

Comment by Benjamin Eberlei [ 14/Mar/13 ]

Can you maybe show an entity definition with its sequence mapping?

Comment by Max Milaney [ 17/Mar/13 ]

Here you are mate. Please see attachment.

Comment by Benjamin Eberlei [ 04/Apr/13 ]

I cant seem to find the problem, in DBAL "lib/Doctrine/DBAL/Platforms/OraclePlatform.php" on line 171, the sequence statement is created with $sequence->getQuotedName($platform), but this only works if quoting is requrested for the sequence.

How do you actually create the sequence? Your entity doesnt have @GeneratedValue.

What does the create schema command say with "--dump-sql" flag? Is the SQL quoted?





[DBAL-481] [GH-297] check for proper type when formatting dates Created: 02/Apr/13  Updated: 02/Apr/13  Resolved: 02/Apr/13

Status: Closed
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Invalid Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of mprzytulski:

Url: https://github.com/doctrine/dbal/pull/297

Message:



 Comments   
Comment by Benjamin Eberlei [ 02/Apr/13 ]

A related Github Pull-Request [GH-297] was closed
https://github.com/doctrine/dbal/pull/297





[DBAL-446] Type json_array can't be null Created: 13/Feb/13  Updated: 01/Apr/13  Resolved: 01/Apr/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: 2.3
Fix Version/s: 2.3.3
Security Level: All

Type: Bug Priority: Major
Reporter: Jan Hruban Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

Column type json_array can be set to nullable, but if there's null in the database, it is returned as an empty array to PHP.

Null should be returned instead, as that's how the other types behave too.



 Comments   
Comment by Benjamin Eberlei [ 01/Apr/13 ]

This was fixed in 2.3.3





[DBAL-476] [GH-294] Allow removing column comment on some platforms Created: 28/Mar/13  Updated: 01/Apr/13  Resolved: 01/Apr/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of deeky666:

Url: https://github.com/doctrine/dbal/pull/294

Message:

Some platforms currently do not remove a comment on a column on table alteration.
This PR fixes this. Also updated platform and functional schema tests for this.
Besides that <code>OraclePlatform</code> now does not generate a useless <code>ALTER TABLE MODIFY</code> SQL snippet when only the column comment has changed, as this is handled seperately through <code>COMMENT ON COLUMN</code> SQL statement.



 Comments   
Comment by Benjamin Eberlei [ 01/Apr/13 ]

A related Github Pull-Request [GH-294] was closed
https://github.com/doctrine/dbal/pull/294





[DBAL-478] [GH-295] Fix ModifyLimitQueryTest Created: 30/Mar/13  Updated: 01/Apr/13  Resolved: 01/Apr/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of deeky666:

Url: https://github.com/doctrine/dbal/pull/295

Message:

The functional <code>ModifyLimitQueryTest</code> makes false expectations about the query results. <code>LIMIT</code> queries without <code>ORDER BY</code> clause return non-deterministic results, therefore the test cannot make any expectations about which values are returned and in which order. You can only expect a certain number of results.
The test might still work on platforms like mysql when you assume results to be in an ascending order, because the database might put the results of a non-deterministic query in an ascending order by default. Still this is not reliable and not all vendors do that.
This PR changes the tests to have an ordered, deterministic results by default to have more reliable expectations. Also one test about a non-deterministic query was added, which just asserts the number of results returned.



 Comments   
Comment by Benjamin Eberlei [ 01/Apr/13 ]

A related Github Pull-Request [GH-295] was closed
https://github.com/doctrine/dbal/pull/295





[DBAL-479] Doctrine2 schema-tool:update doesn't re-create foreign keys on entity change Created: 07/Jan/12  Updated: 01/Apr/13  Resolved: 01/Apr/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: 2.1.5
Fix Version/s: 2.3
Security Level: All

Type: Bug Priority: Major
Reporter: Timo A. Hummel Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Duplicate
is duplicated by DDC-1585 Doctrine2 doesn't check for the corre... Resolved

 Description   

I have changed a @ManyToOne relation to another entity. My workflow was this:

  • Having @ManyToOne(targetEntity="Entity\EntityA") in the source
  • Creating the database schema
  • Changing @ManyToOne(targetEntity="Entity\EntityA") to @ManyToOne(targetEntity="Entity\EntityB")
  • Calling doctrine orm:schema-tool:update

orm:schema-tool:update doesn't notice that and doesn't re-create the FK on MySQL and PostgreSQL (haven't tested others).



 Comments   
Comment by Benjamin Eberlei [ 09/Jan/12 ]

Does this use the same variable or does the many to one variable name change?

Comment by Timo A. Hummel [ 09/Jan/12 ]

Yes, same variable name. For the real-world change, see:

https://github.com/partkeepr/PartKeepr/commit/1cf520f6433dd4d14785a7791a6efe6ab67cc47c

Comment by Timo A. Hummel [ 27/May/12 ]

Any news of this issue?

This is actually not a duplicate of DDC-1585.

Comment by Timo A. Hummel [ 27/May/12 ]

13:32:46 < beberlei> it is a DBAL issue, so you should start replicating it there
13:33:10 < beberlei> i mean, have a look at how the DBAL SchemaDiff looks like in that case, and why it creates the sql wrong
13:33:19 < beberlei> probably the comperator misses something

Comment by Timo A. Hummel [ 29/May/12 ]

I finally found the spot where the check is missing:

Comparator::diffForeignKey misses to compare the foreign table name, which can be added as this:

if ($key1->getForeignTableName() != $key2->getForeignTableName()) {
       return true;
}
Comment by Joshua Smith [ 17/Oct/12 ]

I've looked through the bugs in the DBAL project that reference the Comparator and I can't find one for this issue.

Has one been created for it that I have missed?

Also, I tried adding the suggested code into my project and schema-tool:update generated SQL to drop and recreate every foreign key relationship. I applied those changes and ran schema-tool:update again, expecting to get the normal "nothing to update" message. What I got was SQL to drop and recreate every foreign key relationship. Again.

Tracing the code revealed that (in one case) $key1->getForeignTableName() was returning 'user' and $key2->getForeignTableName() was returning 'User'. All of the foreign key comparisons followed the same pattern. I applied strtolower() to each of them before the comparison and now things seem to behave as I expect, but I don't know how portable my solution is.

if (strtolower($key1->getForeignTableName()) != strtolower($key2->getForeignTableName())) {
    return true;
}

I think applying strtolower() like this is OK since something similar is done when comparing local columns and foreign columns earlier in Comparator::diffForeignKey().

Comment by Benjamin Eberlei [ 01/Apr/13 ]

This was fixed in https://github.com/doctrine/dbal/commit/d7908fee and is part of Doctrine 2.3





[DBAL-418] [GH-251] Escape identifier names in MySQL ALTER queries Created: 21/Jan/13  Updated: 01/Apr/13  Resolved: 01/Apr/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Invalid Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of Xowap:

Url: https://github.com/doctrine/dbal/pull/251

Message:

The generated MySQL queries did not properly escape the identifier, thus
making it impossible to use SQL keywords as field/index/table name.

Although this is indeed a quite unwise design choice, this is required
for many legacy applications.

The submitted modifications do cover MySQL only, because it is the one that I need to use. However, I think that all the platforms are flawed with this issue and that a general re-work should be done here.



 Comments   
Comment by Benjamin Eberlei [ 21/Jan/13 ]

A related Github Pull-Request [GH-251] was opened
https://github.com/doctrine/dbal/pull/251





[DBAL-436] Logger should specify connection used in a master/slave situation Created: 31/Jan/13  Updated: 01/Apr/13  Resolved: 01/Apr/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: 2.3.2
Fix Version/s: 2.3.3
Security Level: All

Type: Bug Priority: Major
Reporter: Jarrod Nettles Assignee: Benjamin Eberlei
Resolution: Invalid Votes: 0
Labels: None


 Description   

Suppose there is a master connection with four slaves specified. Connections are being handled by the Doctrine\DBAL\Connections\MasterSlaveConnection class. Under the current implementation, all queries are logged under the "master" connection, even queries that are routed to the slaves by the Doctrine\DBAL\Connections\MasterSlaveConnection class.

Since slave connections are separate, distinct connections, queries should be logged appropriately under their respective connections.



 Comments   
Comment by Benjamin Eberlei [ 01/Apr/13 ]

Two reasons why this is not feasible:

1. We actually don't ship loggers on our own, so if you want you can implement this yourself. We wouldn't have a way to "add" this, we only provide the interface.

2. However the logger does not have access to the connection to find out which slave or master its currently using, you can create a logger that has a "setConnection($conn)" method and call this during bootstrapping the logger+connection.





[DBAL-435] [GH-264] Allow passing empty arrays as parameters Created: 31/Jan/13  Updated: 01/Apr/13  Resolved: 01/Apr/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of frosas:

Url: https://github.com/doctrine/dbal/pull/264

Message:

Right now something like

```php
$entityManager
->createQuery("SELECT e FROM Entity e WHERE e IN (:entities)")
->execute(array('entities' => array()));
```

produces a `Warning: array_fill(): Number of elements must be positive`






[DBAL-467] DateTime handling in sqlsrv 2005 not quite right Created: 20/Mar/13  Updated: 01/Apr/13  Resolved: 01/Apr/13

Status: Resolved
Project: Doctrine DBAL
Component/s: Platforms
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Gordon Heydon Assignee: Benjamin Eberlei
Resolution: Invalid Votes: 0
Labels: None
Environment:

window, sql svr 2005



 Description   

The problem I am having is with how the DateTimeType converts the DateTime field from sql svr. It seems to need different formats in the ::getDateTimeFormatString() depending in if you are converting from the database to PHP or the other way.

The method format 'Y-m-d H:i:s.000' that is there now works if the database is only written to with PHP, and not anything else.

In my case I am sharing access with other technologies. So basically when converting from the Database to PHP the format needs to be 'Y-m-d H:i:s.u' and 'Y-m-d H:i:s.000' when converting the other way.

If there functions convertToDatabaseValue() and convertToPHPValue() where in the Platform, then I could override these with my own custom platform and I would be right.

Otherwise to do this right we need to split this up getDateTimeFormatString() into 2 different methods, 1 for the database, and 1 for php.



 Comments   
Comment by Benjamin Eberlei [ 01/Apr/13 ]

You can register your own type to handle this, or use the "VarDateTime" that is more flexible with this kind of date format.

Comment by Benjamin Eberlei [ 01/Apr/13 ]

I have clarified the VarDateTime approach in the SQL Server Platform Known Issues and Limitations documentation.





[DBAL-477] Just doublequote all schema names and field names in PostgreSQL sql command generation, and the same for MySQL Created: 28/Mar/13  Updated: 28/Mar/13

Status: Open
Project: Doctrine DBAL
Component/s: Platforms, Schema Managers
Affects Version/s: 2.3.2
Fix Version/s: None
Security Level: All

Type: Improvement Priority: Major
Reporter: jos de witte Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: mysql, postgresql
Environment:

Any PostgreSQL environment



 Description   

Generation of any SQL command to the database (From entities or migration versions) does not quote all the reserved keywords (For example a fieldname `right`.

Simple fix that always works: double-quote dbname, schemaname and fieldname

e.g "dbsecurity"."userschema"."users" or "tblusers"

MySQL : use the ` sign.

e.g `security`.`users` or `tblusers` (No support for schemas since I last checked some time ago)






[DBAL-473] [GH-292] Add length in the OCI8 bindParam Created: 26/Mar/13  Updated: 26/Mar/13  Resolved: 26/Mar/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of Juliens:

Url: https://github.com/doctrine/dbal/pull/292

Message:



 Comments   
Comment by Benjamin Eberlei [ 26/Mar/13 ]

A related Github Pull-Request [GH-292] was closed
https://github.com/doctrine/dbal/pull/292





[DBAL-471] when persisting objects to Doctrine2 and one of the tables are named the same as a MySQL reserved word Created: 24/Mar/13  Updated: 24/Mar/13  Resolved: 24/Mar/13

Status: Closed
Project: Doctrine DBAL
Component/s: Platforms
Affects Version/s: 2.3.2
Fix Version/s: None

Type: Improvement Priority: Minor
Reporter: Per-Øivin Berg Andersen Assignee: Marco Pivetta
Resolution: Invalid Votes: 0
Labels: None
Environment:

MySQL on Ubuntu



 Description   

I am not sure this is a correct posting to your issue tracker, as I am a beginner at development, at least in the sense of doctrine.

I have an entity named Trigger in my Symfony2 project. I had set the table name to be "trigger", and this did not work. However, the entities were created without any problems, I first discovered the problem when attempting to persist a Trigger entity. The solution was to rename the table to "mtrigger" or something else, but I think the error message could be better somehow. Now it throws an exception with the MySQL error, which only says there's an error in the syntax, and to check the manual. The manual is quite huge and it was a horror for me before I started thinking in the field of reserved words.

Note that this is just a proposal to an improvement. It might be that it is hard to implement it for you. In that case, please just close the issue.



 Comments   
Comment by Marco Pivetta [ 24/Mar/13 ]

Doctrine 2 ORM allows you to define "naming strategies" and/or to quote the table names with mysql-style ticks that get automatically quoted, like:

/** @ORM\Table(name="`foo`") */




[DBAL-470] [GH-291] Optimize abstract platform Created: 24/Mar/13  Updated: 24/Mar/13

Status: Open
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of deeky666:

Url: https://github.com/doctrine/dbal/pull/291

Message:

This PR optimizes the <code>AbstractPlatform</code> class in the following ways:

  • Add dedicated use statemtent for each class import
  • Add missing class imports
  • Add missing phpDoc blocks for methods
  • Fix existing phpDocs (parameters, return types, @throws tags, FQDN types, indentation etc.)
  • "Normalize" phpDocs (consistent verbs for what a method does, reuse of certain phrases for similar method types etc.)
  • Fix CS
  • Improve certain code portions

I hope this is a welcomed improvement. It reads much better now and feels somewhat cleaner to me.






[DBAL-465] [GH-286] Fix data not being cached in ResultCache Created: 19/Mar/13  Updated: 20/Mar/13  Resolved: 20/Mar/13

Status: Closed
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Invalid Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of Alan01252:

Url: https://github.com/doctrine/dbal/pull/286

Message:

The ResultCacheStatement has a small logic error, it tested for emptied
being true when it should have tested for emptied being false. The
comments also statement that the function returns a boolean, however the
function didn't return a boolean.

This is my first time committing to a larger open source project like dbal. Very worried I'll of done something wrong, please go easy / teach me.



 Comments   
Comment by Benjamin Eberlei [ 20/Mar/13 ]

A related Github Pull-Request [GH-286] was closed
https://github.com/doctrine/dbal/pull/286

Comment by Benjamin Eberlei [ 20/Mar/13 ]

A related Github Pull-Request [GH-286] was reopened
https://github.com/doctrine/dbal/pull/286

Comment by Benjamin Eberlei [ 20/Mar/13 ]

A related Github Pull-Request [GH-286] was closed
https://github.com/doctrine/dbal/pull/286





[DBAL-468] [GH-288] Fix fetchColumn not caching Created: 20/Mar/13  Updated: 20/Mar/13

Status: Open
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of Alan01252:

Url: https://github.com/doctrine/dbal/pull/288

Message:

Column cache wasn't working because the emptied flag is only set
when fetch no longer returns a row. With fetch column the code
only calls fetch once and so emptied flag never got set.

Created two test cases, one to test fetchColumn, and one to test
that the return value is false if the data doesn't get saved in the cache.






[DBAL-466] [GH-287] Fix platform create constraint foreign table name quotation Created: 19/Mar/13  Updated: 19/Mar/13  Resolved: 19/Mar/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of deeky666:

Url: https://github.com/doctrine/dbal/pull/287

Message:

Creating foreign key constraints via <code>getCreateConstraintSQL</code> in the platform doesn't quote the foreign table name leading to invalid SQL when the foreign table name is a reserved keyword. This PR fixes this issue.



 Comments   
Comment by Benjamin Eberlei [ 19/Mar/13 ]

A related Github Pull-Request [GH-287] was closed
https://github.com/doctrine/dbal/pull/287





[DBAL-102] SQLSRV PDO doesn't support DateTime as a PHP Object Created: 19/Mar/11  Updated: 15/Mar/13  Resolved: 14/Sep/11

Status: Resolved
Project: Doctrine DBAL
Component/s: Drivers
Affects Version/s: 2.1
Fix Version/s: 2.1.3

Type: Bug Priority: Major
Reporter: Aaron DM Assignee: Guilherme Blanco
Resolution: Fixed Votes: 0
Labels: None
Environment:

Windows 7, Microsoft SQL Server 2008, PHP SqlSrv Driver 2.0, PHP 5.3.6



 Description   

I have created an entity with has a datetime column

Entity.php
    /**
     * @orm:Column(name="deleteAt", type="datetime")
     */
    protected $deletedAt;

    /**
     * Get DeletedAt
     * @return	\DateTime	
     */
    public function getDeletedAt() {
    	return $this->deletedAt;
    }
    
    /**
     * Set DeletedAt
     * @param	\DateTime		$deletedAt
     */
    public function setDeletedAt(\DateTime $deletedAt) {
        $this->deletedAt = $deletedAt;
    }

This should work, however I get this error when trying to set a "deleteAt" date

$this->setDeletedAt(new \DateTime());
SQLSTATE[22007]: [Microsoft][SQL Server Native Client 10.0][SQL Server]Conversion failed when converting date and/or time from character string.

This should work afaik.



 Comments   
Comment by Benjamin Eberlei [ 21/Mar/11 ]

Are yo using columns of type "datetime" or "datetime2" in MSSQL? The former is not supported.

Comment by Aaron DM [ 21/Mar/11 ]

I did not know datetime was not supported. I am using the column type "datetime"

Comment by Benjamin Eberlei [ 21/Mar/11 ]

In this case you have to add your own datetime type and change the timestamp format, or use the VarDateTime instead by calling "overrideType". Have a look at the Doctrine\DBAL\Types folder, escpecially the Type.php, DateTimeType.php and VarDateTimeType.php

Comment by Aaron DM [ 29/Mar/11 ]

I have now tried this with the column type "datetime2", which creates the following date format in the database
"2011-03-27 06:07:00.000000"

And I am still getting the same error
"SQLSTATE[22007]: [Microsoft][SQL Server Native Client 10.0][SQL Server]Conversion failed when converting date and/or time from character string."

P.S. this time I tried doing a select
WHERE deletedAt > (datetime)

Comment by Benjamin Eberlei [ 29/Mar/11 ]

Assigned to juokaz

Comment by Aaron DM [ 29/Mar/11 ]

When i ran profile, this is what I see

" AND (a0_.deleted_at <= @P3) ORDER BY a0_.deleted_at DESC','810678','Object','Object'"

Expliclitly converting the DateTiem to a string works

$query->setParameter("deletedAt", $deletedAt->format("Y-m-d H:i:s.u"));

Comment by Juozas Kaziukenas [ 29/Mar/11 ]

Can you give a full code which you use to query this (or the smallest allowing to replicate). I can't see how DateTime object gets passed as a 'Object' to the query, this is handled by DBAL type system, not by mssql platform, which only specifies the date and/or time format.

Comment by Benjamin Eberlei [ 30/Mar/11 ]

Does the error happen during a DQL or during flush (UPDATE/INSERT) ?

Comment by Aaron DM [ 30/Mar/11 ]

https://gist.github.com/6b2a8b53ece6e75abf20

The code there works (its not fully complete, but I tested the statements with the same Entity and etc and I am unable to successfully query the database).

Looks like it doesn't work even for a simple select. However if I do retrieve an entry, the getCreatedAt() does return a DateTime object correctly.

Comment by Guilherme Blanco [ 13/Sep/11 ]

Is this issue still valid with new implementation of ParameterTypeInferer in ORM?

It seems it solved this issue.

Comment by Guilherme Blanco [ 14/Sep/11 ]

Closing since no response was given.

Comment by Michał Banaś [ 15/Mar/13 ]

Why is it close ? After one day of waiting for response?
Problem is not solved. It exist on ether datetime and datetime2 TSQL types.
And it is easy to check if you have sqlserver databes.
PLease repoen this issue.

Comment by Marco Pivetta [ 15/Mar/13 ]

Michał Banaś this actually works with the current implementation of the schema tools. Consider implementing additional formats a custom DBAL type instead.





[DBAL-452] range is a reserved word in several platforms Created: 21/Feb/13  Updated: 15/Mar/13  Resolved: 14/Mar/13

Status: Resolved
Project: Doctrine DBAL
Component/s: Platforms
Affects Version/s: 2.3.3
Fix Version/s: 2.3.3

Type: Bug Priority: Major
Reporter: Michael Cummings Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None
Environment:

Linux 64bit



 Description   

'range' is a reserved word for MySQL, Oracle, and on future reserved list for SQL Server as well so should really be added for escaping. Working on a new project using Doctrine accessing an external API which used it as a field and got an error when running orm:schema-tool:create on my entity with MySQL.



 Comments   
Comment by Benjamin Eberlei [ 14/Mar/13 ]

Added for MySQL and Oracle. Didn't find data on when its added to SQL Server.

Comment by Michael Cummings [ 15/Mar/13 ]

http://msdn.microsoft.com/en-us/library/ms189822.aspx under Future Keywords





[DBAL-463] [GH-285] Add IBM iSeries Driver Created: 12/Mar/13  Updated: 14/Mar/13

Status: Open
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: New Feature Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of spicajames:

Url: https://github.com/doctrine/dbal/pull/285

Message:

Added driver pdo_ibmi to support to db2 iSeries using pdo_odbc






[DBAL-461] Numeric() syntax in columns fails on SQL Server Created: 07/Mar/13  Updated: 14/Mar/13  Resolved: 14/Mar/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: 2.2.2, 2.3.2
Fix Version/s: 2.3.3
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue occurred when I tried to create entities from existing MSSQL Database. My database have several fields that are defined as "numeric" data types. When I tried to reverse engineer this data base, doctrine threw an error mentioning that doctrine numeric data types are not supported. I have attached code that I used to create entities. And error that was generated. Hope this Helps narrow down the process. One thing that ca in to notice was that the "SQLServerSchemaManager" class does not have any specific mechanism to handle "numeric" as compared to "MySqlSchemaManager".



 Comments   
Comment by Benjamin Eberlei [ 14/Mar/13 ]

Fixed





[DBAL-464] MySQL fails when try to drop a primary index with Auto Increment Created: 14/Mar/13  Updated: 14/Mar/13

Status: Open
Project: Doctrine DBAL
Component/s: None
Affects Version/s: 2.3.2
Fix Version/s: None
Security Level: All

Type: Bug Priority: Minor
Reporter: Julien Rosset Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Linux (ubuntu), PHP 5.3.10, MySQL 5.5.29, Symfony2



 Description   

When an update of schema tries to drop a primary key with "auto increment" property (example : @ORM\GeneratedValue(strategy="AUTO")), the execution will fail : it say :
[Doctrine\DBAL\DBALException]
An exception occurred while executing 'ALTER TABLE odesadicola DROP PRIMARY KEY':

SQLSTATE[42000]: Syntax error or access violation: 1075 Incorrect table definition; there can be only one auto column and it must be defined as a key

Apparently, this error occurs because Doctrine try to execute a "drop primary key" on a table and the resulting column of old primary key will be "auto increment".

The answer is to remove "auto increment" attribut of primary key column juste before try to drop the primary key itself.






[DBAL-448] [GH-273] Use BLOB for Object mapping type Created: 17/Feb/13  Updated: 12/Mar/13  Resolved: 12/Mar/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Invalid Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of ludekstepan:

Url: https://github.com/doctrine/dbal/pull/273

Message:

http://php.net/manual/en/function.serialize.php
> Note that this is a binary string which may include null bytes, and needs to be stored and handled as such. For example, serialize() output should generally be stored in a BLOB field in a database, rather than a CHAR or TEXT field.






[DBAL-447] [GH-272] Refactor SQL Server keyword dictionaries and MsSQL leftovers Created: 13/Feb/13  Updated: 12/Mar/13  Resolved: 12/Mar/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of deeky666:

Url: https://github.com/doctrine/dbal/pull/272

Message:

Each Microsoft SQL Server version has its own specific reserved keyword dictionary. Therefore each platform version should implement the correct dictionary. This PR adds dedicated dictionaries for Microsoft SQL Server 2000 (base), 2005, 2008 and 2012. Moreover all the "mssql" leftovers are refactored to fit the "sqlserver" term.






[DBAL-450] [GH-275] accept array as parameter in getConcatExpression Created: 19/Feb/13  Updated: 12/Mar/13  Resolved: 12/Mar/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Invalid Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of broncha:

Url: https://github.com/doctrine/dbal/pull/275

Message:

The function `getConcatExpression` accepts strings, but as there can be any number of parameters passed to this and while calling from `ConcatFunction` sqlwalker has to walk all the parameters. So it would be better if `getConcatExpression` accepts array. Infact even better if it only accepts array. It would be much cleaner. Also I am opening a pull request in ORM for `ConcatFunction` as it only validates 2 primaryStrings. It should support more than two. SO for that to happen, `getConcatExpression` should accept array as parameter.






[DBAL-455] [GH-278] OraclePlatform sequence naming for primary keys Created: 02/Mar/13  Updated: 12/Mar/13  Resolved: 12/Mar/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 1
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of jrjohnson:

Url: https://github.com/doctrine/dbal/pull/278

Message:

Change Oracle sequence generation to match what is being created by ORM and other platforms in the form of $table_$column_SQL instead of $table_SEQ

This is a solution for https://github.com/doctrine/migrations/issues/112



 Comments   
Comment by Benjamin Eberlei [ 12/Mar/13 ]

A related Github Pull-Request [GH-278] was closed
https://github.com/doctrine/dbal/pull/278





[DBAL-459] [GH-282] Add column collation support for SQL Server Created: 05/Mar/13  Updated: 12/Mar/13  Resolved: 12/Mar/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of deeky666:

Url: https://github.com/doctrine/dbal/pull/282

Message:

This PR contributes to PR #274 and adds the missing SQL Server driver support for column collations. It's fully functional tested on my own SQL Server database.



 Comments   
Comment by Benjamin Eberlei [ 12/Mar/13 ]

A related Github Pull-Request [GH-282] was closed
https://github.com/doctrine/dbal/pull/282





[DBAL-460] [GH-283] Fix SchemaManagerFunctionalTestCase composite foreign keys test Created: 05/Mar/13  Updated: 12/Mar/13  Resolved: 12/Mar/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of deeky666:

Url: https://github.com/doctrine/dbal/pull/283

Message:

This PR fixes a bug in the <code>SchemaManagerFunctionalTestCase</code> composite foreign keys test I encountered today. In SQL Server the test case fails because both <code>testListForeignKeys</code> and <code>testListForeignKeysComposite</code> tests create a foreign key with the same name which is not possible for one single DB in SQL Server.
I don't know if this applies to other RDBMS also but this should also fix the others.



 Comments   
Comment by Benjamin Eberlei [ 12/Mar/13 ]

A related Github Pull-Request [GH-283] was closed
https://github.com/doctrine/dbal/pull/283





[DBAL-95] Interbase/Firebird support Created: 26/Feb/11  Updated: 12/Mar/13

Status: Open
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 3
Labels: None


 Description   

Implemented support for Interbase/Firebird dialects






[DBAL-462] [GH-284] Correcting code example Created: 10/Mar/13  Updated: 10/Mar/13  Resolved: 10/Mar/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of intel352:

Url: https://github.com/doctrine/dbal/pull/284

Message:

Doc incorrectly makes a call to close(), when it should be calling closeCursor()



 Comments   
Comment by Benjamin Eberlei [ 10/Mar/13 ]

A related Github Pull-Request [GH-284] was closed
https://github.com/doctrine/dbal/pull/284





[DBAL-456] [GH-279] adds new output format Created: 03/Mar/13  Updated: 05/Mar/13  Resolved: 05/Mar/13

Status: Closed
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Marco Pivetta
Resolution: Invalid Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of schmittjoh:

Url: https://github.com/doctrine/dbal/pull/279

Message:

The output of the ::dump command is very unstable (depends on platform/PHP version/installed extensions).

This pull request adds a new format which is more suitable for machine consumption.



 Comments   
Comment by Benjamin Eberlei [ 04/Mar/13 ]

A related Github Pull-Request [GH-279] was closed
https://github.com/doctrine/dbal/pull/279





[DBAL-457] [GH-280] Use int values instead of strings for PostgreSQL booleans Created: 04/Mar/13  Updated: 04/Mar/13  Resolved: 04/Mar/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of chEbba:

Url: https://github.com/doctrine/dbal/pull/280

Message:

    1. The Problem:
      The current implementation for PostgreSQL uses strings 'true' and 'false' which are not working with PDO::ATTR_EMULATE_PREPARES.
    1. Solution:
      Use ints like in the default platform implementation.
    1. Comments
  • Tested only on my local php 5.4.9
  • Fixed NamedParametersTest to use int columns instead of strings (does not work with PDO::ATTR_EMULATE_PREPARES when compare string column IN array of ints)
  • Fixed DbalFunctionalTestCase sql parameters dumping (found while fixing NamedParametersTest)
  • Added support for driver options configuration via phpunit config globals


 Comments   
Comment by Benjamin Eberlei [ 04/Mar/13 ]

A related Github Pull-Request [GH-280] was closed
https://github.com/doctrine/dbal/pull/280

Comment by Marco Pivetta [ 04/Mar/13 ]

Solved at https://github.com/doctrine/dbal/commit/55128a6549b777ec91d7808989df236dbd508111





[DBAL-458] [GH-281] Upgrading doctrine/common 2.4 (via composer) Created: 04/Mar/13  Updated: 04/Mar/13  Resolved: 04/Mar/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.3.3
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of Ocramius:

Url: https://github.com/doctrine/dbal/pull/281

Message:

This PR introduces changes necessary to make the DBAL recognize `"doctrine/common": "2.4"` as compatible as discussed in https://groups.google.com/d/topic/doctrine-dev/8WjzboENQgg/discussion

Ping @dbu



 Comments   
Comment by Benjamin Eberlei [ 04/Mar/13 ]

A related Github Pull-Request [GH-281] was closed
https://github.com/doctrine/dbal/pull/281





[DBAL-454] [GH-277] Remove duplicate SQL parts in query generation Created: 02/Mar/13  Updated: 03/Mar/13  Resolved: 03/Mar/13

Status: Closed
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Marco Pivetta
Resolution: Invalid Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of gigablah:

Url: https://github.com/doctrine/dbal/pull/277

Message:

Presently, it's possible to do this using QueryBuilder:

```php
$qb->select('u.*')
->from('users', 'u')
->addOrderBy('u.name', 'ASC')
->addOrderBy('u.name', 'ASC'); // duplicate
```
Which produces:
```sql
SELECT u.* FROM users u ORDER BY u.name ASC, u.name ASC
```

This patch removes duplicates from the `SELECT`, `SET`, `ORDER BY` and `GROUP BY` parts during SQL generation (there's already logic that removes duplicate `FROM` parts).

I've added test cases for each affected keyword as well.



 Comments   
Comment by Benjamin Eberlei [ 03/Mar/13 ]

A related Github Pull-Request [GH-277] was closed
https://github.com/doctrine/dbal/pull/277





[DBAL-449] [GH-274] Support column charset/collation on capable platforms Created: 19/Feb/13  Updated: 19/Feb/13

Status: Open
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of adrienbrault:

Url: https://github.com/doctrine/dbal/pull/274

Message:

Basically the same feature wanted as in #245






[DBAL-434] Incorrect type mapping on Oracle Platform Created: 30/Jan/13  Updated: 17/Feb/13  Resolved: 30/Jan/13

Status: Resolved
Project: Doctrine DBAL
Component/s: Platforms
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Critical
Reporter: Damián Nohales Assignee: Benjamin Eberlei
Resolution: Can't Fix Votes: 0
Labels: None
Environment:

Oracle 10g on Windows, using Doctrine 2 with Symfony2



 Description   

Hello,

I'm noticed a strange behaviour when I executed a migration for my Oracle database. Doctrine detects changes on all date columns, generating queries like:

ALTER TABLE the_table MODIFY (the_date DATE DEFAULT NULL);

even if the entity property was not modified. Check in out the Doctrine 2 source code I've detected that Doctrine map the DATE Oracle columns as datetime type, but entity date property are mapped as date (as it should be), so Doctrine believes that entity property and column type are different and generate the alter query.

I found the problem on the method Doctrine\DBAL\Platforms\OraclePlatform::initializeDoctrineTypeMappings, when it say 'date' => 'datetime' should say 'date' => 'date', that fix the migration problem and does not break my application.

Was a typo?

Thanks!



 Comments   
Comment by Benjamin Eberlei [ 30/Jan/13 ]

The problem is that Oracle has a "DATE" type, which is actually a DATETIME. That is why we map it to Doctrine's Datetime type.

As a workaround, you can set this information yourself using:

$conn->getDatabasePlatform()->registerDoctrineTypeMapping('date', 'date');

Be aware this is a global change for all columns. If you map DateTimes to a TIMESTAMP field you are good to go though.

Comment by John Kary [ 17/Feb/13 ]

I ran into this same issue with the default OraclePlatform configuration. I was trying to run doctrine:schema:update --force from the Symfony2 Console on my Oracle database, and ALTER statements were generated for some DATE columns that were fully up to date when looking at the actual table.

But the major issue I ran into was these unnecessary ALTER statements were for DATE columns with NOT NULL constraints, resulting in a query like ALTER TABLE your_table MODIFY (created_at_date DATE NOT NULL); Yet when running this query, Oracle throws an error: ORA-01442: column to be modified to NOT NULL is already NOT NULL. So I could no longer use doctrine:schema:update to update my schema during development against Oracle.

While technically correct, Oracle DATE types actually store time data in addition to date data, I don't agree that this should be considered Doctrine's default behavior.

I believe Oracle DATE columns should be date-only (e.g. Day, Month, Year) and time data should be disregarded. All other drivers except SQLServer map "date" fields to Doctrine's "date" type. I would rather see someone wanting to store time data with their DATE field need to make the suggested change, instead of the other way around:

$conn->getDatabasePlatform()->registerDoctrineTypeMapping('date', 'datetime');

Oracle 11g Release 1 DATE type docs: http://docs.oracle.com/cd/B28359_01/server.111/b28318/datatype.htm#i1847)

Comment by Benjamin Eberlei [ 17/Feb/13 ]

Well the other thing is, that we cannot change this for BC reasons.

We could introduce a new platform that solves this issue though.





[DBAL-437] [GH-265] fix getShowDatabasesSQL() in SQLServerPlatform Created: 01/Feb/13  Updated: 10/Feb/13  Resolved: 10/Feb/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Invalid Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of deeky666:

Url: https://github.com/doctrine/dbal/pull/265

Message:

The getShowDatabasesSQL() in SQLServerPlatform returns invalid SQL. Maybe copy/paste error from MySqlPlatform? This PR fixes this to return the correct statement.



 Comments   
Comment by Benjamin Eberlei [ 03/Feb/13 ]

A related Github Pull-Request [GH-265] was closed
https://github.com/doctrine/dbal/pull/265

Comment by Alexander [ 10/Feb/13 ]

PR was invalid.





[DBAL-440] [GH-268] Remove deprecated getShowDatabasesSQL() from Platforms Created: 03/Feb/13  Updated: 10/Feb/13  Resolved: 10/Feb/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of deeky666:

Url: https://github.com/doctrine/dbal/pull/268

Message:

As stated in PR #265 the getShowDatabasesSQL() method is deprecated in the platforms. This PR removes them entirely now.



 Comments   
Comment by Benjamin Eberlei [ 03/Feb/13 ]

A related Github Pull-Request [GH-268] was closed
https://github.com/doctrine/dbal/pull/268

Comment by Alexander [ 10/Feb/13 ]

Was merged in https://github.com/doctrine/dbal/commit/fc77f6de46d936552b445920a80b12af2c019cd4





[DBAL-316] Incorrect parameter SERVICE_NAME Created: 07/Aug/12  Updated: 10/Feb/13  Resolved: 10/Feb/13

Status: Resolved
Project: Doctrine DBAL
Component/s: Drivers
Affects Version/s: 2.3
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Leandro Guimarães Fernandes Assignee: Alexander
Resolution: Invalid Votes: 0
Labels: oracle
Environment:

Windows 7, ZendServer-CE-php-5.4.0-5.6.0-Windows_x86 and Oracle 10



 Description   

At line 63, the driver PDOOracle, the parameter SERVICE_NAME is receiving the value of 'dbname' and not 'service'.

Sorry, my English is bad!



 Comments   
Comment by Alexander [ 10/Feb/13 ]

This is not a bug. Read the code. It checks if the parameter is set and if it's "true".





[DBAL-381] [GH-227] MySql TEXT and BLOB type declarations Created: 14/Nov/12  Updated: 09/Feb/13  Resolved: 09/Feb/13

Status: Resolved
Project: Doctrine DBAL
Component/s: Platforms
Affects Version/s: 2.0, 2.1, 2.2, 2.3
Fix Version/s: 2.4
Security Level: All

Type: Bug Priority: Minor
Reporter: Benjamin Eberlei Assignee: Alexander
Resolution: Fixed Votes: 0
Labels: blob, clob,
Environment:

OS X 10.8.2, PHP 5.3.18, Nginx 1.2.4 (php through FPM)



 Description   

This issue is created automatically through a Github pull request on behalf of jappie:

Url: https://github.com/doctrine/dbal/pull/227

Message:

Fixed maximum length of MySql TEXT type declaration, this should be 65535 (2 ^ 16 - 1) in stead of 65532.

Added support for TINYBLOB, BLOB, MEDIUMBLOB and LONGBLOB based on the length of the field, the same way as the clob type declarations are determined.

Added tests to prevent regression.






[DBAL-439] [GH-267] Add SQLServerPlatform supports schemas Created: 03/Feb/13  Updated: 05/Feb/13  Resolved: 05/Feb/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of deeky666:

Url: https://github.com/doctrine/dbal/pull/267

Message:

SQL Server supports schemas. This PR modifies SQLServerPlatform to return true when asked for schema support.



 Comments   
Comment by Benjamin Eberlei [ 03/Feb/13 ]

A related Github Pull-Request [GH-267] was closed
https://github.com/doctrine/dbal/pull/267

Comment by Fabio B. Silva [ 05/Feb/13 ]

Merged : https://github.com/doctrine/dbal/commit/e3f1af51eaec0707d5d387fc8cae1a585f2b5634





[DBAL-438] [GH-266] Removed outdated methods in DatabasePlatformMock. Created: 03/Feb/13  Updated: 05/Feb/13  Resolved: 05/Feb/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of BenMorel:

Url: https://github.com/doctrine/dbal/pull/266

Message:

Same as https://github.com/doctrine/doctrine2/pull/567



 Comments   
Comment by Benjamin Eberlei [ 03/Feb/13 ]

A related Github Pull-Request [GH-266] was closed
https://github.com/doctrine/dbal/pull/266

Comment by Benjamin Eberlei [ 03/Feb/13 ]

A related Github Pull-Request [GH-567] was closed
https://github.com/doctrine/doctrine2/pull/567

Comment by Fabio B. Silva [ 05/Feb/13 ]

Merged : https://github.com/doctrine/dbal/commit/2a58ac0e15315b785f3ee5edb822dc5e45d154d7





[DBAL-430] [GH-260] Add SQL Server 2012 platform Created: 29/Jan/13  Updated: 04/Feb/13  Resolved: 04/Feb/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of deeky666:

Url: https://github.com/doctrine/dbal/pull/260

Message:

This adds the platform for SQL Server 2012 introducing sequences. I don't exactly know if sequences should be preferred for ID generation or not so I left identity columns preferred for ID generation. Also added new keywords to MsSqlKeywords since SQL Server 2008.



 Comments   
Comment by Benjamin Eberlei [ 04/Feb/13 ]

A related Github Pull-Request [GH-260] was closed
https://github.com/doctrine/dbal/pull/260





[DBAL-427] [GH-257] fix SQLServerPlatform locking hints Created: 25/Jan/13  Updated: 03/Feb/13  Resolved: 03/Feb/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of deeky666:

Url: https://github.com/doctrine/dbal/pull/257

Message:

This should completely implement the locking hints of the SQLServerPlatform according to http://msdn.microsoft.com/en-us/library/aa213026%28v=sql.80%29.aspx.



 Comments   
Comment by Benjamin Eberlei [ 03/Feb/13 ]

A related Github Pull-Request [GH-257] was closed
https://github.com/doctrine/dbal/pull/257





[DBAL-441] [GH-269] Fix SQLServerPlatform regular expression SQL Created: 03/Feb/13  Updated: 03/Feb/13  Resolved: 03/Feb/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of deeky666:

Url: https://github.com/doctrine/dbal/pull/269

Message:

SQL Server has no native support for regular expressions. Furthermore there is no "RLIKE" expression in T-SQL. This PR fixes this.



 Comments   
Comment by Benjamin Eberlei [ 03/Feb/13 ]

A related Github Pull-Request [GH-269] was closed
https://github.com/doctrine/dbal/pull/269





[DBAL-40] Transparent table&column names escaping Created: 05/Aug/10  Updated: 02/Feb/13

Status: Open
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major
Reporter: Jan Tichý Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 9
Labels: None

Issue Links:
Reference
relates to DBAL-96 Make approach towards identifier quot... Open

 Description   

Hello, I would like to re-open the discussion about automatic transparent escaping of all table/column names sent from DBAL to database. It was already discussed in http://www.doctrine-project.org/jira/browse/DDC-88 without any satisfactory result.

Why do I have to quote any reserved word used in table or column name? Why Doctrine doesn't do this automatically for all table and column
names used in generated SQL queries?

Before you start to explain how complicated it is and what problems you will be faced with, try to look at excellent DIBI database layer - how it acts in this way - it's behaviour is very cool. Unfortunally at the moment the full documentation is in czech only, but here is a brief automatic google-translation to english - http://dibiphp.com/en/quick-start.

My suggestion to Doctrine 2 ORM/DBAL solution is:

1. Developer should never care about any escaping or avoiding any reserved words - it is not his business, the DBAL shoult solve it transparently and safely.

2. So there should be no need and even no possibility to add any quotation chars in @column or @table annotations as well as in DQL queries. ORM layer has nothing to do with escaping, it is all a business of the DBAL layer. Current possibility for manual escaping the names in mentioned annotations is totally wrong and should be discontinued.

3. DBAL should escape ALL table and column names transparently and automatically. There should be ne option to enable or disable the escaping, there is no reason for disabling it.

4. The escaping should be performed just in the final translation of DBAL queries to native SQL query, not earlier. This is the right place to do that.

So what do you think about that?



 Comments   
Comment by Roman S. Borschel [ 05/Aug/10 ]

My point of view (and the reason for the current implementation) is as follows:

  • Using reserved words is bad practice.
  • Quoting everything is like hitting all the SQL with a huge big hammer just to hit the 1% of reserved words (which are again, bad practice), thus overkill.
  • Quoting everything bloats the generated SQL (just to hit the 1% of reserved words which are bad practice to begin with)
  • Quoting everything automatically is like hiding the fact from developers that they use reserved words, thus hiding a bad practice and silently encouraging usage of reserved words in new database schemas. This is not desirable.
  • Quoting reserved words has more effects than simply making the database "accept" that identifier. It affects the case-sensitivity and that in a very inconsistent way across databases and operating systems (See http://www.alberton.info/dbms_identifiers_and_case_sensitivity.html , especially the conclusion). You say there is no reason for disabling it but in fact there are a lot of reasons to do so, so many that it is disabled by default in MDB2 and discouraged to enable it.

So, supporting selective quoting in the name of a (slightly) better interoperability with legacy schemas looked (and still looks) like the best solution for us. The support is limited, explicit, does not require much implementation or overhead and does not unnecessarily bloat the SQL.

There is only one solution for reserved words: not using them. Quoting is a workaround, not a solution and especially not a good one.

ps: I really wish quoting reserved words would not be available in SQL It's not available in most programming languages and noone cares, people just don't use reserved words, because they simply can't.

Comment by Jan Tichý [ 05/Aug/10 ]

Hi Roman, thank you very much for your response! I storngly disagree with most of your points .

There is no doubt that using reserved words is bad practice - FROM THE VIEW OF DATABASE SYSTEM.

But we are discussing about ORM and DBAL. One of the biggest goals of ORM/DBAL is to provide transparent usage of the storage behind the scene. No matter if it is MySQL or PostgreSQL or even maybe something completely diferent.

The ORM/DBAL layer should prevent me from any specifics of particular storage as much as possible. I don't want to remember (and I never should to) that I cannot create entity Order because "order" is reserved word in some weird technology far away from me as ORM programmer.

It is strictly consistent with what you have written above in your PS - "It's not available in most programming languages and noone cares, people just don't use reserved words, because they simply can't" - just consider Doctrine 2 to be another programming language - and there is no real systematic reason in Doctrine 2 itself to prevent developers create entities named "Order".

Here is an analogy - It is the same as if you would say that you cannot use associative arrays in PHP because C-language or Assembler behind PHP doesn't support associative arrays. Yes, they don't support them but it is the responsibility of PHP to provide them. In the same way I don't want to respect this weird limitations of particular RDBMS behind Doctrine 2. This is Doctrine's responsibility to transparently cover the limitation.

Moreover, when list of registered keywords is different from one to the other RDBMS, so the naming of entities is strongly dependent on current database server.

Moreover, when I realize that I have used a registered keyword as lately as an error returns from database engine, not earlier.

I suppose here is probably no risk of SQL injection, but I feel the current Doctrine 2 acting to be "vulnerable" in very similar way, on principle. Simply - you are sending an unescaped piece of SQL query to the database without any warranty what it is. And sometimes it fails, sometimes not. From this view I don't consider overall escaping to be overkill at all, I consider it to be a necessity.

I am strongly convinced that developer working upon DBAL or even ORM layer should never think about such naming limitations and he even shouldn't know anything about reserved words in his particular DBMS.

Now to mentioned problems with case sensitivity. Resulting from the fact that Doctrine 2 entity names are case insensitive I belive that all table definitions and SQL queries comming from Doctrine 2 to database should act as case insensitive too. And that the only practicable way is to normalize (lowercase) all table and column names just on DBAL side before it is passed as SQL query to database.

Jan

Comment by Benjamin Eberlei [ 05/Aug/10 ]

There is actually a very good reason for not quoting. Oracle columns behave differently in their internal structure when escaped.

for example:

/**
  * @column(type="integer")
 */
private $foo;

With quoting it would lead to a column "foo" being lower-cased IN the database and even returned so from resultsets. Without casing it would be a column "FOO". We would essentially need to implement lots of glue code just to get this annoying Oracle feature to work and i think Postgres has the same with lower-cased columns.

Comment by Roman S. Borschel [ 05/Aug/10 ]

@"Hi Roman, thank you very much for your response! I storngly disagree with most of your points"

I guess we can agree to disagree then

@"But we are discussing about ORM and DBAL. One of the biggest goals of ORM/DBAL is to provide transparent usage of the storage behind the scene. No matter if it is MySQL or PostgreSQL or even maybe something completely diferent."

Actually, no, "hiding" the storage completely from the developer is not the goal just as it is not the goal to "hide" SQL. There is an object model on one side and a relational database on the other side. The goal is to provide a mapping between them which is not the same as "hiding" one from the other. In order to create good applications that use ORM technology you need to know both very well, OOP and relational databases. The goal is not to make relational database knowledge "unnecessary". This only results in inefficient use of the databases. The goal is to give people who know both sides equally well a tool to map between the two. Not even "portability" between different relational database vendors is a main goal of an ORM technology, it is just obvious to provide assistance with that as part of the mapping.

@"and there is no real systematic reason in Doctrine 2 itself to prevent developers create entities named "Order".

Noone prevents you from naming domain classes anything you want. Class naming is different from table naming. That the table name defaults to the class name is just that, a default, that can and should be changed if necessary.

@"Moreover, when list of registered keywords is different from one to the other RDBMS, so the naming of entities is strongly dependent on current database server."

Correct, and if you want to create a portable application that works, and will be deployed on, a different set of vendors, you need to have some knowledge of these databases and consider their characteristics. An ORM/DBAL technology does not give you any guarantee for complete and transparent portability between vendors and especially not that it will perform equally well on all of them. The ORM/DBAL technology helps you for the most part in a lot of cases with portability issues but it is no free ticket.

@"I suppose here is probably no risk of SQL injection, but I feel the current Doctrine 2 acting to be "vulnerable" in very similar way, on principle. Simply - you are sending an unescaped piece of SQL query to the database without any warranty what it is. And sometimes it fails, sometimes not. From this view I don't consider overall escaping to be overkill at all, I consider it to be a necessity."

Do not confuse identifier quoting with quoting/escaping of special characters as it is used for security reasons on input. Identifier quoting is absolutely not a necessity, it is a workaround for using otherwise reserved words as schema element names. Speaking of goals, it is neither a "goal" of ORM/DBAL technology to completely remove the possibilities of SQL injections. You can't. It'll always be possible with wrong usage.

@"I am strongly convinced that developer working upon DBAL or even ORM layer should never think about such naming limitations and he even shouldn't know anything about reserved words in his particular DBMS."

And I am strongly convinced that a developer working with a DBAL/ORM should know the underlying databases pretty well.

I think you're really not aware of all the consequences it has across different database vendors to quote every identifier. If not for developers using Doctrine, you cause at least any developer or application pain that does not access the database through Doctrine and is thus feels the full pain of case-sensitivity and mandatory quoting you enforced on the whole schema. Ubiquitious access to the data is actually a strong point of a relational database and it is far from uncommon that the same database is accessed by many parties.

I think the approach taken by DIBI is a bad idea and even worse if there is no way to turn this behavior off. Do they have Oracle or DB2 users? I'm wondering what the sysadmins behind these databases might think if they see this quoting nightmare since to my knowledge this is considered bad practice among them as well.

Yes, we're disagreeing on many points but if you really think identifier quoting is a good idea then you're ignoring a whole lot of prior experience (not only mine).

Comment by Lukas Kahwe [ 05/Aug/10 ]

I was one of the lead developers of MDB2 and we just ran into tons of issues when we overly aggressively did identifier quoting by default. even the option caused lots of headaches. furthermore I agree that the ORM is not about turning an RDBMS into an Object Database, but instead to make a mapping possible. In this vain using reserved words or making all identifiers case sensitive will be a big pain for the people that do work one level lower aka the DBA's. heck even as a developer I frequently work on the DB's command line.

Now as for helping people prevent issues with reserved words. Back then I added some reserved word checking into MDB2_Schema. Obviously its hard to really keep track of all of the different reserved words for all RDBMS. Maybe its possible to work with this guy for this: http://www.petefreitag.com/item/290.cfm This way it could be possible to validate if the names chosen in the models will not cause issues with a certain list of RDBMS.

Comment by Benjamin Eberlei [ 07/Aug/10 ]

Reserved words checking sounds to be a fair compromise!

Comment by Jan Tichý [ 30/Aug/10 ]

Hello, thank you all for your responses.

This helped me understand much about Doctrine 2 basic objectives - especially that it is designed mainly to "make a mapping possible" only, not to be as much as possible transparent layer between database and application. And even if I don't like this conception (because I personally think ORM should provide all such features - like automatic reserved keywords escaping - to make the particular database as transparent as possible), at the same time I fully understand all metioned arguments for doing things in such way. Thank you again.

Comment by Damian Boune [ 17/Jan/11 ]

I would like to state an agreement with the OP.

I understand where there are difficulties in handling reserved words and backtick/quoting, and certainly one should always avoid the use of reserved words in their own schema designs. This is a given when one is able to exert control.

At present I am working on a project in which I am dealing with an outside database where I have no control over the schema, nor am I able to push the remote into making the most sensible changes to their schema. I must live with what they provide.

DBAL presents me with a set of invaluable tools that can not be used as-is, because it lacks the ability to handle quoting when generating schema sql. I'm sure there are some other places where I will find this lacking as well. This is disappointing.

Regardless of what we as developers should do when designing our own schema, we still need to be able to work and play with others who may not follow the same common sense conventions.

Edit:
My temporary quick solution to just "make it work", was to modify AbstractAsset::getQuotedName and force the use of $platform->quoteIdentifier. It did the trick for now until a more suitable solution presents itself.

Comment by Francesco Montefoschi [ 03/Feb/11 ]

"its hard to really keep track of all of the different reserved words for all RDBMS"

That's the main point for me.

Comment by Adrian Rudnik [ 26/Apr/11 ]

@Damian thanks for the hint. I just ran into a similar situation.

Not every project is a startup. I tried to use doctrine2 on a customers database for a small web ui. Well I told them to rename their `iso3166-1` table and `alpha-2` field, then we had a good laugh. We made the mapping possible but i'll remember the one thing i learned: doctrine did not help, guide, prevent or cared at all. It did not even hesitate to spew invalid sql snippets when asked to dump. Its okay for me, but i've expected something more resilient from a DBAL.

Comment by Robert (Jamie) Munro [ 02/Feb/13 ]

What do you mean by "Quoting everything is like hitting all the SQL with a huge big hammer"? Is there a performance hit?

I have always quoted all names when working with PostGres. Not quoting them has always felt like not quoting strings in PHP (e.g. $foo[bar] instead of $foo['bar'] because unless the string is keyword or defined as a constant somewhere, you don't need to (although you will get a "Use of undefined constant" warning). In the early days of PHP, not quoting array keys was common example practise.

Comment by Marco Pivetta [ 02/Feb/13 ]

If you want quoting by default on everything we have a quoting strategy (in ORM) that you can use. I don't think quoting everything by default is a viable solution. Back in `Zend_Db` times this was eating up a lot of performance for no real reason. Users having a clean schema without horrors like columns called `order` or `group` should not be penalized because of users not using valid naming schemes.





[DBAL-419] [GH-252] Sqlserver limit Created: 22/Jan/13  Updated: 30/Jan/13  Resolved: 30/Jan/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of norzechowicz:

Url: https://github.com/doctrine/dbal/pull/252

Message:

Unfortunately fix from my last commit it not enough to handle more complicated queries.
This change should fix points 2 and 3 [from this list](http://www.doctrine-project.org/jira/browse/DDC-1785) but it also removes adding TOP statement if ``$offset`` is not set.
I know it looks realy messy but I can't figure out any other solution to handel queries with subqueries and ordering (such thing is generated after using Doctrine Paginator and ordering).



 Comments   
Comment by Benjamin Eberlei [ 30/Jan/13 ]

A related Github Pull-Request [GH-252] was closed
https://github.com/doctrine/dbal/pull/252





[DBAL-433] [GH-263] Fix wrong class names in SQLAzureFederationsSynchronizer Created: 29/Jan/13  Updated: 30/Jan/13  Resolved: 30/Jan/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of BenMorel:

Url: https://github.com/doctrine/dbal/pull/263

Message:

There is a wrong import in this class:

use Doctrine\DBAL\Sharding\SingleDatabaseSynchronizer;

Should be:

use Doctrine\DBAL\Schema\Synchronizer\SingleDatabaseSynchronizer;

The following import is also missing:

use Doctrine\DBAL\Schema\Synchronizer\SchemaSynchronizer;

This PR fixes them.



 Comments   
Comment by Benjamin Eberlei [ 30/Jan/13 ]

A related Github Pull-Request [GH-263] was closed
https://github.com/doctrine/dbal/pull/263





[DBAL-428] [GH-258] Guid type requires SQL typehint comment Created: 26/Jan/13  Updated: 30/Jan/13  Resolved: 30/Jan/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of pkruithof:

Url: https://github.com/doctrine/dbal/pull/258

Message:

Since guid extends the string type, it needs to be type hinted.



 Comments   
Comment by Benjamin Eberlei [ 30/Jan/13 ]

A related Github Pull-Request [GH-258] was closed
https://github.com/doctrine/dbal/pull/258





[DBAL-220] Some platforms require specific index handling Created: 13/Feb/12  Updated: 29/Jan/13  Resolved: 13/Feb/12

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: 2.2
Fix Version/s: 2.3
Security Level: All

Type: New Feature Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   
  • SQL Server/Azure for example requires strict differentiation between CLUSTERED/NON-CLUSTERED indexes.
  • MySQL can create full text indexes
  • etcetc.


 Comments   
Comment by Benjamin Eberlei [ 13/Feb/12 ]

Implemented.

Comment by Benjamin Eberlei [ 13/Feb/12 ]

SQL Server can now create clustered or non-clustered indexes like:

$table->setPrimaryKey(array("id"));
$table->getIndex('primary')->addFlag('nonclustered');
$table->addIndex(array("column1"), "name");
$table->getIndex("name")->addFlag("clustered");
Comment by Steve Müller [ 29/Jan/13 ]

Is there any way to define the flags via class metadata? Shouldn't there be the possibility to pass the flags to a class metadata index/id definition?





[DBAL-425] [GH-255] fix typo in AbstractPlatform phpDocs Created: 25/Jan/13  Updated: 26/Jan/13  Resolved: 26/Jan/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of deeky666:

Url: https://github.com/doctrine/dbal/pull/255

Message:

Fixes typo in AbstractPlatform phpDocs. "ASNI" -> "ANSI"



 Comments   
Comment by Benjamin Eberlei [ 25/Jan/13 ]

A related Github Pull-Request [GH-255] was closed
https://github.com/doctrine/dbal/pull/255





[DBAL-426] [GH-256] Create queryBuilder from parts. Created: 25/Jan/13  Updated: 26/Jan/13  Resolved: 26/Jan/13

Status: Closed
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Invalid Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of NoUseFreak:

Url: https://github.com/doctrine/dbal/pull/256

Message:

Add a feature that can create a queryBuilder from queryBuilder parts.

This can be used when a query is build and needs to be stored somehow and restore it later.



 Comments   
Comment by Benjamin Eberlei [ 25/Jan/13 ]

A related Github Pull-Request [GH-256] was closed
https://github.com/doctrine/dbal/pull/256





[DBAL-424] [GH-254] fix SQLServerPlatform GUID expression Created: 25/Jan/13  Updated: 25/Jan/13  Resolved: 25/Jan/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of deeky666:

Url: https://github.com/doctrine/dbal/pull/254

Message:

The GUID expression UUID() does not exist in SQLServer. Instead NEWID() is used. This PR fixes this.



 Comments   
Comment by Benjamin Eberlei [ 25/Jan/13 ]

A related Github Pull-Request [GH-254] was closed
https://github.com/doctrine/dbal/pull/254





[DBAL-423] Type GUID = VARCHAR(255) on platforms that don't have a native GUID support Created: 25/Jan/13  Updated: 25/Jan/13

Status: Open
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Minor
Reporter: amr Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

I'm using MySQL with entities that have GUID ids. Therefore I'm using @ORM\Column(type="guid") for the ORM mapping. As MySQL does not have a native GUID data type, it gets mapped to type="string" with a default length of 255 -> VARCHAR(255). I don't really understand why we don't limit the length to 36, which is the fixed length for GUIDs. You could even think about using CHAR(36) for MySQL.

-> see Doctrine\DBAL\Platforms\AbstractPlatform -> getGuidTypeDeclarationSQL()






[DBAL-421] [GH-253] Added GUID expression to SQLite platform Created: 23/Jan/13  Updated: 25/Jan/13  Resolved: 25/Jan/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Guilherme Blanco
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of jankramer:

Url: https://github.com/doctrine/dbal/pull/253

Message:

This will add an implementation of getGuidExpression to the SqlitePlatform. It is based on [UUID version 4](http://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_.28random.29).

Don't know if this is appropriate, but I'm open to suggestions.



 Comments   
Comment by Benjamin Eberlei [ 25/Jan/13 ]

A related Github Pull-Request [GH-253] was closed
https://github.com/doctrine/dbal/pull/253

Comment by Marco Pivetta [ 25/Jan/13 ]

merged





[DBAL-422] Wrong VARCHAR default length in SQLServerPlatform Created: 24/Jan/13  Updated: 24/Jan/13

Status: Open
Project: Doctrine DBAL
Component/s: Platforms
Affects Version/s: 2.3.2
Fix Version/s: None
Security Level: All

Type: Bug Priority: Minor
Reporter: Steve Müller Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: platform, sqlserver, sqlsrv, varchar


 Description   

In SQLServerPlatform the default length for a VARCHAR declaration is set to "255". But according to the SQLServer documentation from Microsoft the default length is "1", if omitted in the declaration.
See remarks: http://msdn.microsoft.com/en-us/library/ms186939.aspx
Also the default length is hardcoded in the "getVarcharTypeDeclarationSQLSnippet" method which in my opinion should be evaluated through "getVarcharDefaultLength".

I don't exactly know if the current implementation is intended, otherwise it should be fixed. I would then create an PR if desired.






[DBAL-358] This issue should be removed. Wrong merge on github. Created: 04/Oct/12  Updated: 23/Jan/13  Resolved: 23/Jan/13

Status: Closed
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Trivial
Reporter: Benjamin Eberlei Assignee: Marco Pivetta
Resolution: Invalid Votes: 0
Labels: None


 Description   

This issue should be removed. Wrong merge on github.



 Comments   
Comment by Benjamin Eberlei [ 04/Oct/12 ]

A related Github Pull-Request [GH-210] was closed
https://github.com/doctrine/dbal/pull/210





[DBAL-292] Multiple use of named parameter doesn't work Created: 12/Jun/12  Updated: 23/Jan/13

Status: Awaiting Feedback
Project: Doctrine DBAL
Component/s: None
Affects Version/s: 2.2.2
Fix Version/s: None
Security Level: All

Type: Bug Priority: Minor
Reporter: Jürgen Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None
Environment:

IIS 7.5, MS-SQL-Server 2005, PHP 5.4.0



 Description   

In the example in the documentation http://doctrine-dbal.readthedocs.org/en/2.0.x/reference/data-retrieval-and-manipulation.html#dynamic-parameters-and-prepared-statements there is the following example:

$sql = "SELECT * FROM users WHERE name = :name OR username = :name";
$stmt = $conn->prepare($sql);
$stmt->bindValue("name", $name);
$stmt->execute();

When I try this example using pdo_sqlsrv I get the following error:
PDOException: SQLSTATE[07002]: [Microsoft][SQL Server Native Client 11.0]COUNT field incorrect or syntax error

When I use instead the parameters name1 and name2 the query works as expected.



 Comments   
Comment by Alexander [ 07/Jul/12 ]

Are you sure you were using the 2.2.2 version of the ORM? Can you try to reproduce this with the latest master?





[DBAL-353] doctrine:schema:update doesn't understand it doesn't need to run again Created: 25/Sep/12  Updated: 23/Jan/13  Resolved: 23/Jan/13

Status: Closed
Project: Doctrine DBAL
Component/s: Schema Managers
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Minor
Reporter: Mark A. Hershberger Assignee: Marco Pivetta
Resolution: Incomplete Votes: 0
Labels: None


 Description   

doctrine:schema:update keeps thinking there is more to do:

$ php app/console doctrine:schema:update --dump-sql
ALTER TABLE Account CHANGE guid guid VARCHAR(255) NOT NULL;
ALTER TABLE Customer CHANGE guid guid VARCHAR(255) NOT NULL, CHANGE authGuid authGuid VARCHAR(255) NOT NULL
$ php app/console doctrine:schema:update --force   
Updating database schema...
Database schema updated successfully! "2" queries were executed
$ php app/console doctrine:schema:update --dump-sql
ALTER TABLE Account CHANGE guid guid VARCHAR(255) NOT NULL;
ALTER TABLE Customer CHANGE guid guid VARCHAR(255) NOT NULL, CHANGE authGuid authGuid VARCHAR(255) NOT NULL


 Comments   
Comment by Christophe Coevoet [ 25/Sep/12 ]

Can you paste your ORM mapping for these fields ?

Comment by John Robeson [ 01/Nov/12 ]

I had the same problem. I used doctrine:mapping:import
to bootstrap some entities. It generated my
session entity primary key with a GeneratedValue strategy of
IDENTITY when it should have been NONE.

This sounds like the same problem with the string key
and incorrect GeneratedValue strategy.

PS: I ran into that doctrine:mapping:import issue
perhaps a year ago, when i first started playing with doctrine.
I do not know if it still persists.





[DBAL-367] Reverse engnering do not work with Oracle DB Created: 18/Oct/12  Updated: 23/Jan/13

Status: Open
Project: Doctrine DBAL
Component/s: Drivers, Schema Managers
Affects Version/s: 2.3
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Zelenin Alexandr Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: Cli, oracle, schematool
Environment:

PHP 5.3.3-1ubuntu9.10 with Suhosin-Patch (cli) (built: Feb 11 2012 06:21:15)
oci8-1.4.7 as PHP extension builded from pecl repository with instantclient-basic-linux.x64-11.2.0.3.0.zip and instantclient-sdk-linux.x64-11.2.0.3.0.zip
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production



 Description   
$ doctrine orm:convert-mapping --filter="ms$ions" xml .

  [Doctrine\DBAL\DBALException]
  Unknown database type binary_float requested, Doctrine\DBAL\Platforms\OraclePlatform may not support it.

cli-config.php:


use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Annotations\AnnotationRegistry;

require_once 'Doctrine/Common/ClassLoader.php';

define('APPLICATION_ENV', "development");
error_reporting(E_ALL);

$classLoader = new \Doctrine\Common\ClassLoader('Doctrine');
$classLoader->register();

$config = new \Doctrine\ORM\Configuration();
$config->setProxyDir(__DIR__);
$config->setProxyNamespace('Proxies');

$config->setAutoGenerateProxyClasses((APPLICATION_ENV == "development"));

AnnotationRegistry::registerFile("Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php");
$reader = new AnnotationReader();
$driverImpl = new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($reader, array(__DIR__ . "/../php/ru/niifhm/bioinformatics/biodb/model"));
$config->setMetadataDriverImpl($driverImpl);

if (APPLICATION_ENV == "development") {
    $cache = new \Doctrine\Common\Cache\ArrayCache();
} else {
    $cache = new \Doctrine\Common\Cache\ApcCache();
}

$config->setMetadataCacheImpl($cache);
$config->setQueryCacheImpl($cache);

$connectionOptions = array(
    'driver'   => 'oci8',
    'host'     => 'host.name',
    'dbname'   => 'db.name',
    'user'     => 'user.name',
    'password' => 'user.password'
);

$em = \Doctrine\ORM\EntityManager::create($connectionOptions, $config);
$platform = $em->getConnection()->getDatabasePlatform();
$platform->registerDoctrineTypeMapping('enum', 'string');

$em->getConfiguration()->setMetadataDriverImpl(
    new \Doctrine\ORM\Mapping\Driver\DatabaseDriver(
        $em->getConnection()->getSchemaManager()
    )
);

$helperSet = new \Symfony\Component\Console\Helper\HelperSet(array(
    'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em->getConnection()),
    'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em)
));


 Comments   
Comment by Marco Pivetta [ 23/Jan/13 ]

Formatting





[DBAL-368] array and object types should use BLOB, not CLOB, to store serialized data Created: 19/Oct/12  Updated: 23/Jan/13  Resolved: 23/Jan/13

Status: Closed
Project: Doctrine DBAL
Component/s: None
Affects Version/s: 2.2.2
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Karsten Dambekalns Assignee: Benjamin Eberlei
Resolution: Duplicate Votes: 0
Labels: postgresql


 Description   

When using array or object types, PHP's serialize() is used. Since that can return NUL bytes, using a text type will fail at least on PostgreSQL (just search the web for issues of that kind…).

So ArrayType and ObjectType should return a BLOB definition instead of a CLOB definition to be binary-safe.



 Comments   
Comment by Karsten Dambekalns [ 19/Oct/12 ]

See DBAL-369 for the suggested fix

Comment by Marco Pivetta [ 23/Jan/13 ]

Karsten Dambekalns DBAL-368 is this issue. What's the one you were referring to?

Comment by Marco Pivetta [ 23/Jan/13 ]

Nvm, it was DBAL-369

Comment by Marco Pivetta [ 23/Jan/13 ]

Moved to DBAL-369





[DBAL-416] [GH-249] Fixed doModifyLimitQuery for SQLServerPlatform Created: 18/Jan/13  Updated: 20/Jan/13  Resolved: 20/Jan/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.3.3
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of norzechowicz:

Url: https://github.com/doctrine/dbal/pull/249

Message:

It seems that there is a problem in SQLServerPlatform ``doModifyLimitQuery`` method.
I can't use Doctrine ORM Paginator because of wrong position of ``DISTINCT`` statement in final limit subquery, here is the exception message I'm getting.
``SQLSTATE[42000]: [Microsoft][SQL Server Native Client 10.0][SQL Server]Incorrect syntax near the keyword 'DISTINCT'.``

My proposition is to change ``doModifyLimitQuery`` result from:

``SELECT * FROM (SELECT ROW_NUMBER() OVER (ORDER BY username DESC) AS doctrine_rownum, * FROM user) ...``

into:

``SELECT * FROM (SELECT *, ROW_NUMBER() OVER (ORDER BY username DESC) AS doctrine_rownum FROM user) ...``



 Comments   
Comment by Benjamin Eberlei [ 20/Jan/13 ]

A related Github Pull-Request [GH-249] was closed
https://github.com/doctrine/dbal/pull/249





[DBAL-417] [GH-250] Lightweight export as of doctrine/doctrine2#543 Created: 19/Jan/13  Updated: 19/Jan/13  Resolved: 19/Jan/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of Ocramius:

Url: https://github.com/doctrine/dbal/pull/250

Message:

see doctrine/doctrine2#543



 Comments   
Comment by Benjamin Eberlei [ 19/Jan/13 ]

A related Github Pull-Request [GH-250] was closed
https://github.com/doctrine/dbal/pull/250





[DBAL-231] Doctrine\DBAL\SQLParserUtils::getPlaceholderPositions() - regex Created: 05/Mar/12  Updated: 19/Jan/13  Resolved: 14/Mar/12

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: 2.2
Fix Version/s: 2.3.3
Security Level: All

Type: Bug Priority: Major
Reporter: Ivo Mandalski Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None
Environment:

Fedora-16, Zend Serve CE, PHP 5.3.5



 Description   

Running the following SQL (note the named parameter ":account_id"):
===================
SELECT count('*') as cnt FROM feed f INNER JOIN orders_accounts oa ON oa.order_id = f.feed_id INNER JOIN users u ON u.id = f.user_id WHERE oa.account_id = :account_id AND f.feed_type='order' ORDER BY f.create_date DESC
===================

ends up in a thrown exception.
This SQL was generated by using the Query Builder

$qb = $this->_em->getConnection()->createQueryBuilder();
$qb->select('count(\'*\') as cnt');//I know this is bad
$qb->from('feed', 'f');
$qb->innerJoin('f', 'orders_accounts', 'oa', 'oa.order_id = f.feed_id');
$qb->innerJoin('f', 'users', 'u', 'u.id = f.user_id');
$qb->where('oa.account_id = :account_id AND f.feed_type=\'order\'');
$qb->setParameter('account_id', $accountId, \PDO::PARAM_INT);

$stmt = $qb->execute();
$res = $stmt->fetchAll(\PDO::FETCH_COLUMN);

===================
string(82) "SQLSTATE[42S22]: Column not found: 1054 Unknown column 'NULL_id' in 'where clause'"
string(3168) "#0 /var/www/cake_to_zf/library/Doctrine/DBAL/Connection.php(628): PDOStatement->execute()
#1 /var/www/cake_to_zf/library/Doctrine/DBAL/Query/QueryBuilder.php(185): Doctrine\DBAL\Connection->executeQuery('SELECT count('*...', Array, Array)
#2 /var/www/cake_to_zf/library/of/doctrine/SqlQueryBuilderPaginatorAdapter.php(69): Doctrine\DBAL\Query\QueryBuilder->execute()
#3 /var/www/cake_to_zf/library/Zend/Paginator.php(1060): of\doctrine\SqlQueryBuilderPaginatorAdapter->count()
.......

Suggested Fix:

Regex on line 64 in preg_match becomes '#([:a-zA-Z0-9_]

{1}

)#'
Added was an "_" ...

===================



 Comments   
Comment by Benjamin Eberlei [ 14/Mar/12 ]

Fixed

Comment by Benjamin Eberlei [ 14/Mar/12 ]

Merged in 2.1.x and 2.2 branches.

Comment by Andrew Vit [ 24/Mar/12 ]

I already fixed this in my reworking of the SqlParserUtils last month. See pull request and confirm that this issue was fixed there, together with other parsing problems:

https://github.com/doctrine/dbal/pull/113

Comment by Benjamin Eberlei [ 19/Jan/13 ]

Fixed in 2.3.3





[DBAL-364] [GH-216] Fixed SQL placeholder parsing Created: 11/Oct/12  Updated: 19/Jan/13  Resolved: 19/Jan/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.3.3
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of a-nik:

Url: https://github.com/doctrine/dbal/pull/216

Message:

Fixed comment on 'getPlaceholderPositions' method
Fixed error on escaped quote mark inside an SQL expression



 Comments   
Comment by Fabio B. Silva [ 19/Jan/13 ]

Closed in favor of GH-113

Comment by Benjamin Eberlei [ 19/Jan/13 ]

Fixed in 2.3.3





[DBAL-376] [GH-223] Include customSchemaOptions in column mapping Created: 05/Nov/12  Updated: 14/Jan/13  Resolved: 14/Jan/13

Status: Closed
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Duplicate Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of djlambert:

Url: https://github.com/doctrine/dbal/pull/223

Message:

This PR adds the customSchemaOptions in the array passed to the type.



 Comments   
Comment by Marco Pivetta [ 14/Jan/13 ]

Solved in DBAL-413





[DBAL-415] [GH-248] Enable multiple postgresql datetime formats Created: 14/Jan/13  Updated: 14/Jan/13

Status: Open
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 1
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of cedriclombardot:

Url: https://github.com/doctrine/dbal/pull/248

Message:

Postgre use ISO 8601 date formats so some times can be Y-m-d H:i:s or sometime Y-m-d H:i:s.u






[DBAL-414] zaza Created: 09/Jan/13  Updated: 09/Jan/13  Resolved: 09/Jan/13

Status: Closed
Project: Doctrine DBAL
Component/s: Drivers
Affects Version/s: 2.2.1
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: batbileg Assignee: Benjamin Eberlei
Resolution: Invalid Votes: 0
Labels: None
Environment:

aaan



 Description   

yu



 Comments   
Comment by batbileg [ 09/Jan/13 ]

yu wm





[DBAL-410] [GH-246] Fixed sql for creating table with fulltext index Created: 08/Jan/13  Updated: 08/Jan/13  Resolved: 08/Jan/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of hason:

Url: https://github.com/doctrine/dbal/pull/246

Message:



 Comments   
Comment by Benjamin Eberlei [ 08/Jan/13 ]

A related Github Pull-Request [GH-246] was closed
https://github.com/doctrine/dbal/pull/246





[DBAL-413] [GH-247] Obtain all informations about a column via Column::toArray() Created: 08/Jan/13  Updated: 08/Jan/13  Resolved: 08/Jan/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of hason:

Url: https://github.com/doctrine/dbal/pull/247

Message:



 Comments   
Comment by Benjamin Eberlei [ 08/Jan/13 ]

A related Github Pull-Request [GH-247] was closed
https://github.com/doctrine/dbal/pull/247





[DBAL-408] [GH-244] Enable Postgresql plateform to map inet column type Created: 08/Jan/13  Updated: 08/Jan/13  Resolved: 08/Jan/13

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of cedriclombardot:

Url: https://github.com/doctrine/dbal/pull/244

Message:

http://www.postgresql.org/docs/8.2/static/functions-net.html



 Comments   
Comment by Benjamin Eberlei [ 08/Jan/13 ]

A related Github Pull-Request [GH-244] was closed
https://github.com/doctrine/dbal/pull/244





[DBAL-411] Schema updater breaks when using backticks in tablenames. Created: 08/Jan/13  Updated: 08/Jan/13

Status: Open
Project: Doctrine DBAL
Component/s: Schema Managers
Affects Version/s: