Overview

Packages

  • Db
    • Adapter
    • Migration

Classes

  • Horde_Db
  • Horde_Db_Exception
  • Horde_Db_SearchParser
  • Horde_Db_StatementParser
  • Horde_Db_Value_Binary

Interfaces

  • Horde_Db_Value
  • Overview
  • Package
  • Class
  • Tree

Class Horde_Db_SearchParser

This class provides a parser which can construct an SQL WHERE clause from a Google-like search expression.

Copyright 2004-2012 Horde LLC (http://www.horde.org/)

The expression recognizes boolean "AND", "OR", and "NOT" (providing no operator between keywords implies "AND"), like so: cat and dog cat or dog cat and not dog

If no operator appears between keywords or quoted strings, "AND" is assumed. A comma can be used instead of "OR": cat dog cat, dog cat not dog

The parser recognizes parentheses, so complex expressions can be created: cat and not (dog or puppy)

Quoted strings are also recognized, and are taken as literal keywords: "cat and dog"

Parsing is designed to be as fuzzy as possible, so it shouldn't error unless people search for "AND", "OR", or "NOT" without quoting it or use unbalanced parentheses.

Package: Db
Category: Horde
License: http://www.horde.org/licenses/bsd
Author: Jason M. Felice jason.m.felice@gmail.com
Located at Horde/Db/SearchParser.php
Methods summary
public static string
# parse( string $column, string $expr )

Parses a keyword expression.

Parses a keyword expression.

Parameters

$column
<p>This is the SQL field name the resulting expression should test against.</p>
$expr
This is the keyword expression we want to parse.

Returns

string
The query expression.

Throws

Horde_Db_Exception
API documentation generated by ApiGen