diff -urpN drupal-6.x-dev-200707182104/includes/cache.inc drupal-6.x-dev-clob-0.7/includes/cache.inc
--- drupal-6.x-dev-200707182104/includes/cache.inc	2007-05-26 05:01:30.000000000 +0800
+++ drupal-6.x-dev-clob-0.7/includes/cache.inc	2007-07-18 21:19:09.000000000 +0800
@@ -105,10 +105,11 @@ function cache_set($cid, $data, $table =
     $serialized = 1;
   }
   $created = time();
-  db_query("UPDATE {". $table ."} SET data = %b, created = %d, expire = %d, headers = '%s', serialized = %d WHERE cid = '%s'", $data, $created, $expire, $headers, $serialized, $cid);
+  db_query("UPDATE {". $table ."} SET data = %b, created = %d, expire = %d, headers = '%s', serialized = %d WHERE cid = '%s'", NULL, $created, $expire, $headers, $serialized, $cid);
   if (!db_affected_rows()) {
-    @db_query("INSERT INTO {". $table ."} (cid, data, created, expire, headers, serialized) VALUES ('%s', %b, %d, %d, '%s', %d)", $cid, $data, $created, $expire, $headers, $serialized);
+    @db_query("INSERT INTO {". $table ."} (cid, data, created, expire, headers, serialized) VALUES ('%s', %b, %d, %d, '%s', %d)", $cid, NULL, $created, $expire, $headers, $serialized);
   }
+  db_update_blob(db_prefix_tables('{' . $table . '}'), array('data' => $data), "cid = '%s'", $cid);
 }
 
 /**
diff -urpN drupal-6.x-dev-200707182104/includes/database.inc drupal-6.x-dev-clob-0.7/includes/database.inc
--- drupal-6.x-dev-200707182104/includes/database.inc	2007-07-12 17:21:30.000000000 +0800
+++ drupal-6.x-dev-clob-0.7/includes/database.inc	2007-07-18 21:19:09.000000000 +0800
@@ -158,6 +158,9 @@ function db_set_active($name = 'default'
 
 /**
  * Helper function for db_query().
+ *
+ * NOTE: %b and %c should input NULL as placeholder, and further more 
+ * update its value manually by using db_update_blob() or db_update_clob().
  */
 function _db_query_callback($match, $init = FALSE) {
   static $args = NULL;
@@ -175,15 +178,17 @@ function _db_query_callback($match, $ini
       return '%';
     case '%f':
       return (float) array_shift($args);
-    case '%b': // binary data
-      return db_encode_blob(array_shift($args));
+    case '%b': // Binary Large OBject.
+      return db_encode_blob(array_shift($args));  
+    case '%c': // Character Large OBject.
+      return db_encode_clob(array_shift($args));
   }
 }
 
 /**
  * Indicates the place holders that should be replaced in _db_query_callback().
  */
-define('DB_QUERY_REGEXP', '/(%d|%s|%%|%f|%b)/');
+define('DB_QUERY_REGEXP', '/(%d|%s|%%|%f|%b|%c)/');
 
 /**
  * Helper function for db_rewrite_sql.
diff -urpN drupal-6.x-dev-200707182104/includes/database.mysql-common.inc drupal-6.x-dev-clob-0.7/includes/database.mysql-common.inc
--- drupal-6.x-dev-200707182104/includes/database.mysql-common.inc	2007-06-27 04:24:19.000000000 +0800
+++ drupal-6.x-dev-clob-0.7/includes/database.mysql-common.inc	2007-07-18 21:19:09.000000000 +0800
@@ -27,7 +27,7 @@
  *   you may also pass a single array containing the query arguments.
  *
  *   Valid %-modifiers are: %s, %d, %f, %b (binary data, do not enclose
- *   in '') and %%.
+ *   in ''), %c (character large object, do not enclose in '') and %%.
  *
  *   NOTE: using this syntax will cast NULL and FALSE values to decimal 0,
  *   and TRUE values to decimal 1.
@@ -217,6 +217,9 @@ function db_type_map() {
     'blob:big'        => 'LONGBLOB',
     'blob:normal'     => 'BLOB',
 
+    'clob:big'        => 'LONGTEXT',
+    'clob:normal'     => 'TEXT',
+
     'datetime:normal' => 'DATETIME',
   );
   return $map;
@@ -462,7 +465,98 @@ function db_last_insert_id($table, $fiel
 }
 
 /**
+ * Update Character Large Object value. Wrapper function for _db_update_lob()
+ *
+ * @param $table
+ *   Table to update.
+ * @param $values
+ *   Values to update, in array format. Columns and values pairs.
+ * @param $where
+ *   Update condition.
+ * @param ...
+ *   A variable number of arguments which are substituted into the query
+ *   WHERE condition, using printf() syntax. Instead of a variable number 
+ *   of query arguments, you may also pass a single array containing the 
+ *   query arguments.
+ *
+ *   Valid %-modifiers are: %s, %d, %f, %b (binary data, do not enclose
+ *   in ''), %c (character large object, do not enclose in '') and %%.
+ *
+ *   NOTE: using this syntax will cast NULL and FALSE values to decimal 0,
+ *   and TRUE values to decimal 1.
+ *
+ * @return
+ *   Returns TRUE on success or FALSE on failure.
+ */
+function db_update_blob($table, $values, $where) {
+  $args = func_get_args();
+  array_shift($args);
+  array_shift($args);
+  array_shift($args);
+  $args = is_array($args) ? $args : array($args);
+  if (isset($args[0]) and is_array($args[0])) { // 'All arguments in one array' syntax
+    $args = $args[0];
+  }
+  return _db_update_lob($table, $values, $where, $args, 'BLOB');
+}
+
+/**
+ * Update Binary Large Object value. Wrapper function for _db_update_lob()
+ *
+ * @param $table
+ *   Table to update.
+ * @param $values
+ *   Values to update, in array format. Columns and values pairs.
+ * @param $where
+ *   Update condition.
+ * @param ...
+ *   A variable number of arguments which are substituted into the query
+ *   WHERE condition, using printf() syntax. Instead of a variable number 
+ *   of query arguments, you may also pass a single array containing the 
+ *   query arguments.
+ *
+ *   Valid %-modifiers are: %s, %d, %f, %b (binary data, do not enclose
+ *   in ''), %c (character large object, do not enclose in '') and %%.
+ *
+ *   NOTE: using this syntax will cast NULL and FALSE values to decimal 0,
+ *   and TRUE values to decimal 1.
+ *
+ * @return
+ *   Returns TRUE on success or FALSE on failure.
+ */
+function db_update_clob($table, $values, $where) {
+  $args = func_get_args();
+  array_shift($args);
+  array_shift($args);
+  array_shift($args);
+  $args = is_array($args) ? $args : array($args);
+  if (isset($args[0]) and is_array($args[0])) { // 'All arguments in one array' syntax
+    $args = $args[0];
+  }
+  return _db_update_lob($table, $values, $where, $args, 'CLOB');
+}
+
+/**
+ * Helper function for update Large Object value.
+ */
+function _db_update_lob($table, $values, $where, $args, $lobtype = 'BLOB') {
+  _db_query_callback($args, TRUE);
+  $where = preg_replace_callback(DB_QUERY_REGEXP, '_db_query_callback', $where);
+
+  $arr = array();
+  foreach ($values as $key => $value) {
+    switch ($lobtype) {
+      case 'BLOB': $arr[] = $key . " = " . db_encode_blob($value); break;
+      case 'CLOB': $arr[] = $key . " = " . db_encode_clob($value); break;
+    }
+  }
+
+  $query = 'UPDATE ' . $table . ' SET ' . implode(', ', $arr) . ' WHERE ' . $where;
+  return _db_query($query);
+}
+
+/**
  * @} End of "ingroup schemaapi".
  */
 
-?>
\ No newline at end of file
+?>
diff -urpN drupal-6.x-dev-200707182104/includes/database.mysqli.inc drupal-6.x-dev-clob-0.7/includes/database.mysqli.inc
--- drupal-6.x-dev-200707182104/includes/database.mysqli.inc	2007-06-05 20:13:20.000000000 +0800
+++ drupal-6.x-dev-clob-0.7/includes/database.mysqli.inc	2007-07-18 21:19:09.000000000 +0800
@@ -253,7 +253,7 @@ function db_affected_rows() {
  *   using printf() syntax. The query arguments can be enclosed in one
  *   array instead.
  *   Valid %-modifiers are: %s, %d, %f, %b (binary data, do not enclose
- *   in '') and %%.
+ *   in ''), %c (character large object, do not enclose in '') and %%.
  *
  *   NOTE: using this syntax will cast NULL and FALSE values to decimal 0,
  *   and TRUE values to decimal 1.
@@ -303,7 +303,7 @@ function db_query_range($query) {
  *   using printf() syntax. The query arguments can be enclosed in one
  *   array instead.
  *   Valid %-modifiers are: %s, %d, %f, %b (binary data, do not enclose
- *   in '') and %%.
+ *   in ''), %c (character large object, do not enclose in '') and %%.
  *
  *   NOTE: using this syntax will cast NULL and FALSE values to decimal 0,
  *   and TRUE values to decimal 1.
