I’m working in a database on vb.net with sqlite which hosts a gallery and I want expand the search properities.
This the actual query string:
"SELECT images.*
FROM images
JOIN nodes
ON images.id = nodes.image_id
WHERE tag_id = (SELECT tags.id
FROM tags
WHERE tag = '" & tagname & "')
ORDER BY images." & sort & " " & order & ""
But it only can search for only one descriptive tag (tagname) and sort the images and nothing more.
I want to filter the results also for image ext (table = images.ext) or one or more parameter…for example:
If the user search "cars ext:jpg width>500" the the database returns all images which has the tag "cars", has the extension jpg and are bigger than 500 px width.
First of all, if that input is coming in from the user, don’t concatenate strings like that, because it’s succeptible to SQL Injection
Using SQL Parameters is a way to avoid the injection:
You can extend this to: