Skip to content

Commit

Permalink
Merged from 3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelsalawa committed Jan 16, 2025
2 parents cd936bf + 2cee121 commit 9efb021
Show file tree
Hide file tree
Showing 20 changed files with 208 additions and 40 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/lin_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ on:
description: 'Use ccache (for workflow debugging only!)'
required: false
type: boolean
DEBUG:
description: 'Enable workflow debug messages'
required: false
type: boolean
default: false
schedule:
- cron: '30 3 * * 1' # run at 3:30 AM UTC every Monday
repository_dispatch:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/mac_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ on:
description: 'Use ccache (for workflow debugging only!)'
required: false
type: boolean
DEBUG:
description: 'Enable workflow debug messages'
required: false
type: boolean
default: false
schedule:
- cron: '0 3 * * 1' # run at 3 AM UTC every Monday
repository_dispatch:
Expand Down
21 changes: 14 additions & 7 deletions .github/workflows/prepare_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ on:
required: false
type: boolean
default: false
DEBUG:
description: 'Enable workflow debug messages'
required: false
type: boolean
default: false

jobs:
build:
Expand All @@ -62,18 +67,20 @@ jobs:
shell: bash
if: inputs.RUN_IDS_TO_USE == ''
run: |
WORKFLOWS=()
for key in $(echo ${{ env.RELEASE_META }} | jq -r 'keys[]')
do
WORKFLOWS+=($key.yml)
done
WORKFLOWS=($(echo "$RELEASE_META" | jq -r 'keys[]'))
echo "WORKFLOWS=${WORKFLOWS[@]}" >> $GITHUB_ENV
run_ids=()
inputs='{}'
inputs="{}"
if [ "${DEBUG}" = "true" ]
then
inputs=$(echo $inputs | jq -c '.DEBUG = "true"')
fi
for wname in $WORKFLOWS
do
run_id=$($SCRIPTS/run_workflow.sh $wname $inputs "${{ github.ref_name }}")
run_id=$($SCRIPTS/run_workflow.sh $wname "$inputs" "${{ github.ref_name }}")
run_ids+=( $run_id )
done
echo "CHILD_IDS=${run_ids[@]}" >> $GITHUB_ENV
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/win32_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ on:
description: 'Use ccache (for workflow debugging only!)'
required: false
type: boolean
DEBUG:
description: 'Enable workflow debug messages'
required: false
type: boolean
default: false
schedule:
- cron: '30 2 * * 1' # run at 2 AM UTC every Monday
repository_dispatch:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/win64_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ on:
description: 'Use ccache (for workflow debugging only!)'
required: false
type: boolean
DEBUG:
description: 'Enable workflow debug messages'
required: false
type: boolean
default: false
schedule:
- cron: '0 2 * * 1' # run at 2 AM UTC every Monday
repository_dispatch:
Expand Down
3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@
- ADDED: #5190 Added support for optional ORDER BY and LIMIT clauses in UPDATE and DELETE statements.
- ADDED: #5190 Added support for AS clause in INSERT, UPDATE and DELETE statements.
- CHANGE: #5187 Backported compilation improvement for ScriptingPython to allow Python version selection through qmake parameter.
- CHANGE: #5214 Database list item selection is retained in the session for the next application start.
- BUGFIX: #5190 Improved code assistant suggestions for UPDATE to pripritize more relevant columns.
- BUGFIX: #5207 Fixed SQL parser to avoid marking INDEXED BY as syntax error.
- BUGFIX: #5189 Fixed execution of SELECT queries that use subselects with a STAR operator for result columns (in these subselects), so they return correct results.
- BUGFIX: Fixed execution of complex SELECT queries with subselects, that join multiple tables, some with aliases, some without aliases. Results from such queries would not be editable at all. Now they execute properly using the Smart Execution method.
- BUGFIX: #4987 MultiEditor dialog (i.e. hex editor dialog) now remembers size that user sets for it.
- BUGFIX: #5191 Fixed Enterprise Formatter in case when it's configured to avoid whitespaces before binary operator and the AND keyword appears in formatted query.

### 3.4.13
- BUGFIX: #5183 Fixed completer proposals in the column names of the INSERT INTO statement.
Expand Down
7 changes: 6 additions & 1 deletion Plugins/SqlEnterpriseFormatter/formatexpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "parser/ast/sqliteraise.h"
#include "parser/ast/sqlitefilterover.h"
#include "sqlenterpriseformatter.h"
#include "common/utils_sql.h"

QRegularExpression FormatExpr::WORD_ONLY_RE = QRegularExpression("^[a-zA-Z]+$");

Expand Down Expand Up @@ -68,7 +69,11 @@ void FormatExpr::formatInternal()

// Operator can be a keyword
QString opStr = cfg->SqlEnterpriseFormatter.UppercaseKeywords.get() ? expr->binaryOp.toUpper() : expr->binaryOp.toLower();
withStatement(expr->expr1, "binaryOp1").withOperator(opStr);
withStatement(expr->expr1, "binaryOp1");
if (WORD_ONLY_RE.match(opStr).hasMatch())
withKeyword(opStr);
else
withOperator(opStr);

if (multiLine)
withNewLine().withIncrIndent("binaryOp1");
Expand Down
2 changes: 1 addition & 1 deletion Plugins/SqlEnterpriseFormatter/sqlenterpriseformatter.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"type": "CodeFormatterPlugin",
"title": "SQL Enterprise",
"description": "Advanced SQL formatter.",
"version": 10007,
"version": 10008,
"author": "SalSoft"
}
6 changes: 3 additions & 3 deletions Plugins/SqlEnterpriseFormatter/sqlenterpriseformatter.ui
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</sizepolicy>
</property>
<property name="currentIndex">
<number>4</number>
<number>0</number>
</property>
<widget class="QWidget" name="indentTab">
<attribute name="title">
Expand Down Expand Up @@ -135,7 +135,7 @@
<x>0</x>
<y>0</y>
<width>576</width>
<height>420</height>
<height>392</height>
</rect>
</property>
<property name="styleSheet">
Expand Down Expand Up @@ -367,7 +367,7 @@
<x>0</x>
<y>0</y>
<width>576</width>
<height>390</height>
<height>364</height>
</rect>
</property>
<property name="styleSheet">
Expand Down
24 changes: 12 additions & 12 deletions SQLiteStudio3/coreSQLiteStudio/common/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -358,32 +358,32 @@ QList<T> map(const QList<S>& list, std::function<T(S)> transformer)
return result;
}

template <class K, class V>
QHash<K, V> toHash(const QList<V>& list, std::function<K(V)> transformer)
template <class S, class T>
QSet<T> map(const QSet<S>& set, std::function<T(S)> transformer)
{
QHash<K, V> result;
for (const V& el : list)
result[el] = transformer(el);
QSet<T> result;
for (const S& el : set)
result << transformer(el);

return result;
}

template <class K, class V>
QHash<K, V> toHash(const QSet<V>& list, std::function<K(V)> transformer)
QHash<K, V> toHash(const QList<V>& list, std::function<K(V)> transformer)
{
QHash<K, V> result;
for (const V& el : list)
result[el] = transformer(el);
result[transformer(el)] = el;

return result;
}

template <class S, class T>
QSet<T> map(const QSet<S>& set, std::function<T(S)> transformer)
template <class K, class V>
QHash<K, V> toHash(const QSet<V>& list, std::function<K(V)> transformer)
{
QSet<T> result;
for (const S& el : set)
result << transformer(el);
QHash<K, V> result;
for (const V& el : list)
result[transformer(el)] = el;

return result;
}
Expand Down
7 changes: 6 additions & 1 deletion SQLiteStudio3/guiSQLiteStudio/common/dialogsizehandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <QWidget>
#include <QScreen>
#include <QGuiApplication>
#include <QDebug>

DialogSizeHandler::DialogSizeHandler(QObject *parent) :
DialogSizeHandler(parent->objectName(), parent)
Expand Down Expand Up @@ -33,7 +34,11 @@ DialogSizeHandler::~DialogSizeHandler()

void DialogSizeHandler::applyFor(QObject *parent)
{
applyFor(parent->objectName(), parent);
QString key = parent->objectName();
if (key.isEmpty())
key = parent->metaObject()->className();

applyFor(key, parent);
}

void DialogSizeHandler::applyFor(const QString &key, QObject *parent)
Expand Down
12 changes: 9 additions & 3 deletions SQLiteStudio3/guiSQLiteStudio/dbtree/dbtree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -645,20 +645,26 @@ void DbTree::initDndTypes()
QVariant DbTree::saveSession()
{
treeModel->storeGroups();
return QVariant();

QHash<QString, QVariant> session;
session["selectionState"] = treeModel->collectSelectionState();
return session;
}

void DbTree::restoreSession(const QVariant& sessionValue)
{
UNUSED(sessionValue);
QHash<QString, QVariant> session = sessionValue.toHash();
QHash<QString, QVariant> selectionState = session["selectionState"].toHash();
if (!selectionState.isEmpty())
treeModel->restoreSelectionState(selectionState);
}

DbTreeModel* DbTree::getModel() const
{
return treeModel;
}

DbTreeView*DbTree::getView() const
DbTreeView* DbTree::getView() const
{
return ui->treeView;
}
Expand Down
39 changes: 33 additions & 6 deletions SQLiteStudio3/guiSQLiteStudio/dbtree/dbtreeitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,13 @@ QString DbTreeItem::getView() const
return item->text();
}

void DbTreeItem::setData(const QVariant& value, int role)
{
QStandardItem::setData(value, role);
if (role == Qt::DisplayRole)
updateSignatureValue();
}

QStandardItem *DbTreeItem::parentItem() const
{
if (!QStandardItem::parent())
Expand Down Expand Up @@ -198,14 +205,29 @@ void DbTreeItem::getPathToRoot(QList<DbTreeItem *> &path)
parentDbTreeItem()->getPathToRoot(path);
}

QString DbTreeItem::signature() const
QString DbTreeItem::pathSignature() const
{
return pathSignatureParts().join("_");
}

QStringList DbTreeItem::pathSignatureParts() const
{
QStringList parts;
pathSignatureParts(parts);
return parts;
}

void DbTreeItem::pathSignatureParts(QStringList& parts) const
{
QString sig;
if (parentDbTreeItem())
sig += parentDbTreeItem()->signature() + "_";
parentDbTreeItem()->pathSignatureParts(parts);

parts += signature();
}

sig += QString::number(type()) + "." + QString::fromLatin1(text().toUtf8().toBase64());
return sig;
QString DbTreeItem::signature() const
{
return signatureValueOfThis;
}

void DbTreeItem::getPathToParentItem(QList<DbTreeItem*>& path, DbTreeItem::Type type)
Expand Down Expand Up @@ -240,6 +262,11 @@ const DbTreeItem* DbTreeItem::getParentItem(DbTreeItem::Type type) const
return nullptr;
}

void DbTreeItem::updateSignatureValue()
{
signatureValueOfThis = QString::number(type()) + "." + QString::fromLatin1(text().toUtf8().toBase64());
}

Db* DbTreeItem::getDb() const
{
QString dbName = data(DataRole::DB).toString();
Expand Down Expand Up @@ -328,7 +355,7 @@ void DbTreeItem::init()

QDataStream &operator <<(QDataStream &out, const DbTreeItem *item)
{
out << item->signature();
out << item->pathSignature();
return out;
}

Expand Down
8 changes: 7 additions & 1 deletion SQLiteStudio3/guiSQLiteStudio/dbtree/dbtreeitem.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class GUI_API_EXPORT DbTreeItem : public QObject, public QStandardItem
QString getIndex() const;
QString getTrigger() const;
QString getView() const;
void setData(const QVariant& value, int role);

/**
* @brief parentItem
Expand All @@ -64,6 +65,8 @@ class GUI_API_EXPORT DbTreeItem : public QObject, public QStandardItem
QList<DbTreeItem*> getPathToParentItem(Type type, const QString& name);
DbTreeItem* findParentItem(Type type);
DbTreeItem* findParentItem(Type type, const QString& name);
QString pathSignature() const;
QStringList pathSignatureParts() const;
QString signature() const;

Type getType() const;
Expand Down Expand Up @@ -94,16 +97,19 @@ class GUI_API_EXPORT DbTreeItem : public QObject, public QStandardItem

DbTreeItem(Type type, const QString& nodeName, QObject* parent = 0);

void pathSignatureParts(QStringList& parts) const;
void init();
void getPathToRoot(QList<DbTreeItem*>& path);
void getPathToParentItem(QList<DbTreeItem*>& path, Type type);
void getPathToParentItem(QList<DbTreeItem*>& path, Type type, const QString& name);
const DbTreeItem* getParentItem(Type type) const;
void updateSignatureValue();

QString signatureValueOfThis;

signals:

public slots:

};

GUI_API_EXPORT QDataStream &operator<<(QDataStream &out, const DbTreeItem* item);
Expand Down
Loading

0 comments on commit 9efb021

Please sign in to comment.