SQL Lobby Issue?

Options
taleri
taleri
I'm trying to create a filter for my matchmaking to disallow users to play against themselves.

I was able to create a filter for rank-based matches without any trouble, but I was only using the "C0" property, which was an integer. I'm now trying to add a C1, which is a string, and add it to my filter for rank-based games, as well as creating a filter for non-ranked games.

My current filter looks like this for the "Normal" mode:

Creating the room:
RoomOptions roomOptions = new RoomOptions();
			roomOptions.MaxPlayers = 2;
			roomOptions.customRoomProperties = new ExitGames.Client.Photon.Hashtable() { { "C1", UserID } };
			roomOptions.customRoomPropertiesForLobby = new string[] { "C1" };
			TypedLobby sqlLobby = new TypedLobby("Normal", LobbyType.SqlLobby);
			PhotonNetwork.CreateRoom(null, roomOptions, sqlLobby);

And then to join a random room with the above filter:
TypedLobby sqlLobby = new TypedLobby("Normal", LobbyType.SqlLobby);
			print("Filter has the id: " + UserID);
			string sqlLobbyFilter = string.Format("C1 <> {0}", SaveLoad.UserID);
			PhotonNetwork.JoinRandomRoom(null, 2, MatchmakingMode.SerialMatching, sqlLobby, sqlLobbyFilter);

Am I stuck using integers only? I'm not sure what else the issue could be. The error I see from Photon is:
SQL logic error or missing database

Comments

  • botg
    botg
    edited December 2016
    Options
    It's possible a string will not work, you can try using the GetHashCode() of the string. It will not be perfect, but should get the job done.
  • JohnTube
    JohnTube ✭✭✭✭✭
    edited December 2016
    Options
    Hi @taleri,

    Please try escaping string values. i.e.:
    string sqlLobbyFilter = string.Format("C1 <> \"{0}\"", SaveLoad.UserID);
  • taleri
    Options
    Perfect, thank you very much. The escape seems to have done the trick.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Great! I will add a task for updating the doc to cover this.