V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
pinkSlime
V2EX  ›  问与答

sqlite 的字段长度是假的吧

  •  
  •   pinkSlime · 2020-07-01 13:50:14 +08:00 · 903 次点击
    这是一个创建于 1366 天前的主题,其中的信息可能已经有所发展或是发生改变。

    我指定了 char(10) 结果往里怼了几百个汉字

    1 条回复    2020-07-01 15:38:06 +08:00
    ACTom
        1
    ACTom  
       2020-07-01 15:38:06 +08:00
    SQLite 只有 5 种数据类型:NULL 、INTEGER 、REAL 、TEXT 、BLOB,你所定义的其它类型都被转到这 5 种类型最终存储。
    SQLite 中类型定义的括号中的数字是会被忽略的。( Note that numeric arguments in parentheses that following the type name (ex: "VARCHAR(255)") are ignored by SQLite - SQLite does not impose any length restrictions (other than the large global SQLITE_MAX_LENGTH limit) on the length of strings, BLOBs or numeric values.)

    详见: https://sqlite.org/datatype3.html#affinity_name_examples
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2946 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 15:09 · PVG 23:09 · LAX 08:09 · JFK 11:09
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.