Enumerating subcollection now silently ignores elements that do not exist anymore, instead of raising an error.
[GB.DB] * NEW: Enumerating subcollection now silently ignores elements that do not exist anymore, instead of raising an error.
This commit is contained in:
parent
bf99c100c8
commit
a22fb26f0f
main/lib/db
@ -393,7 +393,10 @@ BEGIN_METHOD_VOID(Connection_Commit)
|
||||
CHECK_OPEN();
|
||||
|
||||
if (THIS->trans == 0)
|
||||
{
|
||||
//GB.Error("Not in a transaction");
|
||||
return;
|
||||
}
|
||||
|
||||
THIS->trans--;
|
||||
if (!THIS->db.flags.no_nest || THIS->trans == 0)
|
||||
@ -408,7 +411,10 @@ BEGIN_METHOD_VOID(Connection_Rollback)
|
||||
CHECK_OPEN();
|
||||
|
||||
if (THIS->trans == 0)
|
||||
{
|
||||
//GB.Error("Not in a transaction");
|
||||
return;
|
||||
}
|
||||
|
||||
THIS->trans--;
|
||||
if (!THIS->db.flags.no_nest || THIS->trans == 0)
|
||||
|
@ -137,25 +137,40 @@ BEGIN_METHOD_VOID(CSUBCOLLECTION_next)
|
||||
char *key = NULL;
|
||||
int n;
|
||||
|
||||
if (*pos == 0)
|
||||
{
|
||||
free_string_array(&THIS->list);
|
||||
(*THIS->desc->list)(THIS->container, &THIS->list);
|
||||
}
|
||||
if (*pos == 0)
|
||||
{
|
||||
free_string_array(&THIS->list);
|
||||
(*THIS->desc->list)(THIS->container, &THIS->list);
|
||||
}
|
||||
|
||||
if (THIS->list)
|
||||
{
|
||||
if (*pos < GB.Count(THIS->list))
|
||||
{
|
||||
n = (*pos)++;
|
||||
key = THIS->list[n];
|
||||
}
|
||||
}
|
||||
for(;;)
|
||||
{
|
||||
if (THIS->list)
|
||||
{
|
||||
if (*pos < GB.Count(THIS->list))
|
||||
{
|
||||
n = (*pos)++;
|
||||
key = THIS->list[n];
|
||||
}
|
||||
}
|
||||
|
||||
if (!key || !*key)
|
||||
GB.StopEnum();
|
||||
else
|
||||
GB.ReturnObject(get_from_key(THIS, key, 0));
|
||||
if (!key || !*key)
|
||||
{
|
||||
GB.StopEnum();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
void *table = get_from_key(THIS, key, 0);
|
||||
GB.Error(NULL);
|
||||
|
||||
if (table)
|
||||
{
|
||||
GB.ReturnObject(table);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user