Changeset 8344

Show
Ignore:
Timestamp:
12/21/05 02:30:48 (3 years ago)
Author:
Darren_Duncan
Message:

r1465@Darren-Duncans-Computer: darrenduncan | 2005-12-20 17:29:56 -0800
/ext/Rosetta-Incubator : reorganized the DATA TYPES OVERVIEW section of Language.pod to cut on redundancy

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • ext/Rosetta-Incubator/lib/SQL/Routine/Language.pod

    r8324 r8344  
    124124adjoining locations. 
    125125 
    126 =head2 Native Primitive Types 
    127  
    128 These are the simplest data types, from which all others are derived: 
    129  
    130 =over 
    131  
    132 =item C<NULL> 
    133  
    134 This special data type represents situations where a value of an arbitrary 
    135 data type is desired but none is yet known; it sits in place of the absent 
    136 value to indicate that fact.  NULL artifacts will always explicitly compare 
    137 as being unequal to each other; since they all represent unknowns, we can 
    138 not logically say any are equal, so they are all treated as distinct.  This 
     126=head2 Native Null Type 
     127 
     128SQL::Routine natively supports the special NULL data type, whose value 
     129domain is by definition mutually exclusive of the domains of all other data 
     130types; in practice, a NULL is distinct from all possible values that the 
     131other SQL::Routine native primitive types can have.  But some built-in 
     132complex types and user customized types could be defined where their 
     133domains are a super-set of NULL; those latter types are described as 
     134"nullable", while types whose domains are not a super-set of NULL are 
     135described as "not nullable". 
     136 
     137The NULL data type represents situations where a value of an arbitrary data 
     138type is desired but none is yet known; it sits in place of the absent value 
     139to indicate that fact.  NULL artifacts will always explicitly compare as 
     140being unequal to each other; since they all represent unknowns, we can not 
     141logically say any are equal, so they are all treated as distinct.  This 
    139142data type corresponds to SQL's concept of NULL, and is similar to Perl's 
    140143concept of "undef".  A NULL does not natively cast between any data types. 
    141144 
     145SQL::Routine does not allow you to declare "domain" Nodes that are simply 
     146of or based on the data type NULL; rather, to use NULL you must declare 
     147"domain" Nodes that are either based on a not-nullable data type unioned 
     148with the NULL type, or are based on a nullable data type.  The "domain" 
     149Node type provides a short-hand to indicate the union of its base type with 
     150NULL, in the form of the boolean "is_nullable" attribute; if the attribute 
     151is undefined, then the nullability status of the base data type is 
     152inherited; if it is defined, then it overrides the parent's status. 
     153 
     154All not-nullable built-in data types default to their concept of empty or 
     155nothingness, such as zero or the empty string.  All nullable built-in 
     156types, and all not-nullable built-in types that you customize with a true 
     157is_nullable, will default to NULL.  In either case, you can define an 
     158explicit default value for your custom data type, which will override those 
     159behaviours; details are given further below. 
     160 
     161=head2 Native Primitive Types 
     162 
     163These are the simplest data types, from which all others are derived: 
     164 
     165=over 
     166 
    142167=item C<BOOLEAN> 
    143168 
    144 This data type is a logical boolean, whose only possible values are FALSE 
    145 and TRUE.  This data type is not nullable and defaults to FALSE. 
     169This not-nullable data type is a logical boolean, whose only possible 
     170values are FALSE and TRUE.  Its concept of nothingness is FALSE. 
    146171 
    147172=item C<INTEGER> 
    148173 
    149 This data type is a rational integer of unlimited (but not infinite) 
    150 precision.  It is a sub-domain of RATIONAL and will natively cast to (and 
    151 sometimes from) that.  This data type is not nullable and defaults to zero. 
     174This not-nullable data type is a rational integer of unlimited (but not 
     175infinite) precision.  Its concept of nothingness is zero.  It is 
     176conceptually a full sub-domain of RATIONAL, such that all INTEGER values 
     177have one-on-one RATIONAL equivalents, but for widely pervasive matters of 
     178efficiency, SQL::Routine will treat the two types as exclusive, so you need 
     179to do explicit conversions between them. 
    152180 
    153181=item C<RATIONAL> 
    154182 
    155 This data type is a rational number of unlimited (but not infinite) 
    156 precision and scale.  This data type is not nullable and defaults to zero. 
     183This not-nullable data type is a rational number of unlimited (but not 
     184infinite) precision and scale.  Its concept of nothingness is zero. 
    157185 
    158186=item C<CHAR_STR> 
    159187 
    160 This data type is a character string of unlimited (but not infinite) 
    161 length.  Its abstract character repertoire is that of the current newest 
    162 Unicode Standard.  This data type is not nullable and defaults to the empty 
    163 string. 
     188This not-nullable data type is a character string of unlimited (but not 
     189infinite) length.  Its abstract character repertoire is that of the current 
     190newest Unicode Standard.  Its concept of nothingness is the empty string. 
    164191 
    165192=item C<BIT_STR> 
    166193 
    167 This data type is a bit string of unlimited (but not infinite) 
    168 length.  This data type is not nullable and defaults to the empty string. 
    169  
    170 =item C<SCALAR> 
    171  
    172 This data type is a union of the domains of the BOOLEAN, RATIONAL (includes 
    173 INTEGER), CHAR_STR, and BIT_STR data types.  It is a weakly typed scalar 
    174 like Perl's default variables, or SQLite's default table columns.  This 
    175 data type is not nullable and defaults to the empty string. 
    176  
    177 =item C<NULL_BOOLEAN> 
    178  
    179 This data type is a union of the domains of the NULL and BOOLEAN data 
    180 types; it is a nullable logical boolean and defaults to NULL. 
    181  
    182 =item C<NULL_INTEGER> 
    183  
    184 This data type is a union of the domains of the NULL and INTEGER data 
    185 types; it is a nullable rational integer and defaults to NULL. 
    186  
    187 =item C<NULL_RATIONAL> 
    188  
    189 This data type is a union of the domains of the NULL and RATIONAL data 
    190 types; it is a nullable rational number and defaults to NULL. 
    191  
    192 =item C<NULL_CHAR_STR> 
    193  
    194 This data type is a union of the domains of the NULL and CHAR_STR data 
    195 types; it is a nullable character string and defaults to NULL. 
    196  
    197 =item C<NULL_BIT_STR> 
    198  
    199 This data type is a union of the domains of the NULL and BIT_STR data 
    200 types; it is a nullable bit string and defaults to NULL. 
    201  
    202 =item C<NULL_SCALAR> 
    203  
    204 This data type is a union of the domains of the NULL and SCALAR data 
    205 types; it is a nullable weakly typed scalar and defaults to NULL. 
     194This not-nullable data type is a bit string of unlimited (but not infinite) 
     195length.  Its concept of nothingness is the empty string. 
    206196 
    207197=back 
     198 
     199=head2 Native Scalar Type 
     200 
     201SQL::Routine has native support for a special SCALAR data type, which is 
     202akin to SQLite's weakly typed table columns, or to Perl's weakly typed 
     203default scalar variables.  This not-nullable data type is a union of the 
     204domains of the BOOLEAN, INTEGER, RATIONAL, CHAR_STR, and BIT_STR 
     205data types.  Its concept of nothingness is the empty string. 
    208206 
    209207=head1 SEE ALSO