Index: C:/Applications/ltvdrupal/branches/stage-d6/sites/all/modules/contrib/views/plugins/views_plugin_display.inc
===================================================================
--- C:/Applications/ltvdrupal/branches/stage-d6/sites/all/modules/contrib/views/plugins/views_plugin_display.inc	(revision 70799)
+++ C:/Applications/ltvdrupal/branches/stage-d6/sites/all/modules/contrib/views/plugins/views_plugin_display.inc	(revision 87939)
@@ -110,6 +110,17 @@
   }
 
   /**
+   * Does the display use slave_db?
+   */
+  function slave_db() {
+    if (!empty($this->definition['slave db'])) {
+      return $this->get_option('slave_db');
+    }
+    return FALSE;
+  }
+  
+  
+  /**
    * Does the display have a pager enabled?
    */
   function use_pager() {
@@ -181,6 +192,7 @@
       'footer' => array('footer', 'footer_format', 'footer_empty'),
       'empty' => array('empty', 'empty_format'),
       'use_ajax' => array('use_ajax'),
+      'slave_db' => array('slave_db'),
       'items_per_page' => array('items_per_page', 'offset', 'use_pager', 'pager_element'),
       'use_pager' => array('items_per_page', 'offset', 'use_pager', 'pager_element'),
       'use_more' => array('use_more', 'use_more_always', 'use_more_text'),
@@ -252,6 +264,7 @@
           'empty_format' => TRUE,
 
           'use_ajax' => TRUE,
+          'slave_db' => TRUE,
           'items_per_page' => TRUE,
           'offset' => TRUE,
           'use_pager' => TRUE,
@@ -340,6 +353,9 @@
       'use_ajax' => array(
         'default' => FALSE,
       ),
+      'slave_db' => array(
+        'default' => FALSE,
+      ),
       'items_per_page' => array(
         'default' => 10,
       ),
@@ -694,6 +710,14 @@
       );
     }
 
