3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
10 namespace Zend\Db\Adapter\Platform
;
12 class Sql92
implements PlatformInterface
19 public function getName()
25 * Get quote indentifier symbol
29 public function getQuoteIdentifierSymbol()
37 * @param string $identifier
40 public function quoteIdentifier($identifier)
42 return '"' . str_replace('"', '\\' . '"', $identifier) . '"';
46 * Quote identifier chain
48 * @param string|string[] $identifierChain
51 public function quoteIdentifierChain($identifierChain)
53 $identifierChain = str_replace('"', '\\"', $identifierChain);
54 if (is_array($identifierChain)) {
55 $identifierChain = implode('"."', $identifierChain);
57 return '"' . $identifierChain . '"';
61 * Get quote value symbol
65 public function getQuoteValueSymbol()
73 * @param string $value
76 public function quoteValue($value)
79 'Attempting to quote a value without specific driver level support can introduce security vulnerabilities in a production environment.'
81 return '\'' . addcslashes($value, "\x00\n\r\\'\"\x1a") . '\'';
87 * The ability to quote values without notices
92 public function quoteTrustedValue($value)
94 return '\'' . addcslashes($value, "\x00\n\r\\'\"\x1a") . '\'';
100 * @param string|string[] $valueList
103 public function quoteValueList($valueList)
105 if (!is_array($valueList)) {
106 return $this->quoteValue($valueList);
109 $value = reset($valueList);
111 $valueList[key($valueList)] = $this->quoteValue($value);
112 } while ($value = next($valueList));
113 return implode(', ', $valueList);
117 * Get identifier separator
121 public function getIdentifierSeparator()
127 * Quote identifier in fragment
129 * @param string $identifier
130 * @param array $safeWords
133 public function quoteIdentifierInFragment($identifier, array $safeWords = array())
135 $parts = preg_split('#([\.\s\W])#', $identifier, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY
);
137 $safeWords = array_flip($safeWords);
138 $safeWords = array_change_key_case($safeWords, CASE_LOWER
);
140 foreach ($parts as $i => $part) {
141 if ($safeWords && isset($safeWords[strtolower($part)])) {
155 $parts[$i] = '"' . str_replace('"', '\\' . '"', $part) . '"';
159 return implode('', $parts);