GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • JavaQueryBuilder
  • Installation
  • Queries
  • SELECT
  • INSERT
  • UPDATE
  • DELETE
  • CREATE TABLE
  • Conditions
  • Subqueries
  • SQL Dialects
  • STANDARD
  • MySQL
  • SQLite

This view

  • Original page
  • New address

GeezerVison is showing ezframework.github.io — STANDARD

STANDARD Dialect

Table of contents

  1. Overview
  2. SELECT
  3. DML statements
  4. DELETE LIMIT
  5. When to use

Overview

SqlDialect.STANDARD produces ANSI-compliant SQL with no identifier quoting. It is the default dialect used by buildSql() and build() when no dialect is specified.

Feature Value
Identifier quoting None
DELETE LIMIT Not supported
ILIKE Not supported
RETURNING on DELETE Not supported

SELECT

STANDARD is the implicit default; you can pass it explicitly for clarity:

SqlResult r = new QueryBuilder()
    .from("users")
    .select("id", "name")
    .whereEquals("status", "active")
    .buildSql(SqlDialect.STANDARD);
// → SELECT id, name FROM users WHERE status = ?
// Parameters: ["active"]

// Equivalent — no dialect argument means STANDARD
SqlResult r2 = new QueryBuilder()
    .from("users")
    .whereEquals("id", 1)
    .buildSql();
// → SELECT * FROM users WHERE id = ?

DML statements

STANDARD is also the default for all DML builders when calling build() with no argument:

SqlResult insert = QueryBuilder.insertInto("orders")
    .value("product_id", 7)
    .value("qty", 2)
    .build();
// → INSERT INTO orders (product_id, qty) VALUES (?, ?)

SqlResult update = QueryBuilder.update("orders")
    .set("qty", 3)
    .whereEquals("id", 1)
    .build();
// → UPDATE orders SET qty = ? WHERE id = ?

SqlResult delete = QueryBuilder.deleteFrom("sessions")
    .whereEquals("expired", true)
    .build();
// → DELETE FROM sessions WHERE expired = ?

DELETE LIMIT

STANDARD does not support a LIMIT clause on DELETE. If a limit is set on the Query it is silently ignored:

Query q = new QueryBuilder()
    .from("sessions")
    .whereEquals("expired", true)
    .limit(500)
    .build();

SqlResult r = SqlDialect.STANDARD.renderDelete(q);
// → DELETE FROM sessions WHERE expired = ?
// (LIMIT 500 is dropped)

When to use

  • Any ANSI-compatible database that does not need quoted identifiers
  • Unit tests and integration tests where quoting does not matter
  • When you want the simplest rendered SQL for debugging
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.