--- fb_app.install.orig	2011-05-26 21:07:02.000000000 +0200
+++ fb_app.install	2011-05-26 21:31:49.804884149 +0200
@@ -98,17 +98,20 @@
 function fb_app_update_6301() {
   $ret = array();
   $query = db_query("SELECT fba_id, label FROM {fb_app} ORDER BY fba_id");
-  while ($app = db_fetch_object($query)) {
+  while ($app = $query->fetchObject()) {
     //change label names to lowercase
     $label_old = $app->label;
     $label_new = strtolower($label_old);
     if ($label_old != $label_new){
 
       // Change app name to lowercase.
-      $ret[] = update_sql("UPDATE {fb_app} SET label = '%s' WHERE fba_id = %d",
-                          $label_new, $app->fba_id);
+      $ret[] = db_update('fb_app')
+        ->fields(array('label' => $label_new))
+        ->condition('fba_id', $app->fba_id)
+        ->execute();
+
       drupal_set_message(t("Changed fb application name from %label_old to %label_new. Please adjust any custom code or settings which rely on app's label.", array(
-                             '%label_old' => $label_old,
+                           '%label_old' => $label_old,
                              '%label_new' => $label_new,
                            )), 'warning');
 
@@ -130,12 +133,16 @@
       // change deltas of blocks
       $old_delta = 'login_' . $label_old;
       $new_delta = 'login_' . $label_new;
-      $ret[] = update_sql("UPDATE {blocks} SET delta = '%s' WHERE (module = 'fb_connect' AND delta = '%s')",
-                          $new_delta, $old_delta);
+
+      $ret[] = db_update('blocks')
+        ->fields(array('delta' => $new_delta))
+        ->condition('module', 'fb_module')
+        ->condition('delta', $old_delta)
+        ->execute();
 
       // end fb_connect.module settings.
 
     }
   }
   return $ret;
-}
\ No newline at end of file
+}
