SQLite

  • Description

      SQLite

      SQLite component is a non-visible component. SQLite is a small, fast, self-contained SQL (Structured Query Language) database engine built into Android. SQL statements are used to create, select, update, and delete data in one or more tables. SQL allows for complex relationships between tables and provides an expressive means to find data stored in a database.

  • Events

    • After execution (text waxExecuted)
    • Event handler after the SQL statement is executed, returns whether the execution was succesfully executed.
    • After query (text result, number numberOfRecords)
    • Event handler after the ExecuteRawQuery or Query is executed and returns a list with the selected data and number of records.
    • Error ocurred (text message)
    • Event handler when an error occurred, returns a string with a message from the error.
  • Procedures

    • Clean database
    • Clears the database to version 1. Use only while developing, this shouldn't be used on production.
    • Delete
    • Executes pre-compiled DELETE statement with specified parameters.
      • String table: Name of the table.
      • String whereClause: Optional WHERE clause to apply when deleting (Example: 'ID = ?'), pasing an empty a string will delete all rows.
      • List whereArgs: List with arguments for the WHERE clause. These arguments will be replaced by '?' in the whereClause. Returns the number of rows affected if a whereClause is passed in, 0 otherwise.
    • Get Path
    • Returns the path to the database.
    • Insert
    • Executes pre-compiled INSERT statement with specified parameters.
      • String table: Name of the table.
      • YailList columns: List with the columns that will contain the data to be inserted in the database.
      • YailList values: List with the data to be inserted in the database. Returns the row ID of the newly inserted row, or -1 if an error occurred.
    • Multiple SQL
    • Execute Multiple SQL Statement asynchronously and returns whether the transaction was succesful in the 'AfterExecution' Event Handler. Use it when returned data isn't needed. Parameters: List of SQL statements.
    • Query
    • Executes pre-compiled QUERY statement with specified parameters.
      • String table: Name of the table.
      • YailList columns: List of which columns to return, passing an empty list will return all columns.
      • String selection: Filter declaring which rows to return, formatted as an SQL WHERE clause, passing an empty string will return all rows.
      • YailList selectionArgs: List with the arguments that will replace onto '?' in the selection filter.
      • String groupBy: A filter declaring how to group rows, formatted as an SQL GROUP BY clause (excluding the GROUP BY itself), passing an empty string will cause the row to not be grouped.
      • String having: A filter declare which row groups to include if row grouping is being used, passing an empty string will cause all row groups to be included.
      • String orderBy: How to order the rows, formatted as an SQL ORDER BY clause (excluding the ORDER BY itself), passing an empty string will use the default sort order (unordered).
      • String limit: Limits the number of rows returned by the query, formatted as LIMIT clause, passing an empty string denotes no LIMIT clause.
      Return:The result query is available in the 'AfterQuery' event handler.
    • Raw query
    • Executes the provided rawQuery Statement asynchronously, returns a YailList with the selected data and number of records in the 'AfterQuery' Event.
      • String: SQL statement.
      • List selectionArgs: List with the arguments that will replace '?' in where clause in the query, to prevent SQL injections.
    • Replace
    • Executes pre-compiled REPLACE OR INSERT INTO statement with specified parameters.
      • String table: Name of the table.
      • YailList columns: List with the columns that will contain the data to be replaced in the database.
      • YailList values: List with the data to be replaced in the database. Returns the row ID of the newly replaced row, or -1 if an error occurred.
    • Single SQL
    • Execute a Single SQL Statement asynchronously and returns whether the transaction was succesful in the 'AfterExecution' Event Handler. Use it when returned data isn't needed. Parameters: String sql.
    • Update
    • Executes pre-compiled UPDATE statement with specified parameters.
      • String table: Name of the table.
      • YailList columns: List with the columns that will contain the data to be inserted in the database.
      • YailList values: List with the data to be inserted in the database.
      • String whereClause: optional WHERE clause to apply when updating, leave an empty string to update all rows. Include ?s, which will be updated by the values from whereArgs.
      • YailList whereArgs: List with the columns that will contain the data to be updated in the database. Returns the row ID of the newly inserted row, or -1 if an error occurred.
  • Properties

    • Return header
    • Returns or specifies whether the header row should be returned in the result of a Select statement.
    • Suppress toast
    • Returns or specifies whether Success Toast should be suppressed.