aboutsummaryrefslogtreecommitdiff
path: root/odb/oracle/error.hxx
diff options
context:
space:
mode:
authorConstantin Michael <constantin@codesynthesis.com>2011-09-05 11:55:41 +0200
committerConstantin Michael <constantin@codesynthesis.com>2011-09-05 11:55:41 +0200
commit6eed6c47b07371349bd4c30daf2b305ff7f5b1d3 (patch)
treea9e63048560e301a1415c8d9821d2715423a94aa /odb/oracle/error.hxx
parentf024d16b9c78d683baa5d87b6e92b3d79a1f3300 (diff)
Add exceptions and error translation
Diffstat (limited to 'odb/oracle/error.hxx')
-rw-r--r--odb/oracle/error.hxx49
1 files changed, 49 insertions, 0 deletions
diff --git a/odb/oracle/error.hxx b/odb/oracle/error.hxx
new file mode 100644
index 0000000..2b83895
--- /dev/null
+++ b/odb/oracle/error.hxx
@@ -0,0 +1,49 @@
+// file : odb/oracle/errors.hxx
+// author : Constantin Michael <constantin@codesynthesis.com>
+// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC
+// license : ODB NCUEL; see accompanying LICENSE file
+
+#ifndef ODB_ORACLE_ERRORS_HXX
+#define ODB_ORACLE_ERRORS_HXX
+
+#include <odb/pre.hxx>
+
+#include <oci.h>
+
+#include <odb/oracle/version.hxx>
+#include <odb/oracle/details/export.hxx>
+
+namespace odb
+{
+ namespace oracle
+ {
+ void
+ translate_error (void* h, ub4 t, sword s);
+
+ // @@ Check connection state attribute once connection has been
+ // implemented.
+ //
+
+ // Translate OCI error given an error handle and throw an appropriate
+ // exception.
+ //
+ inline LIBODB_ORACLE_EXPORT void
+ translate_error (OCIError* h, sword s)
+ {
+ translate_error (h, OCI_HTYPE_ERROR, s);
+ }
+
+ // Translate an OCI error given an environment handle error and throw
+ // an appropriate exception.
+ //
+ inline LIBODB_ORACLE_EXPORT void
+ translate_error (OCIEnv* h)
+ {
+ translate_error (h, OCI_HTYPE_ENV, OCI_ERROR);
+ }
+ }
+}
+
+#include <odb/post.hxx>
+
+#endif // ODB_ORACLE_ERRORS_HXX