PhpMyObject
[ class tree: PhpMyObject ] [ index: PhpMyObject ] [ all elements ]

Class: PMO_MyRequest

Source Location: /fichiers/v0.15/PMO_core/PMO_MyRequest.php

Class Overview


This class is used to provide a SQL query to PMO_MyController


Implements interfaces:

Variables

Methods



Class Details

[line 72]
This class is used to provide a SQL query to PMO_MyController

You provide the different parts of the query by using the corresponding methods. Each method returns the PMO_MyRequest object which allows you to link the methods together, e.g.

  1.  $request new PMO_MyRequest;
  2.  $request->field('film_id')->from('film_actor')->limit('10')
  3.  $controller new PMO_MyController;
  4.  $map $cntroller->objectquery($request)

This could also be written like this:

  1.  $controller new PMO_MyController;
  2.  $request new PMO_MyRequest;
  3.  $controller->objectquery($request->field('film_id')->from('film_actor')->limit('10'));

Most methods accept a variable number of arguments. So you can do something like this:

  1.  $request new PMO_MyRequest;
  2.  $request->field('film_id','actor_id')->from('film_actor')->limit('10')




[ Top ]


Class Variables

$field =

[line 82]

the SQL query fields

if none is provided, a SELECT * will be performed.




Tags:

access:  protected

Type:   array


[ Top ]

$from =

[line 90]

the table names of the query



Tags:

access:  protected

Type:   array


[ Top ]

$groupby =

[line 130]

the groupby clause



Tags:

access:  protected

Type:   array


[ Top ]

$having =

[line 114]

the having clause



Tags:

access:  protected

Type:   array


[ Top ]

$limit =

[line 122]

the limit clause



Tags:

access:  protected

Type:   array


[ Top ]

$order =

[line 106]

the order clause



Tags:

access:  protected

Type:   array


[ Top ]

$where =

[line 98]

the where clause of the query



Tags:

access:  protected

Type:   array


[ Top ]



Class Methods


constructor __construct [line 132]

PMO_MyRequest __construct( )



Tags:

access:  public


[ Top ]

method field [line 155]

void field( $field, string $field,...)

stores the provided column names from which data will be read.

This method accepts a variable number of arguments.

  1.  $request new PMO_MyRequest;
  2.  $request->field('column1''column2')->from('mytable');

If you do not provide column names, a "SELECT *" will be performed.




Tags:

access:  public



Implementation of:
PMO_Request::field()
the implementation must store the passed $field arguments in the PMO_MyRequest::$field property and return the object itself.

Parameters:

string   $field,...   any number of column names you want to read
   $field  

[ Top ]

method from [line 173]

void from( $from, string $from,...)

stores the table names on which the request is going to be run

This method accepts a variable number of arguments.

  1.  $request new PMO_MyRequest;
  2.  $request->field('column1''column2')->from('mytable1''mytable2');




Tags:

access:  public



Implementation of:
PMO_Request::from()
the implementation must store the passed $from arguments in the PMO_MyRequest::$from property and return the object itself.

Parameters:

string   $from,...   any number of table names you want to read from
   $from  

[ Top ]

method getLinked [line 307]

void getLinked( )



Tags:

access:  public


[ Top ]

method groupby [line 237]

void groupby( $groupby, string $groupby,...)

stores the groupby clause



Tags:

access:  public


Parameters:

string   $groupby,...   the groupby clause
   $groupby  

[ Top ]

method having [line 226]

void having( $having, string $having,...)

stores the having clause



Tags:

access:  public



Implementation of:
PMO_Request::having()
the implementation must store the passed $having arguments in the PMO_MyRequest::$having array and return the object itself.

Parameters:

string   $having,...   the having clause
   $having  

[ Top ]

method limit [line 247]

void limit( string|integer $limit)

stores the limit clause



Tags:

access:  public



Implementation of:
PMO_Request::limit()
the implementation must store the passed $limit argument in the PMO_MyRequest::$limit property.

Parameters:

string|integer   $limit   the limit you want to impose to your query

[ Top ]

method order [line 215]

void order( $order, string $order,...)

store the order clause using the provided $order parameter

This method accepts a variable number of arguments. You create the order clause by providing the field names.

  1.  $request new PMO_MyRequest;
  2.  $request->from('MyTable')->where('active = 1')->order('lastname','firstname');




Tags:

access:  public



Implementation of:
PMO_Request::order()
the implementation must store the passed $order arguments in the PMO_MyRequest::$order property and return the object itself.

Parameters:

string   $order,...   the order field name
   $order  

[ Top ]

method reset [line 298]

void reset( )

resets the PMO_MyRequest object so that it can reused



Tags:

access:  public



Implementation of:
PMO_Request::reset()
the implementation must reset the object
[ Top ]

method toString [line 263]

string toString( )

Build the actual SQL query using all the previoulsy provided parts

You should not need to use this directly. Since the PMO_MyController::objectquery() takes a PMO_MyRequest object and use this method to call {@see PMO_MyController::query()}




Tags:

return:  the SQL query
todo:  implement having
access:  public



Implementation of:
PMO_Request::toString()
the implementation must create the SQL query using the stored values.
[ Top ]

method where [line 196]

void where( $where, string $where,...)

stores the where clause

This method accepts a variable number of arguments. You create the where clause by providing conditions.

  1.  $request new PMO_MyRequest;
  2.  $request->from('MyTable')->where('name = "value"''active = 1');

toString() will create your where clause by linking them with the 'AND' keyword.




Tags:

access:  public



Implementation of:
PMO_Request::where()
the implementation must store the passed $where arguments in the PMO_MyRequest::$where property and return the object itself

Parameters:

string   $where,...   any number of conditions to build your where clause with
   $where  

[ Top ]


Documentation generated on Wed, 15 Oct 2008 09:17:44 -0400 by phpDocumentor 1.4.1