From 9478982fcfdda45131cde66a20ebcd494f050908 Mon Sep 17 00:00:00 2001 From: eileen Date: Thu, 8 Oct 2020 09:14:44 +1300 Subject: [PATCH] dev/core#2073 Fix use of legacy leaky method in tested code This is too low volume to really leak but it uses the leaky legacy method and has test cover in CRM_Contact_Import_Form_MapFieldTest.testSubmit with data set basic_data CRM_Contact_Import_Form_MapFieldTest.testSubmit with data set save_mapping --- CRM/Contact/Import/Form/MapField.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/CRM/Contact/Import/Form/MapField.php b/CRM/Contact/Import/Form/MapField.php index dc09e731f5..8475dcd070 100644 --- a/CRM/Contact/Import/Form/MapField.php +++ b/CRM/Contact/Import/Form/MapField.php @@ -149,14 +149,11 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { } else { // get the field names from the temp. DB table - $dao = new CRM_Core_DAO(); - $db = $dao->getDatabaseConnection(); - $columnsQuery = "SHOW FIELDS FROM $this->_importTableName WHERE Field NOT LIKE '\_%'"; - $columnsResult = $db->query($columnsQuery); - while ($row = $columnsResult->fetchRow(DB_FETCHMODE_ASSOC)) { - $columnNames[] = $row['Field']; + $columnsResult = CRM_Core_DAO::executeQuery($columnsQuery); + while ($columnsResult->fetch()) { + $columnNames[] = $columnsResult->Field; } } -- 2.25.1