mirror of
https://github.com/glebarez/go-sqlite.git
synced 2025-10-05 15:56:52 +08:00

modified: Makefile new file: all_linux_test.go renamed: all_test.go -> all_test_windows.go new file: doc.go new file: generate_linux.go new file: generate_windows.go modified: generator.go new file: generator_windows.go modified: internal/bin/bin_linux_386.go modified: internal/bin/bin_linux_amd64.go modified: main.c modified: sqlite.go modified: sqlite_go18.go new file: sqlite_windows.go
37 lines
583 B
C
37 lines
583 B
C
// Copyright 2017 The Sqlite Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
// SQLite Is Public Domain
|
|
|
|
// +build ignore
|
|
|
|
#define minAlloc (2<<5)
|
|
|
|
#include <sqlite3.h>
|
|
#include <stdlib.h>
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
init(-1);
|
|
}
|
|
|
|
int init(int heapSize)
|
|
{
|
|
void *heap = malloc(heapSize);
|
|
if (heap == 0) {
|
|
return 1;
|
|
}
|
|
|
|
int rc = sqlite3_config(SQLITE_CONFIG_HEAP, heap, heapSize, minAlloc);
|
|
if (rc) {
|
|
return 2;
|
|
}
|
|
|
|
rc = sqlite3_threadsafe();
|
|
if (!rc) {
|
|
return 3;
|
|
}
|
|
|
|
return 0;
|
|
}
|