1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-10 01:02:56 +03:00

Add definitions of the CollSeq and KeyInfo structures. (CVS 1399)

FossilOrigin-Name: cd1be81569aa6d5a365eb27b7d067a153079ce45
This commit is contained in:
drh
2004-05-18 23:21:35 +00:00
parent 428702d730
commit a9fd84b034
5 changed files with 49 additions and 56 deletions

View File

@@ -1,5 +1,5 @@
C Remove\sdead\scode\sfrom\svdbeaux.c.\s\sAdd\scomments\sdescribing\sdesired\schanges\nto\sOP_Sort\sprocessing\sin\sselect.c\s(CVS\s1398) C Add\sdefinitions\sof\sthe\sCollSeq\sand\sKeyInfo\sstructures.\s(CVS\s1399)
D 2004-05-18T22:38:32 D 2004-05-18T23:21:36
F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906 F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@@ -49,7 +49,7 @@ F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3
F src/select.c 2981cafe3b21ca06c97ddec8c7181f209a06ee82 F src/select.c 2981cafe3b21ca06c97ddec8c7181f209a06ee82
F src/shell.c 0c4662e13bfbfd3d13b066c5859cc97ad2f95d21 F src/shell.c 0c4662e13bfbfd3d13b066c5859cc97ad2f95d21
F src/sqlite.h.in 799c5e726296ec7bc20e6407cdf4df0e0bc00c0c F src/sqlite.h.in 799c5e726296ec7bc20e6407cdf4df0e0bc00c0c
F src/sqliteInt.h 9e35491dc2fb88f792744d2e6c1cd172e0c28829 F src/sqliteInt.h 1da4a9c26da43f235c45c1de0c49fadf6c40d0e6
F src/table.c af14284fa36c8d41f6829e3f2819dce07d3e2de2 F src/table.c af14284fa36c8d41f6829e3f2819dce07d3e2de2
F src/tclsqlite.c fbf0fac73624ae246551a6c671f1de0235b5faa1 F src/tclsqlite.c fbf0fac73624ae246551a6c671f1de0235b5faa1
F src/test1.c 12ef76b8aaba4408422f21f269256b630d4dd627 F src/test1.c 12ef76b8aaba4408422f21f269256b630d4dd627
@@ -64,9 +64,9 @@ F src/utf.c fc799748d43fe1982d157b871e3e420a19c85d4f
F src/util.c 6d4339b7f05ccdacaebcce67e7fb8c5b880620e8 F src/util.c 6d4339b7f05ccdacaebcce67e7fb8c5b880620e8
F src/vacuum.c c134702e023db8778e6be59ac0ea7b02315b5476 F src/vacuum.c c134702e023db8778e6be59ac0ea7b02315b5476
F src/vdbe.c 37c3d0c45fd6bd7096ae50d08e864acf41924b34 F src/vdbe.c 37c3d0c45fd6bd7096ae50d08e864acf41924b34
F src/vdbe.h 1d0d0b5741c7f46ab372a95a4305fed0ae09d466 F src/vdbe.h 314e9c07db73a42a6ba91ab7539e27652fc88870
F src/vdbeInt.h 5bac5f0f468205f6e43a4ba86a807abff4953abb F src/vdbeInt.h 5bac5f0f468205f6e43a4ba86a807abff4953abb
F src/vdbeaux.c 1d447c912c6cde3629c99073eacb4604b201ab16 F src/vdbeaux.c 95f5a9ff770794f5165d5827d2343eb2d83d7a6d
F src/where.c 5f480219a943b0fed1f6922d2fdbfba8616a9148 F src/where.c 5f480219a943b0fed1f6922d2fdbfba8616a9148
F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242 F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242
F test/attach.test cb9b884344e6cfa5e165965d5b1adea679a24c83 F test/attach.test cb9b884344e6cfa5e165965d5b1adea679a24c83
@@ -193,7 +193,7 @@ F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604
F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1 F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4 F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
P 238442bbd267faee3eb70048bd9419af99c02931 P ae37e8a0bff39fd1568eae83f8761c34cd0184fc
R 14afd092ade15d8c91f5ce918c3cd94a R 3c5b4370c9c3ea00ed8ad90f1394d1c1
U drh U drh
Z aa7deeaa1cefc9fd6080f4f67691aaa6 Z b84fedd6f94a949476c1655f09bd2d6c

