PHP Class Pop\Db\Sql

Author: Nick Sagona, III ([email protected])
Exibir arquivo Open project: nicksagona/PopPHP Class Usage Examples

Protected Properties

Property Type Description
$alias string Alias name for sub-queries
$clause mixed SQL clause object
$db Db Database object
$dbType integer Database type
$quoteIdType integer ID quote type
$sql string SQL statement
$table string Current table

Public Methods

Method Description
__construct ( Db $db, mixed $table = null, string $alias = null ) : Sql Constructor
__toString ( ) : string Method to return the SQL as a string
adapter ( ) : AbstractAdapter Get the current database object's adapter.
delete ( ) : Update Create a delete statement
factory ( Db $db, mixed $table = null, string $alias = null ) : Sql Static method to instantiate the SQL object and return itself to facilitate chaining methods together.
getAlias ( ) : string Get the alias name.
getDb ( ) : Db Get the current database object.
getDbType ( ) : integer Get the current database type.
getQuoteId ( ) : integer Get the quote ID type
getSql ( ) : string Get the current SQL statement string.
getTable ( ) : string Get the current table.
hasAlias ( ) : boolean Determine if the Sql object has an alias name
hasTable ( ) : boolean Determine if the Sql object has a table set
insert ( array $columns = null ) : Insert Create a insert statement
quote ( string $value ) : string Quote the value with single quotes
quoteId ( string $id ) : string Quote the value with the quoted identifier
render ( boolean $ret = false ) : mixed Render SQL string
select ( mixed $columns = null ) : Select Create a select statement
setAlias ( string $alias = null ) : Sql Set alias name
setDb ( Db $db ) : Sql Set the database object
setQuoteId ( integer $type = Pop\Db\Sql::NO_QUOTE ) : Sql Set the quote ID type
setTable ( mixed $table = null ) : Sql Set current table to operate on.
update ( array $columns = null ) : Update Create a update statement

Method Details

__construct() public method

Instantiate the SQL object.
public __construct ( Db $db, mixed $table = null, string $alias = null ) : Sql
$db Db
$table mixed
$alias string
return Sql

__toString() public method

Method to return the SQL as a string
public __toString ( ) : string
return string

adapter() public method

Get the current database object's adapter.
public adapter ( ) : AbstractAdapter
return Pop\Db\Adapter\AbstractAdapter

delete() public method

Create a delete statement
public delete ( ) : Update
return Pop\Db\Sql\Update

factory() public static method

Static method to instantiate the SQL object and return itself to facilitate chaining methods together.
public static factory ( Db $db, mixed $table = null, string $alias = null ) : Sql
$db Db
$table mixed
$alias string
return Sql

getAlias() public method

Get the alias name.
public getAlias ( ) : string
return string

getDb() public method

Get the current database object.
public getDb ( ) : Db
return Db

getDbType() public method

Get the current database type.
public getDbType ( ) : integer
return integer

getQuoteId() public method

Get the quote ID type
public getQuoteId ( ) : integer
return integer

getSql() public method

Get the current SQL statement string.
public getSql ( ) : string
return string

getTable() public method

Get the current table.
public getTable ( ) : string
return string

hasAlias() public method

Determine if the Sql object has an alias name
public hasAlias ( ) : boolean
return boolean

hasTable() public method

Determine if the Sql object has a table set
public hasTable ( ) : boolean
return boolean

insert() public method

Create a insert statement
public insert ( array $columns = null ) : Insert
$columns array
return Pop\Db\Sql\Insert

quote() public method

Quote the value with single quotes
public quote ( string $value ) : string
$value string
return string

quoteId() public method

Quote the value with the quoted identifier
public quoteId ( string $id ) : string
$id string
return string

render() public method

Render SQL string
public render ( boolean $ret = false ) : mixed
$ret boolean
return mixed

select() public method

Create a select statement
public select ( mixed $columns = null ) : Select
$columns mixed
return Pop\Db\Sql\Select

setAlias() public method

Set alias name
public setAlias ( string $alias = null ) : Sql
$alias string
return Sql

setDb() public method

Set the database object
public setDb ( Db $db ) : Sql
$db Db
return Sql

setQuoteId() public method

Set the quote ID type
public setQuoteId ( integer $type = Pop\Db\Sql::NO_QUOTE ) : Sql
$type integer
return Sql

setTable() public method

Set current table to operate on.
public setTable ( mixed $table = null ) : Sql
$table mixed
return Sql

update() public method

Create a update statement
public update ( array $columns = null ) : Update
$columns array
return Pop\Db\Sql\Update

Property Details

$alias protected_oe property

Alias name for sub-queries
protected string $alias
return string

$clause protected_oe property

SQL clause object
protected mixed $clause
return mixed

$db protected_oe property

Database object
protected Db,Pop\Db $db
return Db

$dbType protected_oe property

Database type
protected int $dbType
return integer

$quoteIdType protected_oe property

ID quote type
protected int $quoteIdType
return integer

$sql protected_oe property

SQL statement
protected string $sql
return string

$table protected_oe property

Current table
protected string $table
return string