What causes a journal file to be created in SQLite?

后端 未结 3 1706
轻奢々
轻奢々 2020-12-09 15:46

I started noticing a weird behavior with my SQLite queries for my iPhone application. Whenever I execute an \"INSERT\" statement, a journal file is created beside my db fil

3条回答
  •  悲哀的现实
    2020-12-09 16:18

    As Joe said, the journal is created when a transaction is started and SQLlite creates one for you when you start a statement.

    To clear out that journal and make sure that the statement was committed to the db use:

    sqlite3_finalize(insertStmt);   
    

    Before your close.

    The .journal file will go away and all your data will be nice and safe in your DB.

    Hope this helps.

    chris.

提交回复
热议问题