The Artima Developer Community
Sponsored Link

Java Buzz Forum
Better GroovySQL Example

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Brian McCallister

Posts: 1282
Nickname: frums
Registered: Sep, 2003

Brian McCallister is JustaProgrammer who thinks too much.
Better GroovySQL Example Posted: Feb 19, 2004 10:21 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Brian McCallister.
Original Post: Better GroovySQL Example
Feed Title: Waste of Time
Feed URL: http://kasparov.skife.org/blog/index.rss
Feed Description: A simple waste of time and weblog experiment
Latest Java Buzz Posts
Latest Java Buzz Posts by Brian McCallister
Latest Posts From Waste of Time

Advertisement

Glen complained that the example in my previous post was pretty bad, so here is a better one in honor of Andy ;-)

<step name="md5-passwords" type="groovy">
    <script>
import groovy.sql.Sql
import java.security.MessageDigest

sql = new Sql(connection)

sql.queryEach("select password, user_id from users") {
    MessageDigest md = MessageDigest.getInstance("MD5")
    sql.execute("update users set password=? where user_id=?",
                 [md.digest(it.password.bytes), it.user_id])
}
    </script>
</step>

=)

Read: Better GroovySQL Example

Topic: O'Reilly Emerging Technology Conference Previous Topic   Next Topic Topic: Java XUL Toolkits

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use