DBHelper SplitQuery Method CleanCode C# Libraries v1.2.03 API
Splits a compound query into two queries when you need to run a slightly different query because of fundamental incompatibilities.

Namespace: CleanCode.Data
Assembly: CleanCode (in CleanCode.dll) Version: (1.2.03)

public void SplitQuery(
	string compoundQuery,
	out string trueQuery,
	out string falseQuery


Type: OnlineSystem String
Instrumented query to be split
Type: OnlineSystem String 
Returned query instance on true condition.
Type: OnlineSystem String 
Returned query instance on false condition.

A typical example of this is if a new table is introduced in a later version, queries that reference that table will not be compilable in earlier versions. So this function acts as a macro pre-processor to split out the query into its two valid incantations. The query must be specially constructed, containing <IF>...<ELSE>...<END> constructs, each on a separate line. So they do not interfere with the query, each should be preceded with the comment indicator "--". Further, within the ELSE clause each line must be commented out with a comment indicator followed by a double-asterisk ("--**"). That allows the compound query to run without alteration, and is thus functionally equivalent to the returned trueQuery. Multiple instances of IF...ELSE...END may appear in the query.
See Also