c# - Conditions for nchar fields in queries -
in db there nchar field , have problem comparisonon in different databases ( oracle , postgresql ) when comparing string length not equal field length.
var hash = "abcd"; var padded = hash.padright(36); (1) session.queryover<messageprofile>().where(mp => mp.hash == hash ).singleordefault() (2) session.queryover<messageprofile>().where(mp => mp.hash == padded).singleordefault() on oracle (1) null , (2) not, on postgresql (2) null , (1) not. successful queries retrieved hash has length of 36 chars. can solve this? thought compare trimmed values, sense there improve solution.
when utilize clients ( pgadmin, sql developer ) both queries homecoming result
select * message_profile hash= 'abc ' select * message_profile hash= 'abc' c# database nhibernate
No comments:
Post a Comment