'String comparison in Mybatis SQL Fails
There are two cases, one of which passes while other fails.
Case 1: Fails or Returns 0 for all #{password} values
SELECT @out = CASE WHEN (SELECT CONVERT( VARCHAR(MAX), DECRYPTBYKEY(hashed_key)) AS someKey FROM t_key_table WHERE is_active = 1) = '#{password}'
THEN 1
ELSE 0
END
Case 2: Passes on correct ${password} value and returns 0 for others
SELECT @out = CASE WHEN (SELECT CONVERT( VARCHAR(MAX), DECRYPTBYKEY(hashed_key)) AS someKey FROM t_key_table WHERE is_active = 1) = '${password}'
THEN 1
ELSE 0
END
Currently my reasoning is that #{} returns PreparedStatement which might hinder with the comparison process, but i am unable to find any specific doc or something concrete to help me understand this. Any help is appreciated.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
