Main Page
Namespaces
Classes
Files
File List
File Members
libism
ISM
soci
src
backends
oracle
backends/oracle/error.cpp
Go to the documentation of this file.
1
//
2
// Copyright (C) 2004-2007 Maciej Sobczak, Stephen Hutton
3
// Distributed under the Boost Software License, Version 1.0.
4
// (See accompanying file LICENSE_1_0.txt or copy at
5
// http://www.boost.org/LICENSE_1_0.txt)
6
//
7
8
#define SOCI_ORACLE_SOURCE
9
#include "
soci-oracle.h
"
10
#include "
error.h
"
11
#include <limits>
12
#include <sstream>
13
14
#ifdef _MSC_VER
15
#pragma warning(disable:4355)
16
#endif
17
18
using namespace
soci
;
19
using namespace
soci::details
;
20
using namespace
soci::details::oracle
;
21
22
oracle_soci_error::oracle_soci_error
(std::string
const
& msg,
int
errNum)
23
:
soci_error
(msg), err_num_(errNum)
24
{
25
}
26
27
void
soci::details::oracle::get_error_details
(sword res, OCIError *errhp,
28
std::string &msg,
int
&errNum)
29
{
30
text errbuf[512];
31
sb4 errcode;
32
errNum = 0;
33
34
switch
(res)
35
{
36
case
OCI_NO_DATA:
37
msg =
"soci error: No data"
;
38
break
;
39
case
OCI_ERROR:
40
OCIErrorGet(errhp, 1, 0, &errcode,
41
errbuf,
sizeof
(errbuf), OCI_HTYPE_ERROR);
42
msg =
reinterpret_cast<
char
*
>
(errbuf);
43
errNum =
static_cast<
int
>
(errcode);
44
break
;
45
case
OCI_INVALID_HANDLE:
46
msg =
"soci error: Invalid handle"
;
47
break
;
48
default
:
49
msg =
"soci error: Unknown error code"
;
50
}
51
}
52
53
void
soci::details::oracle::throw_oracle_soci_error
(sword res, OCIError *errhp)
54
{
55
std::string msg;
56
int
errNum;
57
58
get_error_details
(res, errhp, msg, errNum);
59
throw
oracle_soci_error
(msg, errNum);
60
}
soci::details
Definition:
db2/common.h:15
soci::details::oracle
Definition:
backends/oracle/error.h:19
soci::oracle_soci_error::oracle_soci_error
oracle_soci_error(std::string const &msg, int errNum=0)
Definition:
backends/oracle/error.cpp:22
soci::details::oracle::get_error_details
void get_error_details(sword res, OCIError *errhp, std::string &msg, int &errNum)
Definition:
backends/oracle/error.cpp:27
soci::soci_error
Definition:
core/error.h:19
soci::details::oracle::throw_oracle_soci_error
void throw_oracle_soci_error(sword res, OCIError *errhp)
Definition:
backends/oracle/error.cpp:53
error.h
soci-oracle.h
soci
Definition:
db2/common.h:15
asr_lib_ism
Author(s): Hanselmann Fabian, Heller Florian, Heizmann Heinrich, Kübler Marcel, Mehlhaus Jonas, Meißner Pascal, Qattan Mohamad, Reckling Reno, Stroh Daniel
autogenerated on Wed Jan 8 2020 04:02:40