conninfo->allow_keyset = -1;
conninfo->lf_conversion = -1;
conninfo->true_is_minus1 = -1;
+ conninfo->int8_as = -101;
memcpy(&(conninfo->drivers), &globals, sizeof(globals));
}
/*
rv->client_encoding = NULL;
rv->server_encoding = NULL;
#endif /* MULTIBYTE */
+ rv->current_schema = NULL;
/* Initialize statement options to defaults */
free(self->server_encoding);
self->server_encoding = NULL;
#endif /* MULTIBYTE */
+ if (self->current_schema)
+ free(self->current_schema);
+ self->current_schema = NULL;
/* Free cached table info */
if (self->col_info)
{
if (self->col_info[i]->result) /* Free the SQLColumns result structure */
QR_Destructor(self->col_info[i]->result);
+ if (self->col_info[i]->schema)
+ free(self->col_info[i]->schema);
free(self->col_info[i]);
}
free(self->col_info);
}
}
}
+#else
+ {
+ }
#endif /* UNICODE_SUPPORT */
}
#ifdef UNICODE_SUPPORT
return value;
}
+/*
+ * This deosn't really return the CURRENT SCHEMA
+ * but there's no alternative.
+ */
+const char *
+CC_get_current_schema(ConnectionClass *conn)
+{
+ if (!conn->current_schema && conn->schema_support)
+ {
+ QResultClass *res;
+
+ if (res = CC_send_query(conn, "select current_schema()", NULL, CLEAR_RESULT_ON_ABORT), res)
+ {
+ if (QR_get_num_total_tuples(res) == 1)
+ conn->current_schema = strdup(QR_get_value_backend_row(res, 0, 0));
+ QR_Destructor(res);
+ }
+ }
+ return (const char *) conn->current_schema;
+}
+
int
CC_send_cancel_request(const ConnectionClass *conn)
{
char updatable_cursors;
char lf_conversion;
char true_is_minus1;
+ char int8_as;
GLOBAL_VALUES drivers; /* moved from driver's option */
} ConnInfo;
struct col_info
{
QResultClass *result;
+ char *schema;
char name[MAX_TABLE_LEN + 1];
};
int be_pid; /* pid returned by backend */
int be_key; /* auth code needed to send cancel */
UInt4 isolation;
+ char *current_schema;
};
void CC_on_commit(ConnectionClass *conn);
void CC_on_abort(ConnectionClass *conn, UDWORD opt);
void ProcessRollback(ConnectionClass *conn, BOOL undo);
+const char *CC_get_current_schema(ConnectionClass *conn);
/* CC_send_query options */
#define CLEAR_RESULT_ON_ABORT 1L
*/
bZone = FALSE; /* time zone stuff is unreliable */
timestamp2stime(value, &st, &bZone, &zone);
-inolog("2stime fr=%d\n", st.fr);
}
else
{
case SQL_C_ULONG:
len = 4;
-inolog("rgb=%x + %d, pcb=%x, set %s\n", rgbValue, bind_row * bind_size, pcbValue, neut_str);
if (bind_size > 0)
*(UDWORD *) ((char *) rgbValue + (bind_row * bind_size)) = atol(neut_str);
else
*
* Comments: See "notice.txt" for copyright and license information.
*
- * $Id: descriptor.h,v 1.5 2002/05/22 05:51:03 inoue Exp $
+ * $Id: descriptor.h,v 1.6 2002/06/06 04:50:47 inoue Exp $
*
*/
char dot[MAX_TABLE_LEN + 1];
char name[MAX_COLUMN_LEN + 1];
char alias[MAX_COLUMN_LEN + 1];
+ char *schema;
} FIELD_INFO;
Int4 FI_precision(const FIELD_INFO *);
Int4 FI_scale(const FIELD_INFO *);
extern GLOBAL_VALUES globals;
-#ifdef WIN32
-static int driver_optionsDraw(HWND, const ConnInfo *, int src, BOOL enable);
-static int driver_options_update(HWND hdlg, ConnInfo *ci, BOOL);
-static void updateCommons(const ConnInfo *ci);
-#endif
-
-#ifdef WIN32
-void
-SetDlgStuff(HWND hdlg, const ConnInfo *ci)
-{
- /*
- * If driver attribute NOT present, then set the datasource name and
- * description
- */
- if (ci->driver[0] == '\0')
- {
- SetDlgItemText(hdlg, IDC_DSNAME, ci->dsn);
- SetDlgItemText(hdlg, IDC_DESC, ci->desc);
- }
-
- SetDlgItemText(hdlg, IDC_DATABASE, ci->database);
- SetDlgItemText(hdlg, IDC_SERVER, ci->server);
- SetDlgItemText(hdlg, IDC_USER, ci->username);
- SetDlgItemText(hdlg, IDC_PASSWORD, ci->password);
- SetDlgItemText(hdlg, IDC_PORT, ci->port);
-}
-
-
-void
-GetDlgStuff(HWND hdlg, ConnInfo *ci)
-{
- GetDlgItemText(hdlg, IDC_DESC, ci->desc, sizeof(ci->desc));
-
- GetDlgItemText(hdlg, IDC_DATABASE, ci->database, sizeof(ci->database));
- GetDlgItemText(hdlg, IDC_SERVER, ci->server, sizeof(ci->server));
- GetDlgItemText(hdlg, IDC_USER, ci->username, sizeof(ci->username));
- GetDlgItemText(hdlg, IDC_PASSWORD, ci->password, sizeof(ci->password));
- GetDlgItemText(hdlg, IDC_PORT, ci->port, sizeof(ci->port));
-}
-
-
-static int
-driver_optionsDraw(HWND hdlg, const ConnInfo *ci, int src, BOOL enable)
-{
- const GLOBAL_VALUES *comval;
- static BOOL defset = FALSE;
- static GLOBAL_VALUES defval;
-
- switch (src)
- {
- case 0: /* driver common */
- comval = &globals;
- break;
- case 1: /* dsn specific */
- comval = &(ci->drivers);
- break;
- case 2: /* default */
- if (!defset)
- {
- defval.commlog = DEFAULT_COMMLOG;
- defval.disable_optimizer = DEFAULT_OPTIMIZER;
- defval.ksqo = DEFAULT_KSQO;
- defval.unique_index = DEFAULT_UNIQUEINDEX;
- defval.onlyread = DEFAULT_READONLY;
- defval.use_declarefetch = DEFAULT_USEDECLAREFETCH;
-
- defval.parse = DEFAULT_PARSE;
- defval.cancel_as_freestmt = DEFAULT_CANCELASFREESTMT;
- defval.debug = DEFAULT_DEBUG;
-
- /* Unknown Sizes */
- defval.unknown_sizes = DEFAULT_UNKNOWNSIZES;
- defval.text_as_longvarchar = DEFAULT_TEXTASLONGVARCHAR;
- defval.unknowns_as_longvarchar = DEFAULT_UNKNOWNSASLONGVARCHAR;
- defval.bools_as_char = DEFAULT_BOOLSASCHAR;
- }
- defset = TRUE;
- comval = &defval;
- break;
- }
-
- CheckDlgButton(hdlg, DRV_COMMLOG, comval->commlog);
-#ifndef Q_LOG
- EnableWindow(GetDlgItem(hdlg, DRV_COMMLOG), FALSE);
-#endif /* Q_LOG */
- CheckDlgButton(hdlg, DRV_OPTIMIZER, comval->disable_optimizer);
- CheckDlgButton(hdlg, DRV_KSQO, comval->ksqo);
- CheckDlgButton(hdlg, DRV_UNIQUEINDEX, comval->unique_index);
- /* EnableWindow(GetDlgItem(hdlg, DRV_UNIQUEINDEX), enable); */
- CheckDlgButton(hdlg, DRV_READONLY, comval->onlyread);
- EnableWindow(GetDlgItem(hdlg, DRV_READONLY), enable);
- CheckDlgButton(hdlg, DRV_USEDECLAREFETCH, comval->use_declarefetch);
-
- /* Unknown Sizes clear */
- CheckDlgButton(hdlg, DRV_UNKNOWN_DONTKNOW, 0);
- CheckDlgButton(hdlg, DRV_UNKNOWN_LONGEST, 0);
- CheckDlgButton(hdlg, DRV_UNKNOWN_MAX, 0);
- /* Unknown (Default) Data Type sizes */
- switch (comval->unknown_sizes)
- {
- case UNKNOWNS_AS_DONTKNOW:
- CheckDlgButton(hdlg, DRV_UNKNOWN_DONTKNOW, 1);
- break;
- case UNKNOWNS_AS_LONGEST:
- CheckDlgButton(hdlg, DRV_UNKNOWN_LONGEST, 1);
- break;
- case UNKNOWNS_AS_MAX:
- default:
- CheckDlgButton(hdlg, DRV_UNKNOWN_MAX, 1);
- break;
- }
-
- CheckDlgButton(hdlg, DRV_TEXT_LONGVARCHAR, comval->text_as_longvarchar);
- CheckDlgButton(hdlg, DRV_UNKNOWNS_LONGVARCHAR, comval->unknowns_as_longvarchar);
- CheckDlgButton(hdlg, DRV_BOOLS_CHAR, comval->bools_as_char);
- CheckDlgButton(hdlg, DRV_PARSE, comval->parse);
- CheckDlgButton(hdlg, DRV_CANCELASFREESTMT, comval->cancel_as_freestmt);
- CheckDlgButton(hdlg, DRV_DEBUG, comval->debug);
-#ifndef MY_LOG
- EnableWindow(GetDlgItem(hdlg, DRV_DEBUG), FALSE);
-#endif /* MY_LOG */
- SetDlgItemInt(hdlg, DRV_CACHE_SIZE, comval->fetch_max, FALSE);
- SetDlgItemInt(hdlg, DRV_VARCHAR_SIZE, comval->max_varchar_size, FALSE);
- SetDlgItemInt(hdlg, DRV_LONGVARCHAR_SIZE, comval->max_longvarchar_size, TRUE);
- SetDlgItemText(hdlg, DRV_EXTRASYSTABLEPREFIXES, comval->extra_systable_prefixes);
-
- /* Driver Connection Settings */
- SetDlgItemText(hdlg, DRV_CONNSETTINGS, comval->conn_settings);
- EnableWindow(GetDlgItem(hdlg, DRV_CONNSETTINGS), enable);
- return 0;
-}
-static int
-driver_options_update(HWND hdlg, ConnInfo *ci, BOOL updateProfile)
-{
- GLOBAL_VALUES *comval;
-
- if (ci)
- comval = &(ci->drivers);
- else
- comval = &globals;
- comval->commlog = IsDlgButtonChecked(hdlg, DRV_COMMLOG);
- comval->disable_optimizer = IsDlgButtonChecked(hdlg, DRV_OPTIMIZER);
- comval->ksqo = IsDlgButtonChecked(hdlg, DRV_KSQO);
- comval->unique_index = IsDlgButtonChecked(hdlg, DRV_UNIQUEINDEX);
- if (!ci)
- {
- comval->onlyread = IsDlgButtonChecked(hdlg, DRV_READONLY);
- }
- comval->use_declarefetch = IsDlgButtonChecked(hdlg, DRV_USEDECLAREFETCH);
-
- /* Unknown (Default) Data Type sizes */
- if (IsDlgButtonChecked(hdlg, DRV_UNKNOWN_MAX))
- comval->unknown_sizes = UNKNOWNS_AS_MAX;
- else if (IsDlgButtonChecked(hdlg, DRV_UNKNOWN_DONTKNOW))
- comval->unknown_sizes = UNKNOWNS_AS_DONTKNOW;
- else if (IsDlgButtonChecked(hdlg, DRV_UNKNOWN_LONGEST))
- comval->unknown_sizes = UNKNOWNS_AS_LONGEST;
- else
- comval->unknown_sizes = UNKNOWNS_AS_MAX;
-
- comval->text_as_longvarchar = IsDlgButtonChecked(hdlg, DRV_TEXT_LONGVARCHAR);
- comval->unknowns_as_longvarchar = IsDlgButtonChecked(hdlg, DRV_UNKNOWNS_LONGVARCHAR);
- comval->bools_as_char = IsDlgButtonChecked(hdlg, DRV_BOOLS_CHAR);
-
- comval->parse = IsDlgButtonChecked(hdlg, DRV_PARSE);
-
- comval->cancel_as_freestmt = IsDlgButtonChecked(hdlg, DRV_CANCELASFREESTMT);
- comval->debug = IsDlgButtonChecked(hdlg, DRV_DEBUG);
-
- comval->fetch_max = GetDlgItemInt(hdlg, DRV_CACHE_SIZE, NULL, FALSE);
- comval->max_varchar_size = GetDlgItemInt(hdlg, DRV_VARCHAR_SIZE, NULL, FALSE);
- comval->max_longvarchar_size = GetDlgItemInt(hdlg, DRV_LONGVARCHAR_SIZE, NULL, TRUE); /* allows for
- * SQL_NO_TOTAL */
-
- GetDlgItemText(hdlg, DRV_EXTRASYSTABLEPREFIXES, comval->extra_systable_prefixes, sizeof(comval->extra_systable_prefixes));
-
- /* Driver Connection Settings */
- if (!ci)
- GetDlgItemText(hdlg, DRV_CONNSETTINGS, comval->conn_settings, sizeof(comval->conn_settings));
-
- if (updateProfile)
- updateCommons(ci);
-
- /* fall through */
- return 0;
-}
-
-int CALLBACK
-driver_optionsProc(HWND hdlg,
- UINT wMsg,
- WPARAM wParam,
- LPARAM lParam)
-{
- ConnInfo *ci;
-
- switch (wMsg)
- {
- case WM_INITDIALOG:
- SetWindowLong(hdlg, DWL_USER, lParam); /* save for OK etc */
- ci = (ConnInfo *) lParam;
- CheckDlgButton(hdlg, DRV_OR_DSN, 0);
- if (ci && ci->dsn && ci->dsn[0])
- SetWindowText(hdlg, "Advanced Options (per DSN)");
- else
- {
- SetWindowText(hdlg, "Advanced Options (Connection)");
- ShowWindow(GetDlgItem(hdlg, DRV_OR_DSN), SW_HIDE);
- }
- driver_optionsDraw(hdlg, ci, 1, FALSE);
- break;
-
- case WM_COMMAND:
- switch (GET_WM_COMMAND_ID(wParam, lParam))
- {
- case IDOK:
- ci = (ConnInfo *) GetWindowLong(hdlg, DWL_USER);
- driver_options_update(hdlg, IsDlgButtonChecked(hdlg, DRV_OR_DSN) ? NULL : ci,
- ci && ci->dsn && ci->dsn[0]);
-
- case IDCANCEL:
- EndDialog(hdlg, GET_WM_COMMAND_ID(wParam, lParam) == IDOK);
- return TRUE;
-
- case IDDEFAULTS:
- if (IsDlgButtonChecked(hdlg, DRV_OR_DSN))
- driver_optionsDraw(hdlg, NULL, 2, TRUE);
- else
- {
- ConnInfo *ci = (ConnInfo *) GetWindowLong(hdlg, DWL_USER);
-
- driver_optionsDraw(hdlg, ci, 0, FALSE);
- }
- break;
-
- case DRV_OR_DSN:
- if (GET_WM_COMMAND_CMD(wParam, lParam) == BN_CLICKED)
- {
- mylog("DRV_OR_DSN clicked\n");
- if (IsDlgButtonChecked(hdlg, DRV_OR_DSN))
- {
- SetWindowText(hdlg, "Advanced Options (Common)");
- driver_optionsDraw(hdlg, NULL, 0, TRUE);
- }
- else
- {
- ConnInfo *ci = (ConnInfo *) GetWindowLong(hdlg, DWL_USER);
-
- SetWindowText(hdlg, "Advanced Options (per DSN)");
- driver_optionsDraw(hdlg, ci, ci ? 1 : 0, ci == NULL);
- }
- }
- break;
- }
- }
-
- return FALSE;
-}
-
-
-int CALLBACK
-ds_optionsProc(HWND hdlg,
- UINT wMsg,
- WPARAM wParam,
- LPARAM lParam)
-{
- ConnInfo *ci;
- char buf[128];
-
- switch (wMsg)
- {
- case WM_INITDIALOG:
- ci = (ConnInfo *) lParam;
- SetWindowLong(hdlg, DWL_USER, lParam); /* save for OK */
-
- /* Change window caption */
- if (ci->driver[0])
- SetWindowText(hdlg, "Advanced Options (Connection)");
- else
- {
- sprintf(buf, "Advanced Options (%s)", ci->dsn);
- SetWindowText(hdlg, buf);
- }
-
- /* Readonly */
- CheckDlgButton(hdlg, DS_READONLY, atoi(ci->onlyread));
-
- /* Protocol */
- if (strncmp(ci->protocol, PG62, strlen(PG62)) == 0)
- CheckDlgButton(hdlg, DS_PG62, 1);
- else if (strncmp(ci->protocol, PG63, strlen(PG63)) == 0)
- CheckDlgButton(hdlg, DS_PG63, 1);
- else
- /* latest */
- CheckDlgButton(hdlg, DS_PG64, 1);
-
- CheckDlgButton(hdlg, DS_SHOWOIDCOLUMN, atoi(ci->show_oid_column));
- CheckDlgButton(hdlg, DS_FAKEOIDINDEX, atoi(ci->fake_oid_index));
- CheckDlgButton(hdlg, DS_ROWVERSIONING, atoi(ci->row_versioning));
- CheckDlgButton(hdlg, DS_SHOWSYSTEMTABLES, atoi(ci->show_system_tables));
- CheckDlgButton(hdlg, DS_DISALLOWPREMATURE, ci->disallow_premature);
- CheckDlgButton(hdlg, DS_LFCONVERSION, ci->lf_conversion);
- CheckDlgButton(hdlg, DS_TRUEISMINUS1, ci->true_is_minus1);
- CheckDlgButton(hdlg, DS_UPDATABLECURSORS, ci->allow_keyset);
-#ifndef DRIVER_CURSOR_IMPLEMENT
- EnableWindow(GetDlgItem(hdlg, DS_UPDATABLECURSORS), FALSE);
-#endif /* DRIVER_CURSOR_IMPLEMENT */
-
- EnableWindow(GetDlgItem(hdlg, DS_FAKEOIDINDEX), atoi(ci->show_oid_column));
-
- /* Datasource Connection Settings */
- SetDlgItemText(hdlg, DS_CONNSETTINGS, ci->conn_settings);
- break;
-
- case WM_COMMAND:
- switch (GET_WM_COMMAND_ID(wParam, lParam))
- {
- case DS_SHOWOIDCOLUMN:
- mylog("WM_COMMAND: DS_SHOWOIDCOLUMN\n");
- EnableWindow(GetDlgItem(hdlg, DS_FAKEOIDINDEX), IsDlgButtonChecked(hdlg, DS_SHOWOIDCOLUMN));
- return TRUE;
-
- case IDOK:
- ci = (ConnInfo *) GetWindowLong(hdlg, DWL_USER);
- mylog("IDOK: got ci = %u\n", ci);
-
- /* Readonly */
- sprintf(ci->onlyread, "%d", IsDlgButtonChecked(hdlg, DS_READONLY));
-
- /* Protocol */
- if (IsDlgButtonChecked(hdlg, DS_PG62))
- strcpy(ci->protocol, PG62);
- else if (IsDlgButtonChecked(hdlg, DS_PG63))
- strcpy(ci->protocol, PG63);
- else
- /* latest */
- strcpy(ci->protocol, PG64);
-
- sprintf(ci->show_system_tables, "%d", IsDlgButtonChecked(hdlg, DS_SHOWSYSTEMTABLES));
-
- sprintf(ci->row_versioning, "%d", IsDlgButtonChecked(hdlg, DS_ROWVERSIONING));
- ci->disallow_premature = IsDlgButtonChecked(hdlg, DS_DISALLOWPREMATURE);
- ci->lf_conversion = IsDlgButtonChecked(hdlg, DS_LFCONVERSION);
- ci->true_is_minus1 = IsDlgButtonChecked(hdlg, DS_TRUEISMINUS1);
-#ifdef DRIVER_CURSOR_IMPLEMENT
- ci->allow_keyset = IsDlgButtonChecked(hdlg, DS_UPDATABLECURSORS);
-#endif /* DRIVER_CURSOR_IMPLEMENT */
-
- /* OID Options */
- sprintf(ci->fake_oid_index, "%d", IsDlgButtonChecked(hdlg, DS_FAKEOIDINDEX));
- sprintf(ci->show_oid_column, "%d", IsDlgButtonChecked(hdlg, DS_SHOWOIDCOLUMN));
-
- /* Datasource Connection Settings */
- GetDlgItemText(hdlg, DS_CONNSETTINGS, ci->conn_settings, sizeof(ci->conn_settings));
-
- /* fall through */
-
- case IDCANCEL:
- EndDialog(hdlg, GET_WM_COMMAND_ID(wParam, lParam) == IDOK);
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-/*
- * This function writes any global parameters (that can be manipulated)
- * to the ODBCINST.INI portion of the registry
- */
-static void
-updateCommons(const ConnInfo *ci)
-{
- const char *sectionName;
- const char *fileName;
- const GLOBAL_VALUES *comval;
- char tmp[128];
-
- if (ci)
- if (ci->dsn && ci->dsn[0])
- {
- mylog("DSN=%s updating\n", ci->dsn);
- comval = &(ci->drivers);
- sectionName = ci->dsn;
- fileName = ODBC_INI;
- }
- else
- {
- mylog("ci but dsn==NULL\n");
- return;
- }
- else
- {
- mylog("drivers updating\n");
- comval = &globals;
- sectionName = DBMS_NAME;
- fileName = ODBCINST_INI;
- }
- sprintf(tmp, "%d", comval->fetch_max);
- SQLWritePrivateProfileString(sectionName,
- INI_FETCH, tmp, fileName);
-
- sprintf(tmp, "%d", comval->commlog);
- SQLWritePrivateProfileString(sectionName,
- INI_COMMLOG, tmp, fileName);
-
- sprintf(tmp, "%d", comval->debug);
- SQLWritePrivateProfileString(sectionName,
- INI_DEBUG, tmp, fileName);
-
- sprintf(tmp, "%d", comval->disable_optimizer);
- SQLWritePrivateProfileString(sectionName,
- INI_OPTIMIZER, tmp, fileName);
-
- sprintf(tmp, "%d", comval->ksqo);
- SQLWritePrivateProfileString(sectionName,
- INI_KSQO, tmp, fileName);
-
- sprintf(tmp, "%d", comval->unique_index);
- SQLWritePrivateProfileString(sectionName, INI_UNIQUEINDEX, tmp, fileName);
- /*
- * Never update the onlyread from this module.
- */
- if (!ci)
- {
- sprintf(tmp, "%d", comval->onlyread);
- SQLWritePrivateProfileString(sectionName, INI_READONLY, tmp,
- fileName);
- }
-
- sprintf(tmp, "%d", comval->use_declarefetch);
- SQLWritePrivateProfileString(sectionName,
- INI_USEDECLAREFETCH, tmp, fileName);
-
- sprintf(tmp, "%d", comval->unknown_sizes);
- SQLWritePrivateProfileString(sectionName,
- INI_UNKNOWNSIZES, tmp, fileName);
-
- sprintf(tmp, "%d", comval->text_as_longvarchar);
- SQLWritePrivateProfileString(sectionName,
- INI_TEXTASLONGVARCHAR, tmp, fileName);
-
- sprintf(tmp, "%d", comval->unknowns_as_longvarchar);
- SQLWritePrivateProfileString(sectionName,
- INI_UNKNOWNSASLONGVARCHAR, tmp, fileName);
-
- sprintf(tmp, "%d", comval->bools_as_char);
- SQLWritePrivateProfileString(sectionName,
- INI_BOOLSASCHAR, tmp, fileName);
-
- sprintf(tmp, "%d", comval->parse);
- SQLWritePrivateProfileString(sectionName,
- INI_PARSE, tmp, fileName);
-
- sprintf(tmp, "%d", comval->cancel_as_freestmt);
- SQLWritePrivateProfileString(sectionName,
- INI_CANCELASFREESTMT, tmp, fileName);
-
- sprintf(tmp, "%d", comval->max_varchar_size);
- SQLWritePrivateProfileString(sectionName,
- INI_MAXVARCHARSIZE, tmp, fileName);
-
- sprintf(tmp, "%d", comval->max_longvarchar_size);
- SQLWritePrivateProfileString(sectionName,
- INI_MAXLONGVARCHARSIZE, tmp, fileName);
-
- SQLWritePrivateProfileString(sectionName,
- INI_EXTRASYSTABLEPREFIXES, comval->extra_systable_prefixes, fileName);
-
- /*
- * Never update the conn_setting from this module
- * SQLWritePrivateProfileString(sectionName, INI_CONNSETTINGS,
- * comval->conn_settings, fileName);
- */
-}
-#endif /* WIN32 */
-
-
void
makeConnectString(char *connect_string, const ConnInfo *ci, UWORD len)
{
hlen = strlen(connect_string);
if (!abbrev)
sprintf(&connect_string[hlen],
- ";%s=%s;%s=%s;%s=%s;%s=%s;%s=%s;%s=%s;%s=%s;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%s;%s=%d;%s=%d;%s=%d;%s=%d",
+ ";%s=%s;%s=%s;%s=%s;%s=%s;%s=%s;%s=%s;%s=%s;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d;%s=%s;%s=%d;%s=%d;%s=%d;%s=%d;%s=%d",
INI_READONLY,
ci->onlyread,
INI_PROTOCOL,
INI_DISALLOWPREMATURE,
ci->disallow_premature,
INI_TRUEISMINUS1,
+ ci->true_is_minus1,
+ INI_INT8AS,
ci->true_is_minus1);
/* Abbrebiation is needed ? */
if (abbrev || strlen(connect_string) >= len)
flag |= BIT_TRUEISMINUS1;
sprintf(&connect_string[hlen],
- ";A6=%s;A7=%d;A8=%d;B0=%d;B1=%d;C2=%s;CX=%02x%lx",
+ ";A6=%s;A7=%d;A8=%d;B0=%d;B1=%d;%s=%d;C2=%s;CX=%02x%lx",
encoded_conn_settings,
ci->drivers.fetch_max,
ci->drivers.socket_buffersize,
ci->drivers.max_varchar_size,
ci->drivers.max_longvarchar_size,
+ INI_INT8AS,
+ ci->int8_as,
ci->drivers.extra_systable_prefixes,
EFFECTIVE_BIT_COUNT,
flag);
ci->lf_conversion = atoi(value);
else if (stricmp(attribute, INI_TRUEISMINUS1) == 0)
ci->true_is_minus1 = atoi(value);
+ else if (stricmp(attribute, INI_INT8AS) == 0)
+ ci->int8_as = atoi(value);
else if (stricmp(attribute, "CX") == 0)
unfoldCXAttribute(ci, value);
ci->lf_conversion = DEFAULT_LFCONVERSION;
if (ci->true_is_minus1 < 0)
ci->true_is_minus1 = DEFAULT_TRUEISMINUS1;
+ if (ci->int8_as < -100)
+ ci->int8_as = DEFAULT_INT8AS;
}
ci->true_is_minus1 = atoi(temp);
}
+ if (ci->int8_as < -100 || overwrite)
+ {
+ SQLGetPrivateProfileString(DSN, INI_INT8AS, "", temp, sizeof(temp), ODBC_INI);
+ if (temp[0])
+ ci->int8_as = atoi(temp);
+ }
+
/* Allow override of odbcinst.ini parameters here */
getCommonDefaults(DSN, ODBC_INI, ci);
ci->translation_option);
}
+/*
+ * This function writes any global parameters (that can be manipulated)
+ * to the ODBCINST.INI portion of the registry
+ */
+void
+writeDriverCommoninfo(const ConnInfo *ci)
+{
+ const char *sectionName;
+ const char *fileName;
+ const GLOBAL_VALUES *comval;
+ char tmp[128];
+
+ if (ci)
+ if (ci->dsn && ci->dsn[0])
+ {
+ mylog("DSN=%s updating\n", ci->dsn);
+ comval = &(ci->drivers);
+ sectionName = ci->dsn;
+ fileName = ODBC_INI;
+ }
+ else
+ {
+ mylog("ci but dsn==NULL\n");
+ return;
+ }
+ else
+ {
+ mylog("drivers updating\n");
+ comval = &globals;
+ sectionName = DBMS_NAME;
+ fileName = ODBCINST_INI;
+ }
+ sprintf(tmp, "%d", comval->fetch_max);
+ SQLWritePrivateProfileString(sectionName,
+ INI_FETCH, tmp, fileName);
+
+ sprintf(tmp, "%d", comval->commlog);
+ SQLWritePrivateProfileString(sectionName,
+ INI_COMMLOG, tmp, fileName);
+
+ sprintf(tmp, "%d", comval->debug);
+ SQLWritePrivateProfileString(sectionName,
+ INI_DEBUG, tmp, fileName);
+
+ sprintf(tmp, "%d", comval->disable_optimizer);
+ SQLWritePrivateProfileString(sectionName,
+ INI_OPTIMIZER, tmp, fileName);
+
+ sprintf(tmp, "%d", comval->ksqo);
+ SQLWritePrivateProfileString(sectionName,
+ INI_KSQO, tmp, fileName);
+
+ sprintf(tmp, "%d", comval->unique_index);
+ SQLWritePrivateProfileString(sectionName, INI_UNIQUEINDEX, tmp, fileName);
+ /*
+ * Never update the onlyread from this module.
+ */
+ if (!ci)
+ {
+ sprintf(tmp, "%d", comval->onlyread);
+ SQLWritePrivateProfileString(sectionName, INI_READONLY, tmp,
+ fileName);
+ }
+
+ sprintf(tmp, "%d", comval->use_declarefetch);
+ SQLWritePrivateProfileString(sectionName,
+ INI_USEDECLAREFETCH, tmp, fileName);
+
+ sprintf(tmp, "%d", comval->unknown_sizes);
+ SQLWritePrivateProfileString(sectionName,
+ INI_UNKNOWNSIZES, tmp, fileName);
+
+ sprintf(tmp, "%d", comval->text_as_longvarchar);
+ SQLWritePrivateProfileString(sectionName,
+ INI_TEXTASLONGVARCHAR, tmp, fileName);
+
+ sprintf(tmp, "%d", comval->unknowns_as_longvarchar);
+ SQLWritePrivateProfileString(sectionName,
+ INI_UNKNOWNSASLONGVARCHAR, tmp, fileName);
+
+ sprintf(tmp, "%d", comval->bools_as_char);
+ SQLWritePrivateProfileString(sectionName,
+ INI_BOOLSASCHAR, tmp, fileName);
+
+ sprintf(tmp, "%d", comval->parse);
+ SQLWritePrivateProfileString(sectionName,
+ INI_PARSE, tmp, fileName);
+
+ sprintf(tmp, "%d", comval->cancel_as_freestmt);
+ SQLWritePrivateProfileString(sectionName,
+ INI_CANCELASFREESTMT, tmp, fileName);
+
+ sprintf(tmp, "%d", comval->max_varchar_size);
+ SQLWritePrivateProfileString(sectionName,
+ INI_MAXVARCHARSIZE, tmp, fileName);
+
+ sprintf(tmp, "%d", comval->max_longvarchar_size);
+ SQLWritePrivateProfileString(sectionName,
+ INI_MAXLONGVARCHARSIZE, tmp, fileName);
+
+ SQLWritePrivateProfileString(sectionName,
+ INI_EXTRASYSTABLEPREFIXES, comval->extra_systable_prefixes, fileName);
+
+ /*
+ * Never update the conn_setting from this module
+ * SQLWritePrivateProfileString(sectionName, INI_CONNSETTINGS,
+ * comval->conn_settings, fileName);
+ */
+}
/* This is for datasource based options only */
void
INI_TRUEISMINUS1,
temp,
ODBC_INI);
+ sprintf(temp, "%d", ci->int8_as);
+ SQLWritePrivateProfileString(DSN,
+ INI_INT8AS,
+ temp,
+ ODBC_INI);
}
#define INI_UPDATABLECURSORS "UpdatableCursors"
#define INI_LFCONVERSION "LFConversion"
#define INI_TRUEISMINUS1 "TrueIsMinus1"
+#define INI_INT8AS "BI"
/* Bit representaion for abbreviated connection strings */
#define BIT_LFCONVERSION (1L)
#define BIT_UPDATABLECURSORS (1L<<1)
#else
#define DEFAULT_LFCONVERSION 0
#endif /* WIN32 */
+#define DEFAULT_INT8AS 0
/* prototypes */
void getCommonDefaults(const char *section, const char *filename, ConnInfo *ci);
UINT wMsg,
WPARAM wParam,
LPARAM lParam);
-int CALLBACK ds_optionsProc(HWND hdlg,
+int CALLBACK ds_options1Proc(HWND hdlg,
+ UINT wMsg,
+ WPARAM wParam,
+ LPARAM lParam);
+int CALLBACK ds_options2Proc(HWND hdlg,
UINT wMsg,
WPARAM wParam,
LPARAM lParam);
#endif /* WIN32 */
void updateGlobals(void);
+void writeDriverCommoninfo(const ConnInfo *ci);
void writeDSNinfo(const ConnInfo *ci);
void getDSNdefaults(ConnInfo *ci);
void getDSNinfo(ConnInfo *ci, char overwrite);
--- /dev/null
+#ifdef WIN32
+/*-------
+ * Module: dlg_wingui.c
+ *
+ * Description: This module contains any specific code for handling
+ * dialog boxes such as driver/datasource options. Both the
+ * ConfigDSN() and the SQLDriverConnect() functions use
+ * functions in this module. If you were to add a new option
+ * to any dialog box, you would most likely only have to change
+ * things in here rather than in 2 separate places as before.
+ *
+ * Classes: none
+ *
+ * API functions: none
+ *
+ * Comments: See "notice.txt" for copyright and license information.
+ *-------
+ */
+/* Multibyte support Eiji Tokuya 2001-03-15 */
+
+#include "dlg_specific.h"
+
+#include "convert.h"
+
+#ifdef MULTIBYTE
+#include "multibyte.h"
+#endif
+#include "pgapifunc.h"
+
+#ifndef BOOL
+#define BOOL int
+#endif
+#ifndef FALSE
+#define FALSE (BOOL)0
+#endif
+#ifndef TRUE
+#define TRUE (BOOL)1
+#endif
+
+extern GLOBAL_VALUES globals;
+
+extern HINSTANCE NEAR s_hModule;
+static int driver_optionsDraw(HWND, const ConnInfo *, int src, BOOL enable);
+static int driver_options_update(HWND hdlg, ConnInfo *ci, BOOL);
+
+void
+SetDlgStuff(HWND hdlg, const ConnInfo *ci)
+{
+ /*
+ * If driver attribute NOT present, then set the datasource name and
+ * description
+ */
+ if (ci->driver[0] == '\0')
+ {
+ SetDlgItemText(hdlg, IDC_DSNAME, ci->dsn);
+ SetDlgItemText(hdlg, IDC_DESC, ci->desc);
+ }
+
+ SetDlgItemText(hdlg, IDC_DATABASE, ci->database);
+ SetDlgItemText(hdlg, IDC_SERVER, ci->server);
+ SetDlgItemText(hdlg, IDC_USER, ci->username);
+ SetDlgItemText(hdlg, IDC_PASSWORD, ci->password);
+ SetDlgItemText(hdlg, IDC_PORT, ci->port);
+}
+
+
+void
+GetDlgStuff(HWND hdlg, ConnInfo *ci)
+{
+ GetDlgItemText(hdlg, IDC_DESC, ci->desc, sizeof(ci->desc));
+
+ GetDlgItemText(hdlg, IDC_DATABASE, ci->database, sizeof(ci->database));
+ GetDlgItemText(hdlg, IDC_SERVER, ci->server, sizeof(ci->server));
+ GetDlgItemText(hdlg, IDC_USER, ci->username, sizeof(ci->username));
+ GetDlgItemText(hdlg, IDC_PASSWORD, ci->password, sizeof(ci->password));
+ GetDlgItemText(hdlg, IDC_PORT, ci->port, sizeof(ci->port));
+}
+
+
+static int
+driver_optionsDraw(HWND hdlg, const ConnInfo *ci, int src, BOOL enable)
+{
+ const GLOBAL_VALUES *comval;
+ static BOOL defset = FALSE;
+ static GLOBAL_VALUES defval;
+
+ switch (src)
+ {
+ case 0: /* driver common */
+ comval = &globals;
+ break;
+ case 1: /* dsn specific */
+ comval = &(ci->drivers);
+ break;
+ case 2: /* default */
+ if (!defset)
+ {
+ defval.commlog = DEFAULT_COMMLOG;
+ defval.disable_optimizer = DEFAULT_OPTIMIZER;
+ defval.ksqo = DEFAULT_KSQO;
+ defval.unique_index = DEFAULT_UNIQUEINDEX;
+ defval.onlyread = DEFAULT_READONLY;
+ defval.use_declarefetch = DEFAULT_USEDECLAREFETCH;
+
+ defval.parse = DEFAULT_PARSE;
+ defval.cancel_as_freestmt = DEFAULT_CANCELASFREESTMT;
+ defval.debug = DEFAULT_DEBUG;
+
+ /* Unknown Sizes */
+ defval.unknown_sizes = DEFAULT_UNKNOWNSIZES;
+ defval.text_as_longvarchar = DEFAULT_TEXTASLONGVARCHAR;
+ defval.unknowns_as_longvarchar = DEFAULT_UNKNOWNSASLONGVARCHAR;
+ defval.bools_as_char = DEFAULT_BOOLSASCHAR;
+ }
+ defset = TRUE;
+ comval = &defval;
+ break;
+ }
+
+ ShowWindow(GetDlgItem(hdlg, DRV_MSG_LABEL2), enable ? SW_SHOW : SW_HIDE);
+ CheckDlgButton(hdlg, DRV_COMMLOG, comval->commlog);
+#ifndef Q_LOG
+ EnableWindow(GetDlgItem(hdlg, DRV_COMMLOG), FALSE);
+#endif /* Q_LOG */
+ CheckDlgButton(hdlg, DRV_OPTIMIZER, comval->disable_optimizer);
+ CheckDlgButton(hdlg, DRV_KSQO, comval->ksqo);
+ CheckDlgButton(hdlg, DRV_UNIQUEINDEX, comval->unique_index);
+ /* EnableWindow(GetDlgItem(hdlg, DRV_UNIQUEINDEX), enable); */
+ CheckDlgButton(hdlg, DRV_READONLY, comval->onlyread);
+ EnableWindow(GetDlgItem(hdlg, DRV_READONLY), enable);
+ CheckDlgButton(hdlg, DRV_USEDECLAREFETCH, comval->use_declarefetch);
+
+ /* Unknown Sizes clear */
+ CheckDlgButton(hdlg, DRV_UNKNOWN_DONTKNOW, 0);
+ CheckDlgButton(hdlg, DRV_UNKNOWN_LONGEST, 0);
+ CheckDlgButton(hdlg, DRV_UNKNOWN_MAX, 0);
+ /* Unknown (Default) Data Type sizes */
+ switch (comval->unknown_sizes)
+ {
+ case UNKNOWNS_AS_DONTKNOW:
+ CheckDlgButton(hdlg, DRV_UNKNOWN_DONTKNOW, 1);
+ break;
+ case UNKNOWNS_AS_LONGEST:
+ CheckDlgButton(hdlg, DRV_UNKNOWN_LONGEST, 1);
+ break;
+ case UNKNOWNS_AS_MAX:
+ default:
+ CheckDlgButton(hdlg, DRV_UNKNOWN_MAX, 1);
+ break;
+ }
+
+ CheckDlgButton(hdlg, DRV_TEXT_LONGVARCHAR, comval->text_as_longvarchar);
+ CheckDlgButton(hdlg, DRV_UNKNOWNS_LONGVARCHAR, comval->unknowns_as_longvarchar);
+ CheckDlgButton(hdlg, DRV_BOOLS_CHAR, comval->bools_as_char);
+ CheckDlgButton(hdlg, DRV_PARSE, comval->parse);
+ CheckDlgButton(hdlg, DRV_CANCELASFREESTMT, comval->cancel_as_freestmt);
+ CheckDlgButton(hdlg, DRV_DEBUG, comval->debug);
+#ifndef MY_LOG
+ EnableWindow(GetDlgItem(hdlg, DRV_DEBUG), FALSE);
+#endif /* MY_LOG */
+ SetDlgItemInt(hdlg, DRV_CACHE_SIZE, comval->fetch_max, FALSE);
+ SetDlgItemInt(hdlg, DRV_VARCHAR_SIZE, comval->max_varchar_size, FALSE);
+ SetDlgItemInt(hdlg, DRV_LONGVARCHAR_SIZE, comval->max_longvarchar_size, TRUE);
+ SetDlgItemText(hdlg, DRV_EXTRASYSTABLEPREFIXES, comval->extra_systable_prefixes);
+
+ /* Driver Connection Settings */
+ SetDlgItemText(hdlg, DRV_CONNSETTINGS, comval->conn_settings);
+ EnableWindow(GetDlgItem(hdlg, DRV_CONNSETTINGS), enable);
+ ShowWindow(GetDlgItem(hdlg, IDPREVPAGE), enable ? SW_HIDE : SW_SHOW);
+ ShowWindow(GetDlgItem(hdlg, IDNEXTPAGE), enable ? SW_HIDE : SW_SHOW);
+ return 0;
+}
+static int
+driver_options_update(HWND hdlg, ConnInfo *ci, BOOL updateProfile)
+{
+ GLOBAL_VALUES *comval;
+
+ if (ci)
+ comval = &(ci->drivers);
+ else
+ comval = &globals;
+ comval->commlog = IsDlgButtonChecked(hdlg, DRV_COMMLOG);
+ comval->disable_optimizer = IsDlgButtonChecked(hdlg, DRV_OPTIMIZER);
+ comval->ksqo = IsDlgButtonChecked(hdlg, DRV_KSQO);
+ comval->unique_index = IsDlgButtonChecked(hdlg, DRV_UNIQUEINDEX);
+ if (!ci)
+ {
+ comval->onlyread = IsDlgButtonChecked(hdlg, DRV_READONLY);
+ }
+ comval->use_declarefetch = IsDlgButtonChecked(hdlg, DRV_USEDECLAREFETCH);
+
+ /* Unknown (Default) Data Type sizes */
+ if (IsDlgButtonChecked(hdlg, DRV_UNKNOWN_MAX))
+ comval->unknown_sizes = UNKNOWNS_AS_MAX;
+ else if (IsDlgButtonChecked(hdlg, DRV_UNKNOWN_DONTKNOW))
+ comval->unknown_sizes = UNKNOWNS_AS_DONTKNOW;
+ else if (IsDlgButtonChecked(hdlg, DRV_UNKNOWN_LONGEST))
+ comval->unknown_sizes = UNKNOWNS_AS_LONGEST;
+ else
+ comval->unknown_sizes = UNKNOWNS_AS_MAX;
+
+ comval->text_as_longvarchar = IsDlgButtonChecked(hdlg, DRV_TEXT_LONGVARCHAR);
+ comval->unknowns_as_longvarchar = IsDlgButtonChecked(hdlg, DRV_UNKNOWNS_LONGVARCHAR);
+ comval->bools_as_char = IsDlgButtonChecked(hdlg, DRV_BOOLS_CHAR);
+
+ comval->parse = IsDlgButtonChecked(hdlg, DRV_PARSE);
+
+ comval->cancel_as_freestmt = IsDlgButtonChecked(hdlg, DRV_CANCELASFREESTMT);
+ comval->debug = IsDlgButtonChecked(hdlg, DRV_DEBUG);
+
+ comval->fetch_max = GetDlgItemInt(hdlg, DRV_CACHE_SIZE, NULL, FALSE);
+ comval->max_varchar_size = GetDlgItemInt(hdlg, DRV_VARCHAR_SIZE, NULL, FALSE);
+ comval->max_longvarchar_size = GetDlgItemInt(hdlg, DRV_LONGVARCHAR_SIZE, NULL, TRUE); /* allows for
+ * SQL_NO_TOTAL */
+
+ GetDlgItemText(hdlg, DRV_EXTRASYSTABLEPREFIXES, comval->extra_systable_prefixes, sizeof(comval->extra_systable_prefixes));
+
+ /* Driver Connection Settings */
+ if (!ci)
+ GetDlgItemText(hdlg, DRV_CONNSETTINGS, comval->conn_settings, sizeof(comval->conn_settings));
+
+ if (updateProfile)
+ writeDriverCommoninfo(ci);
+
+ /* fall through */
+ return 0;
+}
+
+int CALLBACK
+driver_optionsProc(HWND hdlg,
+ UINT wMsg,
+ WPARAM wParam,
+ LPARAM lParam)
+{
+ ConnInfo *ci;
+
+ switch (wMsg)
+ {
+ case WM_INITDIALOG:
+ SetWindowLong(hdlg, DWL_USER, lParam); /* save for OK etc */
+ ci = (ConnInfo *) lParam;
+ SetWindowText(hdlg, "Advanced Options (Default)");
+ SetWindowText(GetDlgItem(hdlg, IDOK), "Save");
+ ShowWindow(GetDlgItem(hdlg, IDAPPLY), SW_HIDE);
+ driver_optionsDraw(hdlg, ci, 0, TRUE);
+ break;
+
+ case WM_COMMAND:
+ switch (GET_WM_COMMAND_ID(wParam, lParam))
+ {
+ case IDOK:
+ ci = (ConnInfo *) GetWindowLong(hdlg, DWL_USER);
+ driver_options_update(hdlg, NULL,
+ ci && ci->dsn && ci->dsn[0]);
+
+ case IDCANCEL:
+ EndDialog(hdlg, GET_WM_COMMAND_ID(wParam, lParam) == IDOK);
+ return TRUE;
+
+ case IDDEFAULTS:
+ driver_optionsDraw(hdlg, NULL, 2, TRUE);
+ break;
+ }
+ }
+
+ return FALSE;
+}
+
+int CALLBACK
+ds_options1Proc(HWND hdlg,
+ UINT wMsg,
+ WPARAM wParam,
+ LPARAM lParam)
+{
+ ConnInfo *ci;
+
+ switch (wMsg)
+ {
+ case WM_INITDIALOG:
+ SetWindowLong(hdlg, DWL_USER, lParam); /* save for OK etc */
+ ci = (ConnInfo *) lParam;
+ if (ci && ci->dsn && ci->dsn[0])
+ SetWindowText(hdlg, "Advanced Options (DSN 1/2)");
+ else
+ {
+ SetWindowText(hdlg, "Advanced Options (Connection 1/2)");
+ ShowWindow(GetDlgItem(hdlg, IDAPPLY), SW_HIDE);
+ }
+ driver_optionsDraw(hdlg, ci, 1, FALSE);
+ break;
+
+ case WM_COMMAND:
+ ci = (ConnInfo *) GetWindowLong(hdlg, DWL_USER);
+ switch (GET_WM_COMMAND_ID(wParam, lParam))
+ {
+ case IDOK:
+ driver_options_update(hdlg, ci, FALSE);
+
+ case IDCANCEL:
+ EndDialog(hdlg, GET_WM_COMMAND_ID(wParam, lParam) == IDOK);
+ return TRUE;
+
+ case IDAPPLY:
+ driver_options_update(hdlg, ci, FALSE);
+ SendMessage(GetWindow(hdlg, GW_OWNER), WM_COMMAND, wParam, lParam);
+ break;
+
+ case IDDEFAULTS:
+ driver_optionsDraw(hdlg, ci, 0, FALSE);
+ break;
+
+ case IDNEXTPAGE:
+ driver_options_update(hdlg, ci, FALSE);
+
+ EndDialog(hdlg, FALSE);
+ DialogBoxParam(s_hModule,
+ MAKEINTRESOURCE(DLG_OPTIONS_DS),
+ hdlg, ds_options2Proc, (LPARAM)
+ci);
+ break;
+ }
+ }
+
+ return FALSE;
+}
+
+
+int CALLBACK
+ds_options2Proc(HWND hdlg,
+ UINT wMsg,
+ WPARAM wParam,
+ LPARAM lParam)
+{
+ ConnInfo *ci;
+ char buf[128];
+ DWORD cmd;
+
+ switch (wMsg)
+ {
+ case WM_INITDIALOG:
+ ci = (ConnInfo *) lParam;
+ SetWindowLong(hdlg, DWL_USER, lParam); /* save for OK */
+
+ /* Change window caption */
+ if (ci->driver[0])
+ {
+ SetWindowText(hdlg, "Advanced Options (Connection 2/2)");
+ ShowWindow(GetDlgItem(hdlg, IDAPPLY), SW_HIDE); }
+ else
+ {
+ sprintf(buf, "Advanced Options (%s) 2/2", ci->dsn);
+ SetWindowText(hdlg, buf);
+ }
+
+ /* Readonly */
+ CheckDlgButton(hdlg, DS_READONLY, atoi(ci->onlyread));
+
+ /* Protocol */
+ if (strncmp(ci->protocol, PG62, strlen(PG62)) == 0)
+ CheckDlgButton(hdlg, DS_PG62, 1);
+ else if (strncmp(ci->protocol, PG63, strlen(PG63)) == 0)
+ CheckDlgButton(hdlg, DS_PG63, 1);
+ else
+ /* latest */
+ CheckDlgButton(hdlg, DS_PG64, 1);
+
+ /* Int8 As */
+ switch (ci->int8_as)
+ {
+ case SQL_BIGINT:
+ CheckDlgButton(hdlg, DS_INT8_AS_BIGINT, 1);
+ break;
+ case SQL_NUMERIC:
+ CheckDlgButton(hdlg, DS_INT8_AS_NUMERIC, 1);
+ break;
+ case SQL_VARCHAR:
+ CheckDlgButton(hdlg, DS_INT8_AS_VARCHAR, 1);
+ break;
+ case SQL_DOUBLE:
+ CheckDlgButton(hdlg, DS_INT8_AS_DOUBLE, 1);
+ break;
+ case SQL_INTEGER:
+ CheckDlgButton(hdlg, DS_INT8_AS_INT4, 1);
+ break;
+ default:
+ CheckDlgButton(hdlg, DS_INT8_AS_DEFAULT, 1);
+ }
+
+ CheckDlgButton(hdlg, DS_SHOWOIDCOLUMN, atoi(ci->show_oid_column));
+ CheckDlgButton(hdlg, DS_FAKEOIDINDEX, atoi(ci->fake_oid_index));
+ CheckDlgButton(hdlg, DS_ROWVERSIONING, atoi(ci->row_versioning));
+ CheckDlgButton(hdlg, DS_SHOWSYSTEMTABLES, atoi(ci->show_system_tables));
+ CheckDlgButton(hdlg, DS_DISALLOWPREMATURE, ci->disallow_premature);
+ CheckDlgButton(hdlg, DS_LFCONVERSION, ci->lf_conversion);
+ CheckDlgButton(hdlg, DS_TRUEISMINUS1, ci->true_is_minus1);
+ CheckDlgButton(hdlg, DS_UPDATABLECURSORS, ci->allow_keyset);
+#ifndef DRIVER_CURSOR_IMPLEMENT
+ EnableWindow(GetDlgItem(hdlg, DS_UPDATABLECURSORS), FALSE);
+#endif /* DRIVER_CURSOR_IMPLEMENT */
+
+ EnableWindow(GetDlgItem(hdlg, DS_FAKEOIDINDEX), atoi(ci->show_oid_column));
+
+ /* Datasource Connection Settings */
+ SetDlgItemText(hdlg, DS_CONNSETTINGS, ci->conn_settings);
+ break;
+
+ case WM_COMMAND:
+ switch (cmd = GET_WM_COMMAND_ID(wParam, lParam))
+ {
+ case DS_SHOWOIDCOLUMN:
+ mylog("WM_COMMAND: DS_SHOWOIDCOLUMN\n");
+ EnableWindow(GetDlgItem(hdlg, DS_FAKEOIDINDEX), IsDlgButtonChecked(hdlg, DS_SHOWOIDCOLUMN));
+ return TRUE;
+
+ case IDOK:
+ case IDAPPLY:
+ case IDPREVPAGE:
+ ci = (ConnInfo *) GetWindowLong(hdlg, DWL_USER);
+ mylog("IDOK: got ci = %u\n", ci);
+
+ /* Readonly */
+ sprintf(ci->onlyread, "%d", IsDlgButtonChecked(hdlg, DS_READONLY));
+
+ /* Protocol */
+ if (IsDlgButtonChecked(hdlg, DS_PG62))
+ strcpy(ci->protocol, PG62);
+ else if (IsDlgButtonChecked(hdlg, DS_PG63))
+ strcpy(ci->protocol, PG63);
+ else
+ /* latest */
+ strcpy(ci->protocol, PG64);
+
+ /* Int8 As */
+ if (IsDlgButtonChecked(hdlg, DS_INT8_AS_DEFAULT))
+ ci->int8_as = 0;
+ else if (IsDlgButtonChecked(hdlg, DS_INT8_AS_BIGINT))
+ ci->int8_as = SQL_BIGINT;
+ else if (IsDlgButtonChecked(hdlg, DS_INT8_AS_NUMERIC))
+ ci->int8_as = SQL_NUMERIC;
+ else if (IsDlgButtonChecked(hdlg, DS_INT8_AS_DOUBLE))
+ ci->int8_as = SQL_DOUBLE;
+ else if (IsDlgButtonChecked(hdlg, DS_INT8_AS_INT4))
+ ci->int8_as = SQL_INTEGER;
+ else
+ ci->int8_as = SQL_VARCHAR;
+
+ sprintf(ci->show_system_tables, "%d", IsDlgButtonChecked(hdlg, DS_SHOWSYSTEMTABLES));
+
+ sprintf(ci->row_versioning, "%d", IsDlgButtonChecked(hdlg, DS_ROWVERSIONING));
+ ci->disallow_premature = IsDlgButtonChecked(hdlg, DS_DISALLOWPREMATURE);
+ ci->lf_conversion = IsDlgButtonChecked(hdlg, DS_LFCONVERSION);
+ ci->true_is_minus1 = IsDlgButtonChecked(hdlg, DS_TRUEISMINUS1);
+#ifdef DRIVER_CURSOR_IMPLEMENT
+ ci->allow_keyset = IsDlgButtonChecked(hdlg, DS_UPDATABLECURSORS);
+#endif /* DRIVER_CURSOR_IMPLEMENT */
+
+ /* OID Options */
+ sprintf(ci->fake_oid_index, "%d", IsDlgButtonChecked(hdlg, DS_FAKEOIDINDEX));
+ sprintf(ci->show_oid_column, "%d", IsDlgButtonChecked(hdlg, DS_SHOWOIDCOLUMN));
+
+ /* Datasource Connection Settings */
+ GetDlgItemText(hdlg, DS_CONNSETTINGS, ci->conn_settings, sizeof(ci->conn_settings));
+ if (IDAPPLY == cmd)
+ {
+ SendMessage(GetWindow(hdlg, GW_OWNER), WM_COMMAND, wParam, lParam);
+ break;
+ }
+
+ EndDialog(hdlg, cmd == IDOK);
+ if (IDOK == cmd)
+ return TRUE;
+ DialogBoxParam(s_hModule,
+ MAKEINTRESOURCE(DLG_OPTIONS_DRV),
+ hdlg, ds_options1Proc, (LPARAM) ci);
+ break;
+
+ case IDCANCEL:
+ EndDialog(hdlg, GET_WM_COMMAND_ID(wParam, lParam) == IDOK);
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+#endif /* WIN32 */
ShowWindow(GetDlgItem(hdlg, IDC_DSNAME), SW_HIDE);
ShowWindow(GetDlgItem(hdlg, IDC_DESCTEXT), SW_HIDE);
ShowWindow(GetDlgItem(hdlg, IDC_DESC), SW_HIDE);
+ ShowWindow(GetDlgItem(hdlg, IDC_DRIVER), SW_HIDE);
SetWindowLong(hdlg, DWL_USER, lParam); /* Save the ConnInfo for
* the "OK" */
EndDialog(hdlg, GET_WM_COMMAND_ID(wParam, lParam) == IDOK);
return TRUE;
- case IDC_DRIVER:
+ case IDC_DATASOURCE:
ci = (ConnInfo *) GetWindowLong(hdlg, DWL_USER);
DialogBoxParam(s_hModule, MAKEINTRESOURCE(DLG_OPTIONS_DRV),
- hdlg, driver_optionsProc, (LPARAM) ci);
+ hdlg, ds_options1Proc, (LPARAM) ci);
break;
- case IDC_DATASOURCE:
+ case IDC_DRIVER:
ci = (ConnInfo *) GetWindowLong(hdlg, DWL_USER);
- DialogBoxParam(s_hModule, MAKEINTRESOURCE(DLG_OPTIONS_DS),
- hdlg, ds_optionsProc, (LPARAM) ci);
+ DialogBoxParam(s_hModule, MAKEINTRESOURCE(DLG_OPTIONS_DRV),
+ hdlg, driver_optionsProc, (LPARAM) ci);
break;
}
}
}
if (conn->schema_support)
- schema_strcat(tables_query, " and nspname like '%.*s'", szTableOwner, cbTableOwner, szTableName, cbTableName);
+ schema_strcat(tables_query, " and nspname like '%.*s'", szTableOwner, cbTableOwner, szTableName, cbTableName, conn);
else
my_strcat(tables_query, " and usename like '%.*s'", szTableOwner, cbTableOwner);
my_strcat(tables_query, " and relname like '%.*s'", szTableName, cbTableName);
{
my_strcat(columns_query, " and c.relname = '%.*s'", szTableName, cbTableName);
if (conn->schema_support)
- schema_strcat(columns_query, " and u.nspname = '%.*s'", szTableOwner, cbTableOwner, szTableName, cbTableName);
+ schema_strcat(columns_query, " and u.nspname = '%.*s'", szTableOwner, cbTableOwner, szTableName, cbTableName, conn);
else
my_strcat(columns_query, " and u.usename = '%.*s'", szTableOwner, cbTableOwner);
my_strcat(columns_query, " and a.attname = '%.*s'", szColumnName, cbColumnName);
escTbnamelen = reallyEscapeCatalogEscapes(szTableName, cbTableName, esc_table_name, sizeof(esc_table_name), conn->ccsc);
my_strcat(columns_query, " and c.relname like '%.*s'", esc_table_name, escTbnamelen);
if (conn->schema_support)
- schema_strcat(columns_query, " and u.nspname like '%.*s'", szTableOwner, cbTableOwner, szTableName, cbTableName);
+ schema_strcat(columns_query, " and u.nspname like '%.*s'", szTableOwner, cbTableOwner, szTableName, cbTableName, conn);
else
my_strcat(columns_query, " and u.usename like '%.*s'", szTableOwner, cbTableOwner);
my_strcat(columns_query, " and a.attname like '%.*s'", szColumnName, cbColumnName);
my_strcat(columns_query, " and c.relname = '%.*s'", szTableName, cbTableName);
/* SchemaName cannot contain a string search pattern */
if (conn->schema_support)
- schema_strcat(columns_query, " and u.nspname = '%.*s'", szTableOwner, cbTableOwner, szTableName, cbTableName);
+ schema_strcat(columns_query, " and u.nspname = '%.*s'", szTableOwner, cbTableOwner, szTableName, cbTableName, conn);
else
my_strcat(columns_query, " and u.usename = '%.*s'", szTableOwner, cbTableOwner);
}
table_qualifier[0] = '\0';
if (conn->schema_support)
- schema_strcat(table_qualifier, "%.*s", szTableOwner, cbTableOwner, szTableName, cbTableName);
+ schema_strcat(table_qualifier, "%.*s", szTableOwner, cbTableOwner, szTableName, cbTableName, conn);
/*
* we need to get a list of the field names first, so we can return
}
pkscm[0] = '\0';
if (conn->schema_support)
- schema_strcat(pkscm, "%.*s", szTableOwner, cbTableOwner, szTableName, cbTableName);
+ schema_strcat(pkscm, "%.*s", szTableOwner, cbTableOwner, szTableName, cbTableName, conn);
result = PGAPI_BindCol(htbl_stmt, 1, SQL_C_CHAR,
attname, MAX_INFO_STRING, &attname_len);
mylog("%s: entering Foreign Key Case #2", func);
if (conn->schema_support)
{
- schema_strcat(schema_needed, "%.*s", szFkTableOwner, cbFkTableOwner, szFkTableName, cbFkTableName);
+ schema_strcat(schema_needed, "%.*s", szFkTableOwner, cbFkTableOwner, szFkTableName, cbFkTableName, conn);
sprintf(tables_query, "SELECT pt.tgargs, "
" pt.tgnargs, "
" pt.tgdeferrable, "
{
if (conn->schema_support)
{
- schema_strcat(schema_needed, "%.*s", szPkTableOwner, cbPkTableOwner, szPkTableName, cbPkTableName);
+ schema_strcat(schema_needed, "%.*s", szPkTableOwner, cbPkTableOwner, szPkTableName, cbPkTableName, conn);
sprintf(tables_query, "SELECT pt.tgargs, "
" pt.tgnargs, "
" pt.tgdeferrable, "
if (conn->schema_support)
{
strcat(proc_query, " where pg_proc.pronamespace = pg_namespace.oid");
- schema_strcat(proc_query, " and nspname like '%.*s'", szProcOwner, cbProcOwner, szProcName, cbProcName);
+ schema_strcat(proc_query, " and nspname like '%.*s'", szProcOwner, cbProcOwner, szProcName, cbProcName, conn);
my_strcat(proc_query, " and proname like '%.*s'", szProcName, cbProcName);
}
else
{
if (conn->schema_support)
{
- schema_strcat(proc_query, " nspname = '%.*s' and", szTableOwner, cbTableOwner, szTableName, cbTableName);
+ schema_strcat(proc_query, " nspname = '%.*s' and", szTableOwner, cbTableOwner, szTableName, cbTableName, conn);
}
my_strcat(proc_query, " relname = '%.*s' and", szTableName, cbTableName);
}
if (conn->schema_support)
{
escTbnamelen = reallyEscapeCatalogEscapes(szTableOwner, cbTableOwner, esc_table_name, sizeof(esc_table_name), conn->ccsc);
- schema_strcat(proc_query, " nspname like '%.*s' and", esc_table_name, escTbnamelen, szTableName, cbTableName);
+ schema_strcat(proc_query, " nspname like '%.*s' and", esc_table_name, escTbnamelen, szTableName, cbTableName, conn);
}
escTbnamelen = reallyEscapeCatalogEscapes(szTableName, cbTableName, esc_table_name, sizeof(esc_table_name), conn->ccsc);
my_strcat(proc_query, " relname like '%.*s' and", esc_table_name, escTbnamelen);
break;
case SQL_KEYSET_CURSOR_ATTRIBUTES1:
len = 4;
- value = 0;
- if (ci->updatable_cursors || ci->drivers.lie)
- value |= (SQL_CA1_NEXT | SQL_CA1_ABSOLUTE
+ value = SQL_CA1_NEXT | SQL_CA1_ABSOLUTE
| SQL_CA1_RELATIVE | SQL_CA1_BOOKMARK
| SQL_CA1_LOCK_NO_CHANGE | SQL_CA1_POS_POSITION
- | SQL_CA1_POS_UPDATE | SQL_CA1_POS_DELETE
- | SQL_CA1_POS_REFRESH | SQL_CA1_BULK_ADD
+ | SQL_CA1_POS_REFRESH;
+ if (ci->updatable_cursors || ci->drivers.lie)
+ value |= (SQL_CA1_POS_UPDATE | SQL_CA1_POS_DELETE
+ | SQL_CA1_BULK_ADD
| SQL_CA1_BULK_UPDATE_BY_BOOKMARK
| SQL_CA1_BULK_DELETE_BY_BOOKMARK
| SQL_CA1_BULK_FETCH_BY_BOOKMARK
break;
case SQL_KEYSET_CURSOR_ATTRIBUTES2:
len = 4;
- value = 0;
+ value = SQL_CA2_READ_ONLY_CONCURRENCY;
if (ci->updatable_cursors || ci->drivers.lie)
value |= (SQL_CA2_OPT_ROWVER_CONCURRENCY
/*| SQL_CA2_CRC_APPROXIMATE*/
#include <process.h> /* Byron: is this where Windows keeps def.
* of getpid ? */
#endif
+#include "connection.h"
extern GLOBAL_VALUES globals;
void generate_filename(const char *, const char *, char *);
}
char *
-schema_strcat(char *buf, const char *fmt, const char *s, int len, const char *tbname, int tbnmlen)
+schema_strcat(char *buf, const char *fmt, const char *s, int len, const char *tbname, int tbnmlen, ConnectionClass *conn)
{
if (!s || 0 == len)
{
/*
- * I can find no appropriate way to find
- * the CURRENT SCHEMA. If you are lucky
- * you can get expected result.
+ * Note that this driver assumes the implicit schema is
+ * the CURRENT_SCHEMA() though it doesn't worth the
+ * naming.
*/
- /***** if (tbname && (tbnmlen > 0 || tbnmlen == SQL_NTS))
- return my_strcat(buf, fmt, "public", 6); *****/
+ if (conn->schema_support && tbname && (tbnmlen > 0 || tbnmlen == SQL_NTS))
+ return my_strcat(buf, fmt, CC_get_current_schema(conn), SQL_NTS);
return NULL;
}
return my_strcat(buf, fmt, s, len);
char *make_string(const char *s, int len, char *buf);
char *my_strcat(char *buf, const char *fmt, const char *s, int len);
char *schema_strcat(char *buf, const char *fmt, const char *s, int len,
- const char *, int);
+ const char *, int, ConnectionClass *conn);
/* #define GET_SCHEMA_NAME(nspname) (stricmp(nspname, "public") ? nspname : "") */
#define GET_SCHEMA_NAME(nspname) (nspname)
encstr = CC_lookup_cs_new(self);
if (self->client_encoding)
free(self->client_encoding);
+#ifndef UNICODE_SUPPORT
+#ifdef WIN32
+ else
+ {
+ const char *wenc = NULL;
+ switch (GetACP())
+ {
+ case 932:
+ wenc = "SJIS";
+ break;
+ case 936:
+ wenc = "GBK";
+ break;
+ case 949:
+ wenc = "UHC";
+ break;
+ case 950:
+ wenc = "BIG5";
+ break;
+ }
+ if (wenc && stricmp(encstr, wenc))
+ {
+ QResultClass *res;
+ char query[64];
+
+ sprintf(query, "set client_encoding to '%s'", wenc);
+ res = CC_send_query(self, query, NULL, CLEAR_RESULT_ON_ABORT);
+ if (res)
+ {
+ self->client_encoding = strdup(wenc);
+ QR_Destructor(res);
+ free(encstr);
+ return;
+ }
+ }
+ }
+#endif /* WIN32 */
+#endif /* UNICODE_SUPPORT */
if (encstr)
{
self->client_encoding = encstr;
if (fi[ifld]->dot[0])
{
- strcat(fi[ifld]->dot, ".");
- strcat(fi[ifld]->dot, fi[ifld]->name);
+ fi[ifld]->schema = strdup(fi[ifld]->dot);
}
- else
- strcpy(fi[ifld]->dot, fi[ifld]->name);
+ strcpy(fi[ifld]->dot, fi[ifld]->name);
strcpy(fi[ifld]->name, token);
if (delim == ',')
fi[i]->length = fi[i]->column_size;
continue;
}
+ /* field name contains the schema name */
+ else if (fi[i]->schema)
+ {
+ int matchidx = -1;
+
+ for (k = 0; k < stmt->ntab; k++)
+ {
+ if (!stricmp(ti[k]->name, fi[i]->dot))
+ {
+ if (!stricmp(ti[k]->schema, fi[i]->schema))
+ {
+ fi[i]->ti = ti[k];
+ break;
+ }
+ else if (!ti[k]->schema[0])
+ {
+ if (matchidx < 0)
+ matchidx = k;
+ else
+ {
+ stmt->parse_status = STMT_PARSE_FATAL;
+ stmt->errornumber = STMT_EXEC_ERROR;
+ stmt->errormsg = "duplicated Table name";
+ stmt->updatable = FALSE;
+ return FALSE;
+ }
+ }
+ }
+ }
+ if (matchidx >= 0)
+ fi[i]->ti = ti[matchidx];
+ }
/* it's a dot, resolve to table or alias */
else if (fi[i]->dot[0])
{
for (k = 0; k < stmt->ntab; k++)
{
- if (!stricmp(ti[k]->name, fi[i]->dot))
+ if (!stricmp(ti[k]->alias, fi[i]->dot))
{
fi[i]->ti = ti[k];
break;
}
- else if (!stricmp(ti[k]->alias, fi[i]->dot))
+ else if (!stricmp(ti[k]->name, fi[i]->dot))
{
fi[i]->ti = ti[k];
break;
/* See if already got it */
char found = FALSE;
- for (k = 0; k < conn->ntables; k++)
+ if (conn->schema_support)
{
- if (!stricmp(conn->col_info[k]->name, ti[i]->name))
+ if (!ti[i]->schema[0])
{
- mylog("FOUND col_info table='%s'\n", ti[i]->name);
- found = TRUE;
- break;
+ const char *curschema = CC_get_current_schema(conn);
+ /*
+ * Though current_schema() doesn't have
+ * much sense in PostgreSQL, we first
+ * check the current_schema() when no
+ * explicit schema name was specified.
+ */
+ for (k = 0; k < conn->ntables; k++)
+ {
+ if (!stricmp(conn->col_info[k]->name, ti[i]->name) &&
+ !stricmp(conn->col_info[k]->schema, curschema))
+ {
+ mylog("FOUND col_info table='%s' current schema='%s'\n", ti[i]->name, curschema);
+ found = TRUE;
+ strcpy(ti[i]->schema, curschema);
+ break;
+ }
+ }
+ if (!found)
+ {
+ QResultClass *res;
+ BOOL tblFound = FALSE;
+
+ /*
+ * We also have to check as follows.
+ */
+ sprintf(token, "select nspname from pg_namespace n, pg_class c"
+ " where c.relnamespace=n.oid and c.oid='%s'::regclass", ti[i]->name);
+ res = CC_send_query(conn, token, NULL, CLEAR_RESULT_ON_ABORT);
+ if (res)
+ {
+ if (QR_get_num_total_tuples(res) == 1)
+ {
+ tblFound = TRUE;
+ strcpy(ti[i]->schema, QR_get_value_backend_row(res, 0, 0));
+ }
+ QR_Destructor(res);
+ }
+ else
+ CC_abort(conn);
+ if (!tblFound)
+ {
+ stmt->parse_status = STMT_PARSE_FATAL;
+ stmt->errornumber = STMT_EXEC_ERROR;
+ stmt->errormsg = "Table not found";
+ stmt->updatable = FALSE;
+ return FALSE;
+ }
+ }
+ }
+ if (!found && ti[i]->schema[0])
+ {
+ for (k = 0; k < conn->ntables; k++)
+ {
+ if (!stricmp(conn->col_info[k]->name, ti[i]->name) &&
+ !stricmp(conn->col_info[k]->schema, ti[i]->schema))
+ {
+ mylog("FOUND col_info table='%s' schema='%s'\n", ti[i]->name, ti[i]->schema);
+ found = TRUE;
+ break;
+ }
+ }
+ }
+ }
+ else
+ {
+ for (k = 0; k < conn->ntables; k++)
+ {
+ if (!stricmp(conn->col_info[k]->name, ti[i]->name))
+ {
+ mylog("FOUND col_info table='%s'\n", ti[i]->name);
+ found = TRUE;
+ break;
+ }
}
}
col_stmt = (StatementClass *) hcol_stmt;
col_stmt->internal = TRUE;
- if (!ti[i]->schema[0] && conn->schema_support)
- {
- QResultClass *res;
- BOOL tblFound = FALSE;
-
- /* Unfortunately CURRENT_SCHEMA doesn't exist
- * in PostgreSQL and we have to check as follows.
- */
- sprintf(token, "select nspname from pg_namespace n, pg_class c"
- " where c.relnamespace=n.oid and c.oid='%s'::regclass", ti[i]->name);
- res = CC_send_query(conn, token, NULL, CLEAR_RESULT_ON_ABORT);
- if (res)
- {
- if (QR_get_num_total_tuples(res) == 1)
- {
- tblFound = TRUE;
- strcpy(ti[i]->schema, QR_get_value_backend_row(res, 0, 0));
- }
- QR_Destructor(res);
- }
- else
- CC_abort(conn);
- if (!tblFound)
- {
- stmt->parse_status = STMT_PARSE_FATAL;
- stmt->errornumber = STMT_EXEC_ERROR;
- stmt->errormsg = "Table not found";
- stmt->updatable = FALSE;
- return FALSE;
- }
- }
result = PGAPI_Columns(hcol_stmt, "", 0, ti[i]->schema,
SQL_NTS, ti[i]->name, SQL_NTS, "", 0, PODBC_NOT_SEARCH_PATTERN);
* Store the table name and the SQLColumns result
* structure
*/
+ if (ti[i]->schema[0])
+ conn->col_info[conn->ntables]->schema = strdup(ti[i]->schema);
+ else
+ conn->col_info[conn->ntables]->schema = NULL;
strcpy(conn->col_info[conn->ntables]->name, ti[i]->name);
conn->col_info[conn->ntables]->result = SC_get_Curres(col_stmt);
/* Change this to SQL_BIGINT for ODBC v3 bjm 2001-01-23 */
case PG_TYPE_INT8:
+ if (ci->int8_as != 0)
+ return ci->int8_as;
if (conn->ms_jet)
return SQL_NUMERIC; /* maybe a little better than SQL_VARCHAR */
#if (ODBCVER >= 0x0300)
maxsize;
QResultClass *result;
ColumnInfoClass *flds;
- ConnInfo *ci = &(SC_get_conn(stmt)->connInfo);
+ ConnectionClass *conn = SC_get_conn(stmt);
+ ConnInfo *ci = &(conn->connInfo);
mylog("getCharColumnSize: type=%d, col=%d, unknown = %d\n", type, col, handle_unknown_size_as);
p = QR_get_display_size(result, col); /* longest */
attlen = QR_get_atttypmod(result, col);
/* Size is unknown -- handle according to parameter */
- if (attlen >= p && attlen > 0) /* maybe the length is known */
- return attlen;
+ if (attlen > 0) /* maybe the length is known */
+ {
+ if (attlen >= p)
+ return attlen;
+ switch (type)
+ {
+ case PG_TYPE_VARCHAR:
+ case PG_TYPE_BPCHAR:
+ if (conn->unicode || conn->ms_jet)
+ return attlen;
+#if (ODBCVER >= 0x0300)
+#ifdef MULTIBYTE
+ return attlen;
+#endif /* MULTIBYTE */
+#endif /* ODBCVER */
+ return p;
+ }
+ }
/* The type is really unknown */
if (type == PG_TYPE_BPCHAR || handle_unknown_size_as == UNKNOWNS_AS_LONGEST)
*
* Comments: See "notice.txt" for copyright and license information.
*
- * $Id: psqlodbc.h,v 1.66 2002/05/22 05:51:03 inoue Exp $
+ * $Id: psqlodbc.h,v 1.67 2002/06/06 04:50:47 inoue Exp $
*
*/
PUSHBUTTON "Cancel",IDCANCEL,81,88,40,14
GROUPBOX "Options (Advanced):",IDC_OPTIONS,141,72,140,35,
BS_CENTER
- PUSHBUTTON "Driver",IDC_DRIVER,149,89,50,14
- PUSHBUTTON "DataSource",IDC_DATASOURCE,221,88,50,14
+ PUSHBUTTON "DataSource",IDC_DATASOURCE,149,89,50,14
+ PUSHBUTTON "Default",IDC_DRIVER,221,88,50,14
CTEXT "Please supply any missing information needed to connect.",
DRV_MSG_LABEL,25,4,238,10
END
CAPTION "Advanced Options (Driver)"
FONT 10, "Terminal"
BEGIN
+ PUSHBUTTON "Page 1",IDPREVPAGE,10,1,40,15
+ PUSHBUTTON "Page 2",IDNEXTPAGE,50,1,40,15
+ CTEXT "Set your site's defaults (for new DSNs).",
+ DRV_MSG_LABEL2,15,1,270,10, SS_CENTER | WS_GROUP, WS_EX_STATICEDGE
CONTROL "Disable Genetic &Optimizer",DRV_OPTIMIZER,"Button",
- BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,13,11,116,10
+ BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,13,18,116,10
CONTROL "Comm&Log (C:\\psqlodbc.log)",DRV_COMMLOG,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,164,11,120,10
+ BS_AUTOCHECKBOX | WS_TABSTOP,164,18,120,10
CONTROL "&KSQO (Keyset Query Optimization)",DRV_KSQO,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,13,23,144,10
+ BS_AUTOCHECKBOX | WS_TABSTOP,13,30,144,10
CONTROL "&ReadOnly (Default)",DRV_READONLY,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,164,24,88,10
+ BS_AUTOCHECKBOX | WS_TABSTOP,164,31,88,10
CONTROL "Recognize Unique &Indexes",DRV_UNIQUEINDEX,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,13,35,112,10
+ BS_AUTOCHECKBOX | WS_TABSTOP,13,42,112,10
CONTROL "P&arse Statements",DRV_PARSE,"Button",BS_AUTOCHECKBOX |
- WS_TABSTOP,164,37,80,10
+ WS_TABSTOP,164,44,80,10
CONTROL "&Use Declare/Fetch",DRV_USEDECLAREFETCH,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,13,47,84,10
+ BS_AUTOCHECKBOX | WS_TABSTOP,13,54,84,10
CONTROL "Cancel as FreeStmt (Exp)",DRV_CANCELASFREESTMT,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,164,50,112,10
+ BS_AUTOCHECKBOX | WS_TABSTOP,164,57,112,10
CONTROL "Mylog(Debug ouput)",DRV_DEBUG,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,164,63,112,10
- GROUPBOX "Unknown Sizes",IDC_STATIC,13,76,175,24
+ BS_AUTOCHECKBOX | WS_TABSTOP,164,70,112,10
+ GROUPBOX "Unknown Sizes",IDC_STATIC,13,81,175,24
CONTROL "Maximum",DRV_UNKNOWN_MAX,"Button",BS_AUTORADIOBUTTON |
- WS_GROUP | WS_TABSTOP,21,84,44,10
+ WS_GROUP | WS_TABSTOP,21,89,44,10
CONTROL "Don't Know",DRV_UNKNOWN_DONTKNOW,"Button",
- BS_AUTORADIOBUTTON | WS_TABSTOP,72,84,56,10
+ BS_AUTORADIOBUTTON | WS_TABSTOP,72,89,56,10
CONTROL "Longest",DRV_UNKNOWN_LONGEST,"Button",
- BS_AUTORADIOBUTTON | WS_TABSTOP,135,84,44,10
- GROUPBOX "Data Type Options",IDC_STATIC,13,104,282,23
+ BS_AUTORADIOBUTTON | WS_TABSTOP,135,89,44,10
+ GROUPBOX "Data Type Options",IDC_STATIC,13,109,282,23
CONTROL "Text as LongVarChar",DRV_TEXT_LONGVARCHAR,"Button",
- BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,15,115,92,10
+ BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,15,120,92,10
CONTROL "Unknowns as LongVarChar",DRV_UNKNOWNS_LONGVARCHAR,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,112,115,108,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,112,120,108,10
CONTROL "Bools as Char",DRV_BOOLS_CHAR,"Button",BS_AUTOCHECKBOX |
- WS_TABSTOP,225,115,68,10
- LTEXT "&Cache Size:",IDC_STATIC,15,133,45,8
- EDITTEXT DRV_CACHE_SIZE,61,129,35,12,ES_AUTOHSCROLL
- LTEXT "Max &Varchar:",IDC_STATIC,99,133,49,8
- EDITTEXT DRV_VARCHAR_SIZE,149,129,35,12,ES_AUTOHSCROLL
- LTEXT "Max Lon&gVarChar:",IDC_STATIC,192,133,65,8
- EDITTEXT DRV_LONGVARCHAR_SIZE,259,129,35,12,ES_AUTOHSCROLL
- LTEXT "SysTable &Prefixes:",IDC_STATIC,23,144,36,20
- EDITTEXT DRV_EXTRASYSTABLEPREFIXES,61,153,75,12,ES_AUTOHSCROLL
- LTEXT "Connect &Settings:",IDC_STATIC,22,165,35,20
- EDITTEXT DRV_CONNSETTINGS,61,165,225,25,ES_MULTILINE |
+ WS_TABSTOP,225,120,68,10
+ LTEXT "&Cache Size:",IDC_STATIC,15,138,45,8
+ EDITTEXT DRV_CACHE_SIZE,61,134,35,12,ES_AUTOHSCROLL
+ LTEXT "Max &Varchar:",IDC_STATIC,99,138,49,8
+ EDITTEXT DRV_VARCHAR_SIZE,149,134,35,12,ES_AUTOHSCROLL
+ LTEXT "Max Lon&gVarChar:",IDC_STATIC,192,138,65,8
+ EDITTEXT DRV_LONGVARCHAR_SIZE,259,134,35,12,ES_AUTOHSCROLL
+ LTEXT "SysTable &Prefixes:",IDC_STATIC,23,149,36,20
+ EDITTEXT DRV_EXTRASYSTABLEPREFIXES,61,158,75,12,ES_AUTOHSCROLL
+ LTEXT "Connect &Settings:",IDC_STATIC,22,170,35,20
+ EDITTEXT DRV_CONNSETTINGS,61,170,225,25,ES_MULTILINE |
ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN
- DEFPUSHBUTTON "OK",IDOK,59,201,50,14,WS_GROUP
- PUSHBUTTON "Cancel",IDCANCEL,124,201,50,14
- PUSHBUTTON "Defaults",IDDEFAULTS,189,201,50,15
- CONTROL "Default",DRV_OR_DSN,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT |
- BS_NOTIFY | WS_TABSTOP,247,205,40,10
+ DEFPUSHBUTTON "Close",IDOK,39,201,50,14,WS_GROUP
+ PUSHBUTTON "Cancel",IDCANCEL,104,201,50,15
+ PUSHBUTTON "Apply",IDAPPLY,169,201,50,14
+ PUSHBUTTON "Defaults",IDDEFAULTS,234,201,50,15
END
-DLG_OPTIONS_DS DIALOG DISCARDABLE 0, 0, 267, 196
+DLG_OPTIONS_DS DIALOG DISCARDABLE 0, 0, 267, 226
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Advanced Options (DataSource)"
FONT 10, "Terminal"
BEGIN
+ PUSHBUTTON "Page 2",IDNEXTPAGE,50,1,40,15
+ PUSHBUTTON "Page 1",IDPREVPAGE,10,1,40,15
CONTROL "&ReadOnly",DS_READONLY,"Button",BS_AUTOCHECKBOX |
- WS_GROUP | WS_TABSTOP,45,13,48,10
+ WS_GROUP | WS_TABSTOP,25,18,48,10
CONTROL "Row &Versioning",DS_ROWVERSIONING,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,149,13,72,10
+ BS_AUTOCHECKBOX | WS_TABSTOP,129,18,72,10
CONTROL "Show System &Tables",DS_SHOWSYSTEMTABLES,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,45,28,88,10
+ BS_AUTOCHECKBOX | WS_TABSTOP,25,33,88,10
CONTROL "Disallow &Premature",DS_DISALLOWPREMATURE,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,149,28,86,10
+ BS_AUTOCHECKBOX | WS_TABSTOP,129,33,86,10
CONTROL "LF <-> CR/LF convert",DS_LFCONVERSION,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,45,43,92,10
+ BS_AUTOCHECKBOX | WS_TABSTOP,25,48,92,10
CONTROL "True is -1",DS_TRUEISMINUS1,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,149,43,86,10
+ BS_AUTOCHECKBOX | WS_TABSTOP,129,48,86,10
CONTROL "(Trial) Updatable cursors",DS_UPDATABLECURSORS,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,45,58,112,10
- GROUPBOX "Protocol",IDC_STATIC,43,74,180,25
+ BS_AUTOCHECKBOX | WS_TABSTOP,25,63,112,10
+ GROUPBOX "Int8 As",IDC_STATIC,23,79,235,25
+ CONTROL "default",DS_INT8_AS_DEFAULT,"Button",BS_AUTORADIOBUTTON |
+ WS_GROUP,30,89,47,10
+ CONTROL "bigint",DS_INT8_AS_BIGINT,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,
+ 70,89,35,10
+ CONTROL "numeric",DS_INT8_AS_NUMERIC,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,
+ 107,89,40,10
+ CONTROL "varchar",DS_INT8_AS_VARCHAR,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,
+ 149,89,40,10
+ CONTROL "double",DS_INT8_AS_DOUBLE,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,
+ 190,89,40,10
+ CONTROL "int4",DS_INT8_AS_INT4,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,
+ 227,89,28,10
+ GROUPBOX "Protocol",IDC_STATIC,23,109,180,25
CONTROL "7.X,6.4+",DS_PG64,"Button",BS_AUTORADIOBUTTON |
- WS_GROUP,53,84,47,10
+ WS_GROUP,33,119,47,10
CONTROL "6.3",DS_PG63,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,
- 131,84,26,10
+ 83,119,26,10
CONTROL "6.2",DS_PG62,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,
- 187,84,26,10
- GROUPBOX "OID Options",IDC_STATIC,43,104,180,25
+ 133,119,26,10
+ GROUPBOX "OID Options",IDC_STATIC,23,129,180,25
CONTROL "Show &Column",DS_SHOWOIDCOLUMN,"Button",BS_AUTOCHECKBOX |
- WS_GROUP | WS_TABSTOP,53,115,59,10
+ WS_GROUP | WS_TABSTOP,33,140,59,10
CONTROL "Fake &Index",DS_FAKEOIDINDEX,"Button",BS_AUTOCHECKBOX |
- WS_GROUP | WS_TABSTOP,161,115,55,10
- LTEXT "Connect &Settings:",IDC_STATIC,10,135,35,25
- EDITTEXT DS_CONNSETTINGS,50,135,200,20,ES_MULTILINE |
+ WS_GROUP | WS_TABSTOP,141,140,55,10
+ LTEXT "Connect &Settings:",IDC_STATIC,10,170,35,25
+ EDITTEXT DS_CONNSETTINGS,50,170,200,20,ES_MULTILINE |
ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN
- DEFPUSHBUTTON "OK",IDOK,71,165,50,14,WS_GROUP
- PUSHBUTTON "Cancel",IDCANCEL,146,165,50,14
+ DEFPUSHBUTTON "Close",IDOK,51,195,50,14,WS_GROUP
+ PUSHBUTTON "Cancel",IDCANCEL,126,195,50,14
+ PUSHBUTTON "Apply",IDAPPLY,201,195,50,14
END
#else
DLG_CONFIG DIALOG DISCARDABLE 65, 43, 292, 116
PUSHBUTTON "Cancel",IDCANCEL,80,90,40,14
GROUPBOX "Options (Advanced):",IDC_OPTIONS,140,74,140,35,
BS_CENTER
- PUSHBUTTON "Driver",IDC_DRIVER,160,90,50,14
- PUSHBUTTON "DataSource",IDC_DATASOURCE,220,90,50,14
+ PUSHBUTTON "DataSource",IDC_DATASOURCE,160,90,50,14
+ PUSHBUTTON "Default",IDC_DRIVER,220,90,50,14
CTEXT "Please supply any missing information needed to connect.",
DRV_MSG_LABEL,36,5,220,15
END
-DLG_OPTIONS_DRV DIALOG DISCARDABLE 0, 0, 287, 241
+DLG_OPTIONS_DRV DIALOG DISCARDABLE 0, 0, 287, 250
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Advanced Options (Driver)"
FONT 8, "MS Sans Serif"
BEGIN
+ PUSHBUTTON "Page 1",IDPREVPAGE,10,1,40,15
+ PUSHBUTTON "Page 2",IDNEXTPAGE,50,1,40,15
+ CTEXT "Set your site's defaults (for new DSNs).",
+ DRV_MSG_LABEL2,15,1,270,10, SS_CENTER | WS_GROUP, WS_EX_STATICEDGE
CONTROL "Disable Genetic &Optimizer",DRV_OPTIMIZER,"Button",
- BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,15,5,97,10
+ BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,15,18,97,10
CONTROL "Comm&Log (C:\\psqlodbc.log)",DRV_COMMLOG,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,140,5,113,10
+ BS_AUTOCHECKBOX | WS_TABSTOP,140,18,113,10
CONTROL "&KSQO (Keyset Query Optimization)",DRV_KSQO,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,15,20,124,10
+ BS_AUTOCHECKBOX | WS_TABSTOP,15,33,124,10
CONTROL "&ReadOnly (Default)",DRV_READONLY,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,140,20,80,10
+ BS_AUTOCHECKBOX | WS_TABSTOP,140,33,80,10
CONTROL "Recognize Unique &Indexes",DRV_UNIQUEINDEX,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,15,35,101,10
+ BS_AUTOCHECKBOX | WS_TABSTOP,15,48,101,10
CONTROL "P&arse Statements",DRV_PARSE,"Button",BS_AUTOCHECKBOX |
- WS_TABSTOP,140,35,80,10
+ WS_TABSTOP,140,48,80,10
CONTROL "&Use Declare/Fetch",DRV_USEDECLAREFETCH,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,15,50,80,10
+ BS_AUTOCHECKBOX | WS_TABSTOP,15,63,80,10
CONTROL "Cancel as FreeStmt (Exp)",DRV_CANCELASFREESTMT,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,140,50,105,10
+ BS_AUTOCHECKBOX | WS_TABSTOP,140,63,105,10
CONTROL "Mylog(Debug ouput)",DRV_DEBUG,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,140,65,112,10
- GROUPBOX "Unknown Sizes",IDC_STATIC,10,80,175,25
+ BS_AUTOCHECKBOX | WS_TABSTOP,140,78,112,10
+ GROUPBOX "Unknown Sizes",IDC_STATIC,10,93,175,25
CONTROL "Maximum",DRV_UNKNOWN_MAX,"Button",BS_AUTORADIOBUTTON |
- WS_GROUP | WS_TABSTOP,15,91,45,10
+ WS_GROUP | WS_TABSTOP,15,104,45,10
CONTROL "Don't Know",DRV_UNKNOWN_DONTKNOW,"Button",
- BS_AUTORADIOBUTTON | WS_TABSTOP,70,91,53,10
+ BS_AUTORADIOBUTTON | WS_TABSTOP,70,104,53,10
CONTROL "Longest",DRV_UNKNOWN_LONGEST,"Button",
- BS_AUTORADIOBUTTON | WS_TABSTOP,130,91,50,10
- GROUPBOX "Data Type Options",IDC_STATIC,10,110,270,25
+ BS_AUTORADIOBUTTON | WS_TABSTOP,130,104,50,10
+ GROUPBOX "Data Type Options",IDC_STATIC,10,123,270,25
CONTROL "Text as LongVarChar",DRV_TEXT_LONGVARCHAR,"Button",
- BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,15,120,80,10
+ BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,15,133,80,10
CONTROL "Unknowns as LongVarChar",DRV_UNKNOWNS_LONGVARCHAR,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,105,120,100,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,105,133,100,10
CONTROL "Bools as Char",DRV_BOOLS_CHAR,"Button",BS_AUTOCHECKBOX |
- WS_TABSTOP,215,120,60,10
- LTEXT "&Cache Size:",IDC_STATIC,10,145,40,10
- EDITTEXT DRV_CACHE_SIZE,50,145,35,12,ES_AUTOHSCROLL
- LTEXT "Max &Varchar:",IDC_STATIC,90,145,45,10
- EDITTEXT DRV_VARCHAR_SIZE,135,145,35,12,ES_AUTOHSCROLL
- LTEXT "Max Lon&gVarChar:",IDC_STATIC,180,145,60,10
- EDITTEXT DRV_LONGVARCHAR_SIZE,240,145,35,12,ES_AUTOHSCROLL
- LTEXT "SysTable &Prefixes:",IDC_STATIC,15,160,35,20
- EDITTEXT DRV_EXTRASYSTABLEPREFIXES,50,166,75,12,ES_AUTOHSCROLL
- RTEXT "Connect &Settings:",IDC_STATIC,10,185,35,20
- EDITTEXT DRV_CONNSETTINGS,50,185,225,25,ES_MULTILINE |
+ WS_TABSTOP,215,133,60,10
+ LTEXT "&Cache Size:",IDC_STATIC,10,148,40,10
+ EDITTEXT DRV_CACHE_SIZE,50,153,35,12,ES_AUTOHSCROLL
+ LTEXT "Max &Varchar:",IDC_STATIC,90,140,45,10
+ EDITTEXT DRV_VARCHAR_SIZE,135,153,35,12,ES_AUTOHSCROLL
+ LTEXT "Max Lon&gVarChar:",IDC_STATIC,180,140,60,10
+ EDITTEXT DRV_LONGVARCHAR_SIZE,240,153,35,12,ES_AUTOHSCROLL
+ LTEXT "SysTable &Prefixes:",IDC_STATIC,15,155,35,20
+ EDITTEXT DRV_EXTRASYSTABLEPREFIXES,50,174,75,12,ES_AUTOHSCROLL
+ RTEXT "Connect &Settings:",IDC_STATIC,10,180,35,20
+ EDITTEXT DRV_CONNSETTINGS,50,193,225,25,ES_MULTILINE |
ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN
- DEFPUSHBUTTON "OK",IDOK,45,220,50,14,WS_GROUP
- PUSHBUTTON "Cancel",IDCANCEL,110,220,50,14
- PUSHBUTTON "Defaults",IDDEFAULTS,175,220,50,15
- CONTROL "Default",DRV_OR_DSN,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT |
- BS_NOTIFY | WS_TABSTOP,233,224,40,10
+ DEFPUSHBUTTON "Close",IDOK,25,228,50,14,WS_GROUP
+ PUSHBUTTON "Cancel",IDCANCEL,90,228,50,15
+ PUSHBUTTON "Apply",IDAPPLY,155,228,50,14
+ PUSHBUTTON "Defaults",IDDEFAULTS,220,228,50,15
END
-DLG_OPTIONS_DS DIALOG DISCARDABLE 0, 0, 267, 186
+DLG_OPTIONS_DS DIALOG DISCARDABLE 0, 0, 267, 216
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Advanced Options (DataSource)"
FONT 8, "MS Sans Serif"
BEGIN
+ PUSHBUTTON "Page 2",IDNEXTPAGE,50,1,40,15
+ PUSHBUTTON "Page 1",IDPREVPAGE,10,1,40,15
CONTROL "&ReadOnly",DS_READONLY,"Button",BS_AUTOCHECKBOX |
- WS_GROUP | WS_TABSTOP,25,10,53,10
+ WS_GROUP | WS_TABSTOP,25,18,53,10
CONTROL "Row &Versioning",DS_ROWVERSIONING,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,130,10,85,10
+ BS_AUTOCHECKBOX | WS_TABSTOP,130,18,85,10
CONTROL "Show System &Tables",DS_SHOWSYSTEMTABLES,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,25,25,85,10
+ BS_AUTOCHECKBOX | WS_TABSTOP,25,33,85,10
CONTROL "Disallow &Premature",DS_DISALLOWPREMATURE,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,130,25,85,10
+ BS_AUTOCHECKBOX | WS_TABSTOP,130,33,85,10
CONTROL "LF <-> CR/LF convert",DS_LFCONVERSION,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,25,40,92,10
+ BS_AUTOCHECKBOX | WS_TABSTOP,25,48,92,10
CONTROL "True is -1",DS_TRUEISMINUS1,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,130,40,86,10
+ BS_AUTOCHECKBOX | WS_TABSTOP,130,48,86,10
CONTROL "(Trial) Updatable Cursors",DS_UPDATABLECURSORS,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,25,55,102,10
- GROUPBOX "Protocol",IDC_STATIC,15,70,180,25
+ BS_AUTOCHECKBOX | WS_TABSTOP,25,63,102,10
+ GROUPBOX "Int8 As",IDC_STATIC,15,78,248,25
+ CONTROL "default",DS_INT8_AS_DEFAULT,"Button",BS_AUTORADIOBUTTON | WS_GROUP,20,
+ 88,35,10
+ CONTROL "bigint",DS_INT8_AS_BIGINT,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,
+ 63,88,35,10
+ CONTROL "numeric",DS_INT8_AS_NUMERIC,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,
+ 106,88,40,10
+ CONTROL "varchar",DS_INT8_AS_VARCHAR,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,
+ 149,88,40,10
+ CONTROL "double",DS_INT8_AS_DOUBLE,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,
+ 192,88,40,10
+ CONTROL "int4",DS_INT8_AS_INT4,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,
+ 235,88,25,10
+ GROUPBOX "Protocol",IDC_STATIC,15,109,180,25
CONTROL "7.X,6.4+",DS_PG64,"Button",BS_AUTORADIOBUTTON | WS_GROUP,25,
- 80,35,10
+ 118,35,10
CONTROL "6.3",DS_PG63,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,
- 75,80,26,10
+ 75,118,26,10
CONTROL "6.2",DS_PG62,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,
- 130,80,26,10
- GROUPBOX "OID Options",IDC_STATIC,15,101,180,25
+ 130,118,26,10
+ GROUPBOX "OID Options",IDC_STATIC,15,140,180,25
CONTROL "Show &Column",DS_SHOWOIDCOLUMN,"Button",BS_AUTOCHECKBOX |
- WS_GROUP | WS_TABSTOP,25,111,59,10
+ WS_GROUP | WS_TABSTOP,25,150,59,10
CONTROL "Fake &Index",DS_FAKEOIDINDEX,"Button",BS_AUTOCHECKBOX |
- WS_GROUP | WS_TABSTOP,115,111,51,10
- RTEXT "Connect &Settings:",IDC_STATIC,10,135,35,25
- EDITTEXT DS_CONNSETTINGS,50,135,200,20,ES_MULTILINE |
+ WS_GROUP | WS_TABSTOP,115,150,51,10
+ RTEXT "Connect &Settings:",IDC_STATIC,10,174,35,25
+ EDITTEXT DS_CONNSETTINGS,50,174,200,20,ES_MULTILINE |
ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN
- DEFPUSHBUTTON "OK",IDOK,71,165,50,14,WS_GROUP
- PUSHBUTTON "Cancel",IDCANCEL,146,165,50,14
+ DEFPUSHBUTTON "Close",IDOK,51,196,50,14,WS_GROUP
+ PUSHBUTTON "Cancel",IDCANCEL,126,196,50,14
+ PUSHBUTTON "Apply",IDAPPLY,201,196,50,14
END
#endif
#define DS_LFCONVERSION 1062\r
#define DS_TRUEISMINUS1 1063\r
#define DS_UPDATABLECURSORS 1064\r
+#define IDNEXTPAGE 1065\r
+#define IDPREVPAGE 1066\r
+#define DS_INT8_AS_DEFAULT 1067\r
+#define DS_INT8_AS_BIGINT 1068\r
+#define DS_INT8_AS_NUMERIC 1069\r
+#define DS_INT8_AS_VARCHAR 1070\r
+#define DS_INT8_AS_DOUBLE 1071\r
+#define DS_INT8_AS_INT4 1072\r
+#define DRV_MSG_LABEL2 1073\r
+#define IDAPPLY 1074\r
\r
/* Next default values for new objects\r */
/*\r */
#ifndef APSTUDIO_READONLY_SYMBOLS\r
#define _APS_NEXT_RESOURCE_VALUE 105\r
#define _APS_NEXT_COMMAND_VALUE 40001\r
-#define _APS_NEXT_CONTROL_VALUE 1065\r
+#define _APS_NEXT_CONTROL_VALUE 1075\r
#define _APS_NEXT_SYMED_VALUE 101\r
#endif /*\r */
break;
default:
stmt->errormsg = "Column 0 is not of type SQL_C_BOOKMARK";
-inolog("Column 0 is type %d not of type SQL_C_BOOKMARK", fCType);
+ inolog("Column 0 is type %d not of type SQL_C_BOOKMARK", fCType);
stmt->errornumber = STMT_PROGRAM_TYPE_OUT_OF_RANGE;
SC_log_error(func, "", stmt);
return SQL_ERROR;
{
if (0 != (status & CURS_SELF_DELETING))
DiscardDeleted(res, index);
+ keyset[index].blocknum = rollback[i].blocknum;
+ keyset[index].offset = rollback[i].offset;
if (0 != (keyset[index].status & CURS_SELF_UPDATING))
keyset[index].status |= CURS_NEEDS_REREAD;
keyset[index].status &= ~(CURS_SELF_DELETING | CURS_SELF_UPDATING | CURS_SELF_ADDING | KEYSET_INFO_PUBLIC);
#include <stdlib.h>
#include "resource.h"
#include "dlg_specific.h"
+#include "win_setup.h"
#define INTFUNC __stdcall
#define MAXDSNAME (32+1) /* Max data source name length */
-/* Globals */
-/* NOTE: All these are used by the dialog procedures */
-typedef struct tagSETUPDLG
-{
- HWND hwndParent; /* Parent window handle */
- LPCSTR lpszDrvr; /* Driver description */
- ConnInfo ci;
- char szDSN[MAXDSNAME]; /* Original data source name */
- BOOL fNewDSN; /* New data source flag */
- BOOL fDefault; /* Default data source flag */
-
-} SETUPDLG, FAR * LPSETUPDLG;
-
-
-
-/* Prototypes */
-void INTFUNC CenterDialog(HWND hdlg);
-int CALLBACK ConfigDlgProc(HWND hdlg, UINT wMsg, WPARAM wParam, LPARAM lParam);
-void INTFUNC ParseAttributes(LPCSTR lpszAttributes, LPSETUPDLG lpsetupdlg);
-BOOL INTFUNC SetDSNAttributes(HWND hwnd, LPSETUPDLG lpsetupdlg);
-
-
/*--------
* ConfigDSN
*
{
LPSETUPDLG lpsetupdlg;
ConnInfo *ci;
+ DWORD cmd;
switch (wMsg)
{
/* Hide the driver connect message */
ShowWindow(GetDlgItem(hdlg, DRV_MSG_LABEL), SW_HIDE);
+ SetWindowText(GetDlgItem(hdlg, IDOK), "Save");
SetWindowLong(hdlg, DWL_USER, lParam);
CenterDialog(hdlg); /* Center dialog */
/* Process buttons */
case WM_COMMAND:
- switch (GET_WM_COMMAND_ID(wParam, lParam))
+ switch (cmd = GET_WM_COMMAND_ID(wParam, lParam))
{
/*
* Ensure the OK button is enabled only when a data
/* Accept results */
case IDOK:
+ case IDAPPLY:
lpsetupdlg = (LPSETUPDLG) GetWindowLong(hdlg, DWL_USER);
/* Retrieve dialog values */
if (!lpsetupdlg->fDefault)
/* Update ODBC.INI */
SetDSNAttributes(hdlg, lpsetupdlg);
-
+ if (IDAPPLY == cmd)
+ break;
/* Return to caller */
case IDCANCEL:
EndDialog(hdlg, wParam);
return TRUE;
- case IDC_DRIVER:
+ case IDC_DATASOURCE:
lpsetupdlg = (LPSETUPDLG) GetWindowLong(hdlg, DWL_USER);
DialogBoxParam(s_hModule, MAKEINTRESOURCE(DLG_OPTIONS_DRV),
- hdlg, driver_optionsProc, (LPARAM) &lpsetupdlg->ci);
+ hdlg, ds_options1Proc, (LPARAM) &lpsetupdlg->ci);
return TRUE;
- case IDC_DATASOURCE:
+ case IDC_DRIVER:
lpsetupdlg = (LPSETUPDLG) GetWindowLong(hdlg, DWL_USER);
- DialogBoxParam(s_hModule, MAKEINTRESOURCE(DLG_OPTIONS_DS),
- hdlg, ds_optionsProc, (LPARAM) &lpsetupdlg->ci);
+ DialogBoxParam(s_hModule, MAKEINTRESOURCE(DLG_OPTIONS_DRV),
+ hdlg, driver_optionsProc, (LPARAM) &lpsetupdlg->ci);
return TRUE;
}
}
/* Update ODBC.INI */
+ writeDriverCommoninfo(&lpsetupdlg->ci);
writeDSNinfo(&lpsetupdlg->ci);
/* If the data source name has changed, remove the old name */
int i;
for (i = 0; i < (int) self->nfields; i++)
+ {
if (self->fi[i])
+ {
+ if (self->fi[i]->schema)
+ free(self->fi[i]->schema);
free(self->fi[i]);
+ }
+ }
free(self->fi);
self->fi = NULL;
}
-@erase "$(INTDIR)\connection.obj"
-@erase "$(INTDIR)\convert.obj"
-@erase "$(INTDIR)\dlg_specific.obj"
+ -@erase "$(INTDIR)\dlg_wingui.obj"
-@erase "$(INTDIR)\drvconn.obj"
-@erase "$(INTDIR)\environ.obj"
-@erase "$(INTDIR)\execute.obj"
-@erase "$(OUTDIR)\psqlodbc.dll"
-@erase "$(OUTDIR)\psqlodbc.exp"
-@erase "$(OUTDIR)\psqlodbc.lib"
+ -@erase "$(OUTDIR)\psqlodbc.pch"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
"$(INTDIR)\connection.obj" \
"$(INTDIR)\convert.obj" \
"$(INTDIR)\dlg_specific.obj" \
+ "$(INTDIR)\dlg_wingui.obj" \
"$(INTDIR)\drvconn.obj" \
"$(INTDIR)\environ.obj" \
"$(INTDIR)\execute.obj" \
-@erase "$(INTDIR)\connection.obj"
-@erase "$(INTDIR)\convert.obj"
-@erase "$(INTDIR)\dlg_specific.obj"
+ -@erase "$(INTDIR)\dlg_wingui.obj"
-@erase "$(INTDIR)\drvconn.obj"
-@erase "$(INTDIR)\environ.obj"
-@erase "$(INTDIR)\execute.obj"
-@erase "$(OUTDIR)\psqlodbc.ilk"
-@erase "$(OUTDIR)\psqlodbc.lib"
-@erase "$(OUTDIR)\psqlodbc.pdb"
+ -@erase "$(OUTDIR)\psqlodbc.pch"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
"$(INTDIR)\connection.obj" \
"$(INTDIR)\convert.obj" \
"$(INTDIR)\dlg_specific.obj" \
+ "$(INTDIR)\dlg_wingui.obj" \
"$(INTDIR)\drvconn.obj" \
"$(INTDIR)\environ.obj" \
"$(INTDIR)\execute.obj" \
$(CPP) $(CPP_PROJ) $(SOURCE)
+SOURCE=dlg_wingui.c
+
+"$(INTDIR)\dlg_wingui.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
SOURCE=drvconn.c
"$(INTDIR)\drvconn.obj" : $(SOURCE) "$(INTDIR)"
-
#
# File: win32_30.mak
#
-@erase "$(INTDIR)\connection.obj"
-@erase "$(INTDIR)\convert.obj"
-@erase "$(INTDIR)\dlg_specific.obj"
+ -@erase "$(INTDIR)\dlg_wingui.obj"
-@erase "$(INTDIR)\drvconn.obj"
-@erase "$(INTDIR)\environ.obj"
-@erase "$(INTDIR)\execute.obj"
-@erase "$(OUTDIR)\psqlodbc30.dll"
-@erase "$(OUTDIR)\psqlodbc.exp"
-@erase "$(OUTDIR)\psqlodbc.lib"
+ -@erase "$(OUTDIR)\psqlodbc.pch"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
"$(INTDIR)\connection.obj" \
"$(INTDIR)\convert.obj" \
"$(INTDIR)\dlg_specific.obj" \
+ "$(INTDIR)\dlg_wingui.obj" \
"$(INTDIR)\drvconn.obj" \
"$(INTDIR)\environ.obj" \
"$(INTDIR)\execute.obj" \
-@erase "$(INTDIR)\connection.obj"
-@erase "$(INTDIR)\convert.obj"
-@erase "$(INTDIR)\dlg_specific.obj"
+ -@erase "$(INTDIR)\dlg_wingui.obj"
-@erase "$(INTDIR)\drvconn.obj"
-@erase "$(INTDIR)\environ.obj"
-@erase "$(INTDIR)\execute.obj"
-@erase "$(OUTDIR)\psqlodbc.ilk"
-@erase "$(OUTDIR)\psqlodbc.lib"
-@erase "$(OUTDIR)\psqlodbc.pdb"
+ -@erase "$(OUTDIR)\psqlodbc.pch"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
"$(INTDIR)\connection.obj" \
"$(INTDIR)\convert.obj" \
"$(INTDIR)\dlg_specific.obj" \
+ "$(INTDIR)\dlg_wingui.obj" \
"$(INTDIR)\drvconn.obj" \
"$(INTDIR)\environ.obj" \
"$(INTDIR)\execute.obj" \
$(CPP) $(CPP_PROJ) $(SOURCE)
+SOURCE=dlg_wingui.c
+
+"$(INTDIR)\dlg_wingui.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
SOURCE=drvconn.c
"$(INTDIR)\drvconn.obj" : $(SOURCE) "$(INTDIR)"
-@erase "$(INTDIR)\connection.obj"
-@erase "$(INTDIR)\convert.obj"
-@erase "$(INTDIR)\dlg_specific.obj"
+ -@erase "$(INTDIR)\dlg_wingui.obj"
-@erase "$(INTDIR)\drvconn.obj"
-@erase "$(INTDIR)\environ.obj"
-@erase "$(INTDIR)\execute.obj"
-@erase "$(OUTDIR)\psqlodbc30w.dll"
-@erase "$(OUTDIR)\psqlodbc.exp"
-@erase "$(OUTDIR)\psqlodbc.lib"
+ -@erase "$(OUTDIR)\psqlodbc.pch"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
"$(INTDIR)\connection.obj" \
"$(INTDIR)\convert.obj" \
"$(INTDIR)\dlg_specific.obj" \
+ "$(INTDIR)\dlg_wingui.obj" \
"$(INTDIR)\drvconn.obj" \
"$(INTDIR)\environ.obj" \
"$(INTDIR)\execute.obj" \
-@erase "$(INTDIR)\connection.obj"
-@erase "$(INTDIR)\convert.obj"
-@erase "$(INTDIR)\dlg_specific.obj"
+ -@erase "$(INTDIR)\dlg_wingui.obj"
-@erase "$(INTDIR)\drvconn.obj"
-@erase "$(INTDIR)\environ.obj"
-@erase "$(INTDIR)\execute.obj"
-@erase "$(OUTDIR)\psqlodbc.ilk"
-@erase "$(OUTDIR)\psqlodbc.lib"
-@erase "$(OUTDIR)\psqlodbc.pdb"
+ -@erase "$(OUTDIR)\psqlodbc.pch"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
"$(INTDIR)\connection.obj" \
"$(INTDIR)\convert.obj" \
"$(INTDIR)\dlg_specific.obj" \
+ "$(INTDIR)\dlg_wingui.obj" \
"$(INTDIR)\drvconn.obj" \
"$(INTDIR)\environ.obj" \
"$(INTDIR)\execute.obj" \
$(CPP) $(CPP_PROJ) $(SOURCE)
+SOURCE=dlg_wingui.c
+
+"$(INTDIR)\dlg_wingui.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
SOURCE=drvconn.c
"$(INTDIR)\drvconn.obj" : $(SOURCE) "$(INTDIR)"