Author: byterock
Date: Thu Sep 18 13:53:42 2008
New Revision: 11822
Modified:
dbd-oracle/branches/utf8_ea/dbdimp.c
dbd-oracle/branches/utf8_ea/dbdimp.h
Log:
latest stuff tried to get rid of the croak
Modified: dbd-oracle/branches/utf8_ea/dbdimp.c
==============================================================================
--- dbd-oracle/branches/utf8_ea/dbdimp.c (original)
+++ dbd-oracle/branches/utf8_ea/dbdimp.c Thu Sep 18 13:53:42 2008
@@ -54,7 +54,7 @@
ub2 utf8_csid = 871;
ub2 al32utf8_csid = 873;
ub2 al16utf16_csid = 2000;
-ub2 we8mawin1252 = 178;
+ub2 we8mswin1252 = 178;
typedef struct sql_fbh_st sql_fbh_t;
struct sql_fbh_st {
@@ -531,18 +531,13 @@
#ifdef NEW_OCI_INIT /* XXX needs merging into use_proc_connection branch */
-
-PerlIO_printf(DBILOGFP," charsetid=%d)\n",charsetid);
-
- /* Get CLIENT char and nchar charset id values*/
+ /* Get CLIENT char and nchar charset id values */
OCINlsEnvironmentVariableGet_log_stat( &charsetid, 0, OCI_NLS_CHARSET_ID, 0, &rsize ,status );
if (status != OCI_SUCCESS) {
oci_error(dbh, NULL, status,
"OCINlsEnvironmentVariableGet(OCI_NLS_CHARSET_ID) Check NLS settings etc.");
return 0;
}
-PerlIO_printf(DBILOGFP," charsetid=%d)\n",charsetid);
-PerlIO_printf(DBILOGFP," ncharsetid=%d)\n",ncharsetid);
OCINlsEnvironmentVariableGet_log_stat( &ncharsetid, 0, OCI_NLS_NCHARSET_ID, 0, &rsize ,status );
if (status != OCI_SUCCESS) {
@@ -550,7 +545,6 @@
"OCINlsEnvironmentVariableGet(OCI_NLS_NCHARSET_ID) Check NLS settings etc.");
return 0;
}
-PerlIO_printf(DBILOGFP," out ncharsetid=%d)\n",ncharsetid);
/*{
After using OCIEnvNlsCreate() to create the environment handle,
@@ -623,13 +617,7 @@
utf8_csid = OCINlsCharSetNameToId(imp_dbh->envhp, (void*)"UTF8");
al32utf8_csid = OCINlsCharSetNameToId(imp_dbh->envhp, (void*)"AL32UTF8");
al16utf16_csid = OCINlsCharSetNameToId(imp_dbh->envhp, (void*)"AL16UTF16");
-
- PerlIO_printf(DBILOGFP," in we8mawin1252=%d)\n",ncharsetid);
-
- we8mawin1252 = OCINlsCharSetNameToId(imp_dbh->envhp, (void*)"WE8MAWIN1252");
-
- PerlIO_printf(DBILOGFP," out we8mawin1252=%d)\n",ncharsetid);
-
+ we8mswin1252 = OCINlsCharSetNameToId(imp_dbh->envhp, (void*)"we8mswin1252");
#else /* (the old init code) NEW_OCI_INIT */
/* this is now depricated and will be removed as we no longer support <9.2 oracle*/
/* XXX recent oracle docs recommend using OCIEnvCreate() instead of */
@@ -711,17 +699,14 @@
if (DBIS->debug >= 3 || dbd_verbose >= 3) {
- ub1 is_utf8;
oratext charsetname[OCI_NLS_MAXBUFSZ];
oratext ncharsetname[OCI_NLS_MAXBUFSZ];
- OCIAttrGet_log_stat(imp_dbh->envhp, OCI_HTYPE_ENV, &is_utf8, 0 ,
- OCI_ATTR_ENV_CHARSET_ID, imp_dbh->errhp, status);
OCINlsCharSetIdToName(imp_dbh->envhp,charsetname, sizeof(charsetname),charsetid );
OCINlsCharSetIdToName(imp_dbh->envhp,ncharsetname, sizeof(ncharsetname),ncharsetid );
PerlIO_printf(DBILOGFP," charset id=%d, name=%s, ncharset id=%d, name=%s"
- " (csid: utf8=%d al32utf8=%d and this=%d)\n",
- charsetid,charsetname, ncharsetid,ncharsetname, utf8_csid, al32utf8_csid,is_utf8);
+ " (csid: utf8=%d al32utf8=%d)\n",
+ charsetid,charsetname, ncharsetid,ncharsetname, utf8_csid, al32utf8_csid);
}
@@ -3162,7 +3147,7 @@
else if (CSFORM_IMPLIES_UTF8(SQLCS_NCHAR))
csform = SQLCS_NCHAR; /* else leave csform == 0 */
- if (trace_level || dbd_verbose <= 1)
+ if (trace_level || dbd_verbose >= 1)
PerlIO_printf(DBILOGFP, "do_bind_array_exec() (2): rebinding %s with UTF8 value %s", phs->name,
(csform == SQLCS_IMPLICIT) ? "so setting csform=SQLCS_IMPLICIT" :
(csform == SQLCS_NCHAR) ? "so setting csform=SQLCS_NCHAR" :
@@ -3185,25 +3170,19 @@
/* if app has specified a csid then use that, else use default */
- PerlIO_printf(DBILOGFP, "csid =%d\n",phs->csid);
- PerlIO_printf(DBILOGFP, "csid_orig =%d\n",phs->csid_orig);
csid = (phs->csid) ? phs->csid : phs->csid_orig;
-PerlIO_printf(DBILOGFP, "csid =%d\n",csid);
-PerlIO_printf(DBILOGFP, "we8mawin1252 =%d csid=%d\n",we8mawin1252,csid);
-
- PerlIO_printf(DBILOGFP, "CS_IS_UTF8_COMPATIBLE(csid) =%d\n",CS_IS_UTF8_COMPATIBLE(csid));
/* 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_UTF8_COMPATIBLE(csid)) {
+ /* if ((utf8 & ARRAY_BIND_NATIVE) && !CS_IS_UTF8_COMPATIBLE(csid)) {
croak("Can't mix utf8 and non-utf8 in array bind");
- }
+ }*/
csid = utf8_csid; /* not al32utf8_csid here on purpose */
}
- PerlIO_printf(DBILOGFP, "csid after=%d\n",csid);
- if (trace_level >= 3 || dbd_verbose <= 3 )
+
+ if (trace_level >= 3 || dbd_verbose >= 3 )
PerlIO_printf(DBILOGFP, "do_bind_array_exec(): bind %s <== [array of values] "
"(%s, %s, csid %d->%d->%d, ftype %d (%s), csform %d->%d, maxlen %lu, maxdata_size %lu)\n",
phs->name,
@@ -3404,13 +3383,38 @@
phs[i]->maxlen = len;
/* update the utf8_flgs for this value */
+
+ /*PerlIO_printf(DBILOGFP, "\nn in sv=%s...\n",sv);*/
+
+
+
+
if (SvUTF8(sv)) {
+ /*STRLEN len2;
+ char* xx;
+ xx=SvPVutf8( sv, len2);
+ PerlIO_printf(DBILOGFP, " 11xx=%s,len2=%d...\n",xx,len2);
+*/
utf8_flgs[i] |= ARRAY_BIND_UTF8;
}
else {
+ /*STRLEN len2;
+ char* xx;
+ bool is_utf8;
+ xx=SvPVutf8( sv, len2);
+ PerlIO_printf(DBILOGFP, " xx=%s,len2=%d...\n",xx,len2);
+
+ is_utf8=is_utf8_string((U8*)sv,1);
+
+ PerlIO_printf(DBILOGFP, "is_utf8=%d...\n",is_utf8);
+*/
+
utf8_flgs[i] |= ARRAY_BIND_NATIVE;
+
}
+
+
/* Do OCI bind calls on last iteration. */
if( ((unsigned int) j ) == exe_count - 1 ) {
if(!do_bind_array_exec(sth, imp_sth, phs[i], utf8_flgs[i])) {
Modified: dbd-oracle/branches/utf8_ea/dbdimp.h
==============================================================================
--- dbd-oracle/branches/utf8_ea/dbdimp.h (original)
+++ dbd-oracle/branches/utf8_ea/dbdimp.h Thu Sep 18 13:53:42 2008
@@ -256,7 +256,7 @@
extern ub2 ncharsetid;
extern ub2 us7ascii_csid;
extern ub2 utf8_csid;
-extern ub2 we8mawin1252;
+extern ub2 we8mswin1252; /*default for windows */
extern ub2 al32utf8_csid;
extern ub2 al16utf16_csid;
@@ -264,7 +264,8 @@
( ( cs == utf8_csid ) || ( cs == al32utf8_csid ) )
#define CS_IS_UTF8_COMPATIBLE( cs ) \
- ( CS_IS_UTF8(cs) || (cs) == 873 )
+ ( CS_IS_UTF8(cs) || ( (cs) == us7ascii_csid ) || ( (cs) == we8mswin1252 ) )
+
#define CS_IS_UTF16( cs ) ( cs == al16utf16_csid )
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.