logo       

RE: RE: What's wrong with this syntax = markupBuilder + SQL --> Closure: msg#00172

lang.groovy.user

Subject: RE: RE: What's wrong with this syntax = markupBuilder + SQL --> Closure

I have no clue abt this one :-/
I was wondering whether this was along the lines of this other bug already in JIRA :
 
--
Guillaume Laforge
http://glaforge.free.fr/weblog
-----Message d'origine-----
De : Furash Gary [mailto:furashg-sZWokWQQVgMxjvOLE2GS1/IbXMQ5te18@xxxxxxxxxxxxxxxx]
Envoyé : lundi 22 novembre 2004 14:18
À : user-i9PBDF1N6cxnkHa44VUL00B+6BGkLq7r@xxxxxxxxxxxxxxxx
Objet : [groovy-user] RE: What's wrong with this syntax = markupBuilder + SQL --> Closure

Whoops. 
 
Yields: Caught: groovy.lang.MissingMethodException: No signture of method Test$_run_closure2.body() is applicable for argument types Test$_run_closure2.body() is applicable for argument types: (Test$_run_closure2_closure4) values: [Test$_run_closure2_closure@1f6226]


From: Furash Gary
Sent: Friday, November 19, 2004 8:44 AM
To: user-i9PBDF1N6cxnkHa44VUL00B+6BGkLq7r@xxxxxxxxxxxxxxxx
Subject: What's wrong with this syntax = markupBuilder + SQL

import groovy.sql.*;
import groovy.xml.*;
 
release = "3.11";
 
I'm trying to spit out a td row for each line of my sql, but it complains about closures.
 
sql = Sql.newInstance("jdbc:mysql://mcaosdev2:3306/mantis_db",
 "furashgf", "melissa", "org.gjt.mm.mysql.Driver");
getWorkloadSql = <<<EOS
 SELECT mut.last_name, mut.first_name, COUNT(*) AS total_tasks, SUM(IF(mbt.projection IS NULL OR mbt.projection = 10, 1,0)) AS unsized_tasks,
  SUM(mbp.value) AS workload
 FROM mantis_user_table AS mut
  LEFT OUTER JOIN mantis_bug_table AS mbt ON (mbt.handler_id = mut.id)
  LEFT OUTER JOIN mantis_project_version_table AS mpvt ON (mpvt.id = mbt.version_id)
  LEFT OUTER JOIN m_bug_status AS mbs ON (mbs.status_cd = mbt.status)
  LEFT OUTER JOIN m_bug_projection AS mbp ON (mbp.projection_cd = mbt.projection)
 WHERE mpvt.version = ${release} AND mbs.is_active_state = "Y" AND mut.role_cd IN ("DEV", "ADM")
 GROUP BY mut.last_name, mut.first_name
 ORDER BY mut.last_name, mut.first_name;
EOS
 
htmlOut = new MarkupBuilder();
htmlOut.html() {
 head() {
  title("Load By Developer for Release $release");
 }
 body() {
  table() {
   tr() {
    th("Team Member");
    th("Total Tasks");
    th("Workload");
   }
   sql.eachRow(getWorkloadSql) {
    tr() {
     td(it.last_name + ", " + it.first_name);
     td(it.total_tasks);
     td(it.workload);
    }
   }
  }
 }
}
println(htmlOut);
 
 
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise