在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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 11:06:44  来源:igfitidea点击:

store long value in android database

androidandroid-sqlite

提问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 个字节中。

Datatypes In SQLite Version 3

SQLite 版本 3 中的数据类型

回答by Aswin

You can define a column with Integer datatype. For more info go through this link

您可以使用 Integer 数据类型定义列。有关更多信息,请访问此链接

回答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 位)无符号。或者,转换为/从字符串。