Are unamed Params supported in TSQLQuery ? lazarus / 16-Databases ---------------------------------------------------------------------- eara · 2014-04-16 13:55 I know for named params, but what about unamed params? e.g. select x,y,z from table1 where x=? and y=? and z=?; is this supported (delphi  had it, i think) ---------------------------------------------------------------------- Windsurfer · 2014-04-16 19:20 See http://www.freepascal.org/docs- html/ref/refse69.html#x128-13800012.2 and http://wiki.lazarus.freepascal.org/Parameters ---------------------------------------------------------------------- eara · 2014-04-16 20:51 Quote from: Windsurfer on April 16, 2014, 09:20:31 pmSee http://www.freepascal.org/docs-html/ref/refse69.html#x128-13800012.2 and http://wiki.lazarus.freepascal.org/Parameters What has this to do with my question ??? ---------------------------------------------------------------------- valdir.marcos · 2014-04-17 02:14 Are you talking about Firebird Execute Block? http://www.firebirdsql.org/refdocs/langrefupd25-execblock.html ------------------------------------------- The next example calculates the geometric mean of two numbers and returns it to the user: Code: [Select]execute block (x double precision = ?, y double precision = ?) returns (gmean double precision) as begin   gmean = sqrt(x*y);   suspend; end Because this block has input parameters, it has to be prepared first. Then the parameters can be set and the block executed. It depends on the client software how this must be done and even if it is possible at all – see the notes below. Our last example takes two integer values, smallest and largest. For all the numbers in the range smallest .. largest, the block outputs the number itself, its square, its cube and its fourth power. Code: [Select]execute block (smallest int = ?, largest int = ?) returns (number int, square bigint, cube bigint, fourth bigint) as begin   number = smallest;   while (number <= largest) do   begin     square = number * number;     cube   = number * square;     fourth = number * cube;     suspend;     number = number + 1;   end end Again, it depends on the client software if and how you can set the parameter values. ------------------------------------------- ---------------------------------------------------------------------- LacaK · 2014-04-17 04:40 Quote from: eara on April 16, 2014, 03:55:14 pmI know for named params, but what about unamed params? e.g. select x,y,z from table1 where x=? and y=? and z=?; is this supported (delphi  had it, i think) Theoretically it can work, but then you must manually add parameters to TSQLQuery.Params collection. And it depends on SQLConnection type ... it can work for TIBConnection, but not for MySQLConnection for example. ---------------------------------------------------------------------- taazz · 2014-04-17 04:54 as far as I can see the TParams.ParseSQL method supports named and unnamed parameters. Try for your self use a statement like select * from MyTable where MyField = ?and see how that goes. ---------------------------------------------------------------------- eara · 2014-04-17 06:31 thank you both for your anwsers again, i made my tries on MySQL with unamed (didn't try with Add params), and moved to named params again. It was in a attempt to send to MySQL a lot of tag words at once but with a secure way (against sql injections,where FCL hides the mysql_real_escape_string() into a private EscapeString()). Finally i made it but as i see not at once (due to many parameters, this seems that it needs a stored procedure for that). one query is  something like that Code: [Select]qry_.SQL.Text:=Format('insert ignore into tags (tag) select temp.tag from (%s) temp',[s]); for i:=0 to value_list.count-1 do   qry_.ParamByName(IntToStr(i)).AsString:=value_list.strings[i]; which seems to work, in my tests i managed to send 3000 tags with one query (takes some sec, due to roundtrips for 3000 params), which seems to cover my needs for the time. ---------------------------------------------------------------------- eara · 2014-04-19 22:53 QuoteTheoretically it can work, but then you must manually add parameters to TSQLQuery.Params collection. And it depends on SQLConnection type ... it can work for TIBConnection, but not for MySQLConnection for example.Theoretically means no for me.... i made my tests with MySQL, didn't work... never mind, go fwd... thank you all again...