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

Class: SimpleWhereClause

Source Location: /flatfile.php

Class Overview

WhereClause
   |
   --SimpleWhereClause

Implements a single WHERE clause that does simple comparisons of a field with a value.


Methods


Inherited Methods

Class: WhereClause

WhereClause::testRow()
Tests a table row object

Class Details

[line 355]
Implements a single WHERE clause that does simple comparisons of a field with a value.



[ Top ]


Class Methods


constructor SimpleWhereClause [line 391]

SimpleWhereClause SimpleWhereClause( int $field, string $operator, mixed $value, [string $compare_type = STRING_COMPARISON])

Creates a new WhereClause object that does a comparison of a field and a value.

This will be the most commonly used type of WHERE clause. It can do comparisons of the sort "$tablerow[$field] operator $value" where 'operator' is one of:

  • = (equals)
  • != (not equals)
  • > (greater than)
  • < (less than)
There are 3 pre-defined constants (STRING_COMPARISON, NUMERIC COMPARISON and INTEGER_COMPARISON) that modify the behaviour of these operators to do the comparison as strings, floats and integers respectively. Howevers, these constants are just the names of functions that do the comparison (the first being the builtin function http://www.php.net/strcmp, so you can supply your own function here to customise the behaviour of this class.




Parameters:

int   $field   The index (in the table row) of the field to test
string   $operator   The comparison operator, one of "=", "!=", "<", ">"
mixed   $value   The value to compare to.
string   $compare_type   The comparison method to use - either STRING_COMPARISON (default), NUMERIC COMPARISON or INTEGER_COMPARISON

[ Top ]

method testRow [line 399]

void testRow( mixed $tablerow)



Overrides WhereClause::testRow() (Tests a table row object)

[ Top ]


Documentation generated on Mon, 7 Mar 2005 23:20:07 +0000 by phpDocumentor 1.3.0RC3