1 package com.imcode.db;
2
3 import com.imcode.db.Database;
4 import com.imcode.db.DatabaseConnection;
5 import com.imcode.db.DatabaseCommand;
6 import com.imcode.db.DatabaseException;
7
8 public class SingleConnectionDatabase implements Database {
9
10 private final DatabaseConnection connection;
11
12 public SingleConnectionDatabase(DatabaseConnection connection) {
13 this.connection = connection;
14 }
15
16 public Object execute(DatabaseCommand databaseCommand) throws DatabaseException {
17 return databaseCommand.executeOn(connection) ;
18 }
19
20 public Object executeCommand(DatabaseCommand databaseCommand) throws DatabaseException {
21 return execute(databaseCommand) ;
22 }
23 }