@@ -335,11 +335,11 @@ function db_query_temporary($query) {
  * @param $data
  *   Data to encode.
  * @return
- *  Encoded data.
+ *  Encoded data. Return a place holder when NULL input.
  */
 function db_encode_blob($data) {
   global $active_db;
-  return "'". mysqli_real_escape_string($active_db, $data) ."'";
+  return !is_null($data) ? "'". mysqli_real_escape_string($active_db, $data) ."'" :  "''";
 }
 
 /**
@@ -355,6 +355,31 @@ function db_decode_blob($data) {
 }
 
 /**
+ * Returns a properly formatted Character Large OBject value.
+ *
+ * @param $data
+ *   Data to encode.
+ * @return
+ *  Encoded data. Return a place holder when NULL input.
+ */
+function db_encode_clob($data) {
+  global $active_db;
+  return !is_null($data) ? "'". mysqli_real_escape_string($active_db, $data) ."'" :  "''";
+}
+
+/**
+ * Returns text from a Character Large OBject value.
+ *
+ * @param $data
+ *   Data to decode.
+ * @return
+ *  Decoded data.
+ */
+function db_decode_clob($data) {
+  return $data;
+}
+
+/**
  * Prepare user input for use in a database query, preventing SQL injection attacks.
  */
 function db_escape_string($text) {
diff -urpN drupal-6.x-dev-200707182104/includes/database.mysql.inc drupal-6.x-dev-clob-0.7/includes/database.mysql.inc
--- drupal-6.x-dev-200707182104/includes/database.mysql.inc	2007-06-05 20:13:20.000000000 +0800
+++ drupal-6.x-dev-clob-0.7/includes/database.mysql.inc	2007-07-18 21:19:09.000000000 +0800
@@ -255,7 +255,7 @@ function db_affected_rows() {
  *   using printf() syntax. The query arguments can be enclosed in one
  *   array instead.
  *   Valid %-modifiers are: %s, %d, %f, %b (binary data, do not enclose
- *   in '') and %%.
+ *   in ''), %c (character large object, do not enclose in '') and %%.
  *
  *   NOTE: using this syntax will cast NULL and FALSE values to decimal 0,
  *   and TRUE values to decimal 1.
@@ -305,7 +305,7 @@ function db_query_range($query) {
  *   using printf() syntax. The query arguments can be enclosed in one
  *   array instead.
  *   Valid %-modifiers are: %s, %d, %f, %b (binary data, do not enclose
- *   in '') and %%.
+ *   in ''), %c (character large object, do not enclose in '') and %%.
  *
  *   NOTE: using this syntax will cast NULL and FALSE values to decimal 0,
  *   and TRUE values to decimal 1.
@@ -337,11 +337,11 @@ function db_query_temporary($query) {
  * @param $data
  *   Data to encode.
  * @return
- *  Encoded data.
+ *  Encoded data. Return a place holder when NULL input.
  */
 function db_encode_blob($data) {
   global $active_db;
-  return "'". mysql_real_escape_string($data, $active_db) ."'";
+  return !is_null($data) ? "'". mysql_real_escape_string($data, $active_db) ."'" : "''";
 }
 
 /**
@@ -357,6 +357,29 @@ function db_decode_blob($data) {
 }
 
 /**
+ * Returns a placeholder for Character Large OBject value.
+ *
+ * @return
+ *  Placeholder.
+ */
+function db_encode_clob($data) {
+  global $active_db;
+  return !is_null($data) ? "'". mysql_real_escape_string($data, $active_db) ."'" : "''";
+}
+
+/**
+ * Returns text from a Character Large Object value.
+ *
+ * @param $data
+ *   Data to decode.
+ * @return
+ *  Decoded data.
+ */
+function db_decode_clob($data) {
+  return $data;
+}
+
+/**
  * Prepare user input for use in a database query, preventing SQL injection attacks.
  */
 function db_escape_string($text) {
diff -urpN drupal-6.x-dev-200707182104/includes/database.pgsql.inc drupal-6.x-dev-clob-0.7/includes/database.pgsql.inc
--- drupal-6.x-dev-200707182104/includes/database.pgsql.inc	2007-07-05 16:48:57.000000000 +0800
+++ drupal-6.x-dev-clob-0.7/includes/database.pgsql.inc	2007-07-18 21:19:09.000000000 +0800
@@ -120,7 +120,7 @@ function db_connect($url) {
  *   you may also pass a single array containing the query arguments.
  *
  *   Valid %-modifiers are: %s, %d, %f, %b (binary data, do not enclose
- *   in '') and %%.
+ *   in ''), %c (character large object, do not enclose in '') and %%.
  *
  *   NOTE: using this syntax will cast NULL and FALSE values to decimal 0,
  *   and TRUE values to decimal 1.
@@ -287,7 +287,7 @@ function db_affected_rows() {
  *   using printf() syntax. Instead of a variable number of query arguments,
  *   you may also pass a single array containing the query arguments.
  *   Valid %-modifiers are: %s, %d, %f, %b (binary data, do not enclose
- *   in '') and %%.
+ *   in ''), %c (character large object, do not enclose in '') and %%.
  *
  *   NOTE: using this syntax will cast NULL and FALSE values to decimal 0,
  *   and TRUE values to decimal 1.
@@ -337,7 +337,7 @@ function db_query_range($query) {
  *   using printf() syntax. The query arguments can be enclosed in one
  *   array instead.
  *   Valid %-modifiers are: %s, %d, %f, %b (binary data, do not enclose
- *   in '') and %%.
+ *   in ''), %c (character large object, do not enclose in '') and %%.
  *
  *   NOTE: using this syntax will cast NULL and FALSE values to decimal 0,
  *   and TRUE values to decimal 1.
@@ -370,10 +370,10 @@ function db_query_temporary($query) {
  * @param $data
  *   Data to encode.
  * @return
- *  Encoded data.
+ *  Encoded data. Return a place holder when NULL input.
  */
 function db_encode_blob($data) {
-  return "'". pg_escape_bytea($data) ."'";
+  return !is_null($data) ? "'". pg_escape_bytea($data) ."'" : "''";
 }
 
 /**
@@ -390,6 +390,32 @@ function db_decode_blob($data) {
 }
 
 /**
+ * Returns a properly formatted Character Large OBject value.
+ *
+ * @param $data
+ *   Data to encode.
+ * @return
+ *  Encoded data. Return a place holder when NULL input.
+ */
+function db_encode_clob($data) {
+  return !is_null($data) ? "'". pg_escape_string($data) ."'" : "''";
+
+}
+
+/**
+ * Returns text from a Character Large OBject value.
+ * In case of PostgreSQL decodes data after select from bytea field.
+ *
+ * @param $data
+ *   Data to decode.
+ * @return
+ *  Decoded data.
+ */
+function db_decode_clob($data) {
+  return $data;
+}
+
+/**
  * Prepare user input for use in a database query, preventing SQL injection attacks.
  * Note: This function requires PostgreSQL 7.2 or later.
  */
@@ -398,6 +424,97 @@ function db_escape_string($text) {
 }
 
 /**
+ * Update Character Large Object value. Wrapper function for _db_update_lob()
+ *
+ * @param $table
+ *   Table to update.
+ * @param $values
+ *   Values to update, in array format. Columns and values pairs.
+ * @param $where
+ *   Update condition.
+ * @param ...
+ *   A variable number of arguments which are substituted into the query
+ *   WHERE condition, using printf() syntax. Instead of a variable number 
+ *   of query arguments, you may also pass a single array containing the 
+ *   query arguments.
+ *
+ *   Valid %-modifiers are: %s, %d, %f, %b (binary data, do not enclose
+ *   in ''), %c (character large object, do not enclose in '') and %%.
+ *
+ *   NOTE: using this syntax will cast NULL and FALSE values to decimal 0,
+ *   and TRUE values to decimal 1.
+ *
+ * @return
+ *   Returns TRUE on success or FALSE on failure.
+ */
+function db_update_blob($table, $values, $where) {
+  $args = func_get_args();
+  array_shift($args);
+  array_shift($args);
+  array_shift($args);
+  $args = is_array($args) ? $args : array($args);
+  if (isset($args[0]) and is_array($args[0])) { // 'All arguments in one array' syntax
+    $args = $args[0];
+  }
+  return _db_update_lob($table, $values, $where, $args, 'BLOB');
+}
+
+/**
+ * Update Binary Large Object value. Wrapper function for _db_update_lob()
+ *
+ * @param $table
+ *   Table to update.
+ * @param $values
+ *   Values to update, in array format. Columns and values pairs.
+ * @param $where
+ *   Update condition.
+ * @param ...
+ *   A variable number of arguments which are substituted into the query
+ *   WHERE condition, using printf() syntax. Instead of a variable number 
+ *   of query arguments, you may also pass a single array containing the 
+ *   query arguments.
+ *
+ *   Valid %-modifiers are: %s, %d, %f, %b (binary data, do not enclose
+ *   in ''), %c (character large object, do not enclose in '') and %%.
+ *
+ *   NOTE: using this syntax will cast NULL and FALSE values to decimal 0,
+ *   and TRUE values to decimal 1.
+ *
+ * @return
+ *   Returns TRUE on success or FALSE on failure.
+ */
+function db_update_clob($table, $values, $where) {
+  $args = func_get_args();
+  array_shift($args);
+  array_shift($args);
+  array_shift($args);
+  $args = is_array($args) ? $args : array($args);
+  if (isset($args[0]) and is_array($args[0])) { // 'All arguments in one array' syntax
+    $args = $args[0];
+  }
+  return _db_update_lob($table, $values, $where, $args, 'CLOB');
+}
+
+/**
+ * Helper function for update Large Object value.
+ */
+function _db_update_lob($table, $values, $where, $args, $lobtype = 'BLOB') {
+  _db_query_callback($args, TRUE);
+  $where = preg_replace_callback(DB_QUERY_REGEXP, '_db_query_callback', $where);
+
+  $arr = array();
+  foreach ($values as $key => $value) {
+    switch ($lobtype) {
+      case 'BLOB': $arr[] = $key . " = " . db_encode_blob($value); break;
+      case 'CLOB': $arr[] = $key . " = " . db_encode_clob($value); break;
+    }
+  }
+
+  $query = 'UPDATE ' . $table . ' SET ' . implode(', ', $arr) . ' WHERE ' . $where;
+  return _db_query($query);
+}
+
+/**
  * Lock a table.
  * This function automatically starts a transaction.
  */
@@ -501,6 +618,9 @@ function db_type_map() {
     'blob:big' => 'bytea',
     'blob:normal' => 'bytea',
 
+    'clob:big' => 'text',
+    'clob:normal' => 'text',
+
     'datetime:normal' => 'timestamp',
 
     'serial:tiny' => 'serial',
diff -urpN drupal-6.x-dev-200707182104/modules/aggregator/aggregator.module drupal-6.x-dev-clob-0.7/modules/aggregator/aggregator.module
--- drupal-6.x-dev-200707182104/modules/aggregator/aggregator.module	2007-07-16 20:43:04.000000000 +0800
+++ drupal-6.x-dev-clob-0.7/modules/aggregator/aggregator.module	2007-07-18 21:19:09.000000000 +0800
@@ -977,15 +977,17 @@ function aggregator_parse_feed(&$data, $
 
 function aggregator_save_item($edit) {
   if ($edit['iid'] && $edit['title']) {
-    db_query("UPDATE {aggregator_item} SET title = '%s', link = '%s', author = '%s', description = '%s', guid = '%s', timestamp = %d WHERE iid = %d", $edit['title'], $edit['link'], $edit['author'], $edit['description'], $edit['guid'], $edit['timestamp'], $edit['iid']);
+    db_query("UPDATE {aggregator_item} SET title = '%s', link = '%s', author = '%s', description = %c, guid = '%s', timestamp = %d WHERE iid = %d", $edit['title'], $edit['link'], $edit['author'], NULL, $edit['guid'], $edit['timestamp'], $edit['iid']);
+    db_update_clob(db_prefix_tables('{aggregator_item}'), array('description' => $edit['description']), 'iid = %d', $edit['iid']);
   }
   else if ($edit['iid']) {
     db_query('DELETE FROM {aggregator_item} WHERE iid = %d', $edit['iid']);
     db_query('DELETE FROM {aggregator_category_item} WHERE iid = %d', $edit['iid']);
   }
   else if ($edit['title'] && $edit['link']) {
-    db_query("INSERT INTO {aggregator_item} (fid, title, link, author, description, timestamp, guid) VALUES (%d, '%s', '%s', '%s', '%s', %d, '%s')", $edit['fid'], $edit['title'], $edit['link'], $edit['author'], $edit['description'], $edit['timestamp'], $edit['guid']);
+    db_query("INSERT INTO {aggregator_item} (fid, title, link, author, description, timestamp, guid) VALUES (%d, '%s', '%s', '%s', %c, %d, '%s')", $edit['fid'], $edit['title'], $edit['link'], $edit['author'], NULL, $edit['timestamp'], $edit['guid']);
     $edit['iid'] = db_last_insert_id('aggregator_item', 'iid');
+    db_update_clob(db_prefix_tables('{aggregator_item}'), array('description' => $edit['description']), 'iid = %d', $edit['iid']);
     // file the items in the categories indicated by the feed
     $categories = db_query('SELECT cid FROM {aggregator_category_feed} WHERE fid = %d', $edit['fid']);
     while ($category = db_fetch_object($categories)) {
@@ -1232,6 +1234,7 @@ function aggregator_page_rss() {
   }
 
   while ($item = db_fetch_object($result)) {
+    $item->description = db_decode_clob($item->description);
     switch (variable_get('feed_item_length', 'teaser')) {
       case 'teaser':
         $teaser = node_teaser($item->description);
@@ -1407,7 +1410,7 @@ function theme_aggregator_page_item($ite
   $output .= "<div class=\"feed-item-meta\">$source <span class=\"feed-item-date\">$source_date</span></div>\n";
 
   if ($item->description) {
-    $output .= '<div class="feed-item-body">'. aggregator_filter_xss($item->description) ."</div>\n";
+    $output .= '<div class="feed-item-body">'. aggregator_filter_xss(db_decode_clob($item->description)) ."</div>\n";
   }
 
   $result = db_query('SELECT c.title, c.cid FROM {aggregator_category_item} ci LEFT JOIN {aggregator_category} c ON ci.cid = c.cid WHERE ci.iid = %d ORDER BY c.title', $item->iid);
diff -urpN drupal-6.x-dev-200707182104/modules/aggregator/aggregator.schema drupal-6.x-dev-clob-0.7/modules/aggregator/aggregator.schema
--- drupal-6.x-dev-200707182104/modules/aggregator/aggregator.schema	2007-07-15 18:09:21.000000000 +0800
+++ drupal-6.x-dev-clob-0.7/modules/aggregator/aggregator.schema	2007-07-18 21:19:09.000000000 +0800
@@ -57,7 +57,7 @@ function aggregator_schema() {
       'title'       => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
       'link'        => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
       'author'      => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
-      'description' => array('type' => 'text', 'not null' => TRUE, 'size' => 'big'),
+      'description' => array('type' => 'clob', 'not null' => TRUE, 'size' => 'big'),
       'timestamp'   => array('type' => 'int', 'not null' => FALSE),
       'guid'        => array('type' => 'varchar', 'length' => 255, 'not null' => FALSE)
     ),
diff -urpN drupal-6.x-dev-200707182104/modules/block/block.admin.inc drupal-6.x-dev-clob-0.7/modules/block/block.admin.inc
--- drupal-6.x-dev-200707182104/modules/block/block.admin.inc	2007-07-16 14:40:25.000000000 +0800
+++ drupal-6.x-dev-clob-0.7/modules/block/block.admin.inc	2007-07-18 21:19:09.000000000 +0800
@@ -257,8 +257,9 @@ function block_add_block_form_validate($
  * Save the new custom block.
  */
 function block_add_block_form_submit($form, &$form_state) {
-  db_query("INSERT INTO {boxes} (body, info, format) VALUES  ('%s', '%s', %d)", $form_state['values']['body'], $form_state['values']['info'], $form_state['values']['format']);
+  db_query("INSERT INTO {boxes} (body, info, format) VALUES  (%c, '%s', %d)", NULL, $form_state['values']['info'], $form_state['values']['format']);
   $delta = db_last_insert_id('boxes', 'bid');
+  db_update_clob(db_prefix_tables('{boxes}'), array('body' => $form_state['values']['body']), 'bid = %d', $delta);
 
   foreach (list_themes() as $key => $theme) {
     if ($theme->status) {
diff -urpN drupal-6.x-dev-200707182104/modules/block/block.module drupal-6.x-dev-clob-0.7/modules/block/block.module
--- drupal-6.x-dev-200707182104/modules/block/block.module	2007-07-16 20:52:25.000000000 +0800
+++ drupal-6.x-dev-clob-0.7/modules/block/block.module	2007-07-18 21:19:09.000000000 +0800
@@ -146,7 +146,7 @@ function block_block($op = 'list', $delt
 
     case 'view':
       $block = db_fetch_object(db_query('SELECT body, format FROM {boxes} WHERE bid = %d', $delta));
-      $data['content'] = check_markup($block->body, $block->format, FALSE);
+      $data['content'] = check_markup(db_decode_clob($block->body), $block->format, FALSE);
       return $data;
   }
 }
@@ -331,7 +331,8 @@ function block_box_save($edit, $delta) {
     $edit['format'] = FILTER_FORMAT_DEFAULT;
   }
 
-  db_query("UPDATE {boxes} SET body = '%s', info = '%s', format = %d WHERE bid = %d", $edit['body'], $edit['info'], $edit['format'], $delta);
+  db_query("UPDATE {boxes} SET body = %c, info = '%s', format = %d WHERE bid = %d", NULL, $edit['info'], $edit['format'], $delta);
+  db_update_clob(db_prefix_tables('{boxes}'), array('body' => $edit['body']), 'bid = %d', $delta);
 
   return TRUE;
 }
diff -urpN drupal-6.x-dev-200707182104/modules/block/block.schema drupal-6.x-dev-clob-0.7/modules/block/block.schema
--- drupal-6.x-dev-200707182104/modules/block/block.schema	2007-05-25 20:46:43.000000000 +0800
+++ drupal-6.x-dev-clob-0.7/modules/block/block.schema	2007-07-18 21:19:09.000000000 +0800
@@ -36,7 +36,7 @@ function block_schema() {
   $schema['boxes'] = array(
     'fields' => array(
       'bid'    => array('type' => 'serial', 'not null' => TRUE),
-      'body'   => array('type' => 'text', 'not null' => FALSE, 'size' => 'big'),
+      'body'   => array('type' => 'clob', 'not null' => FALSE, 'size' => 'big'),
       'info'   => array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => ''),
       'format' => array('type' => 'int', 'size' => 'small', 'not null' => TRUE, 'default' => 0)
     ),
diff -urpN drupal-6.x-dev-200707182104/modules/comment/comment.module drupal-6.x-dev-clob-0.7/modules/comment/comment.module
--- drupal-6.x-dev-200707182104/modules/comment/comment.module	2007-07-15 18:05:18.000000000 +0800
+++ drupal-6.x-dev-clob-0.7/modules/comment/comment.module	2007-07-18 21:19:09.000000000 +0800
@@ -472,7 +472,7 @@ function comment_nodeapi(&$node, $op, $a
       $text = '';
       $comments = db_query('SELECT subject, comment, format FROM {comments} WHERE nid = %d AND status = %d', $node->nid, COMMENT_PUBLISHED);
       while ($comment = db_fetch_object($comments)) {
-        $text .= '<h2>'. check_plain($comment->subject) .'</h2>'. check_markup($comment->comment, $comment->format, FALSE);
+        $text .= '<h2>'. check_plain($comment->subject) .'</h2>'. check_markup(db_decode_clob($comment->comment), $comment->format, FALSE);
       }
       return $text;
 
@@ -729,7 +729,8 @@ function comment_save($edit) {
     if (!form_get_errors()) {
       if ($edit['cid']) {
         // Update the comment in the database.
-        db_query("UPDATE {comments} SET status = %d, timestamp = %d, subject = '%s', comment = '%s', format = %d, uid = %d, name = '%s', mail = '%s', homepage = '%s' WHERE cid = %d", $edit['status'], $edit['timestamp'], $edit['subject'], $edit['comment'], $edit['format'], $edit['uid'], $edit['name'], $edit['mail'], $edit['homepage'], $edit['cid']);
+        db_query("UPDATE {comments} SET status = %d, timestamp = %d, subject = '%s', comment = %c, format = %d, uid = %d, name = '%s', mail = '%s', homepage = '%s' WHERE cid = %d", $edit['status'], $edit['timestamp'], $edit['subject'], NULL, $edit['format'], $edit['uid'], $edit['name'], $edit['mail'], $edit['homepage'], $edit['cid']);
+        db_update_clob(db_prefix_tables('{comments}'), array('comment' => $edit['comment']), 'cid = %d', $edit['cid']);
 
         _comment_update_node_statistics($edit['nid']);
 
@@ -802,8 +803,9 @@ function comment_save($edit) {
         }
 
         $edit += array('mail' => '', 'homepage' => '');
-        db_query("INSERT INTO {comments} (nid, pid, uid, subject, comment, format, hostname, timestamp, status, score, users, thread, name, mail, homepage) VALUES (%d, %d, %d, '%s', '%s', %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s')", $edit['nid'], $edit['pid'], $edit['uid'], $edit['subject'], $edit['comment'], $edit['format'], ip_address(), $edit['timestamp'], $status, $score, $users, $thread, $edit['name'], $edit['mail'], $edit['homepage']);
+        db_query("INSERT INTO {comments} (nid, pid, uid, subject, comment, format, hostname, timestamp, status, score, users, thread, name, mail, homepage) VALUES (%d, %d, %d, '%s', %c, %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s')", $edit['nid'], $edit['pid'], $edit['uid'], $edit['subject'], NULL, $edit['format'], ip_address(), $edit['timestamp'], $status, $score, $users, $thread, $edit['name'], $edit['mail'], $edit['homepage']);
         $edit['cid'] = db_last_insert_id('comments', 'cid');
+        db_update_clob(db_prefix_tables('{comments}'), array('comment' => $edit['comment']), 'cid = %d', $edit['cid']);
 
         _comment_update_node_statistics($edit['nid']);
 
@@ -1202,7 +1204,7 @@ function comment_admin_overview($type = 
   while ($comment = db_fetch_object($result)) {
     $comments[$comment->cid] = '';
     $comment->name = $comment->uid ? $comment->registered_name : $comment->name;
-    $form['subject'][$comment->cid] = array('#value' => l($comment->subject, 'node/'. $comment->nid, array('title' => truncate_utf8($comment->comment, 128), 'fragment' => 'comment-'. $comment->cid)));
+    $form['subject'][$comment->cid] = array('#value' => l($comment->subject, 'node/'. $comment->nid, array('title' => truncate_utf8(db_decode_clob($comment->comment), 128), 'fragment' => 'comment-'. $comment->cid)));
     $form['username'][$comment->cid] = array('#value' => theme('username', $comment));
     $form['timestamp'][$comment->cid] = array('#value' => format_date($comment->timestamp, 'small'));
     $form['operations'][$comment->cid] = array('#value' => l(t('edit'), 'comment/edit/'. $comment->cid, array('query' => $destination)));
@@ -1732,7 +1734,7 @@ function theme_comment_view($comment, $n
 
   // Switch to folded/unfolded view of the comment
   if ($visible) {
-    $comment->comment = check_markup($comment->comment, $comment->format, FALSE);
+    $comment->comment = check_markup(db_decode_clob($comment->comment), $comment->format, FALSE);
 
     // Comment API hook
     comment_invoke_comment($comment, 'view');
@@ -2160,7 +2162,7 @@ function comment_unpublish_by_keyword_ac
  */
 function comment_unpublish_by_keyword_action($comment, $context) {
   foreach ($context['keywords'] as $keyword) {
-    if (strstr($comment->comment, $keyword) || strstr($comment->subject, $keyword)) {
+    if (strstr(db_decode_clob($comment->comment), $keyword) || strstr($comment->subject, $keyword)) {
       db_query('UPDATE {comments} SET status = %d WHERE cid = %d', COMMENT_NOT_PUBLISHED, $comment->cid);
       watchdog('action', 'Unpublished comment %subject.', array('%subject' => $comment->subject));
       break;
diff -urpN drupal-6.x-dev-200707182104/modules/comment/comment.schema drupal-6.x-dev-clob-0.7/modules/comment/comment.schema
--- drupal-6.x-dev-200707182104/modules/comment/comment.schema	2007-07-15 18:09:21.000000000 +0800
+++ drupal-6.x-dev-clob-0.7/modules/comment/comment.schema	2007-07-18 21:19:09.000000000 +0800
@@ -9,7 +9,7 @@ function comment_schema() {
       'nid'       => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
       'uid'       => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
       'subject'   => array('type' => 'varchar', 'length' => 64, 'not null' => TRUE, 'default' => ''),
-      'comment'   => array('type' => 'text', 'not null' => TRUE, 'size' => 'big'),
+      'comment'   => array('type' => 'clob', 'not null' => TRUE, 'size' => 'big'),
       'hostname'  => array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => ''),
       'timestamp' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
       'score'     => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'medium'),
diff -urpN drupal-6.x-dev-200707182104/modules/contact/contact.module drupal-6.x-dev-clob-0.7/modules/contact/contact.module
--- drupal-6.x-dev-200707182104/modules/contact/contact.module	2007-07-16 14:37:49.000000000 +0800
+++ drupal-6.x-dev-clob-0.7/modules/contact/contact.module	2007-07-18 21:19:09.000000000 +0800
@@ -171,7 +171,7 @@ function contact_mail($key, &$message, $
     case 'page_autoreply':
       $contact = $params['contact'];
       $message['subject'] .= t('[!category] !subject', array('!category' => $contact['category'], '!subject' => $params['subject']), $language->language);
-      $message['body'][] = $contact['reply'];
+      $message['body'][] = db_decode_clob($contact['reply']);
       break;
     case 'user_mail':
     case 'user_copy':
diff -urpN drupal-6.x-dev-200707182104/modules/contact/contact.pages.inc drupal-6.x-dev-clob-0.7/modules/contact/contact.pages.inc
--- drupal-6.x-dev-200707182104/modules/contact/contact.pages.inc	2007-07-16 14:37:49.000000000 +0800
+++ drupal-6.x-dev-clob-0.7/modules/contact/contact.pages.inc	2007-07-18 21:19:09.000000000 +0800
@@ -132,7 +132,7 @@ function contact_mail_page_submit($form,
   }
 
   // Send an auto-reply if necessary using the current language.
-  if ($contact['reply']) {
+  if (db_decode_clob($contact['reply'])) {
     drupal_mail('contact', 'page_autoreply', $from, $language, $values, $contact['recipients']);
   }
 
diff -urpN drupal-6.x-dev-200707182104/modules/contact/contact.schema drupal-6.x-dev-clob-0.7/modules/contact/contact.schema
--- drupal-6.x-dev-200707182104/modules/contact/contact.schema	2007-07-15 18:09:21.000000000 +0800
+++ drupal-6.x-dev-clob-0.7/modules/contact/contact.schema	2007-07-18 21:19:09.000000000 +0800
@@ -7,7 +7,7 @@ function contact_schema() {
       'cid'        => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE),
       'category'   => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
       'recipients' => array('type' => 'text', 'not null' => TRUE, 'size' => 'big'),
-      'reply'      => array('type' => 'text', 'not null' => TRUE, 'size' => 'big'),
+      'reply'      => array('type' => 'clob', 'not null' => TRUE, 'size' => 'big'),
       'weight'     => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'tiny'),
       'selected'   => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'tiny')
     ),
diff -urpN drupal-6.x-dev-200707182104/modules/node/node.module drupal-6.x-dev-clob-0.7/modules/node/node.module
--- drupal-6.x-dev-200707182104/modules/node/node.module	2007-07-16 20:43:05.000000000 +0800
+++ drupal-6.x-dev-clob-0.7/modules/node/node.module	2007-07-18 21:19:09.000000000 +0800
@@ -619,6 +619,8 @@ function node_load($param = array(), $re
   else {
     $node = db_fetch_object(db_query('SELECT n.nid, n.vid, n.type, n.status, n.language, n.created, n.changed, n.comment, n.promote, n.sticky, n.tnid, n.translate, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.vid = n.vid WHERE '. $cond, $arguments));
   }
+  $node->body = db_decode_clob($node->body);
+  $node->teaser = db_decode_clob($node->teaser);
 
   if ($node && $node->nid) {
     // Call the node specific callback (if any) and piggy-back the
@@ -679,13 +681,14 @@ function node_save(&$node) {
 
   // Split off revisions data to another structure
   $revisions_table_values = array('nid' => &$node->nid,
-                     'title' => $node->title, 'body' => $node->body,
-                     'teaser' => $node->teaser, 'timestamp' => $node->changed,
+                     'title' => $node->title, 'body' => NULL,
+                     'teaser' => NULL, 'timestamp' => $node->changed,
                      'uid' => $user->uid, 'format' => $node->format);
   $revisions_table_types = array('nid' => '%d',
-                     'title' => "'%s'", 'body' => "'%s'",
-                     'teaser' => "'%s'", 'timestamp' => '%d',
+                     'title' => "'%s'", 'body' => "%c",
+                     'teaser' => "%c", 'timestamp' => '%d',
                      'uid' => '%d', 'format' => '%d');
+  $revisions_table_clobs = array('body' => $node->body, 'teaser' => $node->teaser);
   if (!empty($node->log) || $node->is_new || (isset($node->revision) && $node->revision)) {
     // Only store the log message if there's something to store; this prevents
     // existing log messages from being unintentionally overwritten by a blank
@@ -713,6 +716,7 @@ function node_save(&$node) {
     $revisions_query = 'INSERT INTO {node_revisions} ('. implode(', ', array_keys($revisions_table_types)) .') VALUES ('. implode(', ', $revisions_table_types) .')';
     db_query($revisions_query, $revisions_table_values);
     $node->vid = db_last_insert_id('node_revisions', 'vid');
+    db_update_clob(db_prefix_tables('{node_revisions}'), $revisions_table_clobs, 'vid = %d', $node->vid);
     $op = 'insert';
   }
   else {
@@ -727,6 +731,7 @@ function node_save(&$node) {
       $revisions_query = 'INSERT INTO {node_revisions} ('. implode(', ', array_keys($revisions_table_types)) .') VALUES ('. implode(', ', $revisions_table_types) .')';
       db_query($revisions_query, $revisions_table_values);
       $node->vid = db_last_insert_id('node_revisions', 'vid');
+      db_update_clob(db_prefix_tables('{node_revisions}'), $revisions_table_clobs, 'vid = %d', $node->vid);
     }
     else {
       $arr = array();
@@ -736,6 +741,7 @@ function node_save(&$node) {
       $revisions_table_values[] = $node->vid;
       $revisions_query = 'UPDATE {node_revisions} SET '. implode(', ', $arr) .' WHERE vid = %d';
       db_query($revisions_query, $revisions_table_values);
+      db_update_clob(db_prefix_tables('{node_revisions}'), $revisions_table_clobs, 'vid = %d', $node->vid);
       $update_node = FALSE;
     }
     $op = 'update';
diff -urpN drupal-6.x-dev-200707182104/modules/node/node.schema drupal-6.x-dev-clob-0.7/modules/node/node.schema
--- drupal-6.x-dev-200707182104/modules/node/node.schema	2007-07-04 03:42:14.000000000 +0800
+++ drupal-6.x-dev-clob-0.7/modules/node/node.schema	2007-07-18 21:19:09.000000000 +0800
@@ -73,8 +73,8 @@ function node_schema() {
       'vid'       => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE),
       'uid'       => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
       'title'     => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
-      'body'      => array('type' => 'text', 'not null' => TRUE, 'size' => 'big'),
-      'teaser'    => array('type' => 'text', 'not null' => TRUE, 'size' => 'big'),
+      'body'      => array('type' => 'clob', 'not null' => TRUE, 'size' => 'big'),
+      'teaser'    => array('type' => 'clob', 'not null' => TRUE, 'size' => 'big'),
       'log'       => array('type' => 'text', 'not null' => TRUE, 'size' => 'big'),
       'timestamp' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
       'format'    => array('type' => 'int', 'not null' => TRUE, 'default' => 0)
