Subject RE: [IBO] Query OrderingLinks POS - program never ends
Author Michael Horne

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.

 

https://drive.google.com/file/d/0B-UU8iBPXW5gVjM2WWNLMVhFRTQ/view?usp=sharing

 

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.

 

Thanks

Michael Horne

 

 

 

 

From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com]
Sent: Monday, February 16, 2015 12:08 PM
To: IBObjects@yahoogroups.com
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.

 

Thanks,

Jason Wharton

www.ibobjects.com

 

 


From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com]
Sent: Monday, February 16, 2015 9:29 AM
To: IBObjects@yahoogroups.com
Subject: [IBO] Query OrderingLinks POS - program never ends

Hello,

 

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 expected.  I have included dfm code samples below.

 

Thanks

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' +

      '_id'

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

  AutoFetchAll = True

  KeyLinks.Strings = (

    'warehouse.wh_id')

  MasterSource = dsCustomer

  OrderingItemNo = 2

  OrderingItems.Strings = (

    'WH_ID=WH_ID;WH_ID DESC'

    'WH_COMPANY=WH_COMPANY;WH_COMPANY DESC'

    'WH_DESCR=WH_DESCR;WH_DESCR DESC'

    'WH_LOCATION=WH_LOCATION;WH_LOCATION DESCR')

  OrderingLinks.Strings = (

    'WH_ID=ITEM=1;POS=1'

    'WH_COMPANY=ITEM=2;POS=1'

    'WH_DESCR=ITEM=3;POS=1'

    'WH_LOCATION=ITEM=4;POS=1')

  RequestLive = True

  Left = 484

  Top = 363

end

 

--- Sample 2

 

object IB_Query1: TIB_Query

  IB_Connection = formIBData.cnMain

  SQL.Strings = (< /p>

    'SELECT OM_ID'

    '     , 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'

    '     , OM_REVIEWED_SALESPERSON'

    '     , OM_SALESMANAGER'

    '     , OM_CUSTSEARCH'

    '     , OM_SESSION_ID'

    '     , OM_SESSION_USERNAME'

    '     , OM_PONUM'

    '     , OM_REFNUM'

    '     , OM_SEARCHNOTES'

    '     , OM_NC_REPLIES_DATETIME'

   

      '     , (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 */'

    'FROM ORDERSM')

  EditSQL.Strings = (

    'UPDATE ORDERSM SET'

    '   OM_REVIEWED = :OM_REVIEWED'

    'WHERE'

    '   OM_ID = :OLD_OM_ID')

  KeyLinks.Strings = (

    'OrdersM.OM_ID')

  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, ' +

      'om_id'

    '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_ID=ITEM=1;Pos=6'

    'OM_InvNum=ITEM=2;Pos=5'

    'OM_Cus_ID=ITEM=3;Pos=4'

    'OM_Company=ITEM=4;Pos=1'

    'OM_SalesPerson=ITEM=5;Pos=1'

    'OM_INVDATE=ITEM=6;Pos=8'

    'OM_SALESMANAGER=ITEM=7;Pos=1'

    'OM_REFNUM=ITEM=8;pos=1'

    'OM_REVIEWED_SALESPERSON=ITEM=9;pos=1')

  RefreshAction = raKeepDataPos

  SearchingLinks.Strings = (

    'OM_ID=Quote'

    'OM_InvNum=InvNum'

    'OM_Cus_ID=Cus_ID'

    'OM_Company=Company'

    'OM_SalesPerson=SalesPerson'

    'OM_INVDATE=InvDate'

    'OM_SALESMANAGER=SalesManager')

  BufferSynchroFlags = [bsAfterEdit, bsAfterInsert]

  Left = 344

  Top = 232

  ParamValues = (

    'OLNK_OM_ID=00000080')

end