Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int TPump::AddComponent(int code, AnsiString name)
- {
- int ResultId;
- entry:
- // Sprawdzenie, czy komponent jest wpisany
- CheckComponentQuery->Params->ParamByName("kod")->AsString = AnsiString("SK") + code;
- CheckComponentQuery->Open();
- if (CheckComponentQuery->RecordCount > 0)
- {
- ResultId = CheckComponentQuery->FieldByName("")->AsInteger;
- goto finally;
- }
- // Ewentualne dopisanie nowego
- AddComponentQuery->Params->ParamByName("kod")->AsString = AnsiString("SK") + code;
- AddComponentQuery->Params->ParamByName("nazwa")->AsString = name;
- AddComponentQuery->ExecSQL();
- Logger->Add("Dodano nowy komponent", LoggerMsgType::information);
- /* niezgrabne rozwiązanie, pobranie id z bazy bez rekurencyjnego zapychania
- stosu wydaje się bardziej na miejscu */
- goto entry; // ResultId = AddComponent(code, name);
- finally:
- CheckComponentQuery->Close();
- return ResultId;
- }
Add Comment
Please, Sign In to add comment