结构体
struct A
{
   int x;
   bool y;
}
数据库表名为 tabel8,其中有字段 
int 型字段        字段名 NUMBER
varchar 型字段    字段名 IP
BLOB   型字段     字段名 ATTR     结构体A存该字段
BLOB   型字段     字段名 ALX请问如何将 结构体A 更新进某一行 
类似 update tabel8 set ATTR= A  where tabel8.IP=“127.0.0.1”  这种意思ps 如何将该行读取后存入结构体呢?求老师指点  有码当真是极好的
结构体sqlite数据库

解决方案 »

  1.   

    用cfile 使用二进制保存和读取!
      

  2.   

    update tabel8 set ATTR= A  where tabel8.IP=“127.0.0.1”  这种意你去查一下sql语句 简单!
      

  3.   

    char *sql = "update tabel8 set ATTR= ? where tabel8.IP='127.0.0.1'”;sqlite3 *db;
    sqlite3_open("db.sdb", &db);char *error;
    sqlite3_stmt *stmt;struct A
    {
       int x;
       bool y;
    } a = {1, false};sqlite3_prepare(db, sql, strlen(sql), &stmt, &error);
    sqlite3_bind_blob(stmt, 1, &a, sizeof(a), NULL);
    sqlite3_step(stmt);
    sqlite3_finalize(stmt); sqlite3_close(db);