Small. Fast. Reliable.
Choose any three.
*** 7,13 ****
    #define RESULT_CODE(res)             ((res)&0xff)
    #define EXTENDED_RESULT_CODE(res)    (res)
  
! The symbolic name for an extended result code always contains a related primary result code as a prefix. Primary result codes contain a single "_" character. Extended result codes contain two or more "_" characters. The numeric value of an extended result code can be converted to its corresponding primary result code by masking off the lower 8 bits.
  
  A complete list of available extended result codes and details about the meaning of the various extended result codes can be found by consulting the C code, especially the sqlite3.h header file and its antecedent sqlite.h.in.
  
--- 7,13 ----
    #define RESULT_CODE(res)             ((res)&0xff)
    #define EXTENDED_RESULT_CODE(res)    (res)
  
! The symbolic name for an extended result code always contains a related primary result code as a prefix. Primary result codes contain a single "{quote:_}" character. Extended result codes contain two or more "{quote:_}" characters. The numeric value of an extended result code can be converted to its corresponding primary result code by masking off the lower 8 bits.
  
  A complete list of available extended result codes and details about the meaning of the various extended result codes can be found by consulting the C code, especially the sqlite3.h header file and its antecedent sqlite.h.in.
  
***************
*** 30,32 ****
--- 30,34 ----
  I don't know if =errno= values can safely be crammed into the high 24 bits of the result code.  It might be better to return them from a separate callback, say, =sqlite3_os_errcode()=, guaranteed to present the OS-level error code from the last operation that returned SQLITE_IOERR.  If that were done, I would also recommend that =sqlite3_errmsg()= automatically augment the error string with the equivalent of =strerror(saved_errno)= when appropriate.  That would allow library users to present better diagnostics to users without any code changes.
  
  -- Zack Weinberg <zackw@panix.com>  9 Jan 2007
+ 
+ *Comment about above:*  Windows error codes are 32 bits and use all of the bits and hence cannot be squeezed into the 24 bit space available.