SQLite User Forum

Inclusion of .recover in the SQLite3 API
Login

Inclusion of .recover in the SQLite3 API

(1) By anonymous on 2022-08-29 01:58:02 [link] [source]

Hello all.

I love the new .recover shell command! Very handy! I was wondering if there are any plans to include this functionality in the SQLite3 API. I was hoping to get it included in the DBD::SQLite Perl module.

Looking into the shell.c code, it looks like for my needs, I could probably just replicate the logic in Perl, or make a one-off module that links with the shell.c code. To get it included in DBD::SQLite though, I think it would need to be exposed through the API first.

Either way, love the new feature!

Thanks!

(2) By Simon Slavin (slavin) on 2022-08-29 12:53:54 in reply to 1 [source]

Extremely unlikely to happen.

The reason is that programmers would write code which, instead of reporting corruption, just ran this recovery process. This process can silently lose data ! Users would complain that SQLite lost their data without any warning. This would lower the reputation that SQLite has. Also, eventually there could be corruption so bad that recovery wasn't possible at all.

Forcing someone to use a programmer tool to perform this recovery forces a real human to have to figure out why the corruption is happening, and perhaps do something about it while an intact backup exists.

(Yes, I know it's possible to script the CLI to perform the recovery on some platforms.)

It might help to know that SQLite already has a lot of built-in logic designed to recover corruption caused by storage failures and power loss. This happens automatically when it detects that it's opening a database which wasn't closed in an orderly fashion, and SQLite doesn't report the problem in any way. It just can't cope with all the situations that the .recover command can.

(3) By anonymous on 2022-08-29 15:58:52 in reply to 2 [link] [source]

Thanks Simon, that makes sense.