Revert "Remove mysql and oracle resources for anna-ericsson project"
[anna.git] / include / anna / dbms.oracle / BaseBind.hpp
diff --git a/include/anna/dbms.oracle/BaseBind.hpp b/include/anna/dbms.oracle/BaseBind.hpp
new file mode 100644 (file)
index 0000000..c99699c
--- /dev/null
@@ -0,0 +1,79 @@
+// 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_BaseBind_hpp
+#define anna_dbms_oracle_BaseBind_hpp
+
+struct OCIEnv;
+struct OCIError;
+struct OCIBind;
+struct OCILobLocator;
+struct OCISvcCtx;
+struct OCIDateTime;
+
+#include <anna/dbms.oracle/Descriptor.hpp>
+
+namespace anna {
+
+class DataBlock;
+
+namespace dbms {
+
+class Statement;
+class Data;
+
+namespace oracle {
+
+class Statement;
+class Database;
+class Connection;
+
+class BaseBind {
+public:
+  virtual ~BaseBind();
+
+protected:
+  /**
+   * NĂºmero de bytes reservados para un Float cuando se trata como si fuera una cadena.
+   */
+  static const int FloatSize = 63;
+  struct oci_param {
+    int type;
+    int maxLength;
+    short unsigned int* length;
+    void* buffer;
+  };
+  struct Blob : public Descriptor {
+    OCILobLocator* handle;
+    Blob() : Descriptor((dvoid**) &handle) {;}
+  };
+  struct DateTime : public Descriptor {
+    OCIDateTime* handle;
+    DateTime() : Descriptor((dvoid**) &handle) {;}
+  };
+
+  short a_nullIndicator;
+  unsigned short a_length;
+  anna::DataBlock* a_ofb; // Oracle Formatted Buffer.
+  Blob a_blob;
+  DateTime a_datetime;
+
+  BaseBind(const dbms::Data& data) ;
+
+  oci_param getOCIParam(Database&, Connection*, dbms::Data&) throw(RuntimeException);
+
+private:
+  const Data::Type::_v a_type;
+};
+
+}
+}
+}
+
+#endif
+