| @@ -1,11 +1,11 @@ | |||||
| package models | package models | ||||
| import ( | import ( | ||||
| logger "code.gitea.io/gitea/modules/log" | |||||
| "code.gitea.io/gitea/modules/timeutil" | |||||
| "errors" | "errors" | ||||
| "fmt" | "fmt" | ||||
| "sort" | "sort" | ||||
| "code.gitea.io/gitea/modules/timeutil" | |||||
| "xorm.io/builder" | "xorm.io/builder" | ||||
| ) | ) | ||||
| @@ -198,6 +198,13 @@ func SearchDatasetByCondition(opts *SearchDatasetOptions, cond builder.Cond) (Da | |||||
| Join("INNER", "attachment", "attachment.dataset_id=dataset.id"). | Join("INNER", "attachment", "attachment.dataset_id=dataset.id"). | ||||
| Where(cond).Count(new(Dataset)) | 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 { | if err != nil { | ||||
| return nil, 0, fmt.Errorf("Count: %v", err) | 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"). | sess.Select(selectColumnsSql).Join("INNER", "repository", "repository.id = dataset.repo_id"). | ||||
| Join("INNER", "attachment", "attachment.dataset_id=dataset.id"). | Join("INNER", "attachment", "attachment.dataset_id=dataset.id"). | ||||
| Where(cond).OrderBy(opts.SearchOrderBy.String()) | Where(cond).OrderBy(opts.SearchOrderBy.String()) | ||||
| a, b = sess.LastSQL() | |||||
| logger.Warn("sql:" + a) | |||||
| print(a, b) | |||||
| if opts.PageSize > 0 { | if opts.PageSize > 0 { | ||||
| sess.Limit(opts.PageSize, (opts.Page-1)*opts.PageSize) | sess.Limit(opts.PageSize, (opts.Page-1)*opts.PageSize) | ||||
| } | } | ||||