mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-04 05:18:25 +00:00 
			
		
		
		
	Increase maximum SQLite variables count to 32766 (#11696)
per https://www.sqlite.org/limits.html Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
		
				
					committed by
					
						
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							f576756b18
						
					
				
				
					commit
					a5aa5c58c1
				
			
							
								
								
									
										13
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								Makefile
									
									
									
									
									
								
							@@ -33,6 +33,9 @@ MIN_NODE_VERSION := 010013000
 | 
				
			|||||||
ifeq ($(HAS_GO), GO)
 | 
					ifeq ($(HAS_GO), GO)
 | 
				
			||||||
	GOPATH ?= $(shell $(GO) env GOPATH)
 | 
						GOPATH ?= $(shell $(GO) env GOPATH)
 | 
				
			||||||
	export PATH := $(GOPATH)/bin:$(PATH)
 | 
						export PATH := $(GOPATH)/bin:$(PATH)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						CGO_EXTRA_CFLAGS := -DSQLITE_MAX_VARIABLE_NUMBER=32766
 | 
				
			||||||
 | 
						CGO_CFLAGS ?= $(shell $(GO) env CGO_CFLAGS) $(CGO_EXTRA_CFLAGS)
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -499,7 +502,7 @@ check: test
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
.PHONY: install $(TAGS_PREREQ)
 | 
					.PHONY: install $(TAGS_PREREQ)
 | 
				
			||||||
install: $(wildcard *.go)
 | 
					install: $(wildcard *.go)
 | 
				
			||||||
	$(GO) install -v -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)'
 | 
						CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) install -v -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.PHONY: build
 | 
					.PHONY: build
 | 
				
			||||||
build: frontend backend
 | 
					build: frontend backend
 | 
				
			||||||
@@ -515,7 +518,7 @@ generate: $(TAGS_PREREQ)
 | 
				
			|||||||
	CC= GOOS= GOARCH= $(GO) generate -mod=vendor -tags '$(TAGS)' $(GO_PACKAGES)
 | 
						CC= GOOS= GOARCH= $(GO) generate -mod=vendor -tags '$(TAGS)' $(GO_PACKAGES)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$(EXECUTABLE): $(GO_SOURCES) $(TAGS_PREREQ)
 | 
					$(EXECUTABLE): $(GO_SOURCES) $(TAGS_PREREQ)
 | 
				
			||||||
	$(GO) build -mod=vendor $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@
 | 
						CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) build -mod=vendor $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.PHONY: release
 | 
					.PHONY: release
 | 
				
			||||||
release: frontend generate release-windows release-linux release-darwin release-copy release-compress release-sources release-check
 | 
					release: frontend generate release-windows release-linux release-darwin release-copy release-compress release-sources release-check
 | 
				
			||||||
@@ -528,7 +531,7 @@ release-windows: | $(DIST_DIRS)
 | 
				
			|||||||
	@hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
 | 
						@hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
 | 
				
			||||||
		$(GO) get -u src.techknowlogick.com/xgo; \
 | 
							$(GO) get -u src.techknowlogick.com/xgo; \
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
	GO111MODULE=off xgo -go $(XGO_VERSION) -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'windows/*' -out gitea-$(VERSION) .
 | 
						CGO_CFLAGS="$(CGO_CFLAGS)" GO111MODULE=off xgo -go $(XGO_VERSION) -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'windows/*' -out gitea-$(VERSION) .
 | 
				
			||||||
ifeq ($(CI),drone)
 | 
					ifeq ($(CI),drone)
 | 
				
			||||||
	cp /build/* $(DIST)/binaries
 | 
						cp /build/* $(DIST)/binaries
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
@@ -538,7 +541,7 @@ release-linux: | $(DIST_DIRS)
 | 
				
			|||||||
	@hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
 | 
						@hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
 | 
				
			||||||
		$(GO) get -u src.techknowlogick.com/xgo; \
 | 
							$(GO) get -u src.techknowlogick.com/xgo; \
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
	GO111MODULE=off xgo -go $(XGO_VERSION) -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'linux/amd64,linux/386,linux/arm-5,linux/arm-6,linux/arm64,linux/mips64le,linux/mips,linux/mipsle' -out gitea-$(VERSION) .
 | 
						CGO_CFLAGS="$(CGO_CFLAGS)" GO111MODULE=off xgo -go $(XGO_VERSION) -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'linux/amd64,linux/386,linux/arm-5,linux/arm-6,linux/arm64,linux/mips64le,linux/mips,linux/mipsle' -out gitea-$(VERSION) .
 | 
				
			||||||
ifeq ($(CI),drone)
 | 
					ifeq ($(CI),drone)
 | 
				
			||||||
	cp /build/* $(DIST)/binaries
 | 
						cp /build/* $(DIST)/binaries
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
@@ -548,7 +551,7 @@ release-darwin: | $(DIST_DIRS)
 | 
				
			|||||||
	@hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
 | 
						@hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
 | 
				
			||||||
		$(GO) get -u src.techknowlogick.com/xgo; \
 | 
							$(GO) get -u src.techknowlogick.com/xgo; \
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
	GO111MODULE=off xgo -go $(XGO_VERSION) -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '$(LDFLAGS)' -targets 'darwin/*' -out gitea-$(VERSION) .
 | 
						CGO_CFLAGS="$(CGO_CFLAGS)" GO111MODULE=off xgo -go $(XGO_VERSION) -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '$(LDFLAGS)' -targets 'darwin/*' -out gitea-$(VERSION) .
 | 
				
			||||||
ifeq ($(CI),drone)
 | 
					ifeq ($(CI),drone)
 | 
				
			||||||
	cp /build/* $(DIST)/binaries
 | 
						cp /build/* $(DIST)/binaries
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -76,7 +76,6 @@ var (
 | 
				
			|||||||
const issueTasksRegexpStr = `(^\s*[-*]\s\[[\sxX]\]\s.)|(\n\s*[-*]\s\[[\sxX]\]\s.)`
 | 
					const issueTasksRegexpStr = `(^\s*[-*]\s\[[\sxX]\]\s.)|(\n\s*[-*]\s\[[\sxX]\]\s.)`
 | 
				
			||||||
const issueTasksDoneRegexpStr = `(^\s*[-*]\s\[[xX]\]\s.)|(\n\s*[-*]\s\[[xX]\]\s.)`
 | 
					const issueTasksDoneRegexpStr = `(^\s*[-*]\s\[[xX]\]\s.)|(\n\s*[-*]\s\[[xX]\]\s.)`
 | 
				
			||||||
const issueMaxDupIndexAttempts = 3
 | 
					const issueMaxDupIndexAttempts = 3
 | 
				
			||||||
const maxIssueIDs = 950
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
func init() {
 | 
					func init() {
 | 
				
			||||||
	issueTasksPat = regexp.MustCompile(issueTasksRegexpStr)
 | 
						issueTasksPat = regexp.MustCompile(issueTasksRegexpStr)
 | 
				
			||||||
@@ -1114,9 +1113,6 @@ func (opts *IssuesOptions) setupSession(sess *xorm.Session) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if len(opts.IssueIDs) > 0 {
 | 
						if len(opts.IssueIDs) > 0 {
 | 
				
			||||||
		if len(opts.IssueIDs) > maxIssueIDs {
 | 
					 | 
				
			||||||
			opts.IssueIDs = opts.IssueIDs[:maxIssueIDs]
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		sess.In("issue.id", opts.IssueIDs)
 | 
							sess.In("issue.id", opts.IssueIDs)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1360,9 +1356,6 @@ func getIssueStatsChunk(opts *IssueStatsOptions, issueIDs []int64) (*IssueStats,
 | 
				
			|||||||
			Where("issue.repo_id = ?", opts.RepoID)
 | 
								Where("issue.repo_id = ?", opts.RepoID)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if len(opts.IssueIDs) > 0 {
 | 
							if len(opts.IssueIDs) > 0 {
 | 
				
			||||||
			if len(opts.IssueIDs) > maxIssueIDs {
 | 
					 | 
				
			||||||
				opts.IssueIDs = opts.IssueIDs[:maxIssueIDs]
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			sess.In("issue.id", opts.IssueIDs)
 | 
								sess.In("issue.id", opts.IssueIDs)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1446,9 +1439,6 @@ func GetUserIssueStats(opts UserIssueStatsOptions) (*IssueStats, error) {
 | 
				
			|||||||
		cond = cond.And(builder.In("issue.repo_id", opts.RepoIDs))
 | 
							cond = cond.And(builder.In("issue.repo_id", opts.RepoIDs))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if len(opts.IssueIDs) > 0 {
 | 
						if len(opts.IssueIDs) > 0 {
 | 
				
			||||||
		if len(opts.IssueIDs) > maxIssueIDs {
 | 
					 | 
				
			||||||
			opts.IssueIDs = opts.IssueIDs[:maxIssueIDs]
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		cond = cond.And(builder.In("issue.id", opts.IssueIDs))
 | 
							cond = cond.And(builder.In("issue.id", opts.IssueIDs))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user