--- C:\Users\Edward\Webs\drupal\includes\database.inc	2008-01-15 23:26:00.275000000 -0500
+++ C:\Users\Edward\Webs\drupal\includes\database.inc.formatted	2008-01-16 17:44:33.389357100 -0500
@@ -1,6 +1,7 @@
 <?php
 // $Id: database.inc,v 1.92 2008/01/08 16:03:31 goba Exp $
 
+
 /**
  * @file
  * Wrapper for database interface code.
@@ -56,6 +57,7 @@
  * @param $sql
  *   A string containing a complete SQL query.  %-substitution
  *   parameters are not supported.
+ *
  * @return
  *   An array containing the keys:
  *      success: a boolean indicating whether the query succeeded
@@ -76,12 +78,13 @@
  *
  * @param $sql
  *   A string containing a partial or entire SQL query.
+ *
  * @return
  *   The properly-prefixed string.
  */
 function db_prefix_tables($sql) {
   global $db_prefix;
-
+  
   if (is_array($db_prefix)) {
     if (array_key_exists('default', $db_prefix)) {
       $tmp = $db_prefix;
@@ -124,12 +127,12 @@
 function db_set_active($name = 'default') {
   global $db_url, $db_type, $active_db;
   static $db_conns, $active_name = FALSE;
-
+  
   if (empty($db_url)) {
     include_once 'includes/install.inc';
     install_goto('install.php');
   }
-
+  
   if (!isset($db_conns[$name])) {
     // Initiate a new connection, using the named DB URL specified.
     if (is_array($db_url)) {
@@ -138,25 +141,25 @@
     else {
       $connect_url = $db_url;
     }
-
+    
     $db_type = substr($connect_url, 0, strpos($connect_url, '://'));
     $handler = "./includes/database.$db_type.inc";
-
+    
     if (is_file($handler)) {
       include_once $handler;
     }
     else {
       _db_error_page("The database type '". $db_type ."' is unsupported. Please use either 'mysql' or 'mysqli' for MySQL, or 'pgsql' for PostgreSQL databases.");
     }
-
+    
     $db_conns[$name] = db_connect($connect_url);
   }
-
+  
   $previous_name = $active_name;
   // Set the active connection.
   $active_name = $name;
   $active_db = $db_conns[$name];
-
+  
   return $previous_name;
 }
 
@@ -175,14 +178,14 @@
   drupal_maintenance_theme();
   drupal_set_header('HTTP/1.1 503 Service Unavailable');
   drupal_set_title('Site off-line');
-
+  
   $message = '<p>The site is currently not available due to technical problems. Please try again later. Thank you for your understanding.</p>';
   $message .= '<hr /><p><small>If you are the maintainer of this site, please check your database settings in the <code>settings.php</code> file and ensure that your hosting provider\'s database server is running. For more help, see the <a href="http://drupal.org/node/258">handbook</a>, or contact your hosting provider.</small></p>';
-
+  
   if ($error && ini_get('display_errors')) {
     $message .= '<p><small>The '. theme('placeholder', $db_type) .' error was: '. theme('placeholder', $error) .'.</small></p>';
   }
-
+  
   print theme('maintenance_page', $message);
   exit;
 }
@@ -204,17 +207,24 @@
     $args = $match;
     return;
   }
-
+  
   switch ($match[1]) {
-    case '%d': // We must use type casting to int to convert FALSE/NULL/(TRUE?)
-      return (int) array_shift($args); // We don't need db_escape_string as numbers are db-safe
+    case '%d':
+      // We must use type casting to int to convert FALSE/NULL/(TRUE?)
+      // We don't need db_escape_string as numbers are db-safe
+      return (int) array_shift($args);
+    
     case '%s':
       return db_escape_string(array_shift($args));
+    
     case '%%':
       return '%';
+    
     case '%f':
       return (float) array_shift($args);
-    case '%b': // binary data
+    
+    case '%b':
+      // binary data
       return db_encode_blob(array_shift($args));
   }
 }
@@ -257,12 +267,13 @@
  *   Name of the primary field.
  * @param $args
  *   Array of additional arguments.
+ *
  * @return
  *   An array: join statements, where statements, field or DISTINCT(field).
  */
 function _db_rewrite_sql($query = '', $primary_table = 'n', $primary_field = 'nid', $args = array()) {
-  $where = array();
-  $join = array();
+  $where    = array();
+  $join     = array();
   $distinct = FALSE;
   foreach (module_implements('db_rewrite_sql') as $module) {
     $result = module_invoke($module, 'db_rewrite_sql', $query, $primary_table, $primary_field, $args);
@@ -281,10 +292,10 @@
       $where[] = $result;
     }
   }
-
+  
   $where = empty($where) ? '' : '('. implode(') AND (', $where) .')';
   $join = empty($join) ? '' : implode(' ', $join);
-
+  
   return array($join, $where, $distinct);
 }
 
