Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9242e6c

Browse files
author
Hiroshi Inoue
committed
Add multibyte support.
Provide an extenisible scheme of encoding conversion.As the first step, SJIS and BIG5 are supported.From now on multibyte people would be happy to usethis psqlodbc driver.Eiji Tokuya e-tokuya@mail.sankyo-unyu.co.jp
1 parent25f03eb commit9242e6c

File tree

7 files changed

+266
-18
lines changed

7 files changed

+266
-18
lines changed

‎src/interfaces/odbc/connection.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
* Comments: See "notice.txt" for copyright and license information.
1313
*
1414
*/
15+
/* Multibyte supportEiji Tokuya 2001-03-15 */
16+
17+
#ifdefHAVE_CONFIG_H
18+
#include"config.h"
19+
#endif
1520

1621
#include"environ.h"
1722
#include"connection.h"
@@ -20,6 +25,11 @@
2025
#include"qresult.h"
2126
#include"lobj.h"
2227
#include"dlg_specific.h"
28+
29+
#ifdefMULTIBYTE
30+
#include"multibyte.h"
31+
#endif
32+
2333
#include<stdio.h>
2434
#include<string.h>
2535

@@ -496,9 +506,18 @@ static char *func="CC_connect";
496506
globals.text_as_longvarchar,
497507
globals.unknowns_as_longvarchar,
498508
globals.bools_as_char);
509+
510+
#ifdefMULTIBYTE
511+
check_client_encoding(globals.conn_settings);
512+
qlog(" extra_systable_prefixes='%s', conn_settings='%s' conn_encoding='%s'\n",
513+
globals.extra_systable_prefixes,
514+
globals.conn_settings,
515+
check_client_encoding(globals.conn_settings));
516+
#else
499517
qlog(" extra_systable_prefixes='%s', conn_settings='%s'\n",
500518
globals.extra_systable_prefixes,
501519
globals.conn_settings);
520+
#endif
502521

