org.mmbase.storage.search
Interface FunctionValueConstraint

All Superinterfaces:
Constraint, FieldCompareConstraint, FieldConstraint
All Known Implementing Classes:
BasicFunctionValueConstraint

public interface FunctionValueConstraint
extends FieldCompareConstraint

This class can solve the following. = PROBLEM == The following query will be fired upon the database when somebody tries to login: 8000ms: SELECT otype,owner,number,firstname,account,lastname,email,description,password FROM vpro4_users users WHERE lowerEmail(email)='' AND lowerEmail(password)='' The lower-function is slowing down the login-procedure, because the lower-function will force a sequential-scan. So an functional index should be used to query the table, but informix can't put an index on a table with a function which is not variant; -= SOLUTION =- Use a wrapper to facilitate the variant version of lower and use this to query the database. Squirrel-the-database-client seems to have a problem with these kinds of queries; use the utility classes in cinema-importers -> importer -> CreateProcedure - create an notvariant function of lower: javac CreateProcedure.java && java -cp /usr/local/SQuirreL\ SQL\ Client/lib/ifxjdbc.jar:. CreateProcedure CREATE FUNCTION lowerNotVariant(field VARCHAR(255)) RETURNING VARCHAR(255) WITH (NOT VARIANT); RETURN LOWER(field); END FUNCTION; - set an index on the field to be queried: CREATE INDEX vpro4_users_email_lower on vpro4_users(lowerNotVaraint(email)); - now query the table with full-speed: 33ms: SELECT otype,owner,number,firstname,account,lastname,email,description,password FROM vpro4_users users WHERE lowerNotVariant(email)='' AND lowerNotVariant(password)='' README.txt (END)

Since:
MMBase-1.8.5
Version:
$Id: FunctionValueConstraint.java 41186 2010-02-26 17:54:31Z michiel $
Author:
Marcel Maatkamp

Field Summary
 
Fields inherited from interface org.mmbase.storage.search.FieldCompareConstraint
EQUAL, GREATER, GREATER_EQUAL, LESS, LESS_EQUAL, LIKE, NOT_EQUAL, OPERATOR_DESCRIPTIONS, REGEXP
 
Method Summary
 String getFunction()
           
 Object getValue()
          Gets the value to compare with.
 String toString()
          Returns a string representation of this FunctionValueConstraint.
 
Methods inherited from interface org.mmbase.storage.search.FieldCompareConstraint
getOperator
 
Methods inherited from interface org.mmbase.storage.search.FieldConstraint
getField, isCaseSensitive, matches
 
Methods inherited from interface org.mmbase.storage.search.Constraint
equals, getBasicSupportLevel, hashCode, isInverse, setUnmodifiable
 

Method Detail

getFunction

String getFunction()

getValue

Object getValue()
Gets the value to compare with. Depending on the field type, the value is of type String or Number.

If the associated field type is of string type, when used in combination with the operator LIKE, this may contain the following wildcard characters as well:


toString

String toString()
Returns a string representation of this FunctionValueConstraint. The string representation has the form "FunctionValueConstraint(inverse:<:inverse>, field:<field>, casesensitive:<casesensitive>, operator:<operator>, value:<value>)" where

Overrides:
toString in class Object
Returns:
A string representation of this FunctionValueConstraint.


MMBase 2.0-SNAPSHOT - null