hhtokpinar / sqfEntity

SqfEntity ORM for Flutter/Dart lets you build and execute SQL commands on SQLite database easily and quickly with the help of fluent methods similar to .Net Entity Framework. SqfEntity also generates add/edit forms with validations and special controls (DropDown List, DateTime pickers, Checkboxes.. etc) for your table.
377 stars 99 forks source link

SQL Query execDataTable #289

Closed SimonTellier closed 1 year ago

SimonTellier commented 1 year ago

Hi, I try to make a query directly in the database but I get too many results compared to the normal method. I really don't understand..

query : print((await TarifsChantier().select().toList()).length); print((await MyDbModel().execDataTable("SELECT * FROM TarifsChantiers")).length);

result : flutter: 1862 flutter: 12549

Version : sqfentity: ^2.2.0+6 sqfentity_gen: ^2.2.0+12

Grrravity commented 1 year ago

Dont you use softdelete ? In your sql statement you did not filter anything so maybe it takes all you ever had

SimonTellier commented 1 year ago

Hi! Yes Thanks !, that was it. Small problem when you remove the softdelete the "delete.cascade" doesn't work anymore ...

Grrravity commented 1 year ago

First of, you may use await TarifsChantier().select(getIsDeleted: false).toList()).length; so you wont get soft delete anymore.

then on you delete command when using soft delete, if you are sure you want to delete it FOREVER, you may use this : await TarifsChantier().select().where("id=?", parameterValue: "whateverID").delete(hardDelete: true);