From 1fdc150116cad39aae5c5da407c3312b47a59e3a Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Fri, 17 Dec 2021 07:06:30 -0500 Subject: New upstream version 3.3.3+dfsg1. --- SQLiteStudio3/sqlitestudiocli/cli.cpp | 6 +- SQLiteStudio3/sqlitestudiocli/clicommandsyntax.cpp | 4 +- SQLiteStudio3/sqlitestudiocli/clicompleter.cpp | 6 +- .../sqlitestudiocli/commands/clicommand.cpp | 34 ++--- .../sqlitestudiocli/commands/clicommandsql.cpp | 3 +- .../sqlitestudiocli/commands/clicommandtables.cpp | 2 +- .../sqlitestudiocli/commands/clicommandtree.cpp | 2 +- SQLiteStudio3/sqlitestudiocli/main.cpp | 3 +- SQLiteStudio3/sqlitestudiocli/sqlitestudiocli.pro | 2 +- .../translations/sqlitestudiocli_zh_CN.ts | 138 +++++++++++---------- 10 files changed, 94 insertions(+), 106 deletions(-) (limited to 'SQLiteStudio3/sqlitestudiocli') diff --git a/SQLiteStudio3/sqlitestudiocli/cli.cpp b/SQLiteStudio3/sqlitestudiocli/cli.cpp index 90c8d5e..30bf175 100644 --- a/SQLiteStudio3/sqlitestudiocli/cli.cpp +++ b/SQLiteStudio3/sqlitestudiocli/cli.cpp @@ -197,12 +197,8 @@ bool CLI::isComplete(const QString& contents) const if (contents.startsWith(CFG_CLI.Console.CommandPrefixChar.get())) return true; - Dialect dialect = Dialect::Sqlite3; - if (getCurrentDb()) - dialect = getCurrentDb()->getDialect(); - bool complete = true; - splitQueries(contents, dialect, true, false, &complete); + splitQueries(contents, true, false, &complete); return complete; } diff --git a/SQLiteStudio3/sqlitestudiocli/clicommandsyntax.cpp b/SQLiteStudio3/sqlitestudiocli/clicommandsyntax.cpp index a473c5d..cfe8483 100644 --- a/SQLiteStudio3/sqlitestudiocli/clicommandsyntax.cpp +++ b/SQLiteStudio3/sqlitestudiocli/clicommandsyntax.cpp @@ -297,7 +297,7 @@ bool CliCommandSyntax::isArgumentSet(int id) const QString CliCommandSyntax::getArgument(int id) const { if (!argumentMap.contains(id)) - return QString::null; + return QString(); return argumentMap[id]->value; } @@ -313,7 +313,7 @@ bool CliCommandSyntax::isOptionSet(int id) const QString CliCommandSyntax::getOptionValue(int id) const { if (!optionMap.contains(id)) - return QString::null; + return QString(); return optionMap[id]->value; } diff --git a/SQLiteStudio3/sqlitestudiocli/clicompleter.cpp b/SQLiteStudio3/sqlitestudiocli/clicompleter.cpp index 3d6dcb0..4ad54be 100644 --- a/SQLiteStudio3/sqlitestudiocli/clicompleter.cpp +++ b/SQLiteStudio3/sqlitestudiocli/clicompleter.cpp @@ -142,11 +142,7 @@ QStringList CliCompleter::completeQuery(const QString& toBeReplaced, const QStri bool CliCompleter::doKeepOriginalStr(const QString& str, int curPos) { - Dialect dialect = Dialect::Sqlite3; - if (cli->getCurrentDb()) - dialect = cli->getCurrentDb()->getDialect(); - - TokenList tokens = Lexer::tokenize(str.mid(0, curPos), dialect); + TokenList tokens = Lexer::tokenize(str.mid(0, curPos)); if (tokens.size() == 0) return false; diff --git a/SQLiteStudio3/sqlitestudiocli/commands/clicommand.cpp b/SQLiteStudio3/sqlitestudiocli/commands/clicommand.cpp index 20f180e..e23a042 100644 --- a/SQLiteStudio3/sqlitestudiocli/commands/clicommand.cpp +++ b/SQLiteStudio3/sqlitestudiocli/commands/clicommand.cpp @@ -147,14 +147,12 @@ QStringList CliCommand::getCompletionTables() if (!cli->getCurrentDb()) return results; - Dialect dialect = Dialect::Sqlite3; - SchemaResolver resolver(cli->getCurrentDb()); resolver.setIgnoreSystemObjects(true); - results += wrapObjNamesIfNeeded(resolver.getTables(), dialect); - results += prefixEach("temp.", wrapObjNamesIfNeeded(resolver.getTables("temp"), dialect)); + results += wrapObjNamesIfNeeded(resolver.getTables()); + results += prefixEach("temp.", wrapObjNamesIfNeeded(resolver.getTables("temp"))); for (const QString& database : resolver.getDatabases()) - results += prefixEach(wrapObjIfNeeded(database, Dialect::Sqlite3)+".", wrapObjNamesIfNeeded(resolver.getTables(database), dialect)); + results += prefixEach(wrapObjIfNeeded(database)+".", wrapObjNamesIfNeeded(resolver.getTables(database))); return results; } @@ -165,14 +163,12 @@ QStringList CliCommand::getCompletionIndexes() if (!cli->getCurrentDb()) return results; - Dialect dialect = Dialect::Sqlite3; - SchemaResolver resolver(cli->getCurrentDb()); resolver.setIgnoreSystemObjects(true); - results += wrapObjNamesIfNeeded(resolver.getIndexes(), dialect); - results += prefixEach("temp.", wrapObjNamesIfNeeded(resolver.getIndexes("temp"), dialect)); + results += wrapObjNamesIfNeeded(resolver.getIndexes()); + results += prefixEach("temp.", wrapObjNamesIfNeeded(resolver.getIndexes("temp"))); for (const QString& database : resolver.getDatabases()) - results += prefixEach(wrapObjIfNeeded(database, Dialect::Sqlite3)+".", wrapObjNamesIfNeeded(resolver.getIndexes(database), dialect)); + results += prefixEach(wrapObjIfNeeded(database)+".", wrapObjNamesIfNeeded(resolver.getIndexes(database))); return results; } @@ -183,14 +179,12 @@ QStringList CliCommand::getCompletionTriggers() if (!cli->getCurrentDb()) return results; - Dialect dialect = Dialect::Sqlite3; - SchemaResolver resolver(cli->getCurrentDb()); resolver.setIgnoreSystemObjects(true); - results += wrapObjNamesIfNeeded(resolver.getTriggers(), dialect); - results += prefixEach("temp.", wrapObjNamesIfNeeded(resolver.getTriggers("temp"), dialect)); + results += wrapObjNamesIfNeeded(resolver.getTriggers()); + results += prefixEach("temp.", wrapObjNamesIfNeeded(resolver.getTriggers("temp"))); for (const QString& database : resolver.getDatabases()) - results += prefixEach(wrapObjIfNeeded(database, Dialect::Sqlite3)+".", wrapObjNamesIfNeeded(resolver.getTriggers(database), dialect)); + results += prefixEach(wrapObjIfNeeded(database)+".", wrapObjNamesIfNeeded(resolver.getTriggers(database))); return results; } @@ -201,14 +195,12 @@ QStringList CliCommand::getCompletionViews() if (!cli->getCurrentDb()) return results; - Dialect dialect = Dialect::Sqlite3; - SchemaResolver resolver(cli->getCurrentDb()); resolver.setIgnoreSystemObjects(true); - results += wrapObjNamesIfNeeded(resolver.getViews(), dialect); - results += prefixEach("temp.", wrapObjNamesIfNeeded(resolver.getViews("temp"), dialect)); + results += wrapObjNamesIfNeeded(resolver.getViews()); + results += prefixEach("temp.", wrapObjNamesIfNeeded(resolver.getViews("temp"))); for (const QString& database : resolver.getDatabases()) - results += prefixEach(wrapObjIfNeeded(database, Dialect::Sqlite3)+".", wrapObjNamesIfNeeded(resolver.getViews(database), dialect)); + results += prefixEach(wrapObjIfNeeded(database)+".", wrapObjNamesIfNeeded(resolver.getViews(database))); return results; } @@ -274,7 +266,7 @@ QStringList CliCommand::getCompletionInternalDbs() return results; SchemaResolver resolver(cli->getCurrentDb()); - results += resolver.getDatabases().toList(); + results += resolver.getDatabases().values(); results << "main" << "temp"; results.sort(Qt::CaseInsensitive); return results; diff --git a/SQLiteStudio3/sqlitestudiocli/commands/clicommandsql.cpp b/SQLiteStudio3/sqlitestudiocli/commands/clicommandsql.cpp index 4b66592..cb89dfe 100644 --- a/SQLiteStudio3/sqlitestudiocli/commands/clicommandsql.cpp +++ b/SQLiteStudio3/sqlitestudiocli/commands/clicommandsql.cpp @@ -8,6 +8,7 @@ #include "common/unused.h" #include "cli_config.h" #include "cliutils.h" +#include "common/compatibility.h" #include #include @@ -290,7 +291,7 @@ void CliCommandSql::shrinkColumns(QList& colu previousTotalWidth = totalWidth; // Sort columns by current widths - qSort(columnWidths); + sSort(columnWidths); // See if we can shrink headers only, or we already need to shrink the data for (SortedColumnWidth* colWidth : columnWidths) diff --git a/SQLiteStudio3/sqlitestudiocli/commands/clicommandtables.cpp b/SQLiteStudio3/sqlitestudiocli/commands/clicommandtables.cpp index 8a8f5dc..8f79e82 100644 --- a/SQLiteStudio3/sqlitestudiocli/commands/clicommandtables.cpp +++ b/SQLiteStudio3/sqlitestudiocli/commands/clicommandtables.cpp @@ -41,7 +41,7 @@ void CliCommandTables::execute() dbList << "main" << "temp"; dbList += resolver.getDatabases(); - int width = longest(dbList.toList()).length(); + int width = longest(dbList.values()).length(); width = qMax(width, tr("Database").length()); println(pad(tr("Database"), width, ' ') + " " + tr("Table")); diff --git a/SQLiteStudio3/sqlitestudiocli/commands/clicommandtree.cpp b/SQLiteStudio3/sqlitestudiocli/commands/clicommandtree.cpp index c99fe66..0fc359e 100644 --- a/SQLiteStudio3/sqlitestudiocli/commands/clicommandtree.cpp +++ b/SQLiteStudio3/sqlitestudiocli/commands/clicommandtree.cpp @@ -27,7 +27,7 @@ void CliCommandTree::execute() else { databases << "main" << "temp"; - databases += resolver.getDatabases().toList(); + databases += resolver.getDatabases().values(); } AsciiTree tree; diff --git a/SQLiteStudio3/sqlitestudiocli/main.cpp b/SQLiteStudio3/sqlitestudiocli/main.cpp index 7a126e3..3ffc2e3 100644 --- a/SQLiteStudio3/sqlitestudiocli/main.cpp +++ b/SQLiteStudio3/sqlitestudiocli/main.cpp @@ -46,13 +46,14 @@ QString cliHandleCmdLineArgs() if (args.size() > 0) return args[0]; - return QString::null; + return QString(); } int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); QCoreApplication::setApplicationName("SQLiteStudio"); + QCoreApplication::setOrganizationName("SalSoft"); QCoreApplication::setApplicationVersion(SQLITESTUDIO->getVersionString()); qInstallMessageHandler(cliMessageHandler); diff --git a/SQLiteStudio3/sqlitestudiocli/sqlitestudiocli.pro b/SQLiteStudio3/sqlitestudiocli/sqlitestudiocli.pro index 6583172..e32eca3 100644 --- a/SQLiteStudio3/sqlitestudiocli/sqlitestudiocli.pro +++ b/SQLiteStudio3/sqlitestudiocli/sqlitestudiocli.pro @@ -19,7 +19,7 @@ CONFIG -= app_bundle TEMPLATE = app -CONFIG += c++11 +CONFIG += c++17 QMAKE_CXXFLAGS += -pedantic linux { portable { diff --git a/SQLiteStudio3/sqlitestudiocli/translations/sqlitestudiocli_zh_CN.ts b/SQLiteStudio3/sqlitestudiocli/translations/sqlitestudiocli_zh_CN.ts index 7cf3e27..ab95a5d 100644 --- a/SQLiteStudio3/sqlitestudiocli/translations/sqlitestudiocli_zh_CN.ts +++ b/SQLiteStudio3/sqlitestudiocli/translations/sqlitestudiocli_zh_CN.ts @@ -57,7 +57,7 @@ adds new database to the list - + 添加新的数据库到列表 @@ -74,7 +74,7 @@ path CLI command syntax - + 路径 @@ -92,7 +92,7 @@ changes current working directory - + 更改当前工作目录 @@ -103,7 +103,7 @@ path CLI command syntax - + 路径 @@ -117,17 +117,17 @@ Connection to database %1 closed. - + 数据库 %1 的连接已关闭。 No such database: %1. Use %2 to see list of known databases. - + 没有这样的数据库:%1。使用 %2 去查看已知数据库列表。 closes given (or current) database - + 关闭给定的(或当前)数据库 @@ -138,7 +138,7 @@ name CLI command syntax - + 名称 @@ -151,46 +151,46 @@ Databases: - + 数据库: Name CLI db name column - + 名称 Open CLI connection state column - + 打开 Closed CLI connection state column - + 关闭 Connection CLI connection state column - + 连接 Database file path - + 数据库文件路径 prints list of registered databases - + 打印已注册数据库列表 @@ -210,12 +210,12 @@ Call %2 to see list of all databases. Database is not open. - + 数据库未被打开。 Cannot find table named: %1 - + 无法找到名为 %1 的表 @@ -230,22 +230,22 @@ Call %2 to see list of all databases. Table: %1 - + 表:%1 Column name - + 字段名 Data type - + 数据类型 Constraints - + 约束条件 @@ -268,7 +268,7 @@ Call %2 to see list of all databases. lists directories and files in current working directory - + 列出当前工作目录中的目录与文件 @@ -293,7 +293,7 @@ You can pass <pattern> with wildcard characters to filter output. Quits the application. Settings are stored in configuration file and will be restored on next startup. - + 退出本程序。设置已被存储在配置文件并且会在下一次启动时恢复。 @@ -301,7 +301,7 @@ You can pass <pattern> with wildcard characters to filter output. shows this help message - + 显示这个帮助信息 @@ -317,27 +317,27 @@ You can always execute any command with exactly single '--help' option command CLI command syntax - + 命令 No such command: %1 - + 没有这个命令:%1 Type '%1' for list of available commands. - + 输入 '%1' 列出所有可用的命令。 Usage: %1%2 - 用法: %1%2 + 用法: %1%2 Aliases: %1 - + 别名:%1 @@ -350,7 +350,7 @@ You can always execute any command with exactly single '--help' option prints history or erases it - + 打印历史或擦除它 @@ -369,12 +369,12 @@ Use -ql or --querylimit option to see the current limit value. Console history erased. - + 控制台历史已擦除。 Invalid number: %1 - + 无效的数字:%1 @@ -387,17 +387,17 @@ Use -ql or --querylimit option to see the current limit value. Current results printing mode: %1 - + 当前结果打印模式:%1 Invalid results printing mode: %1 - + 无效结果打印模式:%1 New results printing mode: %1 - + 新结果打印模式:%1 @@ -451,22 +451,22 @@ The ROW mode is recommended if you need to see whole values and you don't e Could not add database %1 to list. - 未能将数据库“%1”添加到列表。 + 未能将数据库“%1”添加到列表。 File %1 doesn't exist in %2. Cannot open inexisting database with %3 command. To create a new database, use %4 command. - + 文件 %1 不存在于 %2。无法使用 %3 命令打开不存在的数据库。使用 %4 命令创建一个新数据库。 Database %1 has been open and set as the current working database. - + 数据库 %1 已被打开并设为当前工作数据库。 opens database connection - + 打开数据库连接 @@ -477,13 +477,13 @@ The ROW mode is recommended if you need to see whole values and you don't e name CLI command syntax - + 名称 path CLI command syntax - + 路径 @@ -491,7 +491,7 @@ The ROW mode is recommended if you need to see whole values and you don't e prints the current working directory - + 打印当前工作目录 @@ -504,7 +504,7 @@ The ROW mode is recommended if you need to see whole values and you don't e No such database: %1 - + 没有这样一个数据库:%1 @@ -519,7 +519,7 @@ The ROW mode is recommended if you need to see whole values and you don't e removes database from the list - + 从列表中移除数据库 @@ -530,7 +530,7 @@ The ROW mode is recommended if you need to see whole values and you don't e name CLI command syntax - + 名称 @@ -540,17 +540,19 @@ The ROW mode is recommended if you need to see whole values and you don't e No working database is set. Call %1 command to set working database. Call %2 to see list of all databases. - + 没有设置工作数据库。 +调用 %1 命令去设置工作数据库。 +调用 %2 去浏览所有数据库列表。 Database is not open. - + 数据库没有打开。 executes SQL query - + 执行 SQL 查询 @@ -561,7 +563,7 @@ Call %2 to see list of all databases. sql CLI command syntax - + sql @@ -572,12 +574,12 @@ Call %2 to see list of all databases. Row %1 - + 行 %1 Query execution error: %1 - + 查询执行错误:%1 @@ -585,7 +587,7 @@ Call %2 to see list of all databases. No such database: %1. Use %2 to see list of known databases. - + 没有这样一个数据库:%1。使用 %2 去查看已知的数据库列表。 @@ -595,23 +597,23 @@ Call %2 to see list of all databases. Database %1 is closed. - + 数据库已被关闭 Database - + 数据库 Table - + prints list of tables in the database - + 列出数据库中的所有表 @@ -623,7 +625,7 @@ When the -s option is given, then system tables are also listed. database CLI command syntax - + 数据库 @@ -636,28 +638,28 @@ When the -s option is given, then system tables are also listed. Tables - + Views - + 视图 Columns - + 字段 Indexes - + 索引 Triggers - + 触发器 @@ -684,17 +686,17 @@ The database argument is optional and if provided, then only given database will Current database: %1 - 当前数据库:%1 + 当前数据库:%1 No such database: %1 - + 没有这样一个数据库:%1 changes default working database - + 更改默认工作数据库 @@ -715,7 +717,7 @@ The default database can be selected in various ways: name CLI command syntax - + 名称 @@ -728,7 +730,7 @@ The default database can be selected in various ways: Too many arguments. - + 参数过多。 @@ -777,7 +779,7 @@ Expected one of: %2 file - + 文件 -- cgit v1.2.3