public string[] GetGameLibrary(int loginID) { SQL_Handler handler = new SQL_Handler(); handler.SQLConnect("default", 0, "default", "default", "default"); return(handler.SQLQuery("SELECT WHERE id=" + loginID)); }
private void CreateLibrary(int id) { SQL_Handler handler = new SQL_Handler(); handler.SQLConnect("default", 0, "default", "default", "libraries"); handler.SQLQuery("CREATE TABLE " + id + " (`gameId` INT NOT NULL, `hoursInGame` VARCHAR(20) NOT NULL, PRIMARY KEY(`gameId`, `hoursInGame`));"); }
public void CreateUser(string username, string password) { SQL_Handler handler = new SQL_Handler(); handler.SQLConnect("default", 0, "default", "default", "users"); int newUserId = int.Parse(handler.SQLQuery("SELECT MAX(id) FROM users")[0]) + 1; handler.SQLQuery("INSERT INTO users (id, username, password) VALUES (" + newUserId + ", " + username + ", " + password + ")"); CreateLibrary(newUserId); }
public Game getGame(int gameId) { SQL_Handler handler = new SQL_Handler(); handler.SQLConnect("default", 0, "default", "default", "games"); string[] gameInfo = handler.SQLQuery("SELECT * FROM games WHERE gameId=" + gameId); Game game = new Game(int.Parse(gameInfo[0]), gameInfo[1], gameInfo[2], gameInfo[3]); return(game); }