我有一个文本文件,并以c语言存储记录。我插入并选择是好的工作。但删除和更新不起作用:
我的选择代码工作正常:
void SQLselect(const struct TokenList *list, const struct TableStructureInfo *const tableStructure)
{
struct Table table;
if (tableStructure == NULL)
return;
table = SQLloadTable(list, tableStructure);
SQLprintTable(&table);
}
我写删除功能但不起作用:
void SQLdelete(struct TokenList *list, const struct TableStructureInfo *const tableStructure)
{
struct Table filteredTable;
struct Table fullTable;
size_t filteredRowIndex;
size_t fullRowIndex;
struct TokenList *nextNode;
if (tableStructure == NULL)
return;
filteredTable = SQLloadTable(list, tableStructure);
nextNode = list->next;
list->next = NULL;
fullTable = SQLloadTable(list, tableStructure);
list->next = nextNode;
fullRowIndex = 0;
for (filteredRowIndex = 0 ; filteredRowIndex < filteredTable.rowCount ; ++filteredRowIndex)
{
// fullTable.rows[fullRowIndex++] =
}
}
我的链表结构是:
union Value
{
int integer;
float number;
char *string;
Bool boolean;
};
struct Column
{
union Value value;
enum FieldType type;
int position;
};
struct Row
{
int index;
struct Column columns[128];
size_t columnCount;
};
struct Table
{
struct Row *rows;
size_t rowCount;
};