1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" id="sixapart-standard">
5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6 <meta name="generator" content="Movable Type 5.2.3" />
8 <link rel="stylesheet" href="http://defaria.com/blogs/Status/styles-site.css" type="text/css" />
9 <link rel="alternate" type="application/atom+xml" title="Atom" href="http://defaria.com/blogs/Status/atom.xml" />
10 <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="http://defaria.com/blogs/Status/index.xml" />
12 <title>Status for Andrew DeFaria: New Trigger</title>
14 <link rel="start" href="http://defaria.com/blogs/Status/" title="Home" />
15 <link rel="prev" href="http://defaria.com/blogs/Status/archives/000223.html" title="Server move (cont)" />
16 <link rel="next" href="http://defaria.com/blogs/Status/archives/000225.html" title="CommentSQLCode Trigger" />
22 <script type="text/javascript" src="http://defaria.com/blogs/Status/mt-site.js"></script>
24 <body class="layout-one-column" onload="individualArchivesOnLoad(commenter_name)">
26 <div id="container-inner" class="pkg">
29 <div id="banner-inner" class="pkg">
30 <h1 id="banner-header"><a href="http://defaria.com/blogs/Status/" accesskey="1">Status for Andrew DeFaria</a></h1>
31 <h2 id="banner-description">Searchable status reports and work log</h2>
36 <div id="pagebody-inner" class="pkg">
38 <div id="alpha-inner" class="pkg">
40 <p class="content-nav">
41 <a href="http://defaria.com/blogs/Status/archives/000223.html">« Server move (cont)</a> |
42 <a href="http://defaria.com/blogs/Status/">Main</a>
43 | <a href="http://defaria.com/blogs/Status/archives/000225.html">CommentSQLCode Trigger »</a>
47 <div class="entry" id="entry-224">
48 <h3 class="entry-header">New Trigger</h3>
49 <div class="entry-content">
50 <div class="entry-body">
51 <p>Here are the requirements as I understand them for the trigger that Steve Lipson wants for the SQL checkins. Basically he desires a trigger that will capture the checkin comment and other information and insert that information in the form of a comment at the top of the checked in element. This trigger will:</p>
54 <li>Be a postop trigger for the checkin action</li>
55 <li><b>Not</b> be an all element trigger rather it will be attached to certain file elements in the vob</li>
56 <li>Be made for the <<i>fill in vob name here</i>> vob</li>
57 <li>Only work on file elements - directory elements are to be skipped</li>
58 <li>Only work on file elements that have an extension of .sql - other elements will be skipped</li>
61 <p>Roughly the psuedo code for this trigger will be:</p>
63 <div class="code"><pre>
64 # Get name of element and its type
65 $pname = $ENV{CLEARCASE_PN};
66 $element_type = $ENV{CLEARCASE_ELTYPE};
68 # Skip directories and elements that aren't .sql
69 exit if $element_type =~ /directory/i || $pname !~ /\.sql$/i;
71 # Get comment and user
72 $comment = $ENV{CLEARCASE_COMMENT};
73 $userid = $ENV{CLEARCASE_USER};
76 $timestamp = getCurrentTime;
78 # Parse output of lsactivity -cact -long
79 ($activity_id, $activity_title, $activity_owner) = parseLSActivity;
81 # Open up $pname for reading and $pname.trig for writting
83 or die "Unable to open $pname for reading - $!\n";
85 open PNAME_OUT, ">$pname.trig"
86 or dir "Unable to open $pname.trig for writing - $!\n";
88 # Add comment to top of file
89 print $PNAME_OUT <<END;
91 -- Activity: $activity_id: $activity_title
92 -- Owner: $activity_owner ($userid)
104 # Switch $pname.trig -> $pname
106 rename "$pname.trig", $pname;
108 # Allow checkin to proceed
112 <div id="more" class="entry-more">
116 <p class="entry-footer">
117 <span class="post-footers">Posted by on August 3, 2004 6:54 PM</span> <span class="separator">|</span> <a class="permalink" href="http://defaria.com/blogs/Status/archives/000224.html">Permalink</a>