Revert "Remove mysql and oracle resources for anna-ericsson project"
[anna.git] / include / anna / dbms.oracle / InputBind.hpp
diff --git a/include/anna/dbms.oracle/InputBind.hpp b/include/anna/dbms.oracle/InputBind.hpp
new file mode 100644 (file)
index 0000000..3b0b6ee
--- /dev/null
@@ -0,0 +1,60 @@
+// 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_InputBind_hpp
+#define anna_dbms_oracle_InputBind_hpp
+
+#include <anna/dbms/InputBind.hpp>
+
+#include <anna/dbms.oracle/BaseBind.hpp>
+
+struct OCIBind;
+
+namespace anna {
+
+class DataBlock;
+
+namespace dbms {
+
+class Data;
+class Statement;
+
+namespace oracle {
+
+class Statement;
+
+class InputBind : public dbms::InputBind, public  BaseBind {
+public:
+  InputBind(const char* name, dbms::Data& data);
+  virtual ~InputBind();
+
+private:
+  OCIBind* a_ociBind;
+
+  void code() const throw(RuntimeException);
+  void prepare(dbms::Statement*, dbms::Connection*, const int pos) throw(RuntimeException, DatabaseException);
+  void release(dbms::Statement*) throw() { a_ociBind = NULL; }
+
+  void codeFloat(dbms::Data&) const throw();
+  void codeShortBlock(dbms::Data&) const throw();
+  void codeDate(dbms::Data&) const throw(RuntimeException, DatabaseException);
+
+  static char asCharacter(const char byte)
+  throw() {
+    return (byte >= 0 && byte <= 9) ? (byte + '0') : ((byte - 0xa) + 'A');
+  }
+
+  friend class oracle::Statement;
+};
+
+}
+}
+}
+
+#endif
+