Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Db\Sql - cleaning code duplicates #5701

Closed
wants to merge 17 commits into from
Closed

Db\Sql - cleaning code duplicates #5701

wants to merge 17 commits into from

Conversation

turrsis
Copy link
Contributor

@turrsis turrsis commented Jan 10, 2014

moved to functions :

  • resolving columns (AbstractSql::resolveColumnValue)
  • resolving $this->table (AbstractSql::resolveTable)
  • resolve $parameterContainer (AbstractSql::resolveParameterContainer)

Insert reorganized because :

  • for using common method for resolving columns
  • use of $columns and $values ​​is redundant, $columns only is enough

AbstractSql::processExpression and AbstractSql::processSubSelect : do more readable

Added new commits (step 6 - step 9):

  • delete dependency between $driver and $parameterContainer for process... methods.
  • move prepareStatement() and getSqlString() to AbstractSql because it duplicates in many places
  • AbstractSql::processExpression() should return string and paremeters push to ParameterContainer directly - this remove excess ParameterContainer::merge() calls and simplificate code
  • some code optimization

@ralphschindler
Copy link
Member

Big commit, have to check if there are any BC issues. I realize you like creating abstractions for non-algorithmically interesting code blocks, so I'll defer to the cr-team on that stuff. Personally, I like shallower stack traces when I am having to debug through stuff, especially something as simple as the workflow you created for on resolving parameter containers. But that is my personal preference.

As for some of the rest, it looks ok- considering the size, it might take some time to get to.

@weierophinney
Copy link
Member

@ralphschindler Can you set a milestone on this, please?

@ralphschindler ralphschindler added this to the 3.0.0 milestone Mar 4, 2014
@@ -199,4 +198,65 @@ protected function processSubSelect(Select $subselect, PlatformInterface $platfo
}
return $sql;
}

protected function resolveColumnValue($column, PlatformInterface $platform, DriverInterface $driver = null, $namedParameterPrefix = null, ParameterContainer $parameterContainer = null)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doc block, please.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On all new methods...

@weierophinney weierophinney modified the milestones: 2.4.0, 3.0.0 May 12, 2014
@weierophinney
Copy link
Member

This looks good, and like it may offer some performance improvements due to reduced algorithmic complexity and duplication of records.

@weierophinney
Copy link
Member

@turrsis Ping me when the docblocks are in place, and I'll merge.

@turrsis
Copy link
Contributor Author

turrsis commented May 13, 2014

@weierophinney the docblocks added

@turrsis
Copy link
Contributor Author

turrsis commented May 13, 2014

@weierophinney please, see this #6262 (this is reduced algorithmic too). Or add new commit to current PR?

@turrsis
Copy link
Contributor Author

turrsis commented May 24, 2014

@weierophinney Can you merge this (docblocks are in place)?

@turrsis
Copy link
Contributor Author

turrsis commented May 27, 2014

Added new commits (step 6 - step 9), and change PR description

@turrsis
Copy link
Contributor Author

turrsis commented May 29, 2014

Added new commits (step 10 - step 11)

@Ocramius
Copy link
Member

This was rebased and manually merged into develop at 6c20013

@turrsis thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants