The Run SQL statement policy item can be used to run an SQL statement on a chosen database. This could be a query, or an insert, update, deletion etc. of information to the database.
The most common use for the Run SQL statement policy item is to perform a SQL query to a database, in order to compare the value of selected event data against a set of values in the database. This works by configuring a suitable SQL query (based on the event data values) to send to the database. If the records returned by the database contains a value, then it is considered a match has been found, and the evaluation of the Run SQL statement item will return true (Yes). If the recordset is empty, then the submitted event data value does not exist in the database, and so the Run SQL statement item will return false (No).
The example below shows how a possible SQL query could be constructed.
Using the event data that provides the requesting clients IP address {{Session.ClientIP}}, a SQL query could be made to see if this value is stored in the allowed_ip field of the ip_check table of the database. The result set returned from the database can then be used to determine the correct path of continuation for policy evaluation.
i.e. If there is a recordset returned with a corresponding value, then it is true that the clients IP address is in the ip_check table. If the recordset returned is empty then the client IP is not in the table.
Complex SQL queries can be constructed from more then one piece of event data to provide greater definition of what type of records should be returned for the Run SQL statement item.
Since databases can store vast amounts of information, the possibilities for setting up database tables with configured values such as Banned URLs, Allowed IP addresses, allowed user names, specific strings or numbers, are almost unlimited.
Setting any other type of SQL statement in the Run SQL statement policy item, such as an UPDATE, INSERT, or DELETE will always return True (Yes) since it is not making a query for existing values in the database.
©2012 Qbik New Zealand Limited
no comments yet...
You can use basic Full-Text Searches against the page title and body to find matching articles. Use the following search modifiers to refine your query:
You can create a new account or reset your password at forum.wingate.com.