Skip to content

Commit 63e726d

Browse files
authored
Merge pull request #149 from psarna/createfu
parse: unconditionally support CREATE FUNCTION in the grammar
2 parents e9287e6 + 930be4c commit 63e726d

2 files changed

Lines changed: 22 additions & 2 deletions

File tree

src/build.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5810,4 +5810,26 @@ void libsql_drop_function(
58105810

58115811
sqlite3VdbeAddOp4(sqlite3GetVdbe(pParse), OP_DropWasmFunc, noErr, 0, 0, zName, P4_DYNAMIC);
58125812
}
5813+
5814+
#else
5815+
5816+
void libsql_create_function(
5817+
Parse *pParse, /* The parsing context */
5818+
Token *pName, /* Function name */
5819+
Token *pLang, /* Language of the function */
5820+
Token *pBody, /* Body of the function */
5821+
int isBlob, /* If the input token is blob */
5822+
int noErr /* Suppress error messages if FUNCTION already exists */
5823+
) {
5824+
sqlite3ErrorMsg(pParse, "Support for user-defined functions is not compiled-in. Try ./configure --enable-wasm-runtime");
5825+
}
5826+
5827+
void libsql_drop_function(
5828+
Parse *pParse, /* The parsing context */
5829+
Token *pName, /* Function name */
5830+
int noErr /* Suppress error messages if FUNCTION does not exist */
5831+
) {
5832+
sqlite3ErrorMsg(pParse, "Support for user-defined functions is not compiled-in. Try ./configure --enable-wasm-runtime");
5833+
}
5834+
58135835
#endif

src/parse.y

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,6 @@ cmd ::= DROP VIEW ifexists(E) fullname(X). {
492492
}
493493
%endif SQLITE_OMIT_VIEW
494494

495-
%ifdef LIBSQL_ENABLE_WASM_RUNTIME
496495
///////////////////// The CREATE FUNCTION statement /////////////////////////
497496
//
498497

@@ -510,7 +509,6 @@ cmd ::= createkw FUNCTION ifnotexists(E) nm(N) LANGUAGE nm(L) AS BLOB(B). {
510509
cmd ::= DROP FUNCTION ifexists(E) nm(N). {
511510
libsql_drop_function(pParse, &N, E);
512511
}
513-
%endif
514512

515513
//////////////////////// The SELECT statement /////////////////////////////////
516514
//

0 commit comments

Comments
 (0)