X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=source%2Fdbms.mysql%2FInputBind.cpp;fp=source%2Fdbms.mysql%2FInputBind.cpp;h=0000000000000000000000000000000000000000;hb=851ff2962362fd5bad874e8ed91445b296eaca24;hp=edfb2d335a69c33eb33f64e1535a3042352af424;hpb=78be86969d2f26a9084b0c4af6ce43d5fa4ed3fd;p=anna.git diff --git a/source/dbms.mysql/InputBind.cpp b/source/dbms.mysql/InputBind.cpp deleted file mode 100644 index edfb2d3..0000000 --- a/source/dbms.mysql/InputBind.cpp +++ /dev/null @@ -1,110 +0,0 @@ -// ANNA - Anna is Not Nothingness Anymore // -// // -// (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo // -// // -// See project site at http://redmine.teslayout.com/projects/anna-suite // -// See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE // - - -#include - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include - -using namespace std; -using namespace anna; - -InputBind::InputBind(const char* name, dbms::Data& data) : - dbms::InputBind(name, data), - BaseBind(data) { -} - -InputBind::~InputBind() { -} - -/* - * Completa la informacion establececida por el setupBind. - */ -void InputBind::prepare(anna::dbms::Statement* dbmsStmt, anna::dbms::Connection*, const int pos) -throw(RuntimeException) { - st_mysql_bind* bind = static_cast (dbmsStmt)->getBindParams() + pos; - Data& data = anna::dbms::Bind::getData(); - BaseBind::setupBind(*bind, data); - - if(data.getType() == Data::Type::LongBlock) { - DataBlock& dataBlock = static_cast (data).getValue(); - bind->buffer_type = MYSQL_TYPE_BLOB; - bind->buffer_length = dataBlock.getSize(); - bind->buffer = (char*) dataBlock.getData(); - bind->length = &a_length; - } -} - -/* - * Se invoca desde anna::dbms::mysql::Statement::execute. - * Codificar� la informaci�n C++ de forma que encaje en las estructuras requeridas por el API de MySQL. - */ -void InputBind::code() const -throw(RuntimeException) { - InputBind* _this = const_cast (this); - Data& data = _this->getData(); - - if((_this->a_nullIndicator = data.isNull() ? true : false) == true) - return; - - switch(data.getType()) { - case Data::Type::String: - _this->a_length = anna_strlen((char*)(static_cast (data).getBuffer())); - break; - case Data::Type::Date: - case Data::Type::TimeStamp: - _this->codeDate(data); - break; - case Data::Type::Integer: - throw RuntimeException("anna::dbms::mysql::InputBind::code not implemented for Data::Type::Integer", ANNA_FILE_LOCATION); - break; - case Data::Type::Float: - throw RuntimeException("anna::dbms::mysql::InputBind::code not implemented for Data::Type::Float", ANNA_FILE_LOCATION); - break; - case Data::Type::ShortBlock: - throw RuntimeException("anna::dbms::mysql::InputBind::code not implemented for Data::Type::ShortBlock", ANNA_FILE_LOCATION); - break; - case Data::Type::LongBlock: - throw RuntimeException("anna::dbms::mysql::InputBind::code not implemented for Data::Type::LongBlock", ANNA_FILE_LOCATION); - break; - - } -} - -/** - * El bind.buffer ha sido asociado a una estructura de tipo MYSQL_TIME (a_time), cuyos valores vamos - * a establecer en �ste m�todo. - */ -void InputBind::codeDate(dbms::Data& data) -throw() { - dbms::Date& date = static_cast (data); - - if(data.getType() == Data::Type::TimeStamp) { - a_time->second_part = static_cast (data).getFractionalSecond(); - } - - a_time->year = date.getYear(); - a_time->month = date.getMonth(); - a_time->day = date.getDay(); - a_time->hour = date.getHour(); - a_time->minute = date.getMinute(); - a_time->second = date.getSecond(); -} -