Annotation of win32/sql/mysql/include/mysql_com.h, revision 1.2

1.2     ! misha       1: /* Copyright (C) 2000 MySQL AB
        !             2: 
        !             3:    This program is free software; you can redistribute it and/or modify
        !             4:    it under the terms of the GNU General Public License as published by
        !             5:    the Free Software Foundation; version 2 of the License.
        !             6: 
        !             7:    This program is distributed in the hope that it will be useful,
        !             8:    but WITHOUT ANY WARRANTY; without even the implied warranty of
        !             9:    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        !            10:    GNU General Public License for more details.
        !            11: 
        !            12:    You should have received a copy of the GNU General Public License
        !            13:    along with this program; if not, write to the Free Software
        !            14:    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
1.1       parser     15: 
                     16: /*
                     17: ** Common definition between mysql server & client
                     18: */
                     19: 
                     20: #ifndef _mysql_com_h
                     21: #define _mysql_com_h
                     22: 
                     23: #define NAME_LEN       64              /* Field/table name length */
                     24: #define HOSTNAME_LENGTH 60
                     25: #define USERNAME_LENGTH 16
1.2     ! misha      26: #define SERVER_VERSION_LENGTH 60
        !            27: #define SQLSTATE_LENGTH 5
        !            28: 
        !            29: /*
        !            30:   USER_HOST_BUFF_SIZE -- length of string buffer, that is enough to contain
        !            31:   username and hostname parts of the user identifier with trailing zero in
        !            32:   MySQL standard format:
        !            33:   user_name_part@host_name_part\0
        !            34: */
        !            35: #define USER_HOST_BUFF_SIZE HOSTNAME_LENGTH + USERNAME_LENGTH + 2
1.1       parser     36: 
                     37: #define LOCAL_HOST     "localhost"
                     38: #define LOCAL_HOST_NAMEDPIPE "."
                     39: 
                     40: 
1.2     ! misha      41: #if defined(__WIN__) && !defined( _CUSTOMCONFIG_)
1.1       parser     42: #define MYSQL_NAMEDPIPE "MySQL"
1.2     ! misha      43: #define MYSQL_SERVICENAME "MySQL"
        !            44: #endif /* __WIN__ */
        !            45: 
        !            46: /*
        !            47:   You should add new commands to the end of this list, otherwise old
        !            48:   servers won't be able to handle them as 'unsupported'.
        !            49: */
        !            50: 
        !            51: enum enum_server_command
        !            52: {
        !            53:   COM_SLEEP, COM_QUIT, COM_INIT_DB, COM_QUERY, COM_FIELD_LIST,
        !            54:   COM_CREATE_DB, COM_DROP_DB, COM_REFRESH, COM_SHUTDOWN, COM_STATISTICS,
        !            55:   COM_PROCESS_INFO, COM_CONNECT, COM_PROCESS_KILL, COM_DEBUG, COM_PING,
        !            56:   COM_TIME, COM_DELAYED_INSERT, COM_CHANGE_USER, COM_BINLOG_DUMP,
        !            57:   COM_TABLE_DUMP, COM_CONNECT_OUT, COM_REGISTER_SLAVE,
        !            58:   COM_STMT_PREPARE, COM_STMT_EXECUTE, COM_STMT_SEND_LONG_DATA, COM_STMT_CLOSE,
        !            59:   COM_STMT_RESET, COM_SET_OPTION, COM_STMT_FETCH,
        !            60:   /* don't forget to update const char *command_name[] in sql_parse.cc */
        !            61: 
        !            62:   /* Must be last */
        !            63:   COM_END
        !            64: };
        !            65: 
        !            66: 
        !            67: /*
        !            68:   Length of random string sent by server on handshake; this is also length of
        !            69:   obfuscated password, recieved from client
        !            70: */
        !            71: #define SCRAMBLE_LENGTH 20
        !            72: #define SCRAMBLE_LENGTH_323 8
        !            73: /* length of password stored in the db: new passwords are preceeded with '*' */
        !            74: #define SCRAMBLED_PASSWORD_CHAR_LENGTH (SCRAMBLE_LENGTH*2+1)
        !            75: #define SCRAMBLED_PASSWORD_CHAR_LENGTH_323 (SCRAMBLE_LENGTH_323*2)
