<p dir="ltr">What about using a stored procedure to do it ? You could pass the list for the in as a string and handle it in the stored procedure. Of course that's no help if using sqlite or other that does not support stored procedures.</p>
<div class="gmail_quote">On Apr 10, 2016 1:39 PM, "Stephen Chrzanowski" <<a href="mailto:pontiac76@gmail.com">pontiac76@gmail.com</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>The problem with that Tony is that the the bind might make :myparam a string, so you'll be doing a 1-integer to 1-string comparison, which won't give you any results. Essentially you'll be asking for a list of results whos field is equal to "1,2,3,4", not a list of results in which the field in question contains the numbers 1, or 2, or 3, or 4.<br><br></div>At OP<br><br></div><div>Due to the nature of the bind mechanism, you won't be able to do it this way. The only way you'll be able to do that is with your program doing string substitution instead of doing the bind. Since you're dealing with integers only, you'll just need to make sure that every entry you're substituting for is actually an integer.<br></div><br></div><div class="elided-text"><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Apr 10, 2016 at 10:01 AM, Tony Caduto <span dir="ltr"><<a href="mailto:tony.caduto@gmail.com" target="_blank">tony.caduto@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">Did you try putting quotes around the param ID in the sql query? in(":myparam")<br>
I am guessing it's the commas that are the problem.</p>
<p dir="ltr">Sqlite will accept double qoutes as will MySQL postgres will not though.<br></p><div><div>
<div class="gmail_quote">On Apr 10, 2016 7:40 AM, "leledumbo" <<a href="mailto:leledumbo_cool@yahoo.co.id" target="_blank">leledumbo_cool@yahoo.co.id</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">> But until now i havent figured a way to pass an array of values (mostly<br>
integers) to be used with IN operators.<br>
<br>
That, unfortunately, is not possible. It's a DBMS limitation, parameterized<br>
values are actually passed as is to DBMS. So there's nothing you can do<br>
unless you can convince DBMS maintainer to implement it.<br>
<br>
> Is there a way to accomplish this?<br>
<br>
No other way than direct formatting for now.<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://free-pascal-general.1045716.n5.nabble.com/Sqldb-How-to-pass-an-array-of-values-as-a-param-to-be-used-with-SQL-IN-operator-tp5724873p5724874.html" target="_blank">http://free-pascal-general.1045716.n5.nabble.com/Sqldb-How-to-pass-an-array-of-values-as-a-param-to-be-used-with-SQL-IN-operator-tp5724873p5724874.html</a><br>
Sent from the Free Pascal - General mailing list archive at Nabble.com.<br>
_______________________________________________<br>
fpc-pascal maillist - <a href="mailto:fpc-pascal@lists.freepascal.org" target="_blank">fpc-pascal@lists.freepascal.org</a><br>
<a href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal" target="_blank">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal</a><br>
</blockquote></div>
</div></div><br>_______________________________________________<br>
fpc-pascal maillist - <a href="mailto:fpc-pascal@lists.freepascal.org" target="_blank">fpc-pascal@lists.freepascal.org</a><br>
<a href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal" rel="noreferrer" target="_blank">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal</a><br></blockquote></div><br></div>
</div><br>_______________________________________________<br>
fpc-pascal maillist - <a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a><br>
<a href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal" rel="noreferrer" target="_blank">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal</a><br></blockquote></div>