From 2b8226e0e5861c3d3d140cd8dcff101b0c5d8d3d Mon Sep 17 00:00:00 2001 From: cxl Date: Mon, 2 Feb 2009 12:46:49 +0000 Subject: [PATCH] Fix in sqlite3 git-svn-id: svn://ultimatepp.org/upp/trunk@833 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/plugin/sqlite3/Sqlite3upp.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/uppsrc/plugin/sqlite3/Sqlite3upp.cpp b/uppsrc/plugin/sqlite3/Sqlite3upp.cpp index 860869eb6..463984561 100644 --- a/uppsrc/plugin/sqlite3/Sqlite3upp.cpp +++ b/uppsrc/plugin/sqlite3/Sqlite3upp.cpp @@ -273,8 +273,13 @@ bool Sqlite3Session::Open(const char* filename) { // However, using the ATTACH sql command, it can connect to more databases. // I don't know how to get the list of attached databases from the API current_dbname = "main"; - bool opened = (SQLITE_OK == sqlite3_open(filename, &db)); - return opened; + if(SQLITE_OK == sqlite3_open(filename, &db)) + return true; + if(db) { + sqlite3_close(db); + db = NULL; + } + return false; } void Sqlite3Session::Close() { if (NULL != db) {