Commit graph

101 commits

Author SHA1 Message Date
Tyler Anthony Romeo
b69cc58b7f (bug 39287) Fixed error checking in DatabaseMysql::fetchObject.
According to the libmysql API documentation, mysql_fetch_row,
upon which the PHP functions mysql_fetch_object, etc. are
based on, does not reset the error number or message upon
success. So calling mysql_errno() after a successful fetch
may return the error of the previous function call.

This commit changes DatabaseMysql::fetchObject and similar
functions to only check for specific error numbers that are
explicitly documented to be expected from mysql_fetch_*.

Change-Id: Iacb78828885a8a0d4e499a681d938a6adf651582
2012-09-04 11:41:58 -07:00
Alexandre Emsenhuber
72a72e26dc Fixes for DatabaseMysql::open()
- Group global declarations at the top
- Early abort on error, instead of going through
  the whole code
- Group double call to wfDebug()
- Whitespaces fixes

Change-Id: I9e28395a2698216e14458d1a74ef0a89e7ee48d6
2012-09-01 17:13:35 +02:00
Tyler Anthony Romeo
494b8b51b1 (bug 32774) Added config options and flags for SSL and compression in DB.
Added configuration options ($wgDBssl, $wgDBcompress) and related
connection flags (DBO_SSL, DBO_COMPRESS) to allow SSL/TLS and
compression on database connections. The flags are only observed if
the functionality is supported for that type of database (e.g.,
SQLite will ignore both flags as neither are supported).

Currently, only MySQL and PgSQL have support for at least one of
these flags in their PHP extensions. MySQL supports both flags and
PgSQL supports the SSL flag only.

Change-Id: I7b4d3ba82ccab0eed4a19e3b4e7bc0b4eb881262
Signed-off-by: Tyler Anthony Romeo <tylerromeo@gmail.com>
2012-08-16 10:48:07 -04:00
Aaron Schulz
eb16f5898d [Database] Various DB cleanups.
* Removed unused and obsolete set() and safeQuery() functions.
* Removed unused deprecated constructor functions.
* Removed unused limitResultForUpdate() cruft function.
* Removed unused standardSelectDistinct(), it's better to just follow the standard for all queries.
* Removed other cruft functions unused by core/extensions.
* Made some internal functions protected.

Change-Id: I90be88ea740834a417a17d7751f1be7bac4eae4e
2012-08-08 11:00:48 -07:00
Christian Aistleitner
af919fe3e0 Fix error message for MySQL connection failures
Change-Id: I23cbe6a58ab5aed88c656bfa9370568b39ca4e32
2012-05-28 22:06:43 +02:00
Aaron
ff187ea7cc [SiteStatsUpdate] Reduced contention by using a new lockIsFree() DB function.
* Note: follows up a4b3979160
* Cleanup up transaction statements a bit; transactions don't effect the lock calls
* Also made DatabaseMysql::unlock() actually return a bool

Change-Id: Iade2efa94165b6918eae0863716cc163f36a07b8
2012-05-10 15:48:58 -07:00
Catrope
c9047274d5 Revert "Commit of various live hacks"
Was meant for 1.20wmf2

This reverts commit 062773733d
2012-04-30 20:57:56 +00:00
Reedy
062773733d Commit of various live hacks
Disable of MessageBlobStore clear

Reset $wgAutopromote (should be moved to a config change!!)

Disable setting of wgStyleSheetPath

Disable squid updates in HTMLCacaheUpdate invalidateTitles

Throttle page_touched

Add apc htcp packet numbers to SquidUpdate

Disable set names binary/utf8

Commment out searchindex table indexes

Was c532e81d583d3d0439fe76eea4d105d675461b56

Change-Id: I42c4f859e55eb198f6c6841e582b3552aad7b31f
2012-04-30 20:10:13 +01:00
Alexandre Emsenhuber
78a56a67ba Added missing GPLv2 headers in includes/db.
Change-Id: Ib8fe301c6db77603e411113cea5a39c25c664961
2012-04-26 10:47:10 +02:00
Max Semenik
a8f718267e Follow-up r112565: fix code duplication 2012-02-28 14:42:08 +00:00
Chad Horohoe
2177a4d8b4 (bug 34762) Calling close() on a DatabaseBase object now clears the connection. Based on patch by Christian.
By the way, the duplication here is stupid.
2012-02-28 02:18:18 +00:00
Alexandre Emsenhuber
d97561461c Pass __METHOD__ to DatabaseBase::begin(), DatabaseBase::commit() and DatabaseBase::rollback() 2012-02-25 13:23:43 +00:00
Sam Reed
c052fc3b7b Documentation followups from lastnight 2012-02-10 15:37:33 +00:00
Sam Reed
7b25f8231f Fixing some of the "@return true" or "@return false", need to be "@return bool" and then the metadata can say true if foo, false if bar
Other documentation improvements
2012-02-09 19:30:01 +00:00
Sam Reed
e1d83d5721 Fixing some of the "@return true" or "@return false", need to be "@return bool" and then the metadata can say true if foo, false if bar
Other documentation improvements
2012-02-09 18:01:54 +00:00
Sam Reed
138ddc452f Fixing some of the "@return true" or "@return false", need to be "@return bool" and then the metadata can say true if foo, false if bar
Other documentation improvements
2012-02-09 17:42:35 +00:00
Sam Reed
ebf916f3fb Give sql.php eval.php type scrollback 2012-01-12 22:57:51 +00:00
Max Semenik
6d87a6ea8f Revert r108603, which was itself a revert of r107376, r107994. Before considering something unneeded, please ask first ;) 2012-01-11 20:19:55 +00:00
Antoine Musso
f5f1b6d0bb Reverts MySQL stored procedure support
This is reverting the work done by MaxSem to support stored procedures
and stored function in MySQL. The reasons are:
 - it is not needed yet
 - tests are not functionals
 - alter the stable include/db/Database.php and drop support for ';;'

So please create a branch to work on it and merge it back in trunk
once we have branched 1.19 :-)

I have opened bug 33654 to track this enhancement request.

Reverts r107376, r107994.
2012-01-11 09:46:21 +00:00
Max Semenik
6b7317c91f Added support for stored procedures/functions to MySQL:
* Refactored DatabaseBase::sourceStream(), made it possible for descendant classes to alter its behaviour w/o having to redo it completely like Oracle does.
* MySQL class now supports specifying DELIMITER.
* Thrown away the mess of catering for double semicolon. If it's a problem, fix your .sql files!
* Haven't actually touched Oracle.
* Tests!
2011-12-27 12:29:36 +00:00
Jeroen De Dauw
49cdca93be add missing deprecation notices and added deprecation version to existing ones 2011-12-13 05:19:05 +00:00
Sam Reed
5bfce03820 More documentation of parameters following up r104591 2011-12-05 16:50:58 +00:00
Sam Reed
b3e65d734f Per Timo, the second line would wipe out the first 2011-12-02 21:50:42 +00:00
Sam Reed
39356de1a4 Moar documentations 2011-11-29 21:04:20 +00:00
Sam Reed
cce8c92045 Improve comment from r104047
Also bump MySQL min requirements to 5.0.2 to save an extra conditional

>= 5.0.2 has been around ages..
2011-11-25 00:16:34 +00:00
Aaron Schulz
bd07cf97f5 Added Database::getServerUptime() function to return seconds of uptime 2011-11-24 19:55:38 +00:00
Aaron Schulz
608963577b Added wasLockTimeout() DB function. All our DBMS can implement this accept for PG. 2011-11-23 23:45:46 +00:00
Aaron Schulz
dfc1675f31 Reverted 'lockTimeout' option from r104069: table_lock_wait_timeout is GLOBAL and the other one requires an innoDB plugin...so that was useless. 2011-11-23 21:03:57 +00:00
Aaron Schulz
12f430217f Factored setTimeout() into setSessionOptions() and deprecated the former. In the future we can batch the queries perhaps. Also added a lock wait timeout option. 2011-11-23 19:25:59 +00:00
Sam Reed
c0cbf2e16e Kill mysql4 specific code from DatabaseMysql
Set minimum version of mysql in MysqlInstaller
2011-11-23 16:27:48 +00:00
Sam Reed
9814e6b075 Add $fname to tableExists
Pass $fname/__METHOD__ in in upstream callers
2011-11-10 20:39:23 +00:00
Mark A. Hershberger
f9ff37c153 fix bug #29102: Upgrade fails "Unknown character set: 'mysql4'"
by replacing "mysql4" with "binary"

Trivial enough to be backported, I think.
2011-11-09 03:25:15 +00:00
Sam Reed
627ceb7d09 Bug 30120 - Interwiki links error after upgrade
Per Emufarmers, in wgDBTableOptions replace TYPE with ENGINE

Should at least stop the errors. Do need to do something in the updaters (can we have some "delayed messages" or something?

Needed more for the CLI updater/update.php, as putting it in the middle of the updaters is just pointless, as it won't be seen. Needs to be at the end...

Doing it in the webupdater is saner/easier, as it'll be displayed

Certainly, this does suffice for the moment

Fine on MySQL 4, as it accepts {TYPE|ENGINE}
2011-11-01 06:17:40 +00:00
Sam Reed
12be913477 Revert r97257 2011-09-17 11:49:10 +00:00
Sam Reed
4d8c6dee24 Moar documentations 2011-09-16 17:58:50 +00:00
Sam Reed
5f3bdc72cf * (bug 30927) Omission of MySQLField::maxLength 2011-09-16 12:25:45 +00:00
Tim Starling
a3bf5ecb4a * Fix for r90643: in the case where there is only one server, implying no replication, make LoadBalancer::getLagTimes(), LoadMonitor_MySQL::getLagTimes() and LoadBalancer::getMaxLag() quickly report zero lag without attempting to do a SHOW SLAVE STATUS query.
* Updated the documentation to make it clear that REPLICATION CLIENT is required in a replicated setup. 
* Reverted r90773.
2011-08-29 04:42:26 +00:00
Sam Reed
dd2c01af83 Add/update documentation 2011-08-14 19:49:07 +00:00
Mark A. Hershberger
97969f7d99 w/s changes: “svn diff -x-w” is clean 2011-08-01 16:01:13 +00:00
Alexandre Emsenhuber
19c5d5e595 * Removed usage of error suppression operator in includes/db
* Changed an usage of $_REQUEST to $wgRequest
2011-07-04 15:00:30 +00:00
Sam Reed
ef34cb7192 Hack followup to r90643
Comment out the call SHOW SLAVE STATUS for getting replag, leaving the use processlist

Not sure when Tim/someone else will look at it, so easier to just hack the bad code for the moment, so people can develop/test etc
2011-06-25 16:30:32 +00:00
Tim Starling
0e73205470 General database-related code cleanup:
* Merged the 4 simulated implementations of Database*::replace(). I took diffs, they were nearly identical. I made one based on the IBM DB2 version, since it used insert() which looked like a nice touch.
* Provided the non-simulated implementation of Database*::replace() via a protected member function, and made DatabaseMysql::replace() and DatabaseSqlite::replace() into a wrapper for it. 
* Moved the MySQL-specific functionality from masterPosWait(), getSlavePos() and getMasterPos() from DatabaseBase to DatabaseMysql. 
* Renamed getStatus() to getMysqlStatus() and moved it to DatabaseMysql. Removed "unimplemented" errors from two other subclasses. Really there's no way another DBMS could or should implement this function. 
* Split the LoadMonitor class into a no-op class and a MySQL-specific class, to avoid fatal errors due to the getMysqlStatus() call if other DBMSs tried to use LoadBalancer with multiple servers. Of course there are lots of other reasons it won't work, I'm just fixing the architecture issue here.

And while I have a replicated test setup handy:
* On MySQL 4.1.9 and later, use SHOW SLAVE STATUS to get the lag instead of SHOW PROCESSLIST. This has the advantage of reading zero when there are no events for a while.
2011-06-23 03:14:11 +00:00
Tim Starling
5fcd668a02 Followup r90429:
* Reverted the public -> protected changes from r90429, except for doQuery() after a review of usage:
** resultObject() is used by lots of things in core and extensions. 
** makeSelectOptions() is used by SMW, and if that's going to be public, the other two probably should be too, for consistency. 
** doQuery() was used by several things, but mostly by mistake. It's been marked private since r21359 which is before almost all of them. I updated the callers to use query().

* Added "protected" to doQuery() declarations in other database classes.
2011-06-20 12:09:22 +00:00
Platonides
8093e9733c All the databases but MySQL were overriding DatabaseBase::deleteJoin() with the same code.
Move DatabaseBase::deleteJoin() to DatabaseMysql::deleteJoin() and the common code to DatabaseBase::deleteJoin()
Follow up r90356
2011-06-18 20:26:31 +00:00
Platonides
7eb228b5cb If this was ever passed an empty string it would spit "PHP Notice: Uninitialized string offset: 0..." 2011-06-09 19:57:10 +00:00
Chad Horohoe
0735dd2083 whitespace 2011-05-30 01:57:53 +00:00
Platonides
f524482f2d Change the duplicateTableStructure() to use the original names.
It is now duplicateTableStructure() duty to addIdentifierQuotes() them.
Fixed bug for mysql < 4.1 where the new name would be quoted twice.

Always quote identifier in Oracle, doing otherwise seems a bug (can someone confirm?)
2011-04-12 18:54:51 +00:00
Platonides
a91d6f4cac Abstract tableName() by adding new function isQuotedIdentifier() to databases.
This fixes bug in DatabaseOracle.php tableName() on line 671 and allows it to call 
the parent implementation instead of copying it with different quotes.
Adapt Mssql addIdentifierQuotes(). Replace its addIdentifierQuotes calls with addQuotes
as it's what it really is. The serialize() is probably unneeded, since I don't think it will
ever be called with objects but I kept it anyway.
2011-04-12 16:34:12 +00:00
Sam Reed
c52ff356d2 Remove remaining empty() call in r79119 2011-03-27 01:22:44 +00:00
Sam Reed
d2e409eed1 Mark a fixme comment in Oracle DB file for undefined variable
Add documentation
2011-02-18 22:58:02 +00:00