@things-factory/integration-base 6.1.115 → 6.1.116

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,128 @@
1
+ # Oracle Procedure Task
2
+
3
+ Oracle 데이터베이스에 저장되어 있는 프로시저를 호출하는 태스크이며,
4
+ 개별 데이터 타입에 따라서 데이터의 리스트 혹은 특정 데이터 타입의 값을 반환한다.
5
+
6
+ ## Parameters
7
+
8
+ ### 프로시저
9
+ - 프로시저를 호출하는 함수부를 작성한다. 작성 시에 BEGIN과 END는 실제 내부에서 추가되기 때문에 별도로 지정할 필요가 없다.
10
+ - 호출 이후에 ;을 추가해야 한다.
11
+ - 프로시저의 입출력 파라미터는 :과 함께 사용한다.
12
+ - 프로시저 작성 예는 다음과 같다.
13
+
14
+ ```sql
15
+ mcs.myproc(:id, :out_name);
16
+ ```
17
+
18
+ ### 파라미터
19
+ - 파라미터는 다음과 같은 요소로 구성되어 있다.
20
+ - 파라미터 이름
21
+ - 입출력 지정: IN, INOUT, OUT
22
+ - 파라미터 타입: String, Number, Date, Cursor
23
+ - 값: 해당 변수가 입력일 경우, 해당 입력에 대한 값
24
+ - 최대크기: 해당 변수타입이 String이나 Buffer일 경우, 변수의 최대 크기를 지정.
25
+
26
+ #### 파라미터 이름
27
+
28
+ 파라미터 이름은 프로시저 작성에 사용된 파라미터의 이름을 지정한다.
29
+ 앞의 예의 경우,
30
+ ```sql
31
+ mcs.myproc(:id, :out_name);
32
+ ```
33
+ id와 out_name이 각각 파라미터 이름이다.
34
+
35
+ ### 입출력 지정
36
+
37
+ 해당 변수가 입력(IN) 혹은 출력(OUT) 여부를 지정한다.
38
+
39
+ ### 파라미터 타입
40
+
41
+ 파라미터 타입을 지정한다. 타입은 실제 프로시저 생성 시에 지정되어 있는 이름과 동일하게 지정되어야 한다.
42
+
43
+ 프로시저가 다음과 같이 구현되어 있다면,
44
+
45
+ ```sql
46
+ CREATE OR REPLACE NONEDITIONABLE PROCEDURE myproc (in_id IN VARCHAR2, out_name OUT VARCHAR2) AS
47
+ BEGIN
48
+ SELECT name INTO out_name FROM MCS.FMB_USERS WHERE id = in_id ;
49
+ END;
50
+ ```
51
+
52
+ 첫번째 파라미터와 두번째 파라미터 모두 VARCHAR2로 지정되어 있으며,
53
+
54
+ 이러한 프로시저를 호출해야 할 경우 파라미터 타입은 모두 String을 지정해야 하고,
55
+ 출력의 경우, 최대 크기까지 지정해야 한다.
56
+
57
+ 호출 지정 예는 다음과 같다.
58
+
59
+ ![procedure example1](./assets/../../../../assets/images/oracle-procedure-example1.png 'procedure example1')
60
+
61
+ ### 값
62
+
63
+ 파라미터가 입력(IN)일 경우, 해당 값을 지정한다.
64
+ 해당 값에 바로 상수 값을 입력하지 않고, 특정 태스크 이름을 지정하도록 한다.
65
+
66
+ 위의 예어서 id의 입력 값을 ID라고 지정되어 있다면, ID 태스크에서 반환되는 값을 입력 값으로 지정한다.
67
+
68
+ ### 최대 크기
69
+
70
+ 파라미터 타입이 String이나 Buffer 일 경우, 최대 크기를 지정한다. 다른 타입의 경우 값을 지정하지 않고 무시한다.
71
+
72
+ ## 태스크 결과
73
+
74
+ 프로시저 호출에 대한 결과는 Object 형태로 반환되며, 파라미터 중에서 출력으로 지정된 파라미터 이름이 키가 되어 값을 반환한다.
75
+
76
+ 만약, 위에서 소개된 태스크의 경우 다음과 같은 결과 값을 반환한다.
77
+
78
+ ```javascript
79
+ {
80
+ out_name: 'Admin'
81
+ }
82
+ ```
83
+
84
+
85
+ ## 다른 사용 예(커서)
86
+
87
+ ### 프로시저 작성 예
88
+
89
+ ```sql
90
+ CREATE OR REPLACDE NONEDITIONABLE PROCEDURE PROCEDURE1(out_cursor OUT SYS_REFCURSOR) AS
91
+ BEGIN
92
+ BEGIN
93
+ OPEN out_cursor FOR
94
+ SELECT * FROM FARMWEATHER WHERE rownum <= 1000;
95
+ END;
96
+ END PROCEDURE1;
97
+
98
+ ```
99
+
100
+ ### 프로시저 호출 예
101
+
102
+ ![procedure example2](./assets/../../../../assets/images/oracle-procedure-example2.png 'procedure example2')
103
+
104
+ ### 프로시저 태스크 호출 결과
105
+
106
+ ```javascript
107
+ {
108
+ "out_cursor": [
109
+ {
110
+ "FARMDATE": "2006-01-07T15:00:00.000Z",
111
+ "MAXT": 29.5,
112
+ "MINT": 21.8,
113
+ "WINDSPEED": 1.6,
114
+ "FARMHUM": 70.2,
115
+ "PRECIPITATION": 0
116
+ },
117
+ {
118
+ "FARMDATE": "2006-01-08T15:00:00.000Z",
119
+ "MAXT": 30.1,
120
+ "MINT": 21,
121
+ "WINDSPEED": 1.6,
122
+ "FARMHUM": 67.4,
123
+ "PRECIPITATION": 0
124
+ },
125
+ ..
126
+ ]
127
+ }
128
+ ```
@@ -0,0 +1,130 @@
1
+ # Oracle Procedure Task
2
+
3
+ A task that calls a procedure stored in an Oracle database,
4
+ Depending on the individual data type, it returns a list of data or a value of a specific data type.
5
+
6
+ ## Parameters
7
+
8
+ ### Procedure
9
+ - Write a function that calls the procedure. You don't need to specify BEGIN and END at the time of writing because they are actually added internally.
10
+ - You need to add ;after the call.
11
+ - The input and output parameters of a procedure are used with :.
12
+ - An example of writing a procedure is as follows
13
+
14
+ ```sql
15
+ mcs.myproc(:id, :out_name);
16
+ ```
17
+
18
+ ### Parameters
19
+ - A parameter consists of the following elements
20
+ - The parameter name
21
+ - Input/output designation: IN, INOUT, OUT
22
+ - Parameter type: String, Number, Date, Cursor
23
+ - Value: If the variable is an input, the value for that input.
24
+ - MaxSize: If the variable is of type String or Buffer, specifies the maximum size of the variable.
25
+
26
+ #### Paramter name
27
+
28
+ Parameter name specifies the name of the parameter used in the procedure.
29
+ For the previous example,
30
+
31
+ ```sql
32
+ mcs.myproc(:id, :out_name);
33
+ ```
34
+
35
+ id and out_name are the parameter names, respectively.
36
+
37
+ ### In/Out Type
38
+
39
+ Specifies whether the variable is an input (IN) or output (OUT).
40
+
41
+ ### Paramter type
42
+
43
+ Specifies the parameter type. The type must be the same as the name given to the actual procedure when it is created.
44
+
45
+ If the procedure is implemented as follows,
46
+
47
+ ```sql
48
+ CREATE OR REPLACE NONEDITIONABLE PROCEDURE myproc (in_id IN VARCHAR2, out_name OUT VARCHAR2) AS
49
+ BEGIN
50
+ SELECT name INTO out_name FROM MCS.FMB_USERS WHERE id = in_id ;
51
+ END;
52
+ ```
53
+
54
+ Both the first and second parameters are specified as VARCHAR2,
55
+
56
+ If you need to call these procedures, the parameter types should all be String,
57
+ For the output, the maximum size should be specified.
58
+
59
+ An example call specification is as follows
60
+
61
+ ![procedure example1](./assets/../../../../assets/images/oracle-procedure-example1.png 'procedure example1')
62
+
63
+ ### Value(for Input)
64
+
65
+ If the parameter is an input (IN), specify its value.
66
+ Do not enter a constant value directly into the value, but rather specify a specific task name.
67
+
68
+ In the example above, if the input value for id is specified as ID, specify the value returned by the ID task as the input value.
69
+
70
+ ### Maxsize
71
+
72
+ If the parameter type is String or Buffer, specify the maximum size. For other types, no value is specified and it is ignored.
73
+
74
+ ## Task Result
75
+
76
+ The result of a procedure call is returned as an Object, where the name of the parameter specified as output is the key, and the value is returned.
77
+
78
+ For example, the task introduced above returns the following result value.
79
+
80
+ ```javascript
81
+ {
82
+ out_name: 'Admin'
83
+ }
84
+ ```
85
+
86
+
87
+ ## Another Example(using cursor)
88
+
89
+ ### Procedure using cursor parameter
90
+
91
+ ```sql
92
+ CREATE OR REPLACDE NONEDITIONABLE PROCEDURE PROCEDURE1(out_cursor OUT SYS_REFCURSOR) AS
93
+ BEGIN
94
+ BEGIN
95
+ OPEN out_cursor FOR
96
+ SELECT * FROM FARMWEATHER WHERE rownum <= 1000;
97
+ END;
98
+ END PROCEDURE1;
99
+
100
+ ```
101
+
102
+ ### Task example to call the procedure using a cursor as an output
103
+
104
+ ![procedure example2](./assets/../../../../assets/images/oracle-procedure-example2.png 'procedure example2')
105
+
106
+ ### Task result
107
+
108
+ ```javascript
109
+ {
110
+ "out_cursor": [
111
+ {
112
+ "FARMDATE": "2006-01-07T15:00:00.000Z",
113
+ "MAXT": 29.5,
114
+ "MINT": 21.8,
115
+ "WINDSPEED": 1.6,
116
+ "FARMHUM": 70.2,
117
+ "PRECIPITATION": 0
118
+ },
119
+ {
120
+ "FARMDATE": "2006-01-08T15:00:00.000Z",
121
+ "MAXT": 30.1,
122
+ "MINT": 21,
123
+ "WINDSPEED": 1.6,
124
+ "FARMHUM": 67.4,
125
+ "PRECIPITATION": 0
126
+ },
127
+ ...
128
+ ]
129
+ }
130
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/integration-base",
3
- "version": "6.1.115",
3
+ "version": "6.1.116",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -26,12 +26,12 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "@apollo/client": "^3.6.9",
29
- "@things-factory/api": "^6.1.115",
30
- "@things-factory/auth-base": "^6.1.115",
31
- "@things-factory/env": "^6.1.112",
32
- "@things-factory/oauth2-client": "^6.1.115",
33
- "@things-factory/scheduler-client": "^6.1.115",
34
- "@things-factory/shell": "^6.1.115",
29
+ "@things-factory/api": "^6.1.116",
30
+ "@things-factory/auth-base": "^6.1.116",
31
+ "@things-factory/env": "^6.1.116",
32
+ "@things-factory/oauth2-client": "^6.1.116",
33
+ "@things-factory/scheduler-client": "^6.1.116",
34
+ "@things-factory/shell": "^6.1.116",
35
35
  "async-mqtt": "^2.5.0",
36
36
  "chance": "^1.1.11",
37
37
  "cross-fetch": "^3.0.4",
@@ -46,5 +46,5 @@
46
46
  "devDependencies": {
47
47
  "@types/cron": "^2.0.1"
48
48
  },
49
- "gitHead": "3677982365595b0f3a8ec26e47c234878ecbb910"
49
+ "gitHead": "4477d162a7008239bfd5f31dcfa879f59a2ad2ce"
50
50
  }
@@ -103,4 +103,6 @@ OracleProcedure.parameterSpec = [
103
103
  }
104
104
  ]
105
105
 
106
+ OracleProcedure.help = 'integration/task/oracle-procedure'
107
+
106
108
  TaskRegistry.registerTaskHandler('oracle-procedure', OracleProcedure)