Mailinglisten-Archive |
Hallo,
ich habe ein Problem beim upload von Oracle LOB feldern mit dem oci8 interface.
das insert erfolgt ja nun so, was auch klappt:
$req=sprintf("INSERT INTO %s (insert_date_%s,insert_by_%s,kind_of_%s,duration_%s,title_%s,place_%s,contentarea_%s,branch_%s,data_%s) VALUES ".
"(:currenttime,:userid,:kind,:duration,:title,:place,:contentarea,:branch,EMPTY_CLOB()) returning data_%s into :data",
$this->type,$this->type,$this->type,$this->type,$this->type,$this->type,$this->type,$this->type,$this->type,$this->type,
$this->type);
$this->parse($req);
$lob = ocinewdescriptor($this->conn,OCI_D_LOB);
_(at)_OCIBindByName($this->stmt,":data",$lob,-1,SQLT_CLOB);
$this->execute($this->stmt,OCI_DEFAULT);
$lob->save(serialize($data));
$this->commit();
das problem ist nun ein update eines solchen CLOB feldes ich fand ein
beispielcode von thies:
// SELECT and update the lob....
$stmt = ociparse($conn,"select * from test");
ociexecute($stmt,OCI_DEFAULT);
while (ocifetchinto($stmt,&$arr,OCI_ASSOC)) {
var_dump($arr);
$lob = $arr[ "CLOB" ]->load();
$arr[ "CLOB" ]->load($lob . "saved again");
}
ocifreestatement($stmt);
aber so wie mir es scheint, wird doch dort auber nciht abgespeichert ???
oder ueberseh ich da was ?
ich habs dann so probiert:
$req=sprintf("SELECT data_%s FROM %s WHERE id_%s='%s' FOR UPDATE",
$this->type,$this->type,$this->type,$jobid);
$this->parse($req);
$this->execute($this->stmt,OCI_DEFAULT);
$req=sprintf("UPDATE %s SET data_%s=:data WHERE id_%s='%s'",
$this->type,$this->type,$this->type,$jobid);
$this->parse($req);
$lob = ocinewdescriptor($this->conn,OCI_D_LOB);
_(at)_OCIBindByName($this->stmt,":data", &$lob,-1,SQLT_CLOB);
$this->execute($this->stmt,OCI_DEFAULT);
$lob->save(serialize($data));
if(!$this->commit()){
return FALSE;
}
was leider hierzufuehrt:
22275, 00000, "invalid LOB locator specified"
// *Cause: There are several causes: (1) the LOB locator was never
// initialized; (2) the locator is for a BFILE and the routine
// expects a BLOB/CLOB/NCLOB locator; (3) the locator is for a
// BLOB/CLOB/NCLOB and the routine expects a BFILE locator;
// (4) trying to update the LOB in a trigger body -- LOBs in
// trigger bodies are read only.
// *Action: For (1), initialize the LOB locator by selecting into the locator
// variable or by setting the LOB locator to empty. For (2) and (3),
// pass the correct type of locator into the routine. For (4),
hat da jemand eine idee ? die beispielcodes sammel ich im ueberigen und bastel
sie mit in der schonmal angesprochene oracle faq.
gruss
thomas
--
---------------------------------------------------------
Mail: tfromm_(at)_cs.uni-potsdam.de
Web: http://codewizards.org/thomas.fromm
Job: http://www.inubit.com
PHP-Stand auf Europas größter Linux-Messe: 'Linux-Tag' !
weitere Infos _(at)_ http://www.dynamic-webpages.de/
php::bar PHP Wiki - Listenarchive