Browse Source

SQLITE补充

xx 2 years ago
parent
commit
a7208adaa0
1 changed files with 6 additions and 1 deletions
  1. 6 1
      src/util/sqlite3.cpp

+ 6 - 1
src/util/sqlite3.cpp

@@ -46,7 +46,12 @@ bool ylib::sqlite3::open(const std::string& filepath, const std::string& usernam
 	m_db = nullptr;
 	if (sqlite3_open(codec::to_utf8(filepath).c_str(),(::sqlite3**)&m_db) != 0)
 	{
-		this->m_lastErrorDesc = sqlite3_errmsg(DB_PTR);
+		if (m_db != nullptr)
+		{
+			this->m_lastErrorDesc = sqlite3_errmsg(DB_PTR);
+			close();
+		}
+		
 		return false;
 	}
 	return true;