Index: trunk/phase3/maintenance/ora/tables.sql |
— | — | @@ -659,7 +659,7 @@ |
660 | 660 | /*$mw$*/ |
661 | 661 | |
662 | 662 | /*$mw$*/ |
663 | | -CREATE OR REPLACE TYPE GET_OUTPUT_TYPE AS TABLE OF VARCHAR2(255); |
| 663 | +CREATE OR REPLACE TYPE GET_OUTPUT_TYPE IS TABLE OF VARCHAR2(255); |
664 | 664 | /*$mw$*/ |
665 | 665 | |
666 | 666 | /*$mw$*/ |
Index: trunk/phase3/includes/db/DatabaseOracle.php |
— | — | @@ -208,8 +208,7 @@ |
209 | 209 | return true; |
210 | 210 | } |
211 | 211 | |
212 | | - static function newFromParams( $server = false, $user = false, $password = false, $dbName = false, |
213 | | - $failFunction = false, $flags = 0) |
| 212 | + static function newFromParams( $server, $user, $password, $dbName, $failFunction = false, $flags = 0 ) |
214 | 213 | { |
215 | 214 | return new DatabaseOracle( $server, $user, $password, $dbName, $failFunction, $flags ); |
216 | 215 | } |
— | — | @@ -289,7 +288,9 @@ |
290 | 289 | $union_unique = (preg_match('/\/\* UNION_UNIQUE \*\/ /', $sql) != 0); |
291 | 290 | //EXPLAIN syntax in Oracle is EXPLAIN PLAN FOR and it return nothing |
292 | 291 | //you have to select data from plan table after explain |
| 292 | + $olderr = error_reporting(E_ERROR); |
293 | 293 | $explain_id = date('dmYHis'); |
| 294 | + error_reporting($olderr); |
294 | 295 | $sql = preg_replace('/^EXPLAIN /', 'EXPLAIN PLAN SET STATEMENT_ID = \''.$explain_id.'\' FOR', $sql, 1, $explain_count); |
295 | 296 | |
296 | 297 | |
— | — | @@ -446,33 +447,30 @@ |
447 | 448 | $first = true; |
448 | 449 | foreach ($row as $col => $val) { |
449 | 450 | if ($first) |
450 | | - $sql .= ':'.$col; |
| 451 | + $sql .= $val !== NULL ? ':'.$col : 'NULL'; |
451 | 452 | else |
452 | | - $sql.= ', :'.$col; |
| 453 | + $sql .= $val !== NULL ? ', :'.$col : ', NULL'; |
453 | 454 | |
454 | 455 | $first = false; |
455 | 456 | } |
456 | 457 | $sql .= ')'; |
457 | 458 | |
458 | | - $stmt = oci_parse($this->mConn, $sql); |
459 | | - foreach ($row as $col => $val) { |
460 | | - if (!is_object($val)) { |
461 | | - if (oci_bind_by_name($stmt, ":$col", $row[$col]) === false) |
462 | | - $this->reportQueryError($this->lastErrno(), $this->lastError(), $sql, __METHOD__); |
463 | | - } |
464 | | - } |
465 | 459 | |
466 | 460 | $stmt = oci_parse($this->mConn, $sql); |
467 | | - foreach ($row as $col => $val) { |
| 461 | + foreach ($row as $col => &$val) { |
468 | 462 | $col_type=$this->fieldInfo($this->tableName($table), $col)->type(); |
469 | | - if ($col_type != 'BLOB' && $col_type != 'CLOB') { |
| 463 | + |
| 464 | + if ($val === NULL) { |
| 465 | + // do nothing ... null was inserted in statement creation |
| 466 | + } elseif ($col_type != 'BLOB' && $col_type != 'CLOB') { |
470 | 467 | if (is_object($val)) |
471 | 468 | $val = $val->getData(); |
472 | | - |
| 469 | + |
473 | 470 | if (preg_match('/^timestamp.*/i', $col_type) == 1 && strtolower($val) == 'infinity') |
474 | 471 | $val = '31-12-2030 12:00:00.000000'; |
475 | 472 | |
476 | | - if (oci_bind_by_name($stmt, ":$col", $wgLang->checkTitleEncoding($val)) === false) |
| 473 | + $val = $wgLang->checkTitleEncoding($val); |
| 474 | + if (oci_bind_by_name($stmt, ":$col", $val) === false) |
477 | 475 | $this->reportQueryError($this->lastErrno(), $this->lastError(), $sql, __METHOD__); |
478 | 476 | } else { |
479 | 477 | if (($lob[$col] = oci_new_descriptor($this->mConn, OCI_D_LOB)) === false) { |
— | — | @@ -489,7 +487,7 @@ |
490 | 488 | } |
491 | 489 | } |
492 | 490 | } |
493 | | - |
| 491 | + |
494 | 492 | $olderr = error_reporting(E_ERROR); |
495 | 493 | if (oci_execute($stmt, OCI_DEFAULT) === false) { |
496 | 494 | $e = oci_error($stmt); |
— | — | @@ -720,14 +718,14 @@ |
721 | 719 | return $size; |
722 | 720 | } |
723 | 721 | |
724 | | - function limitResult($sql, $limit, $offset) { |
| 722 | + function limitResult( $sql, $limit, $offset=false ) { |
725 | 723 | if ($offset === false) |
726 | 724 | $offset = 0; |
727 | 725 | return "SELECT * FROM ($sql) WHERE rownum >= (1 + $offset) AND rownum < (1 + $limit + $offset)"; |
728 | 726 | } |
729 | 727 | |
730 | 728 | |
731 | | - function unionQueries($sqls, $all = false) { |
| 729 | + function unionQueries($sqls, $all) { |
732 | 730 | $glue = ' UNION ALL '; |
733 | 731 | return 'SELECT * '.($all?'':'/* UNION_UNIQUE */ ').'FROM ('.implode( $glue, $sqls ).')' ; |
734 | 732 | } |
— | — | @@ -801,7 +799,7 @@ |
802 | 800 | * Query whether a given column exists in the mediawiki schema |
803 | 801 | * based on prebuilt table to simulate MySQL field info and keep query speed minimal |
804 | 802 | */ |
805 | | - function fieldExists( $table, $field ) { |
| 803 | + function fieldExists( $table, $field, $fname = 'DatabaseOracle::fieldExists' ) { |
806 | 804 | if (!isset($this->fieldInfo_stmt)) |
807 | 805 | $this->fieldInfo_stmt = oci_parse($this->mConn, 'SELECT * FROM wiki_field_info_full WHERE table_name = upper(:tab) and column_name = UPPER(:col)'); |
808 | 806 | |
— | — | @@ -821,7 +819,8 @@ |
822 | 820 | if (!isset($this->fieldInfo_stmt)) |
823 | 821 | $this->fieldInfo_stmt = oci_parse($this->mConn, 'SELECT * FROM wiki_field_info_full WHERE table_name = upper(:tab) and column_name = UPPER(:col)'); |
824 | 822 | |
825 | | - oci_bind_by_name($this->fieldInfo_stmt, ':tab', trim($table, '"')); |
| 823 | + $table = trim($table, '"'); |
| 824 | + oci_bind_by_name($this->fieldInfo_stmt, ':tab', $table); |
826 | 825 | oci_bind_by_name($this->fieldInfo_stmt, ':col', $field); |
827 | 826 | |
828 | 827 | if (oci_execute($this->fieldInfo_stmt, OCI_DEFAULT) === false) { |
Index: trunk/phase3/config/Installer.php |
— | — | @@ -106,7 +106,7 @@ |
107 | 107 | 'havedriver' => 0, |
108 | 108 | 'compile' => 'oci8', |
109 | 109 | 'bgcolor' => '#ffeba1', |
110 | | - 'rootuser' => '', |
| 110 | + 'rootuser' => 'sys', |
111 | 111 | 'serverless' => false |
112 | 112 | ); |
113 | 113 | |
— | — | @@ -1027,7 +1027,10 @@ |
1028 | 1028 | echo "ok</li>\n"; |
1029 | 1029 | } elseif ( $conf->DBtype == 'oracle' ) { |
1030 | 1030 | echo "<li>Attempting to connect to database \"" . htmlspecialchars( $wgDBname ) ."\"</li>"; |
| 1031 | + $old_error_level = error_reporting(); |
| 1032 | + error_reporting($old_error_level & ~E_WARNING); //disable E_WARNING for test connect (oci returns login denied as warning) |
1031 | 1033 | $wgDatabase = $dbc->newFromParams('DUMMY', $wgDBuser, $wgDBpassword, $wgDBname, 1); |
| 1034 | + error_reporting($old_error_level); |
1032 | 1035 | if (!$wgDatabase->isOpen()) { |
1033 | 1036 | $ok = true; |
1034 | 1037 | echo "<li>Connect failed.</li>"; |