const UTF8 = 'DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci';
const CATEGORY_LENGTH = 12;
const CATEGORY_REGEXP = ';^[a-zA-Z0-9]+$;';
- const ID_LENGTH = 37; // MAX{64} - CATEGORY_LENGTH{12} - CONST_LENGHTH{15} = 37
+ // MAX{64} - CATEGORY_LENGTH{12} - CONST_LENGHTH{15} = 37
+ const ID_LENGTH = 37;
const ID_REGEXP = ';^[a-zA-Z0-9_]+$;';
const INNODB = 'ENGINE=InnoDB';
const MEMORY = 'ENGINE=MEMORY';
/**
* @var bool
*/
- protected $durable, $utf8;
+ protected $durable;
+
+ /**
+ * @var bool
+ */
+ protected $utf8;
protected $category;
protected $memory;
+ protected $createSql;
+
/**
* @return CRM_Utils_SQL_TempTable
*/
$t->id = md5(uniqid('', TRUE));
// The constant CIVICRM_TEMP_FORCE_DURABLE is for local debugging.
$t->durable = CRM_Utils_Constant::value('CIVICRM_TEMP_FORCE_DURABLE', FALSE);
- // I suspect it would be better to just say utf8=true, but a lot of existing queries don't do the utf8 bit.
- $t->utf8 = CRM_Utils_Constant::value('CIVICRM_TEMP_FORCE_UTF8', FALSE);
+ // @deprecated This constant is deprecated and will be removed.
+ $t->utf8 = CRM_Utils_Constant::value('CIVICRM_TEMP_FORCE_UTF8', TRUE);
$t->autodrop = FALSE;
$t->memory = FALSE;
return $t;
$this->utf8 ? self::UTF8 : '',
($selectQuery instanceof CRM_Utils_SQL_Select ? $selectQuery->toSQL() : $selectQuery)
);
- CRM_Core_DAO::executeQuery($sql, array(), TRUE, NULL, TRUE, FALSE);
+ CRM_Core_DAO::executeQuery($sql, [], TRUE, NULL, TRUE, FALSE);
+ $this->createSql = $sql;
return $this;
}
$this->memory ? self::MEMORY : self::INNODB,
$this->utf8 ? self::UTF8 : ''
);
- CRM_Core_DAO::executeQuery($sql, array(), TRUE, NULL, TRUE, FALSE);
+ CRM_Core_DAO::executeQuery($sql, [], TRUE, NULL, TRUE, FALSE);
+ $this->createSql = $sql;
return $this;
}
*/
public function drop() {
$sql = $this->toSQL('DROP', 'IF EXISTS');
- CRM_Core_DAO::executeQuery($sql, array(), TRUE, NULL, TRUE, FALSE);
+ CRM_Core_DAO::executeQuery($sql, [], TRUE, NULL, TRUE, FALSE);
return $this;
}
return $this->id;
}
+ /**
+ * @return string|NULL
+ */
+ public function getCreateSql() {
+ return $this->createSql;
+ }
+
/**
* @return bool
*/