Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Create a sample table

创建一个示例表

运行以下命令在数据库中创建一个临时表来观察更改。

 Run the following to create a temporary table in the database to observe the changes.

Code Block
CREATE TABLE IF NOT EXISTS `app_fd_demo` (
  `id` varchar(255) NOT NULL,
  `dateCreated` datetime DEFAULT NULL,
  `dateModified` datetime DEFAULT NULL,
  `c_message` longtext,
  PRIMARY KEY (`id`)
)

Prepare the Stored Procedure

In your SQL client, create a sample procedure called as jogetaddrecord by executing the statements below. 

准备存储过程

在您的SQL客户端中,通过执行以下语句创建一个名为jogetaddrecord 的示例过程  。 

在这个过程中,每次调用时都会在app_fd_demo中插入新的记录  

 In this procedure, it will insert a new record into app_fd_demo every time it is called.

Code Block
DELIMITER //
CREATE PROCEDURE jogetaddrecord(IN inputParam VARCHAR(255))
BEGIN
    INSERT INTO app_fd_demo VALUES (now(), now(), now(), inputParam);
END //
DELIMITER ;

Calling the stored procedure in Joget Workflow

...

在Joget Workflow中调用存储过程

  1. 在Joget Workflow中,从一个Process中,将一个工具映射到插件,比如数据库更新工具
  2. 添加下面的代码来调用存储的过程。

...

  1. Code Block
    call jogetaddrecord("hello");

...

观察数据库更改

Code Block
mysql> select * from app_fd_demo;
+---------------------+---------------------+---------------------+-----------+
| id | dateCreated | dateModified | c_message |
+---------------------+---------------------+---------------------+-----------+
| 2016-06-29 11:57:19 | 2016-06-29 11:57:19 | 2016-06-29 11:57:19 | hello |
+---------------------+---------------------+---------------------+-----------+
1 row in set (0.00 sec)

...