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

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

Hi Eranda,

You are on the right track. sqlgrammar.jj is the right place to start to see 
how the TableElementList is constructed. But at parse() time you don't have 
enough information to construct the list for a TRUNCATE TABLE statement. You 
only have that information at bind() time. That is because it is the 
responsibility of the bind() phase to look at the metadata to fill in missing 
facts about the table.

The nodeFactory.getNode() call cited above will give you an empty 
TableElementList. You then need to put one TableElementNode on that list, a 
TableElementNode which represents the action ALTER TABLE ALTER COLUMN...RESTART 
WITH. To see how to make that node, look in sqlgrammar.jj for the string 
"<RESTART> <WITH>".

The TableElementList itself should be constructed in 
AlterTableNode.bindStatement() once you know that you are dealing with a 
TRUNCATE TABLE statement.

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: changes.diff, 
> 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