1.1       parser     76: 
                     77: 
                     78: #define NOT_NULL_FLAG  1               /* Field can't be NULL */
                     79: #define PRI_KEY_FLAG   2               /* Field is part of a primary key */
                     80: #define UNIQUE_KEY_FLAG 4              /* Field is part of a unique key */
                     81: #define MULTIPLE_KEY_FLAG 8            /* Field is part of a key */
                     82: #define BLOB_FLAG      16              /* Field is a blob */
                     83: #define UNSIGNED_FLAG  32              /* Field is unsigned */
                     84: #define ZEROFILL_FLAG  64              /* Field is zerofill */
1.2     ! misha      85: #define BINARY_FLAG    128             /* Field is binary   */
        !            86: 
1.1       parser     87: /* The following are only sent to new clients */
                     88: #define ENUM_FLAG      256             /* field is an enum */
                     89: #define AUTO_INCREMENT_FLAG 512                /* field is a autoincrement field */
                     90: #define TIMESTAMP_FLAG 1024            /* Field is a timestamp */
                     91: #define SET_FLAG       2048            /* field is a set */
1.2     ! misha      92: #define NO_DEFAULT_VALUE_FLAG 4096     /* Field doesn't have default value */
        !            93: #define NUM_FLAG       32768           /* Field is num (for clients) */
1.1       parser     94: #define PART_KEY_FLAG  16384           /* Intern; Part of some key */
                     95: #define GROUP_FLAG     32768           /* Intern: Group field */
                     96: #define UNIQUE_FLAG    65536           /* Intern: Used by sql_yacc */
1.2     ! misha      97: #define BINCMP_FLAG    131072          /* Intern: Used by sql_yacc */
1.1       parser     98: 
                     99: #define REFRESH_GRANT          1       /* Refresh grant tables */
                    100: #define REFRESH_LOG            2       /* Start on new log file */
                    101: #define REFRESH_TABLES         4       /* close all tables */
                    102: #define REFRESH_HOSTS          8       /* Flush host cache */
                    103: #define REFRESH_STATUS         16      /* Flush status variables */
1.2     ! misha     104: #define REFRESH_THREADS                32      /* Flush thread cache */
        !           105: #define REFRESH_SLAVE           64      /* Reset master info and restart slave
        !           106:                                           thread */
        !           107: #define REFRESH_MASTER          128     /* Remove all bin logs in the index
        !           108:                                           and truncate the index */
        !           109: 
        !           110: /* The following can't be set with mysql_refresh() */
        !           111: #define REFRESH_READ_LOCK      16384   /* Lock tables for read */
1.1       parser    112: #define REFRESH_FAST           32768   /* Intern flag */
                    113: 
1.2     ! misha     114: /* RESET (remove all queries) from query cache */
        !           115: #define REFRESH_QUERY_CACHE    65536
        !           116: #define REFRESH_QUERY_CACHE_FREE 0x20000L /* pack query cache */
        !           117: #define REFRESH_DES_KEY_FILE   0x40000L
        !           118: #define REFRESH_USER_RESOURCES 0x80000L
        !           119: 
1.1       parser    120: #define CLIENT_LONG_PASSWORD   1       /* new more secure passwords */
                    121: #define CLIENT_FOUND_ROWS      2       /* Found instead of affected rows */
                    122: #define CLIENT_LONG_FLAG       4       /* Get all column flags */
                    123: #define CLIENT_CONNECT_WITH_DB 8       /* One can specify db on connect */
                    124: #define CLIENT_NO_SCHEMA       16      /* Don't allow database.table.column */
                    125: #define CLIENT_COMPRESS                32      /* Can use compression protocol */
                    126: #define CLIENT_ODBC            64      /* Odbc client */
                    127: #define CLIENT_LOCAL_FILES     128     /* Can use LOAD DATA LOCAL */
                    128: #define CLIENT_IGNORE_SPACE    256     /* Ignore spaces before '(' */
