The 1.15 release of MediaWiki introduced some hardcoded bitwise
operators to the core SQL. They were added to operate on the
log_deleted column in the logging table by, I think, aaron. This is
because the log_deleted column now has multiple states.

Unfortunately, bitwise operators have different syntax in different databases.

MySQL, PostgreSQL:
log_deleted & 1

DB2, Oracle:
BITAND(log_deleted, 1)


I think there are three options to make it compatible:

1. Refactor the database to not use an integer as a bit field. Just
use four different boolean columns, which works well cross-database.

2. Add a function to the Database API for each bit operator.

$sql = $database->bitand('log_deleted', 1);

3. Add a function to the Database API to handle all the operators.

$sql = $database->op('&', 'log_deleted', 1);
or
$sql = $database->op(Database::BITAND, 'log_deleted', 1);


My preference is for option 1 or 3. Thoughts?

Regards,

Leons Petrazickis
http://lpetr.org/blog/

_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to