Skip to content

Commit

Permalink
MDL-35155: Fix MSSQL bug in sql_substr()
Browse files Browse the repository at this point in the history
  • Loading branch information
simoncoggins authored and danpoltawski committed Dec 31, 2014
1 parent eb1dc9f commit e53364b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/dml/mssql_native_moodle_database.php
Original file line number Diff line number Diff line change
Expand Up @@ -1257,7 +1257,7 @@ public function sql_substr($expr, $start, $length=false) {
s only returning name of SQL substring function, it now requires all parameters.');
}
if ($length === false) {
return "SUBSTRING($expr, $start, (LEN($expr) - $start + 1))";
return "SUBSTRING($expr, $start, LEN($expr))";
} else {
return "SUBSTRING($expr, $start, $length)";
}
Expand Down
2 changes: 1 addition & 1 deletion lib/dml/sqlsrv_native_moodle_database.php
Original file line number Diff line number Diff line change
Expand Up @@ -1324,7 +1324,7 @@ public function sql_substr($expr, $start, $length = false) {
}

if ($length === false) {
return "SUBSTRING($expr, $start, (LEN($expr) - $start + 1))";
return "SUBSTRING($expr, $start, LEN($expr))";
} else {
return "SUBSTRING($expr, $start, $length)";
}
Expand Down

0 comments on commit e53364b

Please sign in to comment.