When entering search parameters in the GUI, the generated SQL query can be too restrictive and not return valid entries that have null data in some fields.
I will use the Creature searcher as an example, the first time entering the "Select Creature" window, the fields are empty and the generated SQL query is
SELECT * FROM `creature_template` LIMIT 50
If I put 3103 in the first field and click Search, one of the results is Makrura Clacker, which is the NPC with ID 3103.
The generated query for this is
SELECT * FROM `creature_template` WHERE (`entry` LIKE '%3103%') LIMIT 50
So far, so good.
If I enter some data in the subname field and then delete it, the query changes to this
SELECT * FROM `creature_template` WHERE (`entry` LIKE '%3103%') AND (`subname` LIKE '%%') LIMIT 50
Makrura Clacker is no longer returned because it has NULL data in the subname.
This bug is complicated by the fact that the search still returns entries that have empty subnames so there must be something unusual about Makrura Clacker.
I've only just started using Keira so haven't had a lot of time to find more entries with this issue, the only other time I've noticed it is with Dark Iron Rifleman (NPC ID 6523)
It looks as though if data is entered into the 'Entry' field 'entry' LIKE '%*%' is added to the query, when you delete text from this field it is completely removed from the generated query, if this function were extended to the Name and Subname fields the issue should be resolved.
---
Want to back this issue? **[Post a bounty on it!](https://app.bountysource.com/issues/98222913-generated-sql-query-can-be-too-restrictive?utm_campaign=plugin&utm_content=tracker%2F139701226&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://app.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F139701226&utm_medium=issues&utm_source=github).
When entering search parameters in the GUI, the generated SQL query can be too restrictive and not return valid entries that have null data in some fields.
I will use the Creature searcher as an example, the first time entering the "Select Creature" window, the fields are empty and the generated SQL query is
If I put
3103
in the first field and click Search, one of the results is Makrura Clacker, which is the NPC with ID3103
. The generated query for this isSo far, so good.
If I enter some data in the subname field and then delete it, the query changes to this
Makrura Clacker is no longer returned because it has NULL data in the subname.
This bug is complicated by the fact that the search still returns entries that have empty subnames so there must be something unusual about Makrura Clacker. I've only just started using Keira so haven't had a lot of time to find more entries with this issue, the only other time I've noticed it is with Dark Iron Rifleman (NPC ID
6523
)It looks as though if data is entered into the 'Entry' field
'entry' LIKE '%*%'
is added to the query, when you delete text from this field it is completely removed from the generated query, if this function were extended to the Name and Subname fields the issue should be resolved.