Class tgcSqlBuilder_Delete

Description

Subclass of tgcSqlBuilder that helps to create DELETE sql-statements.

Subclass of tgcSqlBuilder that helps to create DELETE sql-statements.

Located in /tgcSqlBuilder/Delete.php (line 22)

tgcSqlBuilder
   |
   --tgcSqlBuilder_Delete
Method Summary
 tgcSqlBuilder_Delete tgcSqlBuilder_Delete (object &$dbc)
 void addOrderBy (string $table, [string $column = null], [string $direction = null])
 void addRawWhere (string $statement, [string $logic = SQLBUILDER_LOGICAL_AND])
 void addTable (string $tableName)
 void addWhere (string $table, string $column, mixed $value, [string $compOp = null], [string $logic = null])
 string generateQuery ()
 mixed removeOrderBy ([string $table = null], [string $column = null])
 void removeRawWhere ([string $logic = null])
 void removeTable ()
 mixed removeWhere ([string $table = null], [string $column = null], [string $logic = null])
 void reset ()
 void setLimit (int $rows, int $offset)
 void unsetLimit ()
Methods
Constructor tgcSqlBuilder_Delete (line 134)

Constructor

Constructor

  • access: public
tgcSqlBuilder_Delete tgcSqlBuilder_Delete (object &$dbc)
  • object $dbc: PEAR::DB connection object
addOrderBy (line 234)

Add an ORDER BY setting.

Add an ORDER BY setting. The parameter $direction can be either SQLBUILDER_ORDER_ASC or SQLBUILDER_ORDER_DESC. If none is specified, then SQLBUILDER_ORDER_ASC will be used. You can also leave $column null, if you want to order by an alias.


1 $sql = new tgcSqlBuilder_Delete($dbc);
2
3 // ... ORDER BY alias1 ASC ...
4 $sql->addOrderBy('alias1');
5
6 // ... ORDER BY alias2 DESC ...
7 $sql->addOrderBy('alias2', null, SQLBUILDER_ORDER_DESC);
If a setting for this table/column exists, it will be overwritten.

  • access: public
void addOrderBy (string $table, [string $column = null], [string $direction = null])
  • string $table: tablename
  • string $column: columnname
  • string $direction: oder direction
addRawWhere (line 411)

Add a raw WHERE statement.

Add a raw WHERE statement. You can add a raw WHERE statement and define a logical operator. As default this is the logical AND.

  • access: public
void addRawWhere (string $statement, [string $logic = SQLBUILDER_LOGICAL_AND])
  • string $statement: raw WHERE statement
  • string $logic: SQLBUILDER_LOGICAL_AND or SQLBUILDER_LOGICAL_OR
addTable (line 195)

Add the statements table.

Add the statements table. If you call this method twice, the tablename that was set in first call will be overwritten.


1 $sql = new tgcSqlBuilder_Delete($dbc);
2 $sql->addTable('users');
3

  • access: public
void addTable (string $tableName)
  • string $tableName: tablename

Redefinition of:
tgcSqlBuilder::addTable()
Add the statements table.
addWhere (line 344)

Add a WHERE statement.

Add a WHERE statement. Possible comparison operators are: SQLBUILDER_COMP_EQUAL, SQLBUILDER_COMP_NOT_EQUAL, SQLBUILDER_COMP_LESSER_THAN, SQLBUILDER_COMP_LESSER_EQUAL, SQLBUILDER_COMP_GREATER_EQUAL, SQLBUILDER_COMP_GREATER_THAN, SQLBUILDER_COMP_STARTSWITH, SQLBUILDER_COMP_CONTAINS, SQLBUILDER_COMP_ENDSWITH, SQLBUILDER_COMP_BETWEEN If none is specified then SQLBUILDER_COMP_EQUAL will be used. Possible logical expressions are: SQLBUILDER_LOGICAL_AND, SQLBUILDER_LOGICAL_OR If none is specified, then SQLBUILDER_LOGICAL_AND will be used. When you are using SQLBUILDER_COMP_BETWEEN, then specify $values as a numerical array with two values in correct order.

  • access: public
void addWhere (string $table, string $column, mixed $value, [string $compOp = null], [string $logic = null])
  • string $table: tablename
  • string $column: columnname
  • mixed $value: value(s)
  • string $compOp: comparison operator
  • string $logic: logical linkup
generateQuery (line 152)

Generate the sql-statement.

Generate the sql-statement. This method generates a query based on the object-information and returns it as a string.


1 $sql = new tgcSqlBuilder_Delete($dbc);
2 $query = $sql->generateQuery();

  • return: sql-statement
  • access: public
string generateQuery ()

Redefinition of:
tgcSqlBuilder::generateQuery()
Generate the sql-statement.
removeOrderBy (line 278)

Remove an ORDER BY setting.

Remove an ORDER BY setting. If you don't specify any parameter, then all ORDER BY information will be removed. If you specify a tablename and a columnname, then this specific ORDER BY setting will be removed.

  • return: true on success or PEAR_Error (possible error(s): SQLBUILDER_ERROR_INVALID_PARAM_COMBO)
  • access: public
mixed removeOrderBy ([string $table = null], [string $column = null])
  • string $table: tablename
  • string $column: columnname
removeRawWhere (line 422)

Remove the raw WHERE statements, that have been stored so far.

Remove the raw WHERE statements, that have been stored so far.

  • access: public
void removeRawWhere ([string $logic = null])
  • string $logic: SQLBUILDER_LOGICAL_AND or SQLBUILDER_LOGICAL_OR
removeTable (line 205)

Remove the tablename.

Remove the tablename.

  • access: public
void removeTable ()

Redefinition of:
tgcSqlBuilder::removeTable()
Remove one or all tablename(s).
removeWhere (line 361)

Remove a WHERE statement.

Remove a WHERE statement. If you don't specify any parameter, then all WHERE information will be removed. If you specify a tablename and a columnname, then this specific ORDER BY setting will be removed.

  • return: true on success or PEAR_Error (possible error(s): SQLBUILDER_ERROR_INVALID_PARAM_COMBO)
  • access: public
mixed removeWhere ([string $table = null], [string $column = null], [string $logic = null])
  • string $table: tablename
  • string $column: columnname
  • string $logic: logical operation (possible values: SQLBUILDER_LOGICAL_AND, SQLBUILDER_LOGICAL_OR)
reset (line 393)

Reset the object's whole information.

Reset the object's whole information.

  • access: public
void reset ()

Redefinition of:
tgcSqlBuilder::reset()
Reset the object's whole information.
setLimit (line 373)

Set the LIMIT for the sql-statement.

Set the LIMIT for the sql-statement.

  • access: public
void setLimit (int $rows, int $offset)
  • int $offset: offset
  • int $rows: rows
unsetLimit (line 383)

Remove the LIMIT for the sql-statement.

Remove the LIMIT for the sql-statement.

  • access: public
void unsetLimit ()

Inherited Methods

Inherited From tgcSqlBuilder

 tgcSqlBuilder::tgcSqlBuilder()
 tgcSqlBuilder::addTable()
 tgcSqlBuilder::escape()
 tgcSqlBuilder::generateQuery()
 tgcSqlBuilder::removeTable()
 tgcSqlBuilder::reset()

Documentation generated on Fri, 19 Nov 2004 23:54:02 +0100 by phpDocumentor 1.2.3