Skip to content
/ sqlcw Public

SQL Code Wrapper: A lightweight preprocessor for embedding SQL code in host programming languages

License

Notifications You must be signed in to change notification settings

peter277/sqlcw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LOGO

sqlcw - SQL Code Wrapper

A lightweight preprocessor for embedding SQL code in host programming languages

sqlcw wraps SQL statements with configurable prefix and suffix strings, making it easy to embed SQL in C++, Python, or other languages. For example, wrapping with prefix execute( and suffix ) by cnxn; transforms standalone SQL into ready-to-use function calls.

The tool is SQL syntax-aware and correctly handles quoted strings, identifiers, and comments. Additional options allow you to strip or convert comments and simplify whitespace.

Usage

sqlcw is invoked from the command line. Run with sqlcw --help to see all available program options:

Options:

Generic:
  -v [ --version ]                   Print version string
  -h [ --help ]                      Display this help information

Configuration:
  -p [ --prefix ] arg                Prefix to place before SQL statements
  -s [ --suffix ] arg                Suffix to place after SQL statements
  -t [ --top ] arg                   Header to place at top of output files
  -b [ --bottom ] arg                Footer to place at bottom of output files
  -o [ --out-dir ] arg (=sqlcw-out)  Directory to write output files
  -x [ --out-ext ] arg               Extension of output files
  -m [ --comments ] arg (=convert)   Handling of comments: 'strip' or 'convert'
                                     to /* */ style
  -w [ --whitespace ] arg            Whitespace processing switches list
                                     (multitoken option). Values:
                                       single: compress multiple whitespace
                                               characters into one (excl.
                                               newline)
                                       nonewline: strip off newlines from
                                                  output
  --strip-semicolons                 Strip semicolons from SQL statements

License

sqlcw is distributed under the MIT License. See the license file for full details and third-party attributions.

About

SQL Code Wrapper: A lightweight preprocessor for embedding SQL code in host programming languages

Topics

Resources

License

Stars

Watchers

Forks