Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

[jira] Created: (DERBY-6) Trigger of the form: create trigger ... values my: msg#00288

apache.db.derby.devel

Subject: [jira] Created: (DERBY-6) Trigger of the form: create trigger ... values myFunction(); has no effect.

Message:

A new issue has been created in JIRA.

---------------------------------------------------------------------
View the issue:
http://issues.apache.org/jira/browse/DERBY-6

Here is an overview of the issue:
---------------------------------------------------------------------
Key: DERBY-6
Summary: Trigger of the form: create trigger ... values myFunction(); has
no effect.
Type: Bug

Status: Unassigned
Priority: Minor

Project: Derby
Components:
SQL
Fix Fors:
10.0.2.0
Versions:
10.0.2.0

Assignee:
Reporter: Tulika Agrawal

Created: Mon, 27 Sep 2004 5:37 PM
Updated: Mon, 27 Sep 2004 5:37 PM

Description:
Reporting for Jack Klebanoff, filed on derby-dev list.

> Jack Klebanoff wrote:
>
> | I would like to submit a fix for a bug in triggers.
> |
> | The bug is that a trigger of the form:
> | create trigger ... values myFunction();
> | has no effect. MyFunction is not called even if the trigger is fired.
> | Side effects of myFunction do not happen. Derby does not allow a "CALL"
> | statement inside a trigger action so a values statement is the only way
> | to call a function/procedure in a trigger action.
> |
> | The cause of the bug is that since the values are not actually used by
> | the trigger, the trigger code does not fetch the row(s) returned by the
> | trigger action. The fix is simple: change class
> | org.apache.derby.impl.sql.execute.GenericTriggerExecutor to fetch (and
> | discard) the rows returned by a trigger action.
> |
> | Please review the change. The diff file is attached.
>
>
> I think you need to close the ResultSet (rs). Other locations in the
> code where a ResultSet is processed terminate with an rs.close(). Eg.
> see DeleteCascadeResultSet, ConstraintConstantAction.
>
> Dan.
>
I changed the code to close the ResultSet. The diff file is attached.

Jack
Index: java/engine/org/apache/derby/impl/sql/execute/GenericTriggerExecutor.java
===================================================================
--- java/engine/org/apache/derby/impl/sql/execute/GenericTriggerExecutor.java
(revision 37092)
+++ java/engine/org/apache/derby/impl/sql/execute/GenericTriggerExecutor.java
(working copy)
@@ -157,7 +157,18 @@
*/
try
{
-
ps.execute(spsActivation, false, false, false);
+ ResultSet rs =
ps.execute(spsActivation, false, false, false);
+ if( rs.returnsRows())
+ {
+ // Fetch all the data to ensure that functions in the
select list or values statement will
+ // be evaluated and side effects will happen. Why else
would the trigger action return
+ // rows, but for side effects?
+ // The result set was opened in ps.execute()
+ while( rs.getNextRow() != null)
+ {
+ }
+ }
+ rs.close();
}
catch (StandardException e)
{


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
version-control...    qnx.openqnx.dev...    redhat.rhn.user...    ietf.openpgp/20...    mail.mutt.user/...    web.microformat...    java.sync4j.use...    education.ezpro...    user-groups.blu...    solaris.manager...    org.fitug.debat...    technology.erps...    politics.activi...    linux.redhat.fe...    bug-tracking.ma...    xfce.user/2004-...    hams/2004-11/ms...    kde.users.pim/2...    culture.cooking...    freebsd.devel.x...    gnu.m4.adhoc/20...    ngpt.user/2002-...    apple.fink.deve...   
Home | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation