【问题标题】:Print column names in SQLite3 output along with query results在 SQLite3 输出中打印列名以及查询结果
【发布时间】:2017-04-28 15:52:36
【问题描述】:

当我在 Android 中执行此操作时:

sqlite> SELECT * FROM secure WHERE name='mock_location' OR value=2.2 ORDER BY value ASC;

我明白了:

44|mock_location|1
56|facelock_liveliness_recognition_threshold|2.2

但我想要第一行中 (*) 的列名,如下所示:

_id|name|value
44|mock_location|1
56|facelock_liveliness_recognition_threshold|2.2

如何在单个查询中做到这一点?

【问题讨论】:

  • 如果您将它与 Cursor 一起使用。可以通过java代码获取
  • 我无法使用光标,因为我正在尝试构建光标。
  • 你在使用 CursorFactory 吗?
  • 我正在扩展 AbstractCursor。
  • 试试.headers on

标签: android sqlite columnname


【解决方案1】:

我这样做了,它有效:

sqlite3 -header /data/data/com.android.providers.settings/databases/settings.db "SELECT * FROM secure WHERE name='mock_location' OR value=2.2 ORDER BY value ASC;"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多