This commit is contained in:
jiajen 2018-04-10 22:18:55 +08:00 committed by Aleksandar Fabijanic
parent 200a890434
commit 27e7e532cc
3 changed files with 22 additions and 3 deletions

View File

@ -59,15 +59,17 @@ Utility::TypeMap Utility::_types;
Poco::Mutex Utility::_mutex;
Utility::SQLiteMutex::SQLiteMutex(sqlite3* pDB): _pMutex(sqlite3_db_mutex(pDB))
Utility::SQLiteMutex::SQLiteMutex(sqlite3* pDB): _pMutex((pDB) ? sqlite3_db_mutex(pDB) : 0)
{
sqlite3_mutex_enter(_pMutex);
if (_pMutex)
sqlite3_mutex_enter(_pMutex);
}
Utility::SQLiteMutex::~SQLiteMutex()
{
sqlite3_mutex_leave(_pMutex);
if (_pMutex)
sqlite3_mutex_leave(_pMutex);
}

View File

@ -52,6 +52,7 @@ using Poco::Data::Column;
using Poco::Data::Row;
using Poco::Data::SQLChannel;
using Poco::Data::LimitException;
using Poco::Data::ConnectionFailedException;
using Poco::Data::CLOB;
using Poco::Data::Date;
using Poco::Data::Time;
@ -3362,6 +3363,19 @@ void SQLiteTest::testFTS3()
}
void SQLiteTest::testIllegalFilePath()
{
try
{
Session tmp (Poco::Data::SQLite::Connector::KEY, "\\/some\\/illegal\\/path\\/dummy.db", 1);
fail("must fail");
}
catch (ConnectionFailedException&)
{
}
}
void SQLiteTest::setUp()
{
}
@ -3462,6 +3476,7 @@ CppUnit::Test* SQLiteTest::suite()
CppUnit_addTest(pSuite, SQLiteTest, testTransaction);
CppUnit_addTest(pSuite, SQLiteTest, testTransactor);
CppUnit_addTest(pSuite, SQLiteTest, testFTS3);
CppUnit_addTest(pSuite, SQLiteTest, testIllegalFilePath);
return pSuite;
}

View File

@ -133,6 +133,8 @@ public:
void testFTS3();
void testIllegalFilePath();
void setUp();
void tearDown();