/* * Copyright (c) 2020, Alibaba Group Holding Limited * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include "../core/port/likely.h" #include /** Max table name length as defined in univ.i */ #define MAX_TABLE_NAME_LEN 320 #define MAX_DATABASE_NAME_LEN MAX_TABLE_NAME_LEN #define MAX_FULL_NAME_LEN \ (MAX_TABLE_NAME_LEN + MAX_DATABASE_NAME_LEN + 14) /** Representation of a byte within X-Engine */ typedef unsigned char xengine_byte_t; /** Representation of an unsigned long int within X-Engine */ typedef unsigned long int xengine_ulint_t; /** A signed 8 bit integral type. */ typedef int8_t xengine_i8_t; /** An unsigned 8 bit integral type. */ typedef uint8_t xengine_u8_t; /** A signed 16 bit integral type. */ typedef int16_t xengine_i16_t; /** An unsigned 16 bit integral type. */ typedef uint16_t xengine_u16_t; /** A signed 32 bit integral type. */ typedef int32_t xengine_i32_t; /** An unsigned 32 bit integral type. */ typedef uint32_t xengine_u32_t; /** A signed 64 bit integral type. */ typedef int64_t xengine_i64_t; /** An unsigned 64 bit integral type. */ typedef uint64_t xengine_u64_t; /** Generical X-Engine callback prototype. */ typedef void (*xengine_cb_t)(void); typedef void* xengine_opaque_t; typedef xengine_opaque_t XENGINE_CHARset_t; typedef xengine_ulint_t xengine_bool_t; typedef xengine_u64_t xengine_id_u64_t; enum dberr_t { DB_SUCCESS_LOCKED_REC = 9, /*!< like DB_SUCCESS, but a new explicit record lock was created */ DB_SUCCESS = 10, /* The following are error codes */ DB_ERROR, DB_INTERRUPTED, DB_OUT_OF_MEMORY, DB_OUT_OF_FILE_SPACE, DB_LOCK_WAIT, DB_DEADLOCK, DB_ROLLBACK, DB_DUPLICATE_KEY, DB_QUE_THR_SUSPENDED, DB_MISSING_HISTORY, /*!< required history data has been deleted due to lack of space in rollback segment */ DB_CLUSTER_NOT_FOUND = 30, DB_TABLE_NOT_FOUND, DB_MUST_GET_MORE_FILE_SPACE, /*!< the database has to be stopped and restarted with more file space */ DB_TABLE_IS_BEING_USED, DB_TOO_BIG_RECORD, /*!< a record in an index would not fit on a compressed page, or it would become bigger than 1/2 free space in an uncompressed page frame */ DB_LOCK_WAIT_TIMEOUT, /*!< lock wait lasted too long */ DB_NO_REFERENCED_ROW, /*!< referenced key value not found for a foreign key in an insert or update of a row */ DB_ROW_IS_REFERENCED, /*!< cannot delete or update a row because it contains a key value which is referenced */ DB_CANNOT_ADD_CONSTRAINT, /*!< adding a foreign key constraint to a table failed */ DB_CORRUPTION, /*!< data structure corruption noticed */ DB_CANNOT_DROP_CONSTRAINT, /*!< dropping a foreign key constraint from a table failed */ DB_NO_SAVEPOINT, /*!< no savepoint exists with the given name */ DB_TABLESPACE_EXISTS, /*!< we cannot create a new single-table tablespace because a file of the same name already exists */ DB_TABLESPACE_DELETED, /*!< tablespace was deleted or is being dropped right now */ DB_TABLESPACE_NOT_FOUND, /*