mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2026-08-14 11:47:10 +02:00
Update libraries and make it build on windows.
Still gets some warnings because compilers have changed. But should work.
This commit is contained in:
+709
-52
@@ -20,6 +20,7 @@
|
||||
#include "Poco/Data/DataException.h"
|
||||
#include "Poco/DateTimeParser.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include "Poco/Debugger.h"
|
||||
#if defined(POCO_UNBUNDLED)
|
||||
#include <sqlite3.h>
|
||||
#else
|
||||
@@ -49,43 +50,19 @@ Extractor::~Extractor()
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Poco::Int32& val)
|
||||
{
|
||||
if (isNull(pos)) return false;
|
||||
val = sqlite3_column_int(_pStmt, (int) pos);
|
||||
return true;
|
||||
return extract(sqlite3_column_int, pos, val);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Poco::Int64& val)
|
||||
{
|
||||
if (isNull(pos)) return false;
|
||||
val = sqlite3_column_int64(_pStmt, (int) pos);
|
||||
return true;
|
||||
return extract(sqlite3_column_int64, pos, val);
|
||||
}
|
||||
|
||||
|
||||
#ifndef POCO_INT64_IS_LONG
|
||||
bool Extractor::extract(std::size_t pos, long& val)
|
||||
{
|
||||
if (isNull(pos)) return false;
|
||||
val = sqlite3_column_int(_pStmt, (int) pos);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, unsigned long& val)
|
||||
{
|
||||
if (isNull(pos)) return false;
|
||||
val = sqlite3_column_int(_pStmt, (int) pos);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, double& val)
|
||||
{
|
||||
if (isNull(pos)) return false;
|
||||
val = sqlite3_column_double(_pStmt, (int) pos);
|
||||
return true;
|
||||
return extract(sqlite3_column_double, pos, val);
|
||||
}
|
||||
|
||||
|
||||
@@ -101,59 +78,51 @@ bool Extractor::extract(std::size_t pos, std::string& val)
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, UTF16String& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Poco::Int8& val)
|
||||
{
|
||||
if (isNull(pos)) return false;
|
||||
val = sqlite3_column_int(_pStmt, (int) pos);
|
||||
return true;
|
||||
return extract(sqlite3_column_int, pos, val);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Poco::UInt8& val)
|
||||
{
|
||||
if (isNull(pos)) return false;
|
||||
val = sqlite3_column_int(_pStmt, (int) pos);
|
||||
return true;
|
||||
return extract(sqlite3_column_int, pos, val);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Poco::Int16& val)
|
||||
{
|
||||
if (isNull(pos)) return false;
|
||||
val = sqlite3_column_int(_pStmt, (int) pos);
|
||||
return true;
|
||||
return extract(sqlite3_column_int, pos, val);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Poco::UInt16& val)
|
||||
{
|
||||
if (isNull(pos)) return false;
|
||||
val = sqlite3_column_int(_pStmt, (int) pos);
|
||||
return true;
|
||||
return extract(sqlite3_column_int, pos, val);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Poco::UInt32& val)
|
||||
{
|
||||
if (isNull(pos)) return false;
|
||||
val = sqlite3_column_int(_pStmt, (int) pos);
|
||||
return true;
|
||||
return extract(sqlite3_column_int, pos, val);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Poco::UInt64& val)
|
||||
{
|
||||
if (isNull(pos)) return false;
|
||||
val = sqlite3_column_int64(_pStmt, (int) pos);
|
||||
return true;
|
||||
return extract(sqlite3_column_int64, pos, val);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, bool& val)
|
||||
{
|
||||
if (isNull(pos)) return false;
|
||||
val = (0 != sqlite3_column_int(_pStmt, (int) pos));
|
||||
return true;
|
||||
return extract(sqlite3_column_int, pos, val);
|
||||
}
|
||||
|
||||
|
||||
@@ -167,9 +136,7 @@ bool Extractor::extract(std::size_t pos, float& val)
|
||||
|
||||
bool Extractor::extract(std::size_t pos, char& val)
|
||||
{
|
||||
if (isNull(pos)) return false;
|
||||
val = sqlite3_column_int(_pStmt, (int) pos);
|
||||
return true;
|
||||
return extract(sqlite3_column_int, pos, val);
|
||||
}
|
||||
|
||||
|
||||
@@ -224,12 +191,305 @@ bool Extractor::extract(std::size_t pos, Poco::Any& val)
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Poco::DynamicAny& val)
|
||||
bool Extractor::extract(std::size_t pos, Dynamic::Var& val)
|
||||
{
|
||||
return extractImpl(pos, val);
|
||||
}
|
||||
|
||||
|
||||
// Nullable
|
||||
bool Extractor::extract(std::size_t pos, Nullable<Poco::Int32>& val)
|
||||
{
|
||||
if (isNull(pos)) val.clear();
|
||||
else val = sqlite3_column_int(_pStmt, (int) pos);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Nullable<Poco::Int64>& val)
|
||||
{
|
||||
if (isNull(pos)) val.clear();
|
||||
else val = sqlite3_column_int64(_pStmt, (int) pos);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
#ifndef POCO_INT64_IS_LONG
|
||||
|
||||
bool Extractor::extract(std::size_t pos, long& val)
|
||||
{
|
||||
if (isNull(pos)) return false;
|
||||
val = sqlite3_column_int64(_pStmt, (int) pos);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, unsigned long& val)
|
||||
{
|
||||
if (isNull(pos)) return false;
|
||||
val = sqlite3_column_int64(_pStmt, (int) pos);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<long>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<long>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<long>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<unsigned long>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<unsigned long>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<unsigned long>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Nullable<long>& val)
|
||||
{
|
||||
if (isNull(pos)) val.clear();
|
||||
else val = sqlite3_column_int(_pStmt, (int) pos);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Nullable<unsigned long>& val)
|
||||
{
|
||||
if (isNull(pos)) val.clear();
|
||||
else val = sqlite3_column_int(_pStmt, (int) pos);
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif // POCO_INT64_IS_LONG
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Nullable<double>& val)
|
||||
{
|
||||
if (isNull(pos)) val.clear();
|
||||
else val = sqlite3_column_double(_pStmt, (int) pos);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Nullable<std::string>& val)
|
||||
{
|
||||
if (isNull(pos)) val.clear();
|
||||
else
|
||||
{
|
||||
const char *pBuf = reinterpret_cast<const char*>(sqlite3_column_text(_pStmt, (int) pos));
|
||||
if (!pBuf) val = ""s;
|
||||
else val = pBuf;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Nullable<UTF16String>& val)
|
||||
{
|
||||
throw NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Nullable<Poco::Int8>& val)
|
||||
{
|
||||
if (isNull(pos)) val.clear();
|
||||
else val = sqlite3_column_int(_pStmt, (int) pos);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Nullable<Poco::UInt8>& val)
|
||||
{
|
||||
if (isNull(pos)) val.clear();
|
||||
else val = sqlite3_column_int(_pStmt, (int) pos);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Nullable<Poco::Int16>& val)
|
||||
{
|
||||
if (isNull(pos)) val.clear();
|
||||
else val = sqlite3_column_int(_pStmt, (int) pos);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Nullable<Poco::UInt16>& val)
|
||||
{
|
||||
if (isNull(pos)) val.clear();
|
||||
else val = sqlite3_column_int(_pStmt, (int) pos);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Nullable<Poco::UInt32>& val)
|
||||
{
|
||||
if (isNull(pos)) val.clear();
|
||||
else val = sqlite3_column_int(_pStmt, (int) pos);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Nullable<Poco::UInt64>& val)
|
||||
{
|
||||
if (isNull(pos)) val.clear();
|
||||
else val = sqlite3_column_int64(_pStmt, (int) pos);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Nullable<bool>& val)
|
||||
{
|
||||
if (isNull(pos)) val.clear();
|
||||
else val = (0 != sqlite3_column_int(_pStmt, (int) pos));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Nullable<float>& val)
|
||||
{
|
||||
if (isNull(pos)) val.clear();
|
||||
else val = static_cast<float>(sqlite3_column_double(_pStmt, (int) pos));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Nullable<char>& val)
|
||||
{
|
||||
if (isNull(pos)) val.clear();
|
||||
else val = sqlite3_column_int(_pStmt, (int) pos);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Nullable<Date>& val)
|
||||
{
|
||||
if (isNull(pos)) val.clear();
|
||||
else
|
||||
{
|
||||
std::string str;
|
||||
extract(pos, str);
|
||||
int tzd;
|
||||
val = DateTimeParser::parse(Utility::SQLITE_DATE_FORMAT, str, tzd);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Nullable<Time>& val)
|
||||
{
|
||||
if (isNull(pos)) val.clear();
|
||||
else
|
||||
{
|
||||
std::string str;
|
||||
extract(pos, str);
|
||||
int tzd;
|
||||
val = DateTimeParser::parse(Utility::SQLITE_TIME_FORMAT, str, tzd);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Nullable<DateTime>& val)
|
||||
{
|
||||
if (isNull(pos)) val.clear();
|
||||
else
|
||||
{
|
||||
std::string dt;
|
||||
extract(pos, dt);
|
||||
int tzd;
|
||||
if (val.isNull()) val = DateTime();
|
||||
DateTimeParser::parse(dt, val.value(), tzd);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Nullable<UUID>& val)
|
||||
{
|
||||
if (isNull(pos)) val.clear();
|
||||
else
|
||||
{
|
||||
std::string str;
|
||||
extract(pos, str);
|
||||
if (val.isNull()) val = UUID();
|
||||
val.value().parse(str);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Nullable<Poco::Any>& val)
|
||||
{
|
||||
if (isNull(pos))
|
||||
{
|
||||
val.clear();
|
||||
return true;
|
||||
}
|
||||
if (val.isNull()) val = Poco::Any();
|
||||
return extractImpl(pos, val.value());
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Nullable<Dynamic::Var>& val)
|
||||
{
|
||||
if (isNull(pos))
|
||||
{
|
||||
val.clear();
|
||||
return true;
|
||||
}
|
||||
if (val.isNull()) val = Dynamic::Var();
|
||||
return extractImpl(pos, val.value());
|
||||
}
|
||||
|
||||
|
||||
inline bool Extractor::extract(std::size_t pos, Nullable<Poco::Data::BLOB>& val)
|
||||
{
|
||||
if (isNull(pos))
|
||||
{
|
||||
val.clear();
|
||||
return true;
|
||||
}
|
||||
if (val.isNull()) val = Poco::Data::BLOB();
|
||||
return extractLOB<Poco::Data::BLOB::ValueType>(pos, val.value());
|
||||
}
|
||||
|
||||
|
||||
inline bool Extractor::extract(std::size_t pos, Nullable<Poco::Data::CLOB>& val)
|
||||
{
|
||||
if (isNull(pos))
|
||||
{
|
||||
val.clear();
|
||||
return true;
|
||||
}
|
||||
if (val.isNull()) val = Poco::Data::CLOB();
|
||||
return extractLOB<Poco::Data::CLOB::ValueType>(pos, val.value());
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::isNull(std::size_t pos, std::size_t)
|
||||
{
|
||||
if (pos >= _nulls.size())
|
||||
@@ -245,4 +505,401 @@ bool Extractor::isNull(std::size_t pos, std::size_t)
|
||||
}
|
||||
|
||||
|
||||
// Containers
|
||||
bool Extractor::extract(std::size_t pos, std::vector<Poco::Int8>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<Poco::Int8>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<Poco::Int8>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<Poco::UInt8>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<Poco::UInt8>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<Poco::UInt8>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<Poco::Int16>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<Poco::Int16>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<Poco::Int16>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<Poco::UInt16>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<Poco::UInt16>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<Poco::UInt16>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<Poco::Int32>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<Poco::Int32>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<Poco::Int32>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<Poco::UInt32>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<Poco::UInt32>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<Poco::UInt32>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<Poco::Int64>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<Poco::Int64>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<Poco::Int64>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<Poco::UInt64>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<Poco::UInt64>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<Poco::UInt64>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<bool>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<bool>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<bool>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<char>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<char>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<char>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<std::string>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<std::string>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<std::string>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<UTF16String>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<UTF16String>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<UTF16String>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<float>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<float>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<float>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<double>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<double>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<double>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<Poco::Data::Date>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<Poco::Data::Date>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<Poco::Data::Date>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<Poco::Data::Time>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<Poco::Data::Time>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<Poco::Data::Time>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<Poco::Data::BLOB>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<Poco::Data::BLOB>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<Poco::Data::BLOB>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<Poco::Data::CLOB>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<Poco::Data::CLOB>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<Poco::Data::CLOB>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<Poco::DateTime>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<Poco::DateTime>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<Poco::DateTime>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<Poco::UUID>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<Poco::UUID>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<Poco::UUID>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<Poco::Any>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<Poco::Any>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<Poco::Any>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::vector<Poco::Dynamic::Var>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::deque<Poco::Dynamic::Var>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, std::list<Poco::Dynamic::Var>& val)
|
||||
{
|
||||
throw Poco::NotImplementedException(poco_src_loc);
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::SQLite
|
||||
|
||||
+52
-18
@@ -44,15 +44,19 @@ const std::string SessionImpl::EXCLUSIVE_BEGIN_TRANSACTION("BEGIN EXCLUSIVE");
|
||||
const std::string SessionImpl::IMMEDIATE_BEGIN_TRANSACTION("BEGIN IMMEDIATE");
|
||||
const std::string SessionImpl::COMMIT_TRANSACTION("COMMIT");
|
||||
const std::string SessionImpl::ABORT_TRANSACTION("ROLLBACK");
|
||||
const std::string SessionImpl::SQLITE_READ_UNCOMMITTED = "PRAGMA read_uncommitted = true";
|
||||
const std::string SessionImpl::SQLITE_READ_COMMITTED = "PRAGMA read_uncommitted = false";
|
||||
|
||||
|
||||
|
||||
SessionImpl::SessionImpl(const std::string& fileName, std::size_t loginTimeout):
|
||||
Poco::Data::AbstractSessionImpl<SessionImpl>(fileName, loginTimeout),
|
||||
_connector(Connector::KEY),
|
||||
_pDB(0),
|
||||
_pDB(nullptr),
|
||||
_connected(false),
|
||||
_isTransaction(false),
|
||||
_transactionType(TransactionType::DEFERRED)
|
||||
_transactionType(TransactionType::DEFERRED),
|
||||
_transactionIsolationLevel(Session::TRANSACTION_READ_COMMITTED)
|
||||
{
|
||||
open();
|
||||
setConnectionTimeout(loginTimeout);
|
||||
@@ -78,6 +82,12 @@ SessionImpl::~SessionImpl()
|
||||
}
|
||||
|
||||
|
||||
void SessionImpl::setName()
|
||||
{
|
||||
setDBMSName("SQLite"s);
|
||||
}
|
||||
|
||||
|
||||
Poco::Data::StatementImpl::Ptr SessionImpl::createStatementImpl()
|
||||
{
|
||||
poco_check_ptr (_pDB);
|
||||
@@ -128,28 +138,57 @@ void SessionImpl::rollback()
|
||||
|
||||
void SessionImpl::setTransactionIsolation(Poco::UInt32 ti)
|
||||
{
|
||||
if (ti != Session::TRANSACTION_READ_COMMITTED)
|
||||
throw Poco::InvalidArgumentException("setTransactionIsolation()");
|
||||
Poco::Mutex::ScopedLock l(_mutex);
|
||||
SQLiteStatementImpl tmp(*this, _pDB);
|
||||
switch (ti)
|
||||
{
|
||||
case Session::TRANSACTION_READ_COMMITTED:
|
||||
tmp.add(SQLITE_READ_COMMITTED);
|
||||
_transactionIsolationLevel = Session::TRANSACTION_READ_COMMITTED;
|
||||
break;
|
||||
case Session::TRANSACTION_READ_UNCOMMITTED:
|
||||
tmp.add(SQLITE_READ_UNCOMMITTED);
|
||||
_transactionIsolationLevel = Session::TRANSACTION_READ_UNCOMMITTED;
|
||||
break;
|
||||
case Session::TRANSACTION_REPEATABLE_READ:
|
||||
throw Poco::InvalidArgumentException("setTransactionIsolation(TRANSACTION_REPEATABLE_READ) - unsupported");
|
||||
case Session::TRANSACTION_SERIALIZABLE:
|
||||
throw Poco::InvalidArgumentException("setTransactionIsolation(TRANSACTION_SERIALIZABLE) - unsupported [SQLite transactions are serializable by design]");
|
||||
default:
|
||||
throw Poco::InvalidArgumentException(Poco::format("setTransactionIsolation(%u) - unsupported", ti));
|
||||
break;
|
||||
}
|
||||
tmp.execute();
|
||||
}
|
||||
|
||||
|
||||
Poco::UInt32 SessionImpl::getTransactionIsolation() const
|
||||
{
|
||||
return Session::TRANSACTION_READ_COMMITTED;
|
||||
return _transactionIsolationLevel;
|
||||
}
|
||||
|
||||
|
||||
bool SessionImpl::hasTransactionIsolation(Poco::UInt32 ti) const
|
||||
{
|
||||
if (ti == Session::TRANSACTION_READ_COMMITTED) return true;
|
||||
switch (ti)
|
||||
{
|
||||
case Session::TRANSACTION_READ_COMMITTED:
|
||||
return true;
|
||||
case Session::TRANSACTION_READ_UNCOMMITTED:
|
||||
return true;
|
||||
case Session::TRANSACTION_REPEATABLE_READ:
|
||||
return false;
|
||||
case Session::TRANSACTION_SERIALIZABLE:
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool SessionImpl::isTransactionIsolation(Poco::UInt32 ti) const
|
||||
{
|
||||
if (ti == Session::TRANSACTION_READ_COMMITTED) return true;
|
||||
return false;
|
||||
return getTransactionIsolation() == ti;
|
||||
}
|
||||
|
||||
|
||||
@@ -174,7 +213,7 @@ void SessionImpl::open(const std::string& connect)
|
||||
while (true)
|
||||
{
|
||||
rc = sqlite3_open_v2(connectionString().c_str(), &_pDB,
|
||||
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_URI, NULL);
|
||||
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_URI, nullptr);
|
||||
if (rc == SQLITE_OK) break;
|
||||
if (!_pDB)
|
||||
throw ConnectionFailedException(std::string(sqlite3_errstr(rc)));
|
||||
@@ -201,7 +240,7 @@ void SessionImpl::close()
|
||||
if (_pDB)
|
||||
{
|
||||
sqlite3_close_v2(_pDB);
|
||||
_pDB = 0;
|
||||
_pDB = nullptr;
|
||||
}
|
||||
|
||||
_connected = false;
|
||||
@@ -240,28 +279,23 @@ Poco::Any SessionImpl::getConnectionTimeout(const std::string& prop) const
|
||||
return Poco::Any(_timeout/1000);
|
||||
}
|
||||
|
||||
void SessionImpl::setTransactionType(TransactionType transactionType)
|
||||
void SessionImpl::setTransactionType(TransactionType transactionType)
|
||||
{
|
||||
_transactionType = transactionType;
|
||||
}
|
||||
|
||||
void SessionImpl::setTransactionType(const std::string &prop, const Poco::Any& value)
|
||||
void SessionImpl::setTransactionType(const std::string &prop, const Poco::Any& value)
|
||||
{
|
||||
setTransactionType(Poco::RefAnyCast<TransactionType>(value));
|
||||
}
|
||||
|
||||
Poco::Any SessionImpl::getTransactionType(const std::string& prop) const
|
||||
Poco::Any SessionImpl::getTransactionType(const std::string& prop) const
|
||||
{
|
||||
return Poco::Any(_transactionType);
|
||||
}
|
||||
|
||||
void SessionImpl::autoCommit(const std::string&, bool)
|
||||
{
|
||||
// The problem here is to decide whether to call commit or rollback
|
||||
// when autocommit is set to true. Hence, it is best not to implement
|
||||
// this explicit call and only implicitly support autocommit setting.
|
||||
throw NotImplementedException(
|
||||
"SQLite autocommit is implicit with begin/commit/rollback.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
@@ -138,6 +138,7 @@ Utility::Utility()
|
||||
_types.insert(TypeMap::value_type("TIMESTAMP", MetaColumn::FDT_TIMESTAMP));
|
||||
_types.insert(TypeMap::value_type("UUID", MetaColumn::FDT_UUID));
|
||||
_types.insert(TypeMap::value_type("GUID", MetaColumn::FDT_UUID));
|
||||
_types.insert(TypeMap::value_type("JSON", MetaColumn::FDT_JSON));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+29887
-12296
File diff suppressed because it is too large
Load Diff
+1013
-210
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user