Skip to content

Commit

Permalink
Merge pull request pocoproject#13 in FSF_POCO/upstream from ~LUTKOS/u…
Browse files Browse the repository at this point in the history
…pstream:ms-develop to ms-develop

* commit '2486dc923299b53087135c86a2ac2e059f38be75':
  Linux compilation problems fixed
  Project file update
  Added support for Nullable<T> in out binding
  Prototype for proper support for Keywords::out(Nullable)
  • Loading branch information
Kostya Lutsenko authored and Kostya Lutsenko committed Aug 21, 2015
2 parents e8e635a + 2486dc9 commit 7f6541d
Show file tree
Hide file tree
Showing 21 changed files with 498 additions and 327 deletions.
50 changes: 25 additions & 25 deletions Data/MySQL/include/Poco/Data/MySQL/Binder.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,71 +42,71 @@ class MySQL_API Binder: public Poco::Data::AbstractBinder
virtual ~Binder();
/// Destroys the Binder.

virtual void bind(std::size_t pos, const Poco::Int8& val, Direction dir);
virtual void bind(std::size_t pos, const Poco::Int8& val, Direction dir, const WhenNullCb& nullCb);
/// Binds an Int8.

virtual void bind(std::size_t pos, const Poco::UInt8& val, Direction dir);
virtual void bind(std::size_t pos, const Poco::UInt8& val, Direction dir, const WhenNullCb& nullCb);
/// Binds an UInt8.

virtual void bind(std::size_t pos, const Poco::Int16& val, Direction dir);
virtual void bind(std::size_t pos, const Poco::Int16& val, Direction dir, const WhenNullCb& nullCb);
/// Binds an Int16.

virtual void bind(std::size_t pos, const Poco::UInt16& val, Direction dir);
virtual void bind(std::size_t pos, const Poco::UInt16& val, Direction dir, const WhenNullCb& nullCb);
/// Binds an UInt16.

virtual void bind(std::size_t pos, const Poco::Int32& val, Direction dir);
virtual void bind(std::size_t pos, const Poco::Int32& val, Direction dir, const WhenNullCb& nullCb);
/// Binds an Int32.

virtual void bind(std::size_t pos, const Poco::UInt32& val, Direction dir);
virtual void bind(std::size_t pos, const Poco::UInt32& val, Direction dir, const WhenNullCb& nullCb);
/// Binds an UInt32.

virtual void bind(std::size_t pos, const Poco::Int64& val, Direction dir);
virtual void bind(std::size_t pos, const Poco::Int64& val, Direction dir, const WhenNullCb& nullCb);
/// Binds an Int64.

virtual void bind(std::size_t pos, const Poco::UInt64& val, Direction dir);
virtual void bind(std::size_t pos, const Poco::UInt64& val, Direction dir, const WhenNullCb& nullCb);
/// Binds an UInt64.

#ifndef POCO_LONG_IS_64_BIT

virtual void bind(std::size_t pos, const long& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const long& val, Direction dir, const WhenNullCb& nullCb);
/// Binds a long.

virtual void bind(std::size_t pos, const unsigned long& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const unsigned long& val, Direction dir, const WhenNullCb& nullCb);
/// Binds an unsigned long.

#endif // POCO_LONG_IS_64_BIT

virtual void bind(std::size_t pos, const bool& val, Direction dir);
virtual void bind(std::size_t pos, const bool& val, Direction dir, const WhenNullCb& nullCb);
/// Binds a boolean.

virtual void bind(std::size_t pos, const float& val, Direction dir);
virtual void bind(std::size_t pos, const float& val, Direction dir, const WhenNullCb& nullCb);
/// Binds a float.

virtual void bind(std::size_t pos, const double& val, Direction dir);
virtual void bind(std::size_t pos, const double& val, Direction dir, const WhenNullCb& nullCb);
/// Binds a double.

virtual void bind(std::size_t pos, const char& val, Direction dir);
virtual void bind(std::size_t pos, const char& val, Direction dir, const WhenNullCb& nullCb);
/// Binds a single character.

virtual void bind(std::size_t pos, const std::string& val, Direction dir);
virtual void bind(std::size_t pos, const std::string& val, Direction dir, const WhenNullCb& nullCb);
/// Binds a string.

virtual void bind(std::size_t pos, const Poco::Data::BLOB& val, Direction dir);
virtual void bind(std::size_t pos, const Poco::Data::BLOB& val, Direction dir, const WhenNullCb& nullCb);
/// Binds a BLOB.

virtual void bind(std::size_t pos, const Poco::Data::CLOB& val, Direction dir);
virtual void bind(std::size_t pos, const Poco::Data::CLOB& val, Direction dir, const WhenNullCb& nullCb);
/// Binds a CLOB.

virtual void bind(std::size_t pos, const DateTime& val, Direction dir);
virtual void bind(std::size_t pos, const DateTime& val, Direction dir, const WhenNullCb& nullCb);
/// Binds a DateTime.

virtual void bind(std::size_t pos, const Date& val, Direction dir);
virtual void bind(std::size_t pos, const Date& val, Direction dir, const WhenNullCb& nullCb);
/// Binds a Date.

virtual void bind(std::size_t pos, const Time& val, Direction dir);
virtual void bind(std::size_t pos, const Time& val, Direction dir, const WhenNullCb& nullCb);
/// Binds a Time.

virtual void bind(std::size_t pos, const NullData& val, Direction dir);
virtual void bind(std::size_t pos, const NullData& val, Direction dir, const std::type_info& bindType);
/// Binds a null.


Expand Down Expand Up @@ -212,11 +212,11 @@ class MySQL_API Binder: public Poco::Data::AbstractBinder

virtual void bind(std::size_t pos, const std::list<Time>& val, Direction dir = PD_IN);

virtual void bind(std::size_t pos, const std::vector<NullData>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::vector<NullData>& val, Direction dir, const std::type_info& bindType);

virtual void bind(std::size_t pos, const std::deque<NullData>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::deque<NullData>& val, Direction dir, const std::type_info& bindType);

virtual void bind(std::size_t pos, const std::list<NullData>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::list<NullData>& val, Direction dir, const std::type_info& bindType);

virtual void bind(std::size_t pos, const std::vector<std::string>& val, Direction dir = PD_IN);

Expand All @@ -237,7 +237,7 @@ class MySQL_API Binder: public Poco::Data::AbstractBinder
Binder(const Binder&);
/// Don't copy the binder

virtual void bind(std::size_t, const char* const&, Direction)
virtual void bind(std::size_t, const char* const&, Direction, const WhenNullCb& )
/// Binds a const char ptr.
/// This is a private no-op in this implementation
/// due to security risk.
Expand Down
2 changes: 1 addition & 1 deletion Data/MySQL/include/Poco/Data/MySQL/MySQLStatementImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class MySQL_API MySQLStatementImpl: public Poco::Data::StatementImpl
/// Returns the number of affected rows.
/// Used to find out the number of rows affected by insert, delete or update.

virtual const MetaColumn& metaColumn(std::size_t pos) const;
virtual const MetaColumn& metaColumn(std::size_t pos, std::size_t dataSet) const;
/// Returns column meta data.

virtual bool hasNext();
Expand Down
48 changes: 24 additions & 24 deletions Data/MySQL/src/Binder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,56 +37,56 @@ Binder::~Binder()
}


void Binder::bind(std::size_t pos, const Poco::Int8& val, Direction dir)
void Binder::bind(std::size_t pos, const Poco::Int8& val, Direction dir, const WhenNullCb& nullCb)
{
poco_assert(dir == PD_IN);
realBind(pos, MYSQL_TYPE_TINY, &val, 0);
}


void Binder::bind(std::size_t pos, const Poco::UInt8& val, Direction dir)
void Binder::bind(std::size_t pos, const Poco::UInt8& val, Direction dir, const WhenNullCb& nullCb)
{
poco_assert(dir == PD_IN);
realBind(pos, MYSQL_TYPE_TINY, &val, 0, true);
}


