Update block_wrapper.py
This commit is contained in:
parent
d3762e483b
commit
c3b127d5f4
@ -111,9 +111,13 @@ def construct_sql(input_data):
|
||||
replacement = "NULL"
|
||||
elif isinstance(value, bool):
|
||||
replacement = "TRUE" if value else "FALSE"
|
||||
elif isinstance(value, (list, tuple)):
|
||||
# Serialize list/tuple safely to avoid quote issues in SQL.
|
||||
replacement = f"'{json.dumps(value)}'"
|
||||
elif isinstance(value, str):
|
||||
# Escape quotes if needed, or just do naive single quote
|
||||
replacement = f"'{value}'"
|
||||
# Escape single quotes to keep SQL well-formed.
|
||||
sanitized = value.replace("'", "''")
|
||||
replacement = f"'{sanitized}'"
|
||||
else:
|
||||
replacement = str(value)
|
||||
|
||||
@ -273,4 +277,4 @@ async def main():
|
||||
raise
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
asyncio.run(main())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user