Query the android system database custom SQL statement method

Source: Internet
Author: User

Cursor draftcursor = Mresolver.query (Uri.parse ("Content://sms"),
New string[] {"Canonical_addresses.address" +
"From sms,threads,canonical_addresses" +
"Where sms.thread_id=threads._id and threads.recipient_ids=canonical_addresses._id and sms._id = '" +
String.valueof (target_message_id) + "'--"},
NULL, NULL, NULL);

A little tricky, right, using the comment notation in the SQL statement "--"

So we're going to turn this statement into:

Select Canonical_addresses.address from sms,threads,canonical_addresses where sms.thread_id=threads._id and threads.recipient_ids=canonical_addresses._id and sms._id = ' target_message_id '--from SMS

--from SMS is not parsed when the SQL statement is parsed, so the previous Federated query operation was successfully performed and the address data in the Canonical_addresses table we wanted was obtained.

Quote Original: http://blog.csdn.net/zhangzh332/article/details/6396985

Query the android system database custom SQL statement method

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.