30 #ifndef CPL_ODBC_H_INCLUDED 31 #define CPL_ODBC_H_INCLUDED 45 # define ODBC_FILENAME_MAX PATH_MAX 47 # define ODBC_FILENAME_MAX (255 + 1) 62 char m_szPathOut[ODBC_FILENAME_MAX];
63 char m_szError[SQL_MAX_MESSAGE_LENGTH];
90 int InstallDriver(
const char* pszDriver,
const char* pszPathIn,
91 WORD fRequest = ODBC_INSTALL_COMPLETE );
109 int RemoveDriver(
const char* pszDriverName,
int fRemoveDSN = FALSE );
113 int GetUsageCount()
const {
return m_nUsageCount; }
119 const char* GetPathOut()
const {
return m_szPathOut; }
125 const char* GetLastError()
const {
return m_szError; }
131 DWORD GetLastErrorCode()
const {
return m_nErrorCode; }
140 #if defined(_MSC_VER) && !defined(SQLULEN) && !defined(_WIN64) 141 # define MISSING_SQLULEN 144 #if !defined(MISSING_SQLULEN) 146 # define CPL_SQLULEN SQLULEN 147 # define CPL_SQLLEN SQLLEN 149 # define CPL_SQLULEN SQLUINTEGER 150 # define CPL_SQLLEN SQLINTEGER 161 char m_szLastError[SQL_MAX_MESSAGE_LENGTH + 1];
164 int m_bInTransaction;
171 int EstablishSession(
const char *pszDSN,
172 const char *pszUserid,
173 const char *pszPassword );
174 const char *GetLastError();
178 int ClearTransaction();
179 int BeginTransaction();
180 int CommitTransaction();
181 int RollbackTransaction();
182 int IsInTransaction() {
return m_bInTransaction; }
188 int Failed(
int, HSTMT = NULL );
189 HDBC GetConnection() {
return m_hDBC; }
190 HENV GetEnvironment() {
return m_hEnv; }
207 SQLSMALLINT m_nColCount;
208 char **m_papszColNames;
209 SQLSMALLINT *m_panColType;
210 char **m_papszColTypeNames;
211 CPL_SQLULEN *m_panColSize;
212 SQLSMALLINT *m_panColPrecision;
213 SQLSMALLINT *m_panColNullable;
214 char **m_papszColColumnDef;
216 char **m_papszColValues;
217 CPL_SQLLEN *m_panColValueLengths;
221 char *m_pszStatement;
222 size_t m_nStatementMax;
223 size_t m_nStatementLen;
229 HSTMT GetStatement() {
return m_hStmt; }
233 void AppendEscaped(
const char * );
234 void Append(
const char * );
236 void Append(
double );
237 int Appendf(
const char *, ... ) CPL_PRINT_FUNC_FORMAT (2, 3);
238 const char *GetCommand() {
return m_pszStatement; }
240 int ExecuteSQL(
const char * = NULL );
243 int Fetch(
int nOrientation = SQL_FETCH_NEXT,
245 void ClearColumnData();
248 const char *GetColName(
int );
249 short GetColType(
int );
250 const char *GetColTypeName(
int );
251 short GetColSize(
int );
252 short GetColPrecision(
int );
253 short GetColNullable(
int );
254 const char *GetColColumnDef(
int );
256 int GetColId(
const char * );
257 const char *GetColData(
int,
const char * = NULL );
258 const char *GetColData(
const char *,
const char * = NULL );
259 int GetColDataLength(
int );
260 int GetRowCountAffected();
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:160
Convenient string class based on std::string.
Definition: cpl_string.h:283
Definition: cpl_odbc.h:202
Definition: cpl_odbc.h:60