Phang  2.1
 All Classes Files Functions Variables Pages
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes
Sql Class Reference

SQL builder class. More...

Inheritance diagram for Sql:
Base

List of all members.

Public Member Functions

 __construct ($sql_string=array())
 Constructor.
 set_sql ($sql_string)
 Set the SQL.
 get_array ()
 Get the SQL statement as array.
 set_order_by ($item)
 Set the ORDER BY clause.
 render ()
 Render the element as SQL string.
 __toString ()
 Automatically render.
- Public Member Functions inherited from Base
 __call ($function, $params)
 The 'magic' call method will get/set for us invoked when the interpreter can not find a method the user is asking for.
 set_parameters ($arguments)
 Set variables from an array to member fields requires $this->optional_arguments or $this->required_arguments to have been set by the subclass.

Static Public Member Functions

static to_array ($sql_string)
 Works through SQL string and parses into an array.
static array_to_sql ($array)
 Creates a SQL string from an array of statement blocks.

Public Attributes

 $select = ''
 SELECT clause.
 $from = ''
 FROM clause.
 $where = ''
 WHERE clause.
 $group_by = ''
 GROUP BY clause.
 $having = ''
 HAVING clause.
 $order_by = ''
 ORDER BY clause.
 $limit = ''
 LIMIT clause.
 $offset = ''
 OFFSET clause.

Protected Attributes

 $sql_string = ''
 the SQL string
 $sql_array = array()
 array of key-value pairs of SQL statement blocks, e.g. array('SELECT'=>'*','FROM'=>'table')
- Protected Attributes inherited from Base
 $optional_arguments = array()
 Array of options that can be set to variables.
 $required_arguments = array()
 Array of options that need to be set to variables.

Detailed Description

SQL builder class.

Assists in building, parsing and manipulating SQL statements


Constructor & Destructor Documentation

Sql::__construct (   $sql_string = array())

Constructor.

Parses SQL string if provided


Member Function Documentation

static Sql::array_to_sql (   $array)
static

Creates a SQL string from an array of statement blocks.

Parameters:
$arrayan array of key-value pairs of SQL statement blocks, e.g. array('SELECT'=>'*','FROM'=>'table')
Sql::set_sql (   $sql_string)

Set the SQL.

Parse into an array

Parameters:
$sql_stringSQL string to parse

The documentation for this class was generated from the following file: