New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to clear a table? #27

Closed
petersnoopy opened this Issue Apr 25, 2015 · 2 comments

Comments

Projects
None yet
2 participants
@petersnoopy

petersnoopy commented Apr 25, 2015

Hi, I want to know a easy way to delete all rows in a table without needing to load all data.

@Stuart-campbell

This comment has been minimized.

Show comment
Hide comment
@Stuart-campbell

Stuart-campbell Apr 25, 2015

Owner

Hi,

Data does needs to be loaded before deleted. The reason for this is a children are stored through join tables. So deleting without ids would leave unused rows in the join tables.

I do see that this is not a problem if you are deleting all rows so could be worth adding a clear all method.

Loading rows is pretty quick unless your talking about multiple thousands.

It can be done on a background thread.

new RushSearch().find(Object.class, new RushSearchCallback<Object>() {
        @Override
        public void complete(List<Object> list) {
            RushCore.getInstance().delete(list, null);
        }
    });
Owner

Stuart-campbell commented Apr 25, 2015

Hi,

Data does needs to be loaded before deleted. The reason for this is a children are stored through join tables. So deleting without ids would leave unused rows in the join tables.

I do see that this is not a problem if you are deleting all rows so could be worth adding a clear all method.

Loading rows is pretty quick unless your talking about multiple thousands.

It can be done on a background thread.

new RushSearch().find(Object.class, new RushSearchCallback<Object>() {
        @Override
        public void complete(List<Object> list) {
            RushCore.getInstance().delete(list, null);
        }
    });

Stuart-campbell added a commit that referenced this issue May 5, 2015

How to delete/drop/empty whole database #32, Customizable table name #31
, Database migration issue #30, How to clear a table? #27,

 Edit New issue
How to execute SQL? #26
@Stuart-campbell

This comment has been minimized.

Show comment
Hide comment
@Stuart-campbell

Stuart-campbell May 5, 2015

Owner

Delete all added in v1.1.4

RushCore.getInstance().deleteAll(Object.class);

That will delete all from a table, will be far more efficient that the method above.

Thanks

Owner

Stuart-campbell commented May 5, 2015

Delete all added in v1.1.4

RushCore.getInstance().deleteAll(Object.class);

That will delete all from a table, will be far more efficient that the method above.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment