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