Commit 0521051b authored by Hiroshi Inoue's avatar Hiroshi Inoue

Fix some multibyte related bugs.

Psqlodbc is 7.01.0007 now.

Hiroshi Inoue
parent 7e99cea8
...@@ -551,13 +551,19 @@ CC_connect(ConnectionClass *self, char do_password) ...@@ -551,13 +551,19 @@ CC_connect(ConnectionClass *self, char do_password)
ci->drivers.bools_as_char); ci->drivers.bools_as_char);
#ifdef MULTIBYTE #ifdef MULTIBYTE
encoding = check_client_encoding(ci->drivers.conn_settings); encoding = check_client_encoding(ci->conn_settings);
if (encoding && strcmp(encoding, "OTHER")) if (encoding && strcmp(encoding, "OTHER"))
self->client_encoding = strdup(encoding); self->client_encoding = strdup(encoding);
else
{
encoding = check_client_encoding(ci->drivers.conn_settings);
if (encoding && strcmp(encoding, "OTHER"))
self->client_encoding = strdup(encoding);
}
qlog(" extra_systable_prefixes='%s', conn_settings='%s' conn_encoding='%s'\n", qlog(" extra_systable_prefixes='%s', conn_settings='%s' conn_encoding='%s'\n",
ci->drivers.extra_systable_prefixes, ci->drivers.extra_systable_prefixes,
ci->drivers.conn_settings, ci->drivers.conn_settings,
check_client_encoding(ci->drivers.conn_settings)); encoding ? encoding : "");
#else #else
qlog(" extra_systable_prefixes='%s', conn_settings='%s'\n", qlog(" extra_systable_prefixes='%s', conn_settings='%s'\n",
ci->drivers.extra_systable_prefixes, ci->drivers.extra_systable_prefixes,
......
...@@ -1156,7 +1156,11 @@ copy_statement_with_parameters(StatementClass *stmt) ...@@ -1156,7 +1156,11 @@ copy_statement_with_parameters(StatementClass *stmt)
} }
opos += lit_call_len; opos += lit_call_len;
CVT_APPEND_STR("SELECT "); CVT_APPEND_STR("SELECT ");
#ifdef MULTIBYTE
if (multibyte_strchr(&old_statement[opos], '('))
#else
if (strchr(&old_statement[opos], '(')) if (strchr(&old_statement[opos], '('))
#endif /* MULTIBYTE */
proc_no_param = FALSE; proc_no_param = FALSE;
continue; continue;
} }
......
...@@ -826,7 +826,6 @@ PGAPI_GetTypeInfo( ...@@ -826,7 +826,6 @@ PGAPI_GetTypeInfo(
RETCODE SQL_API RETCODE SQL_API
/*SQLGetFunctions(*/
PGAPI_GetFunctions( PGAPI_GetFunctions(
HDBC hdbc, HDBC hdbc,
UWORD fFunction, UWORD fFunction,
...@@ -2202,6 +2201,8 @@ PGAPI_Statistics( ...@@ -2202,6 +2201,8 @@ PGAPI_Statistics(
" and i.indexrelid = c.oid" " and i.indexrelid = c.oid"
" and c.relam = a.oid" " and c.relam = a.oid"
, table_name); , table_name);
if (PG_VERSION_GT(SC_get_conn(stmt), 6.4))
strcat(index_query, " order by i.indisprimary desc");
result = PGAPI_ExecDirect(hindx_stmt, index_query, strlen(index_query)); result = PGAPI_ExecDirect(hindx_stmt, index_query, strlen(index_query));
if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
......
...@@ -616,7 +616,14 @@ in_expr = TRUE; ...@@ -616,7 +616,14 @@ in_expr = TRUE;
/* lower case table name */ /* lower case table name */
for (ptr = ti[stmt->ntab]->name; *ptr; ptr++) for (ptr = ti[stmt->ntab]->name; *ptr; ptr++)
{
#ifdef MULTIBYTE
if ((unsigned char) *ptr >= 0x80)
ptr++;
else
#endif /* MULTIBYTE */
*ptr = tolower((unsigned char) *ptr); *ptr = tolower((unsigned char) *ptr);
}
} }
mylog("got table = '%s'\n", ti[stmt->ntab]->name); mylog("got table = '%s'\n", ti[stmt->ntab]->name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment