[jOOQ/jOOQ#7539] Support for SQLDialect.CLICKHOUSE - WIP
This commit is contained in:
parent
198102a5ff
commit
9e64ec7cd7
@ -83,11 +83,39 @@ implements
|
||||
// XXX: QueryPart API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
final boolean parenthesised(Context<?> ctx) {
|
||||
switch (ctx.family()) {
|
||||
case FIREBIRD:
|
||||
case SQLITE:
|
||||
return false;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
case CLICKHOUSE:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void accept(Context<?> ctx) {
|
||||
switch (ctx.family()) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
case FIREBIRD:
|
||||
case SQLITE:
|
||||
ctx.visit(inline(""));
|
||||
@ -104,12 +132,12 @@ implements
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
case CLICKHOUSE:
|
||||
ctx.visit(function(N_currentDatabase, getDataType()));
|
||||
break;
|
||||
|
||||
default:
|
||||
ctx.visit(N_CURRENT_DATABASE).sql("()");
|
||||
ctx.visit(function(N_CURRENT_DATABASE, getDataType()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -123,8 +151,6 @@ implements
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: Query Object Model
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@ -83,8 +83,54 @@ implements
|
||||
// XXX: QueryPart API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
final boolean parenthesised(Context<?> ctx) {
|
||||
switch (ctx.family()) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
case CUBRID:
|
||||
case FIREBIRD:
|
||||
case SQLITE:
|
||||
return false;
|
||||
|
||||
case DERBY:
|
||||
return false;
|
||||
|
||||
case H2:
|
||||
return true;
|
||||
|
||||
|
||||
|
||||
case MARIADB:
|
||||
case MYSQL:
|
||||
return true;
|
||||
|
||||
case CLICKHOUSE:
|
||||
return true;
|
||||
|
||||
|
||||
|
||||
|
||||
case HSQLDB:
|
||||
case POSTGRES:
|
||||
case YUGABYTEDB:
|
||||
return false;
|
||||
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void accept(Context<?> ctx) {
|
||||
switch (ctx.family()) {
|
||||
@ -106,6 +152,8 @@ implements
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
case CUBRID:
|
||||
case FIREBIRD:
|
||||
@ -113,19 +161,24 @@ implements
|
||||
ctx.visit(inline(""));
|
||||
break;
|
||||
|
||||
case DERBY:
|
||||
case DERBY: {
|
||||
ctx.visit(K_CURRENT).sql(' ').visit(K_SCHEMA);
|
||||
break;
|
||||
}
|
||||
|
||||
case H2:
|
||||
ctx.visit(K_SCHEMA).sql("()");
|
||||
ctx.visit(function(N_SCHEMA, getDataType()));
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case MARIADB:
|
||||
case MYSQL:
|
||||
ctx.visit(K_DATABASE).sql("()");
|
||||
ctx.visit(function(N_DATABASE, getDataType()));
|
||||
break;
|
||||
|
||||
case CLICKHOUSE:
|
||||
ctx.visit(function(N_currentDatabase, getDataType()));
|
||||
break;
|
||||
|
||||
|
||||
@ -134,11 +187,11 @@ implements
|
||||
case HSQLDB:
|
||||
case POSTGRES:
|
||||
case YUGABYTEDB:
|
||||
ctx.visit(K_CURRENT_SCHEMA);
|
||||
ctx.visit(N_CURRENT_SCHEMA);
|
||||
break;
|
||||
|
||||
default:
|
||||
ctx.visit(K_CURRENT_SCHEMA).sql("()");
|
||||
ctx.visit(function(N_CURRENT_SCHEMA, getDataType()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -152,8 +205,6 @@ implements
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: Query Object Model
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@ -83,8 +83,47 @@ implements
|
||||
// XXX: QueryPart API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
final boolean parenthesised(Context<?> ctx) {
|
||||
switch (ctx.family()) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
case DERBY:
|
||||
case FIREBIRD:
|
||||
case HSQLDB:
|
||||
case POSTGRES:
|
||||
case YUGABYTEDB:
|
||||
return false;
|
||||
|
||||
case SQLITE:
|
||||
return false;
|
||||
|
||||
case CLICKHOUSE:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void accept(Context<?> ctx) {
|
||||
switch (ctx.family()) {
|
||||
@ -111,6 +150,8 @@ implements
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -123,11 +164,15 @@ implements
|
||||
break;
|
||||
|
||||
case SQLITE:
|
||||
ctx.visit(DSL.inline(""));
|
||||
ctx.visit(inline(""));
|
||||
break;
|
||||
|
||||
case CLICKHOUSE:
|
||||
ctx.visit(function(N_currentUser, getDataType()));
|
||||
break;
|
||||
|
||||
default:
|
||||
ctx.visit(N_CURRENT_USER).sql("()");
|
||||
ctx.visit(function(N_CURRENT_USER, getDataType()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -141,8 +186,6 @@ implements
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: Query Object Model
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@ -19599,7 +19599,7 @@ public class DSL {
|
||||
* @param string is wrapped as {@link DSL#val(Object)}.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ DUCKDB, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
|
||||
@Support({ CLICKHOUSE, DUCKDB, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
|
||||
public static Field<String> md5(@Stringly.Param String string) {
|
||||
return new Md5(Tools.field(string));
|
||||
}
|
||||
@ -19610,7 +19610,7 @@ public class DSL {
|
||||
* Calculate an MD5 hash from a string.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ DUCKDB, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
|
||||
@Support({ CLICKHOUSE, DUCKDB, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
|
||||
public static Field<String> md5(Field<String> string) {
|
||||
return new Md5(string);
|
||||
}
|
||||
@ -22644,27 +22644,33 @@ public class DSL {
|
||||
|
||||
/**
|
||||
* The <code>CURRENT_CATALOG</code> function.
|
||||
* <p>
|
||||
* The CURRENT_CATALOG of the current session
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ FIREBIRD, POSTGRES, SQLITE, YUGABYTEDB })
|
||||
@Support({ CLICKHOUSE, FIREBIRD, POSTGRES, SQLITE, YUGABYTEDB })
|
||||
public static Field<String> currentCatalog() {
|
||||
return new CurrentCatalog();
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>CURRENT_SCHEMA</code> function.
|
||||
* <p>
|
||||
* The CURRENT_SCHEMA of the current session
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTEDB })
|
||||
@Support({ CLICKHOUSE, CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTEDB })
|
||||
public static Field<String> currentSchema() {
|
||||
return new CurrentSchema();
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>CURRENT_USER</code> function.
|
||||
* <p>
|
||||
* The CURRENT_USER of the current session with the database
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTEDB })
|
||||
@Support({ CLICKHOUSE, CUBRID, DERBY, FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTEDB })
|
||||
public static Field<String> currentUser() {
|
||||
return new CurrentUser();
|
||||
}
|
||||
|
||||
@ -96,9 +96,7 @@ final class Names {
|
||||
static final Name N_covarSamp = systemName("covarSamp");
|
||||
static final Name N_CUBE = systemName("cube");
|
||||
static final Name N_CUME_DIST = systemName("cume_dist");
|
||||
static final Name N_CURRENTUSER = systemName("currentuser");
|
||||
static final Name N_CURRENT_BIGDATETIME = systemName("current_bigdatetime");
|
||||
static final Name N_CURRENT_DATABASE = systemName("current_database");
|
||||
static final Name N_CURRENT_DATE = systemName("current_date");
|
||||
static final Name N_CURRENT_TIME = systemName("current_time");
|
||||
static final Name N_CURRENT_TIMESTAMP = systemName("current_timestamp");
|
||||
@ -113,7 +111,6 @@ final class Names {
|
||||
static final Name N_DAYOFYEAR = systemName("dayofyear");
|
||||
static final Name N_DAYS = systemName("days");
|
||||
static final Name N_DAYS_BETWEEN = systemName("days_between");
|
||||
static final Name N_DB_NAME = systemName("db_name");
|
||||
static final Name N_DECODE = systemName("decode");
|
||||
static final Name N_DECODE_ORACLE = systemName("decode_oracle");
|
||||
static final Name N_DEFAULT = systemName("default");
|
||||
@ -254,7 +251,6 @@ final class Names {
|
||||
static final Name N_ROWSFROM = systemName("rowsfrom");
|
||||
static final Name N_ROW_NUMBER = systemName("row_number");
|
||||
static final Name N_SAFE_CAST = systemName("safe_cast");
|
||||
static final Name N_SCHEMA_NAME = systemName("schema_name");
|
||||
static final Name N_SECONDS_BETWEEN = systemName("seconds_between");
|
||||
static final Name N_SEQ4 = systemName("seq4");
|
||||
static final Name N_SEQ8 = systemName("seq8");
|
||||
@ -305,7 +301,6 @@ final class Names {
|
||||
static final Name N_TRUNCNUM = systemName("truncnum");
|
||||
static final Name N_TUPLE = systemName("tuple");
|
||||
static final Name N_UNNEST = systemName("unnest");
|
||||
static final Name N_USER = systemName("user");
|
||||
static final Name N_UUID_TO_CHAR = systemName("uuid_to_char");
|
||||
static final Name N_VALUE = systemName("value");
|
||||
static final Name N_VALUES = systemName("values");
|
||||
@ -429,11 +424,16 @@ final class Names {
|
||||
static final Name N_COUNT = systemName("count");
|
||||
static final Name N_COVAR_POP = systemName("covar_pop");
|
||||
static final Name N_COVAR_SAMP = systemName("covar_samp");
|
||||
static final Name N_CURRENTUSER = systemName("currentuser");
|
||||
static final Name N_CURRENT_CATALOG = systemName("current_catalog");
|
||||
static final Name N_CURRENT_DATABASE = systemName("current_database");
|
||||
static final Name N_CURRENT_SCHEMA = systemName("current_schema");
|
||||
static final Name N_CURRENT_USER = systemName("current_user");
|
||||
static final Name N_DATABASE = systemName("database");
|
||||
static final Name N_DATALENGTH = systemName("datalength");
|
||||
static final Name N_DATE_ADD = systemName("date_add");
|
||||
static final Name N_DBINFO = systemName("dbinfo");
|
||||
static final Name N_DB_NAME = systemName("db_name");
|
||||
static final Name N_DEGREES = systemName("degrees");
|
||||
static final Name N_DELETING = systemName("deleting");
|
||||
static final Name N_DIGITS = systemName("digits");
|
||||
@ -549,6 +549,8 @@ final class Names {
|
||||
static final Name N_RPAD = systemName("rpad");
|
||||
static final Name N_RSHIFT = systemName("rshift");
|
||||
static final Name N_RTRIM = systemName("rtrim");
|
||||
static final Name N_SCHEMA = systemName("schema");
|
||||
static final Name N_SCHEMA_NAME = systemName("schema_name");
|
||||
static final Name N_SETBIT = systemName("setbit");
|
||||
static final Name N_SET_BIT = systemName("set_bit");
|
||||
static final Name N_SGN = systemName("sgn");
|
||||
@ -627,6 +629,7 @@ final class Names {
|
||||
static final Name N_UNIQUE = systemName("unique");
|
||||
static final Name N_UPDATING = systemName("updating");
|
||||
static final Name N_UPPER = systemName("upper");
|
||||
static final Name N_USER = systemName("user");
|
||||
static final Name N_UUID = systemName("uuid");
|
||||
static final Name N_UUID_GENERATE = systemName("uuid_generate");
|
||||
static final Name N_UUID_STRING = systemName("uuid_string");
|
||||
@ -648,6 +651,8 @@ final class Names {
|
||||
static final Name N_bitShiftRight = systemName("bitShiftRight");
|
||||
static final Name N_bitTest = systemName("bitTest");
|
||||
static final Name N_bitXor = systemName("bitXor");
|
||||
static final Name N_currentDatabase = systemName("currentDatabase");
|
||||
static final Name N_currentUser = systemName("currentUser");
|
||||
static final Name N_endsWith = systemName("endsWith");
|
||||
static final Name N_generateUUIDv4 = systemName("generateUUIDv4");
|
||||
static final Name N_startsWith = systemName("startsWith");
|
||||
|
||||
@ -8787,7 +8787,7 @@ final class DefaultParseContext extends AbstractScope implements ParseContext {
|
||||
return field;
|
||||
else if ((parseFunctionNameIf("CURRENT_CATALOG") && parseEmptyParens()))
|
||||
return currentCatalog();
|
||||
else if ((parseFunctionNameIf("CURRENT_DATABASE") && parseEmptyParens()))
|
||||
else if ((parseFunctionNameIf("CURRENT_DATABASE", "currentDatabase") && parseEmptyParens()))
|
||||
return currentCatalog();
|
||||
else if ((parseKeywordIf("CURRENT_SCHEMA", "CURRENT SCHEMA")) && parseEmptyParensIf())
|
||||
return currentSchema();
|
||||
|
||||
@ -11937,6 +11937,8 @@ public final class QOM {
|
||||
|
||||
/**
|
||||
* The <code>CURRENT CATALOG</code> function.
|
||||
* <p>
|
||||
* The CURRENT_CATALOG of the current session
|
||||
*/
|
||||
public static final CurrentCatalog CurrentCatalog() {
|
||||
return new org.jooq.impl.CurrentCatalog(
|
||||
@ -11945,6 +11947,8 @@ public final class QOM {
|
||||
|
||||
/**
|
||||
* The <code>CURRENT CATALOG</code> function.
|
||||
* <p>
|
||||
* The CURRENT_CATALOG of the current session
|
||||
*/
|
||||
public /*sealed*/ interface CurrentCatalog
|
||||
extends
|
||||
@ -11956,6 +11960,8 @@ public final class QOM {
|
||||
|
||||
/**
|
||||
* The <code>CURRENT SCHEMA</code> function.
|
||||
* <p>
|
||||
* The CURRENT_SCHEMA of the current session
|
||||
*/
|
||||
public static final CurrentSchema CurrentSchema() {
|
||||
return new org.jooq.impl.CurrentSchema(
|
||||
@ -11964,6 +11970,8 @@ public final class QOM {
|
||||
|
||||
/**
|
||||
* The <code>CURRENT SCHEMA</code> function.
|
||||
* <p>
|
||||
* The CURRENT_SCHEMA of the current session
|
||||
*/
|
||||
public /*sealed*/ interface CurrentSchema
|
||||
extends
|
||||
@ -11975,6 +11983,8 @@ public final class QOM {
|
||||
|
||||
/**
|
||||
* The <code>CURRENT USER</code> function.
|
||||
* <p>
|
||||
* The CURRENT_USER of the current session with the database
|
||||
*/
|
||||
public static final CurrentUser CurrentUser() {
|
||||
return new org.jooq.impl.CurrentUser(
|
||||
@ -11983,6 +11993,8 @@ public final class QOM {
|
||||
|
||||
/**
|
||||
* The <code>CURRENT USER</code> function.
|
||||
* <p>
|
||||
* The CURRENT_USER of the current session with the database
|
||||
*/
|
||||
public /*sealed*/ interface CurrentUser
|
||||
extends
|
||||
|
||||
Loading…
Reference in New Issue
Block a user