Subject | Using PLAN with TIBOQuery |
---|---|
Author | sboydlns |
Post date | 2010-05-13T13:55:33Z |
I am having a problem with IBO 4.8.6 and Delphi 2007. For a certain query it was necessary to specify a query plan in order to get the performance to where it should be. To do that I just set the SQL.Text property to something like this:
SELECT * FROM some_table WHERE some_condition PLAN the_plan
Then I use the Open method to execute the query, attach it to a TDBGrid and life is good.
The problem arises when the form gets a WM_PAINT message, forcing the TDBGrid to redraw itself. At that point I get an exception:
EIBO_ISCError:
ISC ERROR CODE:335544642
index BILLING_PROIDX cannot be used in the specified plan
TIB_BindingCursor: "LogicalDatabase.SearchQuery.IBOqrSearchQuery.<TIB_BindingCursor>."
TIBOInternalDataset: "LogicalD.
Here is the relevant portion of the call stack.
IBODataset.pas TIBOInternalDataset DoHandleError Line 8519 Offset=23
IB_Components.pas TIB_Component DoHandleError Line 13912 Offset=2
IB_Components.pas TIB_Component DoHandleError Line 13910 Offset=0
IB_Components.pas TIB_Statement DoHandleError Line 20490 Offset=17
system.pas _GetMem Line 2654 Offset=3
system.pas _GetMem Line 2652 Offset=1
system.pas _NewAnsiStringLine 12429 Offset=7
system.pas _GetMem Line 2654 Offset=3
system.pas _GetMem Line 2652 Offset=1
system.pas _NewAnsiString Line 12429 Offset=7
IB_Components.pas TIB_Session DoHandleError Line 13224 Offset=2
IB_Session.pas TIB_SessionBase HandleException Line 1442 Offset=58
IB_Session.pas TIB_SessionBase HandleException Line 1384 Offset=0
IB_Components.pas TIB_BindingCursor GetPrepare Line 30332 Offset=51
IB_Components.pas TIB_BindingCursor GetPrepare 30281 Offset=0
IB_Components.pas TIB_BindingCursor QuickFetch Line 30449 Offset=52
IB_Components.pas TIB_BindingCursor QuickFetch Line 30397 Offset=0
IB_Components.pas TIB_BDataset SysLookupKeyForBufferFields Line 34805 Offset=29
IB_Components.pas TIB_BDataset SysLookupKeyForBufferFields Line 34776 Offset=0
IB_Components.pas TIB_BDataset LookupKeyForBufferFields Line 34687 Offset=9
IB_Components.pas TIB_BDataset LookupKeyForBufferFields Line 34678 Offset=0
IB_Components.pas TIB_BDataset SetBufferBookmark Line 31314 Offset=7
IBODataset.pas TIBODataset CompareBookmarks Line 5611 Offset=11
DBGrids.pas TBookmarkList Compare Line 2017 Offset=2
...
It would seem as though the FRefinedSQL property of the TIB_BindingCursor class should not include the PLAN clause. But I am a bit reluctant to just insert some code to remove it because I have no way of knowing what the impact of doing that might be.
Any suggestions?
SELECT * FROM some_table WHERE some_condition PLAN the_plan
Then I use the Open method to execute the query, attach it to a TDBGrid and life is good.
The problem arises when the form gets a WM_PAINT message, forcing the TDBGrid to redraw itself. At that point I get an exception:
EIBO_ISCError:
ISC ERROR CODE:335544642
index BILLING_PROIDX cannot be used in the specified plan
TIB_BindingCursor: "LogicalDatabase.SearchQuery.IBOqrSearchQuery.<TIB_BindingCursor>."
TIBOInternalDataset: "LogicalD.
Here is the relevant portion of the call stack.
IBODataset.pas TIBOInternalDataset DoHandleError Line 8519 Offset=23
IB_Components.pas TIB_Component DoHandleError Line 13912 Offset=2
IB_Components.pas TIB_Component DoHandleError Line 13910 Offset=0
IB_Components.pas TIB_Statement DoHandleError Line 20490 Offset=17
system.pas _GetMem Line 2654 Offset=3
system.pas _GetMem Line 2652 Offset=1
system.pas _NewAnsiStringLine 12429 Offset=7
system.pas _GetMem Line 2654 Offset=3
system.pas _GetMem Line 2652 Offset=1
system.pas _NewAnsiString Line 12429 Offset=7
IB_Components.pas TIB_Session DoHandleError Line 13224 Offset=2
IB_Session.pas TIB_SessionBase HandleException Line 1442 Offset=58
IB_Session.pas TIB_SessionBase HandleException Line 1384 Offset=0
IB_Components.pas TIB_BindingCursor GetPrepare Line 30332 Offset=51
IB_Components.pas TIB_BindingCursor GetPrepare 30281 Offset=0
IB_Components.pas TIB_BindingCursor QuickFetch Line 30449 Offset=52
IB_Components.pas TIB_BindingCursor QuickFetch Line 30397 Offset=0
IB_Components.pas TIB_BDataset SysLookupKeyForBufferFields Line 34805 Offset=29
IB_Components.pas TIB_BDataset SysLookupKeyForBufferFields Line 34776 Offset=0
IB_Components.pas TIB_BDataset LookupKeyForBufferFields Line 34687 Offset=9
IB_Components.pas TIB_BDataset LookupKeyForBufferFields Line 34678 Offset=0
IB_Components.pas TIB_BDataset SetBufferBookmark Line 31314 Offset=7
IBODataset.pas TIBODataset CompareBookmarks Line 5611 Offset=11
DBGrids.pas TBookmarkList Compare Line 2017 Offset=2
...
It would seem as though the FRefinedSQL property of the TIB_BindingCursor class should not include the PLAN clause. But I am a bit reluctant to just insert some code to remove it because I have no way of knowing what the impact of doing that might be.
Any suggestions?