Closed VoxelTek closed 8 months ago
Hello @VoxelTek 😄
This is a restriction of SQLite: You can't bind table_names nor column_names in SQLite 😢 See here: https://github.com/2shady4u/godot-sqlite?tab=readme-ov-file#functions
In your case you would have to do the following:
var possible_id = randi() % (2^14)
var table_name = "Users"
var check_user_ID : String = "SELECT * FROM " + table_name + " WHERE User_ID = ?;"
var ID_params : Array = [possible_id]
var ID_check_success = responses_db.query_with_bindings(check_user_ID, ID_params)
Ah, damn. That's annoying, but thanks for your help! I was hoping to avoid having to do it this way in order to ensure inputs are sanitised, but ah well. I appreciate your rapid response, and I'm glad this project exists!
SQLite documentation: https://www.sqlite.org/cintro.html
Relevant section in Chapter 6:
Environment:
Issue description: Attempting to use
query_with_bindings
throws a syntax error:Steps to reproduce: _(database already loaded into
responses_db
)_Error thrown:
First error caused by this earlier code snippet:
Minimal reproduction project: Likely unnecessary, please inform if required.
Additional context Installed godot-sqlite from Godot Asset Library, as was recommended.