1
0
Fork 0

Adding upstream version 1.30.0.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-04-21 09:44:08 +02:00
parent f9065f1bef
commit f38abee4bc
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
11 changed files with 125 additions and 17 deletions

View file

@ -151,11 +151,25 @@ output.null = "#808080"
# sql.whitespace = ''
# Favorite queries.
# You can add your favorite queries here. They will be available in the
# REPL when you type `\f` or `\f <query_name>`.
[favorite_queries]
check = 'select "✔"'
foo_args = 'SELECT $1, "$2", "$3"'
# example = "SELECT * FROM example_table WHERE id = 1"
# Initial commands to execute when connecting to any database.
[init-commands]
# read_only = "SET SESSION TRANSACTION READ ONLY"
global_limit = "set sql_select_limit=9999"
# Use the -d option to reference a DSN.
# Special characters in passwords and other strings can be escaped with URL encoding.
[alias_dsn]
# example_dsn = mysql://[user[:password]@][host][:port][/dbname]
# Initial commands to execute when connecting to a DSN alias.
[alias_dsn.init-commands]
# Define one or more SQL statements per alias (semicolon-separated).
# example_dsn = "SET sql_select_limit=1000; SET time_zone='+00:00'"

View file

@ -553,3 +553,14 @@ def test_init_command_multiple_arg(executor):
assert result.exit_code == 0
assert expected_sql_select_limit in result.output
assert expected_max_join_size in result.output
@dbtest
def test_global_init_commands(executor):
"""Tests that global init-commands from config are executed by default."""
# The global init-commands section in test/myclirc sets sql_select_limit=9999
sql = 'show variables like "sql_select_limit";'
runner = CliRunner()
result = runner.invoke(cli, args=CLI_ARGS, input=sql)
expected = "sql_select_limit\t9999\n"
assert result.exit_code == 0
assert expected in result.output

View file

@ -173,6 +173,13 @@ def test_favorite_query_expanded_output(executor):
assert_result_equal(results, status="test-ae: Deleted")
@dbtest
def test_collapsed_output_special_command(executor):
set_expanded_output(True)
run(executor, "select 1\\g")
assert is_expanded_output() is False
@dbtest
def test_special_command(executor):
results = run(executor, "\\?")