comparison init20.gradle @ 202:b217dc3b654a

USASR-1835: Attempt to fix quoting of database name in sql
author Christopher Springer <springer@nwoca.org>
date Fri, 21 Aug 2015 12:40:01 +0100
parents e721a977726b
children a3c507b868a9
comparison
equal deleted inserted replaced
201:e721a977726b 202:b217dc3b654a
296 gradle.environmentDatabase.jdbc.username, 296 gradle.environmentDatabase.jdbc.username,
297 gradle.environmentDatabase.jdbc.password, 297 gradle.environmentDatabase.jdbc.password,
298 driverName) 298 driverName)
299 if (dropIt) { 299 if (dropIt) {
300 logger.info "disconnecting sessions from $databaseName" 300 logger.info "disconnecting sessions from $databaseName"
301 sql.execute "REVOKE CONNECT ON DATABASE " + databaseName + " FROM public;" 301 sql.execute "REVOKE CONNECT ON DATABASE \"" + databaseName + "\" FROM public;"
302 sql.execute "REVOKE CONNECT ON DATABASE " + databaseName + " FROM " + gradle.environmentDatabase.jdbc.username + ";" 302 sql.execute "REVOKE CONNECT ON DATABASE \"" + databaseName + "\" FROM " + gradle.environmentDatabase.jdbc.username + ";"
303 sql.execute "SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = '" + databaseName + "';" 303 sql.execute "SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = '" + databaseName + "';"
304 logger.info "dropping $databaseName (if exists) from $adminUrl" 304 logger.info "dropping $databaseName (if exists) from $adminUrl"
305 sql.execute 'DROP DATABASE IF EXISTS "' + databaseName + '";' 305 sql.execute 'DROP DATABASE IF EXISTS "' + databaseName + '";'
306 } 306 }
307 307