My Project
unireg.h
00001 #ifndef UNIREG_INCLUDED
00002 #define UNIREG_INCLUDED
00003 
00004 /* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; version 2 of the License.
00009 
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013    GNU General Public License for more details.
00014 
00015    You should have received a copy of the GNU General Public License
00016    along with this program; if not, write to the Free Software Foundation,
00017    51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
00018 
00019 
00020 #include "my_global.h"                          /* ulonglong */
00021 #include "mysql_version.h"                      /* FRM_VER */
00022 
00023 /*  Extra functions used by unireg library */
00024 
00025 typedef struct st_ha_create_information HA_CREATE_INFO;
00026 
00027 #ifndef NO_ALARM_LOOP
00028 #define NO_ALARM_LOOP           /* lib5 and popen can't use alarm */
00029 #endif
00030 
00031 /* These paths are converted to other systems (WIN95) before use */
00032 
00033 #define LANGUAGE        "english/"
00034 #define ERRMSG_FILE     "errmsg.sys"
00035 #define TEMP_PREFIX     "MY"
00036 #define LOG_PREFIX      "ML"
00037 #define PROGDIR         "bin/"
00038 #ifndef MYSQL_DATADIR
00039 #define MYSQL_DATADIR           "data/"
00040 #endif
00041 #ifndef SHAREDIR
00042 #define SHAREDIR        "share/"
00043 #endif
00044 #ifndef PLUGINDIR
00045 #define PLUGINDIR       "lib/plugin"
00046 #endif
00047 
00048 #define CURRENT_THD_ERRMSGS current_thd->variables.lc_messages->errmsgs->errmsgs
00049 #define DEFAULT_ERRMSGS     my_default_lc_messages->errmsgs->errmsgs
00050 
00051 #define ER(X)         CURRENT_THD_ERRMSGS[(X) - ER_ERROR_FIRST]
00052 #define ER_DEFAULT(X) DEFAULT_ERRMSGS[(X) - ER_ERROR_FIRST]
00053 #define ER_SAFE(X) (((X) >= ER_ERROR_FIRST && (X) <= ER_ERROR_LAST) ? ER(X) : "Invalid error code")
00054 #define ER_THD(thd,X) ((thd)->variables.lc_messages->errmsgs->errmsgs[(X) - \
00055                        ER_ERROR_FIRST])
00056 #define ER_THD_OR_DEFAULT(thd,X) ((thd) ? ER_THD(thd, X) : ER_DEFAULT(X))
00057 
00058 
00059 #define ME_INFO (ME_HOLDTANG+ME_OLDWIN+ME_NOREFRESH)
00060 #define ME_ERROR (ME_BELL+ME_OLDWIN+ME_NOREFRESH)
00061 #define MYF_RW MYF(MY_WME+MY_NABP)              /* Vid my_read & my_write */
00062 
00063 #define SPECIAL_USE_LOCKS       1               /* Lock used databases */
00064 #define SPECIAL_NO_NEW_FUNC     2               /* Skip new functions */
00065 #define SPECIAL_SKIP_SHOW_DB    4               /* Don't allow 'show db' */
00066 #define SPECIAL_WAIT_IF_LOCKED  8               /* Wait if locked database */
00067 #define SPECIAL_SAME_DB_NAME   16               /* form name = file name */
00068 #define SPECIAL_ENGLISH        32               /* English error messages */
00069 #define SPECIAL_NO_RESOLVE     64               /* Don't use gethostname */
00070 #define SPECIAL_NO_PRIOR        128             /* Obsolete */
00071 #define SPECIAL_BIG_SELECTS     256             /* Don't use heap tables */
00072 #define SPECIAL_NO_HOST_CACHE   512             /* Don't cache hosts */
00073 #define SPECIAL_SHORT_LOG_FORMAT 1024
00074 /* 2048 is no longer used */
00075 #define SPECIAL_LOG_QUERIES_NOT_USING_INDEXES 4096 /* Obsolete */
00076 
00077         /* Extern defines */
00078 #define store_record(A,B) memcpy((A)->B,(A)->record[0],(size_t) (A)->s->reclength)
00079 #define restore_record(A,B) memcpy((A)->record[0],(A)->B,(size_t) (A)->s->reclength)
00080 #define cmp_record(A,B) memcmp((A)->record[0],(A)->B,(size_t) (A)->s->reclength)
00081 #define empty_record(A) { \
00082                           restore_record((A),s->default_values); \
00083                           memset((A)->null_flags, 255, (A)->s->null_bytes);\
00084                         }
00085 
00086         /* Defines for use with openfrm, openprt and openfrd */
00087 
00088 #define READ_ALL                1       /* openfrm: Read all parameters */
00089 #define CHANGE_FRM              2       /* openfrm: open .frm as O_RDWR */
00090 #define READ_KEYINFO            4       /* L{s nyckeldata fr}n filen */
00091 #define EXTRA_RECORD            8       /* Reservera plats f|r extra record */
00092 #define DONT_OPEN_TABLES        8       /* Don't open database-files (frd) */
00093 #define DONT_OPEN_MASTER_REG    16      /* Don't open first reg-file (prt) */
00094 #define EXTRA_LONG_RECORD       16      /* Plats f|r dubbel s|k-record */
00095 #define COMPUTE_TYPES           32      /* Kontrollera type f|r f{ltena */
00096 #define SEARCH_PRG              64      /* S|k efter registret i 'prg_dev' */
00097 #define READ_USED_NAMES         128     /* L{s anv{nda formul{rnamn */
00098 #define DONT_GIVE_ERROR         256     /* Don't do frm_error on openfrm  */
00099 #define READ_SCREENS            1024    /* Read screens, info and helpfile */
00100 #define DELAYED_OPEN            4096    /* Open table later */
00101 #define OPEN_VIEW               8192    /* Allow open on view */
00102 #define OPEN_VIEW_NO_PARSE     16384    /* Open frm only if it's a view,
00103                                            but do not parse view itself */
00104 
00109 #define OPEN_FRM_FILE_ONLY     32768
00110 
00116 #define OPEN_TABLE_ONLY        OPEN_FRM_FILE_ONLY*2
00117 
00123 #define OPEN_VIEW_ONLY         OPEN_TABLE_ONLY*2
00124 
00130 #define OPEN_VIEW_FULL         OPEN_VIEW_ONLY*2
00131 
00136 #define OPTIMIZE_I_S_TABLE     OPEN_VIEW_FULL*2
00137 
00140 #define OPEN_TRIGGER_ONLY      OPTIMIZE_I_S_TABLE*2
00141 
00144 #define CHECK_METADATA_VERSION OPEN_TRIGGER_ONLY*2
00145 
00146 #define SC_INFO_LENGTH 4                /* Form format constant */
00147 #define TE_INFO_LENGTH 3
00148 #define MTYP_NOEMPTY_BIT 128
00149 
00150 /*
00151   Minimum length pattern before Turbo Boyer-Moore is used
00152   for SELECT "text" LIKE "%pattern%", excluding the two
00153   wildcards in class Item_func_like.
00154 */
00155 #define MIN_TURBOBM_PATTERN_LEN 3
00156 
00157 /* 
00158    Defines for binary logging.
00159    Do not decrease the value of BIN_LOG_HEADER_SIZE.
00160    Do not even increase it before checking code.
00161 */
00162 
00163 #define BIN_LOG_HEADER_SIZE    4 
00164 
00165 #define DEFAULT_KEY_CACHE_NAME "default"
00166 
00167 /* Include prototypes for unireg */
00168 
00169 #include "mysqld_error.h"
00170 #include "structs.h"                            /* All structs we need */
00171 #include "sql_list.h"                           /* List<> */
00172 #include "field.h"                              /* Create_field */
00173 
00174 bool mysql_create_frm(THD *thd, const char *file_name,
00175                       const char *db, const char *table,
00176                       HA_CREATE_INFO *create_info,
00177                       List<Create_field> &create_field,
00178                       uint key_count,KEY *key_info,handler *db_type);
00179 int rea_create_table(THD *thd, const char *path,
00180                      const char *db, const char *table_name,
00181                      HA_CREATE_INFO *create_info,
00182                      List<Create_field> &create_field,
00183                      uint key_count,KEY *key_info,
00184                      handler *file,
00185                      bool no_ha_table);
00186 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines