Class: searchQuery

app.searchQuery()

new searchQuery()

Search Query object to validate user input for SQL queries. Contains a list of all used parameters for all queries. User input is compared to this parameters, and validated. Data members of this object are guaranteed to be valid. Applies %% wrapping when appropriate.
Source:

Members

(static) contains :Array.<string>

Array of all ingredients which must be required by a drink
Type:
  • Array.<string>
Source:

(static) drinkId :number

ID of the drink, but with different validation. Defaults to 0.
Type:
  • number
Source:

(static) glass :string

ID of the glass drink must be drunk from "" for any glass.
Type:
  • string
Source:

(static) id :string

ID of the drink "" for any drink.
Type:
  • string
Source:

(static) isSweet :string

If a drink contains a sweet ingredient. "1" for sweet. "0" for savoury. "" for either or anything.
Type:
  • string
Source:

(static) liquor :string

If a drink contains a liquor or liquer. "1" for liquor. "0" for liquer. "" for either or anything.
Type:
  • string
Source:

(static) mixMethod :string

Method of mixing drink. Can be either "shaken" or "stirred". "" for either.
Type:
  • string
Source:

(static) name :string

Name (used mainly for drink name, but can also refer to ingredient names)
Type:
  • string
Source:

(static) onIce :string

If a drink is on the rocks. "1" for ice. "0" for no ice. "" for either.
Type:
  • string
Source:

(static) orderedBy :string

User who ordered a drink
Type:
  • string
Source:

(static) percentage :number

Minimum alcohol percentage. Defaults to 0.
Type:
  • number
Source:

(static) price :number

Maximum drink price Defaults to 100.
Type:
  • number
Source:

(static) rating :number

Minimum drink rating Defaults to 0.
Type:
  • number
Source:

(static) userDob :string

Date of birth of person ordering drink. Defaults to Jan 1st 1970.
Type:
  • string
Source:

(static) userName :string

Username of person ordering drink. Defaults to Unknown Name
Type:
  • string
Source:

Methods

(static) getArgs() → {Array.<string>}

Generates an appropriate ordered list of parameters for the advanced search query.
Source:
Returns:
Ordered list of SQL parameters
Type
Array.<string>

(static) reset()

Resets all string datamembers to empty
Source:

(static) sanitzize()

Where the magic happens. Iterates over all datamembers and applies both general and specific sanitzization. Inputs still must be injected via a prepared statement.
Source:

(static) update(params)

Adds all given parameters of params as datamembers In practice this updates datamembers with all recognizable attributes in the given object. This means that extra clutter will not be injected.
Parameters:
Name Type Description
params object Object of key/value pairs to record.
Source: