Uploaded image for project: 'Plugins'
  1. Plugins
  2. CONTRIB-4955

Theme Elegance - Default exception handler: Error reading from database Debug: Incorrect syntax near 'LIMIT'.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 2.6.2
    • Theme: Elegance
    • None
    • MOODLE_26_STABLE

      The Elegance theme throws an error on our Moodle instances.

      Our Setup:
      Moodle 2.6.2
      Windows Server 2008 R2
      IIS 7.5
      SQL Server 2008
      PHP 5.3.3
      Free TDS

      [26-Mar-2014 10:13:00] Default exception handler: Error reading from database Debug: Incorrect syntax near 'LIMIT'.
      SELECT id, smallmessage, useridfrom, useridto, timecreated, fullmessageformat, notification
      FROM mdl_message_read
      WHERE useridto = ?
      ORDER BY timecreated DESC
      LIMIT 5
      [array (
      0 => '2',
      )]
      Error code: dmlreadexception

      • line 443 of \lib\dml\moodle_database.php: dml_read_exception thrown
      • line 242 of \lib\dml\mssql_native_moodle_database.php: call to moodle_database->query_end()
      • line 716 of \lib\dml\mssql_native_moodle_database.php: call to mssql_native_moodle_database->query_end()
      • line 750 of \lib\dml\mssql_native_moodle_database.php: call to mssql_native_moodle_database->get_recordset_sql()
      • line 340 of \theme\elegance\renderers\core_renderer.php: call to mssql_native_moodle_database->get_records_sql()
      • line 170 of \theme\elegance\renderers\core_renderer.php: call to theme_elegance_core_renderer->get_user_messages()
      • line 150 of \theme\elegance\renderers\core_renderer.php: call to theme_elegance_core_renderer->render_user_menu()
      • line 82 of \theme\elegance\layout\default.php: call to theme_elegance_core_renderer->user_menu()
      • line 870 of \lib\outputrenderers.php: call to include()
      • line 800 of \lib\outputrenderers.php: call to core_renderer->render_page_layout()
      • line 68 of \theme\index.php: call to core_renderer->header()

      It looks like there is a problem with the use of LIMIT in a query for this theme (which is not supported in SQL SERVER).

      /elegance/renders/core_render.php line 326

      protected function get_user_messages() {
      global $USER, $DB;
      $messagelist = array();
      $maxmessages = 5;

      $readmessagesql = "SELECT id, smallmessage, useridfrom, useridto, timecreated, fullmessageformat, notification
      FROM

      {message_read}

      WHERE useridto = :userid
      ORDER BY timecreated DESC
      LIMIT $maxmessages";
      $newmessagesql = "SELECT id, smallmessage, useridfrom, useridto, timecreated, fullmessageformat, notification
      FROM

      {message}

      WHERE useridto = :userid";

      Alternative SQL syntax approaches can be found here

      http://stackoverflow.com/questions/603724/how-to-implement-limit-with-microsoft-sql-server

      I have tested with version
      2014031100 and then upgraded to 2014032102 but the issue still persists.

            trogdor Julian Ridden
            mm447 Michael Mulvihill
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.