在android数据库中存储长值
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12584539/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
store long value in android database
提问by zafi005
How do I store long values in Android SQLite database ? I am trying to store the time(milliseconds) values which comes in long type format .
如何在 Android SQLite 数据库中存储长值?我正在尝试存储长类型格式的时间(毫秒)值。
回答by keyser
An INTEGER column will handle long values.
INTEGER 列将处理长值。
From the SQLite site:
从 SQLite 站点:
INTEGER. The value is a signed integer, stored in 1, 2, 3, 4, 6, or 8 bytes depending on the magnitude of the value.
整数。该值是一个有符号整数,根据值的大小存储在 1、2、3、4、6 或 8 个字节中。
回答by Aswin
回答by Simon
If you don't care about sign, store it as INT8. It's 8 bytes (64 bits) unsigned. Or, convert to/from string.
如果您不关心符号,则将其存储为 INT8。它是 8 个字节(64 位)无符号。或者,转换为/从字符串。