updateFunc
parent
442264f6a0
commit
2ba8bd9d57
|
@ -28,11 +28,13 @@ int main()
|
|||
|
||||
printf("uniq:%d \n", deleteNonUniqElements());
|
||||
|
||||
char selects[7] = { 1, 5, 3, -1, -1, -1, -1 };
|
||||
char selects[7] = { 0, 5, 3, -1, -1, -1, -1 };
|
||||
|
||||
Condition a = { moreEqual, 2, 0, NULL, 0, NULL };
|
||||
Condition* conditions[7] = {NULL, NULL, NULL, &a, NULL, NULL, NULL};
|
||||
printf("\nselect:%d \n", selectFunc(selects, conditions));
|
||||
printf("\nupdate:%d \n", updateFunc("TeStNaMe", NULL, -1, -1, NULL, NULL, NULL, conditions));
|
||||
printf("\nselect:%d \n", selectFunc(selects, conditions));
|
||||
|
||||
//printDataBase();
|
||||
|
||||
|
|
|
@ -485,3 +485,33 @@ int selectFunc(char whatToPrint[7], Condition* conditions[7])
|
|||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
int updateFunc(char* lastName, char* firstName, int course, int labID, time_t* startTime, time_t* endTime, int results[99],Condition* conditions[7])
|
||||
{
|
||||
int count = 0;
|
||||
DataBaseElement* tmp;
|
||||
tmp = head;
|
||||
while (tmp != NULL)
|
||||
{
|
||||
if (isElementRespondConditions(tmp, conditions))
|
||||
{
|
||||
if (lastName != NULL)
|
||||
tmp->last_nm = lastName;
|
||||
if (firstName != NULL)
|
||||
tmp->first_nm = firstName;
|
||||
if (course != -1)
|
||||
tmp->curse_id = course;
|
||||
if (labID != -1)
|
||||
tmp->lab_id = labID;
|
||||
if (startTime != NULL)
|
||||
tmp->start_tm = startTime;
|
||||
if (endTime != NULL)
|
||||
tmp->end_tm = endTime;
|
||||
if (results != NULL)
|
||||
tmp->result = results;
|
||||
count++;
|
||||
}
|
||||
tmp = tmp->nextElement;
|
||||
}
|
||||
return count;
|
||||
}
|
Loading…
Reference in New Issue