Revert "Remove mysql and oracle resources for anna-ericsson project"
[anna.git] / include / anna / dbms.oracle / OutputBind.hpp
diff --git a/include/anna/dbms.oracle/OutputBind.hpp b/include/anna/dbms.oracle/OutputBind.hpp
new file mode 100644 (file)
index 0000000..ce41a22
--- /dev/null
@@ -0,0 +1,58 @@
+// 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_OutputBind_hpp
+#define anna_dbms_oracle_OutputBind_hpp
+
+#include <anna/dbms/OutputBind.hpp>
+
+#include <anna/dbms.oracle/BaseBind.hpp>
+
+struct OCIDefine;
+
+namespace anna {
+
+namespace dbms {
+
+class Statement;
+
+namespace oracle {
+
+class OutputBind : public dbms::OutputBind,  public BaseBind {
+public:
+  OutputBind(const char* name, dbms::Data& data);
+  ~OutputBind();
+
+private:
+  OCIDefine* a_ociDefine;
+
+  void decode() const throw(anna::RuntimeException);
+  void prepare(dbms::Statement*, dbms::Connection*, const int pos) throw(DatabaseException);
+  void release(dbms::Statement*) throw() { a_ociDefine = NULL; }
+
+  void decodeFloat(dbms::Data&) const throw(RuntimeException);
+  void decodeShortBlock(dbms::Data&) const throw(RuntimeException);
+  void decodeLongBlock(dbms::Data&) const throw(RuntimeException);
+  void decodeDate(dbms::Data&) const throw(RuntimeException, DatabaseException);
+
+  void do_write(const dbms::LongBlock&) const throw(RuntimeException, dbms::DatabaseException);
+
+  static unsigned char asByte(const char hex)
+  throw() {
+    return (hex >= '0' && hex <= '9') ? (hex - '0') : ((hex - 'A') + 0x0a);
+  }
+
+  friend class Statement;
+};
+
+}
+}
+}
+
+#endif
+