Moodle

Make sql_substr() to accept parameters instead of simply returning function name

Details

  • Type: Sub-task Sub-task
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 2.0
  • Fix Version/s: 2.0
  • Component/s: Database SQL/XMLDB
  • Labels:
    None
  • Affected Branches:
    MOODLE_20_STABLE
  • Fixed Branches:
    MOODLE_20_STABLE

Description

Until Moodle 2.0, the sql_substr() helper function (dmllib), is used without parameters at simply returns the "substring" function used for each DB.

Change this behaviour so it will look like:

$DB->sql_substr(string, from, len)

with len being optional.

  • Implement it in new moodle_databases.
  • Document it.
  • Look for wrong usages in core.
  • Add some tests, with and without len.

Ciao

Activity

Hide
Petr Škoda (skodak) added a comment -

done including unittests

Show
Petr Škoda (skodak) added a comment - done including unittests
Hide
Petr Škoda (skodak) added a comment -

grrr, sorry for the typo - I was testing the LENGTH() trick in pg

Show
Petr Škoda (skodak) added a comment - grrr, sorry for the typo - I was testing the LENGTH() trick in pg
Hide
Eloy Lafuente (stronk7) added a comment - - edited

bah, sorry my my usual typos too.

*by my: grrr... :-D

Show
Eloy Lafuente (stronk7) added a comment - - edited bah, sorry my my usual typos too. *by my: grrr... :-D

People

Dates

  • Created:
    Updated:
    Resolved: