Versions Compared

Key

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

Table of Contents

Create a sample table

Thai

สร้างตารางตัวอย่าง

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

Thai

เรียกใช้ต่อไปนี้เพื่อสร้างตารางชั่วคราวในฐานข้อมูลเพื่อสังเกตการเปลี่ยนแปลง

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

Thai

เตรียมขั้นตอนการจัดเก็บ

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

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

Thai

ในไคลเอนต์ SQL ของคุณสร้างโพรซีเดอร์ตัวอย่างที่เรียกว่า jogetaddrecord โดยดำเนินการคำสั่งด้านล่าง

ในขั้นตอนนี้มันจะแทรกบันทึกใหม่ลงใน app_fd_demo ทุกครั้งที่มีการเรียก

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

Thai

การเรียกโพรซีเดอร์ที่เก็บใน Joget Workflow

  1. In Joget Workflow, from a Process, map a Tool to plugins such as Database Update Tool.

    Thai

    ใน Joget Workflow จาก Process ให้จับคู่เครื่องมือกับปลั๊กอินเช่น Database Update Tool

  2. Add the following code in to call the stored procedure.

    Thai

    เพิ่มรหัสต่อไปนี้ในการเรียกกระบวนงานที่เก็บไว้

    Code Block
    call jogetaddrecord("hello");

Observe database change

Thai

สังเกตการเปลี่ยนแปลงฐานข้อมูล

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)

...


Related Elements

Thai

องค์ประกอบที่เกี่ยวข้อง

 

...