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

Commitc9f8704

Browse files
author
Hiroshi Inoue
committed
1) prevent setting of KSQO on 7.3+ servers(Thanks to Dave Page).
2) Allow LF->CR/LF conversion under UNICODE driver.
1 parent23e5da8 commitc9f8704

File tree

4 files changed

+22
-9
lines changed

4 files changed

+22
-9
lines changed

‎src/interfaces/odbc/connection.c‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -952,6 +952,13 @@ CC_connect(ConnectionClass *self, char password_req, char *salt_para)
952952
* Send any initial settings
953953
*/
954954

955+
/*
956+
* Get the version number first so we can check it before sending options
957+
* that are now obsolete. DJP 21/06/2002
958+
*/
959+
960+
CC_lookup_pg_version(self);/* Get PostgreSQL version for
961+
SQLGetInfo use */
955962
/*
956963
* Since these functions allocate statements, and since the connection
957964
* is not established yet, it would violate odbc state transition
@@ -961,8 +968,6 @@ CC_connect(ConnectionClass *self, char password_req, char *salt_para)
961968
CC_send_settings(self);
962969
CC_lookup_lo(self);/* a hack to get the oid of
963970
our large object oid type */
964-
CC_lookup_pg_version(self);/* Get PostgreSQL version for
965-
SQLGetInfo use */
966971

967972
/*
968973
*Multibyte handling is available ?
@@ -1802,8 +1807,8 @@ CC_send_settings(ConnectionClass *self)
18021807

18031808
}
18041809

1805-
/* KSQO */
1806-
if (ci->drivers.ksqo)
1810+
/* KSQO(not applicable to 7.1+ - DJP 21/06/2002)*/
1811+
if (ci->drivers.ksqo&&PG_VERSION_LT(self,7.1))
18071812
{
18081813
result=PGAPI_ExecDirect(hstmt,"set ksqo to 'ON'",SQL_NTS);
18091814
if ((result!=SQL_SUCCESS)&& (result!=SQL_SUCCESS_WITH_INFO))

‎src/interfaces/odbc/convert.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
702702
#ifdefUNICODE_SUPPORT
703703
if (fCType==SQL_C_WCHAR)
704704
{
705-
len=utf8_to_ucs2(neut_str,-1,NULL,0);
705+
len=utf8_to_ucs2_lf(neut_str,-1,lf_conv,NULL,0);
706706
len *=2;
707707
wchanged=changed= TRUE;
708708
}
@@ -728,7 +728,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
728728
#ifdefUNICODE_SUPPORT
729729
if (fCType==SQL_C_WCHAR)
730730
{
731-
utf8_to_ucs2(neut_str,-1, (SQLWCHAR*)pbic->ttlbuf,len /2);
731+
utf8_to_ucs2_lf(neut_str,-1,lf_conv, (SQLWCHAR*)pbic->ttlbuf,len /2);
732732
}
733733
else
734734
#endif/* UNICODE_SUPPORT */

‎src/interfaces/odbc/psqlodbc.h‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* Comments:See "notice.txt" for copyright and license information.
77
*
8-
* $Id: psqlodbc.h,v 1.67 2002/06/06 04:50:47 inoue Exp $
8+
* $Id: psqlodbc.h,v 1.68 2002/06/28 02:44:15 inoue Exp $
99
*
1010
*/
1111

@@ -255,7 +255,8 @@ voidlogs_on_off(int cnopen, int, int);
255255
#ifdefUNICODE_SUPPORT
256256
UInt4ucs2strlen(constSQLWCHAR*ucs2str);
257257
char*ucs2_to_utf8(constSQLWCHAR*ucs2str,Int4ilen,UInt4*olen);
258-
UInt4utf8_to_ucs2(constchar*utf8str,Int4ilen,SQLWCHAR*ucs2str,UInt4buflen);
258+
UInt4utf8_to_ucs2_lf(constchar*utf8str,Int4ilen,BOOLlfconv,SQLWCHAR*ucs2str,UInt4buflen);
259+
#defineutf8_to_ucs2(utf8str,ilen,ucs2str,buflen) utf8_to_ucs2_lf(utf8str, ilen, FALSE, ucs2str, buflen)
259260
#endif/* UNICODE_SUPPORT */
260261
/*#define_MEMORY_DEBUG_ */
261262
#ifdef_MEMORY_DEBUG_

‎src/interfaces/odbc/win_unicode.c‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ char *ucs2_to_utf8(const SQLWCHAR *ucs2str, Int4 ilen, UInt4 *olen)
8282
#definebyte3_m30x3f
8383
#definebyte2_m10x1f
8484
#definebyte2_m20x3f
85-
UInt4utf8_to_ucs2(constchar*utf8str,Int4ilen,SQLWCHAR*ucs2str,UInt4bufcount)
85+
UInt4utf8_to_ucs2_lf(constchar*utf8str,Int4ilen,BOOLlfconv,SQLWCHAR*ucs2str,UInt4bufcount)
8686
{
8787
inti;
8888
UInt4ocount,wcode;
@@ -102,6 +102,13 @@ UInt4utf8_to_ucs2(const char *utf8str, Int4 ilen, SQLWCHAR *ucs2str, UInt4 bufc
102102
{
103103
if (iswascii(*str))
104104
{
105+
if (lfconv&&*str=='\n'&&
106+
(i==0||str[-1]!='\r'))
107+
{
108+
if (ocount<bufcount)
109+
ucs2str[ocount]='\r';
110+
ocount++;
111+
}
105112
if (ocount<bufcount)
106113
ucs2str[ocount]=*str;
107114
ocount++;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp