select like

This commit is contained in:
殷勇 2023-09-13 15:04:01 +08:00
parent 0317dc9f5e
commit 386a55fcfa

View File

@ -90,14 +90,14 @@ func (this *dbPool) SelectLike(
fields []string, fields []string,
whereKv [][]string, whereKv [][]string,
likeWhere [][]string, likeWhere [][]string,
start int64,
limit int, limit int,
cb QueryResultCb) { cb QueryResultCb) {
var params []string var params []string
sql := fmt.Sprintf("SELECT %s FROM %s WHERE idx > %d", this.joinSelectFields(fields), tblName, start)
sql := fmt.Sprintf("SELECT %s FROM %s WHERE 1=1 ", this.joinSelectFields(fields), tblName)
this.joinWhere(&sql, &params, whereKv) this.joinWhere(&sql, &params, whereKv)
this.joinWhereLike(&sql, &params, likeWhere) this.joinWhereLike(&sql, &params, likeWhere)
sql = fmt.Sprintf("%s LIMIT %d", sql, limit) sql = fmt.Sprintf("%s ORDER BY idx ASC LIMIT %d", sql, limit)
this.internalQuery(dataSource, sql, params, cb) this.internalQuery(dataSource, sql, params, cb)
} }