mirror of
https://github.com/processwire/processwire.git
synced 2025-08-21 14:02:59 +02:00
Minor adjustment to preparation of table + column helper in WireDatabasePDO
This commit is contained in:
@@ -196,7 +196,9 @@ class DatabaseQuerySelectFulltext extends Wire {
|
||||
*
|
||||
*/
|
||||
protected function tableField() {
|
||||
return "$this->tableName.$this->fieldName";
|
||||
$fieldName = $this->fieldName;
|
||||
if(!$fieldName) $fieldName = 'data';
|
||||
return "$this->tableName.$fieldName";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1496,12 +1496,17 @@ class WireDatabasePDO extends Wire implements WireDatabase {
|
||||
*
|
||||
* @param string $str
|
||||
* @return string
|
||||
* @throws WireDatabaseException
|
||||
*
|
||||
*/
|
||||
public function escapeTableCol($str) {
|
||||
if(strpos($str, '.') === false) return $this->escapeTable($str);
|
||||
list($table, $col) = explode('.', $str);
|
||||
return $this->escapeTable($table) . '.' . $this->escapeCol($col);
|
||||
list($table, $col) = explode('.', $str, 2);
|
||||
$col = $this->escapeCol($col);
|
||||
$table = $this->escapeTable($table);
|
||||
if(!strlen($table)) throw new WireDatabaseException('Invalid table');
|
||||
if(!strlen($col)) return $table;
|
||||
return "$table.$col";
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user