I noticed that nodequeue_schema() is missing a value for nodequeue_queue.reverse:
'reverse' => array(
'description' => '',
'type' => 'int',
'size' => 'tiny',
),
All of the other values have defaults except for this one.
As a test, execute this code with today's code from master with #817558: Machine names applied (patch 98):
$nq = new nodequeue_queue('nodequeue');
$nq->name = 'my_carousel';
$nq->title = 'My Carousel';
$nq->roles = array(2);
$nq->types = array('carousel');
$nq->add_subqueue = array($nq->title);
nodequeue_save($nq);
This results in the following error:
PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'reverse' at row 1: INSERT INTO {nodequeue_queue} (name, title, subqueue_title, size, link, link_remove, owner, show_in_links, show_in_tab, show_in_ui, i18n, reverse, reference) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12); Array ( [:db_insert_placeholder_0] => my_carousel [:db_insert_placeholder_1] => My Carousel [:db_insert_placeholder_2] => [:db_insert_placeholder_3] => 0 [:db_insert_placeholder_4] => [:db_insert_placeholder_5] => [:db_insert_placeholder_6] => nodequeue [:db_insert_placeholder_7] => 1 [:db_insert_placeholder_8] => 1 [:db_insert_placeholder_9] => 1 [:db_insert_placeholder_10] => 0 [:db_insert_placeholder_11] => [:db_insert_placeholder_12] => 0 ) in nodequeue_save() (line 2055 of nodequeue/nodequeue.module).
One odd thing is that the nodequeue_queue class defines the $reverse variable with a value of FALSE, but that isn't being saved - is there a subtle dbtng bug playing a part in this?
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | nodequeue-n1151446-d6.patch | 660 bytes | damienmckenna |
| #2 | nodequeue-n1151446-2.patch | 660 bytes | damienmckenna |
| #1 | nodequeue-n1151446.patch | 349 bytes | damienmckenna |
Comments
Comment #1
damienmckennaA quick patch to assign a default of 0.
Comment #2
damienmckennaSeems the core problem came from the nodequeue_queue class itself, the $reverse attribute shouldn't be set with a default value of FALSE (or TRUE, for that matter) when the table field is defined as an integer. A quick change to make it 0 fixed the error I saw above.
Comment #3
damienmckennaHere's a patch for the D6 branch for the same two changes, for consistency.
Comment #4
amateescu commentedGreat catch :) Commited to 6.x and 7.x.
http://drupalcode.org/project/nodequeue.git/commit/061d478
http://drupalcode.org/project/nodequeue.git/commit/674a6a5