1) prevent setting of KSQO on 7.3+ servers(Thanks to Dave Page).
2) Allow LF->CR/LF conversion under UNICODE driver.
This commit is contained in:
parent
23e5da8a48
commit
c9f8704251
@ -952,6 +952,13 @@ another_version_retry:
|
|||||||
* Send any initial settings
|
* Send any initial settings
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get the version number first so we can check it before sending options
|
||||||
|
* that are now obsolete. DJP 21/06/2002
|
||||||
|
*/
|
||||||
|
|
||||||
|
CC_lookup_pg_version(self); /* Get PostgreSQL version for
|
||||||
|
SQLGetInfo use */
|
||||||
/*
|
/*
|
||||||
* Since these functions allocate statements, and since the connection
|
* Since these functions allocate statements, and since the connection
|
||||||
* is not established yet, it would violate odbc state transition
|
* is not established yet, it would violate odbc state transition
|
||||||
@ -961,8 +968,6 @@ another_version_retry:
|
|||||||
CC_send_settings(self);
|
CC_send_settings(self);
|
||||||
CC_lookup_lo(self); /* a hack to get the oid of
|
CC_lookup_lo(self); /* a hack to get the oid of
|
||||||
our large object oid type */
|
our large object oid type */
|
||||||
CC_lookup_pg_version(self); /* Get PostgreSQL version for
|
|
||||||
SQLGetInfo use */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Multibyte handling is available ?
|
* Multibyte handling is available ?
|
||||||
@ -1802,8 +1807,8 @@ CC_send_settings(ConnectionClass *self)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* KSQO */
|
/* KSQO (not applicable to 7.1+ - DJP 21/06/2002) */
|
||||||
if (ci->drivers.ksqo)
|
if (ci->drivers.ksqo && PG_VERSION_LT(self, 7.1))
|
||||||
{
|
{
|
||||||
result = PGAPI_ExecDirect(hstmt, "set ksqo to 'ON'", SQL_NTS);
|
result = PGAPI_ExecDirect(hstmt, "set ksqo to 'ON'", SQL_NTS);
|
||||||
if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
|
if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
|
||||||
|
@ -702,7 +702,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
|
|||||||
#ifdef UNICODE_SUPPORT
|
#ifdef UNICODE_SUPPORT
|
||||||
if (fCType == SQL_C_WCHAR)
|
if (fCType == SQL_C_WCHAR)
|
||||||
{
|
{
|
||||||
len = utf8_to_ucs2(neut_str, -1, NULL, 0);
|
len = utf8_to_ucs2_lf(neut_str, -1, lf_conv, NULL, 0);
|
||||||
len *= 2;
|
len *= 2;
|
||||||
wchanged = changed = TRUE;
|
wchanged = changed = TRUE;
|
||||||
}
|
}
|
||||||
@ -728,7 +728,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
|
|||||||
#ifdef UNICODE_SUPPORT
|
#ifdef UNICODE_SUPPORT
|
||||||
if (fCType == SQL_C_WCHAR)
|
if (fCType == SQL_C_WCHAR)
|
||||||
{
|
{
|
||||||
utf8_to_ucs2(neut_str, -1, (SQLWCHAR *) pbic->ttlbuf, len / 2);
|
utf8_to_ucs2_lf(neut_str, -1, lf_conv, (SQLWCHAR *) pbic->ttlbuf, len / 2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif /* UNICODE_SUPPORT */
|
#endif /* UNICODE_SUPPORT */
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
*
|
*
|
||||||
* Comments: See "notice.txt" for copyright and license information.
|
* Comments: See "notice.txt" for copyright and license information.
|
||||||
*
|
*
|
||||||
* $Id: psqlodbc.h,v 1.67 2002/06/06 04:50:47 inoue Exp $
|
* $Id: psqlodbc.h,v 1.68 2002/06/28 02:44:15 inoue Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -255,7 +255,8 @@ void logs_on_off(int cnopen, int, int);
|
|||||||
#ifdef UNICODE_SUPPORT
|
#ifdef UNICODE_SUPPORT
|
||||||
UInt4 ucs2strlen(const SQLWCHAR *ucs2str);
|
UInt4 ucs2strlen(const SQLWCHAR *ucs2str);
|
||||||
char *ucs2_to_utf8(const SQLWCHAR *ucs2str, Int4 ilen, UInt4 *olen);
|
char *ucs2_to_utf8(const SQLWCHAR *ucs2str, Int4 ilen, UInt4 *olen);
|
||||||
UInt4 utf8_to_ucs2(const char * utf8str, Int4 ilen, SQLWCHAR *ucs2str, UInt4 buflen);
|
UInt4 utf8_to_ucs2_lf(const char * utf8str, Int4 ilen, BOOL lfconv, SQLWCHAR *ucs2str, UInt4 buflen);
|
||||||
|
#define utf8_to_ucs2(utf8str, ilen, ucs2str, buflen) utf8_to_ucs2_lf(utf8str, ilen, FALSE, ucs2str, buflen)
|
||||||
#endif /* UNICODE_SUPPORT */
|
#endif /* UNICODE_SUPPORT */
|
||||||
/*#define _MEMORY_DEBUG_ */
|
/*#define _MEMORY_DEBUG_ */
|
||||||
#ifdef _MEMORY_DEBUG_
|
#ifdef _MEMORY_DEBUG_
|
||||||
|
@ -82,7 +82,7 @@ char *ucs2_to_utf8(const SQLWCHAR *ucs2str, Int4 ilen, UInt4 *olen)
|
|||||||
#define byte3_m3 0x3f
|
#define byte3_m3 0x3f
|
||||||
#define byte2_m1 0x1f
|
#define byte2_m1 0x1f
|
||||||
#define byte2_m2 0x3f
|
#define byte2_m2 0x3f
|
||||||
UInt4 utf8_to_ucs2(const char *utf8str, Int4 ilen, SQLWCHAR *ucs2str, UInt4 bufcount)
|
UInt4 utf8_to_ucs2_lf(const char *utf8str, Int4 ilen, BOOL lfconv, SQLWCHAR *ucs2str, UInt4 bufcount)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
UInt4 ocount, wcode;
|
UInt4 ocount, wcode;
|
||||||
@ -102,6 +102,13 @@ UInt4 utf8_to_ucs2(const char *utf8str, Int4 ilen, SQLWCHAR *ucs2str, UInt4 bufc
|
|||||||
{
|
{
|
||||||
if (iswascii(*str))
|
if (iswascii(*str))
|
||||||
{
|
{
|
||||||
|
if (lfconv && *str == '\n' &&
|
||||||
|
(i == 0 || str[-1] != '\r'))
|
||||||
|
{
|
||||||
|
if (ocount < bufcount)
|
||||||
|
ucs2str[ocount] = '\r';
|
||||||
|
ocount++;
|
||||||
|
}
|
||||||
if (ocount < bufcount)
|
if (ocount < bufcount)
|
||||||
ucs2str[ocount] = *str;
|
ucs2str[ocount] = *str;
|
||||||
ocount++;
|
ocount++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user