mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-02-02 10:00:38 +01:00
Document CORE-726 - Boolean data type.
This commit is contained in:
parent
520280f44a
commit
81fb7546c4
@ -345,6 +345,8 @@
|
||||
|
||||
* New feature CORE-726
|
||||
Boolean data type
|
||||
See also:
|
||||
/doc/README.data_types
|
||||
Contributor(s):
|
||||
Adriano dos Santos Fernandes <adrianosf at gmail.com>
|
||||
|
||||
|
@ -33,3 +33,50 @@ BIGINT (FB 1.5)
|
||||
of SMALLINT shall be less than or equal to the precision of INTEGER,
|
||||
and the precision of BIGINT shall be greater than or equal to the
|
||||
precision of INTEGER.
|
||||
|
||||
|
||||
BOOLEAN (FB 3.0)
|
||||
--------------
|
||||
|
||||
Function:
|
||||
SQL2008-compliant boolean type.
|
||||
|
||||
Author:
|
||||
Adriano dos Santos Fernandes <adrianosf at gmail.com>
|
||||
|
||||
Syntax rules:
|
||||
BOOLEAN
|
||||
|
||||
Storage:
|
||||
8-bit
|
||||
|
||||
Example(s):
|
||||
1. DECLARE VARIABLE VAR1 BOOLEAN = TRUE;
|
||||
2. CREATE TABLE TABLE1 (FIELD1 BOOLEAN);
|
||||
|
||||
Note(s):
|
||||
1. Quote from the SQL-99 specification:
|
||||
|
||||
The data type boolean comprises the distinct truth values TRUE and FALSE. Unless prohibited
|
||||
by a NOT NULL constraint, the boolean data type also supports the truth value UNKNOWN as the
|
||||
null value. This specification does not make a distinction between the null value of the
|
||||
boolean data type and the truth value Unknown that is the result of an SQL <predicate>,
|
||||
<search condition>, or <boolean value expression>; they may be used interchangeably to mean
|
||||
exactly the same thing.
|
||||
|
||||
2. Represented in the API with the FB_BOOLEAN type and FB_TRUE and FB_FALSE constants.
|
||||
|
||||
3. The value TRUE is greater than the value FALSE.
|
||||
|
||||
4. Booleans are not implicitly convertible to any other datatype. But it's convertible to/from
|
||||
strings with CAST.
|
||||
|
||||
5. It's allowed to test booleans without compare with TRUE or FALSE. For example,
|
||||
"field1 OR field2" and "NOT field1" are valid expressions. It's also allowed to compare with
|
||||
others operators, including the new IS operator: "field1 IS FALSE".
|
||||
|
||||
6. For compatibility reasons, the names INSERTING, UPDATING and DELETING (which aren't keywords)
|
||||
works (like in 2.5 and previous) as boolean expressions and works as values (column or
|
||||
variable) in non-booleans expressions. For example, in:
|
||||
SELECT INSERTING, NOT INSERTING FROM TEST WHERE INSERTING AND INSERTING IS TRUE
|
||||
the INSERTING's are respectively recognized as value, keyword, keyword and value.
|
||||
|
Loading…
Reference in New Issue
Block a user