Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 69257 invoked from network); 4 Mar 2007 16:21:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Mar 2007 16:21:13 -0000 Received: (qmail 83170 invoked by uid 500); 4 Mar 2007 16:21:20 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 83135 invoked by uid 500); 4 Mar 2007 16:21:20 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 83043 invoked by uid 99); 4 Mar 2007 16:21:20 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 04 Mar 2007 08:21:20 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 04 Mar 2007 08:21:11 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id EF062714339 for ; Sun, 4 Mar 2007 08:20:50 -0800 (PST) Message-ID: <11517826.1173025250976.JavaMail.jira@brutus> Date: Sun, 4 Mar 2007 08:20:50 -0800 (PST) From: "Bryan Pendleton (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Commented: (DERBY-2397) Dropping SQL objects could be improved by reducing the number of classes required. In-Reply-To: <22536803.1172946350672.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DERBY-2397?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12477800 ] Bryan Pendleton commented on DERBY-2397: ---------------------------------------- This sounds like a great idea. I struggled with several instances of this problem during ALTER TABLE testing. > Dropping SQL objects could be improved by reducing the number of classes required. > ---------------------------------------------------------------------------------- > > Key: DERBY-2397 > URL: https://issues.apache.org/jira/browse/DERBY-2397 > Project: Derby > Issue Type: Improvement > Components: SQL > Reporter: Daniel John Debrunner > Assigned To: Daniel John Debrunner > > The current flow for a DROP statement, such as a DROP FUNCTION is roughly as follows: > Compile time: > c1) find the TupleDescriptor for the object to verify it exists (e.g. AliasDescriptor, TriggerDescriptor) > c2) create an instance of a type specific ConstantAction (e.g. DropAliasConstantAction), information > is passed into the ConstantAction to allow it to re-create the TupleDescriptor, but doesn't pass the actual TupleDescriptor. > (E.g. the schema name, alias type and routine name is passed to the DropAliasConstantAction) > Execute time (which may be sometime later than compile time) calls executeConstantAction on the object specific ConstantAction > e1) execute verify a matching object exists by finding a matching TupleDescriptor > e2) drop the object > This could be simplified by utilizing the polymorphic nature of TupleDescriptors. Then all the DropXXXConstantActions could be replaced with > a single DropDescriptorConstantAction that was created with a TupleDescriptor at compile time. Two new abstract methods would be added to > TupleDescriptor, getCurrent() and drop(). > Then the execute steps would be: > en1) Get the current TupleDescriptor using the getCurrent() method of the Tupledescriptor passed in at compile time. > This method may return the same object, a different instance that refers to the same SQL object or an instance > that refers to a different SQL object of the same name. > descriptor = descriptor.getCurrent() > en2) Drop the descriptor. > descriptor.drop(). > Thus the checking and drop code would move from the SQL object specific ConstantActions into the SQL object specific TupleDescriptors and > then all of the DropXXXConstantActions classes would be replaced with a single generic one. Thus removing around six classes. > Grant/revoke changes has almost started this approach, where some instances of TupleDescriptor (e.g. ViewDescriptor) and the matching constant action > to drop an item share code. This alerted me to the pattern that is really required, that of a drop() method in TupleDescriptor. > I'll have a patch sometime over the weekend that shows an incremental approach for a couple of SQL objects. > -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.