title: Faster way to update with Groovy SQL
body: <p>I am updating rows of a MySQL database with groovy and with the method I am using things are very slow. I was hoping you could improve on the performance of my example:</p>
  
  <pre><code>sql.resultSetConcurrency = ResultSet.CONCUR_UPDATABLE
  
  sql.eachRow("SELECT * FROM email) { bt -&gt;
      bt.extendedDesc = update(bt.name, bt.direction)
  }
  
  sql.resultSetConcurrency = ResultSet.CONCUR_READ_ONLY
  </code></pre>
  
  <p>Then there is the update method:</p>
  
  <pre><code>def update(name, direction) {
      if (direction == 'Outgoing') {
          result = 'FROM: '+name
      } else {
          result = 'TO: '+name
      }
      if(result.size() &gt; 75) {
          result = result.substring(0, 72) + "..."
      }
      return result
  }
  </code></pre>
  
  <p>So it updates one field of each entry in email (extendedDesc in this example) using a method that needs 2 other fields passed to it as parameters. </p>
  
  <p>It is very slow, around 600 entries updated per minute, and email has 200000+ entries =/</p>
  
  <p>Is there a better method to accomplish this? Should use Groovy if possible, as it needs to run with all my other Groovy scripts.</p>