zend-db icon indicating copy to clipboard operation
zend-db copied to clipboard

Adding a fix for #267.

Open rarog opened this issue 8 years ago • 4 comments

In #267 I described the incorrect behaviour, when generating DDLs with characters in name that are used for escaping on different plattforms. This is an attempt to fix it. I tested the behaviour and it corrects the script generation with the base (PostgreSQL, SQLite) and MySQL escaping behaviour.

MSSQL seems to behave like standard despite having separate escaping, so I didn't touch it. I was able to test with driver Pdo_SqlServer, perhaps it uses the escaping with brackets, if Sqlsrv driver is used, but I couldn't test it, because I don't have the corresponding extension installed. I get the RuntimeException with message The Sqlsrv extension is required for this adapter but the extension is not loaded. @alextech Can you test the example in #267 and add the [] brackets to every named element? If it uses the brackets for escaping and is wrong, is it fixed, if you change in Zend\Db\Adapter\Platform\SqlSserver $quoteIdentifierTo to

    protected $quoteIdentifierTo = '[]';

At least from my tests SQL Management Studio escapes the opening bracket in names by adding the closing bracket to it, when I generate a CREATE TABLE script.

rarog avatar Sep 27 '17 15:09 rarog

I'll work on unit test next week. Thx for the first review!

rarog avatar Oct 20 '17 07:10 rarog

@mwillbanks I finally found time to add the unit tests. Are they ok in that form?

rarog avatar Apr 28 '18 19:04 rarog

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:

  • Squash all commits in your branch (git rebase -i origin/{branch})
  • Make a note of all changed files (`git diff --name-only origin/{branch}...HEAD
  • Run the laminas/laminas-migration tool on the code.
  • Clone laminas/laminas-db to another directory.
  • Copy the files from the second bullet point to the clone of laminas/laminas-db.
  • In your clone of laminas/laminas-db, commit the files, push to your fork, and open the new PR. We will be providing tooling via laminas/laminas-migration soon to help automate the process.

weierophinney avatar Dec 31 '19 22:12 weierophinney

This repository has been closed and moved to laminas/laminas-db; a new issue has been opened at https://github.com/laminas/laminas-db/issues/65.

michalbundyra avatar Jan 16 '20 19:01 michalbundyra