fixes for macos/clang

This commit is contained in:
Günter Obiltschnig
2020-01-09 11:53:03 +01:00
parent 1bf40a0cd2
commit 03d1dd9822
41 changed files with 389 additions and 1317 deletions

View File

@@ -6,7 +6,7 @@
include $(POCO_BASE)/build/rules/global
SYSLIBS += -L/usr/local/lib$(LIB64SUFFIX)/mysql -L/usr/lib$(LIB64SUFFIX)/mysql -L/usr/mysql/lib$(LIB64SUFFIX) -L/usr/mysql/lib$(LIB64SUFFIX)/mysql -L/usr/local/mysql/lib$(LIB64SUFFIX) -lmysqlclient
SYSLIBS += -L/usr/local/lib -L/usr/local/lib$(LIB64SUFFIX)/mysql -L/usr/lib$(LIB64SUFFIX)/mysql -L/usr/mysql/lib$(LIB64SUFFIX) -L/usr/mysql/lib$(LIB64SUFFIX)/mysql -L/usr/local/mysql/lib$(LIB64SUFFIX) -lmysqlclient
INCLUDE += -I/usr/local/include/mysql/ -I/usr/include/mysql/ -I/usr/mysql/include/mysql -I/usr/local/mysql/include
SYSFLAGS += -DTHREADSAFE -DNO_TCL

View File

@@ -36,7 +36,7 @@ public:
Binder();
/// Creates the Binder.
virtual ~Binder();
/// Destroys the Binder.
@@ -64,16 +64,12 @@ public:
virtual void bind(std::size_t pos, const Poco::UInt64& val, Direction dir);
/// Binds an UInt64.
#ifndef POCO_LONG_IS_64_BIT
virtual void bind(std::size_t pos, const long& val, Direction dir = PD_IN);
/// Binds a long.
virtual void bind(std::size_t pos, const unsigned long& val, Direction dir = PD_IN);
/// Binds an unsigned long.
#endif // POCO_LONG_IS_64_BIT
virtual void bind(std::size_t pos, const bool& val, Direction dir);
/// Binds a boolean.
@@ -108,7 +104,7 @@ public:
/// Binds a null.
virtual void bind(std::size_t pos, const std::vector<Poco::Int8>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::vector<Poco::Int8>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::deque<Poco::Int8>& val, Direction dir = PD_IN);
@@ -136,25 +132,25 @@ public:
virtual void bind(std::size_t pos, const std::deque<Poco::Int32>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::list<Poco::Int32>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::list<Poco::Int32>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::vector<Poco::UInt32>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::vector<Poco::UInt32>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::deque<Poco::UInt32>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::list<Poco::UInt32>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::list<Poco::UInt32>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::vector<Poco::Int64>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::vector<Poco::Int64>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::deque<Poco::Int64>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::list<Poco::Int64>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::list<Poco::Int64>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::vector<Poco::UInt64>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::vector<Poco::UInt64>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::deque<Poco::UInt64>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::list<Poco::UInt64>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::list<Poco::UInt64>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::vector<bool>& val, Direction dir = PD_IN);
@@ -236,12 +232,12 @@ private:
/// Don't copy the binder
virtual void bind(std::size_t, const char* const&, Direction)
/// Binds a const char ptr.
/// Binds a const char ptr.
/// This is a private no-op in this implementation
/// due to security risk.
{
}
void realBind(std::size_t pos, enum_field_types type, const void* buffer, int length, bool isUnsigned = false);
/// Common bind implementation

View File

@@ -50,42 +50,40 @@ public:
virtual bool extract(std::size_t pos, Poco::Int8& val);
/// Extracts an Int8.
virtual bool extract(std::size_t pos, Poco::UInt8& val);
/// Extracts an UInt8.
virtual bool extract(std::size_t pos, Poco::Int16& val);
/// Extracts an Int16.
virtual bool extract(std::size_t pos, Poco::UInt16& val);
/// Extracts an UInt16.
virtual bool extract(std::size_t pos, Poco::Int32& val);
/// Extracts an Int32.
virtual bool extract(std::size_t pos, Poco::UInt32& val);
/// Extracts an UInt32.
virtual bool extract(std::size_t pos, Poco::Int64& val);
/// Extracts an Int64.
virtual bool extract(std::size_t pos, Poco::UInt64& val);
/// Extracts an UInt64.
#ifndef POCO_LONG_IS_64_BIT
virtual bool extract(std::size_t pos, long& val);
/// Extracts a long. Returns false if null was received.
virtual bool extract(std::size_t pos, unsigned long& val);
/// Extracts an unsigned long. Returns false if null was received.
#endif
virtual bool extract(std::size_t pos, bool& val);
/// Extracts a boolean.
virtual bool extract(std::size_t pos, float& val);
/// Extracts a float.
virtual bool extract(std::size_t pos, double& val);
/// Extracts a double.
@@ -125,7 +123,7 @@ public:
////////////
// Not implemented extract functions
////////////
virtual bool extract(std::size_t pos, std::vector<Poco::Int8>& val);
/// Extracts an Int8 vector.
@@ -198,7 +196,6 @@ public:
virtual bool extract(std::size_t pos, std::list<Poco::UInt64>& val);
/// Extracts an UInt64 list.
#ifndef POCO_LONG_IS_64_BIT
virtual bool extract(std::size_t pos, std::vector<long>& val);
/// Extracts a long vector.
@@ -207,7 +204,6 @@ public:
virtual bool extract(std::size_t pos, std::list<long>& val);
/// Extracts a long list.
#endif
virtual bool extract(std::size_t pos, std::vector<bool>& val);
/// Extracts a boolean vector.
@@ -316,7 +312,7 @@ public:
virtual bool extract(std::size_t pos, std::list<Dynamic::Var>& val);
/// Extracts a Dynamic::Var list.
private:
bool realExtractFixed(std::size_t pos, enum_field_types type, void* buffer, bool isUnsigned = false);

View File

@@ -91,8 +91,6 @@ void Binder::bind(std::size_t pos, const Poco::UInt64& val, Direction dir)
}
#ifndef POCO_LONG_IS_64_BIT
void Binder::bind(std::size_t pos, const long& val, Direction dir)
{
poco_assert(dir == PD_IN);
@@ -106,8 +104,6 @@ void Binder::bind(std::size_t pos, const unsigned long& val, Direction dir)
realBind(pos, MYSQL_TYPE_LONG, &val, 0, true);
}
#endif // POCO_LONG_IS_64_BIT
void Binder::bind(std::size_t pos, const bool& val, Direction dir)
{
@@ -115,7 +111,7 @@ void Binder::bind(std::size_t pos, const bool& val, Direction dir)
realBind(pos, MYSQL_TYPE_TINY, &val, 0);
}
void Binder::bind(std::size_t pos, const float& val, Direction dir)
{
poco_assert(dir == PD_IN);
@@ -268,7 +264,7 @@ MYSQL_BIND* Binder::getBindArray() const
///////////////////
//
// Private
// Private
//
////////////////////
@@ -293,7 +289,7 @@ void Binder::realBind(std::size_t pos, enum_field_types type, const void* buffer
}
void Binder::bind(std::size_t pos, const std::vector<Poco::Int8>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::vector<Poco::Int8>& val, Direction dir)
{
throw NotImplementedException();
}
@@ -305,13 +301,13 @@ void Binder::bind(std::size_t pos, const std::deque<Poco::Int8>& val, Direction
}
void Binder::bind(std::size_t pos, const std::list<Poco::Int8>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::list<Poco::Int8>& val, Direction dir)
{
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::vector<Poco::UInt8>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::vector<Poco::UInt8>& val, Direction dir)
{
throw NotImplementedException();
}
@@ -323,13 +319,13 @@ void Binder::bind(std::size_t pos, const std::deque<Poco::UInt8>& val, Direction
}
void Binder::bind(std::size_t pos, const std::list<Poco::UInt8>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::list<Poco::UInt8>& val, Direction dir)
{
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::vector<Poco::Int16>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::vector<Poco::Int16>& val, Direction dir)
{
throw NotImplementedException();
}
@@ -341,13 +337,13 @@ void Binder::bind(std::size_t pos, const std::deque<Poco::Int16>& val, Direction
}
void Binder::bind(std::size_t pos, const std::list<Poco::Int16>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::list<Poco::Int16>& val, Direction dir)
{
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::vector<Poco::UInt16>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::vector<Poco::UInt16>& val, Direction dir)
{
throw NotImplementedException();
}
@@ -359,13 +355,13 @@ void Binder::bind(std::size_t pos, const std::deque<Poco::UInt16>& val, Directio
}
void Binder::bind(std::size_t pos, const std::list<Poco::UInt16>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::list<Poco::UInt16>& val, Direction dir)
{
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::vector<Poco::Int32>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::vector<Poco::Int32>& val, Direction dir)
{
throw NotImplementedException();
}
@@ -377,13 +373,13 @@ void Binder::bind(std::size_t pos, const std::deque<Poco::Int32>& val, Direction
}
void Binder::bind(std::size_t pos, const std::list<Poco::Int32>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::list<Poco::Int32>& val, Direction dir)
{
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::vector<Poco::UInt32>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::vector<Poco::UInt32>& val, Direction dir)
{
throw NotImplementedException();
}
@@ -395,13 +391,13 @@ void Binder::bind(std::size_t pos, const std::deque<Poco::UInt32>& val, Directio
}
void Binder::bind(std::size_t pos, const std::list<Poco::UInt32>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::list<Poco::UInt32>& val, Direction dir)
{
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::vector<Poco::Int64>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::vector<Poco::Int64>& val, Direction dir)
{
throw NotImplementedException();
}
@@ -413,13 +409,13 @@ void Binder::bind(std::size_t pos, const std::deque<Poco::Int64>& val, Direction
}
void Binder::bind(std::size_t pos, const std::list<Poco::Int64>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::list<Poco::Int64>& val, Direction dir)
{
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::vector<Poco::UInt64>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::vector<Poco::UInt64>& val, Direction dir)
{
throw NotImplementedException();
}
@@ -431,13 +427,13 @@ void Binder::bind(std::size_t pos, const std::deque<Poco::UInt64>& val, Directio
}
void Binder::bind(std::size_t pos, const std::list<Poco::UInt64>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::list<Poco::UInt64>& val, Direction dir)
{
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::vector<bool>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::vector<bool>& val, Direction dir)
{
throw NotImplementedException();
}
@@ -449,13 +445,13 @@ void Binder::bind(std::size_t pos, const std::deque<bool>& val, Direction dir)
}
void Binder::bind(std::size_t pos, const std::list<bool>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::list<bool>& val, Direction dir)
{
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::vector<float>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::vector<float>& val, Direction dir)
{
throw NotImplementedException();
}
@@ -467,13 +463,13 @@ void Binder::bind(std::size_t pos, const std::deque<float>& val, Direction dir)
}
void Binder::bind(std::size_t pos, const std::list<float>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::list<float>& val, Direction dir)
{
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::vector<double>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::vector<double>& val, Direction dir)
{
throw NotImplementedException();
}
@@ -485,13 +481,13 @@ void Binder::bind(std::size_t pos, const std::deque<double>& val, Direction dir)
}
void Binder::bind(std::size_t pos, const std::list<double>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::list<double>& val, Direction dir)
{
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::vector<char>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::vector<char>& val, Direction dir)
{
throw NotImplementedException();
}
@@ -503,13 +499,13 @@ void Binder::bind(std::size_t pos, const std::deque<char>& val, Direction dir)
}
void Binder::bind(std::size_t pos, const std::list<char>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::list<char>& val, Direction dir)
{
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::vector<Poco::Data::BLOB>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::vector<Poco::Data::BLOB>& val, Direction dir)
{
throw NotImplementedException();
}
@@ -521,13 +517,13 @@ void Binder::bind(std::size_t pos, const std::deque<Poco::Data::BLOB>& val, Dire
}
void Binder::bind(std::size_t pos, const std::list<Poco::Data::BLOB>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::list<Poco::Data::BLOB>& val, Direction dir)
{
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::vector<Poco::Data::CLOB>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::vector<Poco::Data::CLOB>& val, Direction dir)
{
throw NotImplementedException();
}
@@ -539,13 +535,13 @@ void Binder::bind(std::size_t pos, const std::deque<Poco::Data::CLOB>& val, Dire
}
void Binder::bind(std::size_t pos, const std::list<Poco::Data::CLOB>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::list<Poco::Data::CLOB>& val, Direction dir)
{
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::vector<Poco::DateTime>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::vector<Poco::DateTime>& val, Direction dir)
{
throw NotImplementedException();
}
@@ -557,13 +553,13 @@ void Binder::bind(std::size_t pos, const std::deque<Poco::DateTime>& val, Direct
}
void Binder::bind(std::size_t pos, const std::list<Poco::DateTime>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::list<Poco::DateTime>& val, Direction dir)
{
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::vector<Poco::Data::Date>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::vector<Poco::Data::Date>& val, Direction dir)
{
throw NotImplementedException();
}
@@ -575,13 +571,13 @@ void Binder::bind(std::size_t pos, const std::deque<Poco::Data::Date>& val, Dire
}
void Binder::bind(std::size_t pos, const std::list<Poco::Data::Date>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::list<Poco::Data::Date>& val, Direction dir)
{
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::vector<Poco::Data::Time>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::vector<Poco::Data::Time>& val, Direction dir)
{
throw NotImplementedException();
}
@@ -593,13 +589,13 @@ void Binder::bind(std::size_t pos, const std::deque<Poco::Data::Time>& val, Dire
}
void Binder::bind(std::size_t pos, const std::list<Poco::Data::Time>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::list<Poco::Data::Time>& val, Direction dir)
{
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::vector<Poco::Data::NullData>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::vector<Poco::Data::NullData>& val, Direction dir)
{
throw NotImplementedException();
}
@@ -611,13 +607,13 @@ void Binder::bind(std::size_t pos, const std::deque<Poco::Data::NullData>& val,
}
void Binder::bind(std::size_t pos, const std::list<Poco::Data::NullData>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::list<Poco::Data::NullData>& val, Direction dir)
{
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::vector<std::string>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::vector<std::string>& val, Direction dir)
{
throw NotImplementedException();
}
@@ -629,7 +625,7 @@ void Binder::bind(std::size_t pos, const std::deque<std::string>& val, Direction
}
void Binder::bind(std::size_t pos, const std::list<std::string>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::list<std::string>& val, Direction dir)
{
throw NotImplementedException();
}

