30 #ifndef CPL_ODBC_H_INCLUDED 31 #define CPL_ODBC_H_INCLUDED 47 # define ODBC_FILENAME_MAX PATH_MAX 49 # define ODBC_FILENAME_MAX (255 + 1) 64 char m_szPathOut[ODBC_FILENAME_MAX];
65 char m_szError[SQL_MAX_MESSAGE_LENGTH];
92 int InstallDriver(
const char* pszDriver,
const char* pszPathIn,
93 WORD fRequest = ODBC_INSTALL_COMPLETE );
111 int RemoveDriver(
const char* pszDriverName,
int fRemoveDSN = FALSE );
115 int GetUsageCount()
const {
return m_nUsageCount; }
121 const char* GetPathOut()
const {
return m_szPathOut; }
127 const char* GetLastError()
const {
return m_szError; }
134 DWORD GetLastErrorCode()
const {
return m_nErrorCode; }
143 #if defined(_MSC_VER) && !defined(SQLULEN) && !defined(_WIN64) 144 # define MISSING_SQLULEN 147 #if !defined(MISSING_SQLULEN) 149 # define _SQLULEN SQLULEN 150 # define _SQLLEN SQLLEN 152 # define _SQLULEN SQLUINTEGER 153 # define _SQLLEN SQLINTEGER 164 char m_szLastError[SQL_MAX_MESSAGE_LENGTH + 1];
167 int m_bInTransaction;
174 int EstablishSession(
const char *pszDSN,
175 const char *pszUserid,
176 const char *pszPassword );
177 const char *GetLastError();
181 int ClearTransaction();
182 int BeginTransaction();
183 int CommitTransaction();
184 int RollbackTransaction();
185 int IsInTransaction() {
return m_bInTransaction; }
191 int Failed(
int, HSTMT = NULL );
192 HDBC GetConnection() {
return m_hDBC; }
193 HENV GetEnvironment() {
return m_hEnv; }
210 SQLSMALLINT m_nColCount;
211 char **m_papszColNames;
212 SQLSMALLINT *m_panColType;
213 char **m_papszColTypeNames;
214 _SQLULEN *m_panColSize;
215 SQLSMALLINT *m_panColPrecision;
216 SQLSMALLINT *m_panColNullable;
218 char **m_papszColValues;
219 _SQLLEN *m_panColValueLengths;
223 char *m_pszStatement;
224 size_t m_nStatementMax;
225 size_t m_nStatementLen;
231 HSTMT GetStatement() {
return m_hStmt; }
235 void AppendEscaped(
const char * );
236 void Append(
const char * );
238 void Append(
double );
239 int Appendf(
const char *, ... ) CPL_PRINT_FUNC_FORMAT (2, 3);
240 const char *GetCommand() {
return m_pszStatement; }
242 int ExecuteSQL(
const char * = NULL );
245 int Fetch(
int nOrientation = SQL_FETCH_NEXT,
247 void ClearColumnData();
250 const char *GetColName(
int );
251 short GetColType(
int );
252 const char *GetColTypeName(
int );
253 short GetColSize(
int );
254 short GetColPrecision(
int );
255 short GetColNullable(
int );
257 int GetColId(
const char * );
258 const char *GetColData(
int,
const char * = NULL );
259 const char *GetColData(
const char *,
const char * = NULL );
260 int GetColDataLength(
int );
263 int GetColumns(
const char *pszTable,
264 const char *pszCatalog = NULL,
265 const char *pszSchema = NULL );
266 int GetPrimaryKeys(
const char *pszTable,
267 const char *pszCatalog = NULL,
268 const char *pszSchema = NULL );
270 int GetTables(
const char *pszCatalog = NULL,
271 const char *pszSchema = NULL );
273 void DumpResult( FILE *fp,
int bShowSchema = FALSE );
276 static SQLSMALLINT GetTypeMapping( SQLSMALLINT );
278 int CollectResultsInfo();
Definition: cpl_odbc.h:163
Convenient string class based on std::string.
Definition: cpl_string.h:226
Definition: cpl_odbc.h:205
Definition: cpl_odbc.h:62