The Advanced MySQL Extension for MIT App Inventor provides comprehensive tools for managing MySQL databases. It includes a variety of methods for handling tables, columns, indexes, and executing queries with advanced options. Below is a detailed explanation of each block's functionality and usage.
Description:
Adds new columns to an existing table in the MySQL database. You need to specify the table name and a list of columns with their respective data types (e.g., 'age INT', 'email VARCHAR(100)').
Parameters:
- tableName: The name of the table where new columns will be added (Type: text).
- columns: A list of column definitions including their names and data types (Type: list).
Description:
Creates an index on one or more columns of a table to improve query performance.
Parameters:
- tableName: The name of the table on which the index will be created (Type: text).
- indexName: The name of the index to be created (Type: text).
- columns: A list of columns that the index will be based on (Type: list).
Description:
Creates a new table in the MySQL database with specified columns and a primary key.
Parameters:
- tableName: The name of the new table to be created (Type: text).
- columns: A list of column definitions including names and data types (Type: list).
- primaryKey: The primary key column of the new table (Type: text).
Description:
Deletes specific rows from a table based on a condition (e.g., 'id = 1' to delete rows where the id
is 1).
Parameters:
- tableName: The name of the table from which rows will be deleted (Type: text).
- whereClause: The condition to specify which rows to delete (Type: text).
Description:
Drops an index from a table. This action removes the index, which may affect the performance of certain queries.
Parameters:
- tableName: The name of the table from which the index will be dropped (Type: text).
- indexName: The name of the index to be dropped (Type: text).
Description:
Deletes a table by its name. The specified table must exist; otherwise, no action is taken.
Parameters:
- tableName: The name of the table to be dropped (Type: text).
Description:
Executes a MySQL query and returns the result in JSON format. It can handle SELECT
queries (returns rows) and other types of queries (returns the number of affected rows).
Parameters:
- query: The MySQL query to execute (Type: text).
Description:
Executes a transaction with multiple queries. All queries are executed as a batch, and if any query fails, the transaction is rolled back to maintain data integrity.
Parameters:
- queries: A list of MySQL queries to be executed as a transaction (Type: list).
Description:
Retrieves the data types of columns in a specified table, which helps understand the structure of the table.
Parameters:
- tableName: The name of the table whose column data types are to be retrieved (Type: text).
Description:
Retrieves column names from a table based on the row position. The position is zero-based (e.g., position 0 retrieves the first row).
Parameters:
- tableName: The name of the table from which column names are to be retrieved (Type: text).
- position: The position of the row to retrieve column names from (Type: number).
Description:
Gets the total number of rows in a specified table, which can help determine the size of the table.
Parameters:
- tableName: The name of the table for which the row count is to be determined (Type: text).
Description:
Retrieves all rows from a specified table and returns the result in JSON format, including all rows of the table.
Parameters:
- tableName: The name of the table from which rows are to be retrieved (Type: text).
Description:
Retrieves a list of all table names in the database and returns a list of table names as a YailList
.
Parameters:
- None
Description:
Renames a table in the database, which is useful for reorganizing the database schema or correcting table names.
Parameters:
- oldName: The current name of the table to be renamed (Type: text).
- newName: The new name for the table (Type: text).
Description:
Checks if a table exists in the database. It is useful to verify if a table is available before performing operations on it.
Parameters:
- tableName: The name of the table to check for existence (Type: text).
Description:
Updates specific columns in a table with new values. The whereClause
specifies which rows to update (e.g., 'id = 1').
Parameters:
- tableName: The name of the table to be updated (Type: text).
- columns: A list of column names to be updated (Type: list).
- values: A list of new values for the specified columns (Type: list).
- whereClause: A condition to specify which rows to update (Type: text).
Description:
Triggered when columns from a table are retrieved, providing the column names as a list.
Parameters:
- columns: A list of column names retrieved from the table (Type: list).
Description:
Triggered when any MySQL operation fails, providing an error message describing the failure.
Parameters:
- errorMessage: A text description of the error that occurred (Type: text).
Description:
Triggered when a query is executed successfully, providing the result of the query or the number of affected rows.
Parameters:
- value: The result of the query or the number of rows affected by the query (Type: text).
Description:
Triggered when all rows from a table are retrieved, providing the result as a JSON string.
Parameters:
- value: A JSON string containing all rows retrieved from the table (Type:
text).
Description:
Triggered when any MySQL operation is successful, providing a success message describing the operation.
Parameters:
- successMessage: A text message indicating the success of the operation (Type: text).
Description:
Triggered when all table names are retrieved, providing the table names as a list.
Parameters:
- tables: A list of all table names retrieved from the database (Type: list).
Description:
Sets the password for the MySQL database connection.
Description:
Sets the server URL for the MySQL database. Example: jdbc:mysql://localhost:3306/mydatabase
.
Description:
Sets the username for the MySQL database connection.
This documentation was generated using Riad Developer Documentation Generator.