/root/doris/be/src/util/mysql_global.h
Line | Count | Source (jump to first uncovered line) |
1 | | // Licensed to the Apache Software Foundation (ASF) under one |
2 | | // or more contributor license agreements. See the NOTICE file |
3 | | // distributed with this work for additional information |
4 | | // regarding copyright ownership. The ASF licenses this file |
5 | | // to you under the Apache License, Version 2.0 (the |
6 | | // "License"); you may not use this file except in compliance |
7 | | // with the License. You may obtain a copy of the License at |
8 | | // |
9 | | // http://www.apache.org/licenses/LICENSE-2.0 |
10 | | // |
11 | | // Unless required by applicable law or agreed to in writing, |
12 | | // software distributed under the License is distributed on an |
13 | | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
14 | | // KIND, either express or implied. See the License for the |
15 | | // specific language governing permissions and limitations |
16 | | // under the License. |
17 | | |
18 | | #pragma once |
19 | | |
20 | | #include <float.h> |
21 | | #include <stdint.h> |
22 | | |
23 | | namespace doris { |
24 | | |
25 | | typedef unsigned char uchar; |
26 | | |
27 | 311 | #define int1store(T, A) *((uint8_t*)(T)) = (uint8_t)(A) |
28 | 0 | #define int2store(T, A) *((uint16_t*)(T)) = (uint16_t)(A) |
29 | | #define int3store(T, A) \ |
30 | 0 | do { \ |
31 | 0 | *(T) = (uchar)((A)); \ |
32 | 0 | *(T + 1) = (uchar)(((uint32_t)(A) >> 8)); \ |
33 | 0 | *(T + 2) = (uchar)(((A) >> 16)); \ |
34 | 0 | } while (0) |
35 | 0 | #define int4store(T, A) *((uint32_t*)(T)) = (uint32_t)(A) |
36 | 1 | #define int8store(T, A) *((int64_t*)(T)) = (uint64_t)(A) |
37 | 0 | #define float4store(T, A) *((float*)(T)) = (float)(A) |
38 | 0 | #define float8store(T, A) *((double*)(T)) = (double)(A) |
39 | | |
40 | | #define MY_ALIGN(A, L) (((A) + (L)-1) & ~((L)-1)) |
41 | | #define SIZEOF_CHARP 8 |
42 | | |
43 | 2 | #define MAX_TINYINT_WIDTH 3 /* Max width for a TINY w.o. sign */ |
44 | 2 | #define MAX_SMALLINT_WIDTH 5 /* Max width for a SHORT w.o. sign */ |
45 | | #define MAX_MEDIUMINT_WIDTH 8 /* Max width for a INT24 w.o. sign */ |
46 | 58 | #define MAX_INT_WIDTH 10 /* Max width for a LONG w.o. sign */ |
47 | 4 | #define MAX_BIGINT_WIDTH 20 /* Max width for a LONGLONG */ |
48 | 0 | #define MAX_LARGEINT_WIDTH 39 /* Max width for a LARGEINT */ |
49 | | #define MAX_CHAR_WIDTH 255 /* Max length for a CHAR column */ |
50 | | #define MAX_BLOB_WIDTH 16777216 /* Default width for blob */ |
51 | 0 | #define MAX_TIME_WIDTH 10 /* Max width for a TIME HH:MM:SS*/ |
52 | | #define MAX_DECPT_FOR_F_FORMAT DBL_DIG |
53 | 0 | #define MAX_DATETIME_WIDTH 27 /* YYYY-MM-DD HH:MM:SS.ssssss */ |
54 | 0 | #define MAX_DECIMAL_WIDTH 29 /* Max width for a DECIMAL */ |
55 | | |
56 | | /* -[digits].E+## */ |
57 | 44 | #define MAX_FLOAT_STR_LENGTH 24 // see gutil/strings/numbers.h kFloatToBufferSize |
58 | | /* -[digits].E+### */ |
59 | 13 | #define MAX_DOUBLE_STR_LENGTH 32 // see gutil/strings/numbers.h kDoubleToBufferSize |
60 | | |
61 | | /* -[digits].[frac] */ |
62 | | #define MAX_DECIMAL_STR_LENGTH 29 |
63 | | |
64 | | } // namespace doris |