Author: byterock
Date: Fri Oct 24 12:30:51 2008
New Revision: 11999
Modified:
dbd-oracle/trunk/dbdimp.c
dbd-oracle/trunk/dbdimp.h
Log:
found one other little bug with utf8 now fixed. This version now does not leak
memory
Modified: dbd-oracle/trunk/dbdimp.c
==============================================================================
--- dbd-oracle/trunk/dbdimp.c (original)
+++ dbd-oracle/trunk/dbdimp.c Fri Oct 24 12:30:51 2008
@@ -3176,12 +3176,13 @@
/* if app has specified a csid then use that, else use default */
csid = (phs->csid) ? phs->csid : phs->csid_orig;
+
/* if data is utf8 but charset isn't then switch to utf8 csid if
possible */
if ((utf8 & ARRAY_BIND_UTF8) && !CS_IS_UTF8(csid)) {
/* if the specified or default csid is not utf8 _compatible_ AND we
have
* mixed utf8 and native (non-utf8) data, then it's a fatal problem
* utf8 _compatible_ means, can be upgraded to utf8, ie. utf8 or
ascii */
- if ((utf8 & ARRAY_BIND_NATIVE) && CS_IS_NOT_UTF8(csid)) {
+ if ((utf8 & ARRAY_BIND_NATIVE) && !CS_IS_UTF8_COMPATIBLE(csid)) {
oratext charsetname[OCI_NLS_MAXBUFSZ];
OCINlsCharSetIdToName(imp_sth->envhp,charsetname, sizeof(charsetname),csid );
Modified: dbd-oracle/trunk/dbdimp.h
==============================================================================
--- dbd-oracle/trunk/dbdimp.h (original)
+++ dbd-oracle/trunk/dbdimp.h Fri Oct 24 12:30:51 2008
@@ -259,16 +259,14 @@
extern ub2 al32utf8_csid;
extern ub2 al16utf16_csid;
-#define CS_IS_NOT_UTF8( cs ) ( cs == us7ascii_csid )
-
#define CS_IS_UTF8( cs ) \
- ( ( cs == utf8_csid ) )
+ ( ( cs == utf8_csid ) || ( cs == al32utf8_csid ) )
#define CS_IS_UTF8_COMPATIBLE( cs ) \
( CS_IS_UTF8(cs) || ( (cs) == us7ascii_csid ) )
+ #define CS_IS_UTF16( cs ) ( cs == al16utf16_csid )
-#define CS_IS_UTF16( cs ) ( cs == al16utf16_csid )
#define CSFORM_IMPLIED_CSID(csform) \
((csform==SQLCS_NCHAR) ? ncharsetid : charsetid)