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

mixedtypesqlparam exception when filtering chain grades using letters



    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 2.8.8
    • None
    • Module: Taskchain
    • None
    • 2015100194


      While attempting to reduce the list of students in a chain grades table, using the letters of one of the First Name or Surname filters, a dml_exception exception is thrown with the mixedtypesqlparam value.
      Please see below the error message:

      ERROR: Mixed types of sql query parameters!!
      More information about this error
      Debug info:
      Error code: mixedtypesqlparam
      Stack trace:
          line 827 of /lib/dml/moodle_database.php: dml_exception thrown
          line 1075 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->fix_sql_params()
          line 1476 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->get_records_sql()
          line 1549 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
          line 1759 of /lib/dml/moodle_database.php: call to moodle_database->get_field_sql()
          line 1456 of /lib/tablelib.php: call to moodle_database->count_records_sql()
          line 261 of /home/moodle/repositories/published/mod/taskchain-master/report/renderer.php: call to table_sql->query_db()
          line 115 of /home/moodle/repositories/published/mod/taskchain-master/report/renderer.php: call to mod_taskchain_report_renderer->reportcontent()
          line 91 of /home/moodle/repositories/published/mod/taskchain-master/report.php: call to mod_taskchain_report_renderer->render_report()

      This issue seems to come from an incompatibility between the use of question mark placeholders in the mod_taskchain_report_chaingrades_renderer::select_sql_record() method and named placeholders provided by moodle's tablelib flexible_table::get_sql_where().
      The latters are merged into the chain grade generated sql query.
      The rendering process is stopped in moodle_database::fix_sql_params() which does not allow the use of two different placeholder types.

      No problem noticed when using the numbering pagination.

      Step to reproduce in a course containing students and a working taskchain instance:
      1. in the Navigation Block, under the taskchain link, click on Class reports > Chain grades
      2. click on a letter of either the First Name or the Surname filter.

      What you currently get is the exception message above, while we expect to see the report table filtered.




            xxxxxxx Gordon Bateson
            evillard Eric Villard
            0 Vote for this issue
            3 Start watching this issue