Peru
Peru

Reputation: 2971

Ad Hoc Query Engine -- What is it apart from the Dynamic Query part?

I understood what "AD HOC" Query means which is dynamically generating the query at run time like this if am correct

IF (someCondition)
strSQL = "SELECT * FROM authors WHERE " & whereClause
ELSE
strSQL = "SELECT * FROM authors WHERE " & whereClause & orderbyClause

Is there something Extra major concept am missing like when working with DataWarehouse etc. Or any other link useful input will help.

Upvotes: 0

Views: 309

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1269693

An ad-hoc query engine is one that supports the full SQL language for accessing the data stored in the database. It doesn't make a difference whether the SQL is provided directly or in strings (as in your example).

Generally, it refers to complex queries on a decision support system. Ad hoc queries are frowned upon on systems that interface with lots of users or that have steady streams of data modifications.

Dynamic SQL may technically be ad hoc queries, in the sense that the string needs to be recompiled before executed. However, dynamic SQL often produces simple queries where parameterized queries would be better. Your example, for instance, is a classic example of what not to do because of SQL injection attacks.

Upvotes: 1

Related Questions