The GuildedSQL interface provides methods to create, update, delete, and query tables and entries within your Guilded server.
Creates a new table with the given name.
- Parameters:
name: The table's name. Must be betweenGuildedTable.MIN_STRandGuildedTable.MAX_NAME.
- Returns:
GuildedTableinstance of the newly created table. - Throws:
KeyAlreadyExistsExceptionif a table with the given name already exists.
Creates a new table with the given name and description.
- Parameters:
name: The table's name. Must be betweenGuildedTable.MIN_STRandGuildedTable.MAX_NAME.description: The table's description. Must be betweenGuildedTable.MIN_STRandGuildedTable.MAX_DESC.
- Returns:
GuildedTableinstance of the newly created table. - Throws:
KeyAlreadyExistsExceptionif a table with the given name already exists.
Updates a table with the name oldName using the provided updated instance. If the updated instance's name or description is null, the old values are retained.
- Parameters:
oldName: The current name of the table to update.updated: The instance containing the updated data for the table.
- Returns: The updated
GuildedTableinstance. - Throws:
NoSuchElementExceptionif a table with the givenoldNamedoesn't exist.
Updates a table with the name oldName to the given newName and newDescription. If newName or newDescription is null, the old values are retained.
- Parameters:
oldName: The current name of the table to update.newName: The new name for the table. Ifnull, the name remains unchanged.newDescription: The new description for the table. Ifnull, the description remains unchanged.
- Returns: The updated
GuildedTableinstance. - Throws:
NoSuchElementExceptionif a table with the givenoldNamedoesn't exist.
Deletes the specified table.
- Parameters:
table: The table to delete.
- Returns:
trueif the table was successfully deleted,falseotherwise.
Deletes the table with the specified name.
- Parameters:
tableName: The name of the table to delete.
- Returns:
trueif the table was successfully deleted,falseotherwise.
Checks whether a key exists in the specified table.
- Parameters:
table: The table to check.key: The key to check for.
- Returns:
trueif the key exists,falseotherwise. - Throws:
NoSuchElementExceptionif the table doesn't exist.
Retrieves a list of the last limit entries from the specified table.
- Parameters:
table: The table from which to retrieve entries.limit: The number of entries to retrieve. Must be less than or equal toConstants.MAX_LIMIT.
- Returns: A list of the last
limitentries from the table. - Throws:
NoSuchElementExceptionif the table doesn't exist.
Retrieves a list of the last 50 entries from the specified table.
- Parameters:
table: The table from which to retrieve entries.
- Returns: A list of the last 50 entries from the table.
- Throws:
NoSuchElementExceptionif the table doesn't exist.
Retrieves a single entry with the specified key from the specified table.
- Parameters:
table: The table from which to retrieve the entry.key: The key of the entry to retrieve.
- Returns: The entry if it exists,
nullotherwise. - Throws:
NoSuchElementExceptionif the table or key doesn't exist.
Retrieves a list of the first limit entries from the specified table that match the user-defined filter.
- Parameters:
table: The table from which to retrieve entries.limit: The number of entries to retrieve. Must be less than or equal toConstants.MAX_LIMIT.filter: The user-defined filter to apply.
- Returns: A list of the filtered entries.
- Throws:
NoSuchElementExceptionif the table doesn't exist.
Inserts the specified data into the specified table with the specified key.
- Parameters:
table: The table to insert the data into.key: The key for the data. Must be unique.data: The data to insert.
- Throws:
NoSuchElementExceptionif the table doesn't exist.KeyAlreadyExistsExceptionif the key already exists in the table.
Updates an entry in the specified table with the specified key.
- Parameters:
table: The table containing the entry to update.key: The key of the entry to update. Must exist in the table.data: The new data for the entry.
- Throws:
NoSuchElementExceptionif the table or key doesn't exist.
Updates the key of an entry in the specified table.
- Parameters:
table: The table containing the entry to update.oldKey: The current key of the entry. Must exist in the table.newKey: The new key for the entry. Must not exist in the table.
- Throws:
NoSuchElementExceptionif the table or old key doesn't exist.KeyAlreadyExistsExceptionif the new key already exists in the table.
Deletes an entry with the specified key from the specified table.
- Parameters:
table: The table containing the entry to delete.key: The key of the entry to delete.
- Returns:
trueif the entry was successfully deleted,falseotherwise.