mirror of
https://github.com/pocoproject/poco.git
synced 2025-12-23 22:08:33 +01:00
merge Data changes (ODBC Sybase, PostgreSQL etc)
This commit is contained in:
@@ -43,72 +43,72 @@ public:
|
||||
~Binder();
|
||||
/// Destroys the Binder.
|
||||
|
||||
void bind(std::size_t pos, const Poco::Int8 &val, Direction dir);
|
||||
void bind(std::size_t pos, const Poco::Int8 &val, Direction dir, const WhenNullCb& nullCb);
|
||||
/// Binds an Int8.
|
||||
|
||||
void bind(std::size_t pos, const Poco::UInt8 &val, Direction dir);
|
||||
void bind(std::size_t pos, const Poco::UInt8 &val, Direction dir, const WhenNullCb& nullCb);
|
||||
/// Binds an UInt8.
|
||||
|
||||
void bind(std::size_t pos, const Poco::Int16 &val, Direction dir);
|
||||
void bind(std::size_t pos, const Poco::Int16 &val, Direction dir, const WhenNullCb& nullCb);
|
||||
/// Binds an Int16.
|
||||
|
||||
void bind(std::size_t pos, const Poco::UInt16 &val, Direction dir);
|
||||
void bind(std::size_t pos, const Poco::UInt16 &val, Direction dir, const WhenNullCb& nullCb);
|
||||
/// Binds an UInt16.
|
||||
|
||||
void bind(std::size_t pos, const Poco::Int32 &val, Direction dir);
|
||||
void bind(std::size_t pos, const Poco::Int32 &val, Direction dir, const WhenNullCb& nullCb);
|
||||
/// Binds an Int32.
|
||||
|
||||
void bind(std::size_t pos, const Poco::UInt32 &val, Direction dir);
|
||||
void bind(std::size_t pos, const Poco::UInt32 &val, Direction dir, const WhenNullCb& nullCb);
|
||||
/// Binds an UInt32.
|
||||
|
||||
void bind(std::size_t pos, const Poco::Int64 &val, Direction dir);
|
||||
void bind(std::size_t pos, const Poco::Int64 &val, Direction dir, const WhenNullCb& nullCb);
|
||||
/// Binds an Int64.
|
||||
|
||||
void bind(std::size_t pos, const Poco::UInt64 &val, Direction dir);
|
||||
void bind(std::size_t pos, const Poco::UInt64 &val, Direction dir, const WhenNullCb& nullCb);
|
||||
/// Binds an UInt64.
|
||||
|
||||
#ifndef POCO_LONG_IS_64_BIT
|
||||
void bind(std::size_t pos, const long &val, Direction dir);
|
||||
void bind(std::size_t pos, const long &val, Direction dir, const WhenNullCb& nullCb);
|
||||
/// Binds a long
|
||||
|
||||
void bind(std::size_t pos, const unsigned long &val, Direction dir);
|
||||
void bind(std::size_t pos, const unsigned long &val, Direction dir, const WhenNullCb& nullCb);
|
||||
/// Binds an unsigned long
|
||||
#endif
|
||||
|
||||
void bind(std::size_t pos, const bool &val, Direction dir);
|
||||
void bind(std::size_t pos, const bool &val, Direction dir, const WhenNullCb& nullCb);
|
||||
/// Binds a boolean.
|
||||
|
||||
void bind(std::size_t pos, const float &val, Direction dir);
|
||||
void bind(std::size_t pos, const float &val, Direction dir, const WhenNullCb& nullCb);
|
||||
/// Binds a float.
|
||||
|
||||
void bind(std::size_t pos, const double &val, Direction dir);
|
||||
void bind(std::size_t pos, const double &val, Direction dir, const WhenNullCb& nullCb);
|
||||
/// Binds a double.
|
||||
|
||||
void bind(std::size_t pos, const char &val, Direction dir);
|
||||
void bind(std::size_t pos, const char &val, Direction dir, const WhenNullCb& nullCb);
|
||||
/// Binds a single character.
|
||||
|
||||
void bind(std::size_t pos, const char* const &pVal, Direction dir);
|
||||
void bind(std::size_t pos, const char* const &pVal, Direction dir, const WhenNullCb& nullCb);
|
||||
/// Binds a const char ptr.
|
||||
|
||||
void bind(std::size_t pos, const std::string& val, Direction dir);
|
||||
void bind(std::size_t pos, const std::string& val, Direction dir, const WhenNullCb& nullCb);
|
||||
/// Binds a string.
|
||||
|
||||
void bind(std::size_t pos, const Poco::Data::BLOB& val, Direction dir);
|
||||
void bind(std::size_t pos, const Poco::Data::BLOB& val, Direction dir, const WhenNullCb& nullCb);
|
||||
/// Binds a BLOB.
|
||||
|
||||
void bind(std::size_t pos, const Poco::Data::CLOB& val, Direction dir);
|
||||
void bind(std::size_t pos, const Poco::Data::CLOB& val, Direction dir, const WhenNullCb& nullCb);
|
||||
/// Binds a CLOB.
|
||||
|
||||
void bind(std::size_t pos, const Date& val, Direction dir);
|
||||
void bind(std::size_t pos, const Date& val, Direction dir, const WhenNullCb& nullCb);
|
||||
/// Binds a Date.
|
||||
|
||||
void bind(std::size_t pos, const Time& val, Direction dir);
|
||||
void bind(std::size_t pos, const Time& val, Direction dir, const WhenNullCb& nullCb);
|
||||
/// Binds a Time.
|
||||
|
||||
void bind(std::size_t pos, const DateTime& val, Direction dir);
|
||||
void bind(std::size_t pos, const DateTime& val, Direction dir, const WhenNullCb& nullCb);
|
||||
/// Binds a DateTime.
|
||||
|
||||
void bind(std::size_t pos, const NullData& val, Direction dir);
|
||||
void bind(std::size_t pos, const NullData& val, Direction dir, const std::type_info& bindType);
|
||||
/// Binds a null.
|
||||
|
||||
private:
|
||||
@@ -117,7 +117,7 @@ private:
|
||||
/// if error has occurred.
|
||||
|
||||
template <typename T>
|
||||
void bindLOB(std::size_t pos, const Poco::Data::LOB<T>& val, Direction dir)
|
||||
void bindLOB(std::size_t pos, const Poco::Data::LOB<T>& val, Direction dir, const WhenNullCb& nullCb)
|
||||
{
|
||||
// convert a blob to a an unsigned char* array
|
||||
const T* pData = reinterpret_cast<const T*>(val.rawContent());
|
||||
@@ -134,85 +134,85 @@ private:
|
||||
//
|
||||
// inlines
|
||||
//
|
||||
inline void Binder::bind(std::size_t pos, const Poco::Int8 &val, Direction dir)
|
||||
inline void Binder::bind(std::size_t pos, const Poco::Int8 &val, Direction dir, const WhenNullCb& nullCb)
|
||||
{
|
||||
Poco::Int32 tmp = val;
|
||||
bind(pos, tmp, dir);
|
||||
bind(pos, tmp, dir, nullCb);
|
||||
}
|
||||
|
||||
|
||||
inline void Binder::bind(std::size_t pos, const Poco::UInt8 &val, Direction dir)
|
||||
inline void Binder::bind(std::size_t pos, const Poco::UInt8 &val, Direction dir, const WhenNullCb& nullCb)
|
||||
{
|
||||
Poco::Int32 tmp = val;
|
||||
bind(pos, tmp, dir);
|
||||
bind(pos, tmp, dir, nullCb);
|
||||
}
|
||||
|
||||
|
||||
inline void Binder::bind(std::size_t pos, const Poco::Int16 &val, Direction dir)
|
||||
inline void Binder::bind(std::size_t pos, const Poco::Int16 &val, Direction dir, const WhenNullCb& nullCb)
|
||||
{
|
||||
Poco::Int32 tmp = val;
|
||||
bind(pos, tmp, dir);
|
||||
bind(pos, tmp, dir, nullCb);
|
||||
}
|
||||
|
||||
|
||||
inline void Binder::bind(std::size_t pos, const Poco::UInt16 &val, Direction dir)
|
||||
inline void Binder::bind(std::size_t pos, const Poco::UInt16 &val, Direction dir, const WhenNullCb& nullCb)
|
||||
{
|
||||
Poco::Int32 tmp = val;
|
||||
bind(pos, tmp, dir);
|
||||
bind(pos, tmp, dir, nullCb);
|
||||
}
|
||||
|
||||
|
||||
inline void Binder::bind(std::size_t pos, const Poco::UInt32 &val, Direction dir)
|
||||
inline void Binder::bind(std::size_t pos, const Poco::UInt32 &val, Direction dir, const WhenNullCb& nullCb)
|
||||
{
|
||||
Poco::Int32 tmp = static_cast<Poco::Int32>(val);
|
||||
bind(pos, tmp, dir);
|
||||
bind(pos, tmp, dir, nullCb);
|
||||
}
|
||||
|
||||
|
||||
inline void Binder::bind(std::size_t pos, const Poco::UInt64 &val, Direction dir)
|
||||
inline void Binder::bind(std::size_t pos, const Poco::UInt64 &val, Direction dir, const WhenNullCb& nullCb)
|
||||
{
|
||||
Poco::Int64 tmp = static_cast<Poco::Int64>(val);
|
||||
bind(pos, tmp, dir);
|
||||
bind(pos, tmp, dir, nullCb);
|
||||
}
|
||||
|
||||
|
||||
inline void Binder::bind(std::size_t pos, const bool &val, Direction dir)
|
||||
inline void Binder::bind(std::size_t pos, const bool &val, Direction dir, const WhenNullCb& nullCb)
|
||||
{
|
||||
Poco::Int32 tmp = (val ? 1 : 0);
|
||||
bind(pos, tmp, dir);
|
||||
bind(pos, tmp, dir, nullCb);
|
||||
}
|
||||
|
||||
|
||||
inline void Binder::bind(std::size_t pos, const float &val, Direction dir)
|
||||
inline void Binder::bind(std::size_t pos, const float &val, Direction dir, const WhenNullCb& nullCb)
|
||||
{
|
||||
double tmp = val;
|
||||
bind(pos, tmp, dir);
|
||||
bind(pos, tmp, dir, nullCb);
|
||||
}
|
||||
|
||||
|
||||
inline void Binder::bind(std::size_t pos, const char &val, Direction dir)
|
||||
inline void Binder::bind(std::size_t pos, const char &val, Direction dir, const WhenNullCb& nullCb)
|
||||
{
|
||||
Poco::Int32 tmp = val;
|
||||
bind(pos, tmp, dir);
|
||||
bind(pos, tmp, dir, nullCb);
|
||||
}
|
||||
|
||||
|
||||
inline void Binder::bind(std::size_t pos, const char* const &pVal, Direction dir)
|
||||
inline void Binder::bind(std::size_t pos, const char* const &pVal, Direction dir, const WhenNullCb& nullCb)
|
||||
{
|
||||
std::string val(pVal);
|
||||
bind(pos, val, dir);
|
||||
bind(pos, val, dir, nullCb);
|
||||
}
|
||||
|
||||
|
||||
inline void Binder::bind(std::size_t pos, const Poco::Data::BLOB& val, Direction dir)
|
||||
inline void Binder::bind(std::size_t pos, const Poco::Data::BLOB& val, Direction dir, const WhenNullCb& nullCb)
|
||||
{
|
||||
bindLOB<Poco::Data::BLOB::ValueType>(pos, val, dir);
|
||||
bindLOB<Poco::Data::BLOB::ValueType>(pos, val, dir, nullCb);
|
||||
}
|
||||
|
||||
|
||||
inline void Binder::bind(std::size_t pos, const Poco::Data::CLOB& val, Direction dir)
|
||||
inline void Binder::bind(std::size_t pos, const Poco::Data::CLOB& val, Direction dir, const WhenNullCb& nullCb)
|
||||
{
|
||||
bindLOB<Poco::Data::CLOB::ValueType>(pos, val, dir);
|
||||
bindLOB<Poco::Data::CLOB::ValueType>(pos, val, dir, nullCb);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ protected:
|
||||
/// All changes are counted, even if they are later undone by a ROLLBACK or ABORT.
|
||||
/// Changes associated with creating and dropping tables are not counted.
|
||||
|
||||
const MetaColumn& metaColumn(std::size_t pos) const;
|
||||
const MetaColumn& metaColumn(std::size_t pos, std::size_t dataSet) const;
|
||||
/// Returns column meta data.
|
||||
|
||||
bool hasNext();
|
||||
|
||||
@@ -44,14 +44,14 @@ Binder::~Binder()
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
int rc = sqlite3_bind_int(_pStmt, (int) pos, val);
|
||||
checkReturn(rc);
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
int rc = sqlite3_bind_int64(_pStmt, (int) pos, val);
|
||||
checkReturn(rc);
|
||||
@@ -59,14 +59,14 @@ 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)
|
||||
void Binder::bind(std::size_t pos, const long &val, Direction dir, const WhenNullCb& nullCb)
|
||||
{
|
||||
long tmp = static_cast<long>(val);
|
||||
int rc = sqlite3_bind_int(_pStmt, (int) pos, tmp);
|
||||
checkReturn(rc);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
long tmp = static_cast<long>(val);
|
||||
int rc = sqlite3_bind_int(_pStmt, (int) pos, tmp);
|
||||
@@ -75,45 +75,45 @@ void Binder::bind(std::size_t pos, const unsigned long &val, Direction dir)
|
||||
#endif
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
int rc = sqlite3_bind_double(_pStmt, (int) pos, val);
|
||||
checkReturn(rc);
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
int rc = sqlite3_bind_text(_pStmt, (int) pos, val.c_str(), (int) val.size()*sizeof(char), SQLITE_TRANSIENT);
|
||||
checkReturn(rc);
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
DateTime dt(val.year(), val.month(), val.day());
|
||||
std::string str(DateTimeFormatter::format(dt, Utility::SQLITE_DATE_FORMAT));
|
||||
bind(pos, str, dir);
|
||||
bind(pos, str, dir, nullCb);
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
DateTime dt;
|
||||
dt.assign(dt.year(), dt.month(), dt.day(), val.hour(), val.minute(), val.second());
|
||||
std::string str(DateTimeFormatter::format(dt, Utility::SQLITE_TIME_FORMAT));
|
||||
bind(pos, str, dir);
|
||||
bind(pos, str, dir, nullCb);
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
std::string dt(DateTimeFormatter::format(val, DateTimeFormat::ISO8601_FORMAT));
|
||||
bind(pos, dt, dir);
|
||||
bind(pos, dt, dir, nullCb);
|
||||
}
|
||||
|
||||
|
||||
void Binder::bind(std::size_t pos, const NullData&, Direction)
|
||||
void Binder::bind(std::size_t pos, const NullData&, Direction, const std::type_info& bindType)
|
||||
{
|
||||
sqlite3_bind_null(_pStmt, pos);
|
||||
}
|
||||
|
||||
@@ -302,11 +302,10 @@ std::size_t SQLiteStatementImpl::columnsReturned() const
|
||||
}
|
||||
|
||||
|
||||
const MetaColumn& SQLiteStatementImpl::metaColumn(std::size_t pos) const
|
||||
const MetaColumn& SQLiteStatementImpl::metaColumn(std::size_t pos, std::size_t dataSet) const
|
||||
{
|
||||
std::size_t curDataSet = currentDataSet();
|
||||
poco_assert (pos >= 0 && pos <= _columns[curDataSet].size());
|
||||
return _columns[curDataSet][pos];
|
||||
poco_assert (pos >= 0 && pos <= _columns[dataSet].size());
|
||||
return _columns[dataSet][pos];
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user