00 01 編寫ESQL 之 使用訊息體內容

2021-08-19 05:56:59 字數 1845 閱讀 9487

名稱元素:

名稱元素具有與其關聯的字串,即元素的名稱。名稱元素的乙個示例為 xmlelement

值元素:

值元素有乙個與其關聯的值。值元素的示例為 xmlcontent

名稱/值元素:

名稱/值元素是名稱元素中只包含乙個值元素而不包含其他任何元素情況下的優化。該元素同時包含名稱和值。

使用關聯名inputroot後跟元素路徑(inputbody 等價於 inputroot + 解析器名,例如,inputroot.mrm);

關聯名body引用訊息其實部分,(body 等價於 root + 解析器名root.xmlns)

不能在 databaseinput 節點中使用 body 關聯名。

1、compute節點查詢

if inputroot.xmlns.invoice.payment.cardtype = 『jianshe』 then

do;

…more esql …

end if;

2、為string元素賦值

set outputroot.xmlns.invoice.customer.title = 『mr』;

orset outputroot.xmlns.invoice.customer.title value = 『mr』;

3、select 語句過濾來自輸入訊息的記錄

– declare local variable

declare currentcustomer char 『smith』;

– loop through the input message

set outputroot.xmlns.invoice =

(select i from inputroot.xmlns.invoice as i

where i.customer.lastname = currentcustomer

);4、將元素與 esql 關鍵字 null 相比較時

if inputroot.xmlns.invoice.invoiceno is null then

do;

– more esql –

end if;

普通賦值

set outputroot.xmlns.order.name = upper('hello world !');
null賦值,刪除節點

set outputroot.xmlns.order.name  = null;
null賦值,不刪除節點寫法,加入「value」

set outputroot.xmlns.order.name value = null;
e.g:

if body.invoice.customer.billing.address[1] = 『patent office』 then

do;

– more esql –

end if;

field[<] 表明最後乙個元素。

field[<1] 表明最後乙個元素。

field[<2] 表明最後乙個以外的最後的元素(倒數第二個元素)。

刪除重複字段

set outputroot.mrm.e_personname[1] = null;

set outputroot.mrm.e_personname[4] = null;

您可能期待元素一和四被刪除。但是,因為重複元素儲存在堆疊中,您刪除乙個元素後,它上面的元素將取代它的位置。這意味著在上面的示例中,元素一和五將被刪除。要避免此問題,建議您以相反的順序進行刪除,即先刪除元素四再刪除元素一。

AWS之SQS訊息佇列使用經驗

1 問 什麼是可見性超時?可見性超時是乙個時段,在這個時段內,amazon sqs 會阻止其他處理元件接收和處理某條訊息。有關更多資訊,請參閱 amazon sqs 開發人員指南中的可見性超時。這個特性,在工作當中,我們可以提高基於sqs訊息服務的併發能力。比如有1000個sqs client在監聽...

KAFKA使用總結之 使用命令產生訊息失敗處理

新搭建一套kafka集群,配置用的老的一樣的配置,應該很快能夠搞定,結果搞了一天,問題如下,搭建完成後使用如下命令做生產者測試產生新資料 bin kafka console producer.sh broker list localhost 9092 topic test 123稍等下出現如下報錯 ...

知識碎片之使用Win32 編寫shell

伺服器端 如下 include include include pragma comment lib,ws2 32.lib 鏈結ws2 32.lib intmain closesocket listenfd return0 客戶端 include include include pragma com...