Built-in Finders for Arbitrary Queries
Database mashables can include these built-in operations to handle arbitrary SQL queries for a single table or view:
findtable-nameByWhereClause:
![*](bullet.gif)
Accepts a parameter with the SQL code for a WHERE clause which can contain dynamic parameters (as
?). This can also include an ORDER BY clause at the end.
For example: "LAST_NAME LIKE ? AND DEPT_NO = ?"
![*](bullet.gif)
Accepts a second parameter with a string containing the values for all dynamic parameters in the WHERE clause. Parameters are separated by commas. They must be simple values that cannot contain commas.
For example: "L%,1020"
![*](bullet.gif)
Uses a prepared statement and thus has no risk of SQL injection attacks.
![*](bullet.gif)
Returns all columns defined for the mashable.
findtable-nameWhere:
![*](bullet.gif)
Accepts a parameter with the SQL code for a fully-specified WHERE clause. This can also include an ORDER BY clause at the end.
![*](bullet.gif)
Should be used only by users familiar with the database schema as parameters use the database SQL names for columns rather than mashable names.
![*](bullet.gif)
Executes raw SQL and thus is vulnerable to SQL injection attacks.
![*](bullet.gif)
Returns all columns defined for the mashable.
selecttable-name![*](bullet.gif)
Accepts a parameter with the SQL code for a SELECT statement for the specific table. You cannot specify other table names.
For example: "EMPLOYEE_ID, FIRST_NAME, EMAIL"
![*](bullet.gif)
Accepts a parameter with the SQL code for a fully-specified WHERE clause.
For example: "FIRST_NAME LIKE 'L%'"
![*](bullet.gif)
Should be used only by users familiar with the database schema as parameters use the database SQL names for columns rather than mashable names.
![*](bullet.gif)
Executes raw SQL and thus is vulnerable to SQL injection attacks.
![*](bullet.gif)
Can select specific columns from those defined for the mashable.
![*](bullet.gif)
Can sort results.
By default, findtable-nameWhere and selecttable-nameare not enabled when you register a database mashable. Presto administrators can disable both these operations or enable them by default individually.