+    if (!empty($this->definition['slave db'])) {
+      $options['slave_db'] = array(
+        'category' => 'basic',
+        'title' => t('Slave DB'),
+        'value' => $this->get_option('slave_db') ? t('Yes') : t('No'),
+        'desc' => t('Change whether or not this view will run from the slave DB.'),
+      );
+    }
     if (!empty($this->definition['use pager'])) {
       $options['use_pager'] = array(
         'category' => 'basic',
@@ -882,6 +906,19 @@
           '#default_value' => $this->get_option('use_ajax') ? 1 : 0,
         );
         break;
+      case 'slave_db':
+        $form['#title'] .= t('Use the slave DB to make the DB query');
+        $form['description'] = array(
+          '#prefix' => '<div class="description form-item">',
+          '#suffix' => '</div>',
+          '#value' => t('If set, this view the query will be forwarded to the slave DB.'),
+        );
+        $form['slave_db'] = array(
+          '#type' => 'radios',
+          '#options' => array(1 => t('Yes'), 0 => t('No')),
+          '#default_value' => $this->get_option('slave_db') ? 1 : 0,
+        );
+        break;
       case 'use_pager':
         $form['#title'] .= t('Use a pager for this view');
         $form['use_pager'] = array(
@@ -1510,6 +1547,9 @@
       case 'use_ajax':
         $this->set_option($section, (bool)$form_state['values'][$section]);
         break;
+      case 'slave_db':
+        $this->set_option($section, (bool)$form_state['values'][$section]);
+        break;
       case 'use_pager':
         $this->set_option($section, $form_state['values'][$section]);
         $this->set_option('pager_element', intval($form_state['values']['pager_element']));
@@ -1789,6 +1829,7 @@
    */
   function pre_execute() {
     $this->view->set_use_ajax($this->use_ajax());
+    $this->view->set_slave_db($this->slave_db());
     // Copy pager information from the display.
     $this->view->set_use_pager($this->use_pager());
     $this->view->set_pager_element($this->get_option('pager_element'));
@@ -1922,4 +1963,4 @@
 /**
  * @}
  */
-
+ 
\ No newline at end of file
Index: C:/Applications/ltvdrupal/branches/stage-d6/sites/all/modules/contrib/views/includes/admin.inc
===================================================================
--- C:/Applications/ltvdrupal/branches/stage-d6/sites/all/modules/contrib/views/includes/admin.inc	(revision 70799)
+++ C:/Applications/ltvdrupal/branches/stage-d6/sites/all/modules/contrib/views/includes/admin.inc	(revision 87939)
@@ -391,7 +391,13 @@
         _db_query_callback($view->build_info['query_args'], TRUE);
         $query = preg_replace_callback(DB_QUERY_REGEXP, '_db_query_callback', $query);
       }
-      $rows[] = array('<strong>' . t('Query') . '</strong>', '<pre>' . check_plain($query) . '</pre>');
+ 
+      if ($view->slave_db) {
+        $rows[] = array('<strong>' . t('Query on Slave DB') . '</strong>', '<pre>' . check_plain($query) . '</pre>');
+      } else {
+        $rows[] = array('<strong>' . t('Query on Master DB') . '</strong>', '<pre>' . check_plain($query) . '</pre>');
+      }
+
       if (!empty($view->additional_queries)) {
         $queries = '<strong>' . t('These queries were run during view rendering:') . '</strong>';
         foreach ($view->additional_queries as $query) {
Index: C:/Applications/ltvdrupal/branches/stage-d6/sites/all/modules/contrib/views/includes/view.inc
===================================================================
--- C:/Applications/ltvdrupal/branches/stage-d6/sites/all/modules/contrib/views/includes/view.inc	(revision 70799)
+++ C:/Applications/ltvdrupal/branches/stage-d6/sites/all/modules/contrib/views/includes/view.inc	(revision 87939)
@@ -28,6 +28,7 @@
   var $build_info = array();
 
   var $use_ajax = FALSE;
+  var $slave_db = FALSE;
 
   // Where the results of a query will go.
   var $result = array();
@@ -138,6 +139,14 @@
   function set_use_ajax($use_ajax) {
     $this->use_ajax = $use_ajax;
   }
+  
+  /**
+   * Whether or not the view query should be executed  on the slave Database.
+   */
+  function set_slave_db($slave_db) {
+    $this->slave_db = $slave_db;
+  }
+  
 
   /**
    * Set the exposed filters input to an array. If unset they will be taken
@@ -735,8 +744,13 @@
           // support an offset. This is fine as we don't actually need pager
           // query; we've already been doing most of what it does, and we
           // just need to do a little more playing with globals.
+          //  MB modified db_query() to db_query_slave()
           if (!empty($this->pager['use_pager']) || !empty($this->get_total_rows)) {
-            $this->total_rows = db_result(db_query($count_query, $args)) - $this->pager['offset'];
+            if (!empty($this->slave_db)) {
+              $this->total_rows = db_result(db_query_slave($count_query, $args)) - $this->pager['offset'];
+            } else {
+              $this->total_rows = db_result(db_query($count_query, $args)) - $this->pager['offset'];
+            }
           }
 
           if (!empty($this->pager['use_pager'])) {
@@ -762,11 +776,21 @@
           }
 
           $offset = $this->pager['current_page'] * $this->pager['items_per_page'] + $this->pager['offset'];
-          $result = db_query_range($query, $args, $offset, $this->pager['items_per_page']);
+          //  MB modified db_query_range() to db_query_range_slave() -- Requires modif. in database.mysql.inc
+          if ($this->slave_db) {
+            $result = db_query_range_slave($query, $args, $offset, $this->pager['items_per_page']);
+          } else {
+            $result = db_query_range($query, $args, $offset, $this->pager['items_per_page']);
+          }
 
         }
         else {
-          $result = db_query($query, $args);
+          //  MB modified db_query() to db_query_slave()
+          if ($this->slave_db) {
+            $result = db_query_slave($query, $args);
+          } else {
+            $result = db_query($query, $args);
+          }
         }
 
         $this->result = array();
Index: C:/Applications/ltvdrupal/branches/stage-d6/sites/all/modules/contrib/views/includes/plugins.inc
===================================================================
--- C:/Applications/ltvdrupal/branches/stage-d6/sites/all/modules/contrib/views/includes/plugins.inc	(revision 70799)
+++ C:/Applications/ltvdrupal/branches/stage-d6/sites/all/modules/contrib/views/includes/plugins.inc	(revision 87939)
@@ -31,6 +31,7 @@
         'no remove' => TRUE,
         'js' => array('misc/collapse.js', 'misc/textarea.js', 'misc/tabledrag.js', 'misc/autocomplete.js', "$path/dependent.js"),
         'use ajax' => TRUE,
+        'slave db' => TRUE,
         'use pager' => TRUE,
         'use more' => TRUE,
         'accept attachments' => TRUE,
@@ -43,6 +44,7 @@
         'theme' => 'views_view',
         'uses hook menu' => TRUE,
         'use ajax' => TRUE,
+        'slave db' => TRUE,
         'use pager' => TRUE,
         'accept attachments' => TRUE,
         'admin' => t('Page'),
@@ -55,6 +57,7 @@
         'theme' => 'views_view',
         'uses hook block' => TRUE,
         'use ajax' => TRUE,
+        'slave db' => TRUE,
         'use pager' => TRUE,
         'use more' => TRUE,
         'accept attachments' => TRUE,
@@ -67,6 +70,7 @@
         'handler' => 'views_plugin_display_attachment',
         'theme' => 'views_view',
         'use ajax' => TRUE,
+        'slave db' => TRUE,        
         'help topic' => 'display-attachment',
       ),
       'feed' => array(
@@ -76,6 +80,7 @@
         'parent' => 'page', // so it knows to load the page plugin .inc file
         'uses hook menu' => TRUE,
         'use ajax' => FALSE,
+        'slave db' => FALSE,
         'use pager' => FALSE,
         'accept attachments' => FALSE,
         'admin' => t('Feed'),
@@ -405,4 +410,3 @@
    */
   function validate() { return array(); }
 }
-
Index: C:/Applications/ltvdrupal/branches/stage-d6/sites/all/modules/contrib/views/modules/node.views_default.inc
===================================================================
--- C:/Applications/ltvdrupal/branches/stage-d6/sites/all/modules/contrib/views/modules/node.views_default.inc	(revision 70799)
+++ C:/Applications/ltvdrupal/branches/stage-d6/sites/all/modules/contrib/views/modules/node.views_default.inc	(revision 87939)
@@ -192,6 +192,7 @@
     'perm' => '',
   ));
   $handler->override_option('use_ajax', '1');
+  $handler->override_option('slave_db', '1');
   $handler->override_option('items_per_page', 36);
   $handler->override_option('use_pager', '1');
   $handler->override_option('style_plugin', 'table');
