diff --git a/GSMParser/QueryBuilder.cs b/GSMParser/QueryBuilder.cs index 9870678..e045d13 100644 --- a/GSMParser/QueryBuilder.cs +++ b/GSMParser/QueryBuilder.cs @@ -1,47 +1,26 @@ public static class QueryBuilder { - private static string NewQueryFromCommand(string select, string from, string where, string query, bool modalRecord, bool exactMatch) - { - string _query = string.Empty; - - _query += ($"SELECT \"{select}\""); - - if (modalRecord == true) - { - _query += ",* "; - } - else - { - _query += " "; - } - - _query += ($"FROM \"main\".\"{from}\"" + - $"WHERE \"{where}\" "); - - if (exactMatch == true) - { - _query += ($"LIKE '{query}'"); - } - else - { - _query += ($"LIKE '%{query}%'"); - } - - return _query; - } - public static string GameByName(string name) { - return NewQueryFromCommand("GameName", "GameEntry", "GameName", name, true, false); + return $"SELECT \"GameName\",*" + + $"FROM \"main\".\"GameEntry\"" + + $"WHERE \"GameName\"" + + $"LIKE \"%{name}%\""; } public static string GameById(string id) { - return NewQueryFromCommand("GameName", "GameEntry", "id", id, true, true); + return $"SELECT \"GameName\",*" + + $"FROM \"main\".\"GameEntry\"" + + $"WHERE \"id\"" + + $"LIKE \"{id}\""; } public static string DirectoryById(string id) { - return NewQueryFromCommand("Path", "Directories", "GameID", id, true, true); + return $"SELECT \"Path\",*" + + $"FROM \"main\".\"Directories\"" + + $"WHERE \"GameID\"" + + $"LIKE \"{id}\""; } }