mysql - Binding Nulls in Java HashMap -


i making parameter input form query audit table. inputs not required.

the sql query below, want java resolve to, works perfectly. returns rows want, based on input.

select * _audit datediff(now(), `_audit_timestamp`) < 30       , (('smith' <> '' , _action__user = 'smith')            or (_action__user = _action__user , 'smith' null))       , ((null not null , _action_searchkey null)            or (_action_searchkey = _action_searchkey or _action_searchkey null))       , ((null not null , _action_customer null)            or (_action_customer = _action_customer , _action_customer null)) order _audit_timestamp desc 

however, when try make work in java, returns no rows @ all. thinking has values in map. looking @ them in debugger, show "" instead of null

    string sqltext = "select * "             + "       _audit "             + "       datediff(now(), `_audit_timestamp`) < :days "             + "       , ((:name not null , _action__user = :name) "             + "           or (_action__user = _action__user , :name null)) "             + "       , ((:searchkey not null , _action_searchkey = :searchkey) "             + "             or (_action_searchkey = _action_searchkey , :searchkey null)) "             + "       , ((:customer not null , _action_customer = :customer) "             + "           or (_action_customer = _action_customer , :customer null)) "             + "       order _audit_timestamp desc";      map<string, string> parameters = new hashmap<string, string>();     parameters.put("days", aqform.getdays().tostring());     parameters.put("name", aqform.getname());     parameters.put("searchkey", aqform.getsearchkey());     parameters.put("customer", aqform.getcustomer()); 

am barking wrong tree here?

replace ` ' in query , try.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -