693 B
693 B
Query API
Raw SQL is available via api.query() with parameter binding.
Execute
int rows = api.query().execute(
"UPDATE players SET level = level + 1 WHERE id = ?",
java.util.Collections.singletonList(1)
);
Query
List<String> names = api.query().query(
"SELECT name FROM players WHERE level >= ?",
java.util.Collections.singletonList(10),
rs -> rs.getString("name")
);
Transactions
try (Transaction tx = api.beginTransaction()) {
tx.execute("UPDATE players SET level = level + 1 WHERE id = ?", java.util.Collections.singletonList(1));
tx.commit();
} catch (Exception ex) {
// rollback on error if needed
}