Solution for sending Whatsapp via sqlite "INSERT INTO"

I use something similar but thought I‘d mention this ‘bug‘ that can happen:
when you INSERT ‘%wa_message‘ into ‘data‘, bear in mind your typed message will replace %wa_message.
if that typed message contains an apostrophe, your message won‘t send.
why?
the apostrophe effectively closes ‘data‘ insert and the rest of the text isn‘t understood by sqlite.
examples:
‘i‘m not going to work‘ - won‘t work because only ‘i‘ will be inserted into data,
sqlite won‘t know what to do with m not going to work‘
‘im not going to work‘ - on the other hand WILL work!

‘this will work, won‘t it‘ - won‘t work because of the apostrophe, the text t it‘ will be left over and cause an error
‘this will work, wont it‘ - will work

so be careful with apostrophes and sqlite whatsapp messages!
(this "bug" took me AGES to work out!)

On Sunday, 29 September 2013 16:17:01 UTC+1, Amos Wong wrote:Yo everyone!
I found this from Pockable : http://www.pocketables.com/forum/showthread.php?t=11947 which lead me to a Spanish forum : http://www.htcmania.com/showthread.php?p=8993462 
Origin : pepelolo38 
Since part of the commands are in Spanish, I thought of recreating them my Tasker [English] and share it here.

A3 ~ A9 below are copied and modified from the original source.

For this task, I use

  • SQLite Installer
  • Rooted Galaxy Nexus - Android 4.1
  • Whatsapp v2.11.23

Send Whatsapp (491)
Run Both Together
A1: Variable Set [ Name:%nummsg To:%arcomm Do Maths:Off Append:Off ] 
A2: Variable Split [ Name:%nummsg Splitter:[}{] Delete Base:Off ] 
A3: Variable Set [ Name:%wa_number To:%nummsg1 Do Maths:Off Append:Off ] 
A4: Variable Set [ Name:%wa_key_id To:%TIMES Do Maths:Off Append:Off ] 
A5: Variable Set [ Name:%wa_message To:%nummsg2 Do Maths:Off Append:Off ] 
A6: Variable Set [ Name:%wa_timestamp To:%TIMEMS Do Maths:Off Append:Off ] 
A7: Variable Set [ Name:%wa_received_timestamp To:%TIMEMS Do Maths:Off Append:Off ] 
A8: Run Shell [ Command:sqlite3 /data/data/com.whatsapp/databases/msgstore.db "INSERT INTO messages (key_remote_jid, key_from_me, key_id,status, needs_push, data, timestamp, media_url, media_mime_type, media_wa_type, media_size, media_name, latitude, longitude, thumb_image, remote_resource, received_timestamp, send_timestamp, receipt_server_timestamp, receipt_device_timestamp, raw_data, media_hash, recipient_count, media_duration, origin) VALUES (‘%[email protected]‘,1, ‘%wa_key_id-1‘ ,0,0,‘%wa_message‘,%wa_timestamp,‘‘,‘‘,‘0‘,0,‘‘,0.0,0.0,‘‘, ‘‘,%wa_received_timestamp,-1,-1,-1,0,‘‘,0,0,0);" Timeout (Seconds):0 Use Root:On Store Output In: Store Errors In: Store Result In: ] 
A9: Kill App [ App:WhatsApp Use Root:On ]

Description

A1 ~ A2 :
For processing message received from Autoremote by joaomgcd [Ignore if you don‘t use it]
A3 ~ A7 : Setting up necessary variables
A8         : The command to insert data into msgstore.db
A9         : On my phone, this action is required for Whatsapp to send the message.
However, it doesn‘t seem to exit Whatsapp (My whatsapp will just to blank and come back again).

Note:
On my phone

    • It takes 30~40 seconds to send a message when my screen is off.
    • 10~12 seconds when Whatsapp is opened.
    • The message is not shown in Whatsapp‘s homepage. (It is shown in the conversation)
    • The entire task takes 1~2 seconds to run.
时间: 2024-08-09 07:40:31

