class SQLGenerator (View source)

Traits

Methods

addFloat(string $column, array $attribute = [])

Add float column

addDouble(string $column, array $attribute = [])

Add double column

addDoublePrimary(string $column)

Add double primary column

addFloatPrimary(string $column)

Add float primary column

addIncrement(string $column)

Add increment primary column

addInteger(string $column, array $attribute = [])

Add integer column

addIntegerPrimary(string $column)

Add integer primary column

addBigIncrement(string $column)

Add big increment primary column

addTinyInteger(string $column, array $attribute = [])

Add tiny integer column

addBigInteger(string $column, array $attribute = [])

Add Big integer column

addMediumInteger(string $column, array $attribute = [])

Add Medium integer column

addMediumIncrement(string $column)

Add Medium integer column

addBoolean(string $column, array $attribute = [])

Add boolean column

addUuid(string $column, array $attribute = [])

Add UUID column

addBinary(string $column, array $attribute = [])

Add BLOB column

addIpAddress(string $column, array $attribute = [])

Add ip column

addMacAddress(string $column, array $attribute = [])

Add mac column

addString(string $column, array $attribute = [])

Add string column

addLongString(string $column, array $attribute = [])

Add string column

addJson(string $column, array $attribute = [])

Add json column

addChar(string $column, array $attribute = [])

Add character column

addLongtext(string $column, array $attribute = [])

Add longtext column

addText(string $column, array $attribute = [])

Add text column

addBlob(string $column, array $attribute = [])

Add blob column

addDatetime(string $column, array $attribute = [])

Add datetime column

addDate(string $column, array $attribute = [])

Add date column

addTime(string $column, array $attribute = [])

Add time column

addYear(string $column, array $attribute = [])

Add year column

addTimestamp(string $column, array $attribute = [])

Add timestamp column

addTimestamps()

Add default timestamps

addForeign(string $name, array $attributes = [])

Add Foreign KEY constraints

dropForeign(string $name)

Drop constraintes column;

addIndex(string $name)

Add table index;

dropIndex(string $name)

Drop table index;

dropPrimary()

Drop primary column;

addUnique(string $name)

Add table unique;

dropUnique(string $name)

Drop table unique;

__construct(string $table, string $adapter = 'mysql', string $scope = 'create')

SQLGenerator constructor

string
make()

Generate the sql

addColumn(string $name, string $type, array $attributes = [])

Add new column in the table

dropColumn(string $name)

Drop table column

void
withEngine(string $engine)

Set the engine

string
getEngine()

Get the engine

void
withCollation(string $collation)

Set the collation

string
getCollation()

Get the collation

void
withCharset(string $charset)

Set the charset

string
getCharset()

Get the charset

string
getTable()

Get the define table name

setScope(string $scope)

Set the scope

setAdapter(string $adapter)

Set the adapter

Details

SQLGenerator addFloat(string $column, array $attribute = [])

Add float column

Parameters

string $column
array $attribute

Return Value

SQLGenerator

SQLGenerator addDouble(string $column, array $attribute = [])

Add double column

Parameters

string $column
array $attribute

Return Value

SQLGenerator

SQLGenerator addDoublePrimary(string $column)

Add double primary column

Parameters

string $column

Return Value

SQLGenerator

SQLGenerator addFloatPrimary(string $column)

Add float primary column

Parameters

string $column

Return Value

SQLGenerator

SQLGenerator addIncrement(string $column)

Add increment primary column

Parameters

string $column

Return Value

SQLGenerator

SQLGenerator addInteger(string $column, array $attribute = [])

Add integer column

Parameters

string $column
array $attribute

Return Value

SQLGenerator

SQLGenerator addIntegerPrimary(string $column)

Add integer primary column

Parameters

string $column

Return Value

SQLGenerator

SQLGenerator addBigIncrement(string $column)

Add big increment primary column

Parameters

string $column

Return Value

SQLGenerator

SQLGenerator addTinyInteger(string $column, array $attribute = [])

Add tiny integer column

Parameters

string $column
array $attribute

Return Value

SQLGenerator

SQLGenerator addBigInteger(string $column, array $attribute = [])

Add Big integer column

Parameters

string $column
array $attribute

Return Value

SQLGenerator

SQLGenerator addMediumInteger(string $column, array $attribute = [])

Add Medium integer column

Parameters

string $column
array $attribute

Return Value

SQLGenerator

SQLGenerator addMediumIncrement(string $column)

Add Medium integer column

Parameters

string $column

Return Value

SQLGenerator

SQLGenerator addBoolean(string $column, array $attribute = [])

