dev/core#2073 Fix use of legacy leaky method in tested code
authoreileen <emcnaughton@wikimedia.org>
Wed, 7 Oct 2020 20:14:44 +0000 (09:14 +1300)
committereileen <emcnaughton@wikimedia.org>
Wed, 7 Oct 2020 22:04:45 +0000 (11:04 +1300)
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

index dc09e731f58a1712143493cd090bd878cae7183d..8475dcd070cd9b825d3539d91ff87bb9bbc7ed8f 100644 (file)
@@ -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;
       }
     }