khairul169 / gdsqlite-native

SQLite module for Godot 3.x
MIT License
219 stars 41 forks source link

Added functions for parameterized queries #29

Closed TGRCdev closed 5 years ago

TGRCdev commented 5 years ago

This pull request adds query_with_args, fetch_array_with_args, and fetch_assoc_with_args. These functions use parameter binding and help defend against SQL injection attacks. Each of these takes an additional PoolStringArray. These can be called like so:

db.query_with_args("INSERT INTO potion VALUES(?, ?, ?)", ["Jeff's Frikkin' Tasty Heals", 50, 25])

Each function will fail if the amount of arguments passed does not match the amount of arguments in the query. This pull request should maintain backwards compatibility with code written using the non-parameterized functions.

Tested on Windows 10 Home 64-bit on Godot 3.1 stable. Closes #28

khairul169 commented 5 years ago

Thanks! :)