mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-2733: DefaultQuoteStrategy BUG on Oracle #3420
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Oct 10, 2013).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user phackwer:
There's a bug on the DefaultQuoteStrategy when used with Oracle. The getColumnAlias created an invalid alias.
The name of the column had 31 chars, with * being the 3rd. Column was 101 on the query. Resulting name of the alias started with *, which is invalid name for Oracle.
Example:
CO_SEQ_NOMEGIGANTEPRAKCTMEUDEUS
Alias formed was
_SEQ_NOMEGIGANTEPRAKCTMEUDEUS101
HOW TO FIX:
replace the regex on line 135:
original:
$columnName = preg_replace('/[A-Za-z0-9_]/', '', $columnName);
fixed:
$columnName = preg_replace('/[A-Za-z0-9]/', '', $columnName);
@doctrinebot commented on GitHub (Oct 16, 2013):
Comment created by rudi.neto:
Hi there!
I would like to do a contribuition for this issue! I'm not safe with my sugestion, but someone can be helped!
I'm working with 2.4.0 Doctrine Version and I'm facing the same problem, "invalid character" due the function that make a cut off from the begining from alias.
My sugestion to solve this problem is maintain the separator '_' between alias name, but cutting off from the ending alias and reserv the lenght to the counter.
See bellow my modification code at DefaultQuoteStrategy::getColumnAlias() line 130, just replace all lines from function by these below:
What do you guys think?
@doctrinebot commented on GitHub (Oct 16, 2013):
Comment created by phackwer:
Rudi, prefixing it with * would keep the problem on Oracle. Since that name is for aliasing pourposes only, the * char is useless.
I just remembered another possible situation: fields should not start with numbers!
@doctrinebot commented on GitHub (Oct 16, 2013):
Comment created by rudi.neto:
Pablo,
The changes in my sugestion code don't consider the prefix '_', indepedent of the characteres in alias column name, the function will remove the last characteres from alias... see an example with column name DT_VERIFICACAO_SITUACAO_ACESSO.
The current code create a sql:
DT_VERIFICACAO_SITUACAO_ACESSO AS _VERIFICACAO_SITUACAO_ACESSO23,
My sugestion will produce:
DT_VERIFICACAO_SITUACAO_ACESSO AS DT_VERIFICACAO_SITUACAO_ACES23,
@doctrinebot commented on GitHub (Oct 18, 2013):
Comment created by phackwer:
Oh, sorry, my mistake. Your solution sounds better.
Since there's still no solution from the Doctrine Team, I'm iusing my own QuoteStrategy. Hope this bug gets fixed soon.
@doctrinebot commented on GitHub (Oct 26, 2013):
Comment created by @beberlei:
[fabio.bat.silva] Can you comment on [rudi.neto] solution? Its easily changed, but I am wondering if this is backwards compatible. I would want to merge the fix back to 2.3 and 2.4. Branch is ready to be committed for me locally.