? sites/default/files
? sites/default/modules
? sites/default/settings.php
Index: includes/database/mysql/schema.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/database/mysql/schema.inc,v
retrieving revision 1.3
diff -u -p -r1.3 schema.inc
--- includes/database/mysql/schema.inc	19 Sep 2008 20:30:32 -0000	1.3
+++ includes/database/mysql/schema.inc	24 Sep 2008 18:00:14 -0000
@@ -73,6 +73,12 @@ class DatabaseSchema_mysql extends Datab
   protected function createFieldSql($name, $spec) {
     $sql = "`" . $name . "` " . $spec['mysql_type'];
 
+    // BLOB and TEXT columns cannot have DEFAULT values.
+    // Refer to http://dev.mysql.com/doc/refman/5.1/en/blob.html
+    if (($spec['type'] == 'text') || ($spec['type'] == 'blob')) {
+      unset($spec['default']);
+    }
+
     if (isset($spec['length'])) {
       $sql .= '(' . $spec['length'] . ')';
     }
Index: modules/block/block.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/block/block.admin.inc,v
retrieving revision 1.19
diff -u -p -r1.19 block.admin.inc
--- modules/block/block.admin.inc	16 Jul 2008 21:59:25 -0000	1.19
+++ modules/block/block.admin.inc	24 Sep 2008 18:00:14 -0000
@@ -301,17 +301,16 @@ 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']);
-  $delta = db_last_insert_id('boxes', 'bid');
+  drupal_write_record('boxes', $form_state['values']);
 
   foreach (list_themes() as $key => $theme) {
     if ($theme->status) {
-      db_query("INSERT INTO {blocks} (visibility, pages, custom, title, module, theme, status, weight, delta, cache) VALUES(%d, '%s', %d, '%s', '%s', '%s', %d, %d, %d, %d)", $form_state['values']['visibility'], trim($form_state['values']['pages']), $form_state['values']['custom'], $form_state['values']['title'], $form_state['values']['module'], $theme->name, 0, 0, $delta, BLOCK_NO_CACHE);
+      db_query("INSERT INTO {blocks} (visibility, pages, custom, title, module, theme, status, weight, delta, cache) VALUES(%d, '%s', %d, '%s', '%s', '%s', %d, %d, %d, %d)", $form_state['values']['visibility'], trim($form_state['values']['pages']), $form_state['values']['custom'], $form_state['values']['title'], $form_state['values']['module'], $theme->name, 0, 0, $form_state['values']['bid'], BLOCK_NO_CACHE);
     }
   }
 
   foreach (array_filter($form_state['values']['roles']) as $rid) {
-    db_query("INSERT INTO {blocks_roles} (rid, module, delta) VALUES (%d, '%s', '%s')", $rid, $form_state['values']['module'], $delta);
+    db_query("INSERT INTO {blocks_roles} (rid, module, delta) VALUES (%d, '%s', '%s')", $rid, $form_state['values']['module'], $form_state['values']['bid']);
   }
 
   drupal_set_message(t('The block has been created.'));
Index: modules/block/block.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/block/block.install,v
retrieving revision 1.11
diff -u -p -r1.11 block.install
--- modules/block/block.install	15 May 2008 21:30:02 -0000	1.11
+++ modules/block/block.install	24 Sep 2008 18:00:14 -0000
@@ -136,8 +136,9 @@ function block_schema() {
         'description' => t("The block's {blocks}.bid."),
       ),
       'body' => array(
-        'type' => 'text',
-        'not null' => FALSE,
+        'type' => 'blob',
+        'not null' => TRUE,
+        'default' => '',
         'size' => 'big',
         'description' => t('Block contents.'),
       ),
Index: modules/block/block.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/block/block.module,v
retrieving revision 1.309
diff -u -p -r1.309 block.module
--- modules/block/block.module	21 Aug 2008 19:36:36 -0000	1.309
+++ modules/block/block.module	24 Sep 2008 18:00:14 -0000
@@ -332,7 +332,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);
+  $edit['bid'] = $delta;
+  drupal_write_record('boxes', $edit, 'bid');
 
   return TRUE;
 }
Index: modules/system/system.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.install,v
retrieving revision 1.268
diff -u -p -r1.268 system.install
--- modules/system/system.install	20 Sep 2008 20:22:24 -0000	1.268
+++ modules/system/system.install	24 Sep 2008 18:00:15 -0000
@@ -3048,6 +3048,16 @@ function system_update_7010() {
 }
 
 /**
+ * Remap {boxes}.body as BLOB type.
+ */
+function system_update_7011() {
+  $ret = array();
+  db_change_field($ret, 'boxes', 'body', 'body', array('type' => 'blob', 'not null' => TRUE, 'default' => '', 'size' => 'big'));
+
+  return $ret;
+}
+
+/**
  * @} End of "defgroup updates-6.x-to-7.x"
  * The next series of updates should start at 8000.
  */
