Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0521051

Browse files
author
Hiroshi Inoue
committed
Fix some multibyte related bugs.
Psqlodbc is 7.01.0007 now. Hiroshi Inoue
1 parent 7e99cea commit 0521051

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

src/interfaces/odbc/connection.c

+8-2
Original file line numberDiff line numberDiff line change
@@ -551,13 +551,19 @@ CC_connect(ConnectionClass *self, char do_password)
551551
ci->drivers.bools_as_char);
552552

553553
#ifdef MULTIBYTE
554-
encoding = check_client_encoding(ci->drivers.conn_settings);
554+
encoding = check_client_encoding(ci->conn_settings);
555555
if (encoding && strcmp(encoding, "OTHER"))
556556
self->client_encoding = strdup(encoding);
557+
else
558+
{
559+
encoding = check_client_encoding(ci->drivers.conn_settings);
560+
if (encoding && strcmp(encoding, "OTHER"))
561+
self->client_encoding = strdup(encoding);
562+
}
557563
qlog(" extra_systable_prefixes='%s', conn_settings='%s' conn_encoding='%s'\n",
558564
ci->drivers.extra_systable_prefixes,
559565
ci->drivers.conn_settings,
560-
check_client_encoding(ci->drivers.conn_settings));
566+
encoding ? encoding : "");
561567
#else
562568
qlog(" extra_systable_prefixes='%s', conn_settings='%s'\n",
563569
ci->drivers.extra_systable_prefixes,

src/interfaces/odbc/convert.c

+4
Original file line numberDiff line numberDiff line change
@@ -1156,7 +1156,11 @@ copy_statement_with_parameters(StatementClass *stmt)
11561156
}
11571157
opos += lit_call_len;
11581158
CVT_APPEND_STR("SELECT ");
1159+
#ifdef MULTIBYTE
1160+
if (multibyte_strchr(&old_statement[opos], '('))
1161+
#else
11591162
if (strchr(&old_statement[opos], '('))
1163+
#endif /* MULTIBYTE */
11601164
proc_no_param = FALSE;
11611165
continue;
11621166
}

src/interfaces/odbc/info.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,6 @@ PGAPI_GetTypeInfo(
826826

827827

828828
RETCODE SQL_API
829-
/*SQLGetFunctions(*/
830829
PGAPI_GetFunctions(
831830
HDBC hdbc,
832831
UWORD fFunction,
@@ -2202,6 +2201,8 @@ PGAPI_Statistics(
22022201
" and i.indexrelid = c.oid"
22032202
" and c.relam = a.oid"
22042203
, table_name);
2204+
if (PG_VERSION_GT(SC_get_conn(stmt), 6.4))
2205+
strcat(index_query, " order by i.indisprimary desc");
22052206

22062207
result = PGAPI_ExecDirect(hindx_stmt, index_query, strlen(index_query));
22072208
if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))

src/interfaces/odbc/parse.c

+7
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,14 @@ in_expr = TRUE;
616616

617617
/* lower case table name */
618618
for (ptr = ti[stmt->ntab]->name; *ptr; ptr++)
619+
{
620+
#ifdef MULTIBYTE
621+
if ((unsigned char) *ptr >= 0x80)
622+
ptr++;
623+
else
624+
#endif /* MULTIBYTE */
619625
*ptr = tolower((unsigned char) *ptr);
626+
}
620627
}
621628
mylog("got table = '%s'\n", ti[stmt->ntab]->name);
622629

0 commit comments

Comments
 (0)