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

Print FTL version when calling the built in sqlite function only in interactive mode #1226

Merged
merged 2 commits into from
Oct 25, 2021

Conversation

yubiuser
Copy link
Member

  • 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?: {replace this text with a number from 1 to 10, with 1 being not familiar, and 10 being very familiar}

5

So far Pi-hole printed it's version string when calling the built-in SQLite engine also when not in interactive mode. This PR moves the printing function into sqlite's shell.c and prints right befor SQLite prints it's own version string.

Before:

rockpi@rockpi-4b:~$ pihole-FTL sqlite3 < test.sql 
Pi-hole FTL vDev-6f2fa93 2021-10-19 13:52:55 +0200
6|0|tom.vgwort.de|1|1579547648|1634041069|

After:

rockpi@rockpi-4b:~$ pihole-FTL sqlite3 < test.sql 
6|0|tom.vgwort.de|1|1579547648|1634041069|
rockpi@rockpi-4b:~$ pihole-FTL sqlite3
Pi-hole FTL vDev-4886d8e 2021-10-21 11:15:20 +0200
SQLite version 3.36.0 2021-06-18 18:36:39
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> 

@yubiuser
Copy link
Member Author

The only thing I'm not sure of is the big header in /scr/database/CMakeList.txt

This file has no dependencies on other code in the repo and takes a long time to build.

Because this is not true anymore, I added a dependency.

@yubiuser yubiuser added the PR: Code Review Required Open Pull Request, needs code reviewed label Oct 21, 2021
@DL6ER
Copy link
Member

DL6ER commented Oct 21, 2021

Yes, this is a bad thing. It basically means the entire SQLite3 library needs to be recompiled entry time. This pushes incremental builds from seconds to minutes. Since we have a lot of those during regular development, this is definitely a no-go. Furthermore, editing shell.c is another issue as the file will be overwritten with future updates of the embedded SQLite3 library. It is just very likely that we'll forget to re-add your changes.

src/database/shell.c Outdated Show resolved Hide resolved
@DL6ER DL6ER marked this pull request as draft October 23, 2021 12:33
@yubiuser yubiuser force-pushed the tweak/sql2 branch 2 times, most recently from 0337691 to 0bc77ad Compare October 24, 2021 18:39
@yubiuser yubiuser force-pushed the tweak/sql2 branch 3 times, most recently from 1979ca6 to 3cf635e Compare October 24, 2021 19:46
@yubiuser yubiuser marked this pull request as ready for review October 24, 2021 19:52
@DL6ER DL6ER merged commit 0ed94b2 into development Oct 25, 2021
@DL6ER DL6ER deleted the tweak/sql2 branch October 25, 2021 03:06
@DL6ER DL6ER mentioned this pull request Dec 20, 2021
5 tasks
@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-12-web-v5-9-and-core-v5-7-released/51795/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: Code Review Required Open Pull Request, needs code reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants