my code like below:
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------


const char* sql = 
"begin;"
"create table if not exists personal("
"user_id integer primary key autoincrement,"
"type int not null,"
"user_name char(100) unique not null,"
"password char(200),"
"nick_name char(100),"
"image blob(204800),"
"round int,"
"win int,"
"kill int,"
"death int,"
"coin int,"
"diamond int,"
"vip int,"
"level int,"
"experience int,"
"finished_story int,"
"last_online_date int"
");"
"create table if not exists fragment("
"id integer primary key autoincrement,"
"user_id int not null references personal(user_id),"
"type int not null,"
"amount int,"
"finished_times int"
");"
"create unique index if not exists fragment_index on fragment(user_id asc, type 
asc);"
"commit;"
;


char* errmsg = 0;
int ret = sqlite3_exec(m_db, sql, 0, 0, &errmsg);
sqlite3_free(errmsg);




--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
under ios, it work nice.
but under android it don't work.


i have debug this error, and find the rules are:
1).when i delete that statement, it work nice:
"create unique index if not exists fragment_index on fragment(user_id asc, type 
asc);"


2).when i delete these statements, it work nice too.
"begin;"
"commit;"


so, i think it don't support create index in a transaction under android.


do you have any suggest for me?

Reply via email to