-
-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extension Loading #200
base: master
Are you sure you want to change the base?
Extension Loading #200
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @ugursoy
Seems like the static checks pipeline fails 😢 Should be easy fix! 😄
Also:
- Would it be possible to squash your commits?
- Would it be possible to add the documentation to the
README.md
as well?
src/gdsqlite.cpp
Outdated
@@ -1,4 +1,5 @@ | |||
#include "gdsqlite.h" | |||
#include "godot_cpp/variant/utility_functions.hpp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This include is already defined in the header file... not necessary to include it a second time 😄
|
||
int rc; | ||
|
||
char *zErrMsg = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doc_classes/SQLite.xml
Outdated
<method name="enable_load_extension"> | ||
<return type="int" /> | ||
<description> | ||
Extension loading is disabled by default for security reasons. There are two ways to load an extension: C-API and SQL function. This method turns on both options. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a link to the SQLite documentation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do
doc_classes/SQLite.xml
Outdated
<method name="load_extension"> | ||
<return type="int" /> | ||
<description> | ||
Loads the extension in the given path. Does not require [method SQLite.enable_load_extension], as it only enables C-API during the call and disables it right after, utilizing the recommended extension loading method declared by the SQLite documentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you say that this "load_extension" does not require "enable_load_extension", but in the "enable_load_extension"-description you say that "load_extension" can only be used after enabling extension loading with this method? Which is it? 🥲
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, sorry for the headache :/ . My first commits are using the wrong (well not wrong but not recommended) method, thus I wrote their description in that way (still is true for that implementation though). But then I realized that the recommended way does not require it, so I changed the implementation and documentation. Latest commits should be the correct description/implementation.
I will squash the commits to clear the confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I've re-read that and I think I misunderstood what you meant.
In the doc, I say "SQL function load_extension() can only be used after enabling extension loading with this method."
This is the SQL function that you call in a query such as:
"""SELECT load_extension('extension.dll', 'sqlite3_extension_init');"""
and not the load_extension method in the Godot. If the user wants to use the query function, 'enable_load_extension' must be called prior since it is the only way to enable it.
On the other hand, Godot load_extension does not require it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f675553
to
4c04e22
Compare
Hey there, fixed them. |
201f88a
to
b58b354
Compare
SQLite presents an SQL function "load_extension()" for extension loading, but it is disabled by default for security.
These commits include two methods to achieve extension loading:
enable_load_extension: sets a flag that enables both C-API and SQL function (NOT recommended by SQLite documentation, see Security Warning section). But this is the only way for SQL function to work AFAIK.
load_extension: provides an interface for C-API. It enables C-API only and disables it afterwards.
Both methods basically call the corresponding sqlite3 functions with the given parameters, nothing fancy. Necessary explanations are also added into the documentation about how to use them.