Index: includes/bootstrap.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v
retrieving revision 1.46
diff -u -F^f -r1.46 bootstrap.inc
--- includes/bootstrap.inc	12 Apr 2005 16:55:11 -0000	1.46
+++ includes/bootstrap.inc	10 May 2005 19:05:12 -0000
@@ -256,7 +205,7 @@ function cache_set($cid, $data, $expire 
   $data = db_encode_blob($data);
 
   db_query("UPDATE {cache} SET data = '%s', created = %d, expire = %d, headers = '%s' WHERE cid = '%s'", $data, time(), $expire, $headers, $cid);
-  if (!db_affected_rows()) {
+  if (!db_matched()) {
     @db_query("INSERT INTO {cache} (cid, data, created, expire, headers) VALUES ('%s', '%s', %d, %d, '%s')", $cid, $data, time(), $expire, $headers);
   }
 }
Index: includes/database.mysql.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/database.mysql.inc,v
retrieving revision 1.28
diff -u -F^f -r1.28 database.mysql.inc
--- includes/database.mysql.inc	14 Apr 2005 18:50:16 -0000	1.28
+++ includes/database.mysql.inc	10 May 2005 19:07:35 -0000
@@ -164,6 +169,18 @@ function db_affected_rows() {
 }
 
 /**
+ * Determine the number of rows matched by the preceding query
+ */
+function db_matched() {
+  $updated = mysql_affected_rows();
+  if (!$updated) {
+    preg_match('/\d+/', mysql_info(), $m);
+    $updated = $m[0];
+  }
+  return $updated;
+}
+
+/**
  * Runs a limited-range query in the active database.
  *
  * Use this as a substitute for db_query() when a subset of the query is to be
Index: includes/database.pgsql.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/database.pgsql.inc,v
retrieving revision 1.7
diff -u -F^f -r1.7 database.pgsql.inc
--- includes/database.pgsql.inc	8 Apr 2005 11:24:46 -0000	1.7
+++ includes/database.pgsql.inc	10 May 2005 19:07:35 -0000
@@ -158,6 +164,14 @@ function db_affected_rows() {
 }
 
 /**
+ * Determine the number of rows matched by the preceding query
+ */
+function db_matched() {
+  return db_affected_rows();
+}
+
+
+/**
  * Runs a limited-range query in the active database.
  *
  * Use this as a substitute for db_query() when a subset of the query is to be
