Added support for libSQL as an compatible alternative for SQLite. (0.33.0)
This commit is contained in:
parent
9416ec3457
commit
56712206d1
17 changed files with 418 additions and 5 deletions
32
src/vm/libsql/close.c
Normal file
32
src/vm/libsql/close.c
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* This file is part of the Fun programming language.
|
||||
* https://fun-lang.xyz/
|
||||
*
|
||||
* Copyright 2025 Johannes Findeisen <you@hanez.org>
|
||||
* Licensed under the terms of the Apache-2.0 license.
|
||||
* https://opensource.org/license/apache-2-0
|
||||
*
|
||||
* Added: 2025-11-26
|
||||
*/
|
||||
|
||||
/**
|
||||
* OP_LIBSQL_CLOSE: (handle:int) -> Nil
|
||||
*/
|
||||
case OP_LIBSQL_CLOSE: {
|
||||
#ifdef FUN_WITH_LIBSQL
|
||||
Value vh = pop_value(vm);
|
||||
int hid = (int)vh.i;
|
||||
free_value(vh);
|
||||
LibSqlHandle *h = libsql_reg_get(hid);
|
||||
if (h && h->db) {
|
||||
sqlite3_close(h->db);
|
||||
h->db = NULL;
|
||||
libsql_reg_del(hid);
|
||||
}
|
||||
push_value(vm, make_nil());
|
||||
#else
|
||||
Value v = pop_value(vm); free_value(v);
|
||||
push_value(vm, make_nil());
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue