Skip to content

Commit b07b06e

Browse files
committed
update to call _sqlite3_limit as a wrapper instead of sqlite3_limit
1 parent d785b8f commit b07b06e

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

sqlite3.go

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,30 @@ int compareTrampoline(void*, int, char*, int, char*);
105105
int commitHookTrampoline(void*);
106106
void rollbackHookTrampoline(void*);
107107
void updateHookTrampoline(void*, int, char*, char*, sqlite3_int64);
108+
109+
#ifdef SQLITE_LIMIT_WORKER_THREADS
110+
# define _SQLITE_HAS_LIMIT
111+
# define SQLITE_LIMIT_LENGTH 0
112+
# define SQLITE_LIMIT_SQL_LENGTH 1
113+
# define SQLITE_LIMIT_COLUMN 2
114+
# define SQLITE_LIMIT_EXPR_DEPTH 3
115+
# define SQLITE_LIMIT_COMPOUND_SELECT 4
116+
# define SQLITE_LIMIT_VDBE_OP 5
117+
# define SQLITE_LIMIT_FUNCTION_ARG 6
118+
# define SQLITE_LIMIT_ATTACHED 7
119+
# define SQLITE_LIMIT_LIKE_PATTERN_LENGTH 8
120+
# define SQLITE_LIMIT_VARIABLE_NUMBER 9
121+
# define SQLITE_LIMIT_TRIGGER_DEPTH 10
122+
# define SQLITE_LIMIT_WORKER_THREADS 11
123+
#endif
124+
125+
static int _sqlite3_limit(sqlite3* db, int limitId, int newLimit) {
126+
#ifndef _SQLITE_HAS_LIMIT
127+
return -1;
128+
#else
129+
return sqlite3_limit(db, limitId, newLimit);
130+
#endif
131+
}
108132
*/
109133
import "C"
110134
import (
@@ -847,14 +871,14 @@ const (
847871
// GetLimit returns the current value of a run-time limit.
848872
// See: sqlite3_limit, http://www.sqlite.org/c3ref/limit.html
849873
func (c *SQLiteConn) GetLimit(id int) int {
850-
return int(C.sqlite3_limit(c.db, C.int(id), -1))
874+
return int(C._sqlite3_limit(c.db, C.int(id), -1))
851875
}
852876

853877
// SetLimit changes the value of a run-time limits.
854878
// Then this method returns the prior value of the limit.
855879
// See: sqlite3_limit, http://www.sqlite.org/c3ref/limit.html
856880
func (c *SQLiteConn) SetLimit(id int, newVal int) int {
857-
return int(C.sqlite3_limit(c.db, C.int(id), C.int(newVal)))
881+
return int(C._sqlite3_limit(c.db, C.int(id), C.int(newVal)))
858882
}
859883

860884
// Close the statement.

0 commit comments

Comments
 (0)