Class tgcSqlBuilder

Description

Class that helps you to generate sql-statements without handling string concatenation.

Class that helps you to generate sql-statements without handling string concatenation.

Located in /tgcSqlBuilder.php (line 178)


	
			
Direct descendents
Class Description
 class tgcSqlBuilder_Select Subclass of tgcSqlBuilder that helps to create SELECT sql-statements.
 class tgcSqlBuilder_Insert Subclass of tgcSqlBuilder that helps to create INSERT sql-statements.
 class tgcSqlBuilder_Delete Subclass of tgcSqlBuilder that helps to create DELETE sql-statements.
 class tgcSqlBuilder_Update Subclass of tgcSqlBuilder that helps to create UPDATE sql-statements.
Method Summary
 mixed tgcSqlBuilder (object &$dbc)
 void addTable (string $tableName, [string $alias = null])
 mixed escape (mixed $var)
 string generateQuery ()
 void removeTable ([string $tableName = null])
 void reset ()
Methods
Constructor tgcSqlBuilder (line 209)

Constructor

Constructor

  • return: PEAR_Error or an sqlBuilder object
  • access: public
mixed tgcSqlBuilder (object &$dbc)
  • object $dbc: PEAR::DB connection object
addTable (line 228)

Add the statements table.

Add the statements table.


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

  • access: public
void addTable (string $tableName, [string $alias = null])
  • string $tableName: tablename
  • string $alias: aliasname

Redefined in descendants as:
escape (line 291)

Escapes a variable appropriate for the used database-system.

Escapes a variable appropriate for the used database-system.

  • return: escaped variable
  • access: public
mixed escape (mixed $var)
  • mixed $var: variable you want to be escaped
generateQuery (line 280)

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_Select($dbc);
2 $query = $sql->generateQuery();

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

Redefined in descendants as:
removeTable (line 252)

Remove one or all tablename(s).

Remove one or all tablename(s). If you specify a tablename, then this one will be removed. If you don't specify a param, then all tablenames will be removed.


1 // remove a specific tablename
2 $sql = new tgcSqlBuilder_Select($dbc);
3 $sql->removeTable('users');
4
5 // remove all tablenames
6 $sql = new tgcSqlBuilder_Select($dbc);
7 $sql->removeTable();

  • access: public
void removeTable ([string $tableName = null])
  • string $tableName: tablename

Redefined in descendants as:
reset (line 302)

Reset the object's whole information.

Reset the object's whole information.

  • abstract:
  • access: public
void reset ()

Redefined in descendants as:

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