10:41am February 06, 2008
CakePHP Clob Behavior
Updated: I've made some changes to the CakePHP Clob Behavior
Bobby Borisov and Nedko Penev over at chankov.net wrote a great CakePHP behavior to help with handling Oracle clob fields in CakePHP 1.2. For those of you unfamiliar with Oracle, it will only let you insert or update a clob field with less than 4000 characters without using a bind variable. If you need to place a value into a clob field with over 4000 characters, your code will need to use Oracle binds.

CakePHP is a great package, but it is easy to see that its interactive with Oracle is limited at best. The dbo_oracle.php, the Oracle connection wrapper class, doesn't have any code for using a number of Oracle specific "features". The main one missing is the ability to bind variables.

This is where Bobby's and Nedko's clob behavior comes in. It is a great piece of code, however it contacted a handful of errors that we had to fix in order for it to work.

Warning Due to the fact that CakePHP does not use behaviors when storing sessions in the database, if you are trying to store a session larger than 4000 characters in your Oracle database, using CakePHP 1.2, it will still throw ORA-01704: string literal too long.
Views  1007 Comments  3
Filed under: CakePHP, Oracle
Add Comment
cedric
Hi, you can get a custom dbo_oracle.php with support for bind variables here: https://trac.cakephp.org/attachment/ticket/2294/dbo_oracle.php https://trac.cakephp.org/ticket/2294
Chris
Unfortunately, we are using CakePHP 1.2, not 1.1, so we won't be able to use this.
Tony Cooper
I googled the clob behavior because it doesn't seem to be working properly and this was the first entry that came up.
View Chris Thompson's profile on LinkedIn
Loading...