From 7c0b40ffd73b2e16117da0cb4ee39335b230e0f8 Mon Sep 17 00:00:00 2001 From: yanchao Date: Thu, 17 Mar 2022 19:43:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/dataset.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/models/dataset.go b/models/dataset.go index 7d04986d2..6c3bb9e02 100755 --- a/models/dataset.go +++ b/models/dataset.go @@ -1,11 +1,11 @@ package models import ( + logger "code.gitea.io/gitea/modules/log" + "code.gitea.io/gitea/modules/timeutil" "errors" "fmt" "sort" - - "code.gitea.io/gitea/modules/timeutil" "xorm.io/builder" ) @@ -198,6 +198,13 @@ func SearchDatasetByCondition(opts *SearchDatasetOptions, cond builder.Cond) (Da Join("INNER", "attachment", "attachment.dataset_id=dataset.id"). Where(cond).Count(new(Dataset)) + a, b := sess.LastSQL() + logger.Warn("sql:" + a) + + for _, v := range b { + logger.Warn("arg:" + v.(string)) + } + if err != nil { return nil, 0, fmt.Errorf("Count: %v", err) } @@ -205,6 +212,10 @@ func SearchDatasetByCondition(opts *SearchDatasetOptions, cond builder.Cond) (Da sess.Select(selectColumnsSql).Join("INNER", "repository", "repository.id = dataset.repo_id"). Join("INNER", "attachment", "attachment.dataset_id=dataset.id"). Where(cond).OrderBy(opts.SearchOrderBy.String()) + a, b = sess.LastSQL() + logger.Warn("sql:" + a) + + print(a, b) if opts.PageSize > 0 { sess.Limit(opts.PageSize, (opts.Page-1)*opts.PageSize) }