On 10/16/2015 03:22 PM, ???_Ren? wrote:
> 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?

You may need to ensure that SQLite stores temp files in memory. Either 
by building with -DSQLITE_TEMP_STORE=3 or by executing "PRAGMA 
temp_store=memory" after opening the db connection.

https://www.sqlite.org/tempfiles.html#tempstore

Dan.




>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to