? .svn
? views3_handle_external_tables.patch
? views3_handle_external_tables.patch.tmp
? views3_handle_external_tables_1.patch
? views_handle_external_table_aliases_w_str_replace_2.patch
? css/.svn
? docs/.svn
? handlers/.svn
? help/.svn
? help/images/.svn
? images/.svn
? includes/.svn
? js/.svn
? modules/.svn
? modules/aggregator/.svn
? modules/comment/.svn
? modules/contact/.svn
? modules/filter/.svn
? modules/locale/.svn
? modules/node/.svn
? modules/profile/.svn
? modules/search/.svn
? modules/statistics/.svn
? modules/system/.svn
? modules/taxonomy/.svn
? modules/translation/.svn
? modules/upload/.svn
? modules/user/.svn
? plugins/.svn
? tests/.svn
? theme/.svn
? translations/.svn
? views_export/.svn
Index: handlers/views_handler_relationship.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views/handlers/views_handler_relationship.inc,v
retrieving revision 1.1.2.2
diff -u -p -r1.1.2.2 views_handler_relationship.inc
--- handlers/views_handler_relationship.inc	2 Nov 2009 23:25:10 -0000	1.1.2.2
+++ handlers/views_handler_relationship.inc	27 Jan 2010 00:31:02 -0000
@@ -101,7 +101,7 @@ class views_handler_relationship extends
     $def = $this->definition;
     $def['table'] = $this->definition['base'];
     $def['field'] = $base_field;
-    $def['left_table'] = $this->table_alias;
+    $def['left_table'] = $this->table;
     $def['left_field'] = $this->field;
     if (!empty($this->options['required'])) {
       $def['type'] = 'INNER';
@@ -119,7 +119,7 @@ class views_handler_relationship extends
     $join->adjusted = TRUE;
 
     // use a short alias for this:
-    $alias = $def['table'] . '_' . $this->table;
+    $alias = views_clean_alias($def['table'] . '_' . $this->table);
 
     $this->alias = $this->query->add_relationship($alias, $join, $this->definition['base'], $this->relationship);
   }
Index: includes/admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views/includes/admin.inc,v
retrieving revision 1.154.2.22
diff -u -p -r1.154.2.22 admin.inc
--- includes/admin.inc	28 Dec 2009 21:34:25 -0000	1.154.2.22
+++ includes/admin.inc	27 Jan 2010 00:31:02 -0000
@@ -2450,7 +2450,13 @@ function views_ui_add_item_form_submit($
   if (!empty($form_state['values']['name']) && is_array($form_state['values']['name'])) {
     // Loop through each of the items that were checked and add them to the view.
     foreach (array_keys(array_filter($form_state['values']['name'])) as $field) {
-      list($table, $field) = explode('.', $field, 2);
+     // Reverse the string so we can split on the last period, not the first
+      $rev_field = strrev($field);
+      list($field, $table) = explode('.', $rev_field, 2);
+      // Put the strings back in correct order.
+      $table = strrev($table);
+      $field = strrev($field);
+
       $id = $form_state['view']->add_item($form_state['display_id'], $type, $table, $field);
 
       // check to see if we have group by settings
Index: includes/handlers.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views/includes/handlers.inc,v
retrieving revision 1.109.2.15
diff -u -p -r1.109.2.15 handlers.inc
--- includes/handlers.inc	24 Dec 2009 01:08:26 -0000	1.109.2.15
+++ includes/handlers.inc	27 Jan 2010 00:31:02 -0000
@@ -730,7 +730,7 @@ class views_many_to_one_helper {
     }
     // If we found that there are tables in between, add the relationship.
     if ($r_join->table != $join->table) {
-      $relationship = $this->handler->query->add_relationship($this->handler->table . '_' . $r_join->table, $r_join, $r_join->table, $this->handler->relationship);
+      $relationship = $this->handler->query->add_relationship(views_clean_alias($this->handler->table . '_' . $r_join->table), $r_join, $r_join->table, $this->handler->relationship);
     }
 
     // And now add our table, using the new relationship if one was used.
@@ -803,7 +803,7 @@ class views_many_to_one_helper {
           // when we know we can.
           $join = $this->get_join();
           $join->type = 'INNER';
-          $this->handler->table_alias = $this->handler->query->ensure_table($this->handler->table, $this->handler->relationship, $join);
+          $this->handler->table_alias = views_clean_alias($this->handler->query->ensure_table($this->handler->table, $this->handler->relationship, $join));
           $this->handler->view->many_to_one_tables[$field] = $this->handler->value;
         }
         else {
@@ -822,7 +822,7 @@ class views_many_to_one_helper {
             }
           }
 
-          $this->handler->table_alias = $this->add_table($join);
+          $this->handler->table_alias = views_clean_alias($this->add_table($join));
         }
 
         return $this->handler->table_alias;
Index: includes/view.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views/includes/view.inc,v
retrieving revision 1.151.2.25
diff -u -p -r1.151.2.25 view.inc
--- includes/view.inc	28 Dec 2009 21:34:25 -0000	1.151.2.25
+++ includes/view.inc	27 Jan 2010 00:31:02 -0000
@@ -1955,6 +1955,18 @@ function views_object_types() {
   return $retval;
 }
 
+/*
+ * Clean external table aliases by replacing a period with an underscore.
+ * 
+ * @param $alias
+ *   The alias that may need cleaning.
+ * @return
+ *   The alias with any periods replaced with underscores.
+ */
+function views_clean_alias($alias){
+  return  str_replace('.', '_' , $alias);
+} 
+
 /**
  * @}
  */
Index: plugins/views_plugin_query_default.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views/plugins/Attic/views_plugin_query_default.inc,v
retrieving revision 1.1.2.16
diff -u -p -r1.1.2.16 views_plugin_query_default.inc
--- plugins/views_plugin_query_default.inc	4 Jan 2010 23:55:02 -0000	1.1.2.16
+++ plugins/views_plugin_query_default.inc	27 Jan 2010 00:31:02 -0000
@@ -77,13 +77,13 @@ class views_plugin_query_default extends
     $this->relationships[$base_table] = array(
       'link' => NULL,
       'table' => $base_table,
-      'alias' => $base_table,
+      'alias' => views_clean_alias($base_table),
       'base' => $base_table
     );
 
     // init the table queue with our primary table.
     $this->table_queue[$base_table] = array(
-      'alias' => $base_table,
+      'alias' => views_clean_alias($base_table),
       'table' => $base_table,
       'relationship' => $base_table,
       'join' => NULL,
@@ -92,7 +92,7 @@ class views_plugin_query_default extends
     // init the tables with our primary table
     $this->tables[$base_table][$base_table] = array(
       'count' => 1,
-      'alias' => $base_table,
+      'alias' => views_clean_alias($base_table),
     );
 
 /**
@@ -131,7 +131,7 @@ class views_plugin_query_default extends
    */
   function set_count_field($table, $field, $alias = NULL) {
     if (empty($alias)) {
-      $alias = $table . '_' . $field;
+      $alias = views_clean_alias($table . '_' . $field);
     }
     $this->count_field = array(
       'table' => $table,
@@ -305,10 +305,10 @@ class views_plugin_query_default extends
 
     if (!$alias && $join && $relationship && !empty($join->adjusted) && $table != $join->table) {
       if ($relationship == $this->base_table) {
-        $alias = $table;
+        $alias = views_clean_alias($table);
       }
       else {
-        $alias = $relationship . '_' . $table;
+        $alias = views_clean_alias($relationship . '_' . $table);
       }
     }
 
@@ -362,7 +362,7 @@ class views_plugin_query_default extends
           // space collisions.
           $alias = $relationship . '__';
         }
-        $alias .= $table;
+        $alias = views_clean_alias($alias . $table);
       }
       $this->tables[$relationship][$table] = array(
         'count' => 1,
@@ -839,7 +839,7 @@ class views_plugin_query_default extends
     // Only fill out this aliasing if there is a table;
     // otherwise we assume it is a formula.
     if (!$alias && $table) {
-      $as = $table . '_' . $field;
+      $as = views_clean_alias($table . '_' . $field);
     }
     else {
       $as = $alias;
@@ -1026,7 +1026,7 @@ class views_plugin_query_default extends
 
     $where = $this->condition_sql();
 
-    $query = "SELECT " . implode(",\n", array_merge($distinct, $fields)) . "\n FROM {" . $this->base_table . "} $this->base_table \n$joins $where $groupby $having $orderby";
+    $query = "SELECT " . implode(",\n", array_merge($distinct, $fields)) . "\n FROM {" . $this->base_table . "} ". views_clean_alias($this->base_table) . " \n$joins $where $groupby $having $orderby";
 
     $replace = array('&gt;' => '>', '&lt;' => '<');
     $query = strtr($query, $replace);