void Binder::bind(std::size_t pos, const Poco::Int16& val, Direction dir)
void Binder::bind(std::size_t pos, const Poco::Int16& val, Direction dir, const WhenNullCb& nullCb)
{
poco_assert(dir == PD_IN);
realBind(pos, MYSQL_TYPE_SHORT, &val, 0);
}


void Binder::bind(std::size_t pos, const Poco::UInt16& val, Direction dir)
void Binder::bind(std::size_t pos, const Poco::UInt16& val, Direction dir, const WhenNullCb& nullCb)
{
poco_assert(dir == PD_IN);
realBind(pos, MYSQL_TYPE_SHORT, &val, 0, true);
}


void Binder::bind(std::size_t pos, const Poco::Int32& val, Direction dir)
void Binder::bind(std::size_t pos, const Poco::Int32& val, Direction dir, const WhenNullCb& nullCb)
{
poco_assert(dir == PD_IN);
realBind(pos, MYSQL_TYPE_LONG, &val, 0);
}


void Binder::bind(std::size_t pos, const Poco::UInt32& val, Direction dir)
void Binder::bind(std::size_t pos, const Poco::UInt32& val, Direction dir, const WhenNullCb& nullCb)
{
poco_assert(dir == PD_IN);
realBind(pos, MYSQL_TYPE_LONG, &val, 0, true);
}


void Binder::bind(std::size_t pos, const Poco::Int64& val, Direction dir)
void Binder::bind(std::size_t pos, const Poco::Int64& val, Direction dir, const WhenNullCb& nullCb)
{
poco_assert(dir == PD_IN);
realBind(pos, MYSQL_TYPE_LONGLONG, &val, 0);
}


void Binder::bind(std::size_t pos, const Poco::UInt64& val, Direction dir)
void Binder::bind(std::size_t pos, const Poco::UInt64& val, Direction dir, const WhenNullCb& nullCb)
{
poco_assert(dir == PD_IN);
realBind(pos, MYSQL_TYPE_LONGLONG, &val, 0, true);
Expand All @@ -95,14 +95,14 @@ 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)
void Binder::bind(std::size_t pos, const long& val, Direction dir, const WhenNullCb& nullCb)
{
poco_assert(dir == PD_IN);
realBind(pos, MYSQL_TYPE_LONG, &val, 0);
}


