r76383 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76382‎ | r76383 | r76384 >
Date:08:56, 9 November 2010
Author:freakolowsky
Status:ok (Comments)
Tags:
Comment:
* BLOB temporary handling
* en/decodeBlob
Modified paths:
  • /trunk/phase3/includes/db/DatabaseOracle.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/db/DatabaseOracle.php
@@ -534,7 +534,7 @@
535535 // do nothing ... null was inserted in statement creation
536536 } elseif ( $col_type != 'BLOB' && $col_type != 'CLOB' ) {
537537 if ( is_object( $val ) ) {
538 - $val = $val->getData();
 538+ $val = $val->fetch();
539539 }
540540
541541 if ( preg_match( '/^timestamp.*/i', $col_type ) == 1 && strtolower( $val ) == 'infinity' ) {
@@ -553,11 +553,15 @@
554554 throw new DBUnexpectedError( $this, "Cannot create LOB descriptor: " . $e['message'] );
555555 }
556556
 557+ if ( is_object( $val ) ) {
 558+ $val = $val->fetch();
 559+ }
 560+
557561 if ( $col_type == 'BLOB' ) {
558 - $lob[$col]->writeTemporary( $val );
559 - oci_bind_by_name( $stmt, ":$col", $lob[$col], - 1, SQLT_BLOB );
 562+ $lob[$col]->writeTemporary( $val, OCI_TEMP_BLOB );
 563+ oci_bind_by_name( $stmt, ":$col", $lob[$col], - 1, OCI_B_BLOB );
560564 } else {
561 - $lob[$col]->writeTemporary( $val );
 565+ $lob[$col]->writeTemporary( $val, OCI_TEMP_CLOB );
562566 oci_bind_by_name( $stmt, ":$col", $lob[$col], - 1, OCI_B_CLOB );
563567 }
564568 }
@@ -812,6 +816,17 @@
813817 return "SELECT * FROM ($sql) WHERE rownum >= (1 + $offset) AND rownum < (1 + $limit + $offset)";
814818 }
815819
 820+ function encodeBlob( $b ) {
 821+ return new Blob( $b );
 822+ }
 823+
 824+ function decodeBlob( $b ) {
 825+ if ( $b instanceof Blob ) {
 826+ $b = $b->fetch();
 827+ }
 828+ return $b;
 829+ }
 830+
816831 function unionQueries( $sqls, $all ) {
817832 $glue = ' UNION ALL ';
818833 return 'SELECT * ' . ( $all ? '':'/* UNION_UNIQUE */ ' ) . 'FROM (' . implode( $glue, $sqls ) . ')' ;

Comments

#Comment by 😂 (talk | contribs)   20:41, 9 January 2011

Do you really need the ORABlob class?

#Comment by Freakolowsky (talk | contribs)   10:36, 10 January 2011

well ... not actually ... removed ... will commit asap

Status & tagging log