diff --git a/wire/core/DatabaseQuerySelectFulltext.php b/wire/core/DatabaseQuerySelectFulltext.php index afea9edf..6b85fe39 100644 --- a/wire/core/DatabaseQuerySelectFulltext.php +++ b/wire/core/DatabaseQuerySelectFulltext.php @@ -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"; } /** diff --git a/wire/core/WireDatabasePDO.php b/wire/core/WireDatabasePDO.php index a44e18e3..e2c5ac8f 100644 --- a/wire/core/WireDatabasePDO.php +++ b/wire/core/WireDatabasePDO.php @@ -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"; } /**