void Binder::bind(std::size_t pos, const unsigned long& val, Direction dir)
void Binder::bind(std::size_t pos, const unsigned long& val, Direction dir, const WhenNullCb& nullCb)
{
poco_assert(dir == PD_IN);
realBind(pos, MYSQL_TYPE_LONG, &val, 0, true);
Expand All @@ -111,56 +111,56 @@ void Binder::bind(std::size_t pos, const unsigned long& val, Direction dir)
#endif // POCO_LONG_IS_64_BIT


void Binder::bind(std::size_t pos, const bool& val, Direction dir)
void Binder::bind(std::size_t pos, const bool& val, Direction dir, const WhenNullCb& nullCb)
{
poco_assert(dir == PD_IN);
realBind(pos, MYSQL_TYPE_TINY, &val, 0);
}


void Binder::bind(std::size_t pos, const float& val, Direction dir)
void Binder::bind(std::size_t pos, const float& val, Direction dir, const WhenNullCb& nullCb)
{
poco_assert(dir == PD_IN);
realBind(pos, MYSQL_TYPE_FLOAT, &val, 0);
}


void Binder::bind(std::size_t pos, const double& val, Direction dir)
void Binder::bind(std::size_t pos, const double& val, Direction dir, const WhenNullCb& nullCb)
{
poco_assert(dir == PD_IN);
realBind(pos, MYSQL_TYPE_DOUBLE, &val, 0);
}


void Binder::bind(std::size_t pos, const char& val, Direction dir)
void Binder::bind(std::size_t pos, const char& val, Direction dir, const WhenNullCb& nullCb)
{
poco_assert(dir == PD_IN);
realBind(pos, MYSQL_TYPE_TINY, &val, 0);
}


void Binder::bind(std::size_t pos, const std::string& val, Direction dir)
void Binder::bind(std::size_t pos, const std::string& val, Direction dir, const WhenNullCb& nullCb)
{
poco_assert(dir == PD_IN);
realBind(pos, MYSQL_TYPE_STRING, val.c_str(), static_cast<int>(val.length()));
}


void Binder::bind(std::size_t pos, const Poco::Data::BLOB& val, Direction dir)
void Binder::bind(std::size_t pos, const Poco::Data::BLOB& val, Direction dir, const WhenNullCb& nullCb)
{
poco_assert(dir == PD_IN);
realBind(pos, MYSQL_TYPE_BLOB, val.rawContent(), static_cast<int>(val.size()));
}


void Binder::bind(std::size_t pos, const Poco::Data::CLOB& val, Direction dir)
void Binder::bind(std::size_t pos, const Poco::Data::CLOB& val, Direction dir, const WhenNullCb& nullCb)
{
poco_assert(dir == PD_IN);
realBind(pos, MYSQL_TYPE_BLOB, val.rawContent(), static_cast<int>(val.size()));
}


void Binder::bind(std::size_t pos, const DateTime& val, Direction dir)
void Binder::bind(std::size_t pos, const DateTime& val, Direction dir, const WhenNullCb& nullCb)
{
poco_assert(dir == PD_IN);
MYSQL_TIME mt = {0};
Expand All @@ -181,7 +181,7 @@ void Binder::bind(std::size_t pos, const DateTime& val, Direction dir)
}


void Binder::bind(std::size_t pos, const Date& val, Direction dir)
void Binder::bind(std::size_t pos, const Date& val, Direction dir, const WhenNullCb& nullCb)
{
poco_assert(dir == PD_IN);
MYSQL_TIME mt = {0};
Expand All @@ -198,7 +198,7 @@ void Binder::bind(std::size_t pos, const Date& val, Direction dir)
}


void Binder::bind(std::size_t pos, const Time& val, Direction dir)
void Binder::bind(std::size_t pos, const Time& val, Direction dir, const WhenNullCb& nullCb)
{
poco_assert(dir == PD_IN);
MYSQL_TIME mt = {0};
Expand All @@ -215,7 +215,7 @@ void Binder::bind(std::size_t pos, const Time& val, Direction dir)
}


void Binder::bind(std::size_t pos, const NullData&, Direction dir)
void Binder::bind(std::size_t pos, const NullData&, Direction dir, const std::type_info& bindType)
{
poco_assert(dir == PD_IN);
realBind(pos, MYSQL_TYPE_NULL, 0, 0);
Expand Down Expand Up @@ -601,19 +601,19 @@ void Binder::bind(std::size_t pos, const std::list<Poco::Data::Time>& val, Direc
}


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, const std::type_info& bindType)
{
throw NotImplementedException();
}


void Binder::bind(std::size_t pos, const std::deque<Poco::Data::NullData>& val, Direction dir)
void Binder::bind(std::size_t pos, const std::deque<Poco::Data::NullData>& val, Direction dir, const std::type_info& bindType)
{
throw NotImplementedException();
}


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, const std::type_info& bindType)
{
throw NotImplementedException();
}
Expand Down
3 changes: 2 additions & 1 deletion Data/MySQL/src/MySQLStatementImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ std::size_t MySQLStatementImpl::affectedRowCount() const
}


const MetaColumn& MySQLStatementImpl::metaColumn(std::size_t pos) const
const MetaColumn& MySQLStatementImpl::metaColumn(std::size_t pos, size_t dataSet) const
{
poco_assert_dbg(0 == dataSet); // we don't support multiple datasets here
return _metadata.metaColumn(pos);
}

Expand Down

0 comments on commit 7f6541d

Please sign in to comment.