文件首頁
X DevAPI 使用者指南
下載本手冊
PDF (美式信紙) - 1.4Mb
PDF (A4) - 1.4Mb


X DevAPI 使用者指南  /  CRUD EBNF 定義  /  表格 CRUD 函數

11.5 表格 CRUD 函數

TableSelectFunction

Table.select()collection.find() 使用不同的方法來排序結果。Table.select() 遵循 SQL 語言命名,並將排序方法稱為 orderBy()Collection.find() 則不然。使用方法 sort() 來排序 Collection.find() 傳回的結果。在此,與 SQL 標準的接近程度比 API 的一致性更重要。

此函數在 EBNF 中顯示的語法為

TableSelectFunction
  ::= '.select(' ProjectedSearchExprStrList? ')' ( '.where(' SearchConditionStr ')' )?
      ( '.groupBy(' SearchExprStrList ')' )? ( '.having(' SearchConditionStr ')' )?
      ( '.orderBy(' SortExprStrList ')' )? ( '.limit(' NumberOfRows ')' ( '.offset(' NumberOfRows ')' )? )?
      ( '.lockExclusive(' LockContention ')' | '.lockShared(' LockContention ')' )? 
      ( '.bind(' ( PlaceholderValues ) ')' )*
      ( '.execute()' )?

圖 11.15 TableSelectFunction

Image shows the syntax in EBNF form as described in the preceding text.

TableInsertFunction

此函數在 EBNF 中顯示的語法為

TableInsertFunction
  ::= '.insert(' ( TableFields )? ')'
        ( '.values(' ExprOrLiteral (',' ExprOrLiteral)* ')' )+
        ( '.execute()' )?

圖 11.16 TableInsertFunction

Image shows the syntax in EBNF form as described in the preceding text.

TableUpdateFunction

此函數在 EBNF 中顯示的語法為

TableUpdateFunction
  ::= '.update()'
      ( '.set(' TableField ',' ExprOrLiteral ')' )+ '.where(' SearchConditionStr ')'
      ( '.orderBy(' SortExprStrList ')' )? ( '.limit(' NumberOfRows ')' )?
      ( '.bind(' ( PlaceholderValues ) ')' )*
      ( '.execute()' )?

圖 11.17 TableUpdateFunction

Image shows the syntax in EBNF form as described in the preceding text.

TableDeleteFunction

此函數在 EBNF 中顯示的語法為

TableDeleteFunction
  ::= '.delete()' '.where(' SearchConditionStr ')'
      ( '.orderBy(' SortExprStrList ')' )? ( '.limit(' NumberOfRows ')' )?
      ( '.bind(' ( PlaceholderValues ) ')' )*
      ( '.execute()' )?

圖 11.18 TableDeleteFunction

Image shows the syntax in EBNF form as described in the preceding text.