Skip to content

Conversation

@tanloong
Copy link
Contributor

@tanloongtanloong commented May 5, 2025

Copy link
Member

@serhiy-storchakaserhiy-storchaka left a comment

Choose a reason for hiding this comment

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

The sqlite3 CLI supports also space after dot:

sqlite> . version SQLite 3.45.1 2024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257ccalt1 zlib version 1.3 gcc-13.3.0 (64-bit) 

But not before dot:

sqlite> .version ...> 

To be conforming with it, we should check if the first character is a dot, and if it is, use source[1:].strip() as the command. No stripping is needed for the SQL statement.

@tanloongtanloongforce-pushed the sqlite3-cli-strip-whitespaces branch from 0d89da8 to 3543c33CompareMay 9, 2025 08:19
@tanloong
Copy link
ContributorAuthor

Thank you for your review! I have modified the code to use source[1:].strip() as dot command, no stripping for SQL statement.

@tanloongtanloongforce-pushed the sqlite3-cli-strip-whitespaces branch from 3543c33 to a4498abCompareMay 9, 2025 08:24
@tanloongtanloongforce-pushed the sqlite3-cli-strip-whitespaces branch from cbea2b1 to 487aafcCompareMay 9, 2025 09:50
@tanloongtanloongforce-pushed the sqlite3-cli-strip-whitespaces branch from 487aafc to b473fe9CompareMay 9, 2025 09:52
@tanloong
Copy link
ContributorAuthor

Sorry for the overlook, now the empty source and unknown dot commands are handled. I have improved the news entry.

@tanloongtanloongforce-pushed the sqlite3-cli-strip-whitespaces branch from 36b4a16 to caf47bcCompareMay 9, 2025 11:07
Copy link
Member

@serhiy-storchakaserhiy-storchaka left a comment

Choose a reason for hiding this comment

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

LGTM. 👍

@serhiy-storchakaserhiy-storchaka enabled auto-merge (squash) May 9, 2025 11:11
@serhiy-storchakaserhiy-storchaka added the needs backport to 3.14 bugs and security fixes label May 9, 2025
auto-merge was automatically disabled May 9, 2025 11:13

Head branch was pushed to by a user without write access

@serhiy-storchakaserhiy-storchaka enabled auto-merge (squash) May 9, 2025 11:15
@serhiy-storchakaserhiy-storchaka merged commit ebd4881 into python:mainMay 9, 2025
39 checks passed
@miss-islington-app
Copy link

Thanks @tanloong for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 9, 2025
…or multi-line sqlite statements in the sqlite3 command-line interface (pythonGH-133440) (cherry picked from commit ebd4881) Co-authored-by: Tan Long <[email protected]>
@bedevere-app
Copy link

GH-133738 is a backport of this pull request to the 3.14 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.14 bugs and security fixes label May 9, 2025
@picnixz
Copy link
Member

@serhiy-storchaka no 3.13 backports?

serhiy-storchaka pushed a commit that referenced this pull request May 9, 2025
…for multi-line sqlite statements in the sqlite3 command-line interface (GH-133440) (GH-133738) (cherry picked from commit ebd4881) Co-authored-by: Tan Long <[email protected]>
@serhiy-storchaka
Copy link
Member

This is borderline between minor bug fix and minor feature. It improves the quality of life a little, but most people won't notice anything. If anyone wants to backport to 3.13, please do. If not, no problem either.

@tanloong
Copy link
ContributorAuthor

I will do that.

@bedevere-app
Copy link

GH-133765 is a backport of this pull request to the 3.13 branch.

@serhiy-storchaka
Copy link
Member

@tanloong, I meant any of the core developers. It's as simple as adding a label. Someone just has to want to do it.

@tanloong
Copy link
ContributorAuthor

Ah, sorry, I misunderstood.

tanloong added a commit to tanloong/cpython that referenced this pull request May 9, 2025
…or multi-line sqlite statements in the sqlite3 command-line interface (pythonGH-133440) (cherry picked from commit ebd4881)
pass
case _ as unknown:
self.write("Error: unknown command or invalid arguments:"
f' "{unknown}".\n')

Choose a reason for hiding this comment

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

Error messages do not end with a '.' e.g.:

Python 3.15.0a0 (heads/main:c81fa2b9cd1, May 8 2025, 16:38:25) [GCC 15.1.1 20250425 (Red Hat 15.1.1-1)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> test Traceback (most recent call last): File "<python-input-0>", line 1, in <module> test NameError: name 'test' is not defined 

serhiy-storchaka pushed a commit that referenced this pull request Jun 13, 2025
…for multi-line sqlite statements in the sqlite3 command-line interface (GH-133440) (GH-133765) (cherry picked from commit ebd4881)
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
…or multi-line sqlite statements in the sqlite3 command-line interface (pythonGH-133440)
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request Aug 4, 2025
…or multi-line sqlite statements in the sqlite3 command-line interface (pythonGH-133440)
Sign up for freeto 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.

5 participants

@tanloong@picnixz@serhiy-storchaka@erlend-aasland@StanFromIreland