Revert "Remove mysql and oracle resources for anna-ericsson project"
[anna.git] / include / anna / dbms / Bind.hpp
diff --git a/include/anna/dbms/Bind.hpp b/include/anna/dbms/Bind.hpp
new file mode 100644 (file)
index 0000000..5bc3b7b
--- /dev/null
@@ -0,0 +1,53 @@
+// 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_Bind_hpp
+#define anna_dbms_Bind_hpp
+
+#include <anna/core/functions.hpp>
+#include <anna/core/RuntimeException.hpp>
+
+#include <anna/dbms/DatabaseException.hpp>
+#include <anna/dbms/Data.hpp>
+
+namespace anna {
+
+namespace dbms {
+
+class Connection;
+class Statement;
+class Data;
+
+class Bind {
+public:
+  dbms::Data& getData() throw() { return a_data; }
+  const dbms::Data& getData() const throw() { return a_data; }
+
+  virtual void prepare(Statement* statement, Connection* connection, const int pos)
+  throw(RuntimeException, DatabaseException) = 0;
+
+  virtual void release(Statement* statement) throw() = 0;
+  virtual void code() const throw(RuntimeException) = 0;
+  virtual void decode() const throw(RuntimeException) = 0;
+  virtual std::string asString() const throw();
+
+protected:
+  Bind(const char* name, dbms::Data& data) : a_name(name), a_data(data) {;}
+
+private:
+  const std::string a_name;
+  dbms::Data& a_data;
+
+  friend class Statement;
+};
+
+}
+}
+
+#endif
+