Merge pull request #7 from intoverflow/tcarstens/query-params
Updated _create_entry to use sqlite's parameter syntax for values
This commit is contained in:
@@ -51,7 +51,7 @@ table name `student` and rows `student_id`, `student_name` with datatypes
|
||||
integer and text, respectively. The default value for `student_name` is
|
||||
`John Smith`.
|
||||
|
||||
##Basic Usage
|
||||
## Basic Usage
|
||||
|
||||
### Entry manipulation
|
||||
|
||||
|
||||
@@ -27,7 +27,8 @@ def _create_entry(self) -> None:
|
||||
try:
|
||||
cur.execute(f"INSERT INTO {table_name}("
|
||||
f"{', '.join(item[0] for item in kv_pairs)})"
|
||||
f" VALUES ({', '.join(_convert_sql_format(item[1]) for item in kv_pairs)});")
|
||||
f" VALUES ({', '.join('?' for item in kv_pairs)})",
|
||||
[_convert_sql_format(item[1]) for item in kv_pairs])
|
||||
self.__setattr__("obj_id", cur.lastrowid)
|
||||
con.commit()
|
||||
except IntegrityError:
|
||||
|
||||
Reference in New Issue
Block a user