CreateQuery Class
Create a new truncate query
$tables = $db->create('users')
->fields(
"msgid
mediumint(8) unsigned NOT NULL AUTO_INCREMENT",
"parent
mediumint(8) unsigned NOT NULL DEFAULT '0'",
"subject
varchar(255) NOT NULL DEFAULT ''",
)
->primaryKey('msgid')
->fulltextKey('subject')
->result();
Constructor
Item Index
Methods
Methods
__toString
()
String
Represent the query as a SQL statement
Returns:
The query in SQL string form
charset
-
charset
Define the character set to use on table
Parameters:
-
charset
StringThe name of the charset
Returns:
Instance of this call for chaining
collate
-
collate
Define the character set collate to use on table
Parameters:
-
collate
StringThe name of the collate
Returns:
Instance of this call for chaining
engine
-
engine
Set the engine type
Parameters:
-
engine
StringThe name of the engine to use for talbe
Returns:
Instance of this call for chaining
field
-
fieldName
-
The
-
[isNull=true]
-
[default]
-
[autoIncrement=false]
Add a single field by name and properties
Parameters:
Returns:
Instance of this call for chaining
fields
-
fields
Add a collection of fields
Parameters:
-
fields
String multipleAdd a n-number of string arguments
Returns:
Instance of this call for chaining
fulltextKey
-
fieldName
Create a fulltext key on the table
Parameters:
-
fieldName
StringThe name of the field
Returns:
Instance of this call for chaining
internalKey
-
fieldName
-
[type='']
Internal method to create a key on the query
Parameters:
Returns:
Instance of this call for chaining
key
-
fieldName
Create a key on the table, this is non-unique and non-primary
Parameters:
-
fieldName
StringThe name of the field
Returns:
Instance of this call for chaining
limit
-
lengthOrIndex
-
[duration=null]
The limit for query
Parameters:
-
lengthOrIndex
IntEither the single limit number or index, duration
-
[duration=null]
Int optionalHow many rows to fetch
Returns:
The instance of this query
orderBy
-
field
-
[order='asc']
How to order the results by
Parameters:
Returns:
The instance of this query
prepare
-
value
Take an existing value we're about to input and escape it, if needed
Parameters:
-
value
StringA statement or sql property to evaluate
Returns:
A string of an escaped, prepared SQL property
prepareField
-
field
Take an existing field name we're about to input and
Parameters:
-
field
StringThe name of a field
Returns:
A string of an escaped, prepared SQL field name
primaryKey
-
fieldName
-
[startingValue=1]
Create a primary key on the table, this is unique and primary
Parameters:
-
fieldName
StringThe name of the field
-
[startingValue=1]
Int optionalThe starting auto increment value
Returns:
Instance of this call for chaining
set
-
fieldName
-
value
-
[isNull=true]
-
[default]
Add a character set field to the table
Parameters:
Returns:
Instance of this call for chaining
setTables
-
tables
Create and insert query
Returns:
The instance of this query
uniqueKey
-
fieldName
Create a unique key on the table, this is unique and non-primary
Parameters:
-
fieldName
StringThe name of the field
Returns:
Instance of this call for chaining
Properties
The starting auto increment amount
Default: null