summaryrefslogtreecommitdiff
path: root/idiorm.php
diff options
context:
space:
mode:
authorJamie Matthews <[email protected]>2010-04-28 19:46:36 +0100
committerJamie Matthews <[email protected]>2010-04-28 19:46:36 +0100
commit036f470e75e25a17e15dcc38c3bc22d2fca0ee88 (patch)
treeb44416b270a4ed3de9dff22818f6a44136af5d74 /idiorm.php
parent09f0f74ff068891752883fbfa792b7bd29f4df00 (diff)
Refactor WHERE clause building loop
Diffstat (limited to 'idiorm.php')
-rw-r--r--idiorm.php15
1 files changed, 5 insertions, 10 deletions
diff --git a/idiorm.php b/idiorm.php
index 301dde6..dd8c9c4 100644
--- a/idiorm.php
+++ b/idiorm.php
@@ -430,24 +430,19 @@
$query[] = $this->raw_where_clause;
$this->values = array_merge($this->values, $this->raw_where_parameters);
} else if (count($this->where) > 0) { // Standard WHERE clauses
- $query[] = "WHERE";
- $first = array_shift($this->where);
- $query[] = join(" ", array(
- $first[self::WHERE_COLUMN_NAME],
- $first[self::WHERE_OPERATOR],
- '?'
- ));
- $this->values[] = $first[self::WHERE_VALUE];
+ $where_clauses = array();
while($where = array_shift($this->where)) {
- $query[] = "AND";
- $query[] = join(" ", array(
+ $where_clauses[] = join(" ", array(
$where[self::WHERE_COLUMN_NAME],
$where[self::WHERE_OPERATOR],
'?'
));
$this->values[] = $where[self::WHERE_VALUE];
}
+
+ $query[] = "WHERE";
+ $query[] = join(" AND ", $where_clauses);
}
// Add ORDER BY clause(s)