aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2019-12-13 08:38:34 +0000
committerWerner Koch <[email protected]>2019-12-13 08:40:22 +0000
commit308574372055662c76d27f1681b182afddce9166 (patch)
tree23b82ca2b77d0c1c3b386e1095a90027d42f16d6 /src
parentpo: Update Japanese Translations. (diff)
downloadlibgpg-error-308574372055662c76d27f1681b182afddce9166.tar.gz
libgpg-error-308574372055662c76d27f1681b182afddce9166.zip
New error codes for SQLite
* src/err-codes.h.in: Add GPG_ERR_SQL_ codes. * src/gpg-error.h.in (gpg_err_code_from_sqlite): New. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/err-codes.h.in42
-rw-r--r--src/gpg-error.h.in7
2 files changed, 48 insertions, 1 deletions
diff --git a/src/err-codes.h.in b/src/err-codes.h.in
index 3178b58..c65775f 100644
--- a/src/err-codes.h.in
+++ b/src/err-codes.h.in
@@ -474,7 +474,47 @@
1038 GPG_ERR_USER_15 User defined error code 15
1039 GPG_ERR_USER_16 User defined error code 16
-# 1040 to 16380 are free to be used.
+# 1040 to 1499 are free to be used.
+
+# 1500 to 1755 are mapped SQLite primary error codes.
+1500 GPG_ERR_SQL_OK SQL success
+1501 GPG_ERR_SQL_ERROR SQL error
+1502 GPG_ERR_SQL_INTERNAL Internal logic error in SQL library
+1503 GPG_ERR_SQL_PERM Access permission denied (SQL)
+1504 GPG_ERR_SQL_ABORT SQL abort was requested
+1505 GPG_ERR_SQL_BUSY SQL database file is locked
+1506 GPG_ERR_SQL_LOCKED An SQL table in the database is locked
+1507 GPG_ERR_SQL_NOMEM SQL library ran out of core
+1508 GPG_ERR_SQL_READONLY Attempt to write a readonly SQL database
+1509 GPG_ERR_SQL_INTERRUPT SQL operation terminated by interrupt
+1510 GPG_ERR_SQL_IOERR I/O error during SQL operation
+1511 GPG_ERR_SQL_CORRUPT SQL database disk image is malformed
+1512 GPG_ERR_SQL_NOTFOUND Unknown opcode in SQL file control
+1513 GPG_ERR_SQL_FULL Insertion failed because SQL database is full
+1514 GPG_ERR_SQL_CANTOPEN Unable to open the SQL database file
+1515 GPG_ERR_SQL_PROTOCOL SQL database lock protocol error
+1516 GPG_ERR_SQL_EMPTY (internal SQL code: empty)
+1517 GPG_ERR_SQL_SCHEMA SQL database schema changed
+1518 GPG_ERR_SQL_TOOBIG String or blob exceeds size limit (SQL)
+1519 GPG_ERR_SQL_CONSTRAINT SQL abort due to constraint violation
+1520 GPG_ERR_SQL_MISMATCH Data type mismatch (SQL)
+1521 GPG_ERR_SQL_MISUSE SQL library used incorrectly
+1522 GPG_ERR_SQL_NOLFS SQL library uses unsupported OS features
+1523 GPG_ERR_SQL_AUTH Authorization denied (SQL)
+1524 GPG_ERR_SQL_FORMAT (unused SQL code: format)
+1525 GPG_ERR_SQL_RANGE SQL bind parameter out of range
+1526 GPG_ERR_SQL_NOTADB File opened that is not an SQL database file
+1527 GPG_ERR_SQL_NOTICE Notifications from SQL logger
+1528 GPG_ERR_SQL_WARNING Warnings from SQL logger
+
+# 1529 to 1599 are reserved for newer SQLite primary error codes.
+
+1600 GPG_ERR_SQL_ROW SQL has another row ready
+1601 GPG_ERR_SQL_DONE SQL has finished executing
+
+# 1602 to 1755 are reserved for newer SQLite primary error codes.
+
+# 1756 to 16380 are free to be used.
16381 GPG_ERR_MISSING_ERRNO System error w/o errno
16382 GPG_ERR_UNKNOWN_ERRNO Unknown system error
diff --git a/src/gpg-error.h.in b/src/gpg-error.h.in
index 1b9be09..d118e90 100644
--- a/src/gpg-error.h.in
+++ b/src/gpg-error.h.in
@@ -415,6 +415,13 @@ int gpg_err_code_to_errno (gpg_err_code_t code);
* (report this) and GPG_ERR_MISSING_ERRNO if ERRNO has the value 0. */
gpg_err_code_t gpg_err_code_from_syserror (void);
+/* Mapper for SQLite primary error codes. */
+static GPG_ERR_INLINE gpg_error_t
+gpg_err_code_from_sqlite (int sqlres)
+{
+ return sqlres? GPG_ERR_SQL_OK + (sqlres & 0xff) : 0;
+}
+
/* Set the ERRNO variable. This function is the preferred way to set
* ERRNO due to peculiarities on WindowsCE. */