[X2Go-Commits] [x2goserver] 01/01: Use "undef $dbh" instead of "$dbh->disconnect()". Fixes SQLite3 issues on SLE 11.x.

git-admin at x2go.org git-admin at x2go.org
Wed Feb 4 21:04:42 CET 2015


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch release/4.0.1.x
in repository x2goserver.

commit 544d2feb40721c9fab5b2052bb3d4fc0f807bc0c
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Wed Feb 4 20:59:01 2015 +0100

    Use "undef $dbh" instead of "$dbh->disconnect()". Fixes SQLite3 issues on SLE 11.x.
---
 debian/changelog                    |    2 ++
 x2goserver/lib/x2godbwrapper.pm     |   42 +++++++++++++++++------------------
 x2goserver/lib/x2gosqlitewrapper.pl |    2 +-
 x2goserver/sbin/x2godbadmin         |    8 +++----
 4 files changed, 28 insertions(+), 26 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index ce84ef8..b7aa312 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -65,6 +65,8 @@ x2goserver (4.0.1.19-0x2go1) UNRELEASED; urgency=medium
     - Provide legacy support for old File::Path packages in x2godbadmin.
       (Fixes: #715).
     - Fix wrong evocation of x2gosyslog ("error" -> "err").
+    - Use "undef $dbh" instead of "$dbh->disconnect()". Fixes SQLite3 issues on
+      SLE 11.x.
   * debian/control:
     + Add D (x2goserver): libfile-which-perl.
     + Add C (x2goserver: x2godesktopsharing (<< 3.1.1.2-0~). (Fixes: #700).
diff --git a/x2goserver/lib/x2godbwrapper.pm b/x2goserver/lib/x2godbwrapper.pm
index 5c1c323..e70bdad 100644
--- a/x2goserver/lib/x2godbwrapper.pm
+++ b/x2goserver/lib/x2godbwrapper.pm
@@ -119,7 +119,7 @@ sub dbsys_deletemounts
 		my $sth=$dbh->prepare("delete from mounts where session_id='$sid'");
 		$sth->execute();
 		$sth->finish();
-		$dbh->disconnect();
+		undef $dbh;
 	}
 	if ($backend eq 'sqlite')
 	{
@@ -150,7 +150,7 @@ sub dbsys_listsessionsroot
 			@strings[$i++]=join('|', at data);
 		}
 		$sth->finish();
-		$dbh->disconnect();
+		undef $dbh;
 		return @strings;
 	}
 	if($backend eq 'sqlite')
@@ -178,7 +178,7 @@ sub dbsys_listsessionsroot_all
 			@strings[$i++]=join('|', at data);
 		}
 		$sth->finish();
-		$dbh->disconnect();
+		undef $dbh;
 		return @strings;
 	}
 	if ($backend eq 'sqlite')
@@ -205,7 +205,7 @@ sub dbsys_getmounts
 			@strings[$i++]=join("|", at data);
 		}
 		$sth->finish();
-		$dbh->disconnect();
+		undef $dbh;
 		@mounts = @strings;
 	}
 	if ($backend eq 'sqlite')
@@ -235,7 +235,7 @@ sub db_getmounts
 			@strings[$i++]=join("|", at data);
 		}
 		$sth->finish();
-		$dbh->disconnect();
+		undef $dbh;
 		@mounts = @strings;
 	}
 	if ($backend eq 'sqlite')
@@ -258,7 +258,7 @@ sub db_deletemount
 		my $sth=$dbh->prepare("delete from mounts_view where session_id='$sid' and path='$path'");
 		$sth->execute();
 		$sth->finish();
-		$dbh->disconnect();
+		undef $dbh;
 	}
 	if ($backend eq 'sqlite')
 	{
@@ -284,7 +284,7 @@ sub db_insertmount
 			$res_ok=1;
 		}
 		$sth->finish();
-		$dbh->disconnect();
+		undef $dbh;
 	}
 	if ($backend eq 'sqlite')
 	{
@@ -310,7 +310,7 @@ sub db_insertsession
 		my $sth=$dbh->prepare("insert into sessions (display,server,uname,session_id) values ('$display','$server','$uname','$sid')");
 		$sth->execute()or die $_;
 		$sth->finish();
-		$dbh->disconnect();
+		undef $dbh;
 	}
 	if ($backend eq 'sqlite')
 	{
@@ -345,7 +345,7 @@ sub db_createsession
 		                      sound_port='$snd_port',fs_port='$fs_port' where session_id='$sid'");
 		$sth->execute()or die;
 		$sth->finish();
-		$dbh->disconnect();
+		undef $dbh;
 	}
 	if ($backend eq 'sqlite')
 	{
@@ -370,7 +370,7 @@ sub db_insertport
 		my $sth=$dbh->prepare("insert into used_ports (server,session_id,port) values  ('$server','$sid','$sshport')");
 		$sth->execute()or die;
 		$sth->finish();
-		$dbh->disconnect();
+		undef $dbh;
 	}
 	if ($backend eq 'sqlite')
 	{
@@ -390,7 +390,7 @@ sub db_rmport
 		my $sth=$dbh->prepare("delete from used_ports where server='$server' and session_id='$sid' and port='$sshport'");
 		$sth->execute()or die;
 		$sth->finish();
-		$dbh->disconnect();
+		undef $dbh;
 	}
 	if ($backend eq 'sqlite')
 	{
@@ -417,7 +417,7 @@ sub db_resume
 			sound_port='$snd_port',fs_port='$fs_port' where session_id = '$sid'");
 		$sth->execute()or die;
 		$sth->finish();
-		$dbh->disconnect();
+		undef $dbh;
 	}
 	if ($backend eq 'sqlite')
 	{
@@ -437,7 +437,7 @@ sub db_changestatus
 		my $sth=$dbh->prepare("update sessions_view set last_time=now(),status='$status' where session_id = '$sid'");
 		$sth->execute()or die;
 		$sth->finish();
-		$dbh->disconnect();
+		undef $dbh;
 	}
 	if ($backend eq 'sqlite')
 	{
@@ -462,7 +462,7 @@ sub db_getstatus
 			$status=@data[0];
 		}
 		$sth->finish();