View File

@@ -1 +1 @@
ae37e8a0bff39fd1568eae83f8761c34cd0184fc cd1be81569aa6d5a365eb27b7d067a153079ce45

View File

@@ -11,7 +11,7 @@
************************************************************************* *************************************************************************
** Internal interface definitions for SQLite. ** 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 "config.h"
#include "sqlite.h" #include "sqlite.h"
@@ -259,6 +259,7 @@ typedef struct FKey FKey;
typedef struct Db Db; typedef struct Db Db;
typedef struct AuthContext AuthContext; typedef struct AuthContext AuthContext;
typedef struct KeyClass KeyClass; typedef struct KeyClass KeyClass;
typedef struct CollSeq CollSeq;
/* /*
** Each database file to be accessed by the system is an instance ** Each database file to be accessed by the system is an instance
@@ -369,6 +370,8 @@ struct sqlite {
void *pCommitArg; /* Argument to xCommitCallback() */ void *pCommitArg; /* Argument to xCommitCallback() */
int (*xCommitCallback)(void*);/* Invoked at every commit. */ int (*xCommitCallback)(void*);/* Invoked at every commit. */
Hash aFunc; /* All functions that can be in SQL exprs */ 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 lastRowid; /* ROWID of most recent insert (see above) */
i64 priorNewRowid; /* Last randomly generated ROWID */ i64 priorNewRowid; /* Last randomly generated ROWID */
int magic; /* Magic number for detect library misuse */ int magic; /* Magic number for detect library misuse */
@@ -455,13 +458,30 @@ struct Column {
char *zName; /* Name of this column */ char *zName; /* Name of this column */
char *zDflt; /* Default value of this column */ char *zDflt; /* Default value of this column */
char *zType; /* Data type for 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 notNull; /* True if there is a NOT NULL constraint */
u8 isPrimKey; /* True if this column is part of the PRIMARY KEY */ 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 */ char affinity; /* One of the SQLITE_AFF_... values */
u8 dottedName; /* True if zName contains a "." character */ 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. ** The allowed sort orders.
** **
@@ -705,6 +725,7 @@ struct Token {
struct Expr { struct Expr {
u8 op; /* Operation performed by this node */ u8 op; /* Operation performed by this node */
u8 dataType; /* Either SQLITE_SO_TEXT or SQLITE_SO_NUM */ 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 iDb; /* Database referenced by this expression */
u8 flags; /* Various flags. See below */ u8 flags; /* Various flags. See below */
Expr *pLeft, *pRight; /* Left and right subnodes */ Expr *pLeft, *pRight; /* Left and right subnodes */
@@ -718,7 +739,6 @@ struct Expr {
** result from the iAgg-th element of the aggregator */ ** result from the iAgg-th element of the aggregator */
Select *pSelect; /* When the expression is a sub-select. Also the Select *pSelect; /* When the expression is a sub-select. Also the
** right side of "<expr> IN (<select>)" */ ** right side of "<expr> IN (<select>)" */
char affinity; /* The affinity of the column or 0 if not a column */
}; };
/* /*

View File

@@ -15,7 +15,7 @@
** or VDBE. The VDBE implements an abstract machine that runs a ** or VDBE. The VDBE implements an abstract machine that runs a
** simple program to access and modify the underlying database. ** 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_ #ifndef _SQLITE_VDBE_H_
#define _SQLITE_VDBE_H_ #define _SQLITE_VDBE_H_
@@ -80,6 +80,22 @@ typedef struct VdbeOpList VdbeOpList;
*/ */
#include "opcodes.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 ** Prototypes for the VDBE interface. See comments on the implementation
** for a description of what each of these routines does. ** for a description of what each of these routines does.

View File

@@ -1044,49 +1044,6 @@ int sqlite3VdbeCursorMoveto(Cursor *p){
return SQLITE_OK; 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: ** The following functions:
** **