<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -8,12 +8,8 @@
 		 * Function: build_update_values
 		 * Creates an update data part.
 		 */
-		public static function build_update_values($data) {
-			$set = array();
-
-			foreach ($data as $field =&gt; $val)
-				array_push($set, &quot;$field = $val&quot;);
-
+		public static function build_update_values($data, &amp;$params = array()) {
+			$set = self::build_conditions($data, $params);
 			return implode(&quot;, &quot;, $set);
 		}
 
@@ -71,7 +67,7 @@
 		public static function build_update($table, $conds, $data, &amp;$params = array()) {
 			return &quot;
 				UPDATE __$table
-				SET &quot;.self::build_update_values($data).&quot;
+				SET &quot;.self::build_update_values($data, $params).&quot;
 				&quot;.($conds ? &quot;WHERE &quot;.self::build_where($conds, $table, $params) : &quot;&quot;).&quot;
 			&quot;;
 		}
@@ -185,42 +181,48 @@
 			return implode(&quot;, &quot;, $order);
 		}
 
-		public static function build_conditions($conds, &amp;$params, $tables) {
+		public static function build_conditions($conds, &amp;$params, $tables = null) {
 			foreach ($conds as $key =&gt; $val) {
 				if (is_numeric($key)) # Full expression
 					$cond = $val;
 				else { # Key =&gt; Val expression
-					if (substr($key, -4) == &quot; not&quot;) { # Negation
-						$key = substr($key, 0, -4);
-						if (is_array($val))
-							$cond = $key.&quot; NOT IN &quot;.self::build_in($val);
-						elseif ($val === null)
-							$cond = $key.&quot; IS NOT NULL&quot;;
-						else {
-							$cond = $key.&quot; != :&quot;.$key;
+					if (is_string($val) and $val[0] == &quot;:&quot;)
+						$cond = $key.&quot; = &quot;.$val;
+					else {
+						if (substr($key, -4) == &quot; not&quot;) { # Negation
+							$key = substr($key, 0, -4);
+							if (is_array($val))
+								$cond = $key.&quot; NOT IN &quot;.self::build_in($val);
+							elseif ($val === null)
+								$cond = $key.&quot; IS NOT NULL&quot;;
+							else {
+								$cond = $key.&quot; != :&quot;.$key;
+								$params[&quot;:&quot;.$key] = $val;
+							}
+						} elseif (substr($key, -5) == &quot; like&quot;) { # LIKE
+							$key = substr($key, 0, -5);
+							$cond = $key.&quot; LIKE :&quot;.$key;
 							$params[&quot;:&quot;.$key] = $val;
-						}
-					} elseif (substr($key, -5) == &quot; like&quot;) { # LIKE
-						$key = substr($key, 0, -5);
-						$cond = $key.&quot; LIKE :&quot;.$key;
-						$params[&quot;:&quot;.$key] = $val;
-					} elseif (substr($key, -9) == &quot; not like&quot;) { # NOT LIKE
-						$key = substr($key, 0, -9);
-						$cond = $key.&quot; NOT LIKE :&quot;.$key;
-						$params[&quot;:&quot;.$key] = $val;
-					} else { # Equation
-						if (is_array($val))
-							$cond = $key.&quot; IN &quot;.self::build_in($val);
-						elseif ($val === null)
-							$cond = $key.&quot; IS NULL&quot;;
-						else {
-							$cond = $key.&quot; = :&quot;.$key;
+						} elseif (substr($key, -9) == &quot; not like&quot;) { # NOT LIKE
+							$key = substr($key, 0, -9);
+							$cond = $key.&quot; NOT LIKE :&quot;.$key;
 							$params[&quot;:&quot;.$key] = $val;
+						} else { # Equation
+							if (is_array($val))
+								$cond = $key.&quot; IN &quot;.self::build_in($val);
+							elseif ($val === null)
+								$cond = $key.&quot; IS NULL&quot;;
+							else {
+								$cond = $key.&quot; = :&quot;.$key;
+								$params[&quot;:&quot;.$key] = $val;
+							}
 						}
 					}
 				}
 
-				self::tablefy($cond, $tables);
+				if ($tables)
+					self::tablefy($cond, $tables);
+
 				$conditions[] = $cond;
 			}
 </diff>
      <filename>includes/class/QueryBuilder.php</filename>
    </modified>
    <modified>
      <diff>@@ -314,12 +314,9 @@
 					$sql-&gt;delete(&quot;tags&quot;, array(&quot;id&quot; =&gt; $tag[&quot;id&quot;]));
 				else
 					$sql-&gt;update(&quot;tags&quot;,
-					             &quot;id = :id&quot;,
-					             array(&quot;tags&quot; =&gt; &quot;:tags&quot;,
-					                   &quot;clean&quot; =&gt; &quot;:clean&quot;),
-					             array(&quot;:id&quot; =&gt; $tag[&quot;id&quot;],
-					                   &quot;:tags&quot; =&gt; join(&quot;,&quot;, $names),
-					                   &quot;:clean&quot; =&gt; join(&quot;,&quot;, $cleans)));
+					             array(&quot;id&quot; =&gt; $tag[&quot;id&quot;]),
+					             array(&quot;tags&quot; =&gt; join(&quot;,&quot;, $names),
+					                   &quot;clean&quot; =&gt; join(&quot;,&quot;, $cleans)));
 			}
 
 			Flash::notice(__(&quot;Tag deleted.&quot;, &quot;tags&quot;), &quot;/admin/?action=manage_tags&quot;);</diff>
      <filename>modules/tags/tags.php</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>0ab14775db15b0805c1f2192b79edcc6247ad196</id>
    </parent>
  </parents>
  <author>
    <name>Alex Suraci</name>
    <email>i.am@toogeneric.com</email>
  </author>
  <url>http://github.com/vito/chyrp/commit/5563f88b0bc792af119d65e58943ccc949705f19</url>
  <id>5563f88b0bc792af119d65e58943ccc949705f19</id>
  <committed-date>2008-09-01T10:39:40-07:00</committed-date>
  <authored-date>2008-09-01T10:39:40-07:00</authored-date>
  <message>* More SQL interfacing improvements
  * Use condition building for update/insert queries
  * $tables arg is now optional in QueryBuilder::build_conditions</message>
  <tree>41b198d7cce6475afd6ff99065cd5555a2b527ed</tree>
  <committer>
    <name>Alex Suraci</name>
    <email>i.am@toogeneric.com</email>
  </committer>
</commit>
