blob: d848b1adf2e60dda36ef2d35ba2b4e6d0616f9c2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
// file : odb/oracle/errors.cxx
// author : Constantin Michael <constantin@codesynthesis.com>
// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC
// license : ODB NCUEL; see accompanying LICENSE file
#include <cassert>
#include <odb/details/buffer.hxx>
#include <odb/oracle/error.hxx>
#include <odb/oracle/exceptions.hxx>
using namespace std;
namespace odb
{
namespace oracle
{
void
translate_error (void* h, ub4 t, sword s)
{
assert (s == OCI_ERROR || s == OCI_INVALID_HANDLE);
if (s == OCI_INVALID_HANDLE)
throw invalid_oci_handle ();
sb4 e;
details::buffer b;
b.capacity (128);
bool trunc (true);
while (trunc)
{
trunc = OCIErrorGet (h,
1,
0,
&e,
reinterpret_cast<OraText*> (b.data ()),
b.capacity (),
t) == OCI_ERROR;
if (trunc)
b.capacity (b.capacity () * 2);
}
// @@ Need to find a source of OCI specific codes.
//
// There are no symbolic definitions for error codes in the OCI
// header files.
//
switch (e)
{
case 60:
throw deadlock ();
case 3135:
case 3136:
throw connection_lost ();
default:
throw database_exception (e, b.data ());
}
}
}
}
|