RE: HELP : Informix and Delphi
Posted in 1997
We use Delphi extensively with Informix. My first suggestion is to test these same SQLs on the server to determine if Delphi or Informix is the problem. There are also several ways of running these queries. Since your query is dynamic, unless you are going to update the parameter, you may as well hard code the value into the SQL. Parameters are only good if you will be running the same query multiple times with different parameter values each time. Also, be careful the way you reference the parameter. Usually ParamByName is preferred since there is little room for error. Since you only have one, it is not a big deal. What kind of response do you get with LIKE instead of matches? ...Michael... }---------- }From: Michel CURE[SMTP:Michel.Cure@wanadoo.fr] }Sent: Tuesday, March 04, 1997 4:19 AM }To: informix-list@rmy.emory.edu }Subject: HELP : Informix and Delphi } }I have many problems with dynamic queries from Delphi 2.01, using }SQL-LINKS 3.5 and Informix IConnect 7.2. My server is a Informix SE v5 }database. }Actually, I have problems with string parameters : } }- If I open a dynamic query with a restriction on an indexed integer }column, no problems : } (Table SER has 100000 lines) } Query.SQL.Add('select * from ser '); } Query.SQL.ADD(' where num_ser = :num'); } Query.Params[0].AsInteger := 123; } Query.Prepare; } Query.Open; } } -> Answer is immediate } } - If I open e dynamic query with a restriction on an indexed string }column (declared as CHAR(20)) } on Informix database : (Table MAL has 45000 lines) } } Query.SQL.Add('select * from mal'); } Query.SQL.Add(' where nom_mal = :nom'); } Query.Params[0].AsString := 'DUPONT'; } Query.Prepare; } Query.Open; } } -> Answer after a long minute } } - The same query with the KeyWord "matches" answers immediately !!! } } Query.SQL.Add('select * from mal'); } Query.SQL.Add(' where nom_mal matches :nom'); } Query.Params[0].AsString := 'DUPONT'; } Query.Prepare; } Query.Open; } } -> Answer immediate !!!! } } } - If I open a query on table MAL with a restriction on a unique }indexed string column (declared as } CHAR(6)), I have problems : } } Rmq : column Mal.num_dos is a string column but contains only }number characters which are considered } as a string } } Query.SQL.Add('select * from mal'); } Query.SQL.Add(' where num_dos = :nodos'); } Query.Params[0].AsString := '123425'; } Query.Prepare; } Query.Open; } } -> Answer after a long minute } } - I have tried the same keyword "matches" as it worked well with }column Mal.nom_mal } } Query.SQL.Add('select * from mal'); } Query.SQL.Add(' where num_dos matches :nodos'); } Query.Params[0].AsString := '123425'; } Query.Prepare; } Query.Open; } } -> Answer after 8 seconds! } } }I really can't understand what's the matter !! }Does anyone know the same problems? } }Thank You } }Beatrice }