Solution for sending Whatsapp via sqlite "INSERT INTO"的相关文章

使用事务提升sqlite insert的性能

昨天发现sqlite插入性能很低,搜索了一下发现,其实sqlite的插入可以做到每秒50000条,但是处理事务的速度慢: (19) INSERT is really slow - I can only do few dozen INSERTs per second Actually, SQLite will easily do 50,000 or more INSERT statements per second on an average desktop computer. But it wi

sqlite "insert or replace" 和 "insert or ignore" 用法

insert or replace:如果不存在就插入,存在就更新insert or ignore:如果不存在就插入,存在就忽略只对UNIQUE约束的字段起作用.举例:建表:CREATE TABLE TEST(id BIGINT, name text, birthday datetime, PRIMARY KEY(id, name));或者CREATE TABLE TEST (id BIGINT, name text, birthday datetime, UNIQUE(id, name));插入

linq2db Sqlite Insert之后获取插入的自增量ID值

方法为: public static object InsertWithIdentity<T>(this IDataContext dataContext, T obj); 例: var rowId = db.InsertWithIdentity(newRow); newRow.Id = (long)rowId; 对应的SQL语句为: SELECT last_insert_rowid()

SQLite使用教程8 Insert 语句

http://www.runoob.com/sqlite/sqlite-insert.html SQLite Insert 语句 SQLite 的 INSERT INTO 语句用于向数据库的某个表中添加新的数据行. 语法 INSERT INTO 语句有两种基本语法,如下所示: INSERT INTO TABLE_NAME (column1, column2, column3,...columnN)] VALUES (value1, value2, value3,...valueN); 在这里,c

LeetCode57 Insert Interval

题目: Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assume that the intervals were initially sorted according to their start times. Example 1:Given intervals [1,3],[6,9], insert and mer

sqlite 的基本使用1

mac 下自带的sqlite3 直接在终端键入 sqlite3 即进入 sqlite的交互界面 1,创建数据库 sqlite3 命令 被用来创建新的数据库 比如sqlite3 mydb,即创建了一个mydb的数据库 bogon:db lining$ sqlite3 mydb SQLite version 3.8.10.2 2015-05-20 18:17:19 Enter ".help" for usage hints. sqlite> 进入交互界面之后,如何退出,可以键入.qu

SQLite 学习笔记

SQLite 学习笔记. 一.SQLite 安装    访问http://www.sqlite.org/download.html下载对应的文件.    1.在 Windows 上安装 SQLite.需要下载 sqlite-shell-win32-*.zip 和 sqlite-dll-win32-*.zip 压缩文件.        创建文件夹 C:\sqlite,并在此文件夹下解压上面两个压缩文件,将得到 sqlite3.def.sqlite3.dll 和 sqlite3.exe 文件.   

Android 操作SQLite基本用法

在Android开发中SQLite起着很重要的作用,网上SQLite的教程有很多很多,不过那些教程大多数都讲得不是很全面.本人总结了一些SQLite的常用的方法,借着论坛的大赛,跟大家分享分享的. 一.SQLite的介绍 1.SQLite简介 SQLite是一款轻型的数据库,是遵守ACID的关联式数据库管理系统,它的设计目标是嵌入  式的,而且目前已经在很多嵌入式产品中使用了它,它占用资源非常的低,在嵌入式设备中,可能只需要几百K的内存就够了.它能够支持 Windows/Linux/Unix等等

Android-adb 常用命令 和 sqlite

Android开发环境中,ADB是我们进行Android开发经常要用的调试工具,它的使用当然是我们Android开发者必须要掌握的. ADB概述 Android Debug Bridge,Android调试桥接器,简称adb,是用于管理模拟器或真机状态的万能工具,采用了客户端-服务器模型,包括三个部分: 1.客户端部分,运行在开发用的电脑上,可以在命令行中运行adb命令来调用该客户端,像ADB插件和DDMS这样的Android工具也可以调用adb客户端. 2.服务端部分,是运行在开发用电脑上的后