Remove mysql and oracle resources for anna-ericsson project
[anna.git] / example / dbms.mysql / xSelect / main.cpp
diff --git a/example/dbms.mysql/xSelect/main.cpp b/example/dbms.mysql/xSelect/main.cpp
deleted file mode 100644 (file)
index 6f7fdcc..0000000
+++ /dev/null
@@ -1,139 +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 <iostream>
-
-#include <anna/core/core.hpp>
-#include <anna/dbms/dbms.hpp>
-#include <anna/app/app.hpp>
-
-#include <anna/dbms.mysql/Database.hpp>
-#include <anna/dbms.mysql/OracleTranslator.hpp>
-
-class Select : public Application {
-public:
-   Select ();
-   ~Select () { delete a_db; }
-   
-private:
-   anna::dbms::Database* a_db;
-
-   void initialize () throw (RuntimeException); 
-   void run () throw (RuntimeException);      
-};
-
-using namespace std;
-
-int main (int argc, const char** argv)
-{
-   CommandLine& commandLine (CommandLine::instantiate ());
-   Select testNull;
-
-   try {
-      commandLine.initialize (argv, argc);
-      commandLine.verify ();
-
-      Logger::setLevel (Logger::Debug); 
-      Logger::initialize ("copy", new TraceWriter ("xselect.trace", 1024 * 1024));
-      testNull.start ();
-   }
-   catch (Exception& ex) {
-      cout << ex.asString () << endl;
-   }
-   
-   return 0;
-}
-
-Select::Select () : 
-   Application ("xselect", "Copiador de la tabla ad_funcionalidades", "1.0"),
-   a_db (NULL)
-{
-   CommandLine& cl (CommandLine::instantiate ());
-      
-   cl.add ("user", CommandLine::Argument::Mandatory, "Nombre del usuario");
-   cl.add ("password", CommandLine::Argument::Mandatory, "Clave del usuario");
-   cl.add ("host", CommandLine::Argument::Optional, "Nombre de la maquina donde se ubica el MySQL");
-   cl.add ("db", CommandLine::Argument::Optional, "Nombre de la base de datos");
-}
-
-/*
- * Las sentencias SQL usadas por este programana estaba originalmente escritas para Oracle,
- * pero no hay que cambiar cada sentencia manualmente, s�lo hay que activar el traductor
- * correspondiente y anna.dbms.mysql lo hace autom�ticamente.
- */
-void Select::initialize ()
-   throw (RuntimeException)
-{
-   CommandLine& ccll = CommandLine::instantiate ();
-   const char* host = ccll.exists ("host") ? ccll.getValue ("host"): NULL;
-
-   a_db = new anna::dbms::mysql::Database (ccll.getValue ("db"), host);
-   a_db->setStatementTranslator (dbms::mysql::OracleTranslator::instantiate ());
-}
-
-void Select::run () 
-   throw (RuntimeException)
-{
-   LOGMETHOD (TraceMethod tm ("Select", "run", ANNA_FILE_LOCATION)); 
-
-   CommandLine& cl (CommandLine::instantiate ());
-   
-   Statement* select;
-  
-   dbms::Integer n (true);
-   dbms::String name (15, true);
-   dbms::Float zz (true);
-   dbms::TimeStamp tt (true);
-
-   dbms::ResultCode resultCode;
-
-   try {      
-      Connection* connection = a_db->createConnection ("xselect", cl.getValue ("user"), cl.getValue ("password"));
-
-      Guard guard (connection);     
-
-      select = a_db->createStatement ("select", "select xx,yy,zz, tt from anna_db_test");
-      select->bindOutput ("XX", n);
-      select->bindOutput ("YY", name);
-      select->bindOutput ("zz", zz);
-      select->bindOutput ("tt", tt);
-
-      cout << endl << " --- Leyendo ---" << endl;
-      resultCode = connection->execute (select);
-                        
-      if (resultCode.successful () == true) {
-         while (select->fetch () == true) {
-            if (n.isNull () == true)
-               cout << "<null>";
-            else
-               cout << n;
-
-            cout << " | YY: " << ((name.isNull () == true) ? "<null>": name);
-
-            cout << " | ZZ: ";
-            if (zz.isNull () == true)
-               cout << "<null>";
-            else
-               cout << zz.getValue ();
-
-            cout << " | TT: " << ((tt.isNull () == true) ? "<null>": tt.getCStringValue ());
-
-            cout << endl;
-         }         
-      }
-      else
-         cout << resultCode.asString () << endl << endl;  
-         }
-   catch (dbms::DatabaseException& edb) {
-      throw RuntimeException (edb); 
-   }
-}
-
-
-