1#line 1 "ifxconnection.ec"
22#if __DCL_HAVE_ALLOC_DEBUG
23#undef __DCL_ALLOC_LEVEL
24#define __DCL_ALLOC_LEVEL __DCL_ALLOC_INTERNAL
44static volatile long __connectionID__ = 0;
69void IFXConnection::reset()
74#line 67 "ifxconnection.ec"
75#line 68 "ifxconnection.ec"
76 char *pszConnectionID = (
_CONST char*) __connectionID.data();
80#line 69 "ifxconnection.ec"
86#line 71 "ifxconnection.ec"
88#line 71 "ifxconnection.ec"
89 sqli_connect_set(0, pszConnectionID, 0);
90#line 71 "ifxconnection.ec"
96#line 73 "ifxconnection.ec"
98#line 73 "ifxconnection.ec"
99 sqli_trans_begin2((
mint)1);
100#line 73 "ifxconnection.ec"
103 Connection::__canTransact =
true;
107#line 76 "ifxconnection.ec"
109#line 76 "ifxconnection.ec"
110 sqli_trans_rollback();
111#line 76 "ifxconnection.ec"
115 Connection::__canTransact =
false;
122 ListedByteStringToByteStringMap map;
123 Connection::splitConnectionString(_connString, _connlen, map);
125 ByteString strServer = map[
"SERVER"];
126 ByteString strUser = map[
"USER"];
127 ByteString strPassword = map[
"PASSWORD"];
128 ByteString strDatabase = map[
"DATABASE"];
130 ByteString strDatabaseEnv = strDatabase;
131 if (!strServer.isEmpty()) {
132 strDatabaseEnv = strDatabaseEnv +
"@" + strServer;
139#line 100 "ifxconnection.ec"
140#line 101 "ifxconnection.ec"
141 char *pszUserName = (
_CONST char*) strUser.data();
142 char *pszPassword = (
_CONST char*) strPassword.data();
143 char *pszDatabaseEnv = (
_CONST char*) strDatabaseEnv.data();
144 char *pszConnectionID =
NULL;
148#line 105 "ifxconnection.ec"
151 pszConnectionID = (
_CONST char*) __connectionID.data();
158#line 109 "ifxconnection.ec"
160#line 111 "ifxconnection.ec"
161 ifx_conn_t *_sqiconn;
162 _sqiconn = (ifx_conn_t *)ifx_alloc_conn_user(pszUserName, pszPassword);
163 sqli_connect_open(ESQLINTVERSION, 0, pszDatabaseEnv, pszConnectionID, _sqiconn, 1);
164 ifx_free_conn_user(&_sqiconn);
165#line 111 "ifxconnection.ec"
172 if (!strDatabase.isEmpty())
183#line 125 "ifxconnection.ec"
184#line 126 "ifxconnection.ec"
185 char *pszConnectionID = (
_CONST char*) __connectionID.data();
189#line 127 "ifxconnection.ec"
195#line 129 "ifxconnection.ec"
197#line 129 "ifxconnection.ec"
198 sqli_connect_close(0, pszConnectionID, 0, 0);
199#line 129 "ifxconnection.ec"
228static StmtType __GetStmtType(
const char* _sql)
230 for(
size_t i = 0; sp[i].type !=
StmtOther; i++) {
247#line 173 "ifxconnection.ec"
248#line 174 "ifxconnection.ec"
249 char *pszConnectionID = (
_CONST char*) __connectionID.data();
250 char *pszSqlStatement = (
_CONST char*) _sql;
254#line 176 "ifxconnection.ec"
260#line 178 "ifxconnection.ec"
262#line 178 "ifxconnection.ec"
263 sqli_connect_set(0, pszConnectionID, 0);
264#line 178 "ifxconnection.ec"
274#line 184 "ifxconnection.ec"
276#line 184 "ifxconnection.ec"
277 sqli_exec_immed(pszSqlStatement);
278#line 184 "ifxconnection.ec"
285 switch(__GetStmtType(_sql)) {
308#line 210 "ifxconnection.ec"
309#line 211 "ifxconnection.ec"
310 char *pszConnectionID = (
_CONST char*) __connectionID.data();
314#line 212 "ifxconnection.ec"
320#line 214 "ifxconnection.ec"
322#line 214 "ifxconnection.ec"
323 sqli_connect_set(0, pszConnectionID, 0);
324#line 214 "ifxconnection.ec"
334#line 220 "ifxconnection.ec"
336#line 220 "ifxconnection.ec"
337 sqli_trans_begin2((
mint)1);
338#line 220 "ifxconnection.ec"
354#line 232 "ifxconnection.ec"
355#line 233 "ifxconnection.ec"
356 char *pszConnectionID = (
_CONST char*) __connectionID.data();
360#line 234 "ifxconnection.ec"
366#line 236 "ifxconnection.ec"
368#line 236 "ifxconnection.ec"
369 sqli_connect_set(0, pszConnectionID, 0);
370#line 236 "ifxconnection.ec"
380#line 242 "ifxconnection.ec"
382#line 242 "ifxconnection.ec"
384#line 242 "ifxconnection.ec"
400#line 254 "ifxconnection.ec"
401#line 255 "ifxconnection.ec"
402 char *pszConnectionID = (
_CONST char*) __connectionID.data();
406#line 256 "ifxconnection.ec"
412#line 258 "ifxconnection.ec"
414#line 258 "ifxconnection.ec"
415 sqli_connect_set(0, pszConnectionID, 0);
416#line 258 "ifxconnection.ec"
426#line 264 "ifxconnection.ec"
428#line 264 "ifxconnection.ec"
429 sqli_trans_rollback();
430#line 264 "ifxconnection.ec"
451 *_queryHandleOut = pNewQuery;
460 __lastErrorMessage.clear();
466 ByteStringBuilder sb;
467 sb.format(
"SQLCODE(%d) ", _SQLCODE);
471 mint r = rgetlmsg(_SQLCODE,
buf,
sizeof(
buf), &actual);
474 if (!isspace(
buf[actual - 1]))
479 sb.format(
buf, sqlca.sqlerrm);
482 sb.format(
"(%d)",
r);
485 sb.append(
"Message file not found");
488 sb.append(
"Message number not found in message file");
491 sb.append(
"Cannot seek within messge file");
494 sb.append(
"Message buffer too small");
497 sb.append(
"Unkndown");
500 __lastErrorMessage = sb.toByteString();
506 if (__lastErrorMessage.length() < *_buflen)
507 *_buflen = __lastErrorMessage.length();
508 strncpy(_buf, __lastErrorMessage.data(), *_buflen);
515 if (pQuery ==
NULL) {
520 bool localTrans =
false;
527 "SELECT DBINFO('version', 'full')"
528 " FROM systables WHERE tabid = 1";
530 if (!pQuery->prepare(_sql, ByteString::length(_sql), 0))
533 if (!pQuery->execute())
536 if (!pQuery->fetch())
577#line 408 "ifxconnection.ec"
#define __SET_ERROR_SQLCODE(SQLCODE)
#define __SET_ERROR(_error)
#define __DCL_ASSERT(expr)
#define IMPLEMENT_CLASSINFO(class_name, base_class_name)
#define __UNSET_STATE(state)
#define __SET_STATE(state)
void setErrorStatus(SQL::Error _error, long _SQLCODE, const wchar_t *_filename, int _line)
virtual bool __startTrans()
virtual bool __commitTrans()
virtual bool __rollbackTrans()
virtual bool __open(const char *_connString, size_t _connlen)
virtual bool __createQueryInstance(SQL::Query **_queryHandleOut)
virtual bool __execute(const char *_sql, size_t _sqllen)
virtual bool __getServerInfo(char *_buf, size_t *_buflen)
IFXConnection(const wchar_t *_serverTitle)
virtual bool __getErrorMessage(char *_buf, size_t *_buflen)
virtual bool isNull() const
virtual bool __getData(void *_pv, size_t *_size, SQL::DataType _dataType)
virtual bool __getField(size_t _index, SQL::Field **_fieldHandleOut)
static bool test(const wchar_t *_regex, const wchar_t *_string, bool _icase=false) __DCL_THROWS1(RegexException *)
Connection(const wchar_t *_serverTitle)
bool inState(unsigned int uState) const
__PROTECTED const wchar_t int _line
__PROTECTED const wchar_t * _filename
static long incrementAndGet(volatile long &_n)