-		$dbh->disconnect();
+		undef $dbh;
 	}
 	if ($backend eq 'sqlite')
 	{
@@ -490,7 +490,7 @@ sub db_getdisplays
 			@strings[$i++]='|'. at data[0].'|';
 		}
 		$sth->finish();
-		$dbh->disconnect();
+		undef $dbh;
 		@displays = @strings;
 	}
 	if ($backend eq 'sqlite')
@@ -520,7 +520,7 @@ sub db_getports
 			@strings[$i++]='|'. at data[0].'|';
 		}
 		$sth->finish();
-		$dbh->disconnect();
+		undef $dbh;
 		@ports = @strings;
 	}
 	if ($backend eq 'sqlite')
@@ -548,7 +548,7 @@ sub db_getservers
 			@strings[$i++]=@data[0]." ". at data[1];
 		}
 		$sth->finish();
-		$dbh->disconnect();
+		undef $dbh;
 		@servers = @strings;
 	}
 	if ($backend eq 'sqlite')
@@ -578,7 +578,7 @@ sub db_getagent
 			$agent=@data[0];
 		}
 		$sth->finish();
-		$dbh->disconnect();
+		undef $dbh;
 	}
 	if($backend eq 'sqlite')
 	{
@@ -606,7 +606,7 @@ sub db_getdisplay
 			$display=@data[0];
 		}
 		$sth->finish();
-		$dbh->disconnect();
+		undef $dbh;
 	}
 	if ($backend eq 'sqlite')
 	{
@@ -637,7 +637,7 @@ sub db_listsessions
 			@strings[$i++]=join('|', at data);
 		}
 		$sth->finish();
-		$dbh->disconnect();
+		undef $dbh;
 		return @strings;
 	}
 	if ($backend eq 'sqlite')
@@ -666,7 +666,7 @@ sub db_listsessions_all
 			@strings[$i++]=join('|', at data);
 		}
 		$sth->finish();
-		$dbh->disconnect();
+		undef $dbh;
 		return @strings;
 	}
 	if ($backend eq 'sqlite')
diff --git a/x2goserver/lib/x2gosqlitewrapper.pl b/x2goserver/lib/x2gosqlitewrapper.pl
index 1021e94..1a1867d 100755
--- a/x2goserver/lib/x2gosqlitewrapper.pl
+++ b/x2goserver/lib/x2gosqlitewrapper.pl
@@ -509,7 +509,7 @@ else
 	print "unknown command $cmd\n";
 }
 
-$dbh->disconnect();
+undef $dbh;
 
 sub checkroot
 {
diff --git a/x2goserver/sbin/x2godbadmin b/x2goserver/sbin/x2godbadmin
index 0ae42ea..400f36f 100755
--- a/x2goserver/sbin/x2godbadmin
+++ b/x2goserver/sbin/x2godbadmin
@@ -228,10 +228,10 @@ if ($createdb)
 {
 	$dbh=DBI->connect("dbi:Pg:dbname=postgres;host=$host;port=$port;sslmode=$sslmode", "$dbadmin", "$dbadminpass",{AutoCommit => 1}) or die $_;
 	create_database();
-	$dbh->disconnect();
+	undef $dbh;
 	$dbh=DBI->connect("dbi:Pg:dbname=$db;host=$host;port=$port;sslmode=$sslmode", "$dbadmin", "$dbadminpass",{AutoCommit => 1}) or die $_;
 	create_tables();
-	$dbh->disconnect();
+	undef $dbh;
 	exit(0);
 }
 
@@ -239,7 +239,7 @@ if ($listusers)
 {
 	$dbh=DBI->connect("dbi:Pg:dbname=postgres;host=$host;port=$port;sslmode=$sslmode", "$dbadmin", "$dbadminpass",{AutoCommit => 1}) or die $_;
 	list_users();
-	$dbh->disconnect();
+	undef $dbh;
 	exit(0);
 }
 
@@ -275,7 +275,7 @@ if ($rmgroup)
 		rm_user($_);
 	}
 }
-$dbh->disconnect();
+undef $dbh;
 
 sub list_users()
 {

--
Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goserver.git


More information about the x2go-commits mailing list