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 Apr 18, 2024
1 parent caadfb4 commit ffb9f58
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 42 deletions.
36 changes: 26 additions & 10 deletions Samples/exp_2023-07-08_1.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,28 @@
// Licence: GPLv2.
// Platform: Unix|GNU/Linux
//
#define _CRT_SECURE_NO_WARNINGS 1
#include "svimrdb.h"
// #include "sixmem.h"
#include "sixmem.h"

void PrintMatrix(P_MATRIX pmtx)
{
size_t i, j;
for (i = 0; i < pmtx->ln; ++i)
{
for (j = 0; j < pmtx->col; ++j)
printf("%p ", *(P_CELL *)strGetValueMatrix(NULL, pmtx, i, j, sizeof(P_CELL)));
printf("\n");
}
}

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

TBLHDR tbh;

Expand Down Expand Up @@ -47,13 +59,15 @@ int main()
while (TRUE != siTrylock(ptrans, ptbl, LT_X)) // Write lock.
;

siInsertIntoTable(ptrans, ptbl, 2, "Lisa", L"CS");
siInsertIntoTable(ptrans, ptbl, 2, "Lisa", L"CS");
siInsertIntoTable(ptrans, ptbl, 1, "John", L"LT");
siInsertIntoTable(ptrans, ptbl, 4, "Amy", L"CS");
siInsertIntoTable(ptrans, ptbl, 3, "Jack", L"LT");
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");



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

if (NULL != fp)
{
Expand All @@ -77,9 +91,9 @@ int main()

fclose(fp);
}
*/


siDeleteFromTable(ptrans, ptbl, 0);
siDeleteFromTable(ptrans, ptbl, NULL, 0);

siAddTableColumn(ptrans, ptbl, &tbh);

Expand All @@ -89,6 +103,8 @@ int main()

pv = siCreateViewOfTable(ptbl);

//PrintMatrix(pv);

siPrintView(pv);

strDeleteMatrix(pv);
Expand Down
32 changes: 16 additions & 16 deletions Samples/exp_2023-08-09_1.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ P_TABLE CreateTableStudent(P_TRANS ptrans)

void InsertIntoTableStudent(P_TRANS ptrans, P_TABLE ptbl)
{
siInsertIntoTable(ptrans, ptbl, 2023001, "Lisa", 'F', 20, "CS");
siInsertIntoTable(ptrans, ptbl, 2023002, "John", 'M', 19, "CS");
siInsertIntoTable(ptrans, ptbl, 2023003, "Alice", 'F', 18, "MA");
siInsertIntoTable(ptrans, ptbl, 2023004, "Jack", 'M', 19, "IS");
siInsertIntoTable(ptrans, ptbl, NULL, 2023001, "Lisa", 'F', 20, "CS");
siInsertIntoTable(ptrans, ptbl, NULL, 2023002, "John", 'M', 19, "CS");
siInsertIntoTable(ptrans, ptbl, NULL, 2023003, "Alice", 'F', 18, "MA");
siInsertIntoTable(ptrans, ptbl, NULL, 2023004, "Jack", 'M', 19, "IS");
}

P_TABLE CreateTableCourse(P_TRANS ptrans)
Expand Down Expand Up @@ -89,13 +89,13 @@ P_TABLE CreateTableCourse(P_TRANS ptrans)

void InsertIntoTableCourse(P_TRANS ptrans, P_TABLE ptbl)
{
siInsertIntoTable(ptrans, ptbl, 1, "Database", 5, 4);
siInsertIntoTable(ptrans, ptbl, 2, "Math", 0, 2);
siInsertIntoTable(ptrans, ptbl, 3, "Informatics", 1, 4);
siInsertIntoTable(ptrans, ptbl, 4, "Operating System", 6, 3);
siInsertIntoTable(ptrans, ptbl, 5, "Data Structure", 7, 4);
siInsertIntoTable(ptrans, ptbl, 6, "Data Processing", 0, 2);
siInsertIntoTable(ptrans, ptbl, 7, "PASCAL", 6, 4);
siInsertIntoTable(ptrans, ptbl, NULL, 1, "Database", 5, 4);
siInsertIntoTable(ptrans, ptbl, NULL, 2, "Math", 0, 2);
siInsertIntoTable(ptrans, ptbl, NULL, 3, "Informatics", 1, 4);
siInsertIntoTable(ptrans, ptbl, NULL, 4, "Operating System", 6, 3);
siInsertIntoTable(ptrans, ptbl, NULL, 5, "Data Structure", 7, 4);
siInsertIntoTable(ptrans, ptbl, NULL, 6, "Data Processing", 0, 2);
siInsertIntoTable(ptrans, ptbl, NULL, 7, "PASCAL", 6, 4);
}