503522
if (self->status!=CONN_NOT_CONNECTED) {
504523
self->errormsg="Already connected.";

‎src/interfaces/odbc/convert.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* Comments: See "notice.txt" for copyright and license information.
1616
*
1717
*/
18+
/* Multibyte support Eiji Tokuya2001-03-15*/
1819

1920
#ifdefHAVE_CONFIG_H
2021
#include"config.h"
@@ -26,6 +27,10 @@
2627

2728
#include"psqlodbc.h"
2829

30+
#ifdefMULTIBYTE
31+
#include"multibyte.h"
32+
#endif
33+
2934
#ifndefWIN32
3035
#include"iodbc.h"
3136
#include"isql.h"
@@ -690,6 +695,9 @@ int lobj_fd, retval;
690695
param_number=-1;
691696

692697
oldstmtlen=strlen(old_statement);
698+
#ifdefMULTIBYTE
699+
multibyte_init();
700+
#endif
693701

694702
for (opos=0;opos<oldstmtlen;opos++) {
695703

@@ -700,10 +708,18 @@ int lobj_fd, retval;
700708
}
701709

702710
/*Handle literals (date, time, timestamp) and ODBC scalar functions */
711+
#ifdefMULTIBYTE
712+
elseif (multibyte_char_check(old_statement[opos])==0&&old_statement[opos]== '{') {
713+
#else
703714
elseif (old_statement[opos]=='{') {
715+
#endif
704716
char*esc;
705717
char*begin=&old_statement[opos+1];
718+
#ifdefMULTIBYTE
719+
char*end=multibyte_strchr(begin,'}');
720+
#else
706721
char*end=strchr(begin,'}');
722+
#endif
707723

708724
if ( !end)
709725
continue;
@@ -1334,11 +1350,18 @@ char *p;
13341350
max=strlen(si);
13351351
else
13361352
max=used;
1353+
#ifdefMULTIBYTE
1354+
multibyte_init();
1355+
#endif
13371356

13381357
for (i=0;i<max;i++) {
13391358
if (si[i]=='\r'&&i+1<strlen(si)&&si[i+1]=='\n')
13401359
continue;
1360+
#ifdefMULTIBYTE
1361+
elseif (multibyte_char_check(si[i])==0&& (si[i]=='\''||si[i]=='\\'))
1362+
#else
13411363
elseif (si[i]=='\''||si[i]=='\\')
1364+
#endif
13421365
p[out++]='\\';
13431366

13441367
p[out++]=si[i];

‎src/interfaces/odbc/dlg_specific.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* Comments: See "notice.txt" for copyright and license information.
1616
*
1717
*/
18+
/* Multibyte supportEiji Tokuya 2001-03-15 */
1819

1920
#ifdefHAVE_CONFIG_H
2021
#include"config.h"
@@ -34,6 +35,10 @@
3435
#include"dlg_specific.h"
3536
#include"convert.h"
3637

38+
#ifdefMULTIBYTE
39+
#include"multibyte.h"
40+
#endif
41+
3742
#ifndefBOOL
3843
#defineBOOLint
3944
#endif
@@ -507,8 +512,17 @@ char encoded_conn_settings[LARGE_REGISTRY_LEN];
507512
ci->show_oid_column,
508513
ci->fake_oid_index,
509514
ci->show_system_tables);
515+
516+
#ifdefMULTIBYTE
517+
check_client_encoding(ci->conn_settings);
518+
qlog(" conn_settings='%s',conn_encoding='%s'\n",
519+
ci->conn_settings,
520+
check_client_encoding(ci->conn_settings));
521+
#else
510522
qlog(" conn_settings='%s'\n",
511523
ci->conn_settings);
524+
#endif
525+
512526
qlog(" translation_dll='%s',translation_option='%s'\n",
513527
ci->translation_dll,
514528
ci->translation_option);

‎src/interfaces/odbc/parse.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
* Comments: See "notice.txt" for copyright and license information.
1818
*
1919
*/
20+
/* Multibyte supportEiji Tokuya 2001-03-15 */
21+
22+
#ifdefHAVE_CONFIG_H
23+
#include"config.h"
24+
#endif
2025

2126
#include<stdio.h>
2227
#include<string.h>
@@ -27,6 +32,10 @@
2732
#include"qresult.h"
2833
#include"pgtypes.h"
2934

35+
#ifdefMULTIBYTE
36+
#include"multibyte.h"
37+
#endif
38+
3039
#ifndefWIN32
3140
#ifndefHAVE_STRICMP
3241
#definestricmp(s1,s2) strcasecmp(s1,s2)
@@ -88,7 +97,11 @@ char qc, in_escape = FALSE;
8897
if (s[i]==qc&& !in_escape) {
8998
break;
9099
}
100+
#ifdefMULTIBYTE
101+
if (multibyte_char_check(s[i])==0&&s[i]=='\\'&& !in_escape) {
102+
#else
91103
if (s[i]=='\\'&& !in_escape) {
104+
#endif
92105
in_escape= TRUE;
93106
}
94107
else {

‎src/interfaces/odbc/psqlodbc.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Comments: See "notice.txt" for copyright and license information.
88
*
9-
* $Id: psqlodbc.h,v 1.38 2001/02/15 05:32:00 inoue Exp $
9+
* $Id: psqlodbc.h,v 1.39 2001/03/16 01:17:23 inoue Exp $
1010
*/
1111

1212
#ifndef__PSQLODBC_H__
@@ -41,7 +41,7 @@ typedef UInt4 Oid;
4141
#defineDRIVERNAME "PostgreSQL ODBC"
4242
#defineDBMS_NAME "PostgreSQL"
4343

44-
#definePOSTGRESDRIVERVERSION "07.01.0003"
44+
#definePOSTGRESDRIVERVERSION "07.01.0004"
4545

4646
#ifdefWIN32
4747
#defineDRIVER_FILE_NAME"PSQLODBC.DLL"
@@ -134,6 +134,7 @@ typedef struct GlobalValues_
134134
charconn_settings[LARGE_REGISTRY_LEN];
135135
charprotocol[SMALL_REGISTRY_LEN];
136136

137+
137138
FILE*mylogFP;
138139
FILE*qlogFP;
139140
}GLOBAL_VALUES;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp