Commit 30d1409c by Son Nguyen Committed by Gerrit Code Review

Merge "Getting mysql not to use CAST() (bug #1081947)" into 1.6_STABLE

parents 4770d203 e35d3ea8
......@@ -843,8 +843,8 @@ class ActivityTypeWatchlist extends ActivityType {
// mysql compatibility (sigh...)
$casturl = 'CAST(? AS TEXT)';
if (get_config('dbtype') == 'mysql') {
$casturl = 'CAST(? AS CHAR)'; // note, NOT varchar
if (is_mysql()) {
$casturl = '?';
}
$sql = 'SELECT u.*, p.method, ap.value AS lang, ' . $casturl . ' AS url
FROM {usr_watchlist_view} wv
......
......@@ -2592,8 +2592,12 @@ class View {
$expr = 'a.owner IS NOT NULL AND a.owner = ?';
array_unshift($selectph, $user->get('id'));
}
$type = is_mysql() ? 'UNSIGNED' : 'INTEGER';
$cols .= ", CAST($expr AS $type) AS editable";
if (is_mysql()) {
$cols .= ", ($expr) AS editable";
}
else {
$cols .= ", CAST($expr AS INTEGER) AS editable";
}
}
$artefacts = get_records_sql_assoc(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment