dbtng

Multi-table update in D6 to DBTNG

  1. UPDATE {node} n
  2.   INNER JOIN {classified_node} cn ON n.nid = cn.nid
  3.   SET n.STATUS = 0, cn.notify = 0
  4. WHERE
  5.   n.type = 'classified' AND n.STATUS = 1
  6.   AND cn.expires < %s

KISS, chx, KISS!

  1. Index: includes/database/mysql/schema.inc
  2. ===================================================================
  3. RCS file: /cvs/drupal/drupal/includes/database/mysql/schema.inc,v
  4. retrieving revision 1

Fix for Fix for DBTNG extenders

  1. // THIS DOESN'T WORK
  2.  
  3. $query = db_select('system', 's');
  4.  
  5. $query->fields('s', array('name', 'type');
  6. $query->condition('status', '1');
  7. $query->extend('PagerDefault');
  8. $query->limit('10');  // <

Fix for DBTNG extenders

  1. // THIS DOESN'T WORK
  2.  
  3. $query = db_select('system', 's');
  4.  
  5. $query->fields('s', array('name', 'type');
  6. $query->condition('status', '1');
  7. $query->extend('PagerDefault');
  8. $query->limit('10');  // <

DBTNG extenders

  1. // THIS DOESN'T WORK
  2.  
  3. $query = db_select('system', 's');
  4.  
  5. $query->fields('s', array('name', 'type');
  6. $query->condition('status', '1');
  7. $query->extend('PagerDefault);
  8. $query->limit('10');  // <-

Can't figure out what the problem is with this database call?

  1.   return db_select('taxonomy_term_data', 't')
  2.     ->addField('t', 'tid')
  3.     ->addField('t', 'vid')
  4.     ->addField('t', 'name')
  5.     ->addField('t', 'description')
  6.     ->addField('t', 'weight')

tablesort sql test

  1.   function testTableSortQuery() {
  2.     // To keep the test from being too brittle, we determine up front
  3.     // what the page count should be dynamically, and pass the control
Syndicate content