[jOOQ/jOOQ#8524] Add support for CREATE TEMPORARY TABLE IF NOT EXISTS
This commit is contained in:
parent
48201965d6
commit
8b267a321c
@ -8694,6 +8694,30 @@ public interface DSLContext extends Scope , AutoCloseable {
|
||||
@Support({ MARIADB, MYSQL, POSTGRES })
|
||||
CreateTableColumnStep createTemporaryTable(Table<?> table);
|
||||
|
||||
/**
|
||||
* Create a new DSL <code>CREATE TEMPORARY TABLE IF NOT EXISTS</code> statement.
|
||||
*
|
||||
* @see DSL#createTemporaryTableIfNotExists(String)
|
||||
*/
|
||||
@Support({ MARIADB, MYSQL, POSTGRES })
|
||||
CreateTableColumnStep createTemporaryTableIfNotExists(String table);
|
||||
|
||||
/**
|
||||
* Create a new DSL <code>CREATE TEMPORARY TABLE IF NOT EXISTS</code> statement.
|
||||
*
|
||||
* @see DSL#createTemporaryTableIfNotExists(Name)
|
||||
*/
|
||||
@Support({ MARIADB, MYSQL, POSTGRES })
|
||||
CreateTableColumnStep createTemporaryTableIfNotExists(Name table);
|
||||
|
||||
/**
|
||||
* Create a new DSL <code>CREATE TEMPORARY TABLE IF NOT EXISTS</code> statement.
|
||||
*
|
||||
* @see DSL#createTemporaryTableIfNotExists(Table)
|
||||
*/
|
||||
@Support({ MARIADB, MYSQL, POSTGRES })
|
||||
CreateTableColumnStep createTemporaryTableIfNotExists(Table<?> table);
|
||||
|
||||
/**
|
||||
* Create a new DSL <code>CREATE GLOBAL TEMPORARY TABLE</code> statement.
|
||||
*
|
||||
|
||||
@ -6693,7 +6693,7 @@ public class DSL {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new DSL <code>CREATE GLOBAL TEMPORARY TABLE</code> statement.
|
||||
* Create a new DSL <code>CREATE TEMPORARY TABLE</code> statement.
|
||||
*
|
||||
* @see DSLContext#createTemporaryTable(String)
|
||||
*/
|
||||
@ -6703,7 +6703,7 @@ public class DSL {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new DSL <code>CREATE GLOBAL TEMPORARY TABLE</code> statement.
|
||||
* Create a new DSL <code>CREATE TEMPORARY TABLE</code> statement.
|
||||
*
|
||||
* @see DSLContext#createTemporaryTable(Name)
|
||||
*/
|
||||
@ -6713,7 +6713,7 @@ public class DSL {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new DSL <code>CREATE GLOBAL TEMPORARY TABLE</code> statement.
|
||||
* Create a new DSL <code>CREATE TEMPORARY TABLE</code> statement.
|
||||
*
|
||||
* @see DSLContext#createTemporaryTable(Table)
|
||||
*/
|
||||
@ -6722,6 +6722,36 @@ public class DSL {
|
||||
return dsl().createTemporaryTable(table);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new DSL <code>CREATE TEMPORARY TABLE</code> statement.
|
||||
*
|
||||
* @see DSLContext#createTemporaryTableIfNotExists(String)
|
||||
*/
|
||||
@Support({ MARIADB, MYSQL, POSTGRES })
|
||||
public static CreateTableColumnStep createTemporaryTableIfNotExists(String table) {
|
||||
return dsl().createTemporaryTableIfNotExists(table);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new DSL <code>CREATE TEMPORARY TABLE</code> statement.
|
||||
*
|
||||
* @see DSLContext#createTemporaryTableIfNotExists(Name)
|
||||
*/
|
||||
@Support({ MARIADB, MYSQL, POSTGRES })
|
||||
public static CreateTableColumnStep createTemporaryTableIfNotExists(Name table) {
|
||||
return dsl().createTemporaryTableIfNotExists(table);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new DSL <code>CREATE TEMPORARY TABLE</code> statement.
|
||||
*
|
||||
* @see DSLContext#createTemporaryTableIfNotExists(Table)
|
||||
*/
|
||||
@Support({ MARIADB, MYSQL, POSTGRES })
|
||||
public static CreateTableColumnStep createTemporaryTableIfNotExists(Table<?> table) {
|
||||
return dsl().createTemporaryTableIfNotExists(table);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new DSL <code>CREATE GLOBAL TEMPORARY TABLE</code> statement.
|
||||
*
|
||||
|
||||
@ -3127,6 +3127,21 @@ public class DefaultDSLContext extends AbstractScope implements DSLContext, Seri
|
||||
return new CreateTableImpl(configuration(), table, true, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CreateTableColumnStep createTemporaryTableIfNotExists(String table) {
|
||||
return createTemporaryTableIfNotExists(name(table));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CreateTableColumnStep createTemporaryTableIfNotExists(Name table) {
|
||||
return createTemporaryTableIfNotExists(table(table));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CreateTableColumnStep createTemporaryTableIfNotExists(Table<?> table) {
|
||||
return new CreateTableImpl(configuration(), table, true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CreateTableColumnStep createGlobalTemporaryTable(String table) {
|
||||
return createGlobalTemporaryTable(name(table));
|
||||
|
||||
@ -3103,7 +3103,7 @@ final class ParserImpl implements Parser {
|
||||
}
|
||||
|
||||
private static final DDLQuery parseCreateTable(ParserContext ctx, boolean temporary) {
|
||||
boolean ifNotExists = !temporary && parseKeywordIf(ctx, "IF NOT EXISTS");
|
||||
boolean ifNotExists = parseKeywordIf(ctx, "IF NOT EXISTS");
|
||||
Table<?> tableName = DSL.table(parseTableName(ctx).getQualifiedName());
|
||||
CreateTableCommentStep commentStep;
|
||||
CreateTableStorageStep storageStep;
|
||||
@ -3383,7 +3383,9 @@ final class ParserImpl implements Parser {
|
||||
ctas = true;
|
||||
|
||||
CreateTableColumnStep columnStep = ifNotExists
|
||||
? ctx.dsl.createTableIfNotExists(tableName)
|
||||
? temporary
|
||||
? ctx.dsl.createTemporaryTableIfNotExists(tableName)
|
||||
: ctx.dsl.createTableIfNotExists(tableName)
|
||||
: temporary
|
||||
? ctx.dsl.createTemporaryTable(tableName)
|
||||
: ctx.dsl.createTable(tableName);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user