Skip to content

Conversation

UnixY2K
Copy link
Contributor

@UnixY2K UnixY2K commented Dec 20, 2022

Description

Add an option to disable sqlite3_expanded_sql that disables the internal use of it inside the method Statement::getExpandedSQL so it gives a warning when building SQLiteCpp, at runtime it will give an exception instead

this should fix #213

changes

  • CMakeLists.txt: add the SQLITECPP_DISABLE_EXPANDED_SQL option along with the define SQLITECPP_DISABLE_EXPANDED_SQL
  • meson.build/meson.options: add the same SQLITECPP_DISABLE_EXPANDED_SQL that defines SQLITECPP_DISABLE_EXPANDED_SQL
  • Statement.cpp
    • give a warning at compile time if SQLITECPP_DISABLE_EXPANDED_SQL is not defined when running the version of sqlite < 3.14.0
    • give an exception when trying to run Statement::getExpandedSQL if compiled witouth support for sqlite3_expanded_sql

make sqlite3_expanded_sql use optional and give a warning at compile time
along with a exception at runtime when used in an application
@UnixY2K
Copy link
Contributor Author

UnixY2K commented Dec 20, 2022

I think that we could also add an special exception like SQLite::UnsupportedMethodException for any method that does not want to expose the internal implementation of sqlite3 and not make use of the same Exception used for internal SQLite3 Exceptions.

Edit:

I don´t think that this should be on this PR as is a potential refactor/change of how the API throws exceptions, making it easier to differentiate between internal errors and unsupported errors and how other applications handles it, for example app application showing that the support of cyphers or any optional feature is not supported on the system, but that is just a design idea

@SRombauts SRombauts merged commit bac9a8a into SRombauts:master Feb 2, 2023
@SRombauts
Copy link
Owner

Thanks

@UnixY2K UnixY2K deleted the optional-sqlite3_expanded_sql branch February 12, 2023 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SQLiteCpp/build/libSQLiteCpp.so: undefined reference to `sqlite3_expanded_sql'
2 participants