From: Seamus Lee Date: Mon, 11 Nov 2019 20:42:20 +0000 (+1100) Subject: dev/core#183 Event Price Set Custom Search to using CRM_Utils_SQL_TempTable interface X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=bf45c45c0834ac27cc444e0dbbf274935f4d408e;p=civicrm-core.git dev/core#183 Event Price Set Custom Search to using CRM_Utils_SQL_TempTable interface --- diff --git a/CRM/Contact/Form/Search/Custom/PriceSet.php b/CRM/Contact/Form/Search/Custom/PriceSet.php index 0c97298c6e..a927dc5b0b 100644 --- a/CRM/Contact/Form/Search/Custom/PriceSet.php +++ b/CRM/Contact/Form/Search/Custom/PriceSet.php @@ -55,11 +55,7 @@ class CRM_Contact_Form_Search_Custom_PriceSet extends CRM_Contact_Form_Search_Cu } public function buildTempTable() { - $randomNum = md5(uniqid()); - $this->_tableName = "civicrm_temp_custom_{$randomNum}"; - $sql = " -CREATE TEMPORARY TABLE {$this->_tableName} ( - id int unsigned NOT NULL AUTO_INCREMENT, + $sql = "id int unsigned NOT NULL AUTO_INCREMENT, contact_id int unsigned NOT NULL, participant_id int unsigned NOT NULL, "; @@ -76,12 +72,10 @@ CREATE TEMPORARY TABLE {$this->_tableName} ( } $sql .= " -PRIMARY KEY ( id ), -UNIQUE INDEX unique_participant_id ( participant_id ) -) ENGINE=HEAP -"; + PRIMARY KEY ( id ), + UNIQUE INDEX unique_participant_id ( participant_id )"; - CRM_Core_DAO::executeQuery($sql); + $this->_tableName = CRM_Utils_SQL_TempTable::build()->setCategory('priceset')->setMemory()->createWithColumns($sql)->getName(); } public function fillTable() {