added like operator and handling of string sargs

Added index stuff to HACKING file
Misc. mdb-sql updates
This commit is contained in:
brianb
2001-04-20 21:06:46 +00:00
parent 3d4dde05d2
commit 606887dfbd
22 changed files with 1004 additions and 151 deletions

38
src/libmdb/like.c Normal file
View File

@@ -0,0 +1,38 @@
#include <stdio.h>
int likecmp(char *s, char *r)
{
int i, ret;
switch (r[0]) {
case '\0':
if (s[0]=='\0') {
return 1;
} else {
return 0;
}
case '_':
/* skip one character */
return likecmp(&s[1],&r[1]);
case '%':
/* skip any number of characters */
/* the strlen(s)+1 is important so the next call can */
/* if there are trailing characters */
for(i=0;i<strlen(s)+1;i++) {
if (likecmp(&s[i],&r[1])) {
return 1;
}
}
return 0;
default:
for(i=0;i<strlen(r);i++) {
if (r[i]=='_' || r[i]=='%') break;
}
if (strncmp(s,r,i)) {
return 0;
} else {
ret = likecmp(&s[i],&r[i]);
return ret;
}
}
}