en:db_api
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:db_api [2026/06/03 09:40] – administrator | en:db_api [2026/06/05 07:14] (current) – administrator | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== | + | ====== |
| ===== iGarment API: Query ===== | ===== iGarment API: Query ===== | ||
| Line 36: | Line 36: | ||
| Example, single SQL | Example, single SQL | ||
| - | [ | + | select orderNo from saomstr where issdate >= ' |
| - | { | + | |
| - | select orderNo from saomstr where issdate >= ' | + | |
| - | select a.orderno, a.issdate, b.style, b.description from SAOMSTR a inner join t_Filter o on o.OrderNo = a.OrderNo inner join SAOSTYLE b on b.OrderNo = a.OrderNo | + | |
| - | } | + | |
| - | ] | + | |
| - | Reutrn | + | Return |
| - | [ | ||
| { | { | ||
| " | " | ||
| Line 59: | Line 54: | ||
| ] | ] | ||
| } | } | ||
| - | ] | + | |
| - | Query procedure | + | ==== Query procedure |
| Instead of running a single SQL SELECT, you can provide multiple SQLs where each SQL end with a semicolon. When providing multiple SQL, the server will only return data from the last SELECT statment. But if you want to get data from other SELECT statement, you need to specify explicitly. | Instead of running a single SQL SELECT, you can provide multiple SQLs where each SQL end with a semicolon. When providing multiple SQL, the server will only return data from the last SELECT statment. But if you want to get data from other SELECT statement, you need to specify explicitly. | ||
| Example, multiple select | Example, multiple select | ||
| - | SELECT * FROM table1; | + | |
| - | SELECT * FROM table2; | + | SELECT * FROM table2; |
| You should get the select data of ' | You should get the select data of ' | ||
| Example, multple select return mutlipe dataset | Example, multple select return mutlipe dataset | ||
| - | SELECT * FROM table1 into table1; | + | |
| - | SELECT * FROM table2; | + | SELECT * FROM table2; |
| The return data will be a list of two elements with the following structure. | The return data will be a list of two elements with the following structure. | ||
| - | [ | + | |
| { last select result }, | { last select result }, | ||
| { | { | ||
| Line 81: | Line 79: | ||
| ... | ... | ||
| } | } | ||
| - | ] | + | |
| **Using Temporay Table** | **Using Temporay Table** | ||
| Line 87: | Line 85: | ||
| You may also store data into temporay table to be used by subsequence select. | You may also store data into temporay table to be used by subsequence select. | ||
| - | ~~~sql | + | |
| - | SELECT * FROM table1 INTO TEMPORARY TABLE T_A; | + | CREATE INDEX T_A_KEY1 ON (order); |
| - | CREATE INDEX T_A_KEY1 ON (order); | + | |
| + | SELECT * FROM table2 LEFT JOIN T_A WHERE T_A.order > 1000; | ||
| + | DROP INDEX T_A_KEY1; | ||
| + | |||
| + | ===== iGarment API: Get file ===== | ||
| - | SELECT * FROM table2 LEFT JOIN T_A WHERE T_A.order > 1000; | ||
| - | DROP INDEX T_A_KEY1; | ||
| - | iGarment API: Get file | ||
| API to download file. Supported method is GET. | API to download file. Supported method is GET. | ||
| Line 99: | Line 98: | ||
| < | < | ||
| - | Request Example | + | |
| + | **Request Example** | ||
| eg: get style image (example with trial505, https:// | eg: get style image (example with trial505, https:// | ||
| + | |||
| step 1. get real file name from system image table: ~/db/query | step 1. get real file name from system image table: ~/db/query | ||
| - | sql: select b.ImageType, | + | |
| return: | return: | ||
| [{ | [{ | ||
| Line 111: | Line 112: | ||
| " | " | ||
| }] | }] | ||
| + | | ||
| step 2. url: ~/ | step 2. url: ~/ | ||
| - | Return Example | + | **Return Example** |
| - | { | + | |
| " | " | ||
| " | " | ||
| " | " | ||
| # file data, encoded in Base64 | # file data, encoded in Base64 | ||
| - | } | + | |
| - | If file_type is blank, can get file type from system image table. | + | |
| + | '' | ||
en/db_api.1780479640.txt.gzip · Last modified: by administrator
