Reviewed: https://reviews.mahara.org/9950 Committed: https://git.mahara.org/mahara/mahara/commit/3e0cd370e245bd0eb011667430f30df6ab42c4f9 Submitter: Cecilia Vela Gurovic (cecili...@catalyst.net.nz) Branch: master
commit 3e0cd370e245bd0eb011667430f30df6ab42c4f9 Author: Robert Lyon <robe...@catalyst.net.nz> Date: Fri May 3 10:14:51 2019 +1200 Bug 1827445: Check if a table column exists in a quicker way Without needing to create the xmldb table / field objects We do this by trying to query the column and capture the SQLException if it doesn't exist behatnotneeded Change-Id: I0a15dd4d1d4e47e6650576c084ee9e1d36b4ae62 Signed-off-by: Robert Lyon <robe...@catalyst.net.nz> -- You received this bug notification because you are a member of Mahara Contributors, which is subscribed to Mahara. Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it! https://bugs.launchpad.net/bugs/1827445 Title: Improve efficiency when checking if a table field exists Status in Mahara: Fix Committed Bug description: When upgrading we use a field_exists() check to see if a table has a certain column or not which is fine there as upgrade chunks are a one- time execution run when users are all logged out. However we have begun to use field_exists() within other parts of the code and so this can get called on every page load by multiple users at once. This requires fetching the ddl.lib file and setting ul an XMLDB table object and an XMLDB field object which has overhead. Instead we should just query the database directly and ask it if the table has the column or not So instead of doing: require_once('ddl.php'); $table = new XMLDBTable('tablename'); $field = new XMLDBField('fieldname'); if (field_exists($table, $field)) { ... } We could just do: if (column_exists('tablename', 'fieldname')) { ... } And have the column_exists function that call the database directly To manage notifications about this bug go to: https://bugs.launchpad.net/mahara/+bug/1827445/+subscriptions _______________________________________________ Mailing list: https://launchpad.net/~mahara-contributors Post to : mahara-contributors@lists.launchpad.net Unsubscribe : https://launchpad.net/~mahara-contributors More help : https://help.launchpad.net/ListHelp