[This is preliminary documentation and is subject to change.]
An implementation of a QueryFormatter that formats queries for inclusion in
an SQL WHERE clause.
| C# | Visual Basic | Visual C++ |
public class SQLQueryFormatter : QueryFormatter
Public Class SQLQueryFormatter _ Inherits QueryFormatter
public ref class SQLQueryFormatter : public QueryFormatter
| All Members | Constructors | Methods | |||
| Icon | Member | Description |
|---|---|---|
| SQLQueryFormatterSQLQueryFormatterNew()() | ||
| GetOperator(ComparisonOperators) | Return the text that should be inserted for a logical AND operation (Overrides QueryFormatter.GetOperator(ComparisonOperators).) | |
| GetOperator(GroupOperator) | (Overrides QueryFormatter.GetOperator(GroupOperator).) | |
| RenderField(IElementDef, Object) | Return the text for a field name (Overrides QueryFormatter.RenderField(IElementDef, Object).) | |
| RenderValue(String, Object) | Return the text for a field value (Overrides QueryFormatter.RenderValue(String, Object).) |
When preparing a dictionary to be passed to the SQLQueryFormatter.format
method, the caller must map ElementDef constants to instances of the SQLField
class. The constructor to that class requires two parameters: the application-
defined name of the field, and a constant from the DbType class,
which instructs the SQLQueryFormatter how to render the field value in the
query string (e.g. strings are quoted with a single quote, numeric fields
are rendered as-is, etc.)
For example,
CopyC#
The above example might result in a string such as "( Students.US_Citizen_Bool = 0 )"
or "( Students.Foreign_ID = '898' ) OR ( Students.Last_Name = 'Cortez' AND First_Name = 'Robert' )"
IDictionary m = new Hashtable(); m[ SIFDTD.STUDENTPERSONAL_REFID ] = new SQLField( "Students.Foreign_ID", DbType.String ) ; m[ SIFDTD.NAME_LASTNAME ], new SQLField( "Students.Last_Name", DbType.String ) ; m[ SIFDTD.NAME_FIRSTNAME ], new SQLField( "First_Name", DbType.String ) ; m[ SIFDTD.DEMOGRAPHICS_CITIZENSHIPSTATUS ], new SQLField( "Students.US_Citizen_Bool{04=1,=0}", DbType.Int32 ) ;
| Object | ||
| QueryFormatter | ||
| SQLQueryFormatter | ||