从SQLite读取数据,其中列名称包含空格 [英] Read data from SQLite where column name contains spaces

查看:1141
本文介绍了从SQLite读取数据,其中列名称包含空格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为条件名称的名字(.sql文件已从服务器生成)

I am having a coulmn name called "condition name" (.sql file has been generated from server)

但是在android中我在读取数据时遇到异常从该表。

But in android I am getting following exception while reading data from that table.


12-24 14:34:00.870:W / System.err(269):
android。 database.sqlite.SQLiteException:没有这样的列:条件:,

12-24 14:34:00.870: W/System.err(269): android.database.sqlite.SQLiteException: no such column: condition: ,

编译时:


SELECT条件,类别,子类别,条件名称,本地路径,
远程路径,标题,content_type FROM库WHERE category =?

SELECT condition, category, subcategory,condition name, local path, remote path, title, content_type FROM library WHERE category = ?

它无法识别整个表名并且在空格处断开。
如果您有任何想法请帮助我。

Its not recognizing whole table name and breaking at space. if you have any ideas please assist me.

推荐答案

对于引用表/列名等标识符,SQLite支持返回与MySQL兼容的ticks和与SQL Server兼容的方括号,但便携式方法是使用双引号:

For quoting identifiers like table/column names, SQLite supports back ticks for compatibility with MySQL, and square brackets for compatibility with SQL Server, but the portable way is to use double quotes:

SELECT "condition name" FROM library

(单引号将用于字符串值。)

(Single quotes would be used for string values.)

这篇关于从SQLite读取数据,其中列名称包含空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