@@ -303,17 +314,18 @@
  *   Name of the primary field.
  * @param $args
  *   An array of arguments, passed to the implementations of hook_db_rewrite_sql.
+ *
  * @return
  *   The original query with JOIN and WHERE statements inserted from
  *   hook_db_rewrite_sql implementations. nid is rewritten if needed.
  */
-function db_rewrite_sql($query, $primary_table = 'n', $primary_field = 'nid',  $args = array()) {
+function db_rewrite_sql($query, $primary_table = 'n', $primary_field = 'nid', $args = array()) {
   list($join, $where, $distinct) = _db_rewrite_sql($query, $primary_table, $primary_field, $args);
-
+  
   if ($distinct) {
     $query = db_distinct_field($primary_table, $primary_field, $query);
   }
-
+  
   if (!empty($where) || !empty($join)) {
     $pattern = '{
       # Beginning of the string
@@ -329,9 +341,9 @@
     }x';
     preg_match($pattern, $query, $matches);
     if ($where) {
-      $n = strlen($matches[1]);
+      $n           = strlen($matches[1]);
       $second_part = substr($query, $n);
-      $first_part = substr($matches[1], 0, $n - 5) ." $join WHERE $where AND ( ";
+      $first_part  = substr($matches[1], 0, $n - 5) ." $join WHERE $where AND ( ";
       // PHP 4 does not support strrpos for strings. We emulate it.
       $haystack_reverse = strrev($second_part);
       // No need to use strrev on the needle, we supply GROUP, ORDER, LIMIT
@@ -355,7 +367,7 @@
       $query = $matches[1] ." $join ". substr($query, strlen($matches[1]));
     }
   }
-
+  
   return $query;
 }
 
@@ -482,7 +494,7 @@
  * @see drupal_install_schema()
  */
 
- /**
+/**
  * Create a new table from a Drupal table definition.
  *
  * @param $ret
@@ -507,6 +519,7 @@
  *
  * @param $fields
  *   An array of key/index column specifiers.
+ *
  * @return
  *   An array of field names.
  */
@@ -531,6 +544,7 @@
  *
  * @param $type
  *   The Schema API type of a field.
+ *
  * @return
  *   The placeholder string to embed in a query for that type.
  */
@@ -541,7 +555,7 @@
     case 'text':
     case 'datetime':
       return '\'%s\'';
-
+    
     case 'numeric':
       // For 'numeric' values, we use '%s', not '\'%s\'' as with
       // string types, because numeric values should not be enclosed
@@ -550,18 +564,18 @@
       // presumably no db's "escape string" function will mess with
       // those characters.
       return '%s';
-
+    
     case 'serial':
     case 'int':
       return '%d';
-
+    
     case 'float':
       return '%f';
-
+    
     case 'blob':
       return '%b';
   }
-
+  
   // There is no safe value to return here, so return something that
   // will cause the query to fail.
   return 'unsupported type '. $type .'for db_type_placeholder';
@@ -570,3 +584,4 @@
 /**
  * @} End of "defgroup schemaapi".
  */
+