1.2     ! misha     129: #define CLIENT_PROTOCOL_41     512     /* New 4.1 protocol */
1.1       parser    130: #define CLIENT_INTERACTIVE     1024    /* This is an interactive client */
1.2     ! misha     131: #define CLIENT_SSL              2048   /* Switch to SSL after handshake */
        !           132: #define CLIENT_IGNORE_SIGPIPE   4096    /* IGNORE sigpipes */
        !           133: #define CLIENT_TRANSACTIONS    8192    /* Client knows about transactions */
        !           134: #define CLIENT_RESERVED         16384   /* Old flag for 4.1 protocol  */
        !           135: #define CLIENT_SECURE_CONNECTION 32768  /* New 4.1 authentication */
        !           136: #define CLIENT_MULTI_STATEMENTS (1UL << 16) /* Enable/disable multi-stmt support */
        !           137: #define CLIENT_MULTI_RESULTS    (1UL << 17) /* Enable/disable multi-results */
        !           138: 
        !           139: #define CLIENT_SSL_VERIFY_SERVER_CERT (1UL << 30)
        !           140: #define CLIENT_REMEMBER_OPTIONS (1UL << 31)
        !           141: 
        !           142: #define SERVER_STATUS_IN_TRANS     1   /* Transaction has started */
        !           143: #define SERVER_STATUS_AUTOCOMMIT   2   /* Server in auto_commit mode */
        !           144: #define SERVER_MORE_RESULTS_EXISTS 8    /* Multi query - next query exists */
        !           145: #define SERVER_QUERY_NO_GOOD_INDEX_USED 16
        !           146: #define SERVER_QUERY_NO_INDEX_USED      32
        !           147: /*
        !           148:   The server was able to fulfill the clients request and opened a
        !           149:   read-only non-scrollable cursor for a query. This flag comes
        !           150:   in reply to COM_STMT_EXECUTE and COM_STMT_FETCH commands.
        !           151: */
        !           152: #define SERVER_STATUS_CURSOR_EXISTS 64
        !           153: /*
        !           154:   This flag is sent when a read-only cursor is exhausted, in reply to
        !           155:   COM_STMT_FETCH command.
        !           156: */
        !           157: #define SERVER_STATUS_LAST_ROW_SENT 128
        !           158: #define SERVER_STATUS_DB_DROPPED        256 /* A database was dropped */
        !           159: #define SERVER_STATUS_NO_BACKSLASH_ESCAPES 512
1.1       parser    160: 
1.2     ! misha     161: #define MYSQL_ERRMSG_SIZE      512
1.1       parser    162: #define NET_READ_TIMEOUT       30              /* Timeout on read */
                    163: #define NET_WRITE_TIMEOUT      60              /* Timeout on write */
                    164: #define NET_WAIT_TIMEOUT       8*60*60         /* Wait for new query */
                    165: 
1.2     ! misha     166: #define ONLY_KILL_QUERY         1
        !           167: 
1.1       parser    168: struct st_vio;                                 /* Only C */
                    169: typedef struct st_vio Vio;
1.2     ! misha     170: 
        !           171: #define MAX_TINYINT_WIDTH       3       /* Max width for a TINY w.o. sign */
        !           172: #define MAX_SMALLINT_WIDTH      5       /* Max width for a SHORT w.o. sign */
        !           173: #define MAX_MEDIUMINT_WIDTH     8       /* Max width for a INT24 w.o. sign */
        !           174: #define MAX_INT_WIDTH           10      /* Max width for a LONG w.o. sign */
        !           175: #define MAX_BIGINT_WIDTH        20      /* Max width for a LONGLONG */
        !           176: #define MAX_CHAR_WIDTH         255     /* Max length for a CHAR colum */
        !           177: #define MAX_BLOB_WIDTH         8192    /* Default width for blob */
