Advertisement
Uno-Dan

Untitled

Nov 12th, 2018
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 9.26 KB | None | 0 0
  1. DATA_TYPES = {
  2.     'INT': {
  3.         '''
  4.        A normal-sized integer that can be signed or unsigned. If signed, the allowable range is from
  5.        -2147483648 to 2147483647. If unsigned, the allowable range is from 0 to 4294967295. You can specify a
  6.        width of up to 11 digits.
  7.        '''
  8.         'type': 'int',
  9.         'range': {
  10.             'signed': {'low': -2147483648, 'high': 2147483647},
  11.             'unsigned': {'low': 0, 'high': 4294967295},
  12.         },
  13.     },
  14.     'TINYINT': {
  15.         '''
  16.        A very small integer that can be signed or unsigned. If signed, the allowable range is from -128 to 127.
  17.        If unsigned, the allowable range is from 0 to 255. You can specify a width of up to 4 digits.
  18.        '''
  19.         'type': 'tinyint',
  20.         'range': {
  21.             'signed': {'low': -128, 'high': 127},
  22.             'unsigned': {'low': 0, 'high': 255},
  23.         }
  24.     },
  25.     'SMALLINT': {
  26.         '''
  27.        A small integer that can be signed or unsigned. If signed, the allowable range is from -32768 to 32767.
  28.        If unsigned, the allowable range is from 0 to 65535. You can specify a width of up to 5 digits.
  29.        '''
  30.         'type': 'smallint',
  31.         'range': {
  32.             'signed': {'low': -32768, 'high': 32767},
  33.             'unsigned': {'low': 0, 'high': 65535},
  34.         }
  35.     },
  36.     'MEDIUMINT': {
  37.         '''
  38.        A medium-sized integer that can be signed or unsigned. If signed, the allowable range is from -8388608 to
  39.        8388607. If unsigned, the allowable range is from 0 to 16777215. You can specify a width of up to 9 digits.
  40.        '''
  41.         'type': 'mediumint',
  42.         'range': {
  43.             'signed': {'low': -8388608, 'high': 8388607},
  44.             'unsigned': {'low': 0, 'high': 16777215},
  45.         }
  46.     },
  47.     'BIGINT': {
  48.         '''
  49.        A large integer that can be signed or unsigned. If signed, the allowable range is from
  50.        -9223372036854775808 to 9223372036854775807. If unsigned, the allowable range is
  51.        from 0 to 18446744073709551615. You can specify a width of up to 20 digits.
  52.        '''
  53.         'type': 'bigint',
  54.         'range': {
  55.             'signed': {'low': -9223372036854775808, 'high': 9223372036854775807},
  56.             'unsigned': {'low': 0, 'high': 18446744073709551615},
  57.         }
  58.     },
  59.     'FLOAT': {
  60.         '''
  61.        A floating-point number that cannot be unsigned. You can define the display length and the number of
  62.        decimals. This is not required and will default to 10,2, where 2 is the number of decimals and 10 is
  63.        the total number of digits (including decimals). Decimal precision can go to 24 places for a FLOAT.
  64.        '''
  65.         'type': 'float',
  66.         'length': 10,
  67.         'decimals': 2,
  68.         'precision': 24,
  69.     },
  70.     'DOUBLE': {
  71.         '''
  72.        A double precision floating-point number that cannot be unsigned. You can define the display length and
  73.        the number of decimals. This is not required and will default to 16,4, where 4 is the number of decimals.
  74.        Decimal precision can go to 53 places for a DOUBLE. REAL is a synonym for DOUBLE.
  75.        '''
  76.         'type': 'double',
  77.         'length': 16,
  78.         'decimals': 4,
  79.         'precision': 53,
  80.     },
  81.     'DECIMAL': {
  82.         '''
  83.        An unpacked floating-point number that cannot be unsigned. In the unpacked decimals, each decimal
  84.        corresponds to one byte. Defining the display length (M) and the number of decimals (D) is required.
  85.        NUMERIC is a synonym for DECIMAL. (Same as FLOAT)
  86.        '''
  87.         'type': 'decimal',
  88.         'length': 10,
  89.         'decimals': 2,
  90.         'precision': 24,
  91.     },
  92.     'DATE': {
  93.         '''
  94.        A date in YYYY-MM-DD format, between 1000-01-01 and 9999-12-31.
  95.        For example, December 30th, 1973 would be stored as 1973-12-30.
  96.        '''
  97.         'type': 'date',
  98.         'length': 10,
  99.         'date': None,
  100.         'range': {
  101.             'low': '1000-01-01',
  102.             'high': '9999-12-31'
  103.         }
  104.     },
  105.     'DATETIME': {
  106.         '''
  107.        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.
  108.        For example, 3:30 in the afternoon on December 30th, 1973 would be stored as 1973-12-30 15:30:00.
  109.        '''
  110.         'type': 'datetime',
  111.         'length': 19,
  112.         'datetime': None,
  113.         'range': {
  114.             'low': '1000-01-01 00:00:00',
  115.             'high': '9999-12-31 23:59:59'
  116.         }
  117.     },
  118.     'TIMESTAMP': {
  119.         '''
  120.        A timestamp between midnight, January 1st, 1970 and sometime in 2037. This looks like the previous DATETIME
  121.        format, only without the hyphens between numbers; 3:30 in the afternoon on December 30th, 1973 would be
  122.        stored as 19731230153000 (YYYYMMDDHHMMSS).
  123.        '''
  124.         'type': 'timestamp',
  125.         'length': 14,
  126.         'timestamp': None,
  127.         'range': {
  128.             'low': '19700101000000',
  129.             'high': '20700101000000'
  130.         }
  131.     },
  132.     'TIME': {
  133.         '''
  134.        Stores the time in a HH:MM:SS format.
  135.        '''
  136.         'type': 'time',
  137.         'length': 8,
  138.         'time': None,
  139.         'range': {
  140.             'low': '00:00:00',
  141.             'high': '11:59:59'
  142.         }
  143.     },
  144.     'YEAR': {
  145.         '''
  146.        Stores a year in a 2-digit or a 4-digit format. If the length is specified as 2 (for example YEAR(2)),
  147.        YEAR can be between 1970 to 2069 (70 to 69). If the length is specified as 4, then YEAR can be 1901 to 2155.
  148.        The default length is 4.
  149.        '''
  150.         'type': 'year',
  151.         'length': 4,
  152.         'year': None,
  153.         'range': {
  154.             'low': 1901,
  155.             'high': 2155
  156.         }
  157.     },
  158.     'CHAR': {
  159.         '''
  160.        A fixed-length string between 1 and 255 characters in length right-padded with spaces
  161.        to the specified length when stored. Defining a length is not required, but the default is 1.
  162.        '''
  163.         'type': 'char',
  164.         'length': None,
  165.         'char': None,
  166.         'range': {
  167.             'low': 1,
  168.             'high': 255
  169.         }
  170.     },
  171.     'VARCHAR': {
  172.         '''
  173.        A variable-length string between 1 and 255 characters in length. For example, VARCHAR(25).
  174.        You must define a length when creating a VARCHAR field.
  175.        '''
  176.         'type': 'varchar',
  177.         'length': None,
  178.         'char': None,
  179.         'range': {
  180.             'low': 1,
  181.             'high': 255
  182.         }
  183.     },
  184.     'TEXT': {
  185.         '''
  186.        A field with a maximum length of 65535 characters. TEXT's are "Binary Large Objects" and
  187.        are used to store large amounts of binary data, such as images or other types of files.
  188.        '''
  189.         'type': 'text',
  190.         'length': None,
  191.         'char': None,
  192.         'range': {
  193.             'low': 0,
  194.             'high': 65535
  195.         }
  196.     },
  197.     'BLOB': {
  198.         '''
  199.        A field with a maximum length of 65535 characters. BLOB's are "Binary Large Objects" and
  200.        are used to store large amounts of binary data, such as images or other types of files.
  201.        '''
  202.         'type': 'blob',
  203.         'length': None,
  204.         'char': None,
  205.         'range': {
  206.             'low': 0,
  207.             'high': 65535
  208.         }
  209.     },
  210.     'TINYTEXT': {
  211.         '''
  212.        A TINYTEXT column with a maximum length of 255 characters.
  213.        '''
  214.         'type': 'tinytext',
  215.         'char': None,
  216.         'range': {
  217.             'low': 0,
  218.             'high': 255
  219.         }
  220.     },
  221.     'TINYBLOB': {
  222.         '''
  223.        A TINYBLOB column with a maximum length of 255 characters.
  224.        '''
  225.         'type': 'tinyblob',
  226.         'char': None,
  227.         'range': {
  228.             'low': 0,
  229.             'high': 255
  230.         }
  231.     },
  232.     'MEDIUMTEXT': {
  233.         '''
  234.        A MEDIUMTEXT column with a maximum length of 16777215 characters.
  235.        '''
  236.         'type': 'mediumtext',
  237.         'char': None,
  238.         'range': {
  239.             'low': 0,
  240.             'high': 16777215
  241.         }
  242.     },
  243.     'MEDIUMBLOB': {
  244.         '''
  245.        A MEDIUMBLOB column with a maximum length of 16777215 characters.
  246.        '''
  247.         'type': 'mediumblob',
  248.         'char': None,
  249.         'range': {
  250.             'low': 0,
  251.             'high': 16777215
  252.         }
  253.     },
  254.     'LONGTEXT': {
  255.         '''
  256.        A LONGTEXT column with a maximum length of 4294967295 characters.
  257.        '''
  258.         'type': 'longtext',
  259.         'char': None,
  260.         'range': {
  261.             'low': 0,
  262.             'high': 4294967295
  263.         }
  264.     },
  265.     'LONGBLOB': {
  266.         '''
  267.        A LONGBLOB column with a maximum length of 4294967295 characters.
  268.        '''
  269.         'type': 'longblob',
  270.         'char': None,
  271.         'range': {
  272.             'low': 0,
  273.             'high': 4294967295
  274.         }
  275.     },
  276.     'ENUM': {
  277.         '''
  278.        An enumeration, which is a fancy term for list. When defining an ENUM, you are creating a list of items
  279.        from which the value must be selected (or it can be NULL). For example, if you wanted your field to
  280.        contain "A" or "B" or "C", you would define your ENUM as ENUM ('A', 'B', 'C') and only those values (or NULL)
  281.        could ever populate that field.
  282.        '''
  283.         'type': 'enum',
  284.         'char': None,
  285.         'list': []
  286.     },
  287. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement