r72452 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72451‎ | r72452 | r72453 >
Date:18:00, 5 September 2010
Author:ashley
Status:ok
Tags:
Comment:
trim trailing spaces
Modified paths:
  • /trunk/phase3/includes/db/DatabaseMssql.php (modified) (history)
  • /trunk/phase3/includes/db/DatabaseOracle.php (modified) (history)
  • /trunk/phase3/includes/db/DatabasePostgres.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/db/DatabaseOracle.php
@@ -317,7 +317,7 @@
318318 return false;
319319 }
320320 }
321 -
 321+
322322 wfRestoreWarnings();
323323
324324 if ( $explain_count > 0 ) {
@@ -768,7 +768,7 @@
769769 $temporary = $temporary ? 'TRUE' : 'FALSE';
770770 $oldName = trim(strtoupper($oldName), '"');
771771 $oldParts = explode('_', $oldName);
772 -
 772+
773773 $newName = trim(strtoupper($newName), '"');
774774 $newParts = explode('_', $newName);
775775
@@ -783,9 +783,9 @@
784784 unset($oldParts[$i]);
785785 unset($newParts[$i]);
786786 }
787 -
 787+
788788 $tabName = substr($oldName, strlen($oldPrefix));
789 -
 789+
790790 return $this->query( 'BEGIN DUPLICATE_TABLE(\'' . $tabName . '\', \'' . $oldPrefix . '\', \''.$newPrefix.'\', ' . $temporary . '); END;', $fname );
791791 }
792792
Index: trunk/phase3/includes/db/DatabasePostgres.php
@@ -13,7 +13,7 @@
1414 global $wgDBmwschema;
1515
1616 $q = <<<SQL
17 -SELECT
 17+SELECT
1818 attnotnull, attlen, COALESCE(conname, '') AS conname,
1919 COALESCE(condeferred, 'f') AS deferred,
2020 COALESCE(condeferrable, 'f') AS deferrable,
@@ -321,17 +321,17 @@
322322
323323 if ($this->numeric_version < 8.3) {
324324 // Tsearch2 checks
325 - print "<li>Checking that tsearch2 is installed in the database \"" .
 325+ print "<li>Checking that tsearch2 is installed in the database \"" .
326326 htmlspecialchars( $wgDBname ) . "\"...";
327327 if (! $this->tableExists("pg_ts_cfg", $wgDBts2schema)) {
328 - print "<b>FAILED</b>. tsearch2 must be installed in the database \"" .
 328+ print "<b>FAILED</b>. tsearch2 must be installed in the database \"" .
329329 htmlspecialchars( $wgDBname ) . "\".";
330330 print "Please see <a href='http://www.devx.com/opensource/Article/21674/0/page/2'>this article</a>";
331331 print " for instructions or ask on #postgresql on irc.freenode.net</li>\n";
332332 dieout("</ul>");
333333 }
334334 print "OK</li>\n";
335 - print "<li>Ensuring that user \"" . htmlspecialchars( $wgDBuser ) .
 335+ print "<li>Ensuring that user \"" . htmlspecialchars( $wgDBuser ) .
336336 "\" has select rights on the tsearch2 tables...";
337337 foreach (array('cfg','cfgmap','dict','parser') as $table) {
338338 $SQL = "GRANT SELECT ON pg_ts_$table TO $safeuser";
@@ -410,8 +410,8 @@
411411 $SQL = "SELECT count(*) FROM $safetsschema.pg_ts_$tname";
412412 $res = $this->doQuery($SQL);
413413 if (!$res) {
414 - print "<b>FAILED</b> to access " . htmlspecialchars( "pg_ts_$tname" ) .
415 - ". Make sure that the user \"". htmlspecialchars( $wgDBuser ) .
 414+ print "<b>FAILED</b> to access " . htmlspecialchars( "pg_ts_$tname" ) .
 415+ ". Make sure that the user \"". htmlspecialchars( $wgDBuser ) .
416416 "\" has SELECT access to all four tsearch2 tables</li>\n";
417417 dieout("</ul>");
418418 }
@@ -439,7 +439,7 @@
440440 $tsname = pg_fetch_result($res, 0, 0);
441441 if ($tsname != 'default') {
442442 print "<b>not set to default (" . htmlspecialchars( $tsname ) . ")</b>";
443 - print "<li>Attempting to change tsearch2 default locale to \"" .
 443+ print "<li>Attempting to change tsearch2 default locale to \"" .
444444 htmlspecialchars( $ctype ) . "\"...";
445445 $resetlocale = 1;
446446 }
@@ -449,7 +449,7 @@
450450 $res = $this->doQuery($SQL);
451451 if (!$res) {
452452 print "<b>FAILED</b>. ";
453 - print "Please make sure that the locale in pg_ts_cfg for \"default\" is set to \"" .
 453+ print "Please make sure that the locale in pg_ts_cfg for \"default\" is set to \"" .
454454 htmlspecialchars( $ctype ) . "\"</li>\n";
455455 dieout("</ul>");
456456 }
@@ -478,21 +478,21 @@
479479 $result = $this->doQuery("CREATE SCHEMA $safeschema");
480480 error_reporting( E_ALL );
481481 if (!$result) {
482 - print "<b>FAILED</b>. The user \"" . htmlspecialchars( $wgDBuser ) .
 482+ print "<b>FAILED</b>. The user \"" . htmlspecialchars( $wgDBuser ) .
483483 "\" must be able to access the schema. ".
484484 "You can try making them the owner of the database, or try creating the schema with a ".
485 - "different user, and then grant access to the \"" .
 485+ "different user, and then grant access to the \"" .
486486 htmlspecialchars( $wgDBuser ) . "\" user.</li>\n";
487487 dieout("</ul>");
488488 }
489489 print "OK</li>\n";
490490 }
491491 else if ($result != $wgDBuser) {
492 - print "<li>Schema \"" . htmlspecialchars( $wgDBmwschema ) . "\" exists but is not owned by \"" .
 492+ print "<li>Schema \"" . htmlspecialchars( $wgDBmwschema ) . "\" exists but is not owned by \"" .
493493 htmlspecialchars( $wgDBuser ) . "\". Not ideal.</li>\n";
494494 }
495495 else {
496 - print "<li>Schema \"" . htmlspecialchars( $wgDBmwschema ) . "\" exists and is owned by \"" .
 496+ print "<li>Schema \"" . htmlspecialchars( $wgDBmwschema ) . "\" exists and is owned by \"" .
497497 htmlspecialchars( $wgDBuser ) . "\". Excellent.</li>\n";
498498 }
499499
@@ -572,13 +572,13 @@
573573 $result = $this->doQuery("CREATE LANGUAGE plpgsql");
574574 error_reporting($olde);
575575 if (!$result) {
576 - print "<b>FAILED</b>. You need to install the language PL/pgSQL in the database <tt>" .
 576+ print "<b>FAILED</b>. You need to install the language PL/pgSQL in the database <tt>" .
577577 htmlspecialchars( $wgDBname ) . "</tt></li>";
578578 dieout("</ul>");
579579 }
580580 }
581581 else {
582 - print "<b>FAILED</b>. You need to install the language PL/pgSQL in the database <tt>" .
 582+ print "<b>FAILED</b>. You need to install the language PL/pgSQL in the database <tt>" .
583583 htmlspecialchars( $wgDBname ) . "</tt></li>";
584584 dieout("</ul>");
585585 }
@@ -751,7 +751,7 @@
752752
753753 function indexUnique ($table, $index, $fname = 'DatabasePostgres::indexUnique' ) {
754754 $sql = "SELECT indexname FROM pg_indexes WHERE tablename='{$table}'".
755 - " AND indexdef LIKE 'CREATE UNIQUE%(" .
 755+ " AND indexdef LIKE 'CREATE UNIQUE%(" .
756756 $this->strencode( $this->indexName( $index ) ) .
757757 ")'";
758758 $res = $this->query( $sql, $fname );
@@ -971,7 +971,7 @@
972972
973973 return $res;
974974 }
975 -
 975+
976976 function tableName( $name ) {
977977 # Replace reserved words with better ones
978978 switch( $name ) {
@@ -1261,7 +1261,7 @@
12621262 function fieldInfo( $table, $field ) {
12631263 return PostgresField::fromText($this, $table, $field);
12641264 }
1265 -
 1265+
12661266 /**
12671267 * pg_field_type() wrapper
12681268 */
@@ -1292,7 +1292,7 @@
12931293 $res = $this->doQuery($SQL);
12941294 error_reporting( $olde );
12951295 if (!$res) {
1296 - print "<b>FAILED</b>. Make sure that the user \"" . htmlspecialchars( $wgDBuser ) .
 1296+ print "<b>FAILED</b>. Make sure that the user \"" . htmlspecialchars( $wgDBuser ) .
12971297 "\" can write to the schema \"" . htmlspecialchars( $wgDBmwschema ) . "\"</li>\n";
12981298 dieout(""); # Will close the main list <ul> and finish the page.
12991299 }
Index: trunk/phase3/includes/db/DatabaseMssql.php
@@ -80,11 +80,11 @@
8181 $this->mDBname = $dbName;
8282
8383 $connectionInfo = array();
84 -
 84+
8585 if( $dbName ) {
8686 $connectionInfo['Database'] = $dbName;
8787 }
88 -
 88+
8989 // Start NT Auth Hack
9090 // Quick and dirty work around to provide NT Auth designation support.
9191 // Current solution requires installer to know to input 'ntauth' for both username and password
@@ -92,7 +92,7 @@
9393 // TO-DO: Make this better and add NT Auth choice to MW installer when SQL Server option is chosen.
9494 $ntAuthUserTest = strtolower( $user );
9595 $ntAuthPassTest = strtolower( $password );
96 -
 96+
9797 // Decide which auth scenerio to use
9898 if( ( $ntAuthPassTest == 'ntauth' && $ntAuthUserTest == 'ntauth' ) ){
9999 // Don't add credentials to $connectionInfo
@@ -103,7 +103,7 @@
104104 // End NT Auth Hack
105105
106106 $this->mConn = @sqlsrv_connect( $server, $connectionInfo );
107 -
 107+
108108 if ( $this->mConn === false ) {
109109 wfDebug( "DB connection error\n" );
110110 wfDebug( "Server: $server, Database: $dbName, User: $user, Password: " . substr( $password, 0, 3 ) . "...\n" );
@@ -131,7 +131,7 @@
132132 function doQuery( $sql ) {
133133 wfDebug( "SQL: [$sql]\n" );
134134 $this->offset = 0;
135 -
 135+
136136 // several extensions seem to think that all databases support limits via LIMIT N after the WHERE clause
137137 // well, MSSQL uses SELECT TOP N, so to catch any of those extensions we'll do a quick check for a LIMIT
138138 // clause and pass $sql through $this->LimitToTopN() which parses the limit clause and passes the result to
@@ -140,13 +140,13 @@
141141 // massage LIMIT -> TopN
142142 $sql = $this->LimitToTopN( $sql ) ;
143143 }
144 -
145 - // MSSQL doesn't have EXTRACT(epoch FROM XXX)
 144+
 145+ // MSSQL doesn't have EXTRACT(epoch FROM XXX)
146146 if ( preg_match('#\bEXTRACT\s*?\(\s*?EPOCH\s+FROM\b#i', $sql, $matches ) ) {
147147 // This is same as UNIX_TIMESTAMP, we need to calc # of seconds from 1970
148148 $sql = str_replace( $matches[0], "DATEDIFF(s,CONVERT(datetime,'1/1/1970'),", $sql );
149149 }
150 -
 150+
151151 // perform query
152152 $stmt = sqlsrv_query( $this->mConn, $sql );
153153 if ( $stmt == false ) {
@@ -157,16 +157,16 @@
158158 foreach ( sqlsrv_errors() as $error ) {
159159 $message .= $message . "ERROR[" . $error['code'] . "] " . $error['message'] . "\n";
160160 }
161 -
 161+
162162 throw new DBUnexpectedError( $this, $message );
163163 }
164164 // remember number of rows affected
165165 $this->mAffectedRows = sqlsrv_rows_affected( $stmt );
166 -
167 - // if it is a SELECT statement, or an insert with a request to output something we want to return a row.
168 - if ( ( preg_match( '#\bSELECT\s#i', $sql ) ) ||
 166+
 167+ // if it is a SELECT statement, or an insert with a request to output something we want to return a row.
 168+ if ( ( preg_match( '#\bSELECT\s#i', $sql ) ) ||
169169 ( preg_match( '#\bINSERT\s#i', $sql ) && preg_match( '#\bOUTPUT\s+INSERTED\b#i', $sql ) ) ) {
170 - // this is essentially a rowset, but Mediawiki calls these 'result'
 170+ // this is essentially a rowset, but Mediawiki calls these 'result'
171171 // the rowset owns freeing the statement
172172 $res = new MssqlResult( $stmt );
173173 } else {
@@ -190,7 +190,7 @@
191191 $row = $res->fetch( 'OBJECT' );
192192 return $row;
193193 }
194 -
 194+
195195 function getErrors() {
196196 $strRet = '';
197197 $retErrors = sqlsrv_errors( SQLSRV_ERR_ALL );
@@ -220,14 +220,14 @@
221221 }
222222 return ( $res ) ? $res->numrows() : 0;
223223 }
224 -
 224+
225225 function numFields( $res ) {
226226 if ( $res instanceof ResultWrapper ) {
227227 $res = $res->result;
228228 }
229229 return ( $res ) ? $res->numfields() : 0;
230230 }
231 -
 231+
232232 function fieldName( $res, $n ) {
233233 if ( $res instanceof ResultWrapper ) {
234234 $res = $res->result;
@@ -257,7 +257,7 @@
258258 return "No database connection";
259259 }
260260 }
261 -
 261+
262262 function lastErrno() {
263263 $err = sqlsrv_errors( SQLSRV_ERR_ALL );
264264 if ( $err[0] ) return $err[0]['code'];
@@ -267,7 +267,7 @@
268268 function affectedRows() {
269269 return $this->mAffectedRows;
270270 }
271 -
 271+
272272 /**
273273 * SELECT wrapper
274274 *
@@ -292,7 +292,7 @@
293293 }
294294 return $this->query( $sql, $fname );
295295 }
296 -
 296+
297297 /**
298298 * SELECT wrapper
299299 *
@@ -312,7 +312,7 @@
313313 }
314314 return parent::selectSQLText( $table, $vars, $conds, $fname, $options, $join_conds );
315315 }
316 -
 316+
317317 /**
318318 * Estimate rows in dataset
319319 * Returns estimated count, based on SHOWPLAN_ALL output
@@ -323,7 +323,7 @@
324324 function estimateRowCount( $table, $vars = '*', $conds = '', $fname = 'DatabaseMssql::estimateRowCount', $options = array() ) {
325325 $options['EXPLAIN'] = true;// http://msdn2.microsoft.com/en-us/library/aa259203.aspx
326326 $res = $this->select( $table, $vars, $conds, $fname, $options );
327 -
 327+
328328 $rows = -1;
329329 if ( $res ) {
330330 $row = $this->fetchRow( $res );
@@ -381,20 +381,20 @@
382382 if ( !count( $arrToInsert ) ) {
383383 return true;
384384 }
385 -
 385+
386386 if ( !is_array( $options ) ) {
387387 $options = array( $options );
388388 }
389389
390390 $table = $this->tableName( $table );
391 -
 391+
392392 if ( !( isset( $arrToInsert[0] ) && is_array( $arrToInsert[0] ) ) ) {// Not multi row
393393 $arrToInsert = array( 0 => $arrToInsert );// make everything multi row compatible
394394 }
395 -
 395+
396396 $allOk = true;
397 -
398 -
 397+
 398+
399399 // We know the table we're inserting into, get its identity column
400400 $identity = null;
401401 $tableRaw = preg_replace( '#\[([^\]]*)\]#', '$1', $table ); // strip matching square brackets from table name
@@ -404,23 +404,23 @@
405405 $identity = array_pop( $res->fetch( SQLSRV_FETCH_ASSOC ) );
406406 }
407407 unset( $res );
408 -
 408+
409409 foreach ( $arrToInsert as $blah => $a ) {
410410 // start out with empty identity column, this is so we can return it as a result of the insert logic
411411 $sqlPre = '';
412412 $sqlPost = '';
413413 $identityClause = '';
414 -
 414+
415415 // if we have an identity column
416416 if( $identity ) {
417 - // iterate through
 417+ // iterate through
418418 foreach ($a as $k => $v ) {
419419 if ( $k == $identity ) {
420420 if( !is_null($v) ){
421421 // there is a value being passed to us, we need to turn on and off inserted identity
422422 $sqlPre = "SET IDENTITY_INSERT $table ON;" ;
423423 $sqlPost = ";SET IDENTITY_INSERT $table OFF;";
424 -
 424+
425425 } else {
426426 // we can't insert NULL into an identity column, so remove the column from the insert.
427427 unset( $a[$k] );
@@ -429,10 +429,10 @@
430430 }
431431 $identityClause = "OUTPUT INSERTED.$identity "; // we want to output an identity column as result
432432 }
433 -
 433+
434434 $keys = array_keys( $a );
435 -
436 -
 435+
 436+
437437 // INSERT IGNORE is not supported by SQL Server
438438 // remove IGNORE from options list and set ignore flag to true
439439 $ignoreClause = false;
@@ -442,20 +442,20 @@
443443 $ignoreClause = true;
444444 }
445445 }
446 -
 446+
447447 // translate MySQL INSERT IGNORE to something SQL Server can use
448448 // example:
449449 // MySQL: INSERT IGNORE INTO user_groups (ug_user,ug_group) VALUES ('1','sysop')
450 - // MSSQL: IF NOT EXISTS (SELECT * FROM user_groups WHERE ug_user = '1') INSERT INTO user_groups (ug_user,ug_group) VALUES ('1','sysop')
 450+ // MSSQL: IF NOT EXISTS (SELECT * FROM user_groups WHERE ug_user = '1') INSERT INTO user_groups (ug_user,ug_group) VALUES ('1','sysop')
451451 if ( $ignoreClause == true ) {
452452 $prival = $a[$keys[0]];
453453 $sqlPre .= "IF NOT EXISTS (SELECT * FROM $table WHERE $keys[0] = '$prival')";
454454 }
455 -
 455+
456456 // Build the actual query
457457 $sql = $sqlPre . 'INSERT ' . implode( ' ', $options ) .
458458 " INTO $table (" . implode( ',', $keys ) . ") $identityClause VALUES (";
459 -
 459+
460460 $first = true;
461461 foreach ( $a as $key => $value ) {
462462 if ( $first ) {
@@ -478,10 +478,10 @@
479479 }
480480 }
481481 $sql .= ')' . $sqlPost;
482 -
 482+
483483 // Run the query
484484 $ret = sqlsrv_query( $this->mConn, $sql );
485 -
 485+
486486 if ( $ret === false ) {
487487 throw new DBQueryError( $this, $this->getErrors(), $this->lastErrno(), $sql, $fname );
488488 } elseif ( $ret != NULL ) {
@@ -499,7 +499,7 @@
500500 }
501501 return $allOk;
502502 }
503 -
 503+
504504 /**
505505 * INSERT SELECT wrapper
506506 * $varMap must be an associative array of the form array( 'dest1' => 'source1', ...)
@@ -511,7 +511,7 @@
512512 $insertOptions = array(), $selectOptions = array() )
513513 {
514514 $ret = parent::insertSelect( $destTable, $srcTable, $varMap, $conds, $fname, $insertOptions, $selectOptions );
515 -
 515+
516516 if ( $ret === false ) {
517517 throw new DBQueryError( $this, $this->getErrors(), $this->lastErrno(), $sql, $fname );
518518 } elseif ( $ret != NULL ) {
@@ -521,7 +521,7 @@
522522 }
523523 return NULL;
524524 }
525 -
 525+
526526 /**
527527 * Format a table name ready for use in constructing an SQL query
528528 *
@@ -660,7 +660,7 @@
661661 # Returns the size of a text field, or -1 for "unlimited"
662662 function textFieldSize( $table, $field ) {
663663 $table = $this->tableName( $table );
664 - $sql = "SELECT CHARACTER_MAXIMUM_LENGTH,DATA_TYPE FROM INFORMATION_SCHEMA.Columns
 664+ $sql = "SELECT CHARACTER_MAXIMUM_LENGTH,DATA_TYPE FROM INFORMATION_SCHEMA.Columns
665665 WHERE TABLE_NAME = '$table' AND COLUMN_NAME = '$field'";
666666 $res = $this->query( $sql );
667667 $row = $this->fetchRow( $res );
@@ -689,7 +689,7 @@
690690 SELECT sub2.*, ROW_NUMBER() OVER(ORDER BY sub2.line2) AS line3 FROM (
691691 SELECT 1 AS line2, sub1.* FROM (' . $sql . ') AS sub1
692692 ) as sub2
693 - ) AS sub3
 693+ ) AS sub3
694694 WHERE line3 BETWEEN ' . ( $offset + 1 ) . ' AND ' . ( $offset + $limit );
695695 return $sql;
696696 }
@@ -708,14 +708,14 @@
709709 $offset = $matches[3] or
710710 $offset = $matches[6] or
711711 $offset = false;
712 -
 712+
713713 // strip the matching LIMIT clause out
714714 $sql = str_replace( $matches[0], '', $sql );
715715 return $this->limitResult( $sql, $row_count, $offset );
716716 }
717717 return $sql;
718718 }
719 -
 719+
720720 // MSSQL does support this, but documentation is too thin to make a generalized
721721 // function for this. Apparently UPDATE TOP (N) works, but the sort order
722722 // may not be what we're expecting so the top n results may be a random selection.
@@ -723,8 +723,8 @@
724724 function limitResultForUpdate( $sql, $num ) {
725725 return $sql;
726726 }
727 -
728 -
 727+
 728+
729729 function timestamp( $ts = 0 ) {
730730 return wfTimestamp( TS_ISO_8601, $ts );
731731 }
@@ -747,7 +747,7 @@
748748 }
749749
750750 function tableExists ( $table, $schema = false ) {
751 - $res = sqlsrv_query( $this->mConn, "SELECT * FROM information_schema.tables
 751+ $res = sqlsrv_query( $this->mConn, "SELECT * FROM information_schema.tables
752752 WHERE table_type='BASE TABLE' AND table_name = '$table'" );
753753 if ( $res === false ) {
754754 print( "Error in tableExists query: " . $this->getErrors() );
@@ -758,13 +758,13 @@
759759 else
760760 return false;
761761 }
762 -
 762+
763763 /**
764764 * Query whether a given column exists in the mediawiki schema
765765 */
766766 function fieldExists( $table, $field, $fname = 'DatabaseMssql::fieldExists' ) {
767767 $table = $this->tableName( $table );
768 - $res = sqlsrv_query( $this->mConn, "SELECT DATA_TYPE FROM INFORMATION_SCHEMA.Columns
 768+ $res = sqlsrv_query( $this->mConn, "SELECT DATA_TYPE FROM INFORMATION_SCHEMA.Columns
769769 WHERE TABLE_NAME = '$table' AND COLUMN_NAME = '$field'" );
770770 if ( $res === false ) {
771771 print( "Error in fieldExists query: " . $this->getErrors() );
@@ -778,7 +778,7 @@
779779
780780 function fieldInfo( $table, $field ) {
781781 $table = $this->tableName( $table );
782 - $res = sqlsrv_query( $this->mConn, "SELECT * FROM INFORMATION_SCHEMA.Columns
 782+ $res = sqlsrv_query( $this->mConn, "SELECT * FROM INFORMATION_SCHEMA.Columns
783783 WHERE TABLE_NAME = '$table' AND COLUMN_NAME = '$field'" );
784784 if ( $res === false ) {
785785 print( "Error in fieldInfo query: " . $this->getErrors() );
@@ -796,7 +796,7 @@
797797 sqlsrv_begin_transaction( $this->mConn );
798798 $this->mTrxLevel = 1;
799799 }
800 -
 800+
801801 /**
802802 * End a transaction
803803 */
@@ -813,7 +813,7 @@
814814 sqlsrv_rollback( $this->mConn );
815815 $this->mTrxLevel = 0;
816816 }
817 -
 817+
818818 function setup_database() {
819819 global $wgVersion, $wgDBport, $wgDBuser;
820820
@@ -887,58 +887,58 @@
888888 $dbName = $this->escapeIdentifier( $dbName );
889889
890890 // It is not clear what can be used as a login,
891 - // From http://msdn.microsoft.com/en-us/library/ms173463.aspx
 891+ // From http://msdn.microsoft.com/en-us/library/ms173463.aspx
892892 // a sysname may be the same as an identifier.
893893 $newUser = $this->escapeIdentifier( $newUser );
894894 $loginPassword = $this->addQuotes( $loginPassword );
895 -
 895+
896896 $this->doQuery("CREATE DATABASE $dbName;");
897897 $this->doQuery("USE $dbName;");
898898 $this->doQuery("CREATE SCHEMA $dbName;");
899899 $this->doQuery("
900 - CREATE
901 - LOGIN $newUser
902 - WITH
 900+ CREATE
 901+ LOGIN $newUser
 902+ WITH
903903 PASSWORD=$loginPassword
904904 ;
905905 ");
906906 $this->doQuery("
907 - CREATE
908 - USER $newUser
909 - FOR
910 - LOGIN $newUser
911 - WITH
 907+ CREATE
 908+ USER $newUser
 909+ FOR
 910+ LOGIN $newUser
 911+ WITH
912912 DEFAULT_SCHEMA=$dbName
913913 ;
914914 ");
915915 $this->doQuery("
916 - GRANT
917 - BACKUP DATABASE,
918 - BACKUP LOG,
919 - CREATE DEFAULT,
920 - CREATE FUNCTION,
921 - CREATE PROCEDURE,
922 - CREATE RULE,
 916+ GRANT
 917+ BACKUP DATABASE,
 918+ BACKUP LOG,
 919+ CREATE DEFAULT,
 920+ CREATE FUNCTION,
 921+ CREATE PROCEDURE,
 922+ CREATE RULE,
923923 CREATE TABLE,
924 - CREATE VIEW,
925 - CREATE FULLTEXT CATALOG
926 - ON
927 - DATABASE::$dbName
 924+ CREATE VIEW,
 925+ CREATE FULLTEXT CATALOG
 926+ ON
 927+ DATABASE::$dbName
928928 TO $newUser
929929 ;
930930 ");
931931 $this->doQuery("
932 - GRANT
 932+ GRANT
933933 CONTROL
934 - ON
935 - SCHEMA::$dbName
 934+ ON
 935+ SCHEMA::$dbName
936936 TO $newUser
937937 ;
938938 ");
939 -
940 -
 939+
 940+
941941 }
942 -
 942+
943943 function encodeBlob( $b ) {
944944 // we can't have zero's and such, this is a simple encoding to make sure we don't barf
945945 return base64_encode( $b );
@@ -1029,7 +1029,7 @@
10301030 if ( isset( $options['ORDER BY'] ) ) $tailOpts .= " ORDER BY {$options['ORDER BY']}";
10311031
10321032 if ( isset( $noKeyOptions['DISTINCT'] ) && isset( $noKeyOptions['DISTINCTROW'] ) ) $startOpts .= 'DISTINCT';
1033 -
 1033+
10341034 // we want this to be compatible with the output of parent::makeSelectOptions()
10351035 return array( $startOpts, '' , $tailOpts, '' );
10361036 }
@@ -1044,7 +1044,7 @@
10451045 function buildConcat( $stringList ) {
10461046 return implode( ' + ', $stringList );
10471047 }
1048 -
 1048+
10491049 public function getSearchEngine() {
10501050 return "SearchMssql";
10511051 }
@@ -1092,7 +1092,7 @@
10931093 }
10941094
10951095 /**
1096 - * The MSSQL PHP driver doesn't support sqlsrv_num_rows, so we recall all rows into an array and maintain our
 1096+ * The MSSQL PHP driver doesn't support sqlsrv_num_rows, so we recall all rows into an array and maintain our
10971097 * own cursor index into that array...This is similar to the way the Oracle driver handles this same issue
10981098 *
10991099 * @ingroup Database
@@ -1131,7 +1131,7 @@
11321132 }
11331133 return $obj;
11341134 }
1135 -
 1135+
11361136 public function fetch( $mode = SQLSRV_FETCH_BOTH, $object_class = 'stdClass' ) {
11371137 if ( $this->mCursor >= $this->mRowCount || $this->mRowCount == 0 ) return false;
11381138 $ret = false;
@@ -1157,7 +1157,7 @@
11581158 $ret = $this->mRows[$this->mCursor] + $arrNum;
11591159 break;
11601160 }
1161 -
 1161+
11621162 $this->mCursor++;
11631163 return $ret;
11641164 }

Status & tagging log