View File

@@ -80,7 +80,6 @@ bool Extractor::extract(std::size_t pos, Poco::UInt64& val)
}
#ifndef POCO_LONG_IS_64_BIT
bool Extractor::extract(std::size_t pos, long& val)
{
return realExtractFixed(pos, MYSQL_TYPE_LONG, &val);
@@ -91,7 +90,6 @@ bool Extractor::extract(std::size_t pos, unsigned long& val)
{
return realExtractFixed(pos, MYSQL_TYPE_LONG, &val, true);
}
#endif
bool Extractor::extract(std::size_t pos, bool& val)
@@ -105,32 +103,32 @@ bool Extractor::extract(std::size_t pos, float& val)
return realExtractFixed(pos, MYSQL_TYPE_FLOAT, &val);
}
bool Extractor::extract(std::size_t pos, double& val)
{
return realExtractFixed(pos, MYSQL_TYPE_DOUBLE, &val);
}
bool Extractor::extract(std::size_t pos, char& val)
{
return realExtractFixed(pos, MYSQL_TYPE_TINY, &val);
}
bool Extractor::extract(std::size_t pos, std::string& val)
{
if (_metadata.columnsReturned() <= pos)
throw MySQLException("Extractor: attempt to extract more parameters, than query result contain");
if (_metadata.isNull(static_cast<Poco::UInt32>(pos)))
return false;
//mysql reports TEXT types as FDT_BLOB when being extracted
MetaColumn::ColumnDataType columnType = _metadata.metaColumn(static_cast<Poco::UInt32>(pos)).type();
if (columnType != Poco::Data::MetaColumn::FDT_STRING && columnType != Poco::Data::MetaColumn::FDT_BLOB)
throw MySQLException("Extractor: not a string");
val.assign(reinterpret_cast<const char*>(_metadata.rawData(pos)), _metadata.length(pos));
return true;
}
@@ -140,13 +138,13 @@ bool Extractor::extract(std::size_t pos, Poco::Data::BLOB& val)
{
if (_metadata.columnsReturned() <= pos)
throw MySQLException("Extractor: attempt to extract more parameters, than query result contain");
if (_metadata.isNull(static_cast<Poco::UInt32>(pos)))
return false;
if (_metadata.metaColumn(static_cast<Poco::UInt32>(pos)).type() != Poco::Data::MetaColumn::FDT_BLOB)
throw MySQLException("Extractor: not a blob");
val.assignRaw(_metadata.rawData(pos), _metadata.length(pos));
return true;
}
@@ -156,13 +154,13 @@ bool Extractor::extract(std::size_t pos, Poco::Data::CLOB& val)
{
if (_metadata.columnsReturned() <= pos)
throw MySQLException("Extractor: attempt to extract more parameters, than query result contain");
if (_metadata.isNull(static_cast<Poco::UInt32>(pos)))
return false;
if (_metadata.metaColumn(static_cast<Poco::UInt32>(pos)).type() != Poco::Data::MetaColumn::FDT_BLOB)
throw MySQLException("Extractor: not a blob");
val.assignRaw(reinterpret_cast<const char*>(_metadata.rawData(pos)), _metadata.length(pos));
return true;
}
@@ -244,7 +242,7 @@ bool Extractor::realExtractFixed(std::size_t pos, enum_field_types type, void* b
bind.buffer_type = type;
bind.buffer = buffer;
bind.is_unsigned = isUnsigned;
if (!_stmt.fetchColumn(pos, &bind))
return false;
@@ -273,8 +271,8 @@ bool Extractor::extract(std::size_t , std::list<Poco::Int8>& )
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::vector<Poco::UInt8>& )
{
throw NotImplementedException("std::vector extractor must be implemented.");
@@ -401,7 +399,6 @@ bool Extractor::extract(std::size_t , std::list<Poco::UInt64>& )
}
#ifndef POCO_LONG_IS_64_BIT
bool Extractor::extract(std::size_t , std::vector<long>& )
{
throw NotImplementedException("std::vector extractor must be implemented.");
@@ -418,7 +415,6 @@ bool Extractor::extract(std::size_t , std::list<long>& )
{
throw NotImplementedException("std::list extractor must be implemented.");
}
#endif
bool Extractor::extract(std::size_t , std::vector<bool>& )

View File

@@ -9,7 +9,7 @@ include $(POCO_BASE)/build/rules/global
INCLUDE += -I./../include -I/usr/local/include/mysql -I/usr/include/mysql/ -I/usr/mysql/include/mysql -I/usr/local/mysql/include
# Note: linking order is important, do not change it.
SYSLIBS += -L/usr/local/lib$(LIB64SUFFIX)/mysql -L/usr/lib$(LIB64SUFFIX)/mysql -L/usr/mysql/lib$(LIB64SUFFIX) -L/usr/mysql/lib$(LIB64SUFFIX)/mysql -L/usr/local/mysql/lib$(LIB64SUFFIX) -lmysqlclient -lz -lpthread -ldl
SYSLIBS += -L/usr/local/lib -L/usr/local/lib$(LIB64SUFFIX)/mysql -L/usr/lib$(LIB64SUFFIX)/mysql -L/usr/mysql/lib$(LIB64SUFFIX) -L/usr/mysql/lib$(LIB64SUFFIX)/mysql -L/usr/local/mysql/lib$(LIB64SUFFIX) -lmysqlclient -lz -lpthread -ldl
objects = MySQLTestSuite Driver MySQLTest SQLExecutor

View File

@@ -42,11 +42,11 @@ Poco::SharedPtr<SQLExecutor> MySQLTest::_pExecutor = 0;
//
// Parameters for barebone-test
#define MYSQL_USER "root"
#define MYSQL_PWD "poco"
#define MYSQL_USER "pocotest"
#define MYSQL_PWD "pocotest"
#define MYSQL_HOST "127.0.0.1"
#define MYSQL_PORT 3306
#define MYSQL_DB "pocotestdb"
#define MYSQL_DB "pocotest"
//
// Connection string

View File

@@ -65,13 +65,11 @@ public:
void bind(std::size_t pos, const Poco::UInt64 &val, Direction dir);
/// Binds an UInt64.
#ifndef POCO_LONG_IS_64_BIT
void bind(std::size_t pos, const long &val, Direction dir);
/// Binds a long
void bind(std::size_t pos, const unsigned long &val, Direction dir);
/// Binds an unsigned long
#endif
void bind(std::size_t pos, const bool &val, Direction dir);
/// Binds a boolean.

View File

@@ -78,13 +78,11 @@ public:
bool extract(std::size_t pos, Poco::UInt64& val);
/// Extracts an UInt64.
#ifndef POCO_LONG_IS_64_BIT
bool extract(std::size_t pos, long& val);
/// Extracts a long.
bool extract(std::size_t pos, unsigned long& val);
/// Extracts an unsigned long.
#endif
bool extract(std::size_t pos, bool& val);
/// Extracts a boolean.
@@ -124,15 +122,15 @@ public:
bool isNull(std::size_t pos, std::size_t row = POCO_DATA_INVALID_ROW);
/// Returns true if the current row value at pos column is null.
/// Because of the loss of information about null-ness of the
/// underlying database values due to the nature of SQLite engine,
/// (once null value is converted to default value, SQLite API
/// Because of the loss of information about null-ness of the
/// underlying database values due to the nature of SQLite engine,
/// (once null value is converted to default value, SQLite API
/// treats it as non-null), a null indicator container member
/// variable is used to cache the indicators of the underlying nulls
/// thus rendering this function idempotent.
/// variable is used to cache the indicators of the underlying nulls
/// thus rendering this function idempotent.
/// The container is a vector of [bool, bool] pairs.
/// The vector index corresponds to the column position, the first
/// bool value in the pair is true if the null indicator has
/// bool value in the pair is true if the null indicator has
/// been set and the second bool value in the pair is true if
/// the column is actually null.
/// The row argument, needed for connectors with bulk capabilities,
@@ -155,112 +153,112 @@ private:
case MetaColumn::FDT_BOOL:
{
bool i = false;
ret = extract(pos, i);
ret = extract(pos, i);
val = i;
break;
}
case MetaColumn::FDT_INT8:
{
Poco::Int8 i = 0;
ret = extract(pos, i);
ret = extract(pos, i);
val = i;
break;
}
case MetaColumn::FDT_UINT8:
{
Poco::UInt8 i = 0;
ret = extract(pos, i);
ret = extract(pos, i);
val = i;
break;
}
case MetaColumn::FDT_INT16:
{
Poco::Int16 i = 0;
ret = extract(pos, i);
ret = extract(pos, i);
val = i;
break;
}
case MetaColumn::FDT_UINT16:
{
Poco::UInt16 i = 0;
ret = extract(pos, i);
ret = extract(pos, i);
val = i;
break;
}
case MetaColumn::FDT_INT32:
{
Poco::Int32 i = 0;
ret = extract(pos, i);
ret = extract(pos, i);
val = i;
break;
}
case MetaColumn::FDT_UINT32:
{
Poco::UInt32 i = 0;
ret = extract(pos, i);
ret = extract(pos, i);
val = i;
break;
}
case MetaColumn::FDT_INT64:
{
Poco::Int64 i = 0;
ret = extract(pos, i);
ret = extract(pos, i);
val = i;
break;
}
case MetaColumn::FDT_UINT64:
{
Poco::UInt64 i = 0;
ret = extract(pos, i);
ret = extract(pos, i);
val = i;
break;
}
case MetaColumn::FDT_STRING:
{
std::string s;
ret = extract(pos, s);
ret = extract(pos, s);
val = s;
break;
}
case MetaColumn::FDT_DOUBLE:
{
double d(0.0);
ret = extract(pos, d);
ret = extract(pos, d);
val = d;
break;
}
case MetaColumn::FDT_FLOAT:
{
float f(0.0);
ret = extract(pos, f);
ret = extract(pos, f);
val = f;
break;
}
case MetaColumn::FDT_BLOB:
{
BLOB b;
ret = extract(pos, b);
ret = extract(pos, b);
val = b;
break;
}
case MetaColumn::FDT_DATE:
{
Date d;
ret = extract(pos, d);
ret = extract(pos, d);
val = d;
break;
}
case MetaColumn::FDT_TIME:
{
Time t;
ret = extract(pos, t);
ret = extract(pos, t);
val = t;
break;
}
case MetaColumn::FDT_TIMESTAMP:
{
DateTime dt;
ret = extract(pos, dt);
ret = extract(pos, dt);
val = dt;
break;
}

View File

@@ -56,7 +56,6 @@ void Binder::bind(std::size_t pos, const Poco::Int64 &val, Direction dir)
}
#ifndef POCO_LONG_IS_64_BIT
void Binder::bind(std::size_t pos, const long &val, Direction dir)
{
long tmp = static_cast<long>(val);
@@ -70,7 +69,6 @@ void Binder::bind(std::size_t pos, const unsigned long &val, Direction dir)
int rc = sqlite3_bind_int(_pStmt, (int) pos, tmp);
checkReturn(rc);
}
#endif
void Binder::bind(std::size_t pos, const double &val, Direction dir)

