Documentation

Schema extends AbstractSql
in package

Sql schema table class

Tags
category

Pop

author

Nick Sagona, III dev@nolainteractive.com

copyright

Copyright (c) 2009-2021 NOLA Interactive, LLC. (http://www.nolainteractive.com)

license

http://www.popphp.org/license New BSD License

version
5.3.0

Table of Contents

BACKTICK  = 'BACKTICK'
Constants for id quote types
BRACKET  = 'BRACKET'
DOUBLE_QUOTE  = 'DOUBLE_QUOTE'
MYSQL  = 'MYSQL'
Constants for database types
NO_QUOTE  = 'NO_QUOTE'
PGSQL  = 'PGSQL'
SQLITE  = 'SQLITE'
SQLSRV  = 'SQLSRV'
$alter  : array<string|int, mixed>
ALTER table schema objects
$closeQuote  : string
ID close quote
$create  : array<string|int, mixed>
CREATE table schema objects
$db  : AbstractAdapter
Database object
$dbType  : int
Database type
$drop  : array<string|int, mixed>
DROP table schema objects
$foreignKeyCheck  : bool
Foreign key check flag
$idQuoteType  : string
ID quote type
$openQuote  : string
ID open quote
$parameterCount  : int
Parameter count
$placeholder  : string
SQL placeholder
$rename  : array<string|int, mixed>
RENAME table schema objects
$truncate  : array<string|int, mixed>
TRUNCATE table schema objects
__construct()  : mixed
Constructor
__toString()  : string
Render the schema to string
alter()  : Alter
Access the ALTER table object
create()  : Create
Access the CREATE table object
createIfNotExists()  : Create
Access the CREATE table object, setting IF NOT EXISTS
db()  : AbstractAdapter
Get the current database adapter object (alias method)
decrementParameterCount()  : static
Decrement parameter count
disableForeignKeyCheck()  : Schema
Disable the foreign key check
drop()  : Drop
Access the DROP table object
dropIfExists()  : Drop
Access the DROP table object, setting IF EXISTS
enableForeignKeyCheck()  : Schema
Enable the foreign key check
execute()  : void
Execute the schema directly
getCloseQuote()  : string
Get close quote
getDb()  : AbstractAdapter
Get the current database adapter object
getDbType()  : int
Get the current database type
getIdQuoteType()  : int
Get the quote ID type
getOpenQuote()  : string
Get open quote
getParameter()  : string
Get parameter placeholder value
getParameterCount()  : int
Get parameter count
getPlaceholder()  : string
Get the SQL placeholder
incrementParameterCount()  : static
Increment parameter count
isMysql()  : bool
Determine if the DB type is MySQL
isParameter()  : bool
Check if value is parameter placeholder
isPgsql()  : bool
Determine if the DB type is PostgreSQL
isSqlite()  : bool
Determine if the DB type is SQLite
isSqlsrv()  : bool
Determine if the DB type is SQL Server
quote()  : string
Quote the value (if it is not a numeric value)
quoteId()  : string
Quote the identifier
rename()  : Rename
Access the RENAME table object
render()  : string
Render the schema
reset()  : Schema
Reset and clear the schema object
setIdQuoteType()  : AbstractSql
Set the quote ID type
setPlaceholder()  : AbstractSql
Set the placeholder
truncate()  : Truncate
Access the TRUNCATE table object
getAlterTable()  : Alter
Get the ALTER table object
getCreateTable()  : Create
Get the CREATE table object
getDropTable()  : Drop
Get the DROP table object
getRenameTable()  : Rename
Get the RENAME table object
getTruncateTable()  : Truncate
Get the TRUNCATE table object
init()  : void
Initialize SQL object
initQuoteType()  : void
Initialize quite type

Constants

BACKTICK

Constants for id quote types

public mixed BACKTICK = 'BACKTICK'

DOUBLE_QUOTE

public mixed DOUBLE_QUOTE = 'DOUBLE_QUOTE'

MYSQL

Constants for database types

public mixed MYSQL = 'MYSQL'

Properties

$alter

ALTER table schema objects

protected array<string|int, mixed> $alter = []

$closeQuote

ID close quote

protected string $closeQuote = null

$create

CREATE table schema objects

protected array<string|int, mixed> $create = []

$drop

DROP table schema objects

protected array<string|int, mixed> $drop = []

$foreignKeyCheck

Foreign key check flag

protected bool $foreignKeyCheck = true

$idQuoteType

ID quote type

protected string $idQuoteType = 'NO_QUOTE'

$openQuote

ID open quote

protected string $openQuote = null

$parameterCount

Parameter count

protected int $parameterCount = 0

$placeholder

SQL placeholder

protected string $placeholder = null

$rename

RENAME table schema objects

protected array<string|int, mixed> $rename = []

$truncate

TRUNCATE table schema objects

protected array<string|int, mixed> $truncate = []

Methods

__toString()

Render the schema to string

public __toString() : string
Return values
string

alter()

Access the ALTER table object

public alter(string $table) : Alter
Parameters
$table : string
Return values
Alter

create()

Access the CREATE table object

public create(string $table) : Create
Parameters
$table : string
Return values
Create

createIfNotExists()

Access the CREATE table object, setting IF NOT EXISTS

public createIfNotExists(string $table) : Create
Parameters
$table : string
Return values
Create

decrementParameterCount()

Decrement parameter count

public decrementParameterCount() : static
Return values
static

disableForeignKeyCheck()

Disable the foreign key check

public disableForeignKeyCheck() : Schema
Return values
Schema

drop()

Access the DROP table object

public drop(string $table) : Drop
Parameters
$table : string
Return values
Drop

dropIfExists()

Access the DROP table object, setting IF EXISTS

public dropIfExists(string $table) : Drop
Parameters
$table : string
Return values
Drop

enableForeignKeyCheck()

Enable the foreign key check

public enableForeignKeyCheck() : Schema
Return values
Schema

execute()

Execute the schema directly

public execute([bool $reset = true ]) : void
Parameters
$reset : bool = true
Return values
void

getCloseQuote()

Get close quote

public getCloseQuote() : string
Return values
string

getDbType()

Get the current database type

public getDbType() : int
Return values
int

getIdQuoteType()

Get the quote ID type

public getIdQuoteType() : int
Return values
int

getOpenQuote()

Get open quote

public getOpenQuote() : string
Return values
string

getParameter()

Get parameter placeholder value

public getParameter(mixed $value[, string $column = null ]) : string
Parameters
$value : mixed
$column : string = null
Return values
string

getParameterCount()

Get parameter count

public getParameterCount() : int
Return values
int

getPlaceholder()

Get the SQL placeholder

public getPlaceholder() : string
Return values
string

incrementParameterCount()

Increment parameter count

public incrementParameterCount() : static
Return values
static

isMysql()

Determine if the DB type is MySQL

public isMysql() : bool
Return values
bool

isParameter()

Check if value is parameter placeholder

public isParameter(mixed $value[, string $column = null ]) : bool
Parameters
$value : mixed
$column : string = null
Return values
bool

isPgsql()

Determine if the DB type is PostgreSQL

public isPgsql() : bool
Return values
bool

isSqlite()

Determine if the DB type is SQLite

public isSqlite() : bool
Return values
bool

isSqlsrv()

Determine if the DB type is SQL Server

public isSqlsrv() : bool
Return values
bool

quote()

Quote the value (if it is not a numeric value)

public quote(string $value[, bool $force = false ]) : string
Parameters
$value : string
$force : bool = false
Return values
string

quoteId()

Quote the identifier

public quoteId(string $identifier) : string
Parameters
$identifier : string
Return values
string

rename()

Access the RENAME table object

public rename(string $table) : Rename
Parameters
$table : string
Return values
Rename

render()

Render the schema

public render() : string
Return values
string

setIdQuoteType()

Set the quote ID type

public setIdQuoteType([string $type = self::NO_QUOTE ]) : AbstractSql
Parameters
$type : string = self::NO_QUOTE
Return values
AbstractSql

truncate()

Access the TRUNCATE table object

public truncate(string $table) : Truncate
Parameters
$table : string
Return values
Truncate

getAlterTable()

Get the ALTER table object

protected getAlterTable(string $table) : Alter
Parameters
$table : string
Return values
Alter

getCreateTable()

Get the CREATE table object

protected getCreateTable(string $table) : Create
Parameters
$table : string
Return values
Create

getDropTable()

Get the DROP table object

protected getDropTable(string $table) : Drop
Parameters
$table : string
Return values
Drop

getRenameTable()

Get the RENAME table object

protected getRenameTable(string $table) : Rename
Parameters
$table : string
Return values
Rename

getTruncateTable()

Get the TRUNCATE table object

protected getTruncateTable(string $table) : Truncate
Parameters
$table : string
Return values
Truncate

init()

Initialize SQL object

protected init(string $adapter) : void
Parameters
$adapter : string
Return values
void

initQuoteType()

Initialize quite type

protected initQuoteType() : void
Return values
void

Search results