Page 1 of 2

Database trigger and actions

Posted: 08 Sep 2017 20:48
by Bluscre
Sorry for the short post but i think the content is very obvious ^~^

5o anyone else who's searching while it's still being implemented: https://play.google.com/store/apps/deta ... ugin&hl=en

Re: Database trigger and actions

Posted: 09 Sep 2017 08:55
by bogdyro
Well,the plugin is compatible with automagic also. Also it may not know it :)
However you can implement the same functionality by using execute root command SQLite.
I'm preparing the query strings in a script action and sending the commands after.
example:
path=/data/data/some_app/data.db
query="UPDATE alarm_instances SET vibrate ='0'; UPDATE alarm_templates SET vibrate='0'";
and then run root commamd
sqlite3 {path} "{query_
}"
Been using it to get a random song every time an alarm goes off.
By the way,can I ask what is your usage scenario?

Re: Database trigger and actions

Posted: 09 Sep 2017 13:14
by Bluscre
Thats a sloppy workaround xD But what about triggers?

"When cell1row3 value in table USERS in database bla.sqlite changes"

Re: Database trigger and actions

Posted: 10 Sep 2017 20:56
by ewill
I tried the plugin and I get a FC whenever I try to run it - even with a simple select statement.

Also, I the triggers don't appear for me when I use the plugin trigger.

Re: Database trigger and actions

Posted: 11 Sep 2017 05:51
by bogdyro
Tested the plugin myself. It indeed FC whenever I run the action. Maybe it's an incopatibility with AM.
And the trigger is just a feature request, doesn't exist for now.
We're waiting Martin's input on this :)

Re: Database trigger and actions

Posted: 11 Sep 2017 18:36
by Martin
What are the steps required to reproduce the crash?
I'll take a look when time permits.

Re: Database trigger and actions

Posted: 11 Sep 2017 19:40
by ewill
Here is what I tried.

Database path = /data/data/com.whatsapp/databases/msgstore.db

SQL statement = SELECT * FROM 'chat_list'

I know that the database path is correct.

I tried with and without the quote (that was a suggestion I found online).

I also tried
SELECT COUNT(*) FROM 'chat_list'

I tried some other more complex queries as well, but want to start simple.

Thanks for your interest.

Re: Database trigger and actions

Posted: 12 Sep 2017 05:05
by bogdyro
@Martin
simple to reproduce, any run of the plugin causes it to crash. Tried with a path that requires root and another that doesn't. Query was simple like select * from table
@ewill
I assume that the phone is rooted,otherwise you don't have access to /data folder.
After the execute root command action, connect it to a debug dialog and run the flow. You should get either the output(stdout) or an error (stderror). What's the error message you're getting ?

Re: Database trigger and actions

Posted: 12 Sep 2017 08:31
by Martin
Hi,

I made a quick tests and it seems that the plugin dies with a NullPointerException which means that some input might be missing or that the plugin can not read some input.
It might be caused by the plugin reading the input (file path) from the wrong field (from the wrong extras of the intent sent to the plugin) which is something another plugin also implemented in a wrong way in the past. The plugin needs to ensure that it properly follows the plugin specification. According to the ratings in Google Play the plugin seems to also fail in another automation app.

I'll try to contact the developer of the plugin to see if it can be fixed.

Regards,
Martin

Re: Database trigger and actions

Posted: 12 Sep 2017 11:12
by ewill
Thank you Martin!