zoukankan      html  css  js  c++  java
  • 查询android系统数据库 自定义sql语句 办法

    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);

    有点耍滑头,是吧,用到了sql语句中注释符号“--”

    这样我们就将这个语句转化为了:

    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

    在sql语句解析的时候,--from sms是不予解析的,所以就成功执行了前面的联合查询操作而得到了我们想要的canonical_addresses表中的address数据。

    引用原文:http://blog.csdn.net/zhangzh332/article/details/6396985

  • 相关阅读:
    从输入网址到显示网页简介
    java异常及日志注意事项
    java-Excel导出中的坑
    python-arcade时钟
    tkinter-clock实例
    http远程调用原生get、post模板
    eclipse使用小技巧
    sublime text3安装Package Control和Vue Syntax Highlight
    双十一剁手了吗
    Nginx配置HTTPS
  • 原文地址:https://www.cnblogs.com/owner/p/3949399.html
Copyright © 2011-2022 走看看