[Info-vax] Teaching, was: Re: Any stronger versions of the LMF planned ?
Arne Vajhøj
arne at vajhoej.dk
Fri Aug 13 10:44:54 EDT 2021
On 8/13/2021 8:47 AM, Jan-Erik Söderholm wrote:
> Den 2021-08-13 kl. 14:28, skrev Arne Vajhøj:
>> On 8/12/2021 10:00 PM, Lawrence D’Oliveiro wrote:
>>> On Friday, August 13, 2021 at 12:47:29 PM UTC+12, Arne Vajhøj wrote:
>>>> Decent database API's provide support for prepared statement /
>>>> parameters.
>>>
>>> I don’t see any that deal with LIKE clauses, though, for example. How
>>> do you cope with that? Or in your world, do you just run away
>>> screaming?
>> I have never seen an implementation of prepared statement that
>> did not support LIKE.
>>
>> ... f LIKE ?
>>
>> (or whatever the placeholder is)
>
> The question is if you should expect the user to add the correct
> wildcards, or if you need/want to simply add an % before and after
> the search string supplied by the user.
In most cases it should be added by the application code.
> And of course it is no issue to prepare that statement anyway...
True.
Java & JDBC:
PreparedStatement sel = con.prepare("... WHERE f LIKE ?");
sel.setString(1, fval + "%");
Arne
More information about the Info-vax
mailing list