MAK Data Logger API Documentation for HLA
sqlIfError.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 1992-2010 VT MAK
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
9 #pragma once
10 
11 #include "vlDatabase.h"
12 
13 #ifdef _WIN32
14 #include <windows.h>
15 #include <sqltypes.h>
16 #include <odbcinst.h>
17 #else
18 #include <sqltypes.h>
19 #include <iodbcinst.h>
20 #endif
21 #if !defined(_INC_STDIO) && !defined(_STDIO_H)
22 #include <stdio.h>
23 #endif
24 
25 
26 //
27 // class DtSqlIfErrorHandler:
28 //
29 // Since the process for getting error information from the ODBC driver is
30 // somewhat circuitous, this class encapsulates the necessary calls, and writes
31 // any error messages to the log file provided. It checks the return code
32 // provided, so processReturnCode may be called immediately after any ODBC
33 // interface call without checking the returned error code first.
34 //
36 {
37 public:
38  // Default constructor
40 
41  // Destructor
42  virtual ~DtSqlIfErrorHandler();
43 
44  // process the return code from an ODBC interface call
45  virtual void processRetCode(
46  SQLRETURN retCode, SQLSMALLINT handle_type, SQLHANDLE handle );
47 
48  static bool SqlSuccess(SQLRETURN rc);
49 };
50 
51 inline bool DtSqlIfErrorHandler::SqlSuccess(SQLRETURN rc)
52 {
53  return ( (rc == SQL_SUCCESS) || (rc == SQL_SUCCESS_WITH_INFO) );
54 }

Document ID: Generated on Sun Dec 15 18:04:30 EST 2013 from SVN revision 134418
Copyright © 2005-2012 VT MÄK. All Rights Reserved (www.mak.com)