View File

@@ -63,7 +63,6 @@ bool Extractor::extract(std::size_t pos, Poco::Int64& val)
}
#ifndef POCO_LONG_IS_64_BIT
bool Extractor::extract(std::size_t pos, long& val)
{
if (isNull(pos)) return false;
@@ -78,7 +77,6 @@ bool Extractor::extract(std::size_t pos, unsigned long& val)
val = sqlite3_column_int(_pStmt, (int) pos);
return true;
}
#endif
bool Extractor::extract(std::size_t pos, double& val)
@@ -230,7 +228,7 @@ bool Extractor::isNull(std::size_t pos, std::size_t)
_nulls[pos].first = true;
_nulls[pos].second = (SQLITE_NULL == sqlite3_column_type(_pStmt, static_cast<int>(pos)));
}
return _nulls[pos].second;
}

View File

@@ -140,7 +140,7 @@ public:
virtual void bind(std::size_t pos, const std::list<Poco::UInt32>& val, Direction dir = PD_IN);
/// Binds an UInt32 list.
virtual void bind(std::size_t pos, const Poco::Int64& val, Direction dir = PD_IN) = 0;
/// Binds an Int64.
@@ -165,7 +165,6 @@ public:
virtual void bind(std::size_t pos, const std::list<Poco::UInt64>& val, Direction dir = PD_IN);
/// Binds an UInt64 list.
#ifndef POCO_LONG_IS_64_BIT
virtual void bind(std::size_t pos, const long& val, Direction dir = PD_IN) = 0;
/// Binds a long.
@@ -180,7 +179,6 @@ public:
virtual void bind(std::size_t pos, const std::list<long>& val, Direction dir = PD_IN);
/// Binds a long list.
#endif
virtual void bind(std::size_t pos, const bool& val, Direction dir = PD_IN) = 0;
/// Binds a boolean.
@@ -331,7 +329,7 @@ public:
void bind(std::size_t pos, const Any& val, Direction dir = PD_IN);
/// Binds an Any.
void bind(std::size_t pos, const Poco::Dynamic::Var& val, Direction dir = PD_IN);
/// Binds a Var.

View File

@@ -155,7 +155,6 @@ public:
virtual bool extract(std::size_t pos, std::list<Poco::UInt64>& val);
/// Extracts an UInt64 list.
#ifndef POCO_LONG_IS_64_BIT
virtual bool extract(std::size_t pos, long& val) = 0;
/// Extracts a long. Returns false if null was received.
@@ -170,7 +169,6 @@ public:
virtual bool extract(std::size_t pos, std::list<long>& val);
/// Extracts a long list.
#endif
virtual bool extract(std::size_t pos, bool& val) = 0;
/// Extracts a boolean. Returns false if null was received.

View File

