Skip to content
This repository has been archived by the owner on May 1, 2023. It is now read-only.

Feedback on non SELECT database queries. #82

Closed
Tolriq opened this issue Mar 10, 2015 · 5 comments
Closed

Feedback on non SELECT database queries. #82

Tolriq opened this issue Mar 10, 2015 · 5 comments

Comments

@Tolriq
Copy link

Tolriq commented Mar 10, 2015

Currently there's no feedback when doing update or delete queries.

It would be great to have some to know that it worked as even the query vanish from the interface.

Maybe use the current error system

delete from albums where tt = false;
no such column: tt (code 1): , while compiling: delete from albums where tt = false;

With the error line containing : Success : Last id = XX or affected rows = YY

Or return a dummy cursor with only 2 columns last id , affected rows and 1 line with data.

@jasta
Copy link
Contributor

jasta commented Mar 10, 2015

I just looked into this briefly and noticed that of course you can indeed return results as if it were a SQL query. I think that's probably the right thing to do.

Patches welcome? :) You'd be looking at Database and DatabasePeerManager.

@Tolriq
Copy link
Author

Tolriq commented Mar 10, 2015

If no one look into that before I have time, I'll try :)

But I must admit I'm in the middle of a big rewrite and try to gain time with tools, so hard to find time soon to learn new product to contribute.

@jasta
Copy link
Contributor

jasta commented Mar 10, 2015

@Tolriq I'll see what I can do :)

@Tolriq
Copy link
Author

Tolriq commented Mar 10, 2015

No hurry the tool is already wonderful right now and make me win lot's of time for tests and debug.

So I can check that when I have time after the database / sync rewrite :)

@longinoa
Copy link
Contributor

I looked into this a bit today. We are using SqliteDatabase#rawQuery(...) which returns a Cursor. As far as I can tell we cant extract the data of how many rows were modified from a Cursor and would need to find out if the query is UPDATE/INSERT/DELETE/SELECT/... by parsing the raw sql, and then calling structured methods on SqlliteDatabase.

I know presto has parsing for sqlite but do we want to go down that path?

longinoa added a commit to longinoa/stetho that referenced this issue Mar 13, 2015
Previously we would only return a result for sql commands that were
selct statements. This diff makes `DatabasePeerManager` aware of what
commands are being executed and returns a result set appropriate to that
command.

Note: We are returning a result for all commands (including ones that do
not normally contain results like CREATE TABLE). We do this so that the
inspector interface will not remove the command.

Closes facebookarchive#82
longinoa added a commit to longinoa/stetho that referenced this issue Apr 2, 2015
Previously we would only return a result for sql commands that were
selct statements. This diff makes `DatabasePeerManager` aware of what
commands are being executed and returns a result set appropriate to that
command.

Note: We are returning a result for all commands (including ones that do
not normally contain results like CREATE TABLE). We do this so that the
inspector interface will not remove the command.

Closes facebookarchive#82
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants