Revert "Remove mysql and oracle resources for anna-ericsson project"
[anna.git] / include / anna / dbms.oracle / ResultCode.hpp
diff --git a/include/anna/dbms.oracle/ResultCode.hpp b/include/anna/dbms.oracle/ResultCode.hpp
new file mode 100644 (file)
index 0000000..b9f8fd5
--- /dev/null
@@ -0,0 +1,52 @@
+// 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 //
+
+
+#ifndef anna_dbms_oracle_ResultCode_hpp
+#define anna_dbms_oracle_ResultCode_hpp
+
+#include <anna/dbms/ResultCode.hpp>
+
+struct OCIError;
+
+namespace anna {
+
+namespace dbms {
+
+namespace oracle {
+
+/**
+   Clase para acceder a la informacion devuelta por el gestor de base de datos
+   referente al ultimo comando realizado.
+ */
+class ResultCode : public dbms::ResultCode {
+public:
+  /**
+     Constructor.
+
+     \param status Codigo de resultado de la ultima operacion realizada.
+     \param error Estructura de datos que contiene la informacion adicional sobre el error.
+  */
+  explicit ResultCode(const int status, OCIError* error);
+
+private:
+  class ErrorDecoder : public dbms::ResultCode::ErrorDecoder {
+    bool notFound(const int errorCode) const throw();
+    bool successful(const int errorCode) const throw();
+    bool locked(const int errorCode) const throw() { return errorCode == 54; }
+    bool lostConnection(const int errorCode) const throw();
+  };
+
+  static ErrorDecoder st_errorDecoder;
+};
+
+}
+}
+}
+
+#endif
+