dropTable method
Drops the table from the MySQL database.
Executes a DROP TABLE IF EXISTS statement to safely remove the table from the database. The IF EXISTS clause prevents errors if the table doesn't exist.
Parameters:
conn
- The active MySQL database connection
Returns a MySqlResult indicating the success or failure of the drop operation.
Example:
var result = await table.dropTable(conn);
if (result.success) {
print('Table dropped successfully');
}
Implementation
Future<MySqlResult> dropTable(MySQLConnection conn) async {
String sql = 'DROP TABLE IF EXISTS `$name`;';
return execute(conn, sql);
}