Index: includes/install.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/install.inc,v
retrieving revision 1.80
diff -u -p -r1.80 install.inc
--- includes/install.inc	30 Dec 2008 16:43:14 -0000	1.80
+++ includes/install.inc	4 Jan 2009 16:16:34 -0000
@@ -134,8 +134,8 @@ function drupal_get_installed_schema_ver
 
   if (!$versions) {
     $versions = array();
-    $result = db_query("SELECT name, schema_version FROM {system} WHERE type = '%s'", 'module');
-    while ($row = db_fetch_object($result)) {
+    $result = db_query("SELECT name, schema_version FROM {system} WHERE type = :type", array(':type' => 'module'));
+    foreach ($result as $row) {
       $versions[$row->name] = $row->schema_version;
     }
   }
@@ -152,7 +152,10 @@ function drupal_get_installed_schema_ver
  *   The new schema version.
  */
 function drupal_set_installed_schema_version($module, $version) {
-  db_query("UPDATE {system} SET schema_version = %d WHERE name = '%s'", $version, $module);
+  db_update('system')
+    ->fields(array('schema_version' => $version))
+    ->condition('name', $module)
+    ->execute();
 }
 
 /**
@@ -572,7 +575,17 @@ function drupal_install_system() {
 
   $system_versions = drupal_get_schema_versions('system');
   $system_version = $system_versions ? max($system_versions) : SCHEMA_INSTALLED;
-  db_query("INSERT INTO {system} (filename, name, type, owner, status, schema_version) VALUES('%s', '%s', '%s', '%s', %d, %d)", $system_path . '/system.module', 'system', 'module', '', 1, $system_version);
+  db_insert('system')
+    ->fields(array('filename', 'name', 'type', 'owner', 'status', 'schema_version'))
+    ->values(array(
+        'filename' => $system_path . '/system.module',
+        'name' => 'system',
+        'type' => 'module',
+        'owner' => '',
+        'status' => 1,
+        'schema_version' => $system_version
+        ))
+    ->execute();
   // Now that we've installed things properly, bootstrap the full Drupal environment
   drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
   module_rebuild_cache();
@@ -609,10 +622,15 @@ function drupal_uninstall_modules($modul
       }
       $placeholders = implode(', ', array_fill(0, count($paths), "'%s'"));
 
-      $result = db_query('SELECT * FROM {menu_links} WHERE router_path IN (' . $placeholders . ') AND external = 0 ORDER BY depth DESC', $paths);
+      $result = db_select('menu_links')
+         ->fields('menu_links')
+         ->condition('router_path', $paths, 'IN')
+         ->condition('external', 0)
+         ->orderBy('depth')
+         ->execute();
       // Remove all such items. Starting from those with the greatest depth will
       // minimize the amount of re-parenting done by menu_link_delete().
-      while ($item = db_fetch_array($result)) {
+      foreach ($result as $item) {
         _menu_delete_item($item, TRUE);
       }
     }
