Implementato unlock sulla DB_rewrite, e controllo chiave sulla DB_seek.
git-svn-id: svn://10.65.10.50/trunk@1553 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
4e71de7064
commit
6feacefc3e
@ -314,9 +314,23 @@ int DB_unlock(int handle)
|
||||
successivo, se torna r4eof e' su eof
|
||||
--------------------------------------------------------------------------*/
|
||||
int DB_seek(int handle,char *key)
|
||||
{
|
||||
{
|
||||
int rc;
|
||||
TAG4 * tt;
|
||||
|
||||
if(dbdata[handle]==0) return(-1);
|
||||
return(x4seek(&xdb[handle],key));
|
||||
rc = x4seek(&xdb[handle],key);
|
||||
if (rc)
|
||||
return rc;
|
||||
tt = d4tag_selected(dbdata[handle]);
|
||||
rc = strncmp(key, t4key(tt), expr4key_len(tt->expr));
|
||||
if (rc == 0)
|
||||
return 0;
|
||||
else
|
||||
if (rc < 0)
|
||||
return r4after;
|
||||
else
|
||||
return r4eof;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@ -400,8 +414,12 @@ int DB_delkey(int handle, char* key, long recno)
|
||||
--------------------------------------------------------------------------*/
|
||||
int DB_rewrite(int handle)
|
||||
{
|
||||
int rt;
|
||||
if(dbdata[handle]==0) return(-1);
|
||||
return(d4write(dbdata[handle],d4recno(dbdata[handle])));
|
||||
rt=d4write(dbdata[handle],d4recno(dbdata[handle]));
|
||||
if (rt!=r4success)
|
||||
rt=DB_unlock(handle);
|
||||
return (rt);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user