[SF 2272430] BLOB and CLOB

Renamed:
(Abstract)Preparation => (Abstract)Preparator
(Abstract)Prepare => (Abstract)Preparation
This commit is contained in:
Aleksandar Fabijanic
2008-11-24 00:38:23 +00:00
parent 161e49a6d4
commit a42e8d919b
75 changed files with 2616 additions and 2832 deletions

View File

@@ -41,7 +41,7 @@
#include "Poco/Data/MySQL/MySQL.h"
#include "Poco/Data/AbstractBinder.h"
#include "Poco/Data/BLOB.h"
#include "Poco/Data/LOB.h"
#include "Poco/Data/MySQL/MySQLException.h"
#include <mysql.h>
@@ -104,10 +104,13 @@ public:
virtual void bind(std::size_t pos, const std::string& val, Direction dir);
/// Binds a string.
virtual void bind(std::size_t pos, const Poco::Data::BLOB& val, Direction dir);
/// Binds a BLOB.
virtual void bind(std::size_t pos, const Poco::Data::CLOB& val, Direction dir);
/// Binds a CLOB.
virtual void bind(std::size_t pos, const DateTime& val, Direction dir);
/// Binds a DateTime.
@@ -199,6 +202,12 @@ public:
virtual void bind(std::size_t pos, const std::list<BLOB>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::vector<CLOB>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::deque<CLOB>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::list<CLOB>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::vector<DateTime>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::deque<DateTime>& val, Direction dir = PD_IN);
@@ -235,8 +244,8 @@ public:
MYSQL_BIND* getBindArray() const;
/// Return array
//void updateDates();
/// Update linked times
//void updateDates();
/// Update linked times
private:
@@ -253,7 +262,7 @@ private:
private:
std::vector<MYSQL_BIND> _bindArray;
std::vector<MYSQL_TIME> _dates;
std::vector<MYSQL_TIME> _dates;
};

View File

