88 if (
Regex::test(__createDatabasePattern__, _conns,
true)) {
90 if(isc_dsql_execute_immediate(
109 ListedByteStringToByteStringMap map;
110 Connection::splitConnStr(_conns, _connlen, map);
112 ByteString _SERVER = map[
"SERVER"];
113 ByteString _DATABASE = map[
"DATABASE"];
114 ByteString _USER = map[
"USER"];
115 ByteString _PASSWORD = map[
"PASSWORD"];
116 ByteString _SQL_DIALECT = map[
"SQL_DIALECT"];
118 if (!_SQL_DIALECT.isEmpty()) {
119 int nDialect = SQL_DIALECT_CURRENT;
121 long n = strtol(_SQL_DIALECT, &endptr, 10);
122 if (n == LONG_MAX || n == LONG_MIN
123 || n < INT_MIN || INT_MAX < n
132 if (!(nDialect == SQL_DIALECT_V5
133 || nDialect == SQL_DIALECT_V6_TRANSITION
134 || nDialect == SQL_DIALECT_V6)
140 __dialect = nDialect;
143 if ((_USER.length() > 127) || (_PASSWORD.length() > 127)) {
150 if (!_SERVER.isEmpty())
151 dbEnv = _SERVER +
":";
153 if (!_DATABASE.isEmpty())
154 dbEnv = dbEnv + _DATABASE;
156 if (dbEnv.isEmpty()) {
162 ByteStringBuilder dpb;
163 dpb = (char)isc_dpb_version1;
164 dpb += (char)isc_dpb_user_name;
165 dpb += (char)_USER.length();
167 dpb += (char)isc_dpb_password;
168 dpb += (char)_PASSWORD.length();
171 static const char __UTF8__[] =
"UTF8";
172 dpb += (char)isc_dpb_lc_ctype;
173 dpb += (char)(
sizeof(__UTF8__) - 1);
176#if defined(FIREBIRD_IBASE_H) && FB_API_VER >= 40
177 static const char __SET_BIND__[] =
178 "DECFLOAT TO VARCHAR;"
180 "TIME ZONE TO EXTENDED";
181 dpb += (char)isc_dpb_set_bind;
182 dpb += (char)(
sizeof(__SET_BIND__) - 1);
186#ifdef FIREBIRD_IBASE_H
191 if (isc_attach_database(
193 (
short) dbEnv.length(),
194 (
_CONST char*) dbEnv.data(),
196 (
short) dpb.length(),
197 (
_CONST char*) dpb.data())
356 ByteStringBuilder sb;
357 if (!__lastErrorMessage.isEmpty())
358 sb = __lastErrorMessage;
361 ISC_STATUS* status = __status;
363#ifdef FIREBIRD_IBASE_H
364#define isc_interprete(buf, pp) fb_interpret(buf, sizeof(buf), (const ISC_STATUS**) pp)
366 for(
size_t i = 0; (len = isc_interprete(buf, &status))
370 sb.append(buf, 0, len);
374 if (sb.length() < *_buflen) {
375 *_buflen = sb.length();
376 *(_buf + *_buflen) =
'\0';
378 strncpy(_buf, sb.data(), *_buflen);
391 if (isc_database_info (
394 sizeof(database_info_items),
409 unsigned short length;
411 while(*p != isc_info_end) {
413 length = (
unsigned short)isc_vax_integer(p, 2);
415 if (item == isc_info_version) {
418 version.assign(p, 2, p[1]);
420 else if (item == isc_info_db_id) {
425 unsigned short strlen = *t++;
426 dbId.assign(t, strlen);
429 site.assign(t, strlen);
439#ifndef FIREBIRD_IBASE_H
440 "InterBase " + version
447 if (info.length() < *_buflen)
448 *_buflen = info.length();
450 strncpy(_buf, info.data(), *_buflen);