This repository was archived by the owner on Jan 29, 2020. It is now read-only.
TableIdentifier schema parameter to allow arrays for use in quoteIdentifierChain to express full object path.#232
Open
alextech wants to merge 4 commits into
Conversation
…wing array as parameter for $schema in TableIdentifier
froschdesign
suggested changes
Mar 11, 2017
| * | ||
| * @link http://github.com/zendframework/zf2 for the canonical source repository | ||
| * @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com) | ||
| * @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com) |
|
|
||
| if ($schema && $table) { | ||
| $table = $platform->quoteIdentifier($schema) . $platform->getIdentifierSeparator() . $table; | ||
| $table = $platform->quoteIdentifierChain($schema).$platform->getIdentifierSeparator() . $table; |
Member
There was a problem hiding this comment.
Spaces are missing before and after the dot.
| @@ -1,9 +1,11 @@ | |||
| <?php | |||
|
|
|||
| public function __construct($table, $schema = null) | ||
| { | ||
| if (! (is_string($table) || is_callable([$table, '__toString']))) { | ||
| if (!(is_string($table) || is_callable([$table, '__toString']))) { |
| $this->schema = null; | ||
| } else { | ||
| if (! (is_string($schema) || is_callable([$schema, '__toString']))) { | ||
| if (!(is_string($schema) || is_array($schema) || is_callable([$schema, '__toString']))) { |
| } | ||
|
|
||
| $this->schema = (string) $schema; | ||
| if (!is_array($schema)) { |
| @@ -1,19 +1,23 @@ | |||
| <?php | |||
|
|
|||
|
|
||
| /** | ||
| * Tests for {@see \Zend\Db\Sql\TableIdentifier} | ||
| * Tests for {@see \Zend\Db\Sql\TableIdentifier}. |
|
|
||
| /** | ||
| * Data provider | ||
| * Data provider. |
|
|
||
| /** | ||
| * Data provider | ||
| * Data provider. |
Member
|
@alextech |
samsonasik
reviewed
Jun 9, 2017
| } | ||
|
|
||
| $this->schema = (string) $schema; | ||
| if (! is_array($schema)) { |
Contributor
There was a problem hiding this comment.
probably check for callable [$schema, '__toString'] only to avoid re-cast $schema that already string ?
if (is_callable([$schema, '__toString'])) {
Member
|
This repository has been moved to laminas/laminas-db. If you feel that this patch is still relevant, please re-open against that repository, and reference this issue. To re-open, we suggest the following workflow:
|
Member
|
This repository has been closed and moved to laminas/laminas-db; a new issue has been opened at laminas/laminas-db#78. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#206 Allow expression of full path towards table by allowing array as parameter for $schema in TableIdentifier and use
quoteIdentifierChainin Sql table resolver. Reasoning explained in the issue.While working on this noticed that
quoteIdentifierChaintries to preform near identical operation asidentifierChain, hence the change in theAbstractSQLclass, but in less safer way. The result is the same most of the time but it uses hardcoded strings, instead of tokens specified in the specification thatquoteIdentifieris using, such asquoteIdentiferToorquoteIdentifer[0]andgetIdentifierSeparator().I think this is an oversight since databases with more complex database object locator rules (PostgreSQL and SQL Server) are only now becoming more popular. Cleaning that up possibly in another PR.