PrependCondition
Function: PrependCondition()
PrependCondition(
query?,condition?):string
Defined in: packages/ql/src/query.ts:315
Prepend a condition to an existing query string using AND logic
Parses both strings, merges them, and reconstructs the combined query.
The statement head (SELECT fields, DELETE, UPDATE SET ...) and the ORDER BY, LIMIT, and OFFSET clauses
of the original query are preserved; the condition joins the WHERE part. Both sides keep their own grouping:
a OR b merged with c OR d is ( a OR b ) AND ( c OR d ).
Parameters
query?
string = ""
existing query string (a plain filter or a statement, may include ORDER BY / LIMIT / OFFSET)
condition?
string
condition to prepend (a plain filter: a statement is refused)
Returns
string
merged query string
Throws
if the condition is a statement, or adds ORDER BY / OFFSET to a DELETE or UPDATE
Example
PrependCondition("status = 'active' ORDER BY name LIMIT 10", "age > 18")
// => 'status = "active" AND age > 18 ORDER BY name LIMIT 10'