import groovy.sql.Sql import java.sql.SQLException import java.io.* import java.util.zip.* /* * Groovlet to load entries from the movements table. * */ class DBSettings { static final def TILE_TABLE = "refractal_romp" // Database settings: { static final def DB_URL = "jdbc:mysql://resist-the-b.org:3306/brien" static final def DB_USER = "pinstripe" static final def DB_PASS = "1am-tranxaktional" static final def DB_DRIVER = "com.mysql.jdbc.Driver" // } } try { def sql = Sql.newInstance( DBSettings.DB_URL, DBSettings.DB_USER, DBSettings.DB_PASS, DBSettings.DB_DRIVER ) def errorText = null def count = 0 sql.query( "select count(*) from " + DBSettings.TILE_TABLE ) { rset -> if (! rset.first() ) { errorText = "Error: There is no entry for the given ID." } else { count = rset.getInt( 1 ) } } if ( errorText ) println errorText else println """
${count} tiles generated
""" } catch ( SQLException e ) { error = true println "Error: ${e.toString()}" }