本文整理汇总了C++中Connection::GetDiagnosticRecords方法的典型用法代码示例。如果您正苦于以下问题:C++ Connection::GetDiagnosticRecords方法的具体用法?C++ Connection::GetDiagnosticRecords怎么用?C++ Connection::GetDiagnosticRecords使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Connection
的用法示例。
在下文中一共展示了Connection::GetDiagnosticRecords方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SQLConnect
SQLRETURN SQLConnect(SQLHDBC conn,
SQLCHAR* serverName,
SQLSMALLINT serverNameLen,
SQLCHAR* userName,
SQLSMALLINT userNameLen,
SQLCHAR* auth,
SQLSMALLINT authLen)
{
using odbc::Connection;
using odbc::config::Configuration;
using utility::SqlStringToString;
LOG_MSG("SQLConnect called\n");
Connection *connection = reinterpret_cast<Connection*>(conn);
if (!connection)
return SQL_INVALID_HANDLE;
odbc::config::Configuration config;
std::string dsn = SqlStringToString(serverName, serverNameLen);
LOG_MSG("DSN: " << dsn);
odbc::ReadDsnConfiguration(dsn.c_str(), config);
connection->Establish(config);
return connection->GetDiagnosticRecords().GetReturnCode();
}
示例2: SQLDriverConnect
SQLRETURN SQLDriverConnect(SQLHDBC conn,
SQLHWND windowHandle,
SQLCHAR* inConnectionString,
SQLSMALLINT inConnectionStringLen,
SQLCHAR* outConnectionString,
SQLSMALLINT outConnectionStringBufferLen,
SQLSMALLINT* outConnectionStringLen,
SQLUSMALLINT driverCompletion)
{
using odbc::Connection;
using odbc::diagnostic::DiagnosticRecordStorage;
using utility::SqlStringToString;
using utility::CopyStringToBuffer;
UNREFERENCED_PARAMETER(windowHandle);
LOG_MSG("SQLDriverConnect called");
if (inConnectionString)
LOG_MSG("Connection String: [" << inConnectionString << "]");
Connection *connection = reinterpret_cast<Connection*>(conn);
if (!connection)
return SQL_INVALID_HANDLE;
std::string connectStr = SqlStringToString(inConnectionString, inConnectionStringLen);
odbc::config::Configuration config;
config.FillFromConnectString(connectStr);
std::string dsn = config.GetDsn();
if (!dsn.empty())
odbc::ReadDsnConfiguration(dsn.c_str(), config);
connection->Establish(config);
const DiagnosticRecordStorage& diag = connection->GetDiagnosticRecords();
if (!diag.IsSuccessful())
return diag.GetReturnCode();
size_t reslen = CopyStringToBuffer(connectStr,
reinterpret_cast<char*>(outConnectionString),
static_cast<size_t>(outConnectionStringBufferLen));
if (outConnectionStringLen)
*outConnectionStringLen = static_cast<SQLSMALLINT>(reslen);
if (outConnectionString)
LOG_MSG(outConnectionString);
return diag.GetReturnCode();
}
示例3: SQLEndTran
SQLRETURN SQLEndTran(SQLSMALLINT handleType, SQLHANDLE handle, SQLSMALLINT completionType)
{
using namespace odbc;
LOG_MSG("SQLEndTran called");
SQLRETURN result;
switch (handleType)
{
case SQL_HANDLE_ENV:
{
Environment *env = reinterpret_cast<Environment*>(handle);
if (!env)
return SQL_INVALID_HANDLE;
if (completionType == SQL_COMMIT)
env->TransactionCommit();
else
env->TransactionRollback();
result = env->GetDiagnosticRecords().GetReturnCode();
break;
}
case SQL_HANDLE_DBC:
{
Connection *conn = reinterpret_cast<Connection*>(handle);
if (!conn)
return SQL_INVALID_HANDLE;
if (completionType == SQL_COMMIT)
conn->TransactionCommit();
else
conn->TransactionRollback();
result = conn->GetDiagnosticRecords().GetReturnCode();
break;
}
default:
{
result = SQL_INVALID_HANDLE;
break;
}
}
return result;
}
示例4: SQLDisconnect
SQLRETURN SQLDisconnect(SQLHDBC conn)
{
using odbc::Connection;
LOG_MSG("SQLDisconnect called");
Connection *connection = reinterpret_cast<Connection*>(conn);
if (!connection)
return SQL_INVALID_HANDLE;
connection->Release();
return connection->GetDiagnosticRecords().GetReturnCode();
}
示例5: SQLSetConnectAttr
SQLRETURN SQL_API SQLSetConnectAttr(SQLHDBC conn,
SQLINTEGER attr,
SQLPOINTER value,
SQLINTEGER valueLen)
{
using odbc::Connection;
LOG_MSG("SQLSetConnectAttr called");
Connection *connection = reinterpret_cast<Connection*>(conn);
if (!connection)
return SQL_INVALID_HANDLE;
connection->SetAttribute(attr, value, valueLen);
return connection->GetDiagnosticRecords().GetReturnCode();
}
示例6: SQLAllocStmt
SQLRETURN SQLAllocStmt(SQLHDBC conn, SQLHSTMT* stmt)
{
using odbc::Connection;
using odbc::Statement;
LOG_MSG("SQLAllocStmt called");
*stmt = SQL_NULL_HDBC;
Connection *connection = reinterpret_cast<Connection*>(conn);
if (!connection)
return SQL_INVALID_HANDLE;
Statement *statement = connection->CreateStatement();
*stmt = reinterpret_cast<SQLHSTMT>(statement);
return connection->GetDiagnosticRecords().GetReturnCode();
}
示例7: SQLAllocHandle
SQLRETURN SQLAllocHandle(SQLSMALLINT type, SQLHANDLE parent, SQLHANDLE* result)
{
//LOG_MSG("SQLAllocHandle called");
switch (type)
{
case SQL_HANDLE_ENV:
return SQLAllocEnv(result);
case SQL_HANDLE_DBC:
return SQLAllocConnect(parent, result);
case SQL_HANDLE_STMT:
return SQLAllocStmt(parent, result);
case SQL_HANDLE_DESC:
{
using odbc::Connection;
Connection *connection = reinterpret_cast<Connection*>(parent);
if (!connection)
return SQL_INVALID_HANDLE;
if (result)
*result = 0;
connection->GetDiagnosticRecords().Reset();
connection->AddStatusRecord(odbc::SqlState::SIM001_FUNCTION_NOT_SUPPORTED,
"The HandleType argument was SQL_HANDLE_DESC, and "
"the driver does not support allocating a descriptor handle");
return SQL_ERROR;
}
default:
break;
}
*result = 0;
return SQL_ERROR;
}
示例8: SQLGetConnectAttr
SQLRETURN SQL_API SQLGetConnectAttr(SQLHDBC conn,
SQLINTEGER attr,
SQLPOINTER valueBuf,
SQLINTEGER valueBufLen,
SQLINTEGER* valueResLen)
{
using namespace odbc;
using namespace type_traits;
using app::ApplicationDataBuffer;
LOG_MSG("SQLGetConnectAttr called");
Connection *connection = reinterpret_cast<Connection*>(conn);
if (!connection)
return SQL_INVALID_HANDLE;
connection->GetAttribute(attr, valueBuf, valueBufLen, valueResLen);
return connection->GetDiagnosticRecords().GetReturnCode();
}
示例9: SQLGetInfo
SQLRETURN SQLGetInfo(SQLHDBC conn,
SQLUSMALLINT infoType,
SQLPOINTER infoValue,
SQLSMALLINT infoValueMax,
SQLSMALLINT* length)
{
using odbc::Connection;
using odbc::config::ConnectionInfo;
LOG_MSG("SQLGetInfo called: "
<< infoType << " (" << ConnectionInfo::InfoTypeToString(infoType) << "), "
<< std::hex << reinterpret_cast<size_t>(infoValue) << ", " << infoValueMax << ", "
<< std::hex << reinterpret_cast<size_t>(length));
Connection *connection = reinterpret_cast<Connection*>(conn);
if (!connection)
return SQL_INVALID_HANDLE;
connection->GetInfo(infoType, infoValue, infoValueMax, length);
return connection->GetDiagnosticRecords().GetReturnCode();
}