CONDITION DMAN_Close(DMAN_HANDLE ** handle) { PRIVATE_HANDLE ** prv; prv = (PRIVATE_HANDLE **) handle; if (*prv == NULL) return COND_PushCondition(DMAN_ERROR(DMAN_ILLEGALHANDLE), "DMAN_Close"); (void) TBL_Close(&(*prv)->applicationEntityHandle); (void) TBL_Close(&(*prv)->groupNamesHandle); (void) TBL_Close(&(*prv)->storageAccessHandle); (void) TBL_Close(&(*prv)->storageControlHandle); (void) TBL_Close(&(*prv)->securityMatrixHandle); #ifdef FIS (void) TBL_Close(&(*prv)->FISAccessHandle); #endif /*ZT (void) TBL_Close(&(*prv)->printServerCFGHandle); (void) TBL_Close(&(*prv)->VideoImageDestHandle); */ if ((*prv)->storage != NULL) free((*prv)->storage); free(*prv); *handle = NULL; return DMAN_NORMAL; }
main() { CONDITION cond; TBL_HANDLE * handle; /* TBL_CRITERIA criteria[10]; */ long count; void *foo = NULL; static TBL_FIELD fields[] = { {"FNAME", TBL_STRING, 50, 0, 1, (void *) fname}, {"LNAME", TBL_STRING, 50, 0, 1, (void *) lname}, {"AGE", TBL_SIGNED4, 4, 0, 1, &age}, {"ZIP", TBL_SIGNED4, 4, 0, 1, &zip}, {"WEIGHT", TBL_FLOAT4, 4, 0, 1, &weight}, {NULL} }; static TBL_FIELD fields1[] = { {"T_TEXT", TBL_TEXT, 50, 0, 1, (void *) textTest}, {NULL} }; THR_Init(); cond = TBL_Open("TBLTest", "TBL_Persons", &handle); if (cond != TBL_NORMAL) { COND_DumpConditions(); exit(1); } /* criteria[0].FieldName = "LNAME"; criteria[0].Operator = TBL_EQUAL; TBL_LOAD_STRING(&criteria[0].Value, "JONES"); criteria[1].FieldName = 0; */ cond = TBL_Select(&handle, NULL, fields, &count, callback, (void *) foo); if (cond != TBL_NORMAL) { COND_DumpConditions(); THR_Shutdown(); exit(2); } printf("ALL DONE--Count: %d\n", count); (void) TBL_Close(&handle); #ifdef _MSC_VER cond = TBL_Open("TBLTest", "TBL_DataTypes", &handle); if (cond != TBL_NORMAL) { COND_DumpConditions(); THR_Shutdown(); exit(1); } count = 0; cond = TBL_Select(&handle, NULL, fields1, &count, callback, (void *) foo); if (cond != TBL_NORMAL) { COND_DumpConditions(); THR_Shutdown(); exit(3); } printf("ALL DONE--Count: %d\n", count); #endif THR_Shutdown(); exit(0); }
main() { CONDITION cond; TBL_HANDLE * handle; TBL_CRITERIA criteria[10]; int age; static TBL_UPDATE fields[] = { {"LNAME", TBL_SET, TBL_STRING, 50, 0, 1, (void *) "WOODROW"}, {NULL} }; #ifdef _MSC_VER static TBL_UPDATE fields1[] = { {"T_TEXT", TBL_SET, TBL_STRING, 50, 0, 1, (void *) "Updated Text Data"}, {NULL} }; #endif THR_Init(); cond = TBL_Open("TBLTest", "TBL_Persons", &handle); if (cond != TBL_NORMAL) { COND_DumpConditions(); THR_Shutdown(); exit(1); } criteria[0].FieldName = "AGE"; criteria[0].Operator = TBL_EQUAL; criteria[0].Value.Type = TBL_SIGNED4; age = 50; criteria[0].Value.Value.Signed4 = &age; criteria[0].Value.IsNull = 0; criteria[0].Value.AllocatedSize = 4; criteria[1].FieldName = 0; cond = TBL_Update(&handle, criteria, fields); if (cond != TBL_NORMAL) { COND_DumpConditions(); THR_Shutdown(); exit(2); } (void) TBL_Close(&handle); #ifdef _MSC_VER cond = TBL_Open("TBLTest", "TBL_DataTypes", &handle); if (cond != TBL_NORMAL) { COND_DumpConditions(); THR_Shutdown(); exit(1); } cond = TBL_Update(&handle, NULL, fields1); if (cond != TBL_NORMAL) { COND_DumpConditions(); THR_Shutdown(); exit(3); } (void) TBL_Close(&handle); #endif printf("\n\nUpdate operation succeeded\n\n"); THR_Shutdown(); exit(0); }