Advise what to do if I made a request to the database, but did not receive the value, provided that it is there exactly, I do not know what malfunctions happen when working with the database, does it make sense to do a second call, through repeat for example 5 times, and if there is no answer anyway then shutting down with an error? That's how I make requests
class function RGetInfo.GetLoginUser(LoginUser: TLoginUser): Boolean; var FDConnection: TFDConnection; FDQuery: TFDQuery; begin FDConnection := TFDConnection.Create(nil); try with FDConnection do begin Params.Add('Database=mybd'); Params.Add('DriverID=MySQL'); Params.Add('Password=123456'); Params.Add('Server=localhost'); Params.Add('User_Name=root'); Params.Add('CharacterSet=utf8'); Params.Add('ReadTimeout=100'); Connected := True; end; FDQuery := TFDQuery.Create(nil); try FDQuery.Connection := FDConnection; try FDQuery.SQL.Clear; FDQuery.SQL.Add('SELECT * FROM `uplayers` WHERE `name` = "' + LoginUser.Name + '" LIMIT 1'); FDQuery.Open; LoginUser.pType := FDQuery.FieldByName('type').AsString; LoginUser.Pass := FDQuery.FieldByName('pass').AsString; LoginUser.PassType := FDQuery.FieldByName('passtype').AsString; LoginUser.Active := FDQuery.FieldByName('active').AsBoolean; LoginUser.Oper.Name := FDQuery.FieldByName('oper').AsString; LoginUser.Admin.Name := FDQuery.FieldByName('admin').AsString; LoginUser.SuperAdmin.Name := FDQuery.FieldByName('superadmin').AsString; FDQuery.Close; finally Result := True; end; finally FDQuery.Free; end; finally FDConnection.Free; end; end;
for(i=1,i<5,i++) {x=2?x:2;}- Akina