1   /*
2    * Replica is published under the terms
3    * of the Apache Software License.
4    */
5   package replica.database.commands.sql;
6   
7   import java.sql.SQLException;
8   import java.sql.Statement;
9   
10  import replica.core.ApplicationMessage;
11  import replica.database.commands.StatementDbCommand;
12  import replica.server.commands.PrintCommand;
13  
14  /***
15   * 
16   * @author Pedro Costa
17   * @author Helder Silva
18   * @since 20/Jan/2004
19   */
20  public class CallDbCommand extends StatementDbCommand {
21  
22  	/***
23  	 * 
24  	 */
25  	public CallDbCommand() {
26  		super();
27  	}
28  
29  	/* (non-Javadoc)
30  	 * @see replica.database.commands.DatabaseCommand#execute(java.sql.Statement, java.lang.String)
31  	 */
32  	protected Object execute(Statement st, String command) throws SQLException{
33  		boolean hasResult =  st.execute( command );
34  		
35  		if( hasResult )
36  			return st.getResultSet();
37  		
38  		int updateCount = st.getUpdateCount();
39  					
40  		ApplicationMessage result = new ApplicationMessage();
41  		result.setOriginator(ApplicationMessage.DATABASE_MODULE);
42  		result.setBody( PrintCommand.NAME + " " + updateCount + " rows afected.");
43  
44  		return result;
45  	}
46  
47  }
This page was automatically generated by Maven