The Artima Developer Community
Sponsored Link

Java Buzz Forum
Once Again, Groovy Rocks

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.
Once Again, Groovy Rocks Posted: Feb 19, 2004 7:52 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Brian McCallister.
Original Post: Once Again, Groovy Rocks
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

A big chunk of my day job is on a continuously evolving large application we host. Continuously evolving and hosting together mean lots of database migrations. We've put together a wonderfully handy tool to automate database migrations. It is really just a stateful dependency resolver with convenience things for working on a database. Up until now we've supported migration steps in SQL, BeanShell, and Java. After playing with GroovySql -- we do that now too.

<step name="switch-login-and-passcode" type="groovy">
    <depends name="version-4.2"/>
    <script>
import groovy.sql.Sql

sql = new Sql(connection)

sql.execute("create table foo as select * from user")
sql.execute("delete from foo")

sql.queryEach("select login, password from user") {
    sql.execute("insert into foo (login, password) values (?, ?)", 
                [it.passcode, it.login])
}

sql.queryEach("select * from foo") {
    println "Funny Looking Login: ${it.login}"
}

sql.execute("drop table foo")
    </script>
</step>

I really like OJB (obviously), but O/R mapping is far from the answer all the time =) Groovy SQL rocks.

Read: Once Again, Groovy Rocks

Topic: Matt's blog Previous Topic   Next Topic Topic: 10 Don't do's in Java WebApp Programming

Sponsored Links



Google
  Web Artima.com   

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