Class DropTable
java.lang.Object
com.northconcepts.datapipeline.jdbc.sql.SqlPart
com.northconcepts.datapipeline.sql.h2.H2SqlPart
com.northconcepts.datapipeline.sql.h2.DropTable
Generates a DROP TABLE statement for H2.
Sample Generated SQL:
DROP TABLE IF EXISTS person, address CASCADE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcollectSqlFragment(CodeWriter writer) Writes this part's SQL to the writer; used bySqlPart.getSqlFragment()and by enclosing parts.Returns the table names.booleanReturns whether CASCADE is enabled.booleanIndicates ifIF EXISTSclause should be included in theDROP TABLEstatement (default true).booleanReturns whether RESTRICT is enabled.setCascade(boolean cascade) Sets whether CASCADE is enabled.setCheckIfExists(boolean checkIfExists) Sets whether IF EXISTS clause should be included in the DROP TABLE statement.setPretty(boolean pretty) Indicates ifSqlPart.getSqlFragment()adds line breaks and indentation instead of using one line (default is false).setTableNames(String... tableNames) Sets the table names.setTableNames(Collection<String> tableNames) Sets the table names from a collection.Methods inherited from class com.northconcepts.datapipeline.sql.h2.H2SqlPart
escapeKeyword, placeBackTicksMethods inherited from class com.northconcepts.datapipeline.jdbc.sql.SqlPart
collectParameterValues, getParameterValues, getSqlFragment, isPretty, printSqlParts, toString
-
Constructor Details
-
DropTable
public DropTable() -
DropTable
Constructs a DropTable with the specified table names.- Parameters:
tableNames- the table names to drop
-
-
Method Details
-
setPretty
Description copied from class:SqlPartIndicates ifSqlPart.getSqlFragment()adds line breaks and indentation instead of using one line (default is false). -
collectSqlFragment
Description copied from class:SqlPartWrites this part's SQL to the writer; used bySqlPart.getSqlFragment()and by enclosing parts.- Specified by:
collectSqlFragmentin classSqlPart
-
getTableNames
Returns the table names.- Returns:
- the table names
-
setTableNames
Sets the table names from a collection.- Parameters:
tableNames- the table names- Returns:
- this instance
-
setTableNames
Sets the table names.- Parameters:
tableNames- the table names- Returns:
- this instance
-
isCheckIfExists
public boolean isCheckIfExists()Indicates ifIF EXISTSclause should be included in theDROP TABLEstatement (default true). -
setCheckIfExists
Sets whether IF EXISTS clause should be included in the DROP TABLE statement.- Parameters:
checkIfExists- true to include IF EXISTS clause- Returns:
- this instance
-
isCascade
public boolean isCascade()Returns whether CASCADE is enabled.- Returns:
- true if CASCADE is enabled
-
setCascade
Sets whether CASCADE is enabled.- Parameters:
cascade- true to enable CASCADE- Returns:
- this instance
-
isRestrict
public boolean isRestrict()Returns whether RESTRICT is enabled.- Returns:
- true if RESTRICT is enabled
-