From 15c40f5ea3ed9bbd1d0d0a2dad804542b7615a5f Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Mon, 16 May 2022 19:12:22 -0700 Subject: [PATCH] Fix build error on linux --- README.md | 3 ++- src/javascript/jsc/bindings/sqlite/JSSQLStatement.cpp | 9 ++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 667754673d..9b36560e12 100644 --- a/README.md +++ b/README.md @@ -2044,7 +2044,8 @@ If you're on macOS, you will need to first use a custom SQLite install (you can import { Database } from "bun:sqlite"; // on macOS, this must be run before any other calls to `Database` -// if called on linux, it will return false and do nothing +// if called on linux, it will return true and do nothing +// on linux it will still check that a string was passed Database.setCustomSQLite("/path/to/sqlite.dylib"); var db = new Database(); diff --git a/src/javascript/jsc/bindings/sqlite/JSSQLStatement.cpp b/src/javascript/jsc/bindings/sqlite/JSSQLStatement.cpp index c19b736e5e..c39e2961e5 100644 --- a/src/javascript/jsc/bindings/sqlite/JSSQLStatement.cpp +++ b/src/javascript/jsc/bindings/sqlite/JSSQLStatement.cpp @@ -33,8 +33,9 @@ #ifdef LAZY_LOAD_SQLITE #include "lazy_sqlite3.h" #else -static void lazyLoadSQLite() +static inline int lazyLoadSQLite() { + return 0; } #endif @@ -336,10 +337,7 @@ JSC_DEFINE_HOST_FUNCTION(jsSQLStatementSetCustomSQLite, (JSC::JSGlobalObject * l return JSValue::encode(JSC::jsUndefined()); } -#ifndef LAZY_LOAD_SQLITE - RELEASE_AND_RETURN(scope, JSValue::encode(JSC::jsBoolean(false))); -#endif - +#ifdef LAZY_LOAD_SQLITE if (sqlite3_handle) { throwException(lexicalGlobalObject, scope, createError(lexicalGlobalObject, "SQLite already loaded\nThis function can only be called before SQLite has been loaded and exactly once. SQLite auto-loads when the first time you open a Database."_s)); return JSValue::encode(JSC::jsUndefined()); @@ -352,6 +350,7 @@ JSC_DEFINE_HOST_FUNCTION(jsSQLStatementSetCustomSQLite, (JSC::JSGlobalObject * l throwException(lexicalGlobalObject, scope, createError(lexicalGlobalObject, msg)); return JSValue::encode(JSC::jsUndefined()); } +#endif RELEASE_AND_RETURN(scope, JSValue::encode(JSC::jsBoolean(true))); }