Add boolean column

Parameters

string $column
array $attribute

Return Value

SQLGenerator

SQLGenerator addUuid(string $column, array $attribute = [])

Add UUID column

Parameters

string $column
array $attribute

Return Value

SQLGenerator

SQLGenerator addBinary(string $column, array $attribute = [])

Add BLOB column

Parameters

string $column
array $attribute

Return Value

SQLGenerator

SQLGenerator addIpAddress(string $column, array $attribute = [])

Add ip column

Parameters

string $column
array $attribute

Return Value

SQLGenerator

SQLGenerator addMacAddress(string $column, array $attribute = [])

Add mac column

Parameters

string $column
array $attribute

Return Value

SQLGenerator

SQLGenerator addString(string $column, array $attribute = [])

Add string column

Parameters

string $column
array $attribute

Return Value

SQLGenerator

SQLGenerator addLongString(string $column, array $attribute = [])

Add string column

Parameters

string $column
array $attribute

Return Value

SQLGenerator

SQLGenerator addJson(string $column, array $attribute = [])

Add json column

Parameters

string $column
array $attribute

Return Value

SQLGenerator

SQLGenerator addChar(string $column, array $attribute = [])

Add character column

Parameters

string $column
array $attribute

Return Value

SQLGenerator

SQLGenerator addLongtext(string $column, array $attribute = [])

Add longtext column

Parameters

string $column
array $attribute

Return Value

SQLGenerator

SQLGenerator addText(string $column, array $attribute = [])

Add text column

Parameters

string $column
array $attribute

Return Value

SQLGenerator

SQLGenerator addBlob(string $column, array $attribute = [])

Add blob column

Parameters

string $column
array $attribute

Return Value

SQLGenerator

SQLGenerator addDatetime(string $column, array $attribute = [])

Add datetime column

Parameters

string $column
array $attribute

Return Value

SQLGenerator

SQLGenerator addDate(string $column, array $attribute = [])

Add date column

Parameters

string $column
array $attribute

Return Value

SQLGenerator

SQLGenerator addTime(string $column, array $attribute = [])

Add time column

Parameters

string $column
array $attribute

Return Value

SQLGenerator

SQLGenerator addYear(string $column, array $attribute = [])

Add year column

Parameters

string $column
array $attribute

Return Value

SQLGenerator

SQLGenerator addTimestamp(string $column, array $attribute = [])

Add timestamp column

Parameters

string $column
array $attribute

Return Value

SQLGenerator

SQLGenerator addTimestamps()

Add default timestamps

Return Value

SQLGenerator

SQLGenerator addForeign(string $name, array $attributes = [])

Add Foreign KEY constraints

Parameters

string $name
array $attributes

Return Value

SQLGenerator

SQLGenerator dropForeign(string $name)

Drop constraintes column;

Parameters

string $name

Return Value

SQLGenerator

SQLGenerator addIndex(string $name)

Add table index;

Parameters

string $name

Return Value

SQLGenerator

SQLGenerator dropIndex(string $name)

Drop table index;

Parameters

string $name

Return Value

SQLGenerator

SQLGenerator dropPrimary()

Drop primary column;

Return Value

SQLGenerator

SQLGenerator addUnique(string $name)

Add table unique;

Parameters

string $name

Return Value

SQLGenerator

SQLGenerator dropUnique(string $name)

Drop table unique;

Parameters

string $name

Return Value

SQLGenerator

__construct(string $table, string $adapter = 'mysql', string $scope = 'create')

SQLGenerator constructor

Parameters

string $table
string $adapter
string $scope

string make()

Generate the sql

Return Value

string

SQLGenerator addColumn(string $name, string $type, array $attributes = [])

Add new column in the table

Parameters

string $name
string $type
array $attributes

Return Value

SQLGenerator

SQLGenerator dropColumn(string $name)

Drop table column

Parameters

string $name

Return Value

SQLGenerator

void withEngine(string $engine)

Set the engine

Parameters

string $engine

Return Value

void

string getEngine()

Get the engine

Return Value

string

void withCollation(string $collation)

Set the collation

Parameters

string $collation

Return Value

void

string getCollation()

Get the collation

Return Value

string

void withCharset(string $charset)

Set the charset

Parameters

string $charset

Return Value

void

string getCharset()

Get the charset

Return Value

string

string getTable()

Get the define table name

Return Value

string

SQLGenerator setScope(string $scope)

Set the scope

Parameters

string $scope

Return Value

SQLGenerator

SQLGenerator setAdapter(string $adapter)

Set the adapter

Parameters

string $adapter

Return Value

SQLGenerator