names of methods in statementBuilder are simpler now

master
Justyna Ilczuk 2013-04-26 16:48:50 +02:00
parent 41608e3dc3
commit cb39a2b373
1 changed files with 10 additions and 10 deletions

View File

@ -19,7 +19,7 @@ import java.util.ArrayList;
class StatementBuilder class StatementBuilder
{ {
public PreparedStatement prepareFindingAuthorByNameStatement(Connection connection) throws SQLException public PreparedStatement findAuthorByNameStatement(Connection connection) throws SQLException
{ {
PreparedStatement statement = connection.prepareStatement( PreparedStatement statement = connection.prepareStatement(
"select * from authors where name=?"); "select * from authors where name=?");
@ -27,7 +27,7 @@ class StatementBuilder
return statement; return statement;
} }
public PreparedStatement prepareAddingAuthorStatement(Connection connection) public PreparedStatement addAuthorStatement(Connection connection)
throws SQLException, ClassNotFoundException throws SQLException, ClassNotFoundException
{ {
PreparedStatement statement = connection.prepareStatement( PreparedStatement statement = connection.prepareStatement(
@ -37,7 +37,7 @@ class StatementBuilder
} }
public PreparedStatement prepareAddingBookStatement(Connection connection) public PreparedStatement addBookStatement(Connection connection)
throws SQLException, ClassNotFoundException throws SQLException, ClassNotFoundException
{ {
PreparedStatement statement = connection.prepareStatement( PreparedStatement statement = connection.prepareStatement(
@ -46,7 +46,7 @@ class StatementBuilder
return statement; return statement;
} }
public PreparedStatement prepareFindingBookStatement(Connection connection) public PreparedStatement findBookStatement(Connection connection)
throws SQLException, ClassNotFoundException throws SQLException, ClassNotFoundException
{ {
PreparedStatement statement = connection.prepareStatement( PreparedStatement statement = connection.prepareStatement(
@ -55,7 +55,7 @@ class StatementBuilder
return statement; return statement;
} }
public PreparedStatement prepareFindingBookByAuthorStatement(Connection connection) public PreparedStatement findBookByAuthorStatement(Connection connection)
throws SQLException, ClassNotFoundException throws SQLException, ClassNotFoundException
{ {
PreparedStatement statement = connection.prepareStatement( PreparedStatement statement = connection.prepareStatement(
@ -112,7 +112,7 @@ public class SqliteDatabaseHandler
this.addAuthor(book.getAuthor()); this.addAuthor(book.getAuthor());
} }
PreparedStatement stat; PreparedStatement stat;
stat= statBld.prepareAddingBookStatement(connection); stat= statBld.addBookStatement(connection);
stat.setString(1, book.getTitle()); stat.setString(1, book.getTitle());
stat.setString(2, book.getAuthor().getName()); stat.setString(2, book.getAuthor().getName());
stat.setString(3, book.getPathToContent()); stat.setString(3, book.getPathToContent());
@ -144,7 +144,7 @@ public class SqliteDatabaseHandler
try try
{ {
PreparedStatement stat; PreparedStatement stat;
stat= statBld.prepareFindingBookStatement(connection); stat= statBld.findBookStatement(connection);
stat.setString(1, title); stat.setString(1, title);
stat.executeQuery(); stat.executeQuery();
ResultSet rs = stat.executeQuery(); ResultSet rs = stat.executeQuery();
@ -179,7 +179,7 @@ public class SqliteDatabaseHandler
try try
{ {
PreparedStatement stat; PreparedStatement stat;
stat = statBld.prepareFindingBookByAuthorStatement(connection); stat = statBld.findBookByAuthorStatement(connection);
stat.setString(1, author.getName()); stat.setString(1, author.getName());
ResultSet rs = stat.executeQuery(); ResultSet rs = stat.executeQuery();
ArrayList<Book> books = new ArrayList<>(); ArrayList<Book> books = new ArrayList<>();
@ -219,7 +219,7 @@ public class SqliteDatabaseHandler
try try
{ {
PreparedStatement stat; PreparedStatement stat;
stat= statBld.prepareAddingAuthorStatement(connection); stat= statBld.addAuthorStatement(connection);
stat.setString(1, author.getName()); stat.setString(1, author.getName());
stat.setString(2, author.getAdditionalInfo()); stat.setString(2, author.getAdditionalInfo());
stat.executeUpdate(); stat.executeUpdate();
@ -252,7 +252,7 @@ public class SqliteDatabaseHandler
try try
{ {
PreparedStatement stat; PreparedStatement stat;
stat= statBld.prepareFindingAuthorByNameStatement(connection); stat= statBld.findAuthorByNameStatement(connection);
stat.setString(1, name); stat.setString(1, name);
stat.executeQuery(); stat.executeQuery();
ResultSet rs = stat.executeQuery(); ResultSet rs = stat.executeQuery();