.

DBWhere Class Reference
[Model]

A DB Where representation. More...

Inheritance diagram for DBWhere:
IDBWhere DBJoinCondition DBWhereFulltext

List of all members.

Public Member Functions

  __construct (IDBTable $table, $column, $operator=null, $value=null, $mode=IDBWhere::LOGIC_AND)
  Constructor.
  get_column ()
  Returns column.
  get_logical_operator ()
  Return logical operator (AND or OR).
  get_operator ()
  Returns the operator (=, >=, LIKe etc.
  get_sql ()
  Return SQL fragment.
  get_table ()
  Returns table assigned.
  get_value ()
  Returns the value.

Protected Member Functions

  prefix_table_name ($column, $table)
  Prefix column with table name.

Protected Attributes

  $column
  $logical_operator
  $operator
  $table
  $value

Detailed Description

A DB Where representation.

Author:
Gerd Riesselmann

Definition at line 8 of file dbwhere.cls.php.


Constructor & Destructor Documentation

DBWhere::__construct ( IDBTable table,
column,
operator = null,
value = null,
mode = IDBWhere::LOGIC_AND  
)

Constructor.

Parameters:
IDBTable  $table Table that contains column
string  $column Column to query upon, or a full sql where statement
string  $operator Operator to execute
mixed  $value Value(s) to use string Either IDBWhere::LOGIC_AND or IDBWhere::LOGIC_OR

Reimplemented in DBWhereFulltext.

Definition at line 24 of file dbwhere.cls.php.

00024                                                                                                                           {
00025                 $this->table = $table;
00026                 $this->column = $column;
00027                 $this->operator = strtoupper(trim($operator)); // $operator is ASCII
00028                 $this->value = $value;
00029                 $this->logical_operator = $mode;
00030         }

Member Function Documentation

DBWhere::get_column (  ) 

Returns column.

May also be null.

Returns:
string

Implements IDBWhere.

Definition at line 56 of file dbwhere.cls.php.

00056                                      {
00057                 return $this->column;
00058         }
DBWhere::get_logical_operator (  ) 

Return logical operator (AND or OR).

Returns:
string

Implements IDBWhere.

Definition at line 83 of file dbwhere.cls.php.

00083                                                {
00084                 return $this->logical_operator;
00085         }
DBWhere::get_operator (  ) 

Returns the operator (=, >=, LIKe etc.

) May also be NULL

Returns:
string

Implements IDBWhere.

Definition at line 65 of file dbwhere.cls.php.

00065                                        {
00066                 return $this->operator;
00067         }
DBWhere::get_sql (  ) 

Return SQL fragment.

Returns:
string

Definition at line 37 of file dbwhere.cls.php.

00037                                   {
00038                 $sqlbuilder = DBSqlBuilderFactory::create_builder(DBSqlBuilderFactory::WHERE, $this);
00039                 return $sqlbuilder->get_sql();
00040         }
DBWhere::get_table (  ) 

Returns table assigned.

Returns:
IDBTable

Implements IDBWhere.

Definition at line 47 of file dbwhere.cls.php.

00047                                     {
00048                 return $this->table;
00049         }
DBWhere::get_value (  ) 

Returns the value.

May also be NULL

Returns:
mixed

Implements IDBWhere.

Definition at line 74 of file dbwhere.cls.php.

00074                                     {
00075                 return $this->value;
00076         }
DBWhere::prefix_table_name ( column,
table  
) [protected]

Prefix column with table name.

Parameters:
string  $column
IDBTable|string  $table
Returns:
string

Definition at line 94 of file dbwhere.cls.php.

00094                                                               {
00095                 $ret = $column;
00096                 if (!String::contains($column, '.')) {
00097                         if ($table instanceof IDBTable) {
00098                                 $ret = DB::escape_database_entity($column, $table->get_table_driver(), IDBDriver::FIELD); 
00099                                 if ($table->get_table_field($column)) {
00100                                         $ret = $table->get_table_alias_escaped() . '.' . $ret;
00101                                 }
00102                         }
00103                         else {
00104                                 $ret = DB::escape_database_entity($column, DB::DEFAULT_CONNECTION, IDBDriver::FIELD);
00105                         }
00106                 }
00107                 return $ret;
00108         }

Member Data Documentation

DBWhere::$column [protected]

Definition at line 10 of file dbwhere.cls.php.

DBWhere::$logical_operator [protected]

Definition at line 13 of file dbwhere.cls.php.

DBWhere::$operator [protected]

Definition at line 11 of file dbwhere.cls.php.

DBWhere::$table [protected]

Definition at line 9 of file dbwhere.cls.php.

DBWhere::$value [protected]

Definition at line 12 of file dbwhere.cls.php.


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