Re: Delphi 2 -- Informix bug?
Posted in 1997
In article <32FB3AD4.673F@wanadoo.fr>, Michel CURE <Michel.Cure@wanadoo.fr> wrote: >I have problems with Delphi 2.01 C/S and Informix(SE version 5) >using SQL Links 3.5 and I-Connect 7.2 : queries with params are >very very slow Yes they are. If you send down a "SET EXPLAIN ON" prior to your parameterised query you will discover that *somehow* Informix decides that it is NOT going to use ANY indexes. It's astonishingly weird. If you do some experiments with, for example, parameterised queries in 4GL (question-marks in your prepared statements) you'll see that *EXACTLY* the same query appears to be sent to the engine, but that this time it *DOES* decide to use the indexes. Again: It's all too weird. *PLEASE* contact Borland and complain (although I can't understand what they could have done wrong). I we should hassle Informix too, but I suspect we're just going to end up with both of them pointing the figure at each other. Sigh. Anyway, because you should *always* develop using your own decendants of the standard classes (which is one of the major problems I had with NE) you can write a work-around like we did which secretly searches for the parameters and builds a string-literal version of the SQL, which gets sent to the engine instead. One day, when this is resolved, we'll take out our over-riding methods and nobody need ever know the problem existed. Cheers, Kerry S >1) with Query1 do > begin > Close; > SQL.Clear; > SQL.Add('select * from malade where num_malade = "M127472" '); > SQL.Open; > end; > > answer : immediatly > >2) Edit1.Text := 'M127472'; > num_malade := Edit1.Text ;// num_malade is the primary key > with Query1 do > begin > Close; > SQL.Clear; > SQL.Add('select * from malade where num_malade = :num_malade '); > Params[0].AsString := num_malade; > or := 'M127472'; > SQL.Open; > end; > > answer : after 2 or 3 minutes !!! > >This problem does not exit with Delphi 1 using SQL Links 16 bits and >Informix-Net (16 bits) and exactly the same program. ------------------------------------,------------------------------------------ Kerry Sainsbury, kerry@kcbbs.gen.nz | THE INFORMIX FAQ v2.5 June 96 Quanta Systems, Auckland | http://www.iiug.org/techinfo/faq/ New Zealand. Work: +64 9 377-4473 | ftp://ftp.iiug.org/pub/informix/faq Home: +64 9 279-3571 | ftp://kcbbs.gen.nz:/pub/informix/