1
0
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:
Ryan Cramer
2023-03-24 13:12:56 -04:00
parent 43aa000f02
commit b7bec30fb7
2 changed files with 10 additions and 3 deletions

View File

@@ -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";
}
/**

View File

@@ -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";
}
/**