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

SQLite 如何变相存储数组呢?

  •  
  •   pepsin · Aug 28, 2011 via Android · 10634 views
    This topic created in 5368 days ago, the information mentioned may be changed or developed.
    遇上了这个问题,查到的答案都是建第二个表,不是太理解,求高人讲解
    6 replies    1970-01-01 08:00:00 +08:00
    icyflash
        1
    icyflash  
       Aug 28, 2011
    看数组结构及自己的需求,可以考虑序列化成字符串
    Livid
        2
    Livid  
    MOD
    PRO
       Aug 28, 2011
    取决于数组是什么类型。

    如果元素固定且数量就几十个左右的话,用列也是一种解决办法。
    pepsin
        3
    pepsin  
    OP
       Aug 28, 2011 via Android
    @Livid 元素数量不定,存储的是字符串。

    考虑转换成字符串,用某种标识符隔开使用时再用正则取出来,但感觉很麻烦的样子。特别是取出的字符串还要考虑利用 android 的 intent 读取
    ssword
        4
    ssword  
       Aug 28, 2011
    一对多关系。
    ayanamist
        5
    ayanamist  
       Aug 28, 2011
    看了这个帖子中的疑问,我终于明白MongoDB提倡的schemeless的意义了
    popoer
        6
    popoer  
       Aug 28, 2011
    转换成json格式存储吧
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1034 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 45ms · UTC 19:01 · PVG 03:01 · LAX 12:01 · JFK 15:01
    ♥ Do have faith in what you're doing.