[ruby-oci8-commit] [280] branches/ruby-oci8-1.0: * NEWS: add changes between 1.0.2 and 1.0.3.

nobody at rubyforge.org nobody at rubyforge.org
Sun Aug 10 08:42:51 EDT 2008


Revision: 280
Author:   kubo
Date:     2008-08-10 08:42:51 -0400 (Sun, 10 Aug 2008)

Log Message:
-----------
* NEWS: add changes between 1.0.2 and 1.0.3.
* VERSION: change version to 1.0.3.
* ext/oci8/lob.c: add workaround code for a losing character problem
    when reading CLOB. The problem is happened at the following condition.
    1. Oracle client version is 10.2.0.4 or 11.1.0.6.
       (It doesn't depend on Oracle server version.)
    2. The character set is a variable-length one (e.g. AL32UTF8).
    (This probmem was reported by Efren Yevale and Thomas Witt and
     fixed with Thomas Witt's help.)

Modified Paths:
--------------
    branches/ruby-oci8-1.0/ChangeLog
    branches/ruby-oci8-1.0/NEWS
    branches/ruby-oci8-1.0/VERSION
    branches/ruby-oci8-1.0/ext/oci8/lob.c

Modified: branches/ruby-oci8-1.0/ChangeLog
===================================================================
--- branches/ruby-oci8-1.0/ChangeLog	2008-08-09 02:42:31 UTC (rev 279)
+++ branches/ruby-oci8-1.0/ChangeLog	2008-08-10 12:42:51 UTC (rev 280)
@@ -1,3 +1,14 @@
+2008-08-10  KUBO Takehiro  <kubo at jiubao.org>
+	* NEWS: add changes between 1.0.2 and 1.0.3.
+	* VERSION: change version to 1.0.3.
+	* ext/oci8/lob.c: add workaround code for a losing character problem
+	    when reading CLOB. The problem is happened at the following condition.
+	    1. Oracle client version is 10.2.0.4 or 11.1.0.6.
+	       (It doesn't depend on Oracle server version.)
+	    2. The character set is a variable-length one (e.g. AL32UTF8).
+	    (This probmem was reported by Efren Yevale and Thomas Witt and
+	     fixed with Thomas Witt's help.)
+
 2008-08-09  KUBO Takehiro  <kubo at jiubao.org>
 	* ext/oci8/lob.c: fix OCILobLocator#getLength for a lob over 1GB,
 	    which affect OCI8::LOB#size and OCI8::LOB#read. fix
@@ -3,9 +14,11 @@
 	    OCILobLocator#read and OCILobLocator#write to set offset over 2BG,
 	    which affect OCI8::LOB#read and OCI8::LOB#write.
+	    (This probmem was reported by Jonathan Hadders.)
 
 2008-07-12  KUBO Takehiro  <kubo at jiubao.org>
 	* lib/oci8.rb.in: (1) add #to_json to OraDate too.
 	    (2) fix a bug when using Oracle 8i and dbd. OCI_ATTR_FSPRECISION
 	    is for TIMESTAMP data type which is new in Oracle 9i.
+	    (This probmem was reported by Glauco Magnelli.)
 
 2008-07-07  KUBO Takehiro  <kubo at jiubao.org>

Modified: branches/ruby-oci8-1.0/NEWS
===================================================================
--- branches/ruby-oci8-1.0/NEWS	2008-08-09 02:42:31 UTC (rev 279)
+++ branches/ruby-oci8-1.0/NEWS	2008-08-10 12:42:51 UTC (rev 280)
@@ -1,3 +1,29 @@
+1.0.3:
+
+1. add workaround code for a losing character problem when reading CLOB.
+   (reported by Efren Yevale and Thomas Witt and fixed with Thomas Witt's help.)
+
+   The problem is happened at the following condition.
+
+   (a) Oracle client version is 10.2.0.4 or 11.1.0.6.
+       It doesn't happend when using 10.2.0.3 client or lower.
+       It doesn't depend on Oracle server version.
+
+   (b) The character set is a variable-length one.
+       e.g. AL32UTF8
+
+2. fix a problem when reading BLOB/CLOB over 1GB.
+   (reported by Jonathan Hadders.)
+
+3. [rails] fix a problem that OraNumber#to_json returns "{}" when using Rails.
+   (reported by Alex Moore)
+
+   Rails add to_json method. But it doesn't know what OraNumber is.
+   OraNumber#to_json is added for Rails.
+
+4. [dbi] fix a problem when using Oracle 8i and ruby-dbi.
+   (reported by Glauco MagnelliRemi Gagnon.)
+
 1.0.2:
 
 1. add a gemspec file.

Modified: branches/ruby-oci8-1.0/VERSION
===================================================================
--- branches/ruby-oci8-1.0/VERSION	2008-08-09 02:42:31 UTC (rev 279)
+++ branches/ruby-oci8-1.0/VERSION	2008-08-10 12:42:51 UTC (rev 280)
@@ -1 +1 @@
-1.0.2
\ No newline at end of file
+1.0.3
\ No newline at end of file

Modified: branches/ruby-oci8-1.0/ext/oci8/lob.c
===================================================================
--- branches/ruby-oci8-1.0/ext/oci8/lob.c	2008-08-09 02:42:31 UTC (rev 279)
+++ branches/ruby-oci8-1.0/ext/oci8/lob.c	2008-08-10 12:42:51 UTC (rev 280)
@@ -101,7 +101,7 @@
   ub1 csfrm;
   ub4 amt;
   sword rv;
-  char buf[4096];
+  char buf[8192]; /* 8192 is chunk size in a platform. */
 #ifndef OCI8_USE_CALLBACK_LOB_READ
   size_t buf_size_in_char;
 #endif
@@ -137,9 +137,22 @@
    */
   buf_size_in_char = sizeof(buf) / h->u.lob_locator.char_width;
   do {
+    /* initialize buf in zeros everytime to check a nul characters. */
+    memset(buf, 0, sizeof(buf));
     rv = OCILobRead(svch->hp, h->errhp, h->hp, &amt, offset, buf, sizeof(buf), NULL, NULL, csid, csfrm);
     if (rv != OCI_SUCCESS && rv != OCI_NEED_DATA)
       oci8_raise(h->errhp, rv, NULL);
+
+    /* Workaround when using Oracle 10.2.0.4 or 11.1.0.6 client and
+     * variable-length character set (e.g. AL32UTF8).
+     *
+     * When the above mentioned condition, amt may be shorter. So
+     * amt is increaded until a nul character to know the actually
+     * read size.
+     */
+    while (amt < sizeof(buf) && buf[amt] != '\0') {
+      amt++;
+    }
     if (amt == 0)
       break;
     /* for fixed size charset, amt is the number of characters stored in buf. */




More information about the ruby-oci8-commit mailing list