[DBAL-399] [GH-237] Do not treat assignment operator as a parameter DBAL-398 Created: 18/Dec/12  Updated: 22/Dec/12  Resolved: 22/Dec/12

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.3.2
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 roverwolf:

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

Message:

A native (mysql) query should be able to use the assignment operator := but currently the SQLParserUtils method treats that as a missing parameter.

The patch solves the issue, but it looks like a higher-level fix might be desired that also handles the regular expression better.



 Comments   
Comment by David Ward [ 18/Dec/12 ]

Noting that this auto-generated issue duplicates DBAL-398

Comment by Benjamin Eberlei [ 22/Dec/12 ]

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





[DBAL-398] Native query does not allow mysql assignment operator := Created: 18/Dec/12  Updated: 03/Jan/13  Resolved: 22/Dec/12

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

Type: Bug Priority: Major
Reporter: David Ward Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: mysql
Environment:

Using Doctrine within Symfony 2.1.x


Attachments: Text File FixNativeAssignmentOperator.patch    

 Description   

When trying to use the mysql assignment operator in a native query one gets an exception as SqlParserUtils does not qualify the character after the : as being part of a valid parameter value.

Undefined index: in vendor/doctrine/dbal/lib/Doctrine/DBAL/SQLParserUtils.php line 156 (uncaught exception)

A simple example is
$rsm = new ResultSetMapping();
$rsm->addScalarResult('rank', 'rank');
$qry = $em->createNativeQuery("
SELECT (@rank := 1) AS rank
");
$result = $qry->getResult(Query::HYDRATE_ARRAY);

Or a more complicated example is (similar to actual use):

$rsm = new ResultSetMapping();
$rsm->addScalarResult('rank', 'rank');
$qry = $em->createNativeQuery("
SELECT rank FROM
(SELECT (@rank := @rank +1) AS rank FROM (SELECT @rank :=0) rnk2) rnk1
");
$result = $qry->getResult(Query::HYDRATE_ARRAY);

I have attached quick-fix patch, but it looks like the getPlaceholderPositions method is wanting something better overall (due to the TODO comment in it).



 Comments   
Comment by David Ward [ 18/Dec/12 ]

A pull request has been added at https://github.com/doctrine/dbal/pull/237 which also has tests added.

Comment by Bryson Armstrong [ 03/Jan/13 ]

I ran into this error and the fix caused other queries to have errors.

I fixed it by changing line 57 in vendor/doctrine/dbal/lib/Doctrine/DBAL/SQLParserUtils.php:

 
if ($statement[$i] == $match && !$inLiteral && (!$isPositional && $statement[$i+1] != '=')) {

to:

if ($statement[$i] == $match && !$inLiteral && ($isPositional || $statement[$i+1] != '=')) {




[DBAL-392] Moving entity relationship doesn't move foreign key in mysql table Created: 24/Nov/12  Updated: 29/Jan/14  Resolved: 23/Dec/12

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

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

Mac OSX, mysql 5.5.28, php 5.4.8


Issue Links:
Reference
is referenced by DDC-2161 Moving entity relationship doesn't mo... Resolved

 Description   

This is the copy of bug http://www.doctrine-project.org/jira/browse/DDC-2161 that I've moved here since it's related to the dbal and not the orm.

Basically when you update just the foreign table of a foreign key the constrain doesn't gets updated.



 Comments   
Comment by Benjamin Eberlei [ 24/Nov/12 ]

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

Comment by Alessandro Tagliapietra [ 26/Nov/12 ]

The related pull request is https://github.com/doctrine/dbal/pull/234

Comment by Doctrine Bot [ 29/Jan/14 ]

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





[DBAL-380] [GH-226] Fix for decimal fields with precision. Created: 12/Nov/12  Updated: 23/Dec/12  Resolved: 23/Dec/12

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: 2.3.2
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 bobdenotter:

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

Message:

These fields have no spaces in the length, so the 'explode' fails. Omit the space from the code, and it works. Even if there were a space, it would still work, because of the `array_map("trim", ..)`.

arr(7)
[
"cid" => str(2) "11"
"name" => str(6) "nummer"
"type" => str(7) "DECIMAL"
"notnull" => str(1) "1"
"dflt_value" => str(1) "0"
"pk" => str(1) "0"
"length" => str(4) "18,9"
]



 Comments   
Comment by Bob den Otter [ 07/Dec/12 ]

bump

Not trying to be annoying, but I think this is an issue, that can be resolved quickly, without any consequences for other functionality. If it could be squeezed into 2.3.2 or 2.4, i'd be very grateful.





Generated at Wed Oct 01 14:17:33 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.