Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-29199

Database query logging fails with Oracle

    Details

      Description

      With the 'logall' option enabled in $CFG->dboptions, during the call to oci_native_moodle_database::connect() at page startup, a call to $this->temptables->is_temptable() is made inside oci_native_moodle_database::fix_table_names() before $this->temptables is initialised. Execution fails with this stack trace (edited for brevity):

      Fatal error: Call to a member function is_temptable() on a non-object in /www/moodle2/lib/dml/oci_native_moodle_database.php on line 306
       
      Call Stack:
           1. {main}() /www/moodle2/index.php:0
           2. require_once('/www/moodle2/config.php') /www/moodle2/index.php:31
           3. require_once('/www/moodle2/lib/setup.php') /www/moodle2/config.php:56
           4. setup_DB() /www/moodle2/lib/setup.php:442
           5. oci_native_moodle_database->connect(..., ..., ..., ..., 'z_', array ('dbpersist' => 0, 'dbport' => 1521, 'logall' => TRUE)) /www/moodle2/lib/dmllib.php:279
           6. oci_native_moodle_database->query_end(TRUE, resource(41) of type (oci8 statement)) /www/moodle2/lib/dml/oci_native_moodle_database.php:207
           7. moodle_database->query_end(TRUE) /www/moodle2/lib/dml/oci_native_moodle_database.php:268
           8. moodle_database->query_log(???) /www/moodle2/lib/dml/moodle_database.php:375
           9. oci_native_moodle_database->insert_record('log_queries', ..., ???, ???) /www/moodle2/lib/dml/moodle_database.php:438
          10. oci_native_moodle_database->get_columns('log_queries', ???) /www/moodle2/lib/dml/oci_native_moodle_database.php:1205
          11. moodle_database->fix_sql_params(..., NULL) /www/moodle2/lib/dml/oci_native_moodle_database.php:473
          12. oci_native_moodle_database->fix_table_names(...) /www/moodle2/lib/dml/moodle_database.php:675

      A simple solution is to modify this line in oci_native_moodle_database::fix_table_names():

      if ($this->temptables->is_temptable($name)) {

      to be:

      if ($this->temptables && $this->temptables->is_temptable($name)) {

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            salvetore Michael de Raadt added a comment -

            Thanks for reporting that, Jonathon.

            We might come back to you for testing.

            Show
            salvetore Michael de Raadt added a comment - Thanks for reporting that, Jonathon. We might come back to you for testing.
            Hide
            poltawski Dan Poltawski added a comment -

            Hi Jonathon,

            Can you confirm if this is still and issue?

            Show
            poltawski Dan Poltawski added a comment - Hi Jonathon, Can you confirm if this is still and issue?
            Hide
            jonof Jonathon Fowler added a comment -

            Hi Dan

            Yes, it's still a problem, and my solution still seems effective.

            Show
            jonof Jonathon Fowler added a comment - Hi Dan Yes, it's still a problem, and my solution still seems effective.
            Hide
            poltawski Dan Poltawski added a comment -

            Thanks - submitting for integration

            Show
            poltawski Dan Poltawski added a comment - Thanks - submitting for integration
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            Integrated (21, 22 & master). Thanks!

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - Integrated (21, 22 & master). Thanks!
            Hide
            nebgor Aparup Banerjee added a comment -

            this test worked fine for me.

            Show
            nebgor Aparup Banerjee added a comment - this test worked fine for me.
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            Well,

            I wish I said it every time
            you do the things you do.
            You always lend a helping hand,
            and I'm filled with gratitude.

            You are strong and generous
            for each and everyone one of us.
            I am eternally grateful,
            I cannot say thanks enough.

            Sorry for the (un)cool bit above, lol. Closing this as fixed. Ciao

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - Well, I wish I said it every time you do the things you do. You always lend a helping hand, and I'm filled with gratitude. You are strong and generous for each and everyone one of us. I am eternally grateful, I cannot say thanks enough. Sorry for the (un)cool bit above, lol. Closing this as fixed. Ciao
            Hide
            eXpl0it3r Lukas Dürrenberger added a comment -

            Same issue occures with lib\dml\mysqli_native_moodle_database.php and the mentioned fix above seem to work as well.

            Show
            eXpl0it3r Lukas Dürrenberger added a comment - Same issue occures with lib\dml\mysqli_native_moodle_database.php and the mentioned fix above seem to work as well.
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            Hi Lukas Dürrenberger, would you mind creating a new issue about that. As far as this is closed since ages ago it won't be reopen, so new issue is the best way.

            TIA and ciao

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - Hi Lukas Dürrenberger , would you mind creating a new issue about that. As far as this is closed since ages ago it won't be reopen, so new issue is the best way. TIA and ciao

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  12/Mar/12