This function retrieves data from a SQLite database based on a provided value and pre-configured table and column settings.
value
(string): The value to search for in the specified database column.
- A list of tuples. Each tuple represents a row from the database where the specified column matches the provided
value
. Returns an empty list if no matches are found.
The function uses a hardcoded configuration (CONFIG
) to determine the table and column to query. It constructs a SQL query using string concatenation, which can be a security risk (SQL injection vulnerability). The function connects to a SQLite database file named database.db
, executes the query, fetches all matching rows, and then closes the connection. The fetched data is then returned.
This function is likely used for retrieving specific data based on simple lookups configured in the CONFIG
dictionary. For instance, it could be used:
- To fetch user details by username.
- To retrieve product information by product ID.
The use of string concatenation in the query construction makes this function vulnerable to SQL injection attacks. Consider using parameterized queries or prepared statements to mitigate this risk.