-C Remove\sdead\scode\sfrom\svdbeaux.c.\s\sAdd\scomments\sdescribing\sdesired\schanges\nto\sOP_Sort\sprocessing\sin\sselect.c\s(CVS\s1398)
-D 2004-05-18T22:38:32
+C Add\sdefinitions\sof\sthe\sCollSeq\sand\sKeyInfo\sstructures.\s(CVS\s1399)
+D 2004-05-18T23:21:36
F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
F src/select.c 2981cafe3b21ca06c97ddec8c7181f209a06ee82
F src/shell.c 0c4662e13bfbfd3d13b066c5859cc97ad2f95d21
F src/sqlite.h.in 799c5e726296ec7bc20e6407cdf4df0e0bc00c0c
-F src/sqliteInt.h 9e35491dc2fb88f792744d2e6c1cd172e0c28829
+F src/sqliteInt.h 1da4a9c26da43f235c45c1de0c49fadf6c40d0e6
F src/table.c af14284fa36c8d41f6829e3f2819dce07d3e2de2
F src/tclsqlite.c fbf0fac73624ae246551a6c671f1de0235b5faa1
F src/test1.c 12ef76b8aaba4408422f21f269256b630d4dd627
F src/util.c 6d4339b7f05ccdacaebcce67e7fb8c5b880620e8
F src/vacuum.c c134702e023db8778e6be59ac0ea7b02315b5476
F src/vdbe.c 37c3d0c45fd6bd7096ae50d08e864acf41924b34
-F src/vdbe.h 1d0d0b5741c7f46ab372a95a4305fed0ae09d466
+F src/vdbe.h 314e9c07db73a42a6ba91ab7539e27652fc88870
F src/vdbeInt.h 5bac5f0f468205f6e43a4ba86a807abff4953abb
-F src/vdbeaux.c 1d447c912c6cde3629c99073eacb4604b201ab16
+F src/vdbeaux.c 95f5a9ff770794f5165d5827d2343eb2d83d7a6d
F src/where.c 5f480219a943b0fed1f6922d2fdbfba8616a9148
F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242
F test/attach.test cb9b884344e6cfa5e165965d5b1adea679a24c83
F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
-P 238442bbd267faee3eb70048bd9419af99c02931
-R 14afd092ade15d8c91f5ce918c3cd94a
+P ae37e8a0bff39fd1568eae83f8761c34cd0184fc
+R 3c5b4370c9c3ea00ed8ad90f1394d1c1
U drh
-Z aa7deeaa1cefc9fd6080f4f67691aaa6
+Z b84fedd6f94a949476c1655f09bd2d6c
-ae37e8a0bff39fd1568eae83f8761c34cd0184fc
\ No newline at end of file
+cd1be81569aa6d5a365eb27b7d067a153079ce45
\ No newline at end of file
*************************************************************************
** Internal interface definitions for SQLite.
**
-** @(#) $Id: sqliteInt.h,v 1.236 2004/05/18 10:06:26 danielk1977 Exp $
+** @(#) $Id: sqliteInt.h,v 1.237 2004/05/18 23:21:36 drh Exp $
*/
#include "config.h"
#include "sqlite.h"
typedef struct Db Db;
typedef struct AuthContext AuthContext;
typedef struct KeyClass KeyClass;
+typedef struct CollSeq CollSeq;
/*
** Each database file to be accessed by the system is an instance
void *pCommitArg; /* Argument to xCommitCallback() */
int (*xCommitCallback)(void*);/* Invoked at every commit. */
Hash aFunc; /* All functions that can be in SQL exprs */
+ Hash aCollSeq; /* All collating sequences */
+ CollSeq *pDfltColl; /* The default collating sequence (memcmp) */
i64 lastRowid; /* ROWID of most recent insert (see above) */
i64 priorNewRowid; /* Last randomly generated ROWID */
int magic; /* Magic number for detect library misuse */
char *zName; /* Name of this column */
char *zDflt; /* Default value of this column */
char *zType; /* Data type for this column */
+ CollSeq *pColl; /* Collating sequence. If NULL, use the default */
u8 notNull; /* True if there is a NOT NULL constraint */
u8 isPrimKey; /* True if this column is part of the PRIMARY KEY */
-// u8 sortOrder; /* Some combination of SQLITE_SO_... values */
char affinity; /* One of the SQLITE_AFF_... values */
u8 dottedName; /* True if zName contains a "." character */
};
+/*
+** A "Collating Sequence" is defined by an instance of the following
+** structure. Every collating sequence has a name and a comparison
+** function that defines the order of text for that sequence. The
+** CollSeq.pUser parameter is an extra parameter that passed in as
+** the first argument to the comparison function.
+**
+** If CollSeq.xCmp is NULL, it means that the collating sequence is
+** undefined. Indices built on an undefined collating sequence may
+** not be read or written.
+*/
+struct CollSeq {
+ char *zName; /* Name of the collating sequence */
+ void *pUser; /* First argument to xCmp() */
+ int (*xCmp)(void*,int,const void*,int,const void*); /* Comparison function */
+};
+
/*
** The allowed sort orders.
**
struct Expr {
u8 op; /* Operation performed by this node */
u8 dataType; /* Either SQLITE_SO_TEXT or SQLITE_SO_NUM */
+ char affinity; /* The affinity of the column or 0 if not a column */
u8 iDb; /* Database referenced by this expression */
u8 flags; /* Various flags. See below */
Expr *pLeft, *pRight; /* Left and right subnodes */
** result from the iAgg-th element of the aggregator */
Select *pSelect; /* When the expression is a sub-select. Also the
** right side of "<expr> IN (<select>)" */
- char affinity; /* The affinity of the column or 0 if not a column */
};
/*
** or VDBE. The VDBE implements an abstract machine that runs a
** simple program to access and modify the underlying database.
**
-** $Id: vdbe.h,v 1.76 2004/05/18 10:06:26 danielk1977 Exp $
+** $Id: vdbe.h,v 1.77 2004/05/18 23:21:36 drh Exp $
*/
#ifndef _SQLITE_VDBE_H_
#define _SQLITE_VDBE_H_
*/
#include "opcodes.h"
+/*
+** An instance of the following structure is passed as the first
+** argument to sqlite3VdbeKeyCompare and is used to control the
+** comparison of the two keys.
+**
+** If the KeyInfo.incrKey value is true and the comparison would
+** otherwise be equal, then return a result as if the second key larger.
+*/
+typedef struct KeyInfo KeyInfo;
+struct KeyInfo {
+ u8 incrKey; /* Increase value of 2nd key by epsilon */
+ u8 reverseOrder; /* If true, reverse the comparison order */
+ int nField; /* Number of entries in aColl[] */
+ struct CollSeq *aColl[1]; /* Collating sequence for each term of the key */
+};
+
/*
** Prototypes for the VDBE interface. See comments on the implementation
** for a description of what each of these routines does.
return SQLITE_OK;
}
-#if 0
-/*
-** FIX ME
-**
-** This function is included temporarily so that regression tests have
-** a chance of passing. It always uses memcmp().
-*/
-int sqlite2BtreeKeyCompare(
- BtCursor *pCur, /* Pointer to entry to compare against */
- const void *pKey, /* Key to compare against entry that pCur points to */
- int nKey, /* Number of bytes in pKey */
- int nIgnore, /* Ignore this many bytes at the end of pCur */
- int *pResult /* Write the result here */
-){
- const void *pCellKey;
- void *pMallocedKey;
- u64 nCellKey;
- int rc;
-
- sqlite3BtreeKeySize(pCur, &nCellKey);
- nCellKey = nCellKey - nIgnore;
- if( nCellKey<=0 ){
- *pResult = 0;
- return SQLITE_OK;
- }
-
- pCellKey = sqlite3BtreeKeyFetch(pCur, nCellKey);
- if( pCellKey ){
- *pResult = memcmp(pCellKey, pKey, nKey>nCellKey?nCellKey:nKey);
- return SQLITE_OK;
- }
-
- pMallocedKey = sqliteMalloc( nCellKey );
- if( pMallocedKey==0 ) return SQLITE_NOMEM;
-
- rc = sqlite3BtreeKey(pCur, 0, nCellKey, pMallocedKey);
- *pResult = memcmp(pMallocedKey, pKey, nKey>nCellKey?nCellKey:nKey);
- sqliteFree(pMallocedKey);
-
- return rc;
-}
-#endif
-
/*
** The following functions:
**