X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=source%2Fdbms%2FDelivery.cpp;fp=source%2Fdbms%2FDelivery.cpp;h=0000000000000000000000000000000000000000;hb=851ff2962362fd5bad874e8ed91445b296eaca24;hp=8ae88e4bdd0515c1a5928a9bdd52132eda172ace;hpb=78be86969d2f26a9084b0c4af6ce43d5fa4ed3fd;p=anna.git diff --git a/source/dbms/Delivery.cpp b/source/dbms/Delivery.cpp deleted file mode 100644 index 8ae88e4..0000000 --- a/source/dbms/Delivery.cpp +++ /dev/null @@ -1,66 +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 - -using namespace std; -using namespace anna; - -void dbms::Delivery::createConnections(dbms::Database& database, const char* prefixName, const char* user, const char* password, const int n) -throw(RuntimeException, dbms::DatabaseException) { - string name; - - for(int i = 0; i < n; i ++) { - name = prefixName; - name += functions::asString("%04d", i); - this->add(database.createConnection(name.c_str(), user, password)); - } - - a_iiConnection = this->begin(); -} - -dbms::Connection& dbms::Delivery::getConnection() -throw(RuntimeException) { - return *(static_cast (comm::Delivery::apply())); -} - -//-------------------------------------------------------------------------------------------------- -// Se invoca desde la seccion critica establecida en comm::Delivery::apply. -// -// (0) Si no hay registrada ninguna conexion -//-------------------------------------------------------------------------------------------------- -comm::Resource* dbms::Delivery::do_apply() -throw(RuntimeException) { - iterator maxii = end(); - - if(a_iiConnection == maxii) // (0) - return NULL; - - iterator init = a_iiConnection; - Connection* result = NULL; - Connection* w; - - do { - w = connection(a_iiConnection); - - if(a_iiConnection == maxii) - a_iiConnection = begin(); - - if(w->isAvailable() == true && w->isEnabled() == true) { - result = w; - break; - } - } while(a_iiConnection != init); - - return result; -}