arsd.querygenerator

Create SQL queries from string containing D expressions.

This module allows you to generate SQL from a template, containing D expressions. Depending on these expressions parts of the template will be included in the SQL or not.

Members

Functions

createQuery
CreatedQuery createQuery(StructT data_, Params params)

Uses createQueryGenerator for actually doing the job. data_ will be made available with D's 'with' statement to the embedded code in queryString. So you can access the elements just as regular variables.

createQueryGenerator
string createQueryGenerator(string preSql)

* This method generates D code from the preSql data, which can be mixed in for generating the resulting sql and the resulting Variant[] array. * The variable sql_ will contain the generated SQL. * The variable args_ is the Variant[] array. * Use createQuery for directly generating the resulting SQL and args. * Params: * preSql = The to be processed SQL containing D expressions in #{} blocks, sub blocks in {} and declarations in ${}. * Returns: D code which can be mixed in.

Structs

CreatedQuery
struct CreatedQuery

The generated query + args.

Bugs

Unicode not really supported. I haven't really explored that yet, but I believe that at the moment string processing will fail for multibyte utf-8 characters in the input string.

Meta

Authors

Robert Klotzner, robert.klotzner at gmail.com

Date

Date: January 7, 2013

License

GNU General Public License version 3 <http://www.gnu.org/licenses/>