Skip to content
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

Enable history and auto-completion for embedded SQLite3 engine #1282

Merged
merged 1 commit into from
Jan 13, 2022

Conversation

DL6ER
Copy link
Member

@DL6ER DL6ER commented Jan 12, 2022

By submitting this pull request, I confirm the following:

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • I have considered, and confirmed that this submission will be valuable to others.
  • I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  • I give this submission freely, and claim no ownership to its content.

How familiar are you with the codebase?:

10


See title. Everything was already configured correctly, we just needed to enable the feature. For the sake of simplicity, we use the history of sqlite3 so you can immediately use pihole-FTL sql with your recent history. Auto-completion is available though Tab, as usual.

@pralor-bot
Copy link

This pull request has been mentioned on Pi-hole Userspace. There might be relevant details there:

https://discourse.pi-hole.net/t/sqlite3-autocomplete/52530/2

Copy link
Member

@yubiuser yubiuser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add -DHAVE_READLINE and the -lreadline and -lncurses libraries to get command-line editing support.

https://www.sqlite.org/howtocompile.html

Do we have those "-lreadline and -lncurses libraries" inclueded?

@DL6ER
Copy link
Member Author

DL6ER commented Jan 12, 2022

Yes, ncurses isn't needed, readline is added here:

FTL/src/CMakeLists.txt

Lines 206 to 213 in 7387e81

find_library(LIBREADLINE NAMES libreadline${CMAKE_STATIC_LIBRARY_SUFFIX} readline)
find_library(LIBHISTORY NAMES libhistory${CMAKE_STATIC_LIBRARY_SUFFIX} history)
find_library(LIBTERMCAP NAMES libtermcap${CMAKE_STATIC_LIBRARY_SUFFIX} termcap)
if(LIBREADLINE AND LIBHISTORY AND LIBTERMCAP)
message(STATUS "Building FTL with readline support: YES")
target_compile_definitions(FTL PRIVATE LUA_USE_READLINE)
target_compile_definitions(pihole-FTL PRIVATE LUA_USE_READLINE)
target_link_libraries(pihole-FTL ${LIBREADLINE} ${LIBHISTORY} ${LIBTERMCAP})

Copy link
Member

@yubiuser yubiuser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. Please wait for feedback from discourse before merging.

@yubiuser
Copy link
Member

Reported to be working on discourse:
https://discourse.pi-hole.net/t/sqlite3-autocomplete/52530/4?u=yubiuser

@DL6ER DL6ER merged commit 231a78e into development Jan 13, 2022
@DL6ER DL6ER deleted the new/sqlite3_autocomplete branch January 13, 2022 15:34
@pralor-bot
Copy link

This pull request has been mentioned on Pi-hole Userspace. There might be relevant details there:

https://discourse.pi-hole.net/t/pi-hole-ftl-v5-14-web-v5-11-and-core-v5-9-released/53529/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants