Don't check for unflushed bytes in SSLClientSocketOpenSSL::IsConnectedAndIdle.
[chromium-blink-merge.git] / sql / error_delegate_util.cc
blob37fe006947e0afcd8e8f329d62666fef5b287983
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "sql/error_delegate_util.h"
7 #include "third_party/sqlite/sqlite3.h"
9 namespace sql {
11 bool IsErrorCatastrophic(int error) {
12 switch (error) {
13 case SQLITE_DONE:
14 case SQLITE_OK:
15 // Theoretically, the wrapped delegate might have resolved the error, and
16 // we would end up here.
17 return false;
19 case SQLITE_CORRUPT:
20 case SQLITE_NOTADB:
21 // Highly unlikely we would ever recover from these.
22 return true;
24 case SQLITE_CANTOPEN:
25 // TODO(erikwright): Figure out what this means.
26 return false;
28 case SQLITE_IOERR:
29 // This could be broken blocks, in which case deleting the DB would be a
30 // good idea. But it might also be transient.
31 // TODO(erikwright): Figure out if we can distinguish between the two,
32 // or determine through metrics analysis to what extent these failures are
33 // transient.
34 return false;
36 case SQLITE_BUSY:
37 // Presumably transient.
38 return false;
40 case SQLITE_TOOBIG:
41 case SQLITE_FULL:
42 case SQLITE_NOMEM:
43 // Not a problem with the database.
44 return false;
46 case SQLITE_READONLY:
47 // Presumably either transient or we don't have the privileges to
48 // move/delete the file anyway.
49 return false;
51 case SQLITE_CONSTRAINT:
52 case SQLITE_ERROR:
53 // These probgably indicate a programming error or a migration failure
54 // that we prefer not to mask.
55 return false;
57 case SQLITE_LOCKED:
58 case SQLITE_INTERNAL:
59 case SQLITE_PERM:
60 case SQLITE_ABORT:
61 case SQLITE_INTERRUPT:
62 case SQLITE_NOTFOUND:
63 case SQLITE_PROTOCOL:
64 case SQLITE_EMPTY:
65 case SQLITE_SCHEMA:
66 case SQLITE_MISMATCH:
67 case SQLITE_MISUSE:
68 case SQLITE_NOLFS:
69 case SQLITE_AUTH:
70 case SQLITE_FORMAT:
71 case SQLITE_RANGE:
72 case SQLITE_ROW:
73 // None of these appear in error reports, so for now let's not try to
74 // guess at how to handle them.
75 return false;
77 return false;
80 } // namespace sql