package bridge;
public class Client {
/**
* @param args
*/
public static void main
(String[] args
) {
// Client Update Command
CommandImpl clientUpdateImpl = PrepareClientModification("Vasily Pupkin");
UpdateCommand clientUpdate = new UpdateCommand(clientUpdateImpl);
if (!clientUpdate.Execute()) {
System.
out.
println(clientUpdate.
getErrors());
}
// Balance correction
CommandImpl balanceCorrectImpl = PrepareBalanceCorrection();
UpdateCommand balanceCommand = new UpdateCommand(balanceCorrectImpl);
if (!balanceCommand.Execute()) {
System.
out.
println(balanceCommand.
getErrors());
}
}
public static CommandImpl PrepareClientModification
(String newFIO
) { try {
Class.
forName("oracle.jdbc.driver.OracleDriver");
"jdbc:oracle:thin:@localhost:1521:XE", "user", "pass");
stmt = conn.createStatement();
e.printStackTrace();
e.printStackTrace();
}
CommandImpl ClientQuery = new SQLUpdateCommand(stmt,
"UPDATE `users` SET `fio` = " + newFIO);
return ClientQuery;
}
public static CommandImpl PrepareBalanceCorrection() {
return new UpdateFileCommand("balance.txt", "$ 100,000");
}
}