SQLite4
Check-in [8132a601e8]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Change the name of "storage.h" to "kv.h". Other minor edits to comments and typedefs.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8132a601e86a5d97869856204fa28240fe4f7e53
User & Date: drh 2012-10-20 12:57:54
Context
2012-10-20
13:01
Change the "TK_" macro prefix in lsm_tree.c to "TKV_" in order to avoid name collisions with "TK_" macros generated by the parser. check-in: b81bc323b9 user: drh tags: trunk
12:57
Change the name of "storage.h" to "kv.h". Other minor edits to comments and typedefs. check-in: 8132a601e8 user: drh tags: trunk
2012-10-19
16:39
Remove obsolete content from sqliteInt.h. check-in: d618b9b106 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to main.mk.

   111    111     $(TOP)/src/fkey.c \
   112    112     $(TOP)/src/func.c \
   113    113     $(TOP)/src/global.c \
   114    114     $(TOP)/src/hash.c \
   115    115     $(TOP)/src/hash.h \
   116    116     $(TOP)/src/hwtime.h \
   117    117     $(TOP)/src/insert.c \
          118  +  $(TOP)/src/kv.h \
   118    119     $(TOP)/src/kvlsm.c \
   119    120     $(TOP)/src/kvmem.c \
   120    121     $(TOP)/src/legacy.c \
   121    122     $(TOP)/src/lsm.h \
   122    123     $(TOP)/src/lsmInt.h \
   123    124     $(TOP)/src/lsm_ckpt.c \
   124    125     $(TOP)/src/lsm_file.c \
................................................................................
   157    158     $(TOP)/src/select.c \
   158    159     $(TOP)/src/shell.c \
   159    160     $(TOP)/src/sqlite.h.in \
   160    161     $(TOP)/src/sqliteInt.h \
   161    162     $(TOP)/src/sqliteLimit.h \
   162    163     $(TOP)/src/status.c \
   163    164     $(TOP)/src/storage.c \
   164         -  $(TOP)/src/storage.h \
   165    165     $(TOP)/src/tclsqlite.c \
   166    166     $(TOP)/src/tokenize.c \
   167    167     $(TOP)/src/trigger.c \
   168    168     $(TOP)/src/utf.c \
   169    169     $(TOP)/src/update.c \
   170    170     $(TOP)/src/util.c \
   171    171     $(TOP)/src/varint.c \
................................................................................
   272    272   
   273    273   # Header files used by all library source files.
   274    274   #
   275    275   HDR = \
   276    276      $(TOP)/src/hash.h \
   277    277      $(TOP)/src/hwtime.h \
   278    278      keywordhash.h \
          279  +   $(TOP)/src/kv.h \
   279    280      $(TOP)/src/lsm.h \
   280    281      $(TOP)/src/lsmInt.h \
   281    282      $(TOP)/src/mutex.h \
   282    283      opcodes.h \
   283    284      $(TOP)/src/os.h \
   284    285      parse.h  \
   285    286      sqlite4.h  \
   286    287      $(TOP)/src/sqliteInt.h  \
   287    288      $(TOP)/src/sqliteLimit.h \
   288         -   $(TOP)/src/storage.h \
   289    289      $(TOP)/src/vdbe.h \
   290    290      $(TOP)/src/vdbeInt.h
   291    291   
   292    292   EXTHDR = \
   293    293     $(TOP)/ext/fts3/fts3.h \
   294    294     $(TOP)/ext/fts3/fts3Int.h \
   295    295     $(TOP)/ext/fts3/fts3_hash.h \

Name change from src/storage.h to src/kv.h.

    24     24   ** for content to be read.  The transaction level must be at least 2 for 
    25     25   ** content to be modified.
    26     26   ** 
    27     27   ** The xBegin method increases transaction level.  The increase may be no
    28     28   ** more than 1 unless the transaction level is initially 0 in which case
    29     29   ** it can be increased immediately to 2.  Increasing the transaction level
    30     30   ** to 1 or more makes a "snapshot" of the database file such that changes
    31         -** made by other connections are not visible.  An xBegin call may fail
           31  +** made by other connections are not visible.  Calls to xBegin may fail
    32     32   ** with SQLITE4_BUSY if the initial transaction level is 0 or 1.
    33     33   ** 
    34     34   ** A read-only database will fail an attempt to increase xBegin above 1.  An
    35     35   ** implementation that does not support nested transactions will fail any
    36     36   ** attempt to increase the transaction level above 2.
    37     37   ** 
    38     38   ** The xCommitPhaseOne and xCommitPhaseTwo methods implement a 2-phase
................................................................................
    54     54   ** to what it was immediately after the most recent xCommit(N).  Higher-level
    55     55   ** subtransactions are cancelled.  This call is equivalent to xRollback(N-1)
    56     56   ** followed by xBegin(N) but is atomic and might be more efficient.
    57     57   ** 
    58     58   ** The xReplace method replaces the value for an existing entry with the
    59     59   ** given key, or creates a new entry with the given key and value if no
    60     60   ** prior entry exists with the given key.  The key and value pointers passed
    61         -** into xReplace belong to the caller will likely be destroyed when the
           61  +** into xReplace belong to the caller and will likely be destroyed when the
    62     62   ** call to xReplace returns so the xReplace routine must make its own
    63         -** copy of that information.
           63  +** copy of that information if it needs to retain it after returning.
    64     64   ** 
    65     65   ** A cursor is at all times pointing to ether an entry in the database or
    66     66   ** to EOF.  EOF means "no entry".  Cursor operations other than xCloseCursor 
    67     67   ** will fail if the transaction level is less than 1.
    68     68   ** 
    69     69   ** The xSeek method moves a cursor to an entry in the database that matches
    70     70   ** the supplied key as closely as possible.  If the dir argument is 0, then
................................................................................
    76     76   ** is found if it is available, otherwise the cursor is left pointing the
    77     77   ** the smallest entry that is larger than the search key, or to EOF if there
    78     78   ** are no entries larger than the search key.
    79     79   **
    80     80   ** The return code from xSeek might be one of the following:
    81     81   **
    82     82   **    SQLITE4_OK        The cursor is left pointing to any entry that
    83         -**                     exactly matchings the probe key.
           83  +**                      exactly matchings the probe key.
    84     84   **
    85     85   **    SQLITE4_INEXACT   The cursor is left pointing to the nearest entry
    86         -**                     to the probe it could find, either before or after
    87         -**                     the probe, according to the dir argument.
           86  +**                      to the probe it could find, either before or after
           87  +**                      the probe, according to the dir argument.
    88     88   **
    89     89   **    SQLITE4_NOTFOUND  No suitable entry could be found.  Either dir==0 and
    90         -**                     there was no exact match, or dir<0 and the probe is
    91         -**                     smaller than every entry in the database, or dir>0 and
    92         -**                     the probe is larger than every entry in the database.
           90  +**                      there was no exact match, or dir<0 and the probe is
           91  +**                      smaller than every entry in the database, or dir>0 and
           92  +**                      the probe is larger than every entry in the database.
    93     93   **
    94     94   ** xSeek might also return some error code like SQLITE4_IOERR or
    95     95   ** SQLITE4_NOMEM.
    96     96   ** 
    97     97   ** The xNext method will only be called following an xSeek with a positive dir,
    98     98   ** or another xNext.  The xPrev method will only be called following an xSeek
    99     99   ** with a negative dir or another xPrev.  Both xNext and xPrev will return

Changes to src/kvlsm.c.

     7      7   **    May you do good and not evil.
     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   **
    13     13   ** An in-memory key/value storage subsystem that presents the interfadce
    14         -** defined by storage.h
           14  +** defined by kv.h
    15     15   */
    16     16   #include "sqliteInt.h"
    17     17   #include "lsm.h"
    18     18   
           19  +/* Forward declarations of objects */
    19     20   typedef struct KVLsm KVLsm;
    20     21   typedef struct KVLsmCsr KVLsmCsr;
    21     22   
           23  +/*
           24  +** An instance of an open connection to an LSM store.  A subclass of KVStore.
           25  +*/
    22     26   struct KVLsm {
    23     27     KVStore base;                   /* Base class, must be first */
    24     28     lsm_db *pDb;                    /* LSM database handle */
    25     29     lsm_cursor *pCsr;               /* LSM cursor holding read-trans open */
    26     30   };
    27     31   
           32  +/*
           33  +** An instance of an open cursor pointing into an LSM store.  A subclass
           34  +** of KVCursor.
           35  +*/
    28     36   struct KVLsmCsr {
    29     37     KVCursor base;                  /* Base class. Must be first */
    30     38     lsm_cursor *pCsr;               /* LSM cursor handle */
    31     39   };
    32     40     
    33     41   /*
    34     42   ** Begin a transaction or subtransaction.

Changes to src/kvmem.c.

     7      7   **    May you do good and not evil.
     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   **
    13     13   ** An in-memory key/value storage subsystem that presents the interfadce
    14         -** defined by storage.h
           14  +** defined by kv.h
    15     15   */
    16     16   #include "sqliteInt.h"
    17     17   
    18     18   /* Forward declarations of object names */
    19     19   typedef struct KVMemNode KVMemNode;
    20     20   typedef struct KVMemChng KVMemChng;
    21     21   typedef struct KVMem KVMem;