@@ -44,10 +44,15 @@
#include "Poco/Data/MySQL/StatementExecutor.h"
#include "Poco/Data/MySQL/ResultMetadata.h"
#include "Poco/Data/AbstractExtractor.h"
#include "Poco/Data/BLOB.h"
#include "Poco/Data/LOB.h"
namespace Poco {
namespace Dynamic {
class Var;
}
namespace Data {
namespace MySQL {
@@ -100,16 +105,19 @@ public:
virtual bool extract(std::size_t pos, double& val);
/// Extracts a double.
virtual bool extract(std::size_t pos, char& val);
/// Extracts a single character.
virtual bool extract(std::size_t pos, std::string& val);
/// Extracts a string.
virtual bool extract(std::size_t pos, Poco::Data::BLOB& val);
/// Extracts a BLOB.
virtual bool extract(std::size_t pos, Poco::Data::CLOB& val);
/// Extracts a CLOB.
virtual bool extract(std::size_t pos, DateTime& val);
/// Extracts a DateTime. Returns false if null was received.
@@ -122,8 +130,8 @@ public:
virtual bool extract(std::size_t pos, Any& val);
/// Extracts an Any. Returns false if null was received.
virtual bool extract(std::size_t pos, DynamicAny& val);
/// Extracts a DynamicAny. Returns false if null was received.
virtual bool extract(std::size_t pos, Dynamic::Var& val);
/// Extracts a Dynamic::Var. Returns false if null was received.
virtual bool isNull(std::size_t col, std::size_t row);
/// Returns true if the value at [col,row] position is null.
@@ -131,7 +139,7 @@ public:
virtual void reset();
/// Resets any information internally cached by the extractor.
////////////
////////////
// Not implemented extract functions
////////////
@@ -272,6 +280,15 @@ public:
virtual bool extract(std::size_t pos, std::list<BLOB>& val);
/// Extracts a BLOB list.
virtual bool extract(std::size_t pos, std::vector<CLOB>& val);
/// Extracts a CLOB vector.
virtual bool extract(std::size_t pos, std::deque<CLOB>& val);
/// Extracts a CLOB deque.
virtual bool extract(std::size_t pos, std::list<CLOB>& val);
/// Extracts a CLOB list.
virtual bool extract(std::size_t pos, std::vector<DateTime>& val);
/// Extracts a DateTime vector.
@@ -308,14 +325,14 @@ public:
virtual bool extract(std::size_t pos, std::list<Any>& val);
/// Extracts an Any list.
virtual bool extract(std::size_t pos, std::vector<DynamicAny>& val);
/// Extracts a DynamicAny vector.
virtual bool extract(std::size_t pos, std::vector<Dynamic::Var>& val);
/// Extracts a Dynamic::Var vector.
virtual bool extract(std::size_t pos, std::deque<DynamicAny>& val);
/// Extracts a DynamicAny deque.
virtual bool extract(std::size_t pos, std::deque<Dynamic::Var>& val);
/// Extracts a Dynamic::Var deque.
virtual bool extract(std::size_t pos, std::list<DynamicAny>& val);
/// Extracts a DynamicAny list.
virtual bool extract(std::size_t pos, std::list<Dynamic::Var>& val);
/// Extracts a Dynamic::Var list.
private:

View File

@@ -112,9 +112,9 @@ private:
};
StatementExecutor _stmt;
ResultMetadata _metadata;
Binder _binder;
Extractor _extractor;
ResultMetadata _metadata;
Binder _binder;
Extractor _extractor;
int _hasNext;
};

View File

@@ -70,7 +70,7 @@ public:
std::size_t length(std::size_t pos) const;
/// Returns the length.
const char* rawData(std::size_t pos) const;
const unsigned char* rawData(std::size_t pos) const;
/// Returns raw data.
bool isNull(std::size_t pos) const;

View File

@@ -45,7 +45,7 @@ namespace MySQL {
Binder::Binder()
{
}
Binder::~Binder()
{
@@ -54,56 +54,56 @@ Binder::~Binder()
void Binder::bind(std::size_t pos, const Poco::Int8& val, Direction dir)
{
poco_assert(dir == PD_IN);
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)
{
poco_assert(dir == PD_IN);
poco_assert(dir == PD_IN);
realBind(pos, MYSQL_TYPE_TINY, &val, 0);
}
}
void Binder::bind(std::size_t pos, const Poco::Int16& val, Direction dir)
{
poco_assert(dir == PD_IN);
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)
{
poco_assert(dir == PD_IN);
poco_assert(dir == PD_IN);
realBind(pos, MYSQL_TYPE_SHORT, &val, 0);
}
void Binder::bind(std::size_t pos, const Poco::Int32& val, Direction dir)
{
poco_assert(dir == PD_IN);
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)
{
poco_assert(dir == PD_IN);
poco_assert(dir == PD_IN);
realBind(pos, MYSQL_TYPE_LONG, &val, 0);
}
void Binder::bind(std::size_t pos, const Poco::Int64& val, Direction dir)
{
poco_assert(dir == PD_IN);
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)
{
poco_assert(dir == PD_IN);
poco_assert(dir == PD_IN);
realBind(pos, MYSQL_TYPE_LONGLONG, &val, 0);
}
@@ -111,111 +111,118 @@ 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);
realBind(pos, MYSQL_TYPE_LONGLONG, &val, 0);
poco_assert(dir == PD_IN);
realBind(pos, MYSQL_TYPE_LONGLONG, &val, 0);
}
#endif
void Binder::bind(std::size_t pos, const bool& val, Direction dir)
{
poco_assert(dir == PD_IN);
poco_assert(dir == PD_IN);
realBind(pos, MYSQL_TYPE_TINY, &val, 0);
}
void Binder::bind(std::size_t pos, const float& val, Direction dir)
{
poco_assert(dir == PD_IN);
poco_assert(dir == PD_IN);
realBind(pos, MYSQL_TYPE_FLOAT, &val, 0);
}
void Binder::bind(std::size_t pos, const double& val, Direction dir)
{
poco_assert(dir == PD_IN);
poco_assert(dir == PD_IN);
realBind(pos, MYSQL_TYPE_DOUBLE, &val, 0);
}
void Binder::bind(std::size_t pos, const char& val, Direction dir)
{
poco_assert(dir == PD_IN);
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)
{
poco_assert(dir == PD_IN);
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)
{
poco_assert(dir == PD_IN);
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)
{
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)
{
poco_assert(dir == PD_IN);
MYSQL_TIME mt = {0};
poco_assert(dir == PD_IN);
MYSQL_TIME mt = {0};
mt.year = val.year();
mt.month = val.month();
mt.day = val.day();
mt.hour = val.hour();
mt.minute = val.minute();
mt.second = val.second();
mt.second_part = val.millisecond();
mt.time_type = MYSQL_TIMESTAMP_DATETIME;
_dates.push_back(mt);
realBind(pos, MYSQL_TYPE_DATETIME, &_dates.back(), sizeof(mt));
mt.year = val.year();
mt.month = val.month();
mt.day = val.day();
mt.hour = val.hour();
mt.minute = val.minute();
mt.second = val.second();
mt.second_part = val.millisecond();
mt.time_type = MYSQL_TIMESTAMP_DATETIME;
_dates.push_back(mt);
realBind(pos, MYSQL_TYPE_DATETIME, &_dates.back(), sizeof(mt));
}
void Binder::bind(std::size_t pos, const Date& val, Direction dir)
{
poco_assert(dir == PD_IN);
MYSQL_TIME mt = {0};
poco_assert(dir == PD_IN);
MYSQL_TIME mt = {0};
mt.year = val.year();
mt.month = val.month();
mt.day = val.day();
mt.year = val.year();
mt.month = val.month();
mt.day = val.day();
_dates.push_back(mt);
realBind(pos, MYSQL_TYPE_DATE, &_dates.back(), sizeof(mt));
_dates.push_back(mt);
realBind(pos, MYSQL_TYPE_DATE, &_dates.back(), sizeof(mt));
}
void Binder::bind(std::size_t pos, const Time& val, Direction dir)
{
poco_assert(dir == PD_IN);
MYSQL_TIME mt = {0};
poco_assert(dir == PD_IN);
MYSQL_TIME mt = {0};
mt.hour = val.hour();
mt.minute = val.minute();
mt.second = val.second();
mt.hour = val.hour();
mt.minute = val.minute();
mt.second = val.second();
mt.time_type = MYSQL_TIMESTAMP_TIME;
_dates.push_back(mt);
realBind(pos, MYSQL_TYPE_TIME, &_dates.back(), sizeof(mt));
mt.time_type = MYSQL_TIMESTAMP_TIME;
_dates.push_back(mt);
realBind(pos, MYSQL_TYPE_TIME, &_dates.back(), sizeof(mt));
}
void Binder::bind(std::size_t pos, const NullData&, Direction dir)
{
poco_assert(dir == PD_IN);
realBind(pos, MYSQL_TYPE_NULL, 0, 0);
poco_assert(dir == PD_IN);
realBind(pos, MYSQL_TYPE_NULL, 0, 0);
}
@@ -238,31 +245,31 @@ MYSQL_BIND* Binder::getBindArray() const
/*void Binder::updateDates()
{
for (size_t i = 0; i < _dates.size(); i++)
{
switch (_dates[i].mt.time_type)
{
case MYSQL_TIMESTAMP_DATE:
_dates[i].mt.year = _dates[i].link.date->year();
_dates[i].mt.month = _dates[i].link.date->month();
_dates[i].mt.day = _dates[i].link.date->day();
break;
case MYSQL_TIMESTAMP_DATETIME:
_dates[i].mt.year = _dates[i].link.dateTime->year();
_dates[i].mt.month = _dates[i].link.dateTime->month();
_dates[i].mt.day = _dates[i].link.dateTime->day();
_dates[i].mt.hour = _dates[i].link.dateTime->hour();
_dates[i].mt.minute = _dates[i].link.dateTime->minute();
_dates[i].mt.second = _dates[i].link.dateTime->second();
_dates[i].mt.second_part = _dates[i].link.dateTime->millisecond();
break;
case MYSQL_TIMESTAMP_TIME:
_dates[i].mt.hour = _dates[i].link.time->hour();
_dates[i].mt.minute = _dates[i].link.time->minute();
_dates[i].mt.second = _dates[i].link.time->second();
break;
}
}
for (size_t i = 0; i < _dates.size(); i++)
{
switch (_dates[i].mt.time_type)
{
case MYSQL_TIMESTAMP_DATE:
_dates[i].mt.year = _dates[i].link.date->year();
_dates[i].mt.month = _dates[i].link.date->month();
_dates[i].mt.day = _dates[i].link.date->day();
break;
case MYSQL_TIMESTAMP_DATETIME:
_dates[i].mt.year = _dates[i].link.dateTime->year();
_dates[i].mt.month = _dates[i].link.dateTime->month();
_dates[i].mt.day = _dates[i].link.dateTime->day();
_dates[i].mt.hour = _dates[i].link.dateTime->hour();
_dates[i].mt.minute = _dates[i].link.dateTime->minute();
_dates[i].mt.second = _dates[i].link.dateTime->second();
_dates[i].mt.second_part = _dates[i].link.dateTime->millisecond();
break;
case MYSQL_TIMESTAMP_TIME:
_dates[i].mt.hour = _dates[i].link.time->hour();
_dates[i].mt.minute = _dates[i].link.time->minute();
_dates[i].mt.second = _dates[i].link.time->second();
break;
}
}
}*/
///////////////////
@@ -284,7 +291,7 @@ void Binder::realBind(std::size_t pos, enum_field_types type, const void* buffer
MYSQL_BIND b = {0};
b.buffer_type = type;
b.buffer = const_cast<void*>(buffer);
b.buffer = const_cast<void*>(buffer);
b.buffer_length = length;
_bindArray[pos] = b;
@@ -293,325 +300,343 @@ 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)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::deque<Poco::Int8>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::list<Poco::Int8>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::vector<Poco::UInt8>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::deque<Poco::UInt8>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::list<Poco::UInt8>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::vector<Poco::Int16>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::deque<Poco::Int16>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::list<Poco::Int16>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::vector<Poco::UInt16>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::deque<Poco::UInt16>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::list<Poco::UInt16>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::vector<Poco::Int32>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::deque<Poco::Int32>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::list<Poco::Int32>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::vector<Poco::UInt32>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::deque<Poco::UInt32>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::list<Poco::UInt32>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::vector<Poco::Int64>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::deque<Poco::Int64>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::list<Poco::Int64>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::vector<Poco::UInt64>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::deque<Poco::UInt64>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::list<Poco::UInt64>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::vector<bool>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::deque<bool>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::list<bool>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::vector<float>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::deque<float>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::list<float>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::vector<double>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::deque<double>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::list<double>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::vector<char>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::deque<char>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::list<char>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::vector<Poco::Data::BLOB>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::deque<Poco::Data::BLOB>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::list<Poco::Data::BLOB>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::vector<Poco::Data::CLOB>& val, Direction dir)
{
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::deque<Poco::Data::CLOB>& val, Direction dir)
{
throw NotImplementedException();
}
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)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::deque<Poco::DateTime>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::list<Poco::DateTime>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::vector<Poco::Data::Date>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::deque<Poco::Data::Date>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::list<Poco::Data::Date>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::vector<Poco::Data::Time>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::deque<Poco::Data::Time>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::list<Poco::Data::Time>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::vector<Poco::Data::NullData>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::deque<Poco::Data::NullData>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::list<Poco::Data::NullData>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::vector<std::string>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::deque<std::string>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}
void Binder::bind(std::size_t pos, const std::list<std::string>& val, Direction dir)
{
throw NotImplementedException();
throw NotImplementedException();
}

