diff --git a/server/bundles/io.cloudbeaver.server/schema/service.core.graphqls b/server/bundles/io.cloudbeaver.server/schema/service.core.graphqls index ccd536c6a4..9d155f95a8 100644 --- a/server/bundles/io.cloudbeaver.server/schema/service.core.graphqls +++ b/server/bundles/io.cloudbeaver.server/schema/service.core.graphqls @@ -71,6 +71,20 @@ type AsyncTaskInfo { taskResult: Object } +type TransactionLogInfos { + count: Int + transactionLogInfos: [ TransactionLogInfoItem ] +} + +type TransactionLogInfoItem { + time: DateTime + type: String + queryString: String + durationMs: Int + rows: Int + result: String +} + # Various server errors descriptor type ServerError { diff --git a/server/bundles/io.cloudbeaver.server/schema/service.sql.graphqls b/server/bundles/io.cloudbeaver.server/schema/service.sql.graphqls index a1d12c3dd5..54b23e9e47 100644 --- a/server/bundles/io.cloudbeaver.server/schema/service.sql.graphqls +++ b/server/bundles/io.cloudbeaver.server/schema/service.sql.graphqls @@ -331,6 +331,12 @@ extend type Mutation { dataFormat: ResultDataFormat ): AsyncTaskInfo! + getTransactionLogInfo( + projectId: ID!, + connectionId: ID!, + contextId: ID! + ): TransactionLogInfos + # Close results (free resources) sqlResultClose(projectId: ID, connectionId: ID!, contextId: ID!, resultId: ID!): Boolean! diff --git a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/sql/DBWServiceSQL.java b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/sql/DBWServiceSQL.java index a7d5a95fc1..bea1288917 100644 --- a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/sql/DBWServiceSQL.java +++ b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/sql/DBWServiceSQL.java @@ -27,6 +27,7 @@ import org.jkiss.dbeaver.DBException; import org.jkiss.dbeaver.model.exec.DBCLogicalOperator; import org.jkiss.dbeaver.model.exec.trace.DBCTraceProperty; +import org.jkiss.dbeaver.model.qm.QMTransactionLogInfo; import org.jkiss.dbeaver.model.sql.registry.SQLGeneratorDescriptor; import java.util.List; @@ -202,4 +203,10 @@ WebAsyncTaskInfo asyncSqlRollbackTransaction( WebAsyncTaskInfo asyncSqlCommitTransaction( @NotNull WebSession webSession, @NotNull WebSQLContextInfo sqlContext); + + @WebAction + QMTransactionLogInfo getTransactionLogInfo( + @NotNull WebSession webSession, + @NotNull WebSQLContextInfo sqlContext + ); } diff --git a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/sql/WebSQLContextInfo.java b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/sql/WebSQLContextInfo.java index f0115c6cef..b21de55660 100644 --- a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/sql/WebSQLContextInfo.java +++ b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/sql/WebSQLContextInfo.java @@ -31,6 +31,7 @@ import org.jkiss.dbeaver.model.exec.*; import org.jkiss.dbeaver.model.exec.trace.DBCTrace; import org.jkiss.dbeaver.model.meta.Property; +import org.jkiss.dbeaver.model.qm.QMTransactionLogInfo; import org.jkiss.dbeaver.model.qm.QMTransactionState; import org.jkiss.dbeaver.model.qm.QMUtils; import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor; @@ -216,6 +217,11 @@ public void run(DBRProgressMonitor monitor) throws InvocationTargetException, In } + public QMTransactionLogInfo getTransactionLogInfo() { + DBCExecutionContext context = processor.getExecutionContext(); + return QMUtils.getTransactionLogInfo(context); + } + public WebAsyncTaskInfo commitTransaction() { DBCExecutionContext context = processor.getExecutionContext(); DBCTransactionManager txnManager = DBUtils.getTransactionManager(context); diff --git a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/sql/WebServiceBindingSQL.java b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/sql/WebServiceBindingSQL.java index c183c7d350..2650213854 100644 --- a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/sql/WebServiceBindingSQL.java +++ b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/sql/WebServiceBindingSQL.java @@ -230,6 +230,11 @@ public void bindWiring(DBWBindingContext model) throws DBWebException { getService(env).asyncSqlRollbackTransaction( getWebSession(env), getSQLContext(env) + )) + .dataFetcher("getTransactionLogInfo", env -> + getService(env).getTransactionLogInfo( + getWebSession(env), + getSQLContext(env) )); } diff --git a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/sql/impl/WebServiceSQL.java b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/sql/impl/WebServiceSQL.java index 0308509dec..1d80c81038 100644 --- a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/sql/impl/WebServiceSQL.java +++ b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/sql/impl/WebServiceSQL.java @@ -42,6 +42,7 @@ import org.jkiss.dbeaver.model.impl.sql.BasicSQLDialect; import org.jkiss.dbeaver.model.navigator.DBNModel; import org.jkiss.dbeaver.model.navigator.DBNNode; +import org.jkiss.dbeaver.model.qm.QMTransactionLogInfo; import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor; import org.jkiss.dbeaver.model.sql.*; import org.jkiss.dbeaver.model.sql.completion.SQLCompletionAnalyzer; @@ -615,4 +616,9 @@ public WebAsyncTaskInfo asyncSqlCommitTransaction(@NotNull WebSession webSession return contextInfo.commitTransaction(); } + @Override + public QMTransactionLogInfo getTransactionLogInfo(@NotNull WebSession webSession, @NotNull WebSQLContextInfo sqlContext) { + return sqlContext.getTransactionLogInfo(); + } + }