As case mentioned in #147947, here is a split patch for remap {aggregator_item}.description as BLOB type. Also update some missing default '' value for text fields. Using drupal_write_record() since implementation can be more simple then using db_insert() or db_update().
Patch via CVS HEAD, tested with MySQL (successful), PostgreSQL (fail after update, as like as case of CVS HEAD) and Oracle (successful with same programming logic via my research project). Update script also function with MySQL.
Comments
Comment #1
hswong3i commentedFix missing default value update script.
Comment #2
hswong3i commentedAlso replace all nearby queries as new standard. Tested with MySQL.
Comment #3
hswong3i commentedSorry, just back to the main focus and patch for BLOB related only.
BTW, it is know as buggy for MySQL when db_insert() + BLOB + db_last_insert_id() (just after insert). It is because MySQL's db_insert() now handling with
DELAYEDdefault on (http://dev.mysql.com/doc/refman/5.0/en/insert-delayed.html):The call of db_insert() and db_update() is successful when working with original schema (text). On the other hand, when handling with drupal_write_record(), the raw query builder without
DELAYEDon, both insert and update will also successful. The programming logic itself is functional, it should be the bug of our new DB abstraction layer. I will report this bug in other issue.P.S. one more bug... I guess by definition, field with
'not null' => TRUEshould come with default value; BTW, in case of MySQL + TEXT/BLOB, default value is not allowed (http://dev.mysql.com/doc/refman/5.0/en/blob.html, http://bugs.mysql.com/bug.php?id=19498). This may also need to handle within another issue, too :SComment #4
hswong3i commentedReroll patch without db_last_insert_id(), and also merge with http://drupal.org/node/300219 for correct schema definition.
MySQL:
PostgreSQL:
Comment #5
hswong3i commentedRevamp with drupal_write_record() for simpler handling.
When combine with simplify drupal_write_record() with db_insert() and db_update(), it can prevent the incorrect input type for
pidanduidwhen compare with using db_insert() directly.Tested with MySQL and PostgreSQL. Stand alone simpletetest, pass; simpletest when combine with http://drupal.org/node/299088, also pass.
Comment #6
hswong3i commentedUpdate based on http://drupal.org/node/316095 founding. Revamp BLOB field with nullable.
Tested with MySQL and PostgreSQL. Stand alone simpletest, pass; simpletest when combine with http://drupal.org/node/299088, also pass.
Comment #7
hswong3i commentedFix incorrect upgrade path.
In case of PostgreSQL, we need to combine with http://drupal.org/node/299088 in order to get db_insert/db_update for BLOB correctly within drupal_write_record.
Comment #8
hswong3i commentedSince #316095: Raise PHP requirement to 5.2.12 for PostgreSQL only already figure out the solution for PostgreSQL + BLOB + NULL + INSERT/UPDATE bug, this patch is now safe for using both null or nullable BLOB field.
Patch reroll via CVS HEAD. Only change field type from TEXT to BLOB.
P.S. Actually, I would like to add default value for "variables" as it is
'not null' => TRUEby default. But since MySQL will buggy with #300219: [DBTNG]: MySQL should remove TEXT/BLOB default value so I would like to wait and handle this with another issue.Comment #9
hswong3i commentedPatch update via CVS HEAD, running simpletest with MySQL correctly.
Comment #11
lilou commentedSee: #335122: Test clean HEAD after every commit and http://pastebin.ca/1258476
Comment #12
hswong3i commentedduplicate with #147947: [DBTNG + XDB] Replace some TEXT:BIG with BLOB