fix(db/postgres): Resolve SQL identifier casing issues
Improves SQL query execution by ensuring proper casing for identifiers across various database types, particularly for Postgres. Enhances security and compatibility by using an identifier escaping method, preventing potential errors due to case sensitivity in SQL queries. Addresses potential issues with existing queries for better reliability and consistency.
This commit is contained in:
parent
69b98980f1
commit
2d839e3609
9 changed files with 81 additions and 47 deletions
|
|
@ -82,7 +82,7 @@ namespace TShockAPI.DB
|
|||
|
||||
try
|
||||
{
|
||||
using var reader = database.QueryReader("SELECT * FROM tsCharacter WHERE Account=@0", acctid);
|
||||
using var reader = database.QueryReader($"SELECT * FROM tsCharacter WHERE {"Account".EscapeSqlId(database)}=@0", acctid);
|
||||
if (reader.Read())
|
||||
{
|
||||
playerData.exists = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue