SQLite Forum

How to distinguish fatal errors
Login
Sorry, let me explain it another way.

I'm not talking about closing sqlite, re opening and verifying it's not corrupt.

In the other thread I posted, it says SQLITE_FULL is reported once. It suggests aborting the app because you can't progress anymore or run another query and it says next insert has failed silently. This is okay, I can close() sqlite and quit on that "fatal" case.

There are other cases for SQLITE_FULL, so I'd like to continue to operate for these cases if possible. 



Pseudo code for my app :

```
// assume endless loop
while (query = next_query()) {
  rc = sqlite_exec(query);
    if (rc == SQLITE_FULL) {
      abort("disk is full");
    }

    report(rc);
}  
  
  

What I'm trying to achieve is : 

// assume endless loop
while (query = next_query()) {
    rc = sqlite_exec(query);
    if (rc == SQLITE_FULL) {
        if (temp_store_was_full() or page_limit_reached()) {
            // Assuming it's safe to continue in these cases. (?)
            // E.g select tried to use excessive amount of 'temp_store'
            // so, it's okay to fail this query and continue with the next one,
            // I don't care if the next one will fail as well.
            report(rc);
            continue;
        }
        
        abort("disk is full");
    }

    report(rc);
}

```

for page_limit_reached() :  

I can do what you suggested, check page_count and max_page_count pragma, hopefully these pragmas will work correctly. (Silent fail of insert and comment about API being not dependable sounds scary).