Moodle
  1. Moodle
  2. MDL-18638

Search code does not follow coding guidelines

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Won't Fix
    • Affects Version/s: 1.9.4
    • Fix Version/s: None
    • Component/s: Global search
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE
    • Rank:
      5135

      Description

      Please see item 11. at http://docs.moodle.org/en/Development:Coding#Database_structures

      Do not use 'AS' for table aliases in SQL. That is

      SELECT x + y AS name ... is correct.

      SELECT * FROM

      {table} AS alias ... is WRONG. it should be SELECT * FROM {table}

      alias ...

      if you don't get this right, then it breaks on at least one of our supported databases. You have this wrong throughout the serach code.

      Also, in HEAD, you are using the old get_record_sql, get_field, ... functions, which do not work any more.

        Activity

        Hide
        Valery Fremaux added a comment -

        I've done actually some review, but still missing some tricks... I check again. Thanks Tim.

        Show
        Valery Fremaux added a comment - I've done actually some review, but still missing some tricks... I check again. Thanks Tim.
        Hide
        Valery Fremaux added a comment -

        Actually addressed some of them... (AS)

        I didn't found any orphan get_field functions but $DB->get_field() in my code base. I will check CVS sync !!

        may you point me out a location with a sample of misusing new libraries so I can check it better.

        Cheers.

        Show
        Valery Fremaux added a comment - Actually addressed some of them... (AS) I didn't found any orphan get_field functions but $DB->get_field() in my code base. I will check CVS sync !! may you point me out a location with a sample of misusing new libraries so I can check it better. Cheers.
        Hide
        Tim Hunt added a comment -

        I was searching for user of {$CFG->prefix}tablename instead of

        {tablename}

        in SQL, and saw several get_records_sql that should be $DB->get_records_sql. Sorry, I don't have specific examples.

        Show
        Tim Hunt added a comment - I was searching for user of {$CFG->prefix}tablename instead of {tablename} in SQL, and saw several get_records_sql that should be $DB->get_records_sql. Sorry, I don't have specific examples.
        Hide
        Michael de Raadt added a comment -

        Thanks for reporting this issue.

        We have detected that this issue has been inactive for over a year has been recorded as affecting versions that are no longer supported.

        If you believe that this issue is still relevant to current versions (2.1 and beyond), please comment on the issue. Issues left inactive for a further month will be closed.

        Michael d;

        lqjjLKA0p6

        Show
        Michael de Raadt added a comment - Thanks for reporting this issue. We have detected that this issue has been inactive for over a year has been recorded as affecting versions that are no longer supported. If you believe that this issue is still relevant to current versions (2.1 and beyond), please comment on the issue. Issues left inactive for a further month will be closed. Michael d; lqjjLKA0p6
        Hide
        Michael de Raadt added a comment -

        I'm closing this issue as it appears to have become inactive and is probably not relevant to a current supported version. If you are encountering this problem or one similar, please launch a new issue.

        Show
        Michael de Raadt added a comment - I'm closing this issue as it appears to have become inactive and is probably not relevant to a current supported version. If you are encountering this problem or one similar, please launch a new issue.

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: