1. A computer implemented method of generating a database query based on a query template comprising a plurality of query language keywords, a plurality of variables, and a plurality of template-tokens, the method comprising: receiving at a computing device one or more values each associated with a respective one of the plurality of variables; and transforming the query template into the database query based on the one or more values, the plurality of variables, and the plurality of template-tokens, wherein the template-tokens include an optional-section-token defining a query-template-section and associated with one or more of the plurality of variables, and wherein transforming the template query into the database query comprises: processing each of said plurality of template-tokens, said processing including determining whether the template-token being processed is an optional-section token; in response to a determination that the template-token being processed is not an optional-section-token, replacing the token with a portion of a database query; in response to a determination that the template-token being processed is an optional-section token, determining whether all of said plurality of variables associated with the query-template section are associated with a null value; replacing the token with a portion of a database query based on a value of one or more variables from among said plurality of variables associated with the query-template section in response to determining that not all of said plurality of variables associated with the query-template section are associated with a null value; and omitting the query-template-section from the database query in response to determining that all of said plurality of variables associated with the query-template section are associated with a null value.