1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-11 01:42:22 +03:00

Fix the locking protocol. (CVS 280)

FossilOrigin-Name: 484b82d8a1c84f3d9725a509de93276b9fa9b294
This commit is contained in:
drh
2001-10-09 04:19:46 +00:00
parent f57b339988
commit ad75e9874b
13 changed files with 413 additions and 134 deletions

View File

@@ -15,9 +15,10 @@
** individual tokens and sends those tokens one-by-one over to the
** parser for analysis.
**
** $Id: tokenize.c,v 1.25 2001/10/08 13:22:33 drh Exp $
** $Id: tokenize.c,v 1.26 2001/10/09 04:19:47 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>
#include <stdlib.h>
@@ -113,16 +114,20 @@ static int sqliteKeywordCode(const char *z, int n){
Keyword *p;
if( aKeywordTable[0].len==0 ){
/* Initialize the keyword hash table */
int i;
int n;
n = sizeof(aKeywordTable)/sizeof(aKeywordTable[0]);
for(i=0; i<n; i++){
aKeywordTable[i].len = strlen(aKeywordTable[i].zName);
h = sqliteHashNoCase(aKeywordTable[i].zName, aKeywordTable[i].len);
h %= KEY_HASH_SIZE;
aKeywordTable[i].pNext = apHashTable[h];
apHashTable[h] = &aKeywordTable[i];
sqliteOsEnterMutex();
if( aKeywordTable[0].len==0 ){
int i;
int n;
n = sizeof(aKeywordTable)/sizeof(aKeywordTable[0]);
for(i=0; i<n; i++){
aKeywordTable[i].len = strlen(aKeywordTable[i].zName);
h = sqliteHashNoCase(aKeywordTable[i].zName, aKeywordTable[i].len);
h %= KEY_HASH_SIZE;
aKeywordTable[i].pNext = apHashTable[h];
apHashTable[h] = &aKeywordTable[i];
}
}
sqliteOsLeaveMutex();
}
h = sqliteHashNoCase(z, n) % KEY_HASH_SIZE;
for(p=apHashTable[h]; p; p=p->pNext){