|
|
@@ -46,28 +46,35 @@ trait SqlDialectTrait
|
|
|
return $this->_startQuote . $identifier . $this->_endQuote;
|
|
|
}
|
|
|
|
|
|
+ // string.string
|
|
|
if (preg_match('/^[\w-]+\.[^ \*]*$/', $identifier)) {
|
|
|
-// string.string
|
|
|
$items = explode('.', $identifier);
|
|
|
|
|
|
return $this->_startQuote . implode($this->_endQuote . '.' . $this->_startQuote, $items) . $this->_endQuote;
|
|
|
}
|
|
|
|
|
|
+ // string.*
|
|
|
if (preg_match('/^[\w-]+\.\*$/', $identifier)) {
|
|
|
-// string.*
|
|
|
return $this->_startQuote . str_replace('.*', $this->_endQuote . '.*', $identifier);
|
|
|
}
|
|
|
|
|
|
if (preg_match('/^([\w-]+)\((.*)\)$/', $identifier, $matches)) {
|
|
|
-// Functions
|
|
|
+ // Functions
|
|
|
return $matches[1] . '(' . $this->quoteIdentifier($matches[2]) . ')';
|
|
|
}
|
|
|
|
|
|
// Alias.field AS thing
|
|
|
- if (preg_match('/^([\w-]+(\.[\w-]+|\(.*\))*)\s+AS\s*([\w-]+)$/i', $identifier, $matches)) {
|
|
|
+ if (preg_match('/^([\w-]+(\.[\w-\s]+|\(.*\))*)\s+AS\s*([\w-]+)$/i', $identifier, $matches)) {
|
|
|
return $this->quoteIdentifier($matches[1]) . ' AS ' . $this->quoteIdentifier($matches[3]);
|
|
|
}
|
|
|
|
|
|
+ // string.string with spaces
|
|
|
+ if (preg_match('/^[\w-_]+\.[\w-_\s]+[\w_]*/', $identifier)) {
|
|
|
+ $items = explode('.', $identifier);
|
|
|
+
|
|
|
+ return $this->_startQuote . implode($this->_endQuote . '.' . $this->_startQuote, $items) . $this->_endQuote;
|
|
|
+ }
|
|
|
+
|
|
|
if (preg_match('/^[\w-_\s]*[\w-_]+/', $identifier)) {
|
|
|
return $this->_startQuote . $identifier . $this->_endQuote;
|
|
|
}
|