fastdb_字符串

来源:互联网 发布:打开手机淘宝 编辑:程序博客网 时间:2024/06/04 18:21

All strings in FastDB have varying length and the programmer should not worry about specification of maximal length for character fields. All operations acceptable for arrays are also applicable to strings. In addition to them, strings have a set of own operations. First of all, strings can be compared with each other using standard relation operators. At present, FastDB supports only the ASCII character set (corresponds to type char in C) and byte-by-byte comparison of strings ignoring locality settings.

 

FastDB中的所有的字符串的长度都是可变的,程序员不需要担心字符串的最大长度的限制。所有对数组的操作同样适用于字符串,另外,字符串有自己的操作。首先,可以使用标准关系操作符来比较字符串。目前FastDB 只支持ASCII 字符集(同c 中的字符型),字符串的单字节比较忽略本地化设置。

 

The operator like can be used for matching a string with a pattern containing special wildcard characters '%' and '_'. The character '_' matches any single character, while the character '%' matches zero or more characters. An extended form of the like operator together with the escape keyword can be used to handle the characters '%' and '_' in the pattern as normal characters if they are preceded by a special escape character, specified after the escape keyword.

 

可以使用关键字LIKE 和特定通配符'%' '_' 实现模式匹配,来查找字符串。字符“_”用来代替任何单个字符,而“%”用来代替0 个或多个字符。like操作符的扩展模式和escape关键字结合起来使用,可以将特定escape 字符后的字符'%' '_' 按照正常字符的模式来处理。

 

If you rebuild GigaBASE with USE_REGEX macro, then you can use match operator implementing standard regular expressions (based on GNU regex library). Second operand of this operator specified regular expression to be matched and should be string literal.

 

It is possible to search substrings within a string by the in operator. The expression ('blue' in color) will be true for all records which color field contains 'blue'. If the length of the searched string is greater than some threshold value (currently 512), a Boyer-Moore substring search algorithm is used instead of a straightforward search implementation.

 

可以使用in 操作符查找一个子串。对于所有color字段包含“blue”的记录,表达式('blue' in color) 将返回真。如果,被查找字符串的长度大于一些阈值(当前是512),将使用Boyer-Moore字串查找算法,而不用直接的查找的方法。

 

Strings can be concatenated by + or || operators. The last one was added for compatibility with the ANSI SQL standard. As far as FastDB doesn't support the implicit conversion to string type in expressions, the semantic of the operator + can be redefined for strings.

 

可以使用操作符+ || 来连接字符串。而操作符|| 是为了和ANSI SQL 标准兼容。由于FastDB 不支持表达式中到字符串的隐式转化,可以为字符串重新定义“+”的语义。

原创粉丝点击