Moodle

sql_ilike() refactoring

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

sql_ilike() is the only remaining function that returns one string (the ilike operator) instead of one SQL fragment. We have already changed some old helper sql functions to return SQL fragments and I think it would be great to do the same with this function. In fact we are going to need it because to implement support for ilike() in Oracle, I need to call some Oracle functions, so I propose to do:

function sql_ilike($fieldname)

where fieldname can be one fieldname or one placeholder, np with that.

Requires:

  • implement the new function.
  • change all old uses
  • modify tests

Thoughts?

Issue Links

Activity

Hide
Petr Škoda (skodak) added a comment -

+1 for the change

Show
Petr Škoda (skodak) added a comment - +1 for the change
Hide
Eloy Lafuente (stronk7) added a comment -

Linking to MDL-15512 where various solutions are commented:

1) need two params in the function to build the whole expression
2) can do it via regexp/upper/plsql function in Oracle
3) keep it BC so when called without params will debug warn but work in the old way.

While I agree 100% about 1 & 2... I'm not sure if 3 is the way, after all we are already breaking a lot of older stuff so I don't know if keep BC at this level has sense.

Ciao

Show
Eloy Lafuente (stronk7) added a comment - Linking to MDL-15512 where various solutions are commented: 1) need two params in the function to build the whole expression 2) can do it via regexp/upper/plsql function in Oracle 3) keep it BC so when called without params will debug warn but work in the old way. While I agree 100% about 1 & 2... I'm not sure if 3 is the way, after all we are already breaking a lot of older stuff so I don't know if keep BC at this level has sense. Ciao
Hide
Amanda Doughty added a comment -

Draft replacement for sql_ilike()

Show
Amanda Doughty added a comment - Draft replacement for sql_ilike()
Hide
Amanda Doughty added a comment -

This is a major issue for our Moodle-Oracle set up. I would really appreciate your feedback Eloy.

Show
Amanda Doughty added a comment - This is a major issue for our Moodle-Oracle set up. I would really appreciate your feedback Eloy.
Hide
Petr Škoda (skodak) added a comment -

Should be fixed now - use the new sql_like(),
thank you for the report.

Petr Skoda

Show
Petr Škoda (skodak) added a comment - Should be fixed now - use the new sql_like(), thank you for the report. Petr Skoda

People

Dates

  • Created:
    Updated:
    Resolved: