[ 
https://issues.apache.org/jira/browse/DERBY-268?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12916134#action_12916134
 ] 

Rick Hillegas commented on DERBY-268:
-------------------------------------

Hi Eranda,

No need to touch ij, all of this code should be in the engine. The good news is 
that both TRUNCATE TABLE and ALTER TABLE ALTER COLUMN RESTART are handled by 
the AlterTableConstantAction machinery at run time. If I were tackling this, I 
would first try something along these lines:

o AlterTableNode.bindStatement() will need to build a tableElementList 
structure for TRUNCATE TABLE, describing the identity column which needs to be 
re-initialized. For ALTER TABLE ALTER COLUMN RESTART, that tableElementList is 
created by the parser.

o That tableElementList structure will then be picked up by 
AlterTableNode.prepConstantAction and turned into a ColumnInfo array when the 
run time structures are generated for TRUNCATE TABLE. The ColumnInfo[] 
structure should contain enough information to describe the change to the 
identity column.

o The column info structure will then be processed by 
AlterTableConstantAction.executeConstantAction() at run time.

You may need to tweak the code a bit to get this to function, but I think this 
basic processing flow should work. Please ask more questions if this is too 
cryptic.

Hope this helps,
-Rick

> Add Support for truncate table
> ------------------------------
>
>                 Key: DERBY-268
>                 URL: https://issues.apache.org/jira/browse/DERBY-268
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>            Reporter: Lance Andersen
>            Assignee: Eranda Sooriyabandara
>            Priority: Minor
>         Attachments: derby-268-01-ab-enableForInsaneBuilds.diff, 
> derby-268-02-aa-permsTest.diff, derby-268-03-aa-npe.diff, Derby-268.diff, 
> tests.diff, TruncateConcurrency.java, TruncateConcurrency.java, 
> TruncateConcurrency.java
>
>
> Adding support for truncate table command will aid to portability

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to