Drupal 7 – Service links » Issues – Error after upgrading to 7.x-2.2

After upgrading Drupal 7 Service links module to 7.x-2.2, the following error message appears:

The following updates returned messages
service_links module
Update #6200

Failed: PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘service_links_show_’ in ‘where clause’: SELECT name FROM {variable} v WHERE LOCATE(“service_links_show_”,v.name) > 0; Array ( ) in service_links_update_6200() (line 46 of /sites/all/modules/contributed/service_links/service_links.install).

Use this patch https://drupal.org/files/drupal7-service_links-2.2-update.patch to fix it.

diff -Naurp service_links.orig/service_links.install service_links.new/service_links.install
--- service_links.orig/service_links.install    2013-06-07 12:17:14.000000000 +0200
+++ service_links.new/service_links.install    2013-06-10 15:26:43.256971524 +0200
@@ -43,11 +43,10 @@ function service_links_update_6200() {
}

// delete old service variables
-  $result = db_query('SELECT name FROM {variable} v WHERE LOCATE("service_links_show_",v.name) > 0');
-  while ($row = db_fetch_object($result)) {
-    variable_del($row->name);
-  }
-
+  db_delete('variable')
+    ->condition('name', 'service_links_show_%', 'LIKE')
+    ->execute();
+
// Aggregator2 support
variable_del('service_links_agg2_link');
}
@@ -56,22 +55,22 @@ function service_links_update_6200() {
* Switch the old variables to the news based on view modes.
*/
function _update_to_view_modes($old_var, $new_var) {
-  $modes = array_filter(variable_get($old_var, 0));
-  $new_var = variable_get($new_var, NULL);
+  $modes = variable_get($old_var, 0);
+  $new_values = variable_get($new_var, NULL);

-  if (!isset($new_var)) {
+  if (!isset($new_values)) {
switch($modes) {
-    case 0:
+    default:
$modes = array();
break;
case 1:
$modes = array('teaser' => 'teaser');
break;
case 2:
-      $modes = array('full' => 1);
+      $modes = array('full' => 'full');
break;
case 3:
-      $modes = array('teaser' => 1, 'full' => 1);
+      $modes = array('teaser' => 'teaser', 'full' => 'full');
break;
}

@@ -87,4 +86,4 @@ function _update_to_view_modes($old_var,
function service_links_update_7201(&$sandbox) {
_update_to_view_modes('service_links_in_links', 'service_links_link_view_modes');
_update_to_view_modes('service_links_in_node', 'service_links_node_view_modes');
-}
\ No newline at end of file
+}

Place the patch in the same directory as the file being patched and run this patch command

patch < file.patch
patch < drupal7-service_links-2.2-update.patch