class MysqlGrammar extends AbstractQueryGrammar (View source)

Class MysqlQueryGrammar

Constants

PRIMARY

INDEX

UNIQUE

SPATIAL

FULLTEXT

FOREIGN

Properties

static Query $query Property query.

Methods

getInstance(string $name)

getInstance

static string
build()

build

static Query
getQuery(bool $new = false)

getQuery

static string
listDatabases(array $where = null)

showDatabases

static string
createDatabase(string $name, bool $isNotExists = false, string $charset = null, string $collate = null)

createDatabase

static string
dropDatabase(string $db, bool $ifExist = false)

dropTable

static string
showTableColumns(string $table, bool $full = false, string|array $where = null)

showTableColumn

static string
showDbTables(string $dbname, string $where = null)

showDbTables

static string
createTable(string $name, array $columns, array|string $pks = array(), array $keys = array(), null $autoIncrement = null, bool $ifNotExists = true, string $engine = 'InnoDB', string $defaultCharset = 'utf8')

createTable

static string
dropTable(string $table, bool $ifExists = false, string $option = '')

dropTable

static string
alterColumn(string $operation, string $table, string $column, string $type = 'text', bool $signed = true, bool $allowNull = true, null $default = null, null $position = null, string $comment = '')

alterColumn

static string
addColumn(string $table, string $column, string $type = 'text', bool $signed = true, bool $allowNull = true, string $default = null, string $position = null, string $comment = '')

Add column

static string
changeColumn(string $table, string $oldColumn, string $newColumn, string $type = 'text', bool $signed = true, bool $allowNull = true, null $default = null, string $position = null, string $comment = '')

changeColumn

static string
modifyColumn(string $table, string $column, string $type = 'text', bool $signed = true, bool $allowNull = true, null $default = null, string $position = null, string $comment = '')

modifyColumn

static string
dropColumn(string $table, string $column)

dropColumn

static string
addIndex(string $table, string $type, array $columns, string $name, string $comment = null)

addIndex

static string
buildIndexDeclare(string $name, array $columns, string $table = null)

buildIndexDeclare

static string
dropIndex(string $table, string $name)

dropIndex

static string
replace(string $name, array $columns = array(), array $values = array())

replace

Details

static QueryGrammarInterface getInstance(string $name)

getInstance

Parameters

string $name

Return Value

QueryGrammarInterface

at line line 447
static string build()

build

Return Value

string

at line line 525
static Query getQuery(bool $new = false)

getQuery

Parameters

bool $new

Return Value

Query

at line line 43
static string listDatabases(array $where = null)

showDatabases

Parameters

array $where

Return Value

string

at line line 60
static string createDatabase(string $name, bool $isNotExists = false, string $charset = null, string $collate = null)

createDatabase

Parameters

string $name
bool $isNotExists
string $charset
string $collate

Return Value

string

at line line 81
static string dropDatabase(string $db, bool $ifExist = false)

dropTable

Parameters

string $db
bool $ifExist

Return Value

string

at line line 101
static string showTableColumns(string $table, bool $full = false, string|array $where = null)

showTableColumn

Parameters

string $table
bool $full
string|array $where

Return Value

string

at line line 122
static string showDbTables(string $dbname, string $where = null)

showDbTables

Parameters

string $dbname
string $where

Return Value

string

at line line 149
static string createTable(string $name, array $columns, array|string $pks = array(), array $keys = array(), null $autoIncrement = null, bool $ifNotExists = true, string $engine = 'InnoDB', string $defaultCharset = 'utf8')

createTable

Parameters

string $name
array $columns
array|string $pks
array $keys
null $autoIncrement
bool $ifNotExists
string $engine
string $defaultCharset

Return Value

string

Exceptions

InvalidArgumentException

at line line 221
static string dropTable(string $table, bool $ifExists = false, string $option = '')

dropTable

Parameters

string $table
bool $ifExists
string $option

Return Value

string

at line line 248
static string alterColumn(string $operation, string $table, string $column, string $type = 'text', bool $signed = true, bool $allowNull = true, null $default = null, null $position = null, string $comment = '')

alterColumn

Parameters

string $operation
string $table
string $column
string $type
bool $signed
bool $allowNull
null $default
null $position
string $comment

Return Value

string

at line line 283
static string addColumn(string $table, string $column, string $type = 'text', bool $signed = true, bool $allowNull = true, string $default = null, string $position = null, string $comment = '')

Add column

Parameters

string $table
string $column
string $type
bool $signed
bool $allowNull
string $default
string $position
string $comment

Return Value

string

at line line 304
static string changeColumn(string $table, string $oldColumn, string $newColumn, string $type = 'text', bool $signed = true, bool $allowNull = true, null $default = null, string $position = null, string $comment = '')

changeColumn

Parameters

string $table
string $oldColumn
string $newColumn
string $type
bool $signed
bool $allowNull
null $default
string $position
string $comment

Return Value

string

at line line 326
static string modifyColumn(string $table, string $column, string $type = 'text', bool $signed = true, bool $allowNull = true, null $default = null, string $position = null, string $comment = '')

modifyColumn

Parameters

string $table
string $column
string $type
bool $signed
bool $allowNull
null $default
string $position
string $comment

Return Value

string

at line line 340
static string dropColumn(string $table, string $column)

dropColumn

Parameters

string $table
string $column

Return Value

string

at line line 363
static string addIndex(string $table, string $type, array $columns, string $name, string $comment = null)

addIndex

Parameters

string $table
string $type
array $columns
string $name
string $comment

Return Value

string

at line line 389
static string buildIndexDeclare(string $name, array $columns, string $table = null)

buildIndexDeclare

Parameters

string $name
array $columns
string $table

Return Value

string

at line line 430
static string dropIndex(string $table, string $name)

dropIndex

Parameters

string $table
string $name

Return Value

string

at line line 505
static string replace(string $name, array $columns = array(), array $values = array())

replace

Parameters

string $name
array $columns
array $values

Return Value

string