Skip to content

Commit

Permalink
Merge pull request #18171 from demeritcowboy/unused-UTF8
Browse files Browse the repository at this point in the history
[REF] Deprecate unused SQL temptable functions
  • Loading branch information
eileenmcnaughton authored Aug 16, 2020
2 parents 75f54c7 + 537dacb commit dd76c9c
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions CRM/Utils/SQL/TempTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,14 @@
*/
class CRM_Utils_SQL_TempTable {

/**
* @deprecated
* The system will attempt to use the same as your other tables, and
* if you really need something else then use createWithColumns and
* specify it per-column there.
*/
const UTF8 = 'DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci';

const CATEGORY_LENGTH = 12;
const CATEGORY_REGEXP = ';^[a-zA-Z0-9]+$;';
// MAX{64} - CATEGORY_LENGTH{12} - CONST_LENGHTH{15} = 37
Expand Down Expand Up @@ -135,8 +142,10 @@ public function createWithQuery($selectQuery) {
/**
* Get the utf8 string for the table.
*
* Our tables are either utf8_unicode_ci OR utf8mb8_unicode_ci - check the contact table
* to see which & use the matching one.
* Our tables are either utf8_unicode_ci OR utf8mb4_unicode_ci - check the contact table
* to see which & use the matching one. Or early adopters may have switched
* switched to other collations e.g. utf8mb4_0900_ai_ci (the default in mysql
* 8).
*
* @return string
*/
Expand Down Expand Up @@ -241,9 +250,11 @@ public function isMemory() {
}

/**
* @deprecated
* @return bool
*/
public function isUtf8() {
CRM_Core_Error::deprecatedFunctionWarning('your own charset/collation per column with createWithColumns if you really need latin1');
return $this->utf8;
}

Expand Down Expand Up @@ -322,6 +333,7 @@ public function setMemory($value = TRUE) {
* @return $this
*/
public function setUtf8($value = TRUE) {
CRM_Core_Error::deprecatedFunctionWarning('your own charset/collation per column with createWithColumns if you really need latin1');
$this->utf8 = $value;
return $this;
}
Expand Down

0 comments on commit dd76c9c

Please sign in to comment.