Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DATA_TYPES = {
- 'INT': {
- '''
- A normal-sized integer that can be signed or unsigned. If signed, the allowable range is from
- -2147483648 to 2147483647. If unsigned, the allowable range is from 0 to 4294967295. You can specify a
- width of up to 11 digits.
- '''
- 'type': 'int',
- 'range': {
- 'signed': {'low': -2147483648, 'high': 2147483647},
- 'unsigned': {'low': 0, 'high': 4294967295},
- },
- },
- 'TINYINT': {
- '''
- A very small integer that can be signed or unsigned. If signed, the allowable range is from -128 to 127.
- If unsigned, the allowable range is from 0 to 255. You can specify a width of up to 4 digits.
- '''
- 'type': 'tinyint',
- 'range': {
- 'signed': {'low': -128, 'high': 127},
- 'unsigned': {'low': 0, 'high': 255},
- }
- },
- 'SMALLINT': {
- '''
- A small integer that can be signed or unsigned. If signed, the allowable range is from -32768 to 32767.
- If unsigned, the allowable range is from 0 to 65535. You can specify a width of up to 5 digits.
- '''
- 'type': 'smallint',
- 'range': {
- 'signed': {'low': -32768, 'high': 32767},
- 'unsigned': {'low': 0, 'high': 65535},
- }
- },
- 'MEDIUMINT': {
- '''
- A medium-sized integer that can be signed or unsigned. If signed, the allowable range is from -8388608 to
- 8388607. If unsigned, the allowable range is from 0 to 16777215. You can specify a width of up to 9 digits.
- '''
- 'type': 'mediumint',
- 'range': {
- 'signed': {'low': -8388608, 'high': 8388607},
- 'unsigned': {'low': 0, 'high': 16777215},
- }
- },
- 'BIGINT': {
- '''
- A large integer that can be signed or unsigned. If signed, the allowable range is from
- -9223372036854775808 to 9223372036854775807. If unsigned, the allowable range is
- from 0 to 18446744073709551615. You can specify a width of up to 20 digits.
- '''
- 'type': 'bigint',
- 'range': {
- 'signed': {'low': -9223372036854775808, 'high': 9223372036854775807},
- 'unsigned': {'low': 0, 'high': 18446744073709551615},
- }
- },
- 'FLOAT': {
- '''
- A floating-point number that cannot be unsigned. You can define the display length and the number of
- decimals. This is not required and will default to 10,2, where 2 is the number of decimals and 10 is
- the total number of digits (including decimals). Decimal precision can go to 24 places for a FLOAT.
- '''
- 'type': 'float',
- 'length': 10,
- 'decimals': 2,
- 'precision': 24,
- },
- 'DOUBLE': {
- '''
- A double precision floating-point number that cannot be unsigned. You can define the display length and
- the number of decimals. This is not required and will default to 16,4, where 4 is the number of decimals.
- Decimal precision can go to 53 places for a DOUBLE. REAL is a synonym for DOUBLE.
- '''
- 'type': 'double',
- 'length': 16,
- 'decimals': 4,
- 'precision': 53,
- },
- 'DECIMAL': {
- '''
- An unpacked floating-point number that cannot be unsigned. In the unpacked decimals, each decimal
- corresponds to one byte. Defining the display length (M) and the number of decimals (D) is required.
- NUMERIC is a synonym for DECIMAL. (Same as FLOAT)
- '''
- 'type': 'decimal',
- 'length': 10,
- 'decimals': 2,
- 'precision': 24,
- },
- 'DATE': {
- '''
- A date in YYYY-MM-DD format, between 1000-01-01 and 9999-12-31.
- For example, December 30th, 1973 would be stored as 1973-12-30.
- '''
- 'type': 'date',
- 'length': 10,
- 'date': None,
- 'range': {
- 'low': '1000-01-01',
- 'high': '9999-12-31'
- }
- },
- 'DATETIME': {
- '''
- A date and time combination in YYYY-MM-DD HH:MM:SS format, between 1000-01-01 00:00:00 and 9999-12-31 23:59:59.
- For example, 3:30 in the afternoon on December 30th, 1973 would be stored as 1973-12-30 15:30:00.
- '''
- 'type': 'datetime',
- 'length': 19,
- 'datetime': None,
- 'range': {
- 'low': '1000-01-01 00:00:00',
- 'high': '9999-12-31 23:59:59'
- }
- },
- 'TIMESTAMP': {
- '''
- A timestamp between midnight, January 1st, 1970 and sometime in 2037. This looks like the previous DATETIME
- format, only without the hyphens between numbers; 3:30 in the afternoon on December 30th, 1973 would be
- stored as 19731230153000 (YYYYMMDDHHMMSS).
- '''
- 'type': 'timestamp',
- 'length': 14,
- 'timestamp': None,
- 'range': {
- 'low': '19700101000000',
- 'high': '20700101000000'
- }
- },
- 'TIME': {
- '''
- Stores the time in a HH:MM:SS format.
- '''
- 'type': 'time',
- 'length': 8,
- 'time': None,
- 'range': {
- 'low': '00:00:00',
- 'high': '11:59:59'
- }
- },
- 'YEAR': {
- '''
- Stores a year in a 2-digit or a 4-digit format. If the length is specified as 2 (for example YEAR(2)),
- YEAR can be between 1970 to 2069 (70 to 69). If the length is specified as 4, then YEAR can be 1901 to 2155.
- The default length is 4.
- '''
- 'type': 'year',
- 'length': 4,
- 'year': None,
- 'range': {
- 'low': 1901,
- 'high': 2155
- }
- },
- 'CHAR': {
- '''
- A fixed-length string between 1 and 255 characters in length right-padded with spaces
- to the specified length when stored. Defining a length is not required, but the default is 1.
- '''
- 'type': 'char',
- 'length': None,
- 'char': None,
- 'range': {
- 'low': 1,
- 'high': 255
- }
- },
- 'VARCHAR': {
- '''
- A variable-length string between 1 and 255 characters in length. For example, VARCHAR(25).
- You must define a length when creating a VARCHAR field.
- '''
- 'type': 'varchar',
- 'length': None,
- 'char': None,
- 'range': {
- 'low': 1,
- 'high': 255
- }
- },
- 'TEXT': {
- '''
- A field with a maximum length of 65535 characters. TEXT's are "Binary Large Objects" and
- are used to store large amounts of binary data, such as images or other types of files.
- '''
- 'type': 'text',
- 'length': None,
- 'char': None,
- 'range': {
- 'low': 0,
- 'high': 65535
- }
- },
- 'BLOB': {
- '''
- A field with a maximum length of 65535 characters. BLOB's are "Binary Large Objects" and
- are used to store large amounts of binary data, such as images or other types of files.
- '''
- 'type': 'blob',
- 'length': None,
- 'char': None,
- 'range': {
- 'low': 0,
- 'high': 65535
- }
- },
- 'TINYTEXT': {
- '''
- A TINYTEXT column with a maximum length of 255 characters.
- '''
- 'type': 'tinytext',
- 'char': None,
- 'range': {
- 'low': 0,
- 'high': 255
- }
- },
- 'TINYBLOB': {
- '''
- A TINYBLOB column with a maximum length of 255 characters.
- '''
- 'type': 'tinyblob',
- 'char': None,
- 'range': {
- 'low': 0,
- 'high': 255
- }
- },
- 'MEDIUMTEXT': {
- '''
- A MEDIUMTEXT column with a maximum length of 16777215 characters.
- '''
- 'type': 'mediumtext',
- 'char': None,
- 'range': {
- 'low': 0,
- 'high': 16777215
- }
- },
- 'MEDIUMBLOB': {
- '''
- A MEDIUMBLOB column with a maximum length of 16777215 characters.
- '''
- 'type': 'mediumblob',
- 'char': None,
- 'range': {
- 'low': 0,
- 'high': 16777215
- }
- },
- 'LONGTEXT': {
- '''
- A LONGTEXT column with a maximum length of 4294967295 characters.
- '''
- 'type': 'longtext',
- 'char': None,
- 'range': {
- 'low': 0,
- 'high': 4294967295
- }
- },
- 'LONGBLOB': {
- '''
- A LONGBLOB column with a maximum length of 4294967295 characters.
- '''
- 'type': 'longblob',
- 'char': None,
- 'range': {
- 'low': 0,
- 'high': 4294967295
- }
- },
- 'ENUM': {
- '''
- An enumeration, which is a fancy term for list. When defining an ENUM, you are creating a list of items
- from which the value must be selected (or it can be NULL). For example, if you wanted your field to
- contain "A" or "B" or "C", you would define your ENUM as ENUM ('A', 'B', 'C') and only those values (or NULL)
- could ever populate that field.
- '''
- 'type': 'enum',
- 'char': None,
- 'list': []
- },
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement