// do nothing ... null was inserted in statement creation
} elseif ( $col_type != 'BLOB' && $col_type != 'CLOB' ) {
if ( is_object( $val ) ) {
- $val = $val->getData();
+ $val = $val->fetch();
}
if ( preg_match( '/^timestamp.*/i', $col_type ) == 1 && strtolower( $val ) == 'infinity' ) {
throw new DBUnexpectedError( $this, "Cannot create LOB descriptor: " . $e['message'] );
}
+ if ( is_object( $val ) ) {
+ $val = $val->fetch();
+ }
+
if ( $col_type == 'BLOB' ) {
- $lob[$col]->writeTemporary( $val );
- oci_bind_by_name( $stmt, ":$col", $lob[$col], - 1, SQLT_BLOB );
+ $lob[$col]->writeTemporary( $val, OCI_TEMP_BLOB );
+ oci_bind_by_name( $stmt, ":$col", $lob[$col], - 1, OCI_B_BLOB );
} else {
- $lob[$col]->writeTemporary( $val );
+ $lob[$col]->writeTemporary( $val, OCI_TEMP_CLOB );
oci_bind_by_name( $stmt, ":$col", $lob[$col], - 1, OCI_B_CLOB );
}
}
return "SELECT * FROM ($sql) WHERE rownum >= (1 + $offset) AND rownum < (1 + $limit + $offset)";
}
+ function encodeBlob( $b ) {
+ return new Blob( $b );
+ }
+
+ function decodeBlob( $b ) {
+ if ( $b instanceof Blob ) {
+ $b = $b->fetch();
+ }
+ return $b;
+ }
+
function unionQueries( $sqls, $all ) {
$glue = ' UNION ALL ';
return 'SELECT * ' . ( $all ? '':'/* UNION_UNIQUE */ ' ) . 'FROM (' . implode( $glue, $sqls ) . ')' ;