Package com.google.mu.safesql


package com.google.mu.safesql
Injection-safe SQL template (requires mug-safesql artifact)

A SQL template library with:

  • Industry-strength library-enforced SQL injection safety - you cannot shoot yourself in the foot.
  • Powerful dynamic SQL capability - compose subqueries flexibly (and safe from SQL injection, again).
  • Compile-time semantic check - never worry about passing template parameters wrong.
  • Real, actual SQL that you can copy/paste - no DSL; no XML; no StringBuilder.
Example:
SafeSql sql = SafeSql.of("select id, name, age from Users where id = {id}", userId);

for (User user : sql.query(dataSource, User.class)) {
  // ...
}

Package Specification

The code is developed and tested under Java 8.0.