Skip to content

Commit a3057a2

Browse files
author
Paweł Salawa
committed
#5684 Added debug(msg) SQL function to print messages to Status Field, for example from TRIGGER body.
1 parent 202c36f commit a3057a2

3 files changed

Lines changed: 16 additions & 0 deletions

File tree

ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
- ADDED: #4225 Foreign Key constraint configuration dialogs now warns about using foreign column that is neither PRIMARY KEY nor UNIQUE.
5050
- ADDED: #3035 The INSTEAD OF triggers on Views are now honored when present. Add/Delete row in the View Window now appears if respective INSTEAD OF trigger is present for the View.
5151
- ADDED: #5085 Added 'Cut' entry to context menu of data Grid View.
52+
- ADDED: #5684 Added debug(msg) SQL function to print messages to Status Field, for example from TRIGGER body.
5253
- ADDED: #4709 Added option in configuration to sort data by single-click on a header. Ehnanced data header tooltips to include this information there.
5354
- ADDED: #3566 Added option in configuration to make the Enter key move to the next row, if it was used to finish data editing in Grid View. The option is also available from the Grid's context menu.
5455
- CHANGE: #5441 Project has been renamed to Letos. Together with the name, also domain/homepage has changed to letos.org.

Letos/core/services/impl/functionmanagerimpl.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ void FunctionManagerImpl::init()
294294

295295
void FunctionManagerImpl::initNativeFunctions()
296296
{
297+
registerNativeFunction("debug", {"msg"}, FunctionManagerImpl::nativeDebug);
297298
registerNativeFunction("regexp", {"pattern", "arg"}, FunctionManagerImpl::nativeRegExp);
298299
registerNativeFunction("sqlfile", {"file"}, FunctionManagerImpl::nativeSqlFile);
299300
registerNativeFunction("readfile", {"file"}, FunctionManagerImpl::nativeReadFile);
@@ -408,6 +409,19 @@ QString FunctionManagerImpl::langUnsupportedError(const QString& name, int argCo
408409
.arg(name, argMarkers.join(","), lang);
409410
}
410411

412+
QVariant FunctionManagerImpl::nativeDebug(const QList<QVariant>& args, Db* db, bool& ok)
413+
{
414+
Q_UNUSED(db);
415+
Q_UNUSED(ok);
416+
417+
QStringList parts = {"DEBUG:"};
418+
for (const QVariant& arg : args)
419+
parts << arg.toString();
420+
421+
notifyInfo(parts.join(" "));
422+
return QVariant();
423+
}
424+
411425
QVariant FunctionManagerImpl::nativeRegExp(const QList<QVariant>& args, Db* db, bool& ok)
412426
{
413427
Q_UNUSED(db);

Letos/core/services/impl/functionmanagerimpl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ class API_EXPORT FunctionManagerImpl : public FunctionManager
7474
QHash<QString, QVariant>& aggregateStorage, bool doReleaseContext);
7575

7676
static QStringList getArgMarkers(int argCount);
77+
static QVariant nativeDebug(const QList<QVariant>& args, Db* db, bool& ok);
7778
static QVariant nativeRegExp(const QList<QVariant>& args, Db* db, bool& ok);
7879
static QVariant nativeSqlFile(const QList<QVariant>& args, Db* db, bool& ok);
7980
static QVariant nativeReadFile(const QList<QVariant>& args, Db* db, bool& ok);

0 commit comments

Comments
 (0)