sql-builder icon indicating copy to clipboard operation
sql-builder copied to clipboard

add empty like check

Open ggggxiaolong opened this issue 5 years ago • 5 comments

ignore like mask is "" or feild is ""

ggggxiaolong avatar Sep 18 '20 14:09 ggggxiaolong

I think we shouldn't merge this.

  1. what if I want to search empty line? select name from products where description = '';
  2. why and when do you add empty column name? It seems like a bug. If you want to add dynamic query without mutable variable I think to add modify method will better than it.

pleshevskiy avatar Sep 20 '20 12:09 pleshevskiy

I think we shouldn't merge this.

  1. what if I want to search empty line? select name from products where description = '';
  2. why and when do you add empty column name? It seems like a bug. If you want to add dynamic query without mutable variable I think to add modify method will better than it.
  1. search empty line use and_where_eq not *_like
  2. sql like "%" or like "%%" is needless

ggggxiaolong avatar Sep 25 '20 09:09 ggggxiaolong

For example you have a filter on a form. And according of its value you show records from database and pinned records: .or_where("pin") .or_where_like_any(filter)

With empty filter you will see all records, and its a normal. In your variant you can see only pinned recods

perdumonocle avatar Oct 14 '20 18:10 perdumonocle

I have plans to make an universal WHERE query constructor, but I haven't yet decided how to make it convenient and visual

perdumonocle avatar Oct 14 '20 19:10 perdumonocle

go-sqlbuilder for golang looks awful:

sb := sqlbuilder.NewSelectBuilder()
sb.Select("id", "name", sb.As("COUNT(*)", "c"))
sb.From("user")
sb.Where(sb.In("status", 1, 2, 5))

perdumonocle avatar Oct 21 '20 18:10 perdumonocle