1.1       parser    178: 
                    179: typedef struct st_net {
1.2     ! misha     180: #if !defined(CHECK_EMBEDDED_DIFFERENCES) || !defined(EMBEDDED_LIBRARY)
1.1       parser    181:   Vio* vio;
1.2     ! misha     182:   unsigned char *buff,*buff_end,*write_pos,*read_pos;
        !           183: //  my_socket fd;                                      /* For Perl DBI/dbd */
        !           184:   unsigned long max_packet,max_packet_size;
        !           185:   unsigned int pkt_nr,compress_pkt_nr;
        !           186:   unsigned int write_timeout, read_timeout, retry_count;
1.1       parser    187:   int fcntl;
1.2     ! misha     188:   my_bool compress;
        !           189:   /*
        !           190:     The following variable is set if we are doing several queries in one
        !           191:     command ( as in LOAD TABLE ... FROM MASTER ),
        !           192:     and do not want to confuse the client with OK at the wrong time
        !           193:   */
1.1       parser    194:   unsigned long remain_in_buf,length, buf_length, where_b;
1.2     ! misha     195:   unsigned int *return_status;
        !           196:   unsigned char reading_or_writing;
1.1       parser    197:   char save_char;
1.2     ! misha     198:   my_bool no_send_ok;  /* For SPs and other things that do multiple stmts */
        !           199:   my_bool no_send_eof; /* For SPs' first version read-only cursors */
        !           200:   /*
        !           201:     Set if OK packet is already sent, and we do not need to send error
        !           202:     messages
        !           203:   */
        !           204:   my_bool no_send_error;
        !           205:   /*
        !           206:     Pointer to query object in query cache, do not equal NULL (0) for
        !           207:     queries in cache that have not stored its results yet
        !           208:   */
        !           209: #endif
        !           210:   char last_error[MYSQL_ERRMSG_SIZE], sqlstate[SQLSTATE_LENGTH+1];
        !           211:   unsigned int last_errno;
        !           212:   unsigned char error;
        !           213: 
        !           214:   /*
        !           215:     'query_cache_query' should be accessed only via query cache
        !           216:     functions and methods to maintain proper locking.
        !           217:   */
        !           218:   gptr query_cache_query;
        !           219: 
        !           220:   my_bool report_error; /* We should report error (we have unreported error) */
        !           221:   my_bool return_errno;
1.1       parser    222: } NET;
                    223: 
1.2     ! misha     224: #define packet_error (~(unsigned long) 0)
        !           225: 
        !           226: enum enum_field_types { MYSQL_TYPE_DECIMAL, MYSQL_TYPE_TINY,
        !           227:                        MYSQL_TYPE_SHORT,  MYSQL_TYPE_LONG,
        !           228:                        MYSQL_TYPE_FLOAT,  MYSQL_TYPE_DOUBLE,
        !           229:                        MYSQL_TYPE_NULL,   MYSQL_TYPE_TIMESTAMP,
        !           230:                        MYSQL_TYPE_LONGLONG,MYSQL_TYPE_INT24,
        !           231:                        MYSQL_TYPE_DATE,   MYSQL_TYPE_TIME,
        !           232:                        MYSQL_TYPE_DATETIME, MYSQL_TYPE_YEAR,
        !           233:                        MYSQL_TYPE_NEWDATE, MYSQL_TYPE_VARCHAR,
        !           234:                        MYSQL_TYPE_BIT,
        !           235:                         MYSQL_TYPE_NEWDECIMAL=246,
        !           236:                        MYSQL_TYPE_ENUM=247,
        !           237:                        MYSQL_TYPE_SET=248,
        !           238:                        MYSQL_TYPE_TINY_BLOB=249,
        !           239:                        MYSQL_TYPE_MEDIUM_BLOB=250,
        !           240:                        MYSQL_TYPE_LONG_BLOB=251,
        !           241:                        MYSQL_TYPE_BLOB=252,
        !           242:                        MYSQL_TYPE_VAR_STRING=253,
        !           243:                        MYSQL_TYPE_STRING=254,
        !           244:                        MYSQL_TYPE_GEOMETRY=255
1.1       parser    245: 
                    246: };
                    247: 
1.2     ! misha     248: /* For backward compatibility */
        !           249: #define CLIENT_MULTI_QUERIES    CLIENT_MULTI_STATEMENTS    
        !           250: #define FIELD_TYPE_DECIMAL     MYSQL_TYPE_DECIMAL
        !           251: #define FIELD_TYPE_NEWDECIMAL  MYSQL_TYPE_NEWDECIMAL
        !           252: #define FIELD_TYPE_TINY        MYSQL_TYPE_TINY
        !           253: #define FIELD_TYPE_SHORT       MYSQL_TYPE_SHORT
        !           254: #define FIELD_TYPE_LONG        MYSQL_TYPE_LONG
        !           255: #define FIELD_TYPE_FLOAT       MYSQL_TYPE_FLOAT
        !           256: #define FIELD_TYPE_DOUBLE      MYSQL_TYPE_DOUBLE
        !           257: #define FIELD_TYPE_NULL        MYSQL_TYPE_NULL
        !           258: #define FIELD_TYPE_TIMESTAMP   MYSQL_TYPE_TIMESTAMP
        !           259: #define FIELD_TYPE_LONGLONG    MYSQL_TYPE_LONGLONG
        !           260: #define FIELD_TYPE_INT24       MYSQL_TYPE_INT24
        !           261: #define FIELD_TYPE_DATE        MYSQL_TYPE_DATE
        !           262: #define FIELD_TYPE_TIME        MYSQL_TYPE_TIME
        !           263: #define FIELD_TYPE_DATETIME    MYSQL_TYPE_DATETIME
        !           264: #define FIELD_TYPE_YEAR        MYSQL_TYPE_YEAR
        !           265: #define FIELD_TYPE_NEWDATE     MYSQL_TYPE_NEWDATE
        !           266: #define FIELD_TYPE_ENUM        MYSQL_TYPE_ENUM
        !           267: #define FIELD_TYPE_SET         MYSQL_TYPE_SET
        !           268: #define FIELD_TYPE_TINY_BLOB   MYSQL_TYPE_TINY_BLOB
        !           269: #define FIELD_TYPE_MEDIUM_BLOB MYSQL_TYPE_MEDIUM_BLOB
        !           270: #define FIELD_TYPE_LONG_BLOB   MYSQL_TYPE_LONG_BLOB
        !           271: #define FIELD_TYPE_BLOB        MYSQL_TYPE_BLOB
        !           272: #define FIELD_TYPE_VAR_STRING  MYSQL_TYPE_VAR_STRING
        !           273: #define FIELD_TYPE_STRING      MYSQL_TYPE_STRING
        !           274: #define FIELD_TYPE_CHAR        MYSQL_TYPE_TINY
        !           275: #define FIELD_TYPE_INTERVAL    MYSQL_TYPE_ENUM
        !           276: #define FIELD_TYPE_GEOMETRY    MYSQL_TYPE_GEOMETRY
        !           277: #define FIELD_TYPE_BIT         MYSQL_TYPE_BIT
        !           278: 
        !           279: 
        !           280: /* Shutdown/kill enums and constants */ 
        !           281: 
        !           282: /* Bits for THD::killable. */
        !           283: #define MYSQL_SHUTDOWN_KILLABLE_CONNECT    (unsigned char)(1 << 0)
        !           284: #define MYSQL_SHUTDOWN_KILLABLE_TRANS      (unsigned char)(1 << 1)
        !           285: #define MYSQL_SHUTDOWN_KILLABLE_LOCK_TABLE (unsigned char)(1 << 2)
        !           286: #define MYSQL_SHUTDOWN_KILLABLE_UPDATE     (unsigned char)(1 << 3)
        !           287: 
        !           288: enum mysql_enum_shutdown_level {
        !           289:   /*
        !           290:     We want levels to be in growing order of hardness (because we use number
        !           291:     comparisons). Note that DEFAULT does not respect the growing property, but
        !           292:     it's ok.
        !           293:   */
        !           294:   SHUTDOWN_DEFAULT = 0,
        !           295:   /* wait for existing connections to finish */
        !           296:   SHUTDOWN_WAIT_CONNECTIONS= MYSQL_SHUTDOWN_KILLABLE_CONNECT,
        !           297:   /* wait for existing trans to finish */
        !           298:   SHUTDOWN_WAIT_TRANSACTIONS= MYSQL_SHUTDOWN_KILLABLE_TRANS,
        !           299:   /* wait for existing updates to finish (=> no partial MyISAM update) */
        !           300:   SHUTDOWN_WAIT_UPDATES= MYSQL_SHUTDOWN_KILLABLE_UPDATE,
        !           301:   /* flush InnoDB buffers and other storage engines' buffers*/
        !           302:   SHUTDOWN_WAIT_ALL_BUFFERS= (MYSQL_SHUTDOWN_KILLABLE_UPDATE << 1),
        !           303:   /* don't flush InnoDB buffers, flush other storage engines' buffers*/
        !           304:   SHUTDOWN_WAIT_CRITICAL_BUFFERS= (MYSQL_SHUTDOWN_KILLABLE_UPDATE << 1) + 1,
        !           305:   /* Now the 2 levels of the KILL command */
        !           306: #if MYSQL_VERSION_ID >= 50000
        !           307:   KILL_QUERY= 254,
        !           308: #endif
        !           309:   KILL_CONNECTION= 255
        !           310: };
