[jOOQ/jOOQ#9472] Fix UUID for SQLite
This commit is contained in:
parent
7883dd3e89
commit
d76e8e3dd3
@ -244,6 +244,7 @@ final class Names {
|
||||
static final Name N_RADIANS = unquotedName("radians");
|
||||
static final Name N_RAND = unquotedName("rand");
|
||||
static final Name N_RANDOM = unquotedName("random");
|
||||
static final Name N_RANDOMBLOB = unquotedName("randomblob");
|
||||
static final Name N_RANDOM_UUID = unquotedName("random_uuid");
|
||||
static final Name N_RATIO_TO_REPORT = unquotedName("ratio_to_report");
|
||||
static final Name N_RAWTOHEX = unquotedName("rawtohex");
|
||||
|
||||
@ -108,6 +108,11 @@ extends
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
case FIREBIRD:
|
||||
ctx.visit(function(N_UUID_TO_CHAR, getDataType(), function(N_GEN_UUID, getDataType())));
|
||||
break;
|
||||
@ -143,6 +148,29 @@ extends
|
||||
|
||||
|
||||
|
||||
case SQLITE: {
|
||||
// See https://stackoverflow.com/a/22725697/521799
|
||||
Field<String> u = DSL.field(name("u"), VARCHAR);
|
||||
|
||||
ctx.visit(DSL.field(
|
||||
select(
|
||||
DSL.substring(u, inline(1), inline(8)).concat(inline('-'))
|
||||
.concat(DSL.substring(u, inline(9), inline(4)).concat(inline('-')))
|
||||
.concat(DSL.substring(u, inline(13), inline(4)).concat(inline('-')))
|
||||
.concat(DSL.substring(u, inline(17), inline(4)).concat(inline('-')))
|
||||
.concat(DSL.substring(u, inline(21)))
|
||||
)
|
||||
.from(select(DSL.lower(function(N_HEX, VARCHAR, function(N_RANDOMBLOB, BINARY, inline(16)))).as(u)).asTable(unquotedName("t")))
|
||||
));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
default:
|
||||
ctx.visit(function(N_UUID, getDataType()));
|
||||
break;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user