Annotation of embedaddon/sqlite3/src/ctime.c, revision 1.1.1.1

1.1       misho       1: /*
                      2: ** 2010 February 23
                      3: **
                      4: ** The author disclaims copyright to this source code.  In place of
                      5: ** a legal notice, here is a blessing:
                      6: **
                      7: **    May you do good and not evil.
                      8: **    May you find forgiveness for yourself and forgive others.
                      9: **    May you share freely, never taking more than you give.
                     10: **
                     11: *************************************************************************
                     12: **
                     13: ** This file implements routines used to report what compile-time options
                     14: ** SQLite was built with.
                     15: */
                     16: 
                     17: #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
                     18: 
                     19: #include "sqliteInt.h"
                     20: 
                     21: /*
                     22: ** An array of names of all compile-time options.  This array should 
                     23: ** be sorted A-Z.
                     24: **
                     25: ** This array looks large, but in a typical installation actually uses
                     26: ** only a handful of compile-time options, so most times this array is usually
                     27: ** rather short and uses little memory space.
                     28: */
                     29: static const char * const azCompileOpt[] = {
                     30: 
                     31: /* These macros are provided to "stringify" the value of the define
                     32: ** for those options in which the value is meaningful. */
                     33: #define CTIMEOPT_VAL_(opt) #opt
                     34: #define CTIMEOPT_VAL(opt) CTIMEOPT_VAL_(opt)
                     35: 
                     36: #ifdef SQLITE_32BIT_ROWID
                     37:   "32BIT_ROWID",
                     38: #endif
                     39: #ifdef SQLITE_4_BYTE_ALIGNED_MALLOC
                     40:   "4_BYTE_ALIGNED_MALLOC",
                     41: #endif
                     42: #ifdef SQLITE_CASE_SENSITIVE_LIKE
                     43:   "CASE_SENSITIVE_LIKE",
                     44: #endif
                     45: #ifdef SQLITE_CHECK_PAGES
                     46:   "CHECK_PAGES",
                     47: #endif
                     48: #ifdef SQLITE_COVERAGE_TEST
                     49:   "COVERAGE_TEST",
                     50: #endif
                     51: #ifdef SQLITE_DEBUG
                     52:   "DEBUG",
                     53: #endif
                     54: #ifdef SQLITE_DEFAULT_LOCKING_MODE
                     55:   "DEFAULT_LOCKING_MODE=" CTIMEOPT_VAL(SQLITE_DEFAULT_LOCKING_MODE),
                     56: #endif
                     57: #ifdef SQLITE_DISABLE_DIRSYNC
                     58:   "DISABLE_DIRSYNC",
                     59: #endif
                     60: #ifdef SQLITE_DISABLE_LFS
                     61:   "DISABLE_LFS",
                     62: #endif
                     63: #ifdef SQLITE_ENABLE_ATOMIC_WRITE
                     64:   "ENABLE_ATOMIC_WRITE",
                     65: #endif
                     66: #ifdef SQLITE_ENABLE_CEROD
                     67:   "ENABLE_CEROD",
                     68: #endif
                     69: #ifdef SQLITE_ENABLE_COLUMN_METADATA
                     70:   "ENABLE_COLUMN_METADATA",
                     71: #endif
                     72: #ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT
                     73:   "ENABLE_EXPENSIVE_ASSERT",
                     74: #endif
                     75: #ifdef SQLITE_ENABLE_FTS1
                     76:   "ENABLE_FTS1",
                     77: #endif
                     78: #ifdef SQLITE_ENABLE_FTS2
                     79:   "ENABLE_FTS2",
                     80: #endif
                     81: #ifdef SQLITE_ENABLE_FTS3
                     82:   "ENABLE_FTS3",
                     83: #endif
                     84: #ifdef SQLITE_ENABLE_FTS3_PARENTHESIS
                     85:   "ENABLE_FTS3_PARENTHESIS",
                     86: #endif
                     87: #ifdef SQLITE_ENABLE_FTS4
                     88:   "ENABLE_FTS4",
                     89: #endif
                     90: #ifdef SQLITE_ENABLE_ICU
                     91:   "ENABLE_ICU",
                     92: #endif
                     93: #ifdef SQLITE_ENABLE_IOTRACE
                     94:   "ENABLE_IOTRACE",
                     95: #endif
                     96: #ifdef SQLITE_ENABLE_LOAD_EXTENSION
                     97:   "ENABLE_LOAD_EXTENSION",
                     98: #endif
                     99: #ifdef SQLITE_ENABLE_LOCKING_STYLE
                    100:   "ENABLE_LOCKING_STYLE=" CTIMEOPT_VAL(SQLITE_ENABLE_LOCKING_STYLE),
                    101: #endif
                    102: #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
                    103:   "ENABLE_MEMORY_MANAGEMENT",
                    104: #endif
                    105: #ifdef SQLITE_ENABLE_MEMSYS3
                    106:   "ENABLE_MEMSYS3",
                    107: #endif
                    108: #ifdef SQLITE_ENABLE_MEMSYS5
                    109:   "ENABLE_MEMSYS5",
                    110: #endif
                    111: #ifdef SQLITE_ENABLE_OVERSIZE_CELL_CHECK
                    112:   "ENABLE_OVERSIZE_CELL_CHECK",
                    113: #endif
                    114: #ifdef SQLITE_ENABLE_RTREE
                    115:   "ENABLE_RTREE",
                    116: #endif
                    117: #ifdef SQLITE_ENABLE_STAT3
                    118:   "ENABLE_STAT3",
                    119: #endif
                    120: #ifdef SQLITE_ENABLE_UNLOCK_NOTIFY
                    121:   "ENABLE_UNLOCK_NOTIFY",
                    122: #endif
                    123: #ifdef SQLITE_ENABLE_UPDATE_DELETE_LIMIT
                    124:   "ENABLE_UPDATE_DELETE_LIMIT",
                    125: #endif
                    126: #ifdef SQLITE_HAS_CODEC
                    127:   "HAS_CODEC",
                    128: #endif
                    129: #ifdef SQLITE_HAVE_ISNAN
                    130:   "HAVE_ISNAN",
                    131: #endif
                    132: #ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX
                    133:   "HOMEGROWN_RECURSIVE_MUTEX",
                    134: #endif
                    135: #ifdef SQLITE_IGNORE_AFP_LOCK_ERRORS
                    136:   "IGNORE_AFP_LOCK_ERRORS",
                    137: #endif
                    138: #ifdef SQLITE_IGNORE_FLOCK_LOCK_ERRORS
                    139:   "IGNORE_FLOCK_LOCK_ERRORS",
                    140: #endif
                    141: #ifdef SQLITE_INT64_TYPE
                    142:   "INT64_TYPE",
                    143: #endif
                    144: #ifdef SQLITE_LOCK_TRACE
                    145:   "LOCK_TRACE",
                    146: #endif
                    147: #ifdef SQLITE_MAX_SCHEMA_RETRY
                    148:   "MAX_SCHEMA_RETRY=" CTIMEOPT_VAL(SQLITE_MAX_SCHEMA_RETRY),
                    149: #endif
                    150: #ifdef SQLITE_MEMDEBUG
                    151:   "MEMDEBUG",
                    152: #endif
                    153: #ifdef SQLITE_MIXED_ENDIAN_64BIT_FLOAT
                    154:   "MIXED_ENDIAN_64BIT_FLOAT",
                    155: #endif
                    156: #ifdef SQLITE_NO_SYNC
                    157:   "NO_SYNC",
                    158: #endif
                    159: #ifdef SQLITE_OMIT_ALTERTABLE
                    160:   "OMIT_ALTERTABLE",
                    161: #endif
                    162: #ifdef SQLITE_OMIT_ANALYZE
                    163:   "OMIT_ANALYZE",
                    164: #endif
                    165: #ifdef SQLITE_OMIT_ATTACH
                    166:   "OMIT_ATTACH",
                    167: #endif
                    168: #ifdef SQLITE_OMIT_AUTHORIZATION
                    169:   "OMIT_AUTHORIZATION",
                    170: #endif
                    171: #ifdef SQLITE_OMIT_AUTOINCREMENT
                    172:   "OMIT_AUTOINCREMENT",
                    173: #endif
                    174: #ifdef SQLITE_OMIT_AUTOINIT
                    175:   "OMIT_AUTOINIT",
                    176: #endif
                    177: #ifdef SQLITE_OMIT_AUTOMATIC_INDEX
                    178:   "OMIT_AUTOMATIC_INDEX",
                    179: #endif
                    180: #ifdef SQLITE_OMIT_AUTORESET
                    181:   "OMIT_AUTORESET",
                    182: #endif
                    183: #ifdef SQLITE_OMIT_AUTOVACUUM
                    184:   "OMIT_AUTOVACUUM",
                    185: #endif
                    186: #ifdef SQLITE_OMIT_BETWEEN_OPTIMIZATION
                    187:   "OMIT_BETWEEN_OPTIMIZATION",
                    188: #endif
                    189: #ifdef SQLITE_OMIT_BLOB_LITERAL
                    190:   "OMIT_BLOB_LITERAL",
                    191: #endif
                    192: #ifdef SQLITE_OMIT_BTREECOUNT
                    193:   "OMIT_BTREECOUNT",
                    194: #endif
                    195: #ifdef SQLITE_OMIT_BUILTIN_TEST
                    196:   "OMIT_BUILTIN_TEST",
                    197: #endif
                    198: #ifdef SQLITE_OMIT_CAST
                    199:   "OMIT_CAST",
                    200: #endif
                    201: #ifdef SQLITE_OMIT_CHECK
                    202:   "OMIT_CHECK",
                    203: #endif
                    204: /* // redundant
                    205: ** #ifdef SQLITE_OMIT_COMPILEOPTION_DIAGS
                    206: **   "OMIT_COMPILEOPTION_DIAGS",
                    207: ** #endif
                    208: */
                    209: #ifdef SQLITE_OMIT_COMPLETE
                    210:   "OMIT_COMPLETE",
                    211: #endif
                    212: #ifdef SQLITE_OMIT_COMPOUND_SELECT
                    213:   "OMIT_COMPOUND_SELECT",
                    214: #endif
                    215: #ifdef SQLITE_OMIT_DATETIME_FUNCS
                    216:   "OMIT_DATETIME_FUNCS",
                    217: #endif
                    218: #ifdef SQLITE_OMIT_DECLTYPE
                    219:   "OMIT_DECLTYPE",
                    220: #endif
                    221: #ifdef SQLITE_OMIT_DEPRECATED
                    222:   "OMIT_DEPRECATED",
                    223: #endif
                    224: #ifdef SQLITE_OMIT_DISKIO
                    225:   "OMIT_DISKIO",
                    226: #endif
                    227: #ifdef SQLITE_OMIT_EXPLAIN
                    228:   "OMIT_EXPLAIN",
                    229: #endif
                    230: #ifdef SQLITE_OMIT_FLAG_PRAGMAS
                    231:   "OMIT_FLAG_PRAGMAS",
                    232: #endif
                    233: #ifdef SQLITE_OMIT_FLOATING_POINT
                    234:   "OMIT_FLOATING_POINT",
                    235: #endif
                    236: #ifdef SQLITE_OMIT_FOREIGN_KEY
                    237:   "OMIT_FOREIGN_KEY",
                    238: #endif
                    239: #ifdef SQLITE_OMIT_GET_TABLE
                    240:   "OMIT_GET_TABLE",
                    241: #endif
                    242: #ifdef SQLITE_OMIT_INCRBLOB
                    243:   "OMIT_INCRBLOB",
                    244: #endif
                    245: #ifdef SQLITE_OMIT_INTEGRITY_CHECK
                    246:   "OMIT_INTEGRITY_CHECK",
                    247: #endif
                    248: #ifdef SQLITE_OMIT_LIKE_OPTIMIZATION
                    249:   "OMIT_LIKE_OPTIMIZATION",
                    250: #endif
                    251: #ifdef SQLITE_OMIT_LOAD_EXTENSION
                    252:   "OMIT_LOAD_EXTENSION",
                    253: #endif
                    254: #ifdef SQLITE_OMIT_LOCALTIME
                    255:   "OMIT_LOCALTIME",
                    256: #endif
                    257: #ifdef SQLITE_OMIT_LOOKASIDE
                    258:   "OMIT_LOOKASIDE",
                    259: #endif
                    260: #ifdef SQLITE_OMIT_MEMORYDB
                    261:   "OMIT_MEMORYDB",
                    262: #endif
                    263: #ifdef SQLITE_OMIT_MERGE_SORT
                    264:   "OMIT_MERGE_SORT",
                    265: #endif
                    266: #ifdef SQLITE_OMIT_OR_OPTIMIZATION
                    267:   "OMIT_OR_OPTIMIZATION",
                    268: #endif
                    269: #ifdef SQLITE_OMIT_PAGER_PRAGMAS
                    270:   "OMIT_PAGER_PRAGMAS",
                    271: #endif
                    272: #ifdef SQLITE_OMIT_PRAGMA
                    273:   "OMIT_PRAGMA",
                    274: #endif
                    275: #ifdef SQLITE_OMIT_PROGRESS_CALLBACK
                    276:   "OMIT_PROGRESS_CALLBACK",
                    277: #endif
                    278: #ifdef SQLITE_OMIT_QUICKBALANCE
                    279:   "OMIT_QUICKBALANCE",
                    280: #endif
                    281: #ifdef SQLITE_OMIT_REINDEX
                    282:   "OMIT_REINDEX",
                    283: #endif
                    284: #ifdef SQLITE_OMIT_SCHEMA_PRAGMAS
                    285:   "OMIT_SCHEMA_PRAGMAS",
                    286: #endif
                    287: #ifdef SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS
                    288:   "OMIT_SCHEMA_VERSION_PRAGMAS",
                    289: #endif
                    290: #ifdef SQLITE_OMIT_SHARED_CACHE
                    291:   "OMIT_SHARED_CACHE",
                    292: #endif
                    293: #ifdef SQLITE_OMIT_SUBQUERY
                    294:   "OMIT_SUBQUERY",
                    295: #endif
                    296: #ifdef SQLITE_OMIT_TCL_VARIABLE
                    297:   "OMIT_TCL_VARIABLE",
                    298: #endif
                    299: #ifdef SQLITE_OMIT_TEMPDB
                    300:   "OMIT_TEMPDB",
                    301: #endif
                    302: #ifdef SQLITE_OMIT_TRACE
                    303:   "OMIT_TRACE",
                    304: #endif
                    305: #ifdef SQLITE_OMIT_TRIGGER
                    306:   "OMIT_TRIGGER",
                    307: #endif
                    308: #ifdef SQLITE_OMIT_TRUNCATE_OPTIMIZATION
                    309:   "OMIT_TRUNCATE_OPTIMIZATION",
                    310: #endif
                    311: #ifdef SQLITE_OMIT_UTF16
                    312:   "OMIT_UTF16",
                    313: #endif
                    314: #ifdef SQLITE_OMIT_VACUUM
                    315:   "OMIT_VACUUM",
                    316: #endif
                    317: #ifdef SQLITE_OMIT_VIEW
                    318:   "OMIT_VIEW",
                    319: #endif
                    320: #ifdef SQLITE_OMIT_VIRTUALTABLE
                    321:   "OMIT_VIRTUALTABLE",
                    322: #endif
                    323: #ifdef SQLITE_OMIT_WAL
                    324:   "OMIT_WAL",
                    325: #endif
                    326: #ifdef SQLITE_OMIT_WSD
                    327:   "OMIT_WSD",
                    328: #endif
                    329: #ifdef SQLITE_OMIT_XFER_OPT
                    330:   "OMIT_XFER_OPT",
                    331: #endif
                    332: #ifdef SQLITE_PERFORMANCE_TRACE
                    333:   "PERFORMANCE_TRACE",
                    334: #endif
                    335: #ifdef SQLITE_PROXY_DEBUG
                    336:   "PROXY_DEBUG",
                    337: #endif
                    338: #ifdef SQLITE_SECURE_DELETE
                    339:   "SECURE_DELETE",
                    340: #endif
                    341: #ifdef SQLITE_SMALL_STACK
                    342:   "SMALL_STACK",
                    343: #endif
                    344: #ifdef SQLITE_SOUNDEX
                    345:   "SOUNDEX",
                    346: #endif
                    347: #ifdef SQLITE_TCL
                    348:   "TCL",
                    349: #endif
                    350: #ifdef SQLITE_TEMP_STORE
                    351:   "TEMP_STORE=" CTIMEOPT_VAL(SQLITE_TEMP_STORE),
                    352: #endif
                    353: #ifdef SQLITE_TEST
                    354:   "TEST",
                    355: #endif
                    356: #ifdef SQLITE_THREADSAFE
                    357:   "THREADSAFE=" CTIMEOPT_VAL(SQLITE_THREADSAFE),
                    358: #endif
                    359: #ifdef SQLITE_USE_ALLOCA
                    360:   "USE_ALLOCA",
                    361: #endif
                    362: #ifdef SQLITE_ZERO_MALLOC
                    363:   "ZERO_MALLOC"
                    364: #endif
                    365: };
                    366: 
                    367: /*
                    368: ** Given the name of a compile-time option, return true if that option
                    369: ** was used and false if not.
                    370: **
                    371: ** The name can optionally begin with "SQLITE_" but the "SQLITE_" prefix
                    372: ** is not required for a match.
                    373: */
                    374: int sqlite3_compileoption_used(const char *zOptName){
                    375:   int i, n;
                    376:   if( sqlite3StrNICmp(zOptName, "SQLITE_", 7)==0 ) zOptName += 7;
                    377:   n = sqlite3Strlen30(zOptName);
                    378: 
                    379:   /* Since ArraySize(azCompileOpt) is normally in single digits, a
                    380:   ** linear search is adequate.  No need for a binary search. */
                    381:   for(i=0; i<ArraySize(azCompileOpt); i++){
                    382:     if(   (sqlite3StrNICmp(zOptName, azCompileOpt[i], n)==0)
                    383:        && ( (azCompileOpt[i][n]==0) || (azCompileOpt[i][n]=='=') ) ) return 1;
                    384:   }
                    385:   return 0;
                    386: }
                    387: 
                    388: /*
                    389: ** Return the N-th compile-time option string.  If N is out of range,
                    390: ** return a NULL pointer.
                    391: */
                    392: const char *sqlite3_compileoption_get(int N){
                    393:   if( N>=0 && N<ArraySize(azCompileOpt) ){
                    394:     return azCompileOpt[N];
                    395:   }
                    396:   return 0;
                    397: }
                    398: 
                    399: #endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>