P_TABLE CreateTableSC(P_TRANS ptrans)
Expand Down Expand Up @@ -130,15 +130,15 @@ void InsertIntoTableSC(P_TRANS ptrans, P_TABLE ptbl)
{
float f;
f = 92.0f;
siInsertIntoTable(ptrans, ptbl, 2023001, 1, &f);
siInsertIntoTable(ptrans, ptbl, NULL, 2023001, 1, &f);
f = 85.0f;
siInsertIntoTable(ptrans, ptbl, 2023001, 2, &f);
siInsertIntoTable(ptrans, ptbl, NULL, 2023001, 2, &f);
f = 88.0f;
siInsertIntoTable(ptrans, ptbl, 2023001, 3, &f);
siInsertIntoTable(ptrans, ptbl, NULL, 2023001, 3, &f);
f = 90.0f;
siInsertIntoTable(ptrans, ptbl, 2023002, 2, &f);
siInsertIntoTable(ptrans, ptbl, NULL, 2023002, 2, &f);
f = 80.0f;
siInsertIntoTable(ptrans, ptbl, 2023002, 3, &f);
siInsertIntoTable(ptrans, ptbl, NULL, 2023002, 3, &f);
}

int main()
Expand Down
32 changes: 16 additions & 16 deletions Samples/exp_2024-01-30_1.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ P_TABLE CreateTableStudent(P_TRANS ptrans)

void InsertIntoTableStudent(P_TRANS ptrans, P_TABLE ptbl)
{
siInsertIntoTable(ptrans, ptbl, 2023001, "Lisa", 'F', 20, "CS");
siInsertIntoTable(ptrans, ptbl, 2023002, "John", 'M', 19, "CS");
siInsertIntoTable(ptrans, ptbl, 2023003, "Alice", 'F', 18, "MA");
siInsertIntoTable(ptrans, ptbl, 2023004, "Jack", 'M', 19, "IS");
siInsertIntoTable(ptrans, ptbl, NULL, 2023001, "Lisa", 'F', 20, "CS");
siInsertIntoTable(ptrans, ptbl, NULL, 2023002, "John", 'M', 19, "CS");
siInsertIntoTable(ptrans, ptbl, NULL, 2023003, "Alice", 'F', 18, "MA");
siInsertIntoTable(ptrans, ptbl, NULL, 2023004, "Jack", 'M', 19, "IS");
}

P_TABLE CreateTableCourse(P_TRANS ptrans)
Expand Down Expand Up @@ -90,13 +90,13 @@ P_TABLE CreateTableCourse(P_TRANS ptrans)

void InsertIntoTableCourse(P_TRANS ptrans, P_TABLE ptbl)
{
siInsertIntoTable(ptrans, ptbl, 1, "Database", 5, 4);
siInsertIntoTable(ptrans, ptbl, 2, "Math", 0, 2);
siInsertIntoTable(ptrans, ptbl, 3, "Informatics", 1, 4);
siInsertIntoTable(ptrans, ptbl, 4, "Operating System", 6, 3);
siInsertIntoTable(ptrans, ptbl, 5, "Data Structure", 7, 4);
siInsertIntoTable(ptrans, ptbl, 6, "Data Processing", 0, 2);
siInsertIntoTable(ptrans, ptbl, 7, "PASCAL", 6, 4);
siInsertIntoTable(ptrans, ptbl, NULL, 1, "Database", 5, 4);
siInsertIntoTable(ptrans, ptbl, NULL, 2, "Math", 0, 2);
siInsertIntoTable(ptrans, ptbl, NULL, 3, "Informatics", 1, 4);
siInsertIntoTable(ptrans, ptbl, NULL, 4, "Operating System", 6, 3);
siInsertIntoTable(ptrans, ptbl, NULL, 5, "Data Structure", 7, 4);
siInsertIntoTable(ptrans, ptbl, NULL, 6, "Data Processing", 0, 2);
siInsertIntoTable(ptrans, ptbl, NULL, 7, "PASCAL", 6, 4);
}

P_TABLE CreateTableSC(P_TRANS ptrans)
Expand Down Expand Up @@ -131,15 +131,15 @@ void InsertIntoTableSC(P_TRANS ptrans, P_TABLE ptbl)
{
float f;
f = 92.0f;
siInsertIntoTable(ptrans, ptbl, 2023001, 1, &f);
siInsertIntoTable(ptrans, ptbl, NULL, 2023001, 1, &f);
f = 85.0f;
siInsertIntoTable(ptrans, ptbl, 2023001, 2, &f);
siInsertIntoTable(ptrans, ptbl, NULL, 2023001, 2, &f);
f = 88.0f;
siInsertIntoTable(ptrans, ptbl, 2023001, 3, &f);
siInsertIntoTable(ptrans, ptbl, NULL, 2023001, 3, &f);
f = 90.0f;
siInsertIntoTable(ptrans, ptbl, 2023002, 2, &f);
siInsertIntoTable(ptrans, ptbl, NULL, 2023002, 2, &f);
f = 80.0f;
siInsertIntoTable(ptrans, ptbl, 2023002, 3, &f);
siInsertIntoTable(ptrans, ptbl, NULL, 2023002, 3, &f);
}

P_TABLE ptbl_student, ptbl_course, ptbl_sc;
Expand Down

0 comments on commit ffb9f58

Please sign in to comment.