From: Jure Kajzer Date: Tue, 9 Nov 2010 08:56:15 +0000 (+0000) Subject: * BLOB temporary handling X-Git-Tag: 1.31.0-rc.0~33969 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/modifier.php?a=commitdiff_plain;h=7c0db2ba75a499d5a26926f5a61475f8733bc5a2;p=lhc%2Fweb%2Fwiklou.git * BLOB temporary handling * en/decodeBlob --- diff --git a/includes/db/DatabaseOracle.php b/includes/db/DatabaseOracle.php index 971bfa3633..5fa9c8ef82 100644 --- a/includes/db/DatabaseOracle.php +++ b/includes/db/DatabaseOracle.php @@ -534,7 +534,7 @@ class DatabaseOracle extends DatabaseBase { // 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' ) { @@ -553,11 +553,15 @@ class DatabaseOracle extends DatabaseBase { 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 ); } } @@ -812,6 +816,17 @@ class DatabaseOracle extends DatabaseBase { 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 ) . ')' ;