Wish JRDC2 to have @p1, @p2 instead of ? (Re-use parameters)

John Naylor

Active Member
Licensed User
Longtime User
I've recently been using JRDC2 quite a bit and it is excellent but I often find I need to reuse parameters in queries.

An entry in the JRDC2 config.properties query may read something like

MySQL Example:
Select
    mainstock.id,
    mainstock.name,
    mainstock.description
From
    mainstock
Where
    (mainstock.id = ?) Or
    (mainstock.name Like Concat('%', ?, '%')) Or
    (mainstock.description Like Concat('%', ?, '%'))

So I would have to pass three parameters when only two are actually required to pull off the following alternative

SQL:
Select
    mainstock.id,
    mainstock.name,
    mainstock.description
From
    mainstock
Where
    (mainstock.id = @p1) Or
    (mainstock.name Like Concat('%', @p2, '%')) Or
    (mainstock.description Like Concat('%', @p2, '%'))

I know I could pass multiple parameters (reusing the same one multiple times) like this

B4X:
Dim cmd As DBCommand = CreateCommand("Select_Stock", Array(ID, SearchString, SearchString))

but that gets to be a nightmare very quickly with a more complex query.

I also know I could just write a stored procedure and use that instead buy hey, this is a wish list eh?
 
Top