Correzioni ulteriori a DB_rewrite e DB_seek
git-svn-id: svn://10.65.10.50/trunk@1554 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
6feacefc3e
commit
ae730cd65f
@ -315,15 +315,21 @@ int DB_unlock(int handle)
|
||||
--------------------------------------------------------------------------*/
|
||||
int DB_seek(int handle,char *key)
|
||||
{
|
||||
int rc;
|
||||
TAG4 * tt;
|
||||
int rc, len;
|
||||
TAG4 * tt;
|
||||
char * k;
|
||||
|
||||
if(dbdata[handle]==0) return(-1);
|
||||
rc = x4seek(&xdb[handle],key);
|
||||
if (rc)
|
||||
return rc;
|
||||
tt = d4tag_selected(dbdata[handle]);
|
||||
rc = strncmp(key, t4key(tt), expr4key_len(tt->expr));
|
||||
tt = d4tag_selected(dbdata[handle]);
|
||||
len = expr4key_len(tt->expr);
|
||||
k = strdup(t4key(tt));
|
||||
while (--len >= 0 && k[len] == ' ')
|
||||
k[len] = '\0';
|
||||
rc = strcmp(key, k);
|
||||
free(k);
|
||||
if (rc == 0)
|
||||
return 0;
|
||||
else
|
||||
@ -417,8 +423,8 @@ int DB_rewrite(int handle)
|
||||
int rt;
|
||||
if(dbdata[handle]==0) return(-1);
|
||||
rt=d4write(dbdata[handle],d4recno(dbdata[handle]));
|
||||
if (rt!=r4success)
|
||||
rt=DB_unlock(handle);
|
||||
if (rt==r4success)
|
||||
DB_unlock(handle);
|
||||
return (rt);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user