praeclarum / sqlite-net

Simple, powerful, cross-platform SQLite client and ORM for .NET
MIT License
4.06k stars 1.42k forks source link

QueryAsync stopped retreiving records #985

Open srochacito opened 4 years ago

srochacito commented 4 years ago

I have a solution MVVM for Xamarin Forms. All the DB handling is done in a class. I wrote a lot of querys that were working fine until they didn't JUST IN ANDROID.

Example:

public async Task<List> GetJugadoresDeUnMatch(int esteMatch) {

        List<JugadoresDeUnMatch> resultado = new List<JugadoresDeUnMatch>();

        string strSQL = "SELECT IdMatchJugador, " + 
            "J.IdJugador, Nombre, " +
            "(CASE WHEN IdMatchJugador IS NULL THEN 0 ELSE 1 END) as Seleccionado " +
            "FROM Jugadores J " +
            "LEFT JOIN MatchesJugadores MJ ON MJ.IdJugador = J.IdJugador AND MJ.IdMatch = " + esteMatch;

        resultado = await database.QueryAsync<JugadoresDeUnMatch>(strSQL);

        return resultado;

    }

Works fine in iOS and UWP, and just doesn't retreive any row if ran with Android.

Really confused !!!

ske66 commented 4 years ago

Break it down into LINQ if possible. First start by retrieving all the records, then filter the query down afterwards.

var result = await database.Table<JugadoresDeUnMatch>();

Do you still get results?