@@ -51,9 +51,9 @@ class Data_API AbstractPreparator
/// (and memory output locations) before extracting data, e.g. ODBC.
/// Extract works as two-phase extract: first we call prepare once, then extract n-times.
/// There are cases (bulk operations using std::vector storage) when extract is called only once.
/// The value passed to a prepare() call is not used by the prepare, serving only as an indication
/// of the data type being prepared, thus all values are passed as const references.
/// Implementing this interface is not mandatory for a connector. Connectors that only extract data
/// The value passed to a prepare() call is not used by the prepare, serving only as an indication
/// of the data type being prepared, thus all values are passed as const references.
/// Implementing this interface is not mandatory for a connector. Connectors that only extract data
/// after SQL execution (e.g. SQLite) do not need this functionality at all.
{
public:
@@ -161,7 +161,6 @@ public:
virtual void prepare(std::size_t pos, const std::list<Poco::UInt64>& val);
/// Prepares an UInt64 list.
#ifndef POCO_LONG_IS_64_BIT
virtual void prepare(std::size_t pos, const long&) = 0;
/// Prepares a long.
@@ -176,7 +175,6 @@ public:
virtual void prepare(std::size_t pos, const std::list<long>& val);
/// Prepares a long list.
#endif
virtual void prepare(std::size_t pos, const bool&) = 0;
/// Prepares a boolean.
@@ -306,7 +304,7 @@ public:
virtual void prepare(std::size_t pos, const std::deque<Time>& val);
/// Prepares a Time deque.
virtual void prepare(std::size_t pos, const std::list<Time>& val);
/// Prepares a Time list.

View File

@@ -211,16 +211,14 @@ inline void swap(LOB<T>& b1, LOB<T>& b2)
namespace std
{
template<>
inline void swap<Poco::Data::BLOB>(Poco::Data::BLOB& b1,
Poco::Data::BLOB& b2)
inline void swap<Poco::Data::BLOB>(Poco::Data::BLOB& b1, Poco::Data::BLOB& b2) noexcept
/// Full template specalization of std:::swap for BLOB
{
b1.swap(b2);
}
template<>
inline void swap<Poco::Data::CLOB>(Poco::Data::CLOB& c1,
Poco::Data::CLOB& c2)
inline void swap<Poco::Data::CLOB>(Poco::Data::CLOB& c1, Poco::Data::CLOB& c2) noexcept
/// Full template specalization of std:::swap for CLOB
{
c1.swap(c2);
@@ -248,7 +246,7 @@ public:
~VarHolderImpl()
{
}
const std::type_info& type() const
{
return typeid(Poco::Data::BLOB);
@@ -263,7 +261,7 @@ public:
{
return cloneHolder(pVarHolder, _val);
}
const Poco::Data::BLOB& value() const
{
return _val;
@@ -286,7 +284,7 @@ public:
~VarHolderImpl()
{
}
const std::type_info& type() const
{
return typeid(Poco::Data::CLOB);
@@ -301,7 +299,7 @@ public:
{
return cloneHolder(pVarHolder, _val);
}
const Poco::Data::CLOB& value() const
{
return _val;

View File

@@ -81,11 +81,11 @@ public:
/// Advances by one position and returns current position.
RowIterator operator ++ (int) const;
/// Advances by one position and returns copy of the iterator with
/// Advances by one position and returns copy of the iterator with
/// previous current position.
const RowIterator& operator -- () const;
/// Goes back by one position and returns copy of the iterator with
/// Goes back by one position and returns copy of the iterator with
/// previous current position.
RowIterator operator -- (int) const;
@@ -105,15 +105,15 @@ private:
RowIterator();
void increment() const;
/// Increments the iterator position by one.
/// Increments the iterator position by one.
/// Throws RangeException if position is out of range.
void decrement() const;
/// Decrements the iterator position by one.
/// Decrements the iterator position by one.
/// Throws RangeException if position is out of range.
void setPosition(std::size_t pos) const;
/// Sets the iterator position.
/// Sets the iterator position.
/// Throws RangeException if position is out of range.
RecordSet* _pRecordSet;
@@ -144,8 +144,7 @@ inline bool RowIterator::operator != (const RowIterator& other) const
namespace std
{
template<>
inline void swap<Poco::Data::RowIterator>(Poco::Data::RowIterator& s1,
Poco::Data::RowIterator& s2)
inline void swap<Poco::Data::RowIterator>(Poco::Data::RowIterator& s1, Poco::Data::RowIterator& s2) noexcept
/// Full template specalization of std:::swap for RowIterator
{
s1.swap(s2);

View File

@@ -40,46 +40,46 @@ class Data_API Session
/// A Session holds a connection to a Database and creates Statement objects.
///
/// Sessions are always created via the SessionFactory:
///
///
/// Session ses(SessionFactory::instance().create(connectorKey, connectionString));
///
///
/// where the first param presents the type of session one wants to create (e.g., for SQLite one would choose "SQLite",
/// for ODBC the key is "ODBC") and the second param is the connection string that the session implementation
/// for ODBC the key is "ODBC") and the second param is the connection string that the session implementation
/// requires to connect to the database. The format of the connection string is specific to the actual connector.
///
/// A simpler form to create the session is to pass the connector key and connection string directly to
/// the Session constructor.
///
/// A concrete example to open an SQLite database stored in the file "dummy.db" would be
///
///
/// Session ses("SQLite", "dummy.db");
///
///
/// Via a Session one can create two different types of statements. First, statements that should only be executed once and immediately, and
/// second, statements that should be executed multiple times, using a separate execute() call.
/// The simple one is immediate execution:
///
///
/// ses << "CREATE TABLE Dummy (data INTEGER(10))", now;
///
/// The now at the end of the statement is required, otherwise the statement
/// would not be executed.
///
///
/// If one wants to reuse a Statement (and avoid the overhead of repeatedly parsing an SQL statement)
/// one uses an explicit Statement object and its execute() method:
///
///
/// int i = 0;
/// Statement stmt = (ses << "INSERT INTO Dummy VALUES(:data)", use(i));
///
///
/// for (i = 0; i < 100; ++i)
/// {
/// stmt.execute();
/// }
///
///
/// The above example assigns the variable i to the ":data" placeholder in the SQL query. The query is parsed and compiled exactly
/// once, but executed 100 times. At the end the values 0 to 99 will be present in the Table "DUMMY".
///
/// A faster implementaton of the above code will simply create a vector of int
/// and use the vector as parameter to the use clause (you could also use set or multiset instead):
///
///
/// std::vector<int> data;
/// for (int i = 0; i < 100; ++i)
/// {
@@ -105,15 +105,15 @@ class Data_API Session
/// }
///
/// The "into" keyword is used to inform the statement where output results should be placed. The limit value ensures
/// that during each run at most 50 rows are retrieved. Assuming Dummy contains 100 rows, retData will contain 50
/// that during each run at most 50 rows are retrieved. Assuming Dummy contains 100 rows, retData will contain 50
/// elements after the first run and 100 after the second run, i.e.
/// the collection is not cleared between consecutive runs. After the second execute stmt.done() will return true.
///
/// A prepared Statement will behave exactly the same but a further call to execute() will simply reset the Statement,
/// A prepared Statement will behave exactly the same but a further call to execute() will simply reset the Statement,
/// execute it again and append more data to the result set.
///
/// Note that it is possible to append several "bind" or "into" clauses to the statement. Theoretically, one could also have several
/// limit clauses but only the last one that was added will be effective.
/// limit clauses but only the last one that was added will be effective.
/// Also several preconditions must be met concerning binds and intos.
/// Take the following example:
///
@@ -123,8 +123,8 @@ class Data_API Session
/// ses << "INSERT INTO Person (LastName, Age) VALUES(:ln, :age)", use(nameVec), use(ageVec);
///
/// The size of all use parameters MUST be the same, otherwise an exception is thrown. Furthermore,
/// the amount of use clauses must match the number of wildcards in the query (to be more precise:
/// each binding has a numberOfColumnsHandled() value which defaults to 1. The sum of all these values
/// the amount of use clauses must match the number of wildcards in the query (to be more precise:
/// each binding has a numberOfColumnsHandled() value which defaults to 1. The sum of all these values
/// must match the wildcard count in the query.
/// However, this is only important if you have written your own TypeHandler specializations.
/// If you plan to map complex object types to tables see the TypeHandler documentation.
@@ -140,13 +140,13 @@ class Data_API Session
///
/// std::vector<Person> people;
/// ses << "SELECT * FROM PERSON", into(people);
///
///
/// Mixing constants or variables with manipulators is allowed provided there are corresponding placeholders for the constants provided in
/// the SQL string, such as in following example:
///
/// std::vector<Person> people;
/// ses << "SELECT * FROM %s", into(people), "PERSON";
///
///
/// Formatting only kicks in if there are values to be injected into the SQL string, otherwise it is skipped.
/// If the formatting will occur and the percent sign is part of the query itself, it can be passed to the query by entering it twice (%%).
/// However, if no formatting is used, one percent sign is sufficient as the string will be passed unaltered.
@@ -203,10 +203,10 @@ public:
void open(const std::string& connect = "");
/// Opens the session using the supplied string.
/// Can also be used with default empty string to
/// Can also be used with default empty string to
/// reconnect a disconnected session.
/// If the connection is not established,
/// a ConnectionFailedException is thrown.
/// If the connection is not established,
/// a ConnectionFailedException is thrown.
/// Zero timout means indefinite
void close();
@@ -267,7 +267,7 @@ public:
static std::string uri(const std::string& connector,
const std::string& connectionString);
/// Utility function that teturns the URI formatted from supplied
/// Utility function that teturns the URI formatted from supplied
/// arguments as "connector:///connectionString".
void setFeature(const std::string& name, bool state);
@@ -278,7 +278,7 @@ public:
///
/// Throws a NotSupportedException if the requested feature is
/// not supported by the underlying implementation.
bool getFeature(const std::string& name) const;
/// Look up the state of a feature.
///
@@ -489,8 +489,7 @@ inline void swap(Session& s1, Session& s2)
namespace std
{
template<>
inline void swap<Poco::Data::Session>(Poco::Data::Session& s1,
Poco::Data::Session& s2)
inline void swap<Poco::Data::Session>(Poco::Data::Session& s1, Poco::Data::Session& s2) noexcept
/// Full template specalization of std:::swap for Session
{
s1.swap(s2);

View File

@@ -258,13 +258,12 @@ public:
Statement& operator , (Poco::Int32 value);
/// Adds the value to the list of values to be supplied to the SQL string formatting function.
#ifndef POCO_LONG_IS_64_BIT
Statement& operator , (long value);
/// Adds the value to the list of values to be supplied to the SQL string formatting function.
Statement& operator , (unsigned long value);
/// Adds the value to the list of values to be supplied to the SQL string formatting function.
#endif
Statement& operator , (Poco::UInt64 value);
/// Adds the value to the list of values to be supplied to the SQL string formatting function.
@@ -573,7 +572,6 @@ inline Statement& Statement::operator , (Poco::Int32 value)
}
#ifndef POCO_LONG_IS_64_BIT
inline Statement& Statement::operator , (long value)
{
return commaPODImpl(value);
@@ -584,7 +582,6 @@ inline Statement& Statement::operator , (unsigned long value)
{
return commaPODImpl(value);
}
#endif
inline Statement& Statement::operator , (Poco::UInt64 value)
@@ -815,8 +812,7 @@ inline void swap(Statement& s1, Statement& s2)
namespace std
{
template<>
inline void swap<Poco::Data::Statement>(Poco::Data::Statement& s1,
Poco::Data::Statement& s2)
inline void swap<Poco::Data::Statement>(Poco::Data::Statement& s1, Poco::Data::Statement& s2) noexcept
/// Full template specalization of std:::swap for Statement
{
s1.swap(s2);

View File

@@ -161,26 +161,25 @@ void AbstractBinder::bind(std::size_t pos, const std::list<Poco::Int64>& val, Di
throw NotImplementedException("std::list binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::vector<Poco::UInt64>& val, Direction dir)
{
throw NotImplementedException("std::vector binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::deque<Poco::UInt64>& val, Direction dir)
{
throw NotImplementedException("std::deque binder must be implemented.");
}
void AbstractBinder::bind(std::size_t pos, const std::list<Poco::UInt64>& val, Direction dir)
{
throw NotImplementedException("std::list binder must be implemented.");
}
#ifndef POCO_LONG_IS_64_BIT
void AbstractBinder::bind(std::size_t pos, const std::vector<long>& val, Direction dir)
{
throw NotImplementedException("std::vector binder must be implemented.");
@@ -197,7 +196,6 @@ void AbstractBinder::bind(std::size_t pos, const std::list<long>& val, Direction
{
throw NotImplementedException("std::list binder must be implemented.");
}
#endif
void AbstractBinder::bind(std::size_t pos, const std::vector<bool>& val, Direction dir)
@@ -426,48 +424,46 @@ void AbstractBinder::bind(std::size_t pos, const Any& val, Direction dir)
{
const std::type_info& type = val.type();
if(type == typeid(Int32))
if (type == typeid(Int32))
bind(pos, RefAnyCast<Int32>(val), dir);
else if(type == typeid(std::string))
else if (type == typeid(std::string))
bind(pos, RefAnyCast<std::string>(val), dir);
else if (type == typeid(Poco::UTF16String))
bind(pos, RefAnyCast<Poco::UTF16String>(val), dir);
else if (type == typeid(bool))
bind(pos, RefAnyCast<bool>(val), dir);
else if(type == typeid(char))
else if (type == typeid(char))
bind(pos, RefAnyCast<char>(val), dir);
else if(type == typeid(Int8))
else if (type == typeid(Int8))
bind(pos, RefAnyCast<Int8>(val), dir);
else if(type == typeid(UInt8))
else if (type == typeid(UInt8))
bind(pos, RefAnyCast<UInt8>(val), dir);
else if(type == typeid(Int16))
else if (type == typeid(Int16))
bind(pos, RefAnyCast<Int16>(val), dir);
else if(type == typeid(UInt16))
else if (type == typeid(UInt16))
bind(pos, RefAnyCast<UInt16>(val), dir);
else if(type == typeid(UInt32))
else if (type == typeid(UInt32))
bind(pos, RefAnyCast<UInt32>(val), dir);
else if(type == typeid(Int64))
else if (type == typeid(Int64))
bind(pos, RefAnyCast<Int64>(val), dir);
else if(type == typeid(UInt64))
else if (type == typeid(UInt64))
bind(pos, RefAnyCast<UInt64>(val), dir);
else if(type == typeid(float))
else if (type == typeid(float))
bind(pos, RefAnyCast<float>(val), dir);
else if(type == typeid(double))
else if (type == typeid(double))
bind(pos, RefAnyCast<double>(val), dir);
else if(type == typeid(DateTime))
else if (type == typeid(DateTime))
bind(pos, RefAnyCast<DateTime>(val), dir);
else if(type == typeid(Date))
else if (type == typeid(Date))
bind(pos, RefAnyCast<Date>(val), dir);
else if(type == typeid(Time))
else if (type == typeid(Time))
bind(pos, RefAnyCast<Time>(val), dir);
else if(type == typeid(BLOB))
else if (type == typeid(BLOB))
bind(pos, RefAnyCast<BLOB>(val), dir);
else if(type == typeid(void))
else if (type == typeid(void))
bind(pos, Keywords::null, dir);
#ifndef POCO_LONG_IS_64_BIT
else if(type == typeid(long))
else if (type == typeid(long))
bind(pos, RefAnyCast<long>(val), dir);
#endif
else
throw UnknownTypeException(std::string(val.type().name()));
}
@@ -477,48 +473,46 @@ void AbstractBinder::bind(std::size_t pos, const Poco::Dynamic::Var& val, Direct
{
const std::type_info& type = val.type();
if(type == typeid(Int32))
if (type == typeid(Int32))
bind(pos, val.extract<Int32>(), dir);
else if(type == typeid(std::string))
else if (type == typeid(std::string))
bind(pos, val.extract<std::string>(), dir);
else if (type == typeid(Poco::UTF16String))
bind(pos, val.extract<Poco::UTF16String>(), dir);
else if (type == typeid(bool))
bind(pos, val.extract<bool>(), dir);
else if(type == typeid(char))
else if (type == typeid(char))
bind(pos, val.extract<char>(), dir);
else if(type == typeid(Int8))
else if (type == typeid(Int8))
bind(pos, val.extract<Int8>(), dir);
else if(type == typeid(UInt8))
else if (type == typeid(UInt8))
bind(pos, val.extract<UInt8>(), dir);
else if(type == typeid(Int16))
else if (type == typeid(Int16))
bind(pos, val.extract<Int16>(), dir);
else if(type == typeid(UInt16))
else if (type == typeid(UInt16))
bind(pos, val.extract<UInt16>(), dir);
else if(type == typeid(UInt32))
else if (type == typeid(UInt32))
bind(pos, val.extract<UInt32>(), dir);
else if(type == typeid(Int64))
else if (type == typeid(Int64))
bind(pos, val.extract<Int64>(), dir);
else if(type == typeid(UInt64))
else if (type == typeid(UInt64))
bind(pos, val.extract<UInt64>(), dir);
else if(type == typeid(float))
else if (type == typeid(float))
bind(pos, val.extract<float>(), dir);
else if(type == typeid(double))
else if (type == typeid(double))
bind(pos, val.extract<double>(), dir);
else if(type == typeid(DateTime))
else if (type == typeid(DateTime))
bind(pos, val.extract<DateTime>(), dir);
else if(type == typeid(Date))
else if (type == typeid(Date))
bind(pos, val.extract<Date>(), dir);
else if(type == typeid(Time))
else if (type == typeid(Time))
bind(pos, val.extract<Time>(), dir);
else if(type == typeid(BLOB))
else if (type == typeid(BLOB))
bind(pos, val.extract<BLOB>(), dir);
else if(type == typeid(void))
else if (type == typeid(void))
bind(pos, Keywords::null, dir);
#ifndef POCO_LONG_IS_64_BIT
else if(type == typeid(long))
else if (type == typeid(long))
bind(pos, val.extract<long>(), dir);
#endif
else
throw UnknownTypeException(std::string(val.type().name()));
}

View File

@@ -174,7 +174,6 @@ bool AbstractExtractor::extract(std::size_t pos, std::list<Poco::UInt64>& val)
}
#ifndef POCO_LONG_IS_64_BIT
bool AbstractExtractor::extract(std::size_t pos, std::vector<long>& val)
{
throw NotImplementedException("std::vector extractor must be implemented.");
@@ -191,7 +190,6 @@ bool AbstractExtractor::extract(std::size_t pos, std::list<long>& val)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
#endif
bool AbstractExtractor::extract(std::size_t pos, std::vector<bool>& val)

View File

@@ -19,7 +19,7 @@ namespace Poco {
namespace Data {
AbstractPreparator::AbstractPreparator(Poco::UInt32 length):
AbstractPreparator::AbstractPreparator(Poco::UInt32 length):
_length(length),
_bulk(false)
{
@@ -175,7 +175,6 @@ void AbstractPreparator::prepare(std::size_t pos, const std::list<Poco::UInt64>&
}
#ifndef POCO_LONG_IS_64_BIT
void AbstractPreparator::prepare(std::size_t pos, const std::vector<long>& val)
{
throw NotImplementedException("std::vector preparator must be implemented.");
@@ -192,7 +191,6 @@ void AbstractPreparator::prepare(std::size_t pos, const std::list<long>& val)
{
throw NotImplementedException("std::list preparator must be implemented.");
}
#endif
void AbstractPreparator::prepare(std::size_t pos, const std::vector<bool>& val)

View File

@@ -68,7 +68,6 @@ void Binder::bind(std::size_t pos, const Poco::UInt64 &val, Direction dir)
}
#ifndef POCO_LONG_IS_64_BIT
void Binder::bind(std::size_t pos, const long& val, Direction dir)
{
}
@@ -77,7 +76,6 @@ void Binder::bind(std::size_t pos, const long& val, Direction dir)
void Binder::bind(std::size_t pos, const unsigned long& val, Direction dir)
{
}
#endif
void Binder::bind(std::size_t pos, const bool &val, Direction dir)

View File

@@ -56,13 +56,11 @@ public:
void bind(std::size_t pos, const Poco::UInt64 &val, Direction dir);
/// Binds an UInt64.
#ifndef POCO_LONG_IS_64_BIT
void bind(std::size_t pos, const long& val, Direction dir);
/// Binds a long.
void bind(std::size_t pos, const unsigned long& val, Direction dir);
/// Binds an unsigned long.
#endif
void bind(std::size_t pos, const bool &val, Direction dir);
/// Binds a boolean.

View File

@@ -77,7 +77,6 @@ bool Extractor::extract(std::size_t pos, Poco::Int64& val)
}
#ifndef POCO_LONG_IS_64_BIT
bool Extractor::extract(std::size_t pos, long& val)
{
val = 0;
@@ -90,7 +89,6 @@ bool Extractor::extract(std::size_t pos, unsigned long& val)
val = 0;
return true;
}
#endif
bool Extractor::extract(std::size_t pos, Poco::UInt64& val)

View File

@@ -62,13 +62,11 @@ public:
bool extract(std::size_t pos, Poco::Dynamic::Var& val);
/// Extracts a Var.
#ifndef POCO_LONG_IS_64_BIT
bool extract(std::size_t pos, long& val);
/// Extracts a long.
bool extract(std::size_t pos, unsigned long& val);
/// Extracts an unsigned long.
#endif
bool extract(std::size_t pos, bool& val);
/// Extracts a boolean.

View File

@@ -68,7 +68,6 @@ void Preparator::prepare(std::size_t pos, const Poco::UInt64&)
}
#ifndef POCO_LONG_IS_64_BIT
void Preparator::prepare(std::size_t pos, const long&)
{
}
@@ -77,7 +76,6 @@ void Preparator::prepare(std::size_t pos, const long&)
void Preparator::prepare(std::size_t pos, const unsigned long&)
{
}
#endif
void Preparator::prepare(std::size_t pos, const bool&)

View File

@@ -57,13 +57,11 @@ public:
void prepare(std::size_t pos, const Poco::UInt64&);
/// Prepares an UInt64.
#ifndef POCO_LONG_IS_64_BIT
void prepare(std::size_t pos, const long&);
/// Prepares a long.
void prepare(std::size_t pos, const unsigned long&);
/// Prepares an unsigned long.
#endif
void prepare(std::size_t pos, const bool&);
/// Prepares a boolean.

View File

@@ -75,7 +75,7 @@ public:
BinaryReader& operator >> (float& value);
BinaryReader& operator >> (double& value);
#if defined(POCO_HAVE_INT64) && !defined(POCO_LONG_IS_64_BIT)
#if defined(POCO_HAVE_INT64)
BinaryReader& operator >> (Int64& value);
BinaryReader& operator >> (UInt64& value);
#endif
@@ -122,22 +122,22 @@ public:
/// the reader for the encountered byte order.
/// A byte-order mark is a 16-bit integer with a value of 0xFEFF,
/// written in host byte order.
bool good();
/// Returns _istr.good();
bool fail();
/// Returns _istr.fail();
bool bad();
/// Returns _istr.bad();
bool eof();
/// Returns _istr.eof();
std::istream& stream() const;
/// Returns the underlying stream.
StreamByteOrder byteOrder() const;
/// Returns the byte-order used by the reader, which is
/// either BIG_ENDIAN_BYTE_ORDER or LITTLE_ENDIAN_BYTE_ORDER.
@@ -150,7 +150,7 @@ public:
private:
std::istream& _istr;
bool _flipBytes;
bool _flipBytes;
TextConverter* _pTextConverter;
};
@@ -212,7 +212,7 @@ inline bool BinaryReader::good()
return _istr.good();
}
inline bool BinaryReader::fail()
{
return _istr.fail();
@@ -236,7 +236,7 @@ inline std::istream& BinaryReader::stream() const
return _istr;
}
inline BinaryReader::StreamByteOrder BinaryReader::byteOrder() const
{
#if defined(POCO_ARCH_BIG_ENDIAN)

View File

@@ -33,7 +33,7 @@ class TextConverter;
class Foundation_API BinaryWriter
/// This class writes basic types (and std::vectors of these)
/// This class writes basic types (and std::vectors of these)
/// in binary form into an output stream.
/// It provides an inserter-based interface similar to ostream.
/// The writer also supports automatic conversion from big-endian
@@ -54,7 +54,7 @@ public:
NETWORK_BYTE_ORDER = 2, /// big-endian (network) byte-order
LITTLE_ENDIAN_BYTE_ORDER = 3 /// little-endian byte-order
};
BinaryWriter(std::ostream& ostr, StreamByteOrder byteOrder = NATIVE_BYTE_ORDER);
/// Creates the BinaryWriter.
@@ -80,7 +80,7 @@ public:
BinaryWriter& operator << (float value);
BinaryWriter& operator << (double value);
#if defined(POCO_HAVE_INT64) && !defined(POCO_LONG_IS_64_BIT)
#if defined(POCO_HAVE_INT64)
BinaryWriter& operator << (Int64 value);
BinaryWriter& operator << (UInt64 value);
#endif
@@ -101,58 +101,58 @@ public:
return *this;
}
void write7BitEncoded(UInt32 value);
/// Writes a 32-bit unsigned integer in a compressed format.
/// The value is written out seven bits at a time, starting
/// with the seven least-significant bits.
/// The high bit of a byte indicates whether there are more bytes to be
/// The value is written out seven bits at a time, starting
/// with the seven least-significant bits.
/// The high bit of a byte indicates whether there are more bytes to be
/// written after this one.
/// If value will fit in seven bits, it takes only one byte of space.
/// If value will not fit in seven bits, the high bit is set on the first byte and
/// written out. value is then shifted by seven bits and the next byte is written.
/// If value will fit in seven bits, it takes only one byte of space.
/// If value will not fit in seven bits, the high bit is set on the first byte and
/// written out. value is then shifted by seven bits and the next byte is written.
/// This process is repeated until the entire integer has been written.
#if defined(POCO_HAVE_INT64)
void write7BitEncoded(UInt64 value);
/// Writes a 64-bit unsigned integer in a compressed format.
/// The value written out seven bits at a time, starting
/// with the seven least-significant bits.
/// The high bit of a byte indicates whether there are more bytes to be
/// The value written out seven bits at a time, starting
/// with the seven least-significant bits.
/// The high bit of a byte indicates whether there are more bytes to be
/// written after this one.
/// If value will fit in seven bits, it takes only one byte of space.
/// If value will not fit in seven bits, the high bit is set on the first byte and
/// written out. value is then shifted by seven bits and the next byte is written.
/// If value will fit in seven bits, it takes only one byte of space.
/// If value will not fit in seven bits, the high bit is set on the first byte and
/// written out. value is then shifted by seven bits and the next byte is written.
/// This process is repeated until the entire integer has been written.
#endif
void writeRaw(const std::string& rawData);
/// Writes the string as-is to the stream.
void writeRaw(const char* buffer, std::streamsize length);
/// Writes length raw bytes from the given buffer to the stream.
void writeBOM();
/// Writes a byte-order mark to the stream. A byte order mark is
/// a 16-bit integer with a value of 0xFEFF, written in host byte-order.
/// A BinaryReader uses the byte-order mark to determine the byte-order
/// a 16-bit integer with a value of 0xFEFF, written in host byte-order.
/// A BinaryReader uses the byte-order mark to determine the byte-order
/// of the stream.
void flush();
/// Flushes the underlying stream.
bool good();
/// Returns _ostr.good();
bool fail();
/// Returns _ostr.fail();
bool bad();
/// Returns _ostr.bad();
std::ostream& stream() const;
/// Returns the underlying stream.
StreamByteOrder byteOrder() const;
/// Returns the byte ordering used by the writer, which is
/// either BIG_ENDIAN_BYTE_ORDER or LITTLE_ENDIAN_BYTE_ORDER.
@@ -169,14 +169,14 @@ class BasicMemoryBinaryWriter: public BinaryWriter
/// A convenient wrapper for using Buffer and MemoryStream with BinarWriter.
{
public:
BasicMemoryBinaryWriter(Buffer<T>& data, StreamByteOrder byteOrder = NATIVE_BYTE_ORDER):
BasicMemoryBinaryWriter(Buffer<T>& data, StreamByteOrder byteOrder = NATIVE_BYTE_ORDER):
BinaryWriter(_ostr, byteOrder),
_data(data),
_ostr(data.begin(), data.capacity())
{
}
BasicMemoryBinaryWriter(Buffer<T>& data, TextEncoding& encoding, StreamByteOrder byteOrder = NATIVE_BYTE_ORDER):
BasicMemoryBinaryWriter(Buffer<T>& data, TextEncoding& encoding, StreamByteOrder byteOrder = NATIVE_BYTE_ORDER):
BinaryWriter(_ostr, encoding, byteOrder),
_data(data),
_ostr(data.begin(), data.capacity())

View File

@@ -40,22 +40,22 @@ class Struct;
class Foundation_API Var
/// Var allows to store data of different types and to convert between these types transparently.
/// Var puts forth the best effort to provide intuitive and reasonable conversion semantics and prevent
/// Var puts forth the best effort to provide intuitive and reasonable conversion semantics and prevent
/// unexpected data loss, particularly when performing narrowing or signedness conversions of numeric data types.
///
/// An attempt to convert or extract from a non-initialized ("empty") Var variable shall result
/// in an exception being thrown.
///
/// Loss of signedness is not allowed for numeric values. This means that if an attempt is made to convert
/// the internal value which is a negative signed integer to an unsigned integer type storage, a RangeException is thrown.
/// Overflow is not allowed, so if the internal value is a larger number than the target numeric type size can accommodate,
/// Loss of signedness is not allowed for numeric values. This means that if an attempt is made to convert
/// the internal value which is a negative signed integer to an unsigned integer type storage, a RangeException is thrown.
/// Overflow is not allowed, so if the internal value is a larger number than the target numeric type size can accommodate,
/// a RangeException is thrown.
///
/// Precision loss, such as in conversion from floating-point types to integers or from double to float on platforms
/// where they differ in size (provided internal actual value fits in float min/max range), is allowed.
///
/// String truncation is allowed -- it is possible to convert between string and character when string length is
/// greater than 1. An empty string gets converted to the char '\0', a non-empty string is truncated to the first character.
///
/// String truncation is allowed -- it is possible to convert between string and character when string length is
/// greater than 1. An empty string gets converted to the char '\0', a non-empty string is truncated to the first character.
///
/// Boolean conversion is performed as follows:
///
@@ -66,18 +66,18 @@ class Foundation_API Var
///
/// Arithmetic operations with POD types as well as between Var's are supported, subject to following
/// limitations:
///
///
/// - for std::string and const char* values, only '+' and '+=' operations are supported
///
///
/// - for integral and floating point numeric values, following operations are supported:
/// '+', '+=', '-', '-=', '*', '*=' , '/' and '/='
/// '+', '+=', '-', '-=', '*', '*=' , '/' and '/='
///
/// - for integral values, following operations are supported:
/// prefix and postfix increment (++) and decrement (--)
///
///
/// - for all other types, InvalidArgumentException is thrown upon attempt of an arithmetic operation
///
/// A Var can be created from and converted to a value of any type for which a specialization of
///
/// A Var can be created from and converted to a value of any type for which a specialization of
/// VarHolderImpl is available. For supported types, see VarHolder documentation.
{
public:
@@ -88,7 +88,7 @@ public:
Var();
/// Creates an empty Var.
template <typename T>
template <typename T>
Var(const T& val)
/// Creates the Var from the given value.
#ifdef POCO_NO_SOO
@@ -125,7 +125,7 @@ public:
Iterator end();
/// Returns the Var iterator.
template <typename T>
template <typename T>
void convert(T& val) const
/// Invoke this method to perform a safe conversion.
///
@@ -147,8 +147,8 @@ public:
pHolder->convert(val);
}
template <typename T>
template <typename T>
T convert() const
/// Invoke this method to perform a safe conversion.
///
@@ -173,12 +173,12 @@ public:
pHolder->convert(result);
return result;
}
template <typename T>
operator T () const
/// Safe conversion operator for implicit type
/// conversions. If the requested type T is same as the
/// type being held, the operation performed is direct
/// conversions. If the requested type T is same as the
/// type being held, the operation performed is direct
/// extraction, otherwise it is the conversion of the value
/// from type currently held to the one requested.
///
@@ -227,7 +227,7 @@ public:
std::string(typeid(T).name())));
}
template <typename T>
template <typename T>
Var& operator = (const T& other)
/// Assignment operator for assigning POD to Var
{
@@ -271,7 +271,7 @@ public:
const Var operator -- (int);
/// Post-decrement operator
template <typename T>
template <typename T>
Var& operator += (const T& other)
/// Addition assignment operator for addition/assignment of POD to Var.
{
@@ -284,7 +284,7 @@ public:
Var& operator += (const char* other);
/// Addition assignment operator overload for const char*
template <typename T>
template <typename T>
const Var operator - (const T& other) const
/// Subtraction operator for subtracting POD from Var
{
@@ -294,7 +294,7 @@ public:
const Var operator - (const Var& other) const;
/// Subtraction operator overload for Var
template <typename T>
template <typename T>
Var& operator -= (const T& other)
/// Subtraction assignment operator
{
@@ -304,7 +304,7 @@ public:
Var& operator -= (const Var& other);
/// Subtraction assignment operator overload for Var
template <typename T>
template <typename T>
const Var operator * (const T& other) const
/// Multiplication operator for multiplying Var with POD
{
@@ -314,7 +314,7 @@ public:
const Var operator * (const Var& other) const;
/// Multiplication operator overload for Var
template <typename T>
template <typename T>
Var& operator *= (const T& other)
/// Multiplication assignment operator
{
@@ -324,7 +324,7 @@ public:
Var& operator *= (const Var& other);
/// Multiplication assignment operator overload for Var
template <typename T>
template <typename T>
const Var operator / (const T& other) const
/// Division operator for dividing Var with POD
{
@@ -334,7 +334,7 @@ public:
const Var operator / (const Var& other) const;
/// Division operator overload for Var
template <typename T>
template <typename T>
Var& operator /= (const T& other)
/// Division assignment operator
{
@@ -344,7 +344,7 @@ public:
Var& operator /= (const Var& other);
/// Division assignment operator specialization for Var
template <typename T>
template <typename T>
bool operator == (const T& other) const
/// Equality operator
{
@@ -358,7 +358,7 @@ public:
bool operator == (const Var& other) const;
/// Equality operator overload for Var
template <typename T>
template <typename T>
bool operator != (const T& other) const
/// Inequality operator
{
@@ -372,7 +372,7 @@ public:
bool operator != (const char* other) const;
/// Inequality operator overload for const char*
template <typename T>
template <typename T>
bool operator < (const T& other) const
/// Less than operator
{
@@ -383,7 +383,7 @@ public:
bool operator < (const Var& other) const;
/// Less than operator overload for Var
template <typename T>
template <typename T>
bool operator <= (const T& other) const
/// Less than or equal operator
{
@@ -394,7 +394,7 @@ public:
bool operator <= (const Var& other) const;
/// Less than or equal operator overload for Var
template <typename T>
template <typename T>
bool operator > (const T& other) const
/// Greater than operator
{
@@ -405,7 +405,7 @@ public:
bool operator > (const Var& other) const;
/// Greater than operator overload for Var
template <typename T>
template <typename T>
bool operator >= (const T& other) const
/// Greater than or equal operator
{
@@ -552,7 +552,7 @@ public:
static std::string toString(const Var& var);
/// Converts the Var to a string in JSON format. Note that toString(const Var&) will return
/// a different result than Var::convert<std::string>() and Var::toString()!
private:
Var& getAt(std::size_t n);
Var& getAt(const std::string& n);
@@ -577,7 +577,7 @@ private:
{
return convert<T>() - other.convert<T>();
}
template <typename T>
T multiply(const Var& other) const
{
@@ -2123,9 +2123,6 @@ inline bool operator != (const char* other, const Var& da)
}
#ifndef POCO_LONG_IS_64_BIT
inline long operator + (const long& other, const Var& da)
/// Addition operator for adding Var to long
{
@@ -2334,9 +2331,6 @@ inline bool operator >= (const unsigned long& other, const Var& da)
}
#endif // POCO_LONG_IS_64_BIT
} // namespace Dynamic

File diff suppressed because it is too large Load Diff

View File

@@ -36,15 +36,15 @@ enum NullType
template <typename C>
class Nullable
/// Nullable is a simple wrapper class for value types
/// that allows objects or native type variables
/// that allows objects or native type variables
/// to have "null" value.
///
/// The class is useful for passing parameters to functions
/// when parameters are optional and no default values
/// when parameters are optional and no default values
/// should be used or when a non-assigned state is needed,
/// such as in e.g. fetching null values from database.
///
/// A Nullable can be default constructed. In this case,
/// A Nullable can be default constructed. In this case,
/// the Nullable will have a Null value and isNull() will
/// return true. Calling value() (without default value) on
/// a Null object will throw a NullValueException.
@@ -58,7 +58,7 @@ class Nullable
/// default construction.
{
public:
Nullable():
Nullable():
/// Creates an empty Nullable.
_value(),
_isNull(true),
@@ -66,7 +66,7 @@ public:
{
}
Nullable(const NullType&):
Nullable(const NullType&):
/// Creates an empty Nullable.
_value(),
_isNull(true),
@@ -74,14 +74,14 @@ public:
{
}
Nullable(const C& value):
Nullable(const C& value):
/// Creates a Nullable with the given value.
_value(value),
_value(value),
_isNull(false),
_null()
{
}
Nullable(const Nullable& other):
/// Creates a Nullable by copying another one.
_value(other._value),
@@ -96,7 +96,7 @@ public:
_isNull(other._isNull),
_null()
{
other.isNull = true;
other._isNull = true;
}
~Nullable()
@@ -111,7 +111,7 @@ public:
_isNull = false;
return *this;
}
Nullable& assign(const Nullable& other)
/// Assigns another Nullable.
{
@@ -119,14 +119,14 @@ public:
swap(tmp);
return *this;
}
Nullable& assign(NullType)
/// Sets value to null.
{
_isNull = true;
return *this;
}
Nullable& operator = (const C& value)
/// Assigns a value to the Nullable.
{
@@ -273,7 +273,7 @@ public:
{
return _isNull;
}
void clear()
/// Clears the Nullable.
{
@@ -295,7 +295,7 @@ inline void swap(Nullable<C>& n1, Nullable<C>& n2)
template <typename C>
std::ostream& operator<<(std::ostream& out, const Nullable<C>& obj)
std::ostream& operator<<(std::ostream& out, const Nullable<C>& obj)
{
if (!obj.isNull()) out << obj.value();
return out;

View File

@@ -61,7 +61,7 @@ public:
static std::string formatHex(int value, bool prefix = false);
/// Formats an int value in hexadecimal notation.
/// If prefix is true, "0x" prefix is prepended to the
/// If prefix is true, "0x" prefix is prepended to the
/// resulting string.
/// The value is treated as unsigned.
@@ -69,7 +69,7 @@ public:
/// Formats a int value in hexadecimal notation,
/// right justified and zero-padded in
/// a field having at least the specified width.
/// If prefix is true, "0x" prefix is prepended to the
/// If prefix is true, "0x" prefix is prepended to the
/// resulting string.
/// The value is treated as unsigned.
@@ -88,14 +88,14 @@ public:
static std::string formatHex(unsigned value, bool prefix = false);
/// Formats an unsigned int value in hexadecimal notation.
/// If prefix is true, "0x" prefix is prepended to the
/// If prefix is true, "0x" prefix is prepended to the
/// resulting string.
static std::string formatHex(unsigned value, int width, bool prefix = false);
/// Formats a int value in hexadecimal notation,
/// right justified and zero-padded in
/// a field having at least the specified width.
/// If prefix is true, "0x" prefix is prepended to the
/// If prefix is true, "0x" prefix is prepended to the
/// resulting string.
static std::string format(long value);
@@ -113,7 +113,7 @@ public:
static std::string formatHex(long value, bool prefix = false);
/// Formats an unsigned long value in hexadecimal notation.
/// If prefix is true, "0x" prefix is prepended to the
/// If prefix is true, "0x" prefix is prepended to the
/// resulting string.
/// The value is treated as unsigned.
@@ -121,7 +121,7 @@ public:
/// Formats an unsigned long value in hexadecimal notation,
/// right justified and zero-padded in a field having at least the
/// specified width.
/// If prefix is true, "0x" prefix is prepended to the
/// If prefix is true, "0x" prefix is prepended to the
/// resulting string.
/// The value is treated as unsigned.
@@ -140,70 +140,18 @@ public:
static std::string formatHex(unsigned long value, bool prefix = false);
/// Formats an unsigned long value in hexadecimal notation.
/// If prefix is true, "0x" prefix is prepended to the
/// If prefix is true, "0x" prefix is prepended to the
/// resulting string.
static std::string formatHex(unsigned long value, int width, bool prefix = false);
/// Formats an unsigned long value in hexadecimal notation,
/// right justified and zero-padded in a field having at least the
/// specified width.
/// If prefix is true, "0x" prefix is prepended to the
/// If prefix is true, "0x" prefix is prepended to the
/// resulting string.
#ifdef POCO_HAVE_INT64
#ifdef POCO_LONG_IS_64_BIT
static std::string format(long long value);
/// Formats a 64-bit integer value in decimal notation.
static std::string format(long long value, int width);
/// Formats a 64-bit integer value in decimal notation,
/// right justified in a field having at least the specified width.
static std::string format0(long long value, int width);
/// Formats a 64-bit integer value in decimal notation,
/// right justified and zero-padded in a field having at least
/// the specified width.
static std::string formatHex(long long value, bool prefix = false);
/// Formats a 64-bit integer value in hexadecimal notation.
/// If prefix is true, "0x" prefix is prepended to the
/// resulting string.
/// The value is treated as unsigned.
static std::string formatHex(long long value, int width, bool prefix = false);
/// Formats a 64-bit integer value in hexadecimal notation,
/// right justified and zero-padded in a field having at least
/// the specified width.
/// The value is treated as unsigned.
/// If prefix is true, "0x" prefix is prepended to the resulting string.
static std::string format(unsigned long long value);
/// Formats an unsigned 64-bit integer value in decimal notation.
static std::string format(unsigned long long value, int width);
/// Formats an unsigned 64-bit integer value in decimal notation,
/// right justified in a field having at least the specified width.
static std::string format0(unsigned long long value, int width);
/// Formats an unsigned 64-bit integer value in decimal notation,
/// right justified and zero-padded in a field having at least the
/// specified width.
static std::string formatHex(unsigned long long value, bool prefix = false);
/// Formats a 64-bit integer value in hexadecimal notation.
/// If prefix is true, "0x" prefix is prepended to the
/// resulting string.
static std::string formatHex(unsigned long long value, int width, bool prefix = false);
/// Formats a 64-bit integer value in hexadecimal notation,
/// right justified and zero-padded in a field having at least
/// the specified width. If prefix is true, "0x" prefix is
/// prepended to the resulting string.
#else // ifndef POCO_LONG_IS_64_BIT
static std::string format(Int64 value);
/// Formats a 64-bit integer value in decimal notation.
@@ -218,7 +166,7 @@ public:
static std::string formatHex(Int64 value, bool prefix = false);
/// Formats a 64-bit integer value in hexadecimal notation.
/// If prefix is true, "0x" prefix is prepended to the
/// If prefix is true, "0x" prefix is prepended to the
/// resulting string.
/// The value is treated as unsigned.
@@ -243,7 +191,7 @@ public:
static std::string formatHex(UInt64 value, bool prefix = false);
/// Formats a 64-bit integer value in hexadecimal notation.
/// If prefix is true, "0x" prefix is prepended to the
/// If prefix is true, "0x" prefix is prepended to the
/// resulting string.
static std::string formatHex(UInt64 value, int width, bool prefix = false);
@@ -252,8 +200,6 @@ public:
/// the specified width. If prefix is true, "0x" prefix is
/// prepended to the resulting string.
#endif // ifdef POCO_LONG_IS_64_BIT
#endif // ifdef POCO_HAVE_INT64
static std::string format(float value);
@@ -381,52 +327,6 @@ public:
#ifdef POCO_HAVE_INT64
#ifdef POCO_LONG_IS_64_BIT
static void append(std::string& str, long long value);
/// Formats a 64-bit integer value in decimal notation.
static void append(std::string& str, long long value, int width);
/// Formats a 64-bit integer value in decimal notation,
/// right justified in a field having at least the specified width.
static void append0(std::string& str, long long value, int width);
/// Formats a 64-bit integer value in decimal notation,
/// right justified and zero-padded in a field having at least
/// the specified width.
static void appendHex(std::string& str, long long value);
/// Formats a 64-bit integer value in hexadecimal notation.
/// The value is treated as unsigned.
static void appendHex(std::string& str, long long value, int width);
/// Formats a 64-bit integer value in hexadecimal notation,
/// right justified and zero-padded in a field having at least
/// the specified width.
/// The value is treated as unsigned.
static void append(std::string& str, unsigned long long value);
/// Formats an unsigned 64-bit integer value in decimal notation.
static void append(std::string& str, unsigned long long value, int width);
/// Formats an unsigned 64-bit integer value in decimal notation,
/// right justified in a field having at least the specified width.
static void append0(std::string& str, unsigned long long value, int width);
/// Formats an unsigned 64-bit integer value in decimal notation,
/// right justified and zero-padded in a field having at least the
/// specified width.
static void appendHex(std::string& str, unsigned long long value);
/// Formats a 64-bit integer value in hexadecimal notation.
static void appendHex(std::string& str, unsigned long long value, int width);
/// Formats a 64-bit integer value in hexadecimal notation,
/// right justified and zero-padded in a field having at least
/// the specified width.
#else // ifndef POCO_LONG_IS_64_BIT
static void append(std::string& str, Int64 value);
/// Formats a 64-bit integer value in decimal notation.
@@ -469,8 +369,6 @@ public:
/// right justified and zero-padded in a field having at least
/// the specified width.
#endif // ifdef POCO_LONG_IS_64_BIT
#endif // ifdef POCO_HAVE_INT64
static void append(std::string& str, float value);
@@ -674,91 +572,6 @@ inline std::string NumberFormatter::formatHex(unsigned long value, int width, bo
#ifdef POCO_HAVE_INT64
#ifdef POCO_LONG_IS_64_BIT
inline std::string NumberFormatter::format(long long value)
{
std::string result;
intToStr(value, 10, result);
return result;
}
inline std::string NumberFormatter::format(long long value, int width)
{
std::string result;
intToStr(value, 10, result, false, width, ' ');
return result;
}
inline std::string NumberFormatter::format0(long long value, int width)
{
std::string result;
intToStr(value, 10, result, false, width, '0');
return result;
}
inline std::string NumberFormatter::formatHex(long long value, bool prefix)
{
std::string result;
uIntToStr(static_cast<unsigned long long>(value), 0x10, result, prefix);
return result;
}
inline std::string NumberFormatter::formatHex(long long value, int width, bool prefix)
{
std::string result;
uIntToStr(static_cast<unsigned long long>(value), 0x10, result, prefix, width, '0');
return result;
}
inline std::string NumberFormatter::format(unsigned long long value)
{
std::string result;
uIntToStr(value, 10, result);
return result;
}
inline std::string NumberFormatter::format(unsigned long long value, int width)
{
std::string result;
uIntToStr(value, 10, result, false, width, ' ');
return result;
}
inline std::string NumberFormatter::format0(unsigned long long value, int width)
{
std::string result;
uIntToStr(value, 10, result, false, width, '0');
return result;
}
inline std::string NumberFormatter::formatHex(unsigned long long value, bool prefix)
{
std::string result;
uIntToStr(value, 0x10, result, prefix);
return result;
}
inline std::string NumberFormatter::formatHex(unsigned long long value, int width, bool prefix)
{
std::string result;
uIntToStr(value, 0x10, result, prefix, width, '0');
return result;
}
#else // ifndef POCO_LONG_IS_64_BIT
inline std::string NumberFormatter::format(Int64 value)
{
@@ -840,8 +653,6 @@ inline std::string NumberFormatter::formatHex(UInt64 value, int width, bool pref
}
#endif // ifdef POCO_LONG_IS_64_BIT
#endif // ifdef POCO_HAVE_INT64

View File

@@ -34,10 +34,8 @@
#include <locale>
#endif
#ifndef uintmax_t
#if defined(POCO_NOINTMAX)
typedef Poco::UInt64 uintmax_t;
#endif
#ifndef intmax_t
typedef Poco::Int64 intmax_t;
#endif
#if !defined (INTMAX_MAX)
@@ -314,7 +312,7 @@ namespace Impl {
Ptr(char* ptr, std::size_t offset): _beg(ptr), _cur(ptr), _end(ptr + offset)
{
}
char*& operator ++ () // prefix
{
checkBounds(_cur + 1);
@@ -327,7 +325,7 @@ namespace Impl {
char* tmp = _cur++;
return tmp;
}
char*& operator -- () // prefix
{
checkBounds(_cur - 1);
@@ -372,7 +370,7 @@ namespace Impl {
const char* _beg;
char* _cur;
const char* _end;
};
};
} // namespace Impl
@@ -477,7 +475,7 @@ bool uIntToStr(T value,
*result = '\0';
return false;
}
Impl::Ptr ptr(result, size);
int thCount = 0;
T tmpVal;
@@ -492,31 +490,31 @@ bool uIntToStr(T value,
thCount = 0;
}
} while (value);
if ('0' == fill)
{
if (prefix && base == 010) --width;
if (prefix && base == 0x10) width -= 2;
while ((ptr - result) < width) *ptr++ = fill;
}
if (prefix && base == 010) *ptr++ = '0';
else if (prefix && base == 0x10)
{
*ptr++ = 'x';
*ptr++ = '0';
}
if ('0' != fill)
{
while ((ptr - result) < width) *ptr++ = fill;
}
size = ptr - result;
poco_assert_dbg (size <= ptr.span());
poco_assert_dbg ((-1 == width) || (size >= size_t(width)));
*ptr-- = '\0';
char* ptrr = result;
char tmp;
while(ptrr < ptr)
@@ -525,7 +523,7 @@ bool uIntToStr(T value,
*ptr-- = *ptrr;
*ptrr++ = tmp;
}
return true;
}
@@ -541,8 +539,8 @@ bool intToStr (T number, unsigned short base, std::string& result, bool prefix =
result.assign(res, size);
return ret;
}
template <typename T>
bool uIntToStr (T number, unsigned short base, std::string& result, bool prefix = false, int width = -1, char fill = ' ', char thSep = 0)
/// Converts unsigned integer to string; This is a wrapper function, for details see see the

View File

@@ -170,7 +170,7 @@ BinaryReader& BinaryReader::operator >> (double& value)
}
#if defined(POCO_HAVE_INT64) && !defined(POCO_LONG_IS_64_BIT)
#if defined(POCO_HAVE_INT64)
BinaryReader& BinaryReader::operator >> (Int64& value)

View File

@@ -212,7 +212,7 @@ BinaryWriter& BinaryWriter::operator << (double value)
}
#if defined(POCO_HAVE_INT64) && !defined(POCO_LONG_IS_64_BIT)
#if defined(POCO_HAVE_INT64)
BinaryWriter& BinaryWriter::operator << (Int64 value)
@@ -271,7 +271,7 @@ BinaryWriter& BinaryWriter::operator << (const std::string& value)
BinaryWriter& BinaryWriter::operator << (const char* value)
{
poco_check_ptr (value);
if (_pTextConverter)
{
std::string converted;

View File

@@ -23,7 +23,7 @@
#if defined(_MSC_VER) || defined(__MINGW32__)
#define I64_FMT "I64"
#elif defined(__APPLE__)
#elif defined(__APPLE__)
#define I64_FMT "q"
#else
#define I64_FMT "ll"
@@ -236,101 +236,6 @@ void NumberFormatter::appendHex(std::string& str, unsigned long value, int width
#ifdef POCO_HAVE_INT64
#ifdef POCO_LONG_IS_64_BIT
void NumberFormatter::append(std::string& str, long long value)
{
char result[NF_MAX_INT_STRING_LEN];
std::size_t sz = NF_MAX_INT_STRING_LEN;
intToStr(value, 10, result, sz);
str.append(result, sz);
}
void NumberFormatter::append(std::string& str, long long value, int width)
{
char result[NF_MAX_INT_STRING_LEN];
std::size_t sz = NF_MAX_INT_STRING_LEN;
intToStr(value, 10, result, sz, false, width, '0');
str.append(result, sz);
}
void NumberFormatter::append0(std::string& str, long long value, int width)
{
char result[NF_MAX_INT_STRING_LEN];
std::size_t sz = NF_MAX_INT_STRING_LEN;
intToStr(value, 10, result, sz, false, width, '0');
str.append(result, sz);
}
void NumberFormatter::appendHex(std::string& str, long long value)
{
char result[NF_MAX_INT_STRING_LEN];
std::size_t sz = NF_MAX_INT_STRING_LEN;
uIntToStr(static_cast<unsigned long long>(value), 0x10, result, sz);
str.append(result, sz);
}
void NumberFormatter::appendHex(std::string& str, long long value, int width)
{
char result[NF_MAX_INT_STRING_LEN];
std::size_t sz = NF_MAX_INT_STRING_LEN;
uIntToStr(static_cast<unsigned long long>(value), 0x10, result, sz, false, width, '0');
str.append(result, sz);
}
void NumberFormatter::append(std::string& str, unsigned long long value)
{
char result[NF_MAX_INT_STRING_LEN];
std::size_t sz = NF_MAX_INT_STRING_LEN;
uIntToStr(value, 10, result, sz);
str.append(result, sz);
}
void NumberFormatter::append(std::string& str, unsigned long long value, int width)
{
char result[NF_MAX_INT_STRING_LEN];
std::size_t sz = NF_MAX_INT_STRING_LEN;
uIntToStr(value, 10, result, sz, false, width, '0');
str.append(result, sz);
}
void NumberFormatter::append0(std::string& str, unsigned long long value, int width)
{
char result[NF_MAX_INT_STRING_LEN];
std::size_t sz = NF_MAX_INT_STRING_LEN;
uIntToStr(value, 10, result, sz, false, width, '0');
str.append(result, sz);
}
void NumberFormatter::appendHex(std::string& str, unsigned long long value)
{
char result[NF_MAX_INT_STRING_LEN];
std::size_t sz = NF_MAX_INT_STRING_LEN;
uIntToStr(value, 0x10, result, sz);
str.append(result, sz);
}
void NumberFormatter::appendHex(std::string& str, unsigned long long value, int width)
{
char result[NF_MAX_INT_STRING_LEN];
std::size_t sz = NF_MAX_INT_STRING_LEN;
uIntToStr(value, 0x10, result, sz, false, width, '0');
str.append(result, sz);
}
#else // ifndef POCO_LONG_IS_64_BIT
void NumberFormatter::append(std::string& str, Int64 value)
{
@@ -422,8 +327,6 @@ void NumberFormatter::appendHex(std::string& str, UInt64 value, int width)
}
#endif // ifdef POCO_LONG_IS_64_BIT
#endif // ifdef POCO_HAVE_INT64

View File

@@ -599,7 +599,7 @@ std::string Path::configHome()
#endif
}
std::string Path::dataHome()
{
#if defined(POCO_OS_FAMILY_UNIX) || defined(POCO_OS_FAMILY_WINDOWS)
@@ -609,7 +609,7 @@ std::string Path::dataHome()
#endif
}
std::string Path::tempHome()
{
#if defined(POCO_OS_FAMILY_UNIX) || defined(POCO_OS_FAMILY_WINDOWS)
@@ -619,7 +619,7 @@ std::string Path::tempHome()
#endif
}
std::string Path::cacheHome()
{
#if defined(POCO_OS_FAMILY_UNIX) || defined(POCO_OS_FAMILY_WINDOWS)
@@ -1077,8 +1077,8 @@ std::string Path::transcode(const std::string& path)
return std::string(buffer.begin(), buffer.size());
}
}
return path;
#endif
return path;
}

View File

@@ -70,7 +70,7 @@ void ChannelTest::testSplitter()
void ChannelTest::testAsync()
{
AutoPtr<TestChannel> pChannel = new TestChannel;
AutoPtr<AsyncChannel> pAsync = new AsyncChannel(pChannel.get());
AutoPtr<AsyncChannel> pAsync = new AsyncChannel(pChannel);
pAsync->open();
Message msg;
pAsync->log(msg);
@@ -84,7 +84,7 @@ void ChannelTest::testFormatting()
{
AutoPtr<TestChannel> pChannel = new TestChannel;
AutoPtr<Formatter> pFormatter = new SimpleFormatter;
AutoPtr<FormattingChannel> pFormatterChannel = new FormattingChannel(pFormatter, pChannel.get());
AutoPtr<FormattingChannel> pFormatterChannel = new FormattingChannel(pFormatter, pChannel);
Message msg("Source", "Text", Message::PRIO_INFORMATION);
pFormatterChannel->log(msg);
assertTrue (pChannel->list().size() == 1);
@@ -96,7 +96,7 @@ void ChannelTest::testConsole()
{
AutoPtr<ConsoleChannel> pChannel = new ConsoleChannel;
AutoPtr<Formatter> pFormatter = new SimpleFormatter;
AutoPtr<FormattingChannel> pFormatterChannel = new FormattingChannel(pFormatter, pChannel.get());
AutoPtr<FormattingChannel> pFormatterChannel = new FormattingChannel(pFormatter, pChannel);
Message msg("Source", "Text", Message::PRIO_INFORMATION);
pFormatterChannel->log(msg);
}
@@ -107,7 +107,7 @@ void ChannelTest::testStream()
std::ostringstream str;
AutoPtr<StreamChannel> pChannel = new StreamChannel(str);
AutoPtr<Formatter> pFormatter = new SimpleFormatter;
AutoPtr<FormattingChannel> pFormatterChannel = new FormattingChannel(pFormatter, pChannel.get());
AutoPtr<FormattingChannel> pFormatterChannel = new FormattingChannel(pFormatter, pChannel);
Message msg("Source", "Text", Message::PRIO_INFORMATION);
pFormatterChannel->log(msg);
assertTrue (str.str().find("Source: Text") == 0);

View File

@@ -233,23 +233,23 @@ void JSONTest::testNumber64Property()
Var test = object.get("test");
assertTrue (test.isInteger());
Poco::Int64 value = test;
assertTrue (value == -5000000000000000);
assertTrue (value == -5000000000000000ll);
DynamicStruct ds = object;
assertTrue (!ds["test"].isEmpty());
assertTrue (ds["test"].isNumeric());
assertTrue (ds["test"].isInteger());
assertTrue (ds["test"] == -5000000000000000);
assertTrue (ds["test"] == -5000000000000000ll);
value = ds["test"];
assertTrue (value == -5000000000000000);
assertTrue (value == -5000000000000000ll);
const DynamicStruct& rds = object;
assertTrue (!rds["test"].isEmpty());
assertTrue (rds["test"].isNumeric());
assertTrue (rds["test"].isInteger());
assertTrue (rds["test"] == -5000000000000000);
assertTrue (rds["test"] == -5000000000000000ll);
value = rds["test"];
assertTrue (value == -5000000000000000);
assertTrue (value == -5000000000000000ll);
}
@@ -277,12 +277,11 @@ void JSONTest::testUnsignedNumber64Property()
assertTrue (test.isInteger());
Poco::UInt64 value = test;
assertTrue (value == -1);
/* TODO: clang has trouble here
DynamicStruct ds = *object;
assertTrue (!ds["test"].isEmpty());
assertTrue (ds["test"].isNumeric());
assertTrue (ds["test"].isInteger());
assertTrue (ds["test"] == 18446744073709551615);
assertTrue (ds["test"] == 18446744073709551615ull);
value = ds["test"];
assertTrue (value == -1);
@@ -290,10 +289,9 @@ void JSONTest::testUnsignedNumber64Property()
assertTrue (!rds["test"].isEmpty());
assertTrue (rds["test"].isNumeric());
assertTrue (rds["test"].isInteger());
assertTrue (rds["test"] == 18446744073709551615);
assertTrue (rds["test"] == 18446744073709551615ull);
value = rds["test"];
assertTrue (value == -1);
*/
}
#endif
@@ -401,7 +399,7 @@ void JSONTest::testEmptyPropertyName()
const DynamicStruct& rds = *object;
assertTrue (rds.size() == 1);
assertTrue (ds[""] == 42);
}

View File

@@ -696,7 +696,7 @@ void ServerApplication::handleUMask(const std::string& name, const std::string&
for (const auto ch: value)
{
mask *= 8;
if (*it >= '0' && ch <= '7')
if (ch >= '0' && ch <= '7')
mask += ch - '0';
else
throw Poco::InvalidArgumentException("umask contains non-octal characters", value);