Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
coshcage authored May 4, 2024
1 parent d806912 commit f5b7b46
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions Samples/exp_2023-07-08_1.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@

int main()
{
int i;
P_MATRIX pv;
P_TRANS ptrans;
P_TABLE ptbl;
P_TABLE ptbl, ptbl2;
P_ARRAY_Z parrhdr, pa = NULL;
FILE * fp;

Expand Down Expand Up @@ -42,19 +43,18 @@ int main()

ptbl = siCreateTable(ptrans, "Student", parrhdr);

while (TRUE != siTrylock(ptrans, ptbl, LT_S)) // Share lock.
;

while (TRUE != siTrylock(ptrans, ptbl, LT_X)) // Write lock.
;

siInsertIntoTable(ptrans, ptbl, NULL, 2, "Lisa", L"CS");
siInsertIntoTable(ptrans, ptbl, NULL, 2, "Lisa", L"CS");
siInsertIntoTable(ptrans, ptbl, NULL, 1, "John", L"LT");
siInsertIntoTable(ptrans, ptbl, NULL, 4, "Amy", L"CS");
siInsertIntoTable(ptrans, ptbl, NULL, 3, "Jack", L"LT");
while (TRUE != siTrylock(ptrans, ptbl, LT_S)) // Share lock.
;


i = 2; siInsertIntoTable(ptrans, ptbl, NULL, &i, "Lisa", L"CS");
i = 2; siInsertIntoTable(ptrans, ptbl, NULL, &i, "Lisa", L"CS");
i = 1; siInsertIntoTable(ptrans, ptbl, NULL, &i, "John", L"LT");
i = 4; siInsertIntoTable(ptrans, ptbl, NULL, &i, "Amy", L"CS");
i = 3; siInsertIntoTable(ptrans, ptbl, NULL, &i, "Jack", L"LT");

fp = fopen("test.db", "wb");

Expand All @@ -68,19 +68,20 @@ int main()

if (NULL != fp)
{
ptbl = siLoadTable(fp, 0);
ptbl2 = siLoadTable(fp, 0);

pv = siCreateViewOfTable(ptbl);
pv = siCreateViewOfTable(ptbl2);

siSortView(pv, 1, TRUE);

siPrintView(pv);

strDeleteMatrix(pv);

siDeleteTable(NULL, ptbl2);

fclose(fp);
}


siDeleteFromTable(ptrans, ptbl, NULL, 0);

Expand Down

0 comments on commit f5b7b46

Please sign in to comment.