phanisrikar
14 years agoContributor
To access select Query result set and parameterize
Hi,
I have executed a SQL Query and got the result set
While accessing the resultset I need to parameterize the column name in the log statement.
Actual Code :
import groovy.sql.Sql
com.eviware.soapui.support.GroovyUtils.registerJdbcDriver( "com.microsoft.sqlserver.jdbc.SQLServerDriver" )
Env = "QA"
sql = Sql.newInstance("jdbc:sqlserver://127.0.0.1\\INST3;databaseName=Quality;user=Test;password=Test@123", "com.microsoft.sqlserver.jdbc.SQLServerDriver");
strQuery = "Select Name, "+Env+" from <TableName>"
sql.eachRow( strQuery )
{ row ->
log.info "$row.Name - $row.QA"
}
Now I need to parameterize the QA in the log statement in the loop using the "Env" variable.
Need help !!!
Thanks,
Srikar.
I have executed a SQL Query and got the result set
While accessing the resultset I need to parameterize the column name in the log statement.
Actual Code :
import groovy.sql.Sql
com.eviware.soapui.support.GroovyUtils.registerJdbcDriver( "com.microsoft.sqlserver.jdbc.SQLServerDriver" )
Env = "QA"
sql = Sql.newInstance("jdbc:sqlserver://127.0.0.1\\INST3;databaseName=Quality;user=Test;password=Test@123", "com.microsoft.sqlserver.jdbc.SQLServerDriver");
strQuery = "Select Name, "+Env+" from <TableName>"
sql.eachRow( strQuery )
{ row ->
log.info "$row.Name - $row.QA"
}
Now I need to parameterize the QA in the log statement in the loop using the "Env" variable.
Need help !!!
Thanks,
Srikar.