Add no-deprecated to warnings due to dynamic exceptions.
[anna.git] / source / dbms.oracle / Descriptor.cpp
1 // ANNA - Anna is Not Nothingness Anymore                                                         //
2 //                                                                                                //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo                         //
4 //                                                                                                //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite                           //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
7
8
9 #include <oci.h>
10
11 #include <anna/dbms.oracle/Descriptor.hpp>
12 #include <anna/dbms.oracle/Database.hpp>
13 #include <anna/dbms.oracle/Connection.hpp>
14 #include <anna/dbms.oracle/ResultCode.hpp>
15
16 using namespace anna;
17
18 dbms::oracle::Descriptor::~Descriptor() {
19   if(*reference != NULL) {
20     OCIDescriptorFree(*reference, type);
21     *reference = NULL;
22   }
23 }
24
25 void dbms::oracle::Descriptor::allocate(dbms::oracle::Database& database, dbms::oracle::Connection* connection,  const int _type)
26 throw(RuntimeException) {
27   if(*reference != NULL)
28     return;
29
30   env = database;
31   error = database.getErrorHandler();
32   context = *connection;                      // Invoca al operador de conversion
33
34   try {
35     anna_dbms_oracle_check(OCIDescriptorAlloc(env, reference, type = _type, 0, 0),  error);
36   } catch(DatabaseException& edb) {
37     throw RuntimeException(edb);
38   }
39 }