V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
pinkSlime
V2EX  ›  问与答

sqlite 的字段长度是假的吧

  •  
  •   pinkSlime · Jul 1, 2020 · 1913 views
    This topic created in 2130 days ago, the information mentioned may be changed or developed.

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

    1 replies    2020-07-01 15:38:06 +08:00
    ACTom
        1
    ACTom  
       Jul 1, 2020
    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
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2475 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 02:46 · PVG 10:46 · LAX 19:46 · JFK 22:46
    ♥ Do have faith in what you're doing.