diff options
-rw-r--r-- | it_dbi.class | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/it_dbi.class b/it_dbi.class index ac90848..ae7767c 100644 --- a/it_dbi.class +++ b/it_dbi.class @@ -520,7 +520,7 @@ function read($id=null) * Fields can contain a compare operator: 'name LIKE' => "j%" or 'amount >' => 100 * Fields can start with - to prevent quoting of right side: '-modified' => "CURDATE()" * $query can contain magic field 'SELECT' for things like 'COUNT(*)' or 'DISTINCT foo', defaults to '*' - * $query can contain magic field 'JOIN' for things like 'tableA LEFT JOIN tableB ON a=b', defaults to table name + * $query can contain magic field 'FROM' or 'JOIN' for things like 'tableA LEFT JOIN tableB ON a=b', defaults to table name * $query can contain 'CALC_FOUND_ROWS', if true member var _found_rows contains number of matching rows before LIMIT * $query can contain 'NOFETCH', if true the first row is not prefetched (e.g. when directly using _result) * @return Number of matching rows, use iterate() to fetch the next record @@ -546,10 +546,10 @@ function select(/* $query = array|string, ... */) } $join = $this->_p['table']; - if (isset($query['JOIN'])) # WARNING: this field gets abused for "tablename USE INDEX (fast2) + if (isset($query['JOIN']) || isset($query['FROM'])) # WARNING: this field gets abused for "tablename USE INDEX (fast2) { - $join = $query['JOIN']; - unset($query['JOIN']); + $join = trim($query['FROM'] . " " . $query['JOIN']); + unset($query['JOIN'], $query['FROM']); } unset($this->_found_rows); |