mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-19 17:34:19 +01:00
sqlite3: Implement some auxiliary functions
This adds `sqlite3_libversion()`, `sqlite3_libversion_number()`, and `libsql3_threadsafe()`.
This commit is contained in:
@@ -773,15 +773,17 @@ pub unsafe extern "C" fn sqlite3_complete(_sql: *const std::ffi::c_char) -> ffi:
|
|||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn sqlite3_threadsafe() -> ffi::c_int {
|
pub unsafe extern "C" fn sqlite3_threadsafe() -> ffi::c_int {
|
||||||
todo!();
|
1
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn sqlite3_libversion() -> *const std::ffi::c_char {
|
pub unsafe extern "C" fn sqlite3_libversion() -> *const std::ffi::c_char {
|
||||||
todo!();
|
ffi::CStr::from_bytes_with_nul(b"3.42.0\0")
|
||||||
|
.unwrap()
|
||||||
|
.as_ptr()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn sqlite3_libversion_number() -> ffi::c_int {
|
pub unsafe extern "C" fn sqlite3_libversion_number() -> ffi::c_int {
|
||||||
todo!();
|
3042000
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ CFLAGS = -g -Wall -std=c17 -MMD -MP
|
|||||||
LIBS ?= -lsqlite3
|
LIBS ?= -lsqlite3
|
||||||
|
|
||||||
OBJS += main.o
|
OBJS += main.o
|
||||||
|
OBJS += test-aux.o
|
||||||
OBJS += test-close.o
|
OBJS += test-close.o
|
||||||
OBJS += test-open.o
|
OBJS += test-open.o
|
||||||
OBJS += test-prepare.o
|
OBJS += test-prepare.o
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
extern void test_libversion();
|
||||||
|
extern void test_libversion_number();
|
||||||
extern void test_open_misuse();
|
extern void test_open_misuse();
|
||||||
extern void test_open_not_found();
|
extern void test_open_not_found();
|
||||||
extern void test_open_existing();
|
extern void test_open_existing();
|
||||||
@@ -6,6 +8,8 @@ extern void test_prepare_misuse();
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
test_libversion();
|
||||||
|
test_libversion_number();
|
||||||
test_open_misuse();
|
test_open_misuse();
|
||||||
test_open_not_found();
|
test_open_not_found();
|
||||||
test_open_existing();
|
test_open_existing();
|
||||||
|
|||||||
11
sqlite3/tests/test-aux.c
Normal file
11
sqlite3/tests/test-aux.c
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#include "check.h"
|
||||||
|
|
||||||
|
#include <sqlite3.h>
|
||||||
|
|
||||||
|
void test_libversion(void) {
|
||||||
|
sqlite3_libversion();
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_libversion_number(void) {
|
||||||
|
sqlite3_libversion_number();
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user