1.1       parser    311: 
1.2     ! misha     312: 
        !           313: enum enum_cursor_type
        !           314: {
        !           315:   CURSOR_TYPE_NO_CURSOR= 0,
        !           316:   CURSOR_TYPE_READ_ONLY= 1,
        !           317:   CURSOR_TYPE_FOR_UPDATE= 2,
        !           318:   CURSOR_TYPE_SCROLLABLE= 4
        !           319: };
        !           320: 
        !           321: 
        !           322: /* options for mysql_set_option */
        !           323: enum enum_mysql_set_option
        !           324: {
        !           325:   MYSQL_OPTION_MULTI_STATEMENTS_ON,
        !           326:   MYSQL_OPTION_MULTI_STATEMENTS_OFF
        !           327: };
1.1       parser    328: 
                    329: #define net_new_transaction(net) ((net)->pkt_nr=0)
                    330: 
1.2     ! misha     331: #ifdef __cplusplus
        !           332: extern "C" {
        !           333: #endif
        !           334: 
        !           335: my_bool        my_net_init(NET *net, Vio* vio);
        !           336: void   my_net_local_init(NET *net);
1.1       parser    337: void   net_end(NET *net);
                    338: void   net_clear(NET *net);
1.2     ! misha     339: my_bool net_realloc(NET *net, unsigned long length);
        !           340: my_bool        net_flush(NET *net);
        !           341: my_bool        my_net_write(NET *net,const char *packet,unsigned long len);
        !           342: my_bool        net_write_command(NET *net,unsigned char command,
        !           343:                          const char *header, unsigned long head_len,
        !           344:                          const char *packet, unsigned long len);
1.1       parser    345: int    net_real_write(NET *net,const char *packet,unsigned long len);
1.2     ! misha     346: unsigned long my_net_read(NET *net);
        !           347: 
        !           348: #ifdef _global_h
        !           349: void my_net_set_write_timeout(NET *net, uint timeout);
        !           350: void my_net_set_read_timeout(NET *net, uint timeout);
        !           351: #endif
        !           352: 
        !           353: /*
        !           354:   The following function is not meant for normal usage
        !           355:   Currently it's used internally by manager.c
        !           356: */
        !           357: /*
        !           358: struct sockaddr;
        !           359: int my_connect(my_socket s, const struct sockaddr *name, unsigned int namelen,
        !           360:               unsigned int timeout);
1.1       parser    361: 
                    362: struct rand_struct {
                    363:   unsigned long seed1,seed2,max_value;
                    364:   double max_value_dbl;
                    365: };
1.2     ! misha     366: */
        !           367: #ifdef __cplusplus
        !           368: }
        !           369: #endif
1.1       parser    370: 
                    371:   /* The following is for user defined functions */
                    372: 
1.2     ! misha     373: enum Item_result {STRING_RESULT=0, REAL_RESULT, INT_RESULT, ROW_RESULT,
        !           374:                   DECIMAL_RESULT};
