X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2Forg%2Fmxchange%2Fjcore%2Fdatabase%2Fbackend%2FDatabaseBackend.java;h=0dd7dac728e13fe1a1d46b9fc482683ccaa94214;hb=4ba810ed69c77d323d5a456124b23b04a241a854;hp=3a8154257964dc8c7408a9e11daa4989a3b36a92;hpb=cf5d98f8e1028421d45d23c8ec007475e45ca307;p=jcore.git diff --git a/src/org/mxchange/jcore/database/backend/DatabaseBackend.java b/src/org/mxchange/jcore/database/backend/DatabaseBackend.java index 3a81542..0dd7dac 100644 --- a/src/org/mxchange/jcore/database/backend/DatabaseBackend.java +++ b/src/org/mxchange/jcore/database/backend/DatabaseBackend.java @@ -18,8 +18,9 @@ package org.mxchange.jcore.database.backend; import java.io.IOException; import java.sql.SQLException; -import java.util.Iterator; import org.mxchange.jcore.FrameworkInterface; +import org.mxchange.jcore.criteria.searchable.SearchableCritera; +import org.mxchange.jcore.database.result.Result; import org.mxchange.jcore.database.storage.Storeable; import org.mxchange.jcore.exceptions.BadTokenException; @@ -38,71 +39,22 @@ public interface DatabaseBackend extends FrameworkInterface { public void connectToDatabase () throws SQLException; /** - * Shuts down this backend - */ - public void doShutdown (); - - /** - * Some "getter" for row index from given boolean row value - * - * @param columnName Name of column - * @param bool Boolean value to look for - * @return Row index - */ - public int getRowIndexFromColumn (final String columnName, final boolean bool); - - /** - * Some "getter" for total table row count - * - * @return Total row count - * @throws java.sql.SQLException If an SQL error occurs - */ - public int getTotalCount () throws SQLException; - - /** - * Checks whether at least one row is found with given boolean value. - * - * @param columnName Column to check for boolean value - * @param bool Boolean value to check - * @return Whether boolean value is found and returns at least one row - * @throws java.sql.SQLException If an SQL error occurs - */ - public boolean isRowFound (final String columnName, final boolean bool) throws SQLException; - - /** - * Rewinds backend - */ - public void rewind (); - - /** - * Get length of underlaying file - * - * @return Length of underlaying file - */ - public long length (); - - /** - * Stores an object in the database. + * Run a "SELECT" statement with given criteria and always return a Result + * instance. The result instance then provides methods to iterate over all + * found entries. * - * @param object Object to store in database - * @throws java.io.IOException From inner class + * @param critera Search critera + * @return A result instance + * @throws java.io.IOException If any IO error occurs + * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found */ - public void store (final Storeable object) throws IOException; + public Result doSelectByCriteria (final SearchableCritera critera) throws IOException, BadTokenException; /** - * Gets an iterator for contacts + * Shuts down this backend * - * @return Iterator for contacts - * @throws org.mxchange.jcore.exceptions.BadTokenException If the CSV token is badly formulated - */ - public Iterator iterator () throws BadTokenException; - - /** - * Reads a single row from database. - * - * @param rowIndex Row index (or how much to skip) - * @return A Storeable instance - * @throws org.mxchange.jcore.exceptions.BadTokenException If a token was badly formatted + * @throws java.sql.SQLException If any SQL error occurs + * @throws java.io.IOException If any IO error occurs */ - public Storeable readRow (final int rowIndex) throws BadTokenException; + public void doShutdown () throws SQLException, IOException; }