Skip to content

Commit 53e8c37

Browse files
author
patched.codes[bot]
committed
Patched /tmp/tmpizwbfryv/index.py
1 parent 5e38558 commit 53e8c37

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

index.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@
77
}
88

99
def get_data_by_config_value(value):
10-
# This might look suspicious due to string concatenation with values from CONFIG.
11-
query = "SELECT * FROM " + CONFIG["default_table"] + " WHERE " + CONFIG["default_column"] + " = '" + value + "'"
10+
query = "SELECT * FROM {} WHERE {} = ?".format(CONFIG["default_table"], CONFIG["default_column"])
1211

1312
connection = sqlite3.connect("database.db")
1413
cursor = connection.cursor()
15-
cursor.execute(query)
14+
cursor.execute(query, (value,))
1615
result = cursor.fetchall()
1716
connection.close()
1817

0 commit comments

Comments
 (0)