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;
217 char **m_papszColColumnDef;
219 char **m_papszColValues;
220 _SQLLEN *m_panColValueLengths;
224 char *m_pszStatement;
225 size_t m_nStatementMax;
226 size_t m_nStatementLen;
232 HSTMT GetStatement() {
return m_hStmt; }
236 void AppendEscaped(
const char * );
237 void Append(
const char * );
239 void Append(
double );
240 int Appendf(
const char *, ... ) CPL_PRINT_FUNC_FORMAT (2, 3);
241 const char *GetCommand() {
return m_pszStatement; }
243 int ExecuteSQL(
const char * = NULL );
246 int Fetch(
int nOrientation = SQL_FETCH_NEXT,
248 void ClearColumnData();
251 const char *GetColName(
int );
252 short GetColType(
int );
253 const char *GetColTypeName(
int );
254 short GetColSize(
int );
255 short GetColPrecision(
int );
256 short GetColNullable(
int );
257 const char *GetColColumnDef(
int );
259 int GetColId(
const char * );
260 const char *GetColData(
int,
const char * = NULL );
261 const char *GetColData(
const char *,
const char * = NULL );
262 int GetColDataLength(
int );
263 int GetRowCountAffected();
266 int GetColumns(
const char *pszTable,
267 const char *pszCatalog = NULL,
268 const char *pszSchema = NULL );
269 int GetPrimaryKeys(
const char *pszTable,
270 const char *pszCatalog = NULL,
271 const char *pszSchema = NULL );
273 int GetTables(
const char *pszCatalog = NULL,
274 const char *pszSchema = NULL );
276 void DumpResult( FILE *fp,
int bShowSchema = FALSE );
279 static SQLSMALLINT GetTypeMapping( SQLSMALLINT );
281 int CollectResultsInfo();
Definition: cpl_odbc.h:163
Convenient string class based on std::string.
Definition: cpl_string.h:236
Definition: cpl_odbc.h:205
Definition: cpl_odbc.h:62