Changes to src/shell.c.

   175    175       FILETIME ftCreation, ftExit;
   176    176       getProcessTimesAddr(hProcess, &ftCreation, &ftExit, &ftKernelBegin, &ftUserBegin);
   177    177     }
   178    178   }
   179    179   
   180    180   /* Return the difference of two FILETIME structs in seconds */
   181    181   static double timeDiff(FILETIME *pStart, FILETIME *pEnd){
   182         -  sqlite_int64 i64Start = *((sqlite_int64 *) pStart);
   183         -  sqlite_int64 i64End = *((sqlite_int64 *) pEnd);
          182  +  sqlite4_int64 i64Start = *((sqlite4_int64 *) pStart);
          183  +  sqlite4_int64 i64End = *((sqlite4_int64 *) pEnd);
   184    184     return (double) ((i64End - i64Start) / 10000000.0);
   185    185   }
   186    186   
   187    187   /*
   188    188   ** Print the timing results.
   189    189   */
   190    190   static void endTimer(void){

Changes to src/sqlite.h.in.

   252    252   ** [sqlite4_busy_timeout()] to name but three) that are methods on an
   253    253   ** sqlite4 object.
   254    254   */
   255    255   typedef struct sqlite4 sqlite4;
   256    256   
   257    257   /*
   258    258   ** CAPIREF: 64-Bit Integer Types
   259         -** KEYWORDS: sqlite_int64 sqlite_uint64
          259  +** KEYWORDS: sqlite4_int64 sqlite4_uint64
   260    260   **
   261    261   ** Because there is no cross-platform way to specify 64-bit integer types
   262    262   ** SQLite includes typedefs for 64-bit signed and unsigned integers.
   263    263   **
   264         -** The sqlite4_int64 and sqlite4_uint64 are the preferred type definitions.
   265         -** The sqlite_int64 and sqlite_uint64 types are supported for backwards
   266         -** compatibility only.
   267         -**
   268    264   ** ^The sqlite4_int64 and sqlite_int64 types can store integer values
   269    265   ** between -9223372036854775808 and +9223372036854775807 inclusive.  ^The
   270    266   ** sqlite4_uint64 and sqlite_uint64 types can store integer values 
   271    267   ** between 0 and +18446744073709551615 inclusive.
   272    268   */
   273    269   #ifdef SQLITE4_INT64_TYPE
   274    270     typedef SQLITE4_INT64_TYPE sqlite4_int64_t;

Changes to src/sqliteInt.h.

   300    300   #include <stddef.h>
   301    301   
   302    302   /*
   303    303   ** If compiling for a processor that lacks floating point support,
   304    304   ** substitute integer for floating-point
   305    305   */
   306    306   #ifdef SQLITE4_OMIT_FLOATING_POINT
   307         -# define double sqlite_int64
   308         -# define float sqlite_int64
   309         -# define LONGDOUBLE_TYPE sqlite_int64
          307  +# define double sqlite4_int64
          308  +# define float sqlite4_int64
          309  +# define LONGDOUBLE_TYPE sqlite4_int64
   310    310   # ifndef SQLITE4_BIG_DBL
   311    311   #   define SQLITE4_BIG_DBL (((sqlite4_int64)1)<<50)
   312    312   # endif
   313    313   # define SQLITE4_OMIT_DATETIME_FUNCS 1
   314    314   # define SQLITE4_OMIT_TRACE 1
   315    315   # undef SQLITE4_MIXED_ENDIAN_64BIT_FLOAT
   316    316   # undef SQLITE4_HAVE_ISNAN
................................................................................
   591    591   typedef struct Walker Walker;
   592    592   typedef struct WherePlan WherePlan;
   593    593   typedef struct WhereInfo WhereInfo;
   594    594   typedef struct WhereLevel WhereLevel;
   595    595   
   596    596   
   597    597   #include "vdbe.h"
   598         -#include "storage.h"
          598  +#include "kv.h"
   599    599   
   600    600   #include "os.h"
   601    601   #include "mutex.h"
   602    602   
   603    603   
   604    604   /*
   605    605   ** Each database file to be accessed by the system is an instance

Changes to src/vdbe.c.

  4753   4753   ** is set to the value of the rowid for the row just inserted.
  4754   4754   */
  4755   4755   case OP_VUpdate: {
  4756   4756     sqlite4_vtab *pVtab;
  4757   4757     sqlite4_module *pModule;
  4758   4758     int nArg;
  4759   4759     int i;
  4760         -  sqlite_int64 rowid;
         4760  +  sqlite4_int64 rowid;
  4761   4761     Mem **apArg;
  4762   4762     Mem *pX;
  4763   4763   
  4764   4764     assert( pOp->p2==1        || pOp->p5==OE_Fail   || pOp->p5==OE_Rollback 
  4765   4765          || pOp->p5==OE_Abort || pOp->p5==OE_Ignore || pOp->p5==OE_Replace
  4766   4766     );
  4767   4767     pVtab = pOp->p4.pVtab->pVtab;

Changes to tool/mksqlite4c.tcl.

    90     90   # files are seen in a #include statement in the C code, include the complete
    91     91   # text of the file in-line.  The file only needs to be included once.
    92     92   #
    93     93   foreach hdr {
    94     94      hash.h
    95     95      hwtime.h
    96     96      keywordhash.h
           97  +   kv.h
    97     98      lsm.h
    98     99      lsmInt.h
    99    100      mutex.h
   100    101      opcodes.h
   101    102      os.h
   102    103      parse.h
   103    104      sqlite4.h
   104    105      sqliteInt.h
   105    106      sqliteLimit.h
   106         -   storage.h
   107    107      vdbe.h
   108    108      vdbeInt.h
   109    109   } {
   110    110     set available_hdr($hdr) 1
   111    111   }
   112    112   set available_hdr(sqliteInt.h) 0
   113    113