pool_temp_tables_find(char * tablename)
{
ListCell *cell;
- ListCell *next;
if (!session_context)
ereport(ERROR,
(errmsg("pool_temp_tables_find: session context is not initialized")));
- for (cell = list_head(session_context->temp_tables); cell; cell = next)
+ foreach(cell, session_context->temp_tables)
{
POOL_TEMP_TABLE * table = (POOL_TEMP_TABLE *)lfirst(cell);
if (strcmp(tablename, table->tablename) == 0)
return table;
-
- next = lnext(cell);
}
return NULL;
}
pool_temp_tables_commit_pending(void)
{
ListCell *cell;
- ListCell *next;
MemoryContext old_context;
if (!session_context)
old_context = MemoryContextSwitchTo(session_context->memory_context);
- for (cell = list_head(session_context->temp_tables); cell; cell = next)
+ foreach(cell, session_context->temp_tables)
{
POOL_TEMP_TABLE * table = (POOL_TEMP_TABLE *)lfirst(cell);
(errmsg("pool_temp_tables_commit_pending: remove: %s", table->tablename)));
session_context->temp_tables = list_delete_ptr(session_context->temp_tables, table);
}
- next = lnext(cell);
}
MemoryContextSwitchTo(old_context);
pool_temp_tables_remove_pending(void)
{
ListCell *cell;
- ListCell *next;
MemoryContext old_context;
if (!session_context)
old_context = MemoryContextSwitchTo(session_context->memory_context);
- for (cell = list_head(session_context->temp_tables); cell; cell = next)
+ foreach(cell, session_context->temp_tables)
{
POOL_TEMP_TABLE * table = (POOL_TEMP_TABLE *)lfirst(cell);
session_context->temp_tables = list_delete_ptr(session_context->temp_tables, table);
}
- next = lnext(cell);
}
MemoryContextSwitchTo(old_context);