defining a quot;VARIANTquot; column type in SQLite?(定义“变体SQLite 中的列类型?)
问题描述
有没有办法在 SQLite 中定义包含 SQLite 支持的任何数据类型的列类型?
Is there a way to define a column type in SQLite that holds any datatype that SQLite supports?
我有无符号字符、有符号字符、无符号整数、有符号整数、UTF-8 字符和 blob,我想将它们填充到单个列中.
I have unsigned chars, signedchars, unsigned ints, signed ints, UTF-8 chars and blobs that I want to populate in a single column.
也欢迎参考任何文献.
推荐答案
只是不要在列声明中放类型,所以它没有亲和性
Just don't put a type in the column declaration, so it has NONE affinity
create table my_table(my_col);
SQLite 有一个独特的动态类型系统.它具有按值类型,但如果您指定列类型,SQLite 将确定类型关联(TEXT、NUMERIC、INTEGER、REAL、NONE).然后它尝试将每个值强制为该关联.
SQLite has a unique dynamic typing system. It has per-value typing, but if you specify a column type, SQLite will determine a type affinity (TEXT, NUMERIC, INTEGER, REAL, NONE). It then attempts to coerce each value to that affinity.
实际支持的类型有 NULL、INTEGER、REAL、TEXT、BLOB.有关详细信息,请参阅 SQLite 版本 3 中的数据类型.
The actual supported types are NULL, INTEGER, REAL, TEXT, BLOB. See Datatypes in SQLite Version 3 for more information.
这篇关于定义“变体"SQLite 中的列类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:定义“变体"SQLite 中的列类型?
基础教程推荐
- 从字符串 TSQL 中获取数字 2021-01-01
- 如何在 CakePHP 3 中实现 INSERT ON DUPLICATE KEY UPDATE aka upsert? 2021-01-01
- while 在触发器内循环以遍历 sql 中表的所有列 2022-01-01
- MySQL 5.7参照时间戳生成日期列 2022-01-01
- 带有WHERE子句的LAG()函数 2022-01-01
- CHECKSUM 和 CHECKSUM_AGG:算法是什么? 2021-01-01
- 带更新的 sqlite CTE 2022-01-01
- ORA-01830:日期格式图片在转换整个输入字符串之前结束/选择日期查询的总和 2021-01-01
- 使用 VBS 和注册表来确定安装了哪个版本和 32 位 2021-01-01
- MySQL根据从其他列分组的值,对两列之间的值进行求和 2022-01-01
