Subject RE: [IBO] Query OrderingLinks POS - program never ends
Author IBO Support List
I received the sample app and I am working on a fix. I'll slip this into the release I am getting out.

From: []
Sent: Monday, February 23, 2015 1:52 AM
Subject: RE: [IBO] Query OrderingLinks POS - program never ends

Hello Jason,


It took a while but I striped out all the other code (over 1,000,000 lines) leaving

a very small sample program that will replicate the problem.  There seems to

be some problem related to having a IB_Session on a different form from the

data module and from the form where the query is, and the query having a

orderinglinks with a “;POS=”.


I have copied the source, exe, and a db into a zip file and copied it to my gdrive,

below is the link to download it.  Once you click the link there is a download

arrow at the top of the browser window.

&n bsp;


Run InvView.exe and put in your local firebird or interbase password and

press the “ConnectDB” button, then the “Open/Close Warehouse” button,

then exit.  The program will not exit, it will remain running and you will

need to hit Ctrl-Alt-Delete and cancel it.


If the “POS” is removed or the ib_Session is removed then the program exits fine.


This came about because we have a large program that does our order entry, and

we wrote a standalone program to go out to several shipping companies like UPS,

and Fedx to get quotes.  The shipping checking program runs a thread to check

each web site and has the “IB_Session” in it(I don’t remember why we need it

any more).  But after we got the shipping program working we decided to

included it in the ordering program and we just changed things so the ordering

program could merge it into the same project.  That is how things got like this.


I hope this helps finding the problem.  Now that I know what is causing the

problem I will be working on a solution on my side while you are looking at

what has changed in IBObjects since v4.8.



Michael Horne





From: []
Sent: Monday, February 16, 2015 12:08 PM
Subject: RE: [IBO] Query OrderingLinks POS - program never ends



Sounds like it is being caught in an infinite loop of some kind.

Are you able to get it to do this while debugging?

It would sure help if I could see the callstack.



Jason Wharton



From: []
Sent: Monday, February 16, 2015 9:29 AM
Subject: [IBO] Query OrderingLinks POS - program never ends



I am upgrading a program from delphi7, ibo v4.8 to the newest ibo v5.5.5.


I noticed that sometimes my programs where not exiting, I started digging

into what is going on and found that if I opened a query or changed to a

order that had used a “OrderingLinks” with “POS” then when the program

tries to close it stays on the TaskBar and doesn’t stop running, I must go into

TaskManager and kill it.


I checked an I am closing the query, I checked multiple queries where I had

the POS and all did the same thing.  The queries that didn’t use the POS worked

as expecte d.  I have included dfm code samples below.



Michael Horne


--- Sample 1


object qyWarehouse: TIB_Query

  IB_Connection = formIBData.cnMain

  SQL.Strings = (

    'select wh_id, wh_Company, wh_Descr, wh_Location,'

    '    wh_fontColor, wh_BackColor,'


      '    cast(( case cwh_omit when 1 then 1 else 0 end) as t_boolean)' +

      ' omit '

    'from warehouse '


      'left join customer_wh on wh_id = cwh_wh_id and cwh_cus_id = :cus' +


    'where wh_hide = '#39'F'#39)

  AutoFetchAll = True

  KeyLinks.Strings = (


  MasterSource = dsCustomer

  OrderingItemNo = 2

  OrderingItems.Strings = (





  OrderingLinks.Strings = (





  RequestLive = True

  Left = 484

  Top = 363



--- Sample 2


object IB_Query1: TIB_Query

  IB_Connection = formIBData.cnMain

  SQL.Strings = (< /p>


    '     , OM_CUS_ID'

    '     , OM_INVNUM'

    '     , OM_COMPANY'

    '     , OM_STATUS'

    '     , OM_INVDATE'

    '     , om_realdate'

    '     , (select Total'

    '        from spOrderCalculate(ORDERSM.om_id)) as Total'


    '     , (select TOTSALES'

    '         from spOrderCalculate(ORDERSM.om_id)) as TOTSALES'


    '     , (select SALESTAX'

    '        from spOrderCalculate(ORDERSM.om_id)) as SALESTAX'

    '     , (select TOTCUSTOMERFREIGHT'

    '        from spOrderCalculate(ORDERSM.om_id)) as FREIGHT'


    '     , (select TOTMisc'

    '        from spOrderCalculate(ORDERSM.om_id)) as MiscChg'

   ;  '*/'

    '     , OM_SALESPERSON'

    '     , (SELECT first 1 NC_DATETIME from NetComQuote'

    '          left join netcomin on nc_id = ncq_nc_id'

    '          where (ncq_om_id = ordersM.om_ID)'

    '          and (NC_Status <> '#39'D'#39')'

    '          order by nc_DateTime desc) as nc_DateTime'

    '     , om_reviewed'


&n bsp;   '     , OM_SALESMANAGER'

    '     , OM_CUSTSEARCH'

    '     , OM_SESSION_ID'


    '     , OM_PONUM'

    '     , OM_REFNUM'

    '     , OM_SEARCHNOTES'



      '     , (select CUS_RATING from customer where om_cus_id = cus_id' +

       ') as cus_rating'


      '     , (select first 1 RAM_ID from ramaster where om_id = ram_om' +

      '_id order by ram_id) as ram_id'


      '/*     , (select first 1 REPLIES_CODE from SPORDER_CHECK_NC_REPL' +

      'IES(ORDERSM.om_id)) as replies_code */'


  EditSQL.Strings = (




 & nbsp;  '   OM_ID = :OLD_OM_ID')

  KeyLinks.Strings = (


  MasterSearchFlags = [msfOpenMasterOnOpen, msfSearchMasterOnSearch, msfSearchAppliesToMasterOnly]

  OrderingItemNo = 1

  OrderingItems.Strings = (

    'Quote=OM_ID desc; OM_ID'

    'InvNum=OM_InvNum desc, OM_ID desc; OM_InvNum, OM_ID'

    'CustNum=OM_Cus_ID desc, OM_Company desc, OM_ID desc; OM_Cus_ID, ' +

      'OM_Company, OM_ID'

    & nbsp;    'Company= OM_Company desc, OM_Cus_ID desc, OM_ID desc; OM_Company' +

      ', OM_Cus_ID, OM_ID'

    'SalesPerson=OM_ID desc; OM_ID'

    'InvDate=OM_INVDATE, om_id; OM_INVDATE desc, om_id desc'


      'SalesManager=OM_SALESMANAGER desc, om_id desc; OM_SALESMANAGER, ' +


    'RefNum=OM_Refnum, om_id desc; om_refnum desc, om_id desc'


      'SalesPerReview=OM_REVIEWED_SALESPERSON, om_id desc; OM_REVIEWED_' +

      'SALESPERSON desc, om_id desc ')

  OrderingLinks.Strings = (

    'OM_I D=ITEM=1;Pos=6'









  RefreshAction = raKeepDataPos

  SearchingLinks.Strings = (








  BufferSynchroFlags = [bsAfterEdit, bsAfterInsert]

  Left = 344

  Top = 232

  ParamValues = (