2.2.1.6 Database Types - Groupable
The following data types specify data for storing into a data store.
DBTYPE-VARNUMERIC:
Designated datatype: dbVARNUMERICData
This type transmits numeric types of arbitrary precision. The dbVARNUMERICData field contains one value, encoded using the following rules:
The sign of the value of the dbVARNUMERICData field as a whole is negative if dbVARNUMERICSign is equal to dbVARNUMERICNegative, and positive or zero otherwise.
The absolute value of the dbVARNUMERICData field as a whole is equal to the value in dbVARNUMERICValue, rounded to the number of decimal digits of precision given by the value in dbVARNUMERICPrec, times 10 to the power of the value in dbVARNUMERICScale.
The syntax of dbVARNUMERICDATA is as follows:
dbVARNUMERICData = dbVARNUMERICPrec dbVARNUMERICScale dbVARNUMERICSign dbVARNUMERICValue dbVARNUMERICPrec = BYTE dbVARNUMERICScale = BYTE dbVARNUMERICSign = dbVARNUMERICPositive / dbVARNUMERICNegative dbVARNUMERICPositive = %x01 dbVARNUMERICNegative = %x00 dbVARNUMERICValue = *BYTE
dbVARNUMERICPrec:
Datatype: BYTE
A 1-byte unsigned integer that specifies the number of significant digits, in base 10, of dbVARNUMERICValue.
dbVARNUMERICScale:
Datatype: BYTE
See the description of dbVARNUMERICData for the exact use of dbVARNUMERICScale. For example, "12000" could be stored as "12" with a scale of -3. Also, the scale can be greater than precision to represent very small numbers without using exponential notation; for example, "0.00012" could be stored as dbVARNUMERICValue = 12 with dbVARNUMERICPrec=2 and dbVARNUMERICScale = 5.
dbVARNUMERICValue:
Datatype: *BYTE
A sequence of unsigned BYTEs containing the primary value of the dvVARNUMERICData. The number of bytes in dbVARNUMERICValue is given by the formula:
CEIL(LOG(10^p, 256)), where p is the value in the dbVARNUMERICPrecision field, CEIL(x) rounds x up to the nearest integer, and LOG(y, z) is the logarithm of y to the base z.
For example, to specify the base 10 number "6553E+50" with 5 digits of precision, the number is scaled to "65530", which is %xff.fa in hexadecimal. In this case, dbVARNUMERICValue would contain the bytes %xfa and %xff, the precision would 5, the scale would be 49, and the sign would be 1.
DBTYPE-DBDATE:
Designated datatype: dbDBDATEData
A date format suitable for use in databases. The syntax of dbDBDATEData is:
dbDBDATEData = dbDBDATEYear dbDBDATEMonth dbDBDATEDay dbDBDATEYear = USHORT dbDBDATEMonth = USHORT dbDBDATEDay = USHORT
dbDBDATEYear:
Datatype: USHORT
A 2-byte signed integer, with a valid range of 0-9999, that specifies the year, measured from 0 A. D.
dbDBDATEMonth:
Datatype: USHORT
A 2-byte unsigned integer, with a valid range of 1-12, that specifies the month of the year.
dbDBDATEDay:
Datatype: USHORT
A 2-byte unsigned integer, with a valid range of 1-31, that specifies the day of the month.
DBTYPE-DBTIME:
Designated datatype: dbDBTIMEData
A time format suitable for use in databases. The syntax of dbDBTIMEData is:
dbDBTIMEData = dbDBTIMEHour dbDBTIMEMinute dbDBTIMESecond dbDBTIMEHour = USHORT dbDBTIMEMinute = USHORT dbDBTIMESecond = USHORT
dbDBDATEHour:
Datatype: USHORT
A 2-byte unsigned integer, with a valid range of 0-23, that specifies the hour of day.
dbDBDATEMinute:
Datatype: USHORT
A 2-byte unsigned integer, with a valid range of 0-59, that specifies the minute of the hour.
dbDBDATESecond:
Datatype: USHORT
A 2-byte unsigned integer, with a valid range of 0-61, that specifies the second. Although in the majority of circumstances only the range 0-59 is used, two "leap" seconds exist in the valid range for synchronization with sidereal time.
DBTYPE-DBTIMESTAMP:
Designated datatype: dbDBTIMESTAMPData
A high-precision date and time structure used primarily to record when an event of interest occurred. The syntax of dbDBTIMESTAMPData is:
dbDBTIMESTAMPData = dbDBDATEData dbDBTIMEData dbDBTIMENanoSecond dbDBTIMENanoSecond = ULONG
dbDBTIMENanoSecond:
Datatype: ULONG
A 4-byte unsigned integer that specifies the number of nanoseconds (billionths of a second) since the beginning of the last second for the time of the event.