Klasse SQLiteV2

java.lang.Object
ch.framedev.javasqliteutils.SQLiteV2

public class SQLiteV2 extends Object
This Plugin was Created by FrameDev Package : mysql Date: 07.03.21 Project: untitled Copyrighted by FrameDev
  • Felddetails

  • Konstruktordetails

    • SQLiteV2

      protected SQLiteV2(String path, String database)
  • Methodendetails

    • connectAsync

      public void connectAsync(Callback<Connection> callback)
    • connect

      public Connection connect()
    • close

      public void close()
    • isTableExists

      public boolean isTableExists(String table)
      Checks if a table exists in the SQLite database.
      Parameter:
      table - The name of the table to check.
      Gibt zurück:
      true if the table exists, false otherwise.
    • isTableExistsAsync

      public void isTableExistsAsync(String table, Callback<Boolean> callback)
      Asynchronously checks if a table exists in the SQLite database.
      Parameter:
      table - The name of the table to check.
      callback - The callback to handle the result.
    • createTable

      public boolean createTable(String tableName, boolean date, String[] columns)
      Creates a table with the specified name and columns.
      Parameter:
      tableName - The name of the table to create.
      date - Whether to include a date column.
      columns - The columns to include in the table.
      Gibt zurück:
      true if the table was created successfully, false otherwise.
    • createTableAsync

      public void createTableAsync(String tableName, boolean date, String[] columns, Callback<Boolean> callback)
      Asynchronously creates a table with the specified name and columns.
      Parameter:
      tableName - The name of the table to create.
      date - Whether to include a date column.
      columns - The columns to include in the table.
      callback - The callback to handle the result.
    • insertData

      public boolean insertData(String table, Object[] data, String[] columns)
      Inserts data into a specified table with the given columns.
      Parameter:
      table - The name of the table to insert data into.
      data - The data to insert.
      columns - The columns corresponding to the data.
      Gibt zurück:
      true if the insertion was successful, false otherwise.
    • insertDataAsync

      public void insertDataAsync(String table, Object[] data, String[] columns, Callback<Boolean> callback)
      Asynchronously inserts data into a specified table with the given columns.
      Parameter:
      table - The name of the table to insert data into.
      data - The data to insert.
      columns - The columns corresponding to the data.
      callback - The callback to handle the result.
    • updateData

      public boolean updateData(String table, String selected, Object data, String where)
      Updates data in a specified table.
      Parameter:
      table - The name of the table to update.
      selected - The column to update.
      data - The new value for the column.
      where - The condition for the update (e.g., "id = 1").
      Gibt zurück:
      true if the update was successful, false otherwise.
    • updateDataAsync

      public void updateDataAsync(String table, String selected, Object data, String where, Callback<Boolean> callback)
      Asynchronously updates data in a specified table.
      Parameter:
      table - The name of the table to update.
      selected - The column to update.
      data - The new value for the column.
      where - The condition for the update (e.g., "id = 1").
      callback - The callback to handle the result.
    • updateData

      public boolean updateData(String table, String[] columns, Object[] values, String where)
      Updates data in a specified table with multiple columns.
      Parameter:
      table - The name of the table to update.
      columns - The columns to update.
      values - The new values for the columns.
      where - The condition for the update (e.g., "id = 1").
      Gibt zurück:
      true if the update was successful, false otherwise.
    • updateDataAsync

      public void updateDataAsync(String table, String[] columns, Object[] values, String where, Callback<Boolean> callback)
      Asynchronously updates data in a specified table with multiple columns.
      Parameter:
      table - The name of the table to update.
      columns - The columns to update.
      values - The new values for the columns.
      where - The condition for the update (e.g., "id = 1").
      callback - The callback to handle the result.
    • deleteDataInTable

      public boolean deleteDataInTable(String table, String where)
      Deletes data from a specified table based on a condition.
      Parameter:
      table - The name of the table to delete data from.
      where - The condition for the deletion (e.g., "id = 1").
      Gibt zurück:
      true if the deletion was successful, false otherwise.
    • deleteDataInTableAsync

      public void deleteDataInTableAsync(String table, String where, Callback<Boolean> callback)
      Asynchronously deletes data from a specified table based on a condition.
      Parameter:
      table - The name of the table to delete data from.
      where - The condition for the deletion (e.g., "id = 1").
      callback - The callback to handle the result.
    • deleteDataInTable

      public boolean deleteDataInTable(String table, String whereColumn, String whereValue, String andColumn, String andValue)
      Deletes data from a specified table based on two conditions.
      Parameter:
      table - The name of the table to delete data from.
      whereColumn - The column for the first condition.
      whereValue - The value for the first condition.
      andColumn - The column for the second condition.
      andValue - The value for the second condition.
      Gibt zurück:
      true if the deletion was successful, false otherwise.
    • deleteDataInTableAsync

      public void deleteDataInTableAsync(String table, String whereColumn, String whereValue, String andColumn, String andValue, Callback<Boolean> callback)
      Asynchronously deletes data from a specified table based on two conditions.
      Parameter:
      table - The name of the table to delete data from.
      whereColumn - The column for the first condition.
      whereValue - The value for the first condition.
      andColumn - The column for the second condition.
      andValue - The value for the second condition.
      callback - The callback to handle the result.
    • exists

      public boolean exists(String table, String column, String data)
      Checks if a record exists in a specified table based on a column and data.
      Parameter:
      table - The name of the table to check.
      column - The column to check.
      data - The data to check for existence.
      Gibt zurück:
      true if the record exists, false otherwise.
    • existsAsync

      public void existsAsync(String table, String column, String data, Callback<Boolean> callback)
      Asynchronously checks if a record exists in a specified table based on a column and data.
      Parameter:
      table - The name of the table to check.
      column - The column to check.
      data - The data to check for existence.
      callback - The callback to handle the result.
    • exists

      public boolean exists(String table, String column, String data, String andColumn, String andValue)
      Checks if a record exists in a specified table based on two conditions.
      Parameter:
      table - The name of the table to check.
      column - The column to check.
      data - The data to check for existence.
      andColumn - The second column for the condition.
      andValue - The value for the second condition.
      Gibt zurück:
      true if the record exists, false otherwise.
    • exists

      public boolean exists(String table, String[] column, String[] data)
      Asynchronously checks if a record exists in a specified table based on two conditions.
      Parameter:
      table - The name of the table to check.
      column - The column to check.
      data - The data to check for existence.
    • existsAsync

      public void existsAsync(String table, String column, String data, String andColumn, String andValue, Callback<Boolean> callback)
      Asynchronously checks if a record exists in a specified table based on two conditions.
      Parameter:
      table - The name of the table to check.
      column - The column to check.
      data - The data to check for existence.
      andColumn - The second column for the condition.
      andValue - The value for the second condition.
      callback - The callback to handle the result.
    • get

      public Object get(String table, String selected, String column, Object data)
      Retrieves a single value from a specified table based on a column and data.
      Parameter:
      table - The name of the table to query.
      selected - The column to select.
      column - The column to filter by.
      data - The value to filter by.
      Gibt zurück:
      The value from the selected column, or null if not found.
    • get

      public Object get(String table, String selected, String[] column, Object[] data)
      Asynchronously retrieves a single value from a specified table based on a column and data.
      Parameter:
      table - The name of the table to query.
      selected - The column to select.
      column - The column to filter by.
      data - The value to filter by.
    • getOptional

      public Optional<Object> getOptional(String table, String selected, String[] column, Object[] data)
    • getAsync

      public void getAsync(String table, String selected, String column, Object data, Callback<Object> callback)
      Asynchronously retrieves a single value from a specified table based on a column and data.
      Parameter:
      table - The name of the table to query.
      selected - The column to select.
      column - The column to filter by.
      data - The value to filter by.
      callback - The callback to handle the result.
    • get

      public List<Object> get(String table, String[] selectedColumns, String column, Object data)
      Retrieves multiple values from a specified table based on a column and data.
      Parameter:
      table - The name of the table to query.
      selectedColumns - The columns to select.
      column - The column to filter by.
      data - The value to filter by.
      Gibt zurück:
      A list of values from the selected columns, or an empty list if not found.
    • get

      public List<Object> get(String table, String[] selectedColumns, String[] column, Object[] data)
      Asynchronously retrieves multiple values from a specified table based on a column and data.
      Parameter:
      table - The name of the table to query.
      selectedColumns - The columns to select.
      column - The column to filter by.
      data - The value to filter by.
    • getAsync

      public void getAsync(String table, String[] selectedColumns, String column, Object data, Callback<List<Object>> callback)
      Asynchronously retrieves multiple values from a specified table based on a column and data.
      Parameter:
      table - The name of the table to query.
      selectedColumns - The columns to select.
      column - The column to filter by.
      data - The value to filter by.
      callback - The callback to handle the result.
    • get

      public <T> T get(String table, String selected, String column, Object data, Class<T> type)
      Retrieves a single value from a specified table based on a column and data, with type casting.
      Parameter:
      table - The name of the table to query.
      selected - The column to select.
      column - The column to filter by.
      data - The value to filter by.
      type - The expected type of the result.
      Gibt zurück:
      The value from the selected column, cast to the specified type, or null if not found or type mismatch.
    • getOptional

      public <T> Optional<T> getOptional(String table, String selected, String column, Object data, Class<T> type)
    • getAsync

      public <T> void getAsync(String table, String selected, String column, Object data, Class<T> type, Callback<T> callback)
      Asynchronously retrieves a single value from a specified table based on a column and data, with type casting.
      Parameter:
      table - The name of the table to query.
      selected - The column to select.
      column - The column to filter by.
      data - The value to filter by.
      type - The expected type of the result.
      callback - The callback to handle the result.
    • addColumn

      public boolean addColumn(String table, String column)
      Adds a new column to an existing table.
      Parameter:
      table - The name of the table to add the column to.
      column - The column definition (e.g., "new_column TEXT").
      Gibt zurück:
      true if the column was added successfully, false otherwise.
    • addColumnAsync

      public void addColumnAsync(String table, String column, Callback<Boolean> callback)
      Asynchronously adds a new column to an existing table.
      Parameter:
      table - The name of the table to add the column to.
      column - The column definition (e.g., "new_column TEXT").
      callback - The callback to handle the result.
    • removeColumn

      public boolean removeColumn(String table, String column)
      Removes a column from an existing table.
      Parameter:
      table - The name of the table to remove the column from.
      column - The name of the column to remove.
      Gibt zurück:
      true if the column was removed successfully, false otherwise.
    • removeColumnAsync

      public void removeColumnAsync(String table, String column, Callback<Boolean> callback)
      Asynchronously removes a column from an existing table.
      Parameter:
      table - The name of the table to remove the column from.
      column - The name of the column to remove.
      callback - The callback to handle the result.
    • showColumns

      public List<String> showColumns(String table)
      Retrieves the names of all columns in a specified table.
      Parameter:
      table - The name of the table to retrieve columns from.
      Gibt zurück:
      A list of column names in the specified table.
    • showColumnsAsync

      public void showColumnsAsync(String table, Callback<List<String>> callback)
      Asynchronously retrieves the names of all columns in a specified table.
      Parameter:
      table - The name of the table to retrieve columns from.
      callback - The callback to handle the result.