View File

@@ -53,201 +53,217 @@ Extractor::~Extractor()
{
}
bool Extractor::extract(std::size_t pos, Poco::Int8& val)
{
return realExtractFixed(pos, MYSQL_TYPE_TINY, &val);
return realExtractFixed(pos, MYSQL_TYPE_TINY, &val);
}
bool Extractor::extract(std::size_t pos, Poco::UInt8& val)
{
return realExtractFixed(pos, MYSQL_TYPE_TINY, &val);
return realExtractFixed(pos, MYSQL_TYPE_TINY, &val);
}
bool Extractor::extract(std::size_t pos, Poco::Int16& val)
{
return realExtractFixed(pos, MYSQL_TYPE_SHORT, &val);
return realExtractFixed(pos, MYSQL_TYPE_SHORT, &val);
}
bool Extractor::extract(std::size_t pos, Poco::UInt16& val)
{
return realExtractFixed(pos, MYSQL_TYPE_SHORT, &val);
return realExtractFixed(pos, MYSQL_TYPE_SHORT, &val);
}
bool Extractor::extract(std::size_t pos, Poco::Int32& val)
{
return realExtractFixed(pos, MYSQL_TYPE_LONG, &val);
return realExtractFixed(pos, MYSQL_TYPE_LONG, &val);
}
bool Extractor::extract(std::size_t pos, Poco::UInt32& val)
{
return realExtractFixed(pos, MYSQL_TYPE_LONG, &val);
return realExtractFixed(pos, MYSQL_TYPE_LONG, &val);
}
bool Extractor::extract(std::size_t pos, Poco::Int64& val)
{
return realExtractFixed(pos, MYSQL_TYPE_LONGLONG, &val);
return realExtractFixed(pos, MYSQL_TYPE_LONGLONG, &val);
}
bool Extractor::extract(std::size_t pos, Poco::UInt64& val)
{
return realExtractFixed(pos, MYSQL_TYPE_LONGLONG, &val);
return realExtractFixed(pos, MYSQL_TYPE_LONGLONG, &val);
}
#ifndef POCO_LONG_IS_64_BIT
bool Extractor::extract(std::size_t pos, long& val)
/// Extracts a long. Returns false if null was received.
{
return realExtractFixed(pos, MYSQL_TYPE_LONGLONG, &val);
return realExtractFixed(pos, MYSQL_TYPE_LONGLONG, &val);
}
#endif
bool Extractor::extract(std::size_t pos, bool& val)
{
return realExtractFixed(pos, MYSQL_TYPE_TINY, &val);
return realExtractFixed(pos, MYSQL_TYPE_TINY, &val);
}
bool Extractor::extract(std::size_t pos, float& val)
{
return realExtractFixed(pos, MYSQL_TYPE_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);
return realExtractFixed(pos, MYSQL_TYPE_DOUBLE, &val);
}
bool Extractor::extract(std::size_t pos, char& val)
{
return realExtractFixed(pos, MYSQL_TYPE_TINY, &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 paremeters, than query result contain");
if (_metadata.isNull(static_cast<Poco::UInt32>(pos)))
if (_metadata.columnsReturned() <= pos)
throw MySQLException("Extractor: attempt to extract more paremeters, 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_STRING)
throw MySQLException("Extractor: not a string");
val.assign(_metadata.rawData(pos), _metadata.length(pos));
return true;
if (_metadata.metaColumn(static_cast<Poco::UInt32>(pos)).type() != Poco::Data::MetaColumn::FDT_STRING)
throw MySQLException("Extractor: not a string");
val.assign(reinterpret_cast<const char*>(_metadata.rawData(pos)), _metadata.length(pos));
return true;
}
bool Extractor::extract(std::size_t pos, Poco::Data::BLOB& val)
{
if (_metadata.columnsReturned() <= pos)
throw MySQLException("Extractor: attempt to extract more paremeters, than query result contain");
if (_metadata.isNull(static_cast<Poco::UInt32>(pos)))
if (_metadata.columnsReturned() <= pos)
throw MySQLException("Extractor: attempt to extract more paremeters, 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;
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;
}
bool Extractor::extract(std::size_t pos, Poco::Data::CLOB& val)
{
if (_metadata.columnsReturned() <= pos)
throw MySQLException("Extractor: attempt to extract more paremeters, 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;
}
bool Extractor::extract(std::size_t pos, DateTime& val)
{
MYSQL_TIME mt = {0};
MYSQL_TIME mt = {0};
if (!realExtractFixed(pos, MYSQL_TYPE_DATETIME, &mt))
return false;
if (!realExtractFixed(pos, MYSQL_TYPE_DATETIME, &mt))
return false;
val.assign(mt.year, mt.month, mt.day, mt.hour, mt.minute, mt.second, mt.second_part, 0);
return true;
val.assign(mt.year, mt.month, mt.day, mt.hour, mt.minute, mt.second, mt.second_part, 0);
return true;
}
bool Extractor::extract(std::size_t pos, Date& val)
{
MYSQL_TIME mt = {0};
MYSQL_TIME mt = {0};
if (!realExtractFixed(pos, MYSQL_TYPE_DATE, &mt))
return false;
if (!realExtractFixed(pos, MYSQL_TYPE_DATE, &mt))
return false;
val.assign(mt.year, mt.month, mt.day);
return true;
val.assign(mt.year, mt.month, mt.day);
return true;
}
bool Extractor::extract(std::size_t pos, Time& val)
{
MYSQL_TIME mt = {0};
MYSQL_TIME mt = {0};
if (!realExtractFixed(pos, MYSQL_TYPE_TIME, &mt))
return false;
if (!realExtractFixed(pos, MYSQL_TYPE_TIME, &mt))
return false;
val.assign(mt.hour, mt.minute, mt.second);
return true;
val.assign(mt.hour, mt.minute, mt.second);
return true;
}
bool Extractor::extract(std::size_t pos, Any& val)
{
return false;
return false;
}
bool Extractor::extract(std::size_t pos, DynamicAny& val)
bool Extractor::extract(std::size_t pos, Dynamic::Var& val)
{
return false;
return false;
}
bool Extractor::isNull(std::size_t col, std::size_t row)
{
poco_assert(row == POCO_DATA_INVALID_ROW);
poco_assert(row == POCO_DATA_INVALID_ROW);
if (_metadata.columnsReturned() <= col)
throw MySQLException("Extractor: attempt to extract more paremeters, than query result contain");
if (_metadata.columnsReturned() <= col)
throw MySQLException("Extractor: attempt to extract more paremeters, than query result contain");
if (_metadata.isNull(static_cast<Poco::UInt32>(col)))
return true;
if (_metadata.isNull(static_cast<Poco::UInt32>(col)))
return true;
return false;
return false;
}
void Extractor::reset()
{
AbstractExtractor::reset();
AbstractExtractor::reset();
}
bool Extractor::realExtractFixed(std::size_t pos, enum_field_types type, void* buffer, size_t length)
{
MYSQL_BIND bind = {0};
my_bool isNull = 0;
MYSQL_BIND bind = {0};
my_bool isNull = 0;
bind.is_null = &isNull;
bind.buffer_type = type;
bind.buffer = buffer;
bind.buffer_length = static_cast<unsigned long>(length);
if (!_stmt.fetchColumn(pos, &bind))
return false;
bind.is_null = &isNull;
bind.buffer_type = type;
bind.buffer = buffer;
bind.buffer_length = static_cast<unsigned long>(length);
if (!_stmt.fetchColumn(pos, &bind))
return false;
return isNull == 0;
return isNull == 0;
}
@@ -258,363 +274,381 @@ bool Extractor::realExtractFixed(std::size_t pos, enum_field_types type, void* b
bool Extractor::extract(std::size_t , std::vector<Poco::Int8>& )
{
throw NotImplementedException("std::vector extractor must be implemented.");
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<Poco::Int8>& )
{
throw NotImplementedException("std::deque extractor must be implemented.");
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<Poco::Int8>& )
{
throw NotImplementedException("std::list extractor must be implemented.");
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.");
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<Poco::UInt8>& )
{
throw NotImplementedException("std::deque extractor must be implemented.");
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<Poco::UInt8>& )
{
throw NotImplementedException("std::list extractor must be implemented.");
throw NotImplementedException("std::list extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::vector<Poco::Int16>& )
{
throw NotImplementedException("std::vector extractor must be implemented.");
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<Poco::Int16>& )
{
throw NotImplementedException("std::deque extractor must be implemented.");
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<Poco::Int16>& )
{
throw NotImplementedException("std::list extractor must be implemented.");
throw NotImplementedException("std::list extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::vector<Poco::UInt16>& )
{
throw NotImplementedException("std::vector extractor must be implemented.");
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<Poco::UInt16>& )
{
throw NotImplementedException("std::deque extractor must be implemented.");
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<Poco::UInt16>& )
{
throw NotImplementedException("std::list extractor must be implemented.");
throw NotImplementedException("std::list extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::vector<Poco::Int32>& )
{
throw NotImplementedException("std::vector extractor must be implemented.");
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<Poco::Int32>& )
{
throw NotImplementedException("std::deque extractor must be implemented.");
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<Poco::Int32>& )
{
throw NotImplementedException("std::list extractor must be implemented.");
throw NotImplementedException("std::list extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::vector<Poco::UInt32>& )
{
throw NotImplementedException("std::vector extractor must be implemented.");
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<Poco::UInt32>& )
{
throw NotImplementedException("std::deque extractor must be implemented.");
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<Poco::UInt32>& )
{
throw NotImplementedException("std::list extractor must be implemented.");
throw NotImplementedException("std::list extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::vector<Poco::Int64>& )
{
throw NotImplementedException("std::vector extractor must be implemented.");
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<Poco::Int64>& )
{
throw NotImplementedException("std::deque extractor must be implemented.");
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<Poco::Int64>& )
{
throw NotImplementedException("std::list extractor must be implemented.");
throw NotImplementedException("std::list extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::vector<Poco::UInt64>& )
{
throw NotImplementedException("std::vector extractor must be implemented.");
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<Poco::UInt64>& )
{
throw NotImplementedException("std::deque extractor must be implemented.");
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<Poco::UInt64>& )
{
throw NotImplementedException("std::list extractor must be implemented.");
throw NotImplementedException("std::list extractor must be implemented.");
}
#ifndef POCO_LONG_IS_64_BIT
bool Extractor::extract(std::size_t , std::vector<long>& )
{
throw NotImplementedException("std::vector extractor must be implemented.");
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<long>& )
{
throw NotImplementedException("std::deque extractor must be implemented.");
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<long>& )
{
throw NotImplementedException("std::list extractor must be implemented.");
throw NotImplementedException("std::list extractor must be implemented.");
}
#endif
bool Extractor::extract(std::size_t , std::vector<bool>& )
{
throw NotImplementedException("std::vector extractor must be implemented.");
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<bool>& )
{
throw NotImplementedException("std::deque extractor must be implemented.");
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<bool>& )
{
throw NotImplementedException("std::list extractor must be implemented.");
throw NotImplementedException("std::list extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::vector<float>& )
{
throw NotImplementedException("std::vector extractor must be implemented.");
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<float>& )
{
throw NotImplementedException("std::deque extractor must be implemented.");
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<float>& )
{
throw NotImplementedException("std::list extractor must be implemented.");
throw NotImplementedException("std::list extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::vector<double>& )
{
throw NotImplementedException("std::vector extractor must be implemented.");
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<double>& )
{
throw NotImplementedException("std::deque extractor must be implemented.");
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<double>& )
{
throw NotImplementedException("std::list extractor must be implemented.");
throw NotImplementedException("std::list extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::vector<char>& )
{
throw NotImplementedException("std::vector extractor must be implemented.");
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<char>& )
{
throw NotImplementedException("std::deque extractor must be implemented.");
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<char>& )
{
throw NotImplementedException("std::list extractor must be implemented.");
throw NotImplementedException("std::list extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::vector<std::string>& )
{
throw NotImplementedException("std::vector extractor must be implemented.");
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<std::string>& )
{
throw NotImplementedException("std::deque extractor must be implemented.");
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<std::string>& )
{
throw NotImplementedException("std::list extractor must be implemented.");
throw NotImplementedException("std::list extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::vector<BLOB>& )
{
throw NotImplementedException("std::vector extractor must be implemented.");
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<BLOB>& )
{
throw NotImplementedException("std::deque extractor must be implemented.");
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<BLOB>& )
{
throw NotImplementedException("std::list extractor must be implemented.");
throw NotImplementedException("std::list extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::vector<CLOB>& )
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<CLOB>& )
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<CLOB>& )
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::vector<DateTime>& )
{
throw NotImplementedException("std::vector extractor must be implemented.");
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<DateTime>& )
{
throw NotImplementedException("std::deque extractor must be implemented.");
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<DateTime>& )
{
throw NotImplementedException("std::list extractor must be implemented.");
throw NotImplementedException("std::list extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::vector<Date>& )
{
throw NotImplementedException("std::vector extractor must be implemented.");
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<Date>& )
{
throw NotImplementedException("std::deque extractor must be implemented.");
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<Date>& )
{
throw NotImplementedException("std::list extractor must be implemented.");
throw NotImplementedException("std::list extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::vector<Time>& )
{
throw NotImplementedException("std::vector extractor must be implemented.");
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<Time>& )
{
throw NotImplementedException("std::deque extractor must be implemented.");
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<Time>& )
{
throw NotImplementedException("std::list extractor must be implemented.");
throw NotImplementedException("std::list extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::vector<Any>& )
{
throw NotImplementedException("std::vector extractor must be implemented.");
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<Any>& )
{
throw NotImplementedException("std::deque extractor must be implemented.");
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<Any>& )
{
throw NotImplementedException("std::list extractor must be implemented.");
throw NotImplementedException("std::list extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::vector<DynamicAny>& )
bool Extractor::extract(std::size_t , std::vector<Dynamic::Var>& )
{
throw NotImplementedException("std::vector extractor must be implemented.");
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<DynamicAny>& )
bool Extractor::extract(std::size_t , std::deque<Dynamic::Var>& )
{
throw NotImplementedException("std::deque extractor must be implemented.");
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<DynamicAny>& )
bool Extractor::extract(std::size_t , std::list<Dynamic::Var>& )
{
throw NotImplementedException("std::list extractor must be implemented.");
throw NotImplementedException("std::list extractor must be implemented.");
}

View File

@@ -80,12 +80,12 @@ namespace
case MYSQL_TYPE_DOUBLE: return sizeof(double);
case MYSQL_TYPE_LONGLONG: return sizeof(Poco::Int64);
case MYSQL_TYPE_DATE:
case MYSQL_TYPE_TIME:
case MYSQL_TYPE_DATETIME:
return sizeof(MYSQL_TIME);
case MYSQL_TYPE_DATE:
case MYSQL_TYPE_TIME:
case MYSQL_TYPE_DATETIME:
return sizeof(MYSQL_TIME);
case MYSQL_TYPE_DECIMAL:
case MYSQL_TYPE_DECIMAL:
case MYSQL_TYPE_NEWDECIMAL:
case MYSQL_TYPE_STRING:
case MYSQL_TYPE_VAR_STRING:
@@ -94,7 +94,7 @@ namespace
case MYSQL_TYPE_LONG_BLOB:
case MYSQL_TYPE_BLOB:
return field.length;
default:
throw Poco::Data::MySQL::StatementException("unknown field type");
}
@@ -140,9 +140,9 @@ namespace
case MYSQL_TYPE_BLOB:
return Poco::Data::MetaColumn::FDT_BLOB;
default:
return Poco::Data::MetaColumn::FDT_UNKNOWN;
return Poco::Data::MetaColumn::FDT_UNKNOWN;
}
}
}
} // namespace
@@ -184,7 +184,7 @@ void ResultMetadata::init(MYSQL_STMT* stmt)
fields[i].name, // name
fieldType(fields[i]), // type
fieldSize(fields[i]), // length
0, // TODO: precision (Now I dont know how to get it)
0, // TODO: precision
!IS_NOT_NULL(fields[i].flags) // nullable
));
@@ -232,14 +232,14 @@ size_t ResultMetadata::length(size_t pos) const
return _lengths[pos];
}
const char* ResultMetadata::rawData(size_t pos) const
const unsigned char* ResultMetadata::rawData(size_t pos) const
{
return reinterpret_cast<const char*>(_row[pos].buffer);
return reinterpret_cast<const unsigned char*>(_row[pos].buffer);
}
bool ResultMetadata::isNull(size_t pos) const
{
return (_isNull[pos] != 0);
return (_isNull[pos] != 0);
}
}}} // namespace Poco::Data::MySQL

View File

@@ -38,7 +38,7 @@
#include "Poco/Tuple.h"
#include "Poco/NamedTuple.h"
#include "Poco/Exception.h"
#include "Poco/Data/BLOB.h"
#include "Poco/Data/LOB.h"
#include "Poco/Data/StatementImpl.h"
#include "Poco/Data/MySQL/Connector.h"
#include "Poco/Data/MySQL/MySQLException.h"

View File

@@ -37,7 +37,7 @@
#include "Poco/Tuple.h"
#include "Poco/Any.h"
#include "Poco/Exception.h"
#include "Poco/Data/BLOB.h"
#include "Poco/Data/LOB.h"
#include "Poco/Data/StatementImpl.h"
#include "Poco/Data/RecordSet.h"
#include "Poco/Data/MySQL/Connector.h"
@@ -118,7 +118,7 @@ public:
pBinder->bind(pos++, obj.age, dir);
}
static void prepare(std::size_t pos, Person& obj, AbstractPreparation* pPrepare)
static void prepare(std::size_t pos, Person& obj, AbstractPreparator* pPrepare)
{
// the table is defined as Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Age INTEGER(3))
poco_assert_dbg (pPrepare != 0);
@@ -1257,7 +1257,7 @@ void SQLExecutor::blob(int bigSize)
std::string firstName("firstname");
std::string address("Address");
Poco::Data::BLOB img("0123456789", 10);
Poco::Data::CLOB img("0123456789", 10);
int count = 0;
try { *_pSession << "INSERT INTO Person VALUES (?,?,?,?)", use(lastName), use(firstName), use(address), use(img), now; }
catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); }
@@ -1267,14 +1267,14 @@ void SQLExecutor::blob(int bigSize)
catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); }
assert (count == 1);
Poco::Data::BLOB res;
Poco::Data::CLOB res;
assert (res.size() == 0);
try { *_pSession << "SELECT Image FROM Person", into(res), now; }
catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); }
catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); }
assert (res == img);
Poco::Data::BLOB big;
Poco::Data::CLOB big;
std::vector<char> v(bigSize, 'x');
big.assignRaw(&v[0], v.size());
@@ -1300,7 +1300,7 @@ void SQLExecutor::blobStmt()
std::string lastName("lastname");
std::string firstName("firstname");
std::string address("Address");
Poco::Data::BLOB blob("0123456789", 10);
Poco::Data::CLOB blob("0123456789", 10);
int count = 0;
Statement ins = (*_pSession << "INSERT INTO Person VALUES (?,?,?,?)", use(lastName), use(firstName), use(address), use(blob));
@@ -1310,7 +1310,7 @@ void SQLExecutor::blobStmt()
catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); }
assert (count == 1);
Poco::Data::BLOB res;
Poco::Data::CLOB res;
poco_assert (res.size() == 0);
Statement stmt = (*_pSession << "SELECT Image FROM Person", into(res));
try { stmt.execute(); }