OXY API 1.0
OXY API Library Documentation
Loading...
Searching...
No Matches
sql_generator.hpp File Reference

SQL emission for the query AST over JSON columns for multiple SQL dialects. More...

Classes

 Configuration structure for SQL database interactions. More...
 Emits SQL WHERE clauses or SELECT statements for a parsed query AST. More...

Namespaces

namespace  oxy
 This root namespace contains the common types and operations for the OXY-API library.
namespace  oxy::core
 This namespace contains core types and operations for the OXY-API library.

Enumerations

enum class  oxy::core::metadata::SqlDialect {
  SQLite , MySQL , MariaDB , PostgreSQL ,
  SQLite , MySQL , MariaDB , PostgreSQL
}

Detailed Description

SQL emission for the query AST over JSON columns for multiple SQL dialects.

Features:

  • Supports SQLite, MySQL, MariaDB, PostgreSQL dialect-specific JSON extraction.
  • Field types:
    • Scalar (strings, numbers)
    • Array membership (configured globally or per dotted name)
    • ISO 8601 datetimes (configured per dotted name; conversion for ordering / equality)
  • Operators: =, !=, <, <=, >, >=, like (LIKE adds ESCAPE '\' for literal %/_ when supported).
  • Numeric detection via JSON number lexical rules (only if value is unquoted).
  • Datetime conversion:
    • SQLite: unixepoch(...) with fallback for 'T' vs space separator.
    • MySQL/MariaDB: COALESCE over several STR_TO_DATE patterns (both 'T' and space, with/without fraction, with optional trailing Z).
    • PostgreSQL: text cast to timestamptz (::timestamptz).

Configuration knobs in SqlConfig allow selecting arrays, datetimes, and jsonb casting.

Enumeration Type Documentation

◆ SqlDialect

Enumerator
SQLite 

SQLite using json_extract and json_each

MySQL 

MySQL using JSON_EXTRACT, JSON_CONTAINS, JSON_SEARCH

MariaDB 

MariaDB with MySQL-compatible JSON functions

PostgreSQL 

PostgreSQL with ->, ->>, jsonb operators