search

Home  >  Q&A  >  body text

sqlite - ios 二进制数据存储数据库问题求助

NSString *insertSQL = [[NSString alloc] initWithFormat:@"insert into weiguanjia collection values data"];

如果要存储data数据这条sql语句应该怎样写啊这样写不对啊求助

黄舟黄舟2816 days ago695

reply all(2)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-04-17 11:14:24

    sqlite3_bind_blob(insertstmt, 10, [Data bytes], [Data length], SQLITE_TRANSIENT);

    Different databases have different interfaces. For sqlite, just make a bind like this. The sql statement is written normally

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-17 11:14:24

    Putting large blobs into sqlite will greatly increase the footprint. It is recommended to add a path field, use the field name primary key as the file name, write the blob as a physical file, and only store a path in the database

    And if you want us to help you, at least don’t write the code without parentheses

    reply
    0
  • Cancelreply