aboutsummaryrefslogtreecommitdiffstats
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
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]>
-rw-r--r--NEWS2
-rw-r--r--doc/errorref.txt71
-rw-r--r--src/err-codes.h.in42
-rw-r--r--src/gpg-error.h.in7
4 files changed, 120 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index ef29558..56f7a8c 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,8 @@
Noteworthy changes in version 1.37 (unreleased) [C27/A27/R_]
-----------------------------------------------
+ * A new set of codes to map SQLite primary error codes.
+
Noteworthy changes in version 1.36 (2019-03-19) [C27/A27/R0]
-----------------------------------------------
diff --git a/doc/errorref.txt b/doc/errorref.txt
index d6c06aa..f35a35f 100644
--- a/doc/errorref.txt
+++ b/doc/errorref.txt
@@ -268,7 +268,8 @@ GPG_ERR_UNUSABLE_SECKEY Unusable secret key
GPG_ERR_INV_VALUE Invalid value
NTBTLS: - A DH parameter is out of range
-
+ GnuPG: - An Assuan server returns a status line with
+ unexpected values.
GPG_ERR_BAD_CERT_CHAIN Bad certificate chain
@@ -481,6 +482,9 @@ GPG_ERR_NOTHING_FOUND Nothing found
GPG_ERR_WRONG_BLOB_TYPE Wrong blob type
+ GNUPG: - The keyboxd returns an unexpected blob
+ (e.g. OpenPGP was requested but X.509 returned).
+
GPG_ERR_MISSING_VALUE Missing value
GNUPG: - Not enough parameters for a secret key send to gpg-agent.
@@ -1152,4 +1156,69 @@ GPG_ERR_LDAP_OTHER_GENERAL LDAP Other general error
#define LDAP_E_ERROR(n) LDAP_RANGE((n),0x1000,0x3FFF)
#define LDAP_X_ERROR(n) LDAP_RANGE((n),0x4000,0xFFFF)
+GPG_ERR_SQL_OK SQL success
+
+ This code is normally not used because it it mapped to GPG_ERR_NO_ERROR.
+
+GPG_ERR_SQL_ERROR SQL error
+
+GPG_ERR_SQL_INTERNAL Internal logic error in SQL library
+
+GPG_ERR_SQL_PERM Access permission denied (SQL)
+
+GPG_ERR_SQL_ABORT SQL abort was requested
+
+GPG_ERR_SQL_BUSY SQL database file is locked
+
+GPG_ERR_SQL_LOCKED An SQL table in the database is locked
+
+GPG_ERR_SQL_NOMEM SQL library ran out of core
+
+GPG_ERR_SQL_READONLY Attempt to write a readonly SQL database
+
+GPG_ERR_SQL_INTERRUPT SQL operation terminated by interrupt
+
+GPG_ERR_SQL_IOERR I/O error during SQL operation
+
+GPG_ERR_SQL_CORRUPT SQL database disk image is malformed
+
+GPG_ERR_SQL_NOTFOUND Unknown opcode in SQL file control
+
+GPG_ERR_SQL_FULL Insertion failed because SQL database is full
+
+GPG_ERR_SQL_CANTOPEN Unable to open the SQL database file
+
+GPG_ERR_SQL_PROTOCOL SQL database lock protocol error
+
+GPG_ERR_SQL_EMPTY (internal SQL code: empty)
+
+GPG_ERR_SQL_SCHEMA SQL database schema changed
+
+GPG_ERR_SQL_TOOBIG String or blob exceeds size limit (SQL)
+
+GPG_ERR_SQL_CONSTRAINT SQL abort due to constraint violation
+
+GPG_ERR_SQL_MISMATCH Data type mismatch (SQL)
+
+GPG_ERR_SQL_MISUSE SQL library used incorrectly
+
+GPG_ERR_SQL_NOLFS SQL library uses unsupported OS features
+
+GPG_ERR_SQL_AUTH Authorization denied (SQL)
+
+GPG_ERR_SQL_FORMAT (unused SQL code: format)
+
+GPG_ERR_SQL_RANGE SQL bind parameter out of range
+
+GPG_ERR_SQL_NOTADB File opened that is not an SQL database file
+
+GPG_ERR_SQL_NOTICE Notifications from SQL logger
+
+GPG_ERR_SQL_WARNING Warnings from SQL logger
+
+GPG_ERR_SQL_ROW SQL has another row ready
+
+GPG_ERR SQL_DONE SQL has finished executing
+
+
## end of errorref.txt
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. */