文档首页
X DevAPI 用户指南
下载本手册
PDF (US Ltr) - 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.