Jump to content

Search the Community

Showing results for tags 'omnithreadlibrary'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Delphi Questions and Answers
    • Algorithms, Data Structures and Class Design
    • VCL
    • FMX
    • RTL and Delphi Object Pascal
    • Databases
    • Network, Cloud and Web
    • Windows API
    • Cross-platform
    • Delphi IDE and APIs
    • General Help
    • Delphi Third-Party
  • C++Builder Questions and Answers
    • General Help
  • General Discussions
    • Embarcadero Lounge
    • Tips / Blogs / Tutorials / Videos
    • Job Opportunities / Coder for Hire
    • I made this
  • Software Development
    • Project Planning and -Management
    • Software Testing and Quality Assurance
  • Community
    • Community Management

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Delphi-Version

Found 1 result

  1. OmahaMax

    OmniThread with Database

    The following code works perfectly with one task but fails to process one input variable with two tasks, two input variables with three tasks, etc. pipeline := Parallel .Pipeline .Stage( procedure(const input, output: IOmniBlockingCollection) var NewAmt, OldAmt: Currency; aDataObj: TDataObj; aValue: TOmniValue; aDm: TdmRetriever; begin aDm := TdmRetriever.Create(nil); aDm.SetUp(DataPath); aDataObj := TDataObj.Create('', 0, 0); try for aValue in input do // input is a stringlist of AcctNum begin s := aValue.AsString; MySL.Add(s); aDm.qRetrieverNew.SQL.Text := 'SELECT SUM(Amount) AS CurrYrAmt FROM TransBS' + #13 + 'WHERE (dDate <= ' + QuotedStr(ThruDateStr) + ') AND (AcctNum = ' + QuotedStr(s) + ')'; aDm.qRetrieverOld.SQL.Text := 'SELECT SUM(Amount) AS PrevYrAmt FROM TransBS' + #13 + 'WHERE (dDate <= ' + QuotedStr(PrevThruDateStr) + ') AND (AcctNum = ' + QuotedStr(s) + ')'; aDm.qRetrieverNew.Open; aDm.qRetrieverOld.Open; // Everything continues fine with one task; execution continues with first AcctNum // The first AcctNum is not processed below with two tasks // The first and second AcctNum are not processed below with three tasks if not VarIsNull(aDm.qRetrieverNew.FieldByName('CurrYrAmt').AsVariant) then NewAmt := aDm.qRetrieverNew.FieldByName('CurrYrAmt').AsCurrency else NewAmt := 0; if not VarIsNull(aDm.qRetrieverOld.FieldByName('PrevYrAmt').AsVariant) then OldAmt := aDm.qRetrieverOld.FieldByName('PrevYrAmt').AsCurrency else OldAmt := 0; MySL.Add(s + ', ' + CurrToStr(NewAmt) + ', ' + CurrToStr(OldAmt) ); aDataObj.fAcctNum := s; aDataObj.fCurrYr := NewAmt; aDataObj.fPrevYr := OldAmt; if not output.TryAdd(aDataObj) then break; end; aDm.SessionRetriever.CloseDatabase(aDm.dbRetriever); aDm.SessionRetriever.DropConnections; finally aDataObj.Free; aDm.Free; end; end ).NumTasks(aNumTasks) .Stage( The results, as logged to the MySL stringlist, are attached. I have no idea how to fix this. "aDm" is datamodule I create which contains the queries. I have placed the query openingss in a try-except and never received an error. I have placed query.isempty in a while loop since the query for AcctNum 1111 takes about 4 seconds. The answer is probably something simple, but I'm at a loss as to what I am doing wrong. Will appreciate any help. Log.txt
×