Database Reference
In-Depth Information
@Override
@WebMethod
@WebResult(name = "sqlResponse")
public CTUFusionDBAdapterResponse executeSQL(
@WebParam(name = "SQLStatements")
CTUFusionDBAdapterSQLStatements sqls,
@WebParam(name = "datasource") String datasource) {
int x = 0;
CTUFusionDBAdapterResponse response = null;
try {
connection = getDynamicConnection(datasource);
Statement statement =
connection.createStatement();
String resultStr ="";
String[] sqlStrings = sqls.getSql();
for(x=0;x<sqlStrings.length;x++){
boolean result =
statement.execute(sqlStrings[x]);
if(!result){
resultStr+=Integer.toString(statement.getUpdateCount());
}else{
resultStr+="S";
}
resultStr=(x<sqlStrings.length-1)?resultStr+"|":resultStr;
}
response = new
CTUFusionDBAdapterResponse("0","",resultStr);
statement.close();
connection.commit();
connection.close();
} catch (SQLException sqle) {
sqle.printStackTrace();
log.severe("SQLException,
["+sqle.getMessage()+"]");
return new
CTUFusionDBAdapterResponse("SQL-1","SQLException,
SQL@position["+x+"] "+sqle.toString(),null);
Search WWH ::




Custom Search