1.1       parser    375: 
                    376: typedef struct st_udf_args
                    377: {
                    378:   unsigned int arg_count;              /* Number of arguments */
                    379:   enum Item_result *arg_type;          /* Pointer to item_results */
                    380:   char **args;                         /* Pointer to argument */
                    381:   unsigned long *lengths;              /* Length of string arguments */
                    382:   char *maybe_null;                    /* Set to 1 for all maybe_null args */
1.2     ! misha     383:   char **attributes;                    /* Pointer to attribute name */
        !           384:   unsigned long *attribute_lengths;     /* Length of attribute arguments */
1.1       parser    385: } UDF_ARGS;
                    386: 
                    387:   /* This holds information about the result */
                    388: 
                    389: typedef struct st_udf_init
                    390: {
                    391:   my_bool maybe_null;                  /* 1 if function can return NULL */
                    392:   unsigned int decimals;               /* for real functions */
1.2     ! misha     393:   unsigned long max_length;            /* For string functions */
1.1       parser    394:   char   *ptr;                         /* free pointer for function data */
                    395:   my_bool const_item;                  /* 0 if result is independent of arguments */
                    396: } UDF_INIT;
                    397: 
                    398:   /* Constants when using compression */
                    399: #define NET_HEADER_SIZE 4              /* standard header size */
                    400: #define COMP_HEADER_SIZE 3             /* compression header extra size */
                    401: 
                    402:   /* Prototypes to password functions */
                    403: 
1.2     ! misha     404: #ifdef __cplusplus
        !           405: extern "C" {
        !           406: #endif
        !           407: 
        !           408: /*
        !           409:   These functions are used for authentication by client and server and
        !           410:   implemented in sql/password.c
        !           411: */
        !           412: 
        !           413: void randominit(struct rand_struct *, unsigned long seed1,
        !           414:                 unsigned long seed2);
        !           415: double my_rnd(struct rand_struct *);
        !           416: void create_random_string(char *to, unsigned int length, struct rand_struct *rand_st);
        !           417: 
        !           418: void hash_password(unsigned long *to, const char *password, unsigned int password_len);
        !           419: void make_scrambled_password_323(char *to, const char *password);
        !           420: void scramble_323(char *to, const char *message, const char *password);
        !           421: my_bool check_scramble_323(const char *, const char *message,
        !           422:                            unsigned long *salt);
        !           423: void get_salt_from_password_323(unsigned long *res, const char *password);
        !           424: void make_password_from_salt_323(char *to, const unsigned long *salt);
        !           425: 
        !           426: void make_scrambled_password(char *to, const char *password);
        !           427: void scramble(char *to, const char *message, const char *password);
        !           428: my_bool check_scramble(const char *reply, const char *message,
        !           429:                        const unsigned char *hash_stage2);
        !           430: void get_salt_from_password(unsigned char *res, const char *password);
        !           431: void make_password_from_salt(char *to, const unsigned char *hash_stage2);
        !           432: char *octet2hex(char *to, const char *str, unsigned int len);
        !           433: 
        !           434: /* end of password.c */
        !           435: 
1.1       parser    436: char *get_tty_password(char *opt_message);
1.2     ! misha     437: const char *mysql_errno_to_sqlstate(unsigned int mysql_errno);
1.1       parser    438: 
                    439: /* Some other useful functions */
                    440: 
1.2     ! misha     441: my_bool my_init(void);
        !           442: extern int modify_defaults_file(const char *file_location, const char *option,
        !           443:                                 const char *option_value,
        !           444:                                 const char *section_name, int remove_option);
        !           445: int load_defaults(const char *conf_file, const char **groups,
        !           446:                  int *argc, char ***argv);
        !           447: my_bool my_thread_init(void);
        !           448: void my_thread_end(void);
        !           449: 
        !           450: #ifdef _global_h
        !           451: ulong STDCALL net_field_length(uchar **packet);
        !           452: my_ulonglong net_field_length_ll(uchar **packet);
        !           453: char *net_store_length(char *pkg, ulonglong length);
1.1       parser    454: #endif
                    455: 
1.2     ! misha     456: #ifdef __cplusplus
1.1       parser    457: }
                    458: #endif
1.2     ! misha     459: 
        !           460: #define NULL_LENGTH ((unsigned long) ~0) /* For net_store_length */
        !           461: #define MYSQL_STMT_HEADER       4
        !           462: #define MYSQL_LONG_DATA_HEADER  6
        !           463: 
1.1       parser    464: #endif

E-mail: