summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUrban Müller2013-10-15 12:58:46 +0000
committerUrban Müller2013-10-15 12:58:46 +0000
commit6b6081f5d7ad4985dfab0e45dad750e8bbaeb3a8 (patch)
tree66ed3ca29df98bf3931b959f8639a97447671556
parent9eeb83b98f08a786020e75e50f2a281ef41b1112 (diff)
downloaditools-6b6081f5d7ad4985dfab0e45dad750e8bbaeb3a8.tar.gz
itools-6b6081f5d7ad4985dfab0e45dad750e8bbaeb3a8.tar.bz2
itools-6b6081f5d7ad4985dfab0e45dad750e8bbaeb3a8.zip
allow FROM instead of JOIN
-rw-r--r--it_dbi.class8
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);