I’m building a content submission form using the nh-ckeditor extension for the content body area. I’m using Oracle with the pdo_oci driver, and its been working great so far.
I have a column in the database as a type BLOB - and the model is limiting the content to 4000 characters. I changed that limit to 40000 just for grins so I could test a longer post, and I get
CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1461 OCIStmtExecute: ORA-01461: can bind a LONG value only for insert into a LONG column
So YII is thinking this is a LONG type, not a BLOB.
I search it all around the net, finally I found a probably solution at Large Object.
I follow the example #2
<?php
$db = new PDO('odbc:SAMPLE', 'db2inst1', 'ibmdb2');
$stmt = $db->prepare("insert into images (id, contenttype, imagedata) values (?, ?, ?)");
$id = get_new_id(); // some function to allocate a new ID
// assume that we are running as part of a file upload form
// You can find more information in the PHP documentation
$fp = fopen($_FILES['file']['tmp_name'], 'rb');
$stmt->bindParam(1, $id);
$stmt->bindParam(2, $_FILES['file']['type']);
$stmt->bindParam(3, $fp, PDO::PARAM_LOB);
$db->beginTransaction();
$stmt->execute();
$db->commit();
?>
I get the db by
$db = Yii::app()->db->getPdoInstance()
instead by
$db = new PDO('odbc:SAMPLE', 'db2inst1', 'ibmdb2');