CRM-12355
authorDonald A. Lobo <lobo@civicrm.org>
Mon, 15 Apr 2013 15:34:04 +0000 (08:34 -0700)
committerDonald A. Lobo <lobo@civicrm.org>
Mon, 15 Apr 2013 23:09:06 +0000 (16:09 -0700)
----------------------------------------
* CRM-12355: Upgrade fails with "CREATE TEMPORARY TABLE ... A table must have at least 1 column]"
  http://issues.civicrm.org/jira/browse/CRM-12355

CRM/Upgrade/Incremental/php/FourThree.php

index b9634bbd23f17033a94850e1a4a85102c03e3456..e241c7e5f5d938a64a4bd62ba7153b13e62e072c 100644 (file)
@@ -444,15 +444,14 @@ AND   con.contribution_status_id = {$pendingStatus}
     //create a temp table to hold financial account id related to payment instruments
     $tempTableName1 = CRM_Core_DAO::createTempTableName();
 
-    $sql =  "CREATE TEMPORARY TABLE {$tempTableName1}";
-    CRM_Core_DAO::executeQuery($sql);
-
-    $sql = "
+    $sql =  "
+CREATE TEMPORARY TABLE {$tempTableName1}
 SELECT     ceft.financial_account_id financial_account_id, cov.value as instrument_id
 FROM       civicrm_entity_financial_account ceft
 INNER JOIN civicrm_option_value cov ON cov.id = ceft.entity_id AND ceft.entity_table = 'civicrm_option_value'
 INNER JOIN civicrm_option_group cog ON cog.id = cov.option_group_id
-WHERE      cog.name = 'payment_instrument'";
+WHERE      cog.name = 'payment_instrument'
+";
     CRM_Core_DAO::executeQuery($sql);
 
     //CRM-12141
@@ -461,10 +460,8 @@ WHERE      cog.name = 'payment_instrument'";
 
     //create temp table to process completed / cancelled contribution
     $tempTableName2 = CRM_Core_DAO::createTempTableName();
-    $sql = "CREATE TEMPORARY TABLE {$tempTableName2}";
-    CRM_Core_DAO::executeQuery($sql);
-
     $sql = "
+CREATE TEMPORARY TABLE {$tempTableName2}
 SELECT con.id as contribution_id, con.payment_instrument_id,
        IF(con.currency IN ('{$validCurrencyCodes}'), con.currency, '{$defaultCurrency}') as currency,
        con.total_amount, con.net_amount, con.fee_amount, con.trxn_id, con.contribution_status_id,
@@ -509,7 +506,8 @@ SELECT   tempI.contribution_id, tempI.payment_instrument_id, tempI.currency, tem
          tempI.fee_amount,    tempI.trxn_id,   tempI.contribution_status_id, tempI.check_number,
          tempI.to_financial_account_id, tempI.from_financial_account_id, tempI.trxn_date
 FROM {$tempTableName2} tempI
-WHERE tempI.action = 'insert';";
+WHERE tempI.action = 'insert'
+";
     CRM_Core_DAO::executeQuery($sql);
 
     //update of existing records