/usr/include/soci/odbc/utility.h is in libsoci-dev 3.2.3-2ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | //
// Copyright (C) 2004-2006 Maciej Sobczak, Stephen Hutton, David Courtney
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef SOCI_UTILITY_H_INCLUDED
#define SOCI_UTILITY_H_INCLUDED
#include "soci-backend.h"
#include <sstream>
namespace soci
{
inline void throw_odbc_error(SQLSMALLINT htype, SQLHANDLE hndl, char const * msg)
{
SQLCHAR message[SQL_MAX_MESSAGE_LENGTH + 1];
SQLCHAR sqlstate[SQL_SQLSTATE_SIZE + 1];
SQLINTEGER sqlcode;
SQLSMALLINT length, i;
std::stringstream ss;
i = 1;
/* get multiple field settings of diagnostic record */
while (SQLGetDiagRecA(htype,
hndl,
i,
sqlstate,
&sqlcode,
message,
SQL_MAX_MESSAGE_LENGTH + 1,
&length) == SQL_SUCCESS)
{
ss << std::endl << "SOCI ODBC Error: " << msg << std::endl
<< "SQLSTATE = " << sqlstate << std::endl
<< "Native Error Code = " << sqlcode << std::endl
<< message << std::endl;
++i;
}
throw soci_error(ss.str());
}
inline bool is_odbc_error(SQLRETURN rc)
{
if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO)
{
return true;
}
else
{
return false;
}
}
}
#endif // SOCI_UTILITY_H_INCLUDED
|