extracted ExtractIndexAndSql class from groovy.sql.Sql