From 4089dea0e6f87c00ef35bf1609841105c1ad782e Mon Sep 17 00:00:00 2001 From: mark burdett Date: Sun, 24 Feb 2019 11:34:20 -0800 Subject: [PATCH] Use CRM_Utils_SQL_TempTable to drop and create table. --- CRM/Export/BAO/Export.php | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/CRM/Export/BAO/Export.php b/CRM/Export/BAO/Export.php index 5ef3763257..44d8e7ee75 100644 --- a/CRM/Export/BAO/Export.php +++ b/CRM/Export/BAO/Export.php @@ -652,14 +652,12 @@ VALUES $sqlValueString */ public static function createTempTable($sqlColumns) { //creating a temporary table for the search result that need be exported - $exportTempTable = CRM_Utils_SQL_TempTable::build()->setDurable()->setCategory('export')->getName(); + $exportTempTable = CRM_Utils_SQL_TempTable::build()->setDurable()->setCategory('export')->setUtf8(); // also create the sql table - $sql = "DROP TABLE IF EXISTS {$exportTempTable}"; - CRM_Core_DAO::executeQuery($sql); + $exportTempTable->drop(); $sql = " -CREATE TABLE {$exportTempTable} ( id int unsigned NOT NULL AUTO_INCREMENT, "; $sql .= implode(",\n", array_values($sqlColumns)); @@ -682,12 +680,8 @@ CREATE TABLE {$exportTempTable} ( } } - $sql .= " -) ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci -"; - - CRM_Core_DAO::executeQuery($sql); - return $exportTempTable; + $exportTempTable->createWithColumns($sql); + return $exportTempTable->getName(); } /** -- 2.25.1