API Documentation for: 1.1.1
Show:

TruncateQuery Class

Extends Query
Namespace: Canteen\Database

Represent the query to remove all contents of a table

$truncated = $db->truncate('users')->result();

Constructor

TruncateQuery

(
  • db
  • table
)

Parameters:

  • db Database

    Reference to the database

  • table String

    The single table name

Methods

__toString

() String

Represent the query as a SQL statement

Returns:

String:

The query in SQL string form

escape

(
  • value
)
String | Array protected

Inherited from Query:

Convenience function for escapeString method on Database

Parameters:

  • value String | Array

    The value or collection of values

Returns:

String | Array:

The value or collection of values

limit

(
  • lengthOrIndex
  • [duration=null]
)
Query

Inherited from Query:

The limit for query

Parameters:

  • lengthOrIndex Int

    Either the single limit number or index, duration

  • [duration=null] Int optional

    How many rows to fetch

Returns:

Query:

The instance of this query

orderBy

(
  • field
  • [order='asc']
)
Query

Inherited from Query:

How to order the results by

Parameters:

  • field String

    The property field

  • [order='asc'] String optional

    The order, either ASC or DESC

Returns:

Query:

The instance of this query

prepare

(
  • value
)
String protected

Inherited from Query:

Take an existing value we're about to input and escape it, if needed

Parameters:

  • value String

    A statement or sql property to evaluate

Returns:

String:

A string of an escaped, prepared SQL property

prepareField

(
  • field
)
String protected

Inherited from Query:

Take an existing field name we're about to input and

Parameters:

  • field String

    The name of a field

Returns:

String:

A string of an escaped, prepared SQL field name

result

() Boolean

Inherited from Query:

Execute the query

Returns:

Boolean:

If result was successful

setTables

(
  • tables
)
Query protected

Inherited from Query:

Create and insert query

Parameters:

  • tables Array | String multiple

    The table to insert into

Returns:

Query:

The instance of this query

where

(
  • args
)
Query

Inherited from Query:

Do a where selection

Parameters:

  • args Array | String multiple

    A single where statement or array of and statements, or list of arguments

Returns:

Query:

The instance of this query

Properties

db

Database protected

Inherited from Query:

The reference to the database connection, required!

limit

String protected

Inherited from Query:

The limit

orderBy

String protected

Inherited from Query:

The order by

tables

String protected

Inherited from Query:

The table or tables to insert into

where

String protected

Inherited from Query:

The array collection of where properties