1 // ANNA - Anna is Not Nothingness Anymore //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
11 #include <anna/core/tracing/Logger.hpp>
12 #include <anna/core/tracing/TraceMethod.hpp>
14 #include <anna/dbms.mysql/mysql.hpp>
15 #include <anna/dbms.mysql/internal/sccs.hpp>
19 using namespace anna::dbms;
21 mysql::Database::Database(const char* dbmsName, const char* host) :
22 dbms::Database(getClassName(), dbmsName) {
23 a_host = (host == NULL) ? NULL : strdup(host);
24 mysql::sccs::activate();
27 mysql::Database::Database(const char* componentName, const char* dbmsName, const char* host) :
28 dbms::Database(componentName, dbmsName) {
29 a_host = (host == NULL) ? NULL : strdup(host);
30 mysql::sccs::activate();
33 void mysql::Database::do_initialize()
34 throw(RuntimeException) {
35 LOGMETHOD(TraceMethod tm("anna::dbms::mysql::Database", "do_initialize", ANNA_FILE_LOCATION));
36 dbms::Database::do_initialize();
39 //----------------------------------------------------------------------------------
40 // Libera todos los manejadores asociados a este entorno.
41 //----------------------------------------------------------------------------------
42 mysql::Database::~Database() {
43 LOGMETHOD(TraceMethod tm("anna::dbms::mysql::Database", "~Database", ANNA_FILE_LOCATION));
49 dbms::Connection* mysql::Database::allocateConnection(const std::string& name, const char* user, const char* password)
50 throw(RuntimeException) {
51 return new Connection(*this, name, user, password);
54 dbms::Statement* mysql::Database::allocateStatement(const char* name, const std::string& expression, const bool isCritical)
55 throw(RuntimeException) {
56 return new Statement(*this, name, expression, isCritical);
59 dbms::InputBind* mysql::Database::allocateInputBind(const char* name, Data& data)
60 throw(RuntimeException) {
61 return new InputBind(name, data);
64 void mysql::Database::deallocate(dbms::InputBind* inputBind)
66 delete(InputBind*) inputBind;
69 dbms::OutputBind* mysql::Database::allocateOutputBind(const char* name, Data& data)
70 throw(RuntimeException) {
71 return new OutputBind(name, data);
74 void mysql::Database::deallocate(dbms::OutputBind* outputBind)
76 delete(OutputBind*) outputBind;