Commit b855982
committed
Refactor: CREATE TABLE / ALTER TABLE grammar and AlterExpression model
Grammar: extract shared helper productions to eliminate redundancy
- ReferentialActionsOnIndex: ON DELETE/UPDATE action (was duplicated 4x)
- CheckConstraintSpec: CHECK (expr) (was duplicated 3x)
- ForeignKeySpec: FOREIGN KEY ... REFERENCES ... (used by both CREATE/ALTER)
- AlterExpressionUsingIndex: USING [INDEX] name (was duplicated 4x)
- AlterExpressionConstraintTail: constraint state + USING + COMMENT tail
- AlterExpressionColumnChanges: DROP/SET DEFAULT, SET VISIBLE/INVISIBLE,
bracketed multi-column (was duplicated 2x)
- AlterExpressionDiscardOrImport: merged identical DISCARD/IMPORT blocks
Grammar: decompose monolithic productions
- CreateTableConstraint: all constraint types inside CREATE TABLE (...)
CreateTable shrinks from 211 to 86 lines
- AlterExpressionAddConstraint: CONSTRAINT clause in ALTER TABLE
- AlterExpressionDrop: all DROP variants
- AlterExpressionPartitionOp: 11 partition maintenance operations
AlterExpression() shrinks from 754 to ~430 lines
AlterExpression.java: unify FK handling
- Standalone ADD FOREIGN KEY now uses ForeignKeySpec/ForeignKeyIndex,
same as CONSTRAINT ... FOREIGN KEY path
- Deprecated fkColumns/fkSourceTable/fkSourceSchema/fkSourceColumns
fields and associated methods in favor of ForeignKeyIndex via setIndex()
- Deprecated referentialActions methods on AlterExpression
- Fields still populated for backward compatibility; rendering delegates
to ForeignKeyIndex.toString() to preserve referential action order
AlterExpression.java: split toString() into focused methods
- toStringConstraintAlter, toStringAlterColumn, toStringSimpleKeyword,
toStringRename, toStringDropSpecial, toStringConvert, toStringPartition,
toStringGeneral — replacing a 330-line if/else chain
No breaking changes to public API. All existing tests pass.
Signed-off-by: Andreas Reichel <andreas@manticore-projects.com>
Signed-off-by: manticore-projects <andreas@manticore-projects.com>1 parent d404f0e commit b855982
File tree
3 files changed
+524
-377
lines changed- src
- main
- java/net/sf/jsqlparser/statement/alter
- jjtree/net/sf/jsqlparser/parser
- test/java/net/sf/jsqlparser/statement/alter
3 files changed
+524
-377
lines changed
0 commit comments