CRM_Utils_SQL_TempTable
in package
Tags
Table of Contents
Constants
- CATEGORY_LENGTH = 12
- CATEGORY_REGEXP = ';^[a-zA-Z0-9]+$;'
- ID_LENGTH = 37
- ID_REGEXP = ';^[a-zA-Z0-9_]+$;'
- INNODB = 'ENGINE=InnoDB'
- MEMORY = 'ENGINE=MEMORY'
- UTF8 = 'DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci'
Properties
- $autodrop : mixed
- $category : mixed
- $createSql : mixed
- $durable : bool
- $id : mixed
- $memory : mixed
- $utf8 : bool
Methods
- __destruct() : mixed
- build() : CRM_Utils_SQL_TempTable
- createWithColumns() : CRM_Utils_SQL_TempTable
- Create the empty table.
- createWithQuery() : CRM_Utils_SQL_TempTable
- Create the table using results from a SELECT query.
- drop() : CRM_Utils_SQL_TempTable
- Drop the table.
- getCategory() : string|null
- getCreateSql() : string|null
- getId() : string|null
- getName() : string
- Determine the full table name.
- getUtf8String() : string
- Get the utf8 string for the table.
- isAutodrop() : bool
- isDurable() : bool
- isMemory() : bool
- isUtf8() : bool
- setAutodrop() : CRM_Utils_SQL_TempTable
- setCategory() : CRM_Utils_SQL_TempTable
- setDurable() : CRM_Utils_SQL_TempTable
- Set whether the table should be durable.
- setId() : CRM_Utils_SQL_TempTable
- Setter for id
- setMemory() : $this
- Set table engine to MEMORY.
- setUtf8() : $this
- Set table collation to UTF8.
- toSQL() : string
Constants
CATEGORY_LENGTH
public
mixed
CATEGORY_LENGTH
= 12
CATEGORY_REGEXP
public
mixed
CATEGORY_REGEXP
= ';^[a-zA-Z0-9]+$;'
ID_LENGTH
public
mixed
ID_LENGTH
= 37
ID_REGEXP
public
mixed
ID_REGEXP
= ';^[a-zA-Z0-9_]+$;'
INNODB
public
mixed
INNODB
= 'ENGINE=InnoDB'
MEMORY
public
mixed
MEMORY
= 'ENGINE=MEMORY'
UTF8
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.
public
mixed
UTF8
= 'DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci'
Properties
$autodrop
protected
mixed
$autodrop
$category
protected
mixed
$category
$createSql
protected
mixed
$createSql
$durable
protected
bool
$durable
$id
protected
mixed
$id
$memory
protected
mixed
$memory
$utf8
protected
bool
$utf8
Methods
__destruct()
public
__destruct() : mixed
build()
public
static build() : CRM_Utils_SQL_TempTable
Return values
CRM_Utils_SQL_TempTablecreateWithColumns()
Create the empty table.
public
createWithColumns(string $columns) : CRM_Utils_SQL_TempTable
Parameters
- $columns : string
-
SQL column listing. Ex: 'id int(10), name varchar(64)'.
Return values
CRM_Utils_SQL_TempTablecreateWithQuery()
Create the table using results from a SELECT query.
public
createWithQuery(string|CRM_Utils_SQL_Select $selectQuery) : CRM_Utils_SQL_TempTable
Parameters
- $selectQuery : string|CRM_Utils_SQL_Select
Return values
CRM_Utils_SQL_TempTabledrop()
Drop the table.
public
drop() : CRM_Utils_SQL_TempTable
Return values
CRM_Utils_SQL_TempTablegetCategory()
public
getCategory() : string|null
Return values
string|nullgetCreateSql()
public
getCreateSql() : string|null
Return values
string|nullgetId()
public
getId() : string|null
Return values
string|nullgetName()
Determine the full table name.
public
getName() : string
Return values
string —Ex: 'civicrm_tmp_d_foo_abcd1234abcd1234'
getUtf8String()
Get the utf8 string for the table.
public
getUtf8String() : string
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 values
stringisAutodrop()
public
isAutodrop() : bool
Return values
boolisDurable()
public
isDurable() : bool
Return values
boolisMemory()
public
isMemory() : bool
Return values
boolisUtf8()
public
isUtf8() : bool
Return values
boolsetAutodrop()
public
setAutodrop([bool $autodrop = TRUE ]) : CRM_Utils_SQL_TempTable
Parameters
- $autodrop : bool = TRUE
Return values
CRM_Utils_SQL_TempTablesetCategory()
public
setCategory(string|null $category) : CRM_Utils_SQL_TempTable
Parameters
- $category : string|null
Return values
CRM_Utils_SQL_TempTablesetDurable()
Set whether the table should be durable.
public
setDurable([bool $durable = TRUE ]) : CRM_Utils_SQL_TempTable
Durable tables are not TEMPORARY in the mysql sense.
Parameters
- $durable : bool = TRUE
Return values
CRM_Utils_SQL_TempTablesetId()
Setter for id
public
setId(mixed $id) : CRM_Utils_SQL_TempTable
Parameters
- $id : mixed
Return values
CRM_Utils_SQL_TempTablesetMemory()
Set table engine to MEMORY.
public
setMemory([bool $value = TRUE ]) : $this
Parameters
- $value : bool = TRUE
Return values
$thissetUtf8()
Set table collation to UTF8.
public
setUtf8([bool $value = TRUE ]) : $this
This method is deprecated as tables should be assumed to have UTF-8 as the default character set and collation; some other character set or collation may be specified in the column definition.
Parameters
- $value : bool = TRUE
Return values
$thistoSQL()
private
toSQL(string $action[, string|null $ifne = NULL ]) : string
Parameters
- $action : string
-
Ex: 'CREATE', 'DROP'
- $ifne : string|null = NULL
-
Ex: 'IF EXISTS', 'IF NOT EXISTS'.
Return values
string —Ex: 'CREATE TEMPORARY TABLE civicrm_tmp_e_foo_abcd1234
'
Ex: 'CREATE TABLE IF NOT EXISTS civicrm_tmp_d_foo_abcd1234
'