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?

Comments

damienmckenna’s picture

Status: Active » Needs review
StatusFileSize
new349 bytes

A quick patch to assign a default of 0.

damienmckenna’s picture

Title: nodequeue_schema() missing default value for nodequeue_queue.reverse » Default value for nodequeue_queue->reverse is incorrect
StatusFileSize
new660 bytes

Seems 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.

damienmckenna’s picture

StatusFileSize
new660 bytes

Here's a patch for the D6 branch for the same two changes, for consistency.

amateescu’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.