Android的SQLite的FTS3:我应该插入:空值或空字符串? [英] Android SQLite fts3: What should I insert: null values OR empty strings?

查看:484
本文介绍了Android的SQLite的FTS3:我应该插入:空值或空字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个SQLite FTS3表有几列一个Android应用程序。该表是由用户的输入填充。然而,并非所有的表列应该有一个值。例如:有一个名为复数列。用户提交一个字是一个动词(不是一个名词)等的多个列中不应该有一个值。

I've created a SQLite FTS3 table for an Android app with several columns. The table is populated by user's inputs. However not all table columns should have a value. Example: There is a column named PLURAL. The user submits a word which is a verb (not a noun) and so the PLURAL column shouldn't have a value.

我应该投入的多个列中,NULL值或空字符串?

What should I input into the PLURAL column, a NULL value or an empty string ""?

除了影响答案的逻辑,有没有在数据库性能有任何显著的区别,如果我用空了空字符串值?是否有任何已知的问题(如抛出例外),如果我使用NULL值?

Except for the logic that affects the answer, is there any significant difference in the Database performance if I use NULL over empty string values? Are there any known issues (e.g. throw exceptions) if I use NULL values?

我已经在网上搜索四周,我发现在其他数据库但不能在SQLite的FTS3一些意见。

I 've searched around the web and I 've found some opinions on other DB but not on SQLite fts3.

感谢您!

推荐答案

根据逻辑:你不应该插入空字符串,但 NULL ,因为在SQL字 NULL 被视为没有价值

Based on logic: you should not insert empty string but NULL, since in SQL word NULL is treated as NO VALUE

有以emptynes​​s或字符串的nulliness相关的任何preformance问题。唯一要考虑的可能情况下的SQL 内加入语句的涌现研究。 INNER JOIN 的连接只非 NULL 字段这符合加入条件。有特殊的左/右JOIN 语句允许的 NULL 字段使用的连接。

There's no preformance issues related to emptyness or nulliness of string. The only consideration can emerge in case of SQL inner join statement. INNER JOIN joins only non NULL fields which fits to join conditions. There's special LEFT/RIGHT JOIN statements which permits usage of NULL fields in joins.

这篇关于Android的SQLite的FTS3:我应该插入:空值或空字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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