From bf45c45c0834ac27cc444e0dbbf274935f4d408e Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Tue, 12 Nov 2019 07:42:20 +1100 Subject: [PATCH] dev/core#183 Event Price Set Custom Search to using CRM_Utils_SQL_TempTable interface --- CRM/Contact/Form/Search/Custom/PriceSet.php | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) 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() { -- 2.25.1