nearinfinity/node-oracle — pull request #63 by raztus (2013-07-26 19:55:43+00:00)
Title: Fixed CLOB UTF8 bug where value would be truncated and padded with

This request fixes a bug when the CLOB value contains multi-byte characters (e.g., UTF8). The value would be truncated and padded with null characters, and the oracle stream would be left open. This is because the code used `clob->length()`, which returns the number of characters rather than the number of bytes, and only read that number of bytes. Due to the way execptions are handled, this resulted in a confusing error:
```bash
terminate called after throwing an instance of 'oracle::occi::SQLException'
what(): ORA-03127: no new operations allowed until the active operation ends

Aborted
```

If the connection was left open (for example, if using the generic-pool module for connection pooling) the underlying oracle error was exposed:
```bash
Error: ORA-24820: Differnt LOB function called while another OCI LOB call is in progress
```

This implementation gets the chunkSize of the CLOB, which is set at table-creation, then reads that many bytes at a time until it hits the end of the stream represented by `-1`. I have tested this with CLOB fields of 8MB ascii and 6MB utf8 (using 4-byte characters). This comes no where near the 4GB limit of a CLOB, so good luck with that!