SQLite.Net-PCL icon indicating copy to clipboard operation
SQLite.Net-PCL copied to clipboard

SQLite.Net.SQLiteException: near "where": syntax error when updating table with only keys

Open eino-wheezlab opened this issue 9 years ago • 3 comments

I have this table with only a id key and child objects (no direct data):

[Table("Categories")]   
public class Category
{
    [PrimaryKey]
    public int Id { get; set;}

    [OneToMany(CascadeOperations = CascadeOperation.All)]
    public List<CategorySign> Signs { get; set;}

}

And I get a crash when calling database.Update(category) :

SQLite.Net.SQLiteException: near "where": syntax error

It took me a long time to find out that the problem was that there is no other member. If I add a dummy column, like : public int Something { get; set; }

then the crash doesn't occur anymore.

eino-wheezlab avatar Jun 14 '16 12:06 eino-wheezlab

lol the error still exists today. Thanks for the hint.

wegascee avatar Jun 28 '17 15:06 wegascee

Same for me - this produces error:

[Table(nameof(MyModel))]
public class MyModel
{
    [PrimaryKey]
    public string MyModelId { get; set; }
}

Adding dummy additional property is "workarouding" this issue:

[Table(nameof(MyModel))]
public class MyModel
{
    [PrimaryKey]
    public string MyModelId { get; set; }
    public string SomethingAdditional { get; set; }
}

Szymaniuk avatar Jun 29 '17 06:06 Szymaniuk

Thanks for the hint! 👍

vallgrenerik avatar Dec 19 '18 09:12 vallgrenerik