⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mysql_com.h

📁 vc连接mysql的封装类
💻 H
📖 第 1 页 / 共 2 页
字号:
/* Copyright (C) 2000 MySQL AB   This program is free software; you can redistribute it and/or modify   it under the terms of the GNU General Public License as published by   the Free Software Foundation; either version 2 of the License, or   (at your option) any later version.   This program is distributed in the hope that it will be useful,   but WITHOUT ANY WARRANTY; without even the implied warranty of   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   GNU General Public License for more details.   You should have received a copy of the GNU General Public License   along with this program; if not, write to the Free Software   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA *//*** Common definition between mysql server & client*/#ifndef _mysql_com_h#define _mysql_com_h#define NAME_LEN	64		/* Field/table name length */#define HOSTNAME_LENGTH 60#define USERNAME_LENGTH 16#define SERVER_VERSION_LENGTH 60#define SQLSTATE_LENGTH 5/*  USER_HOST_BUFF_SIZE -- length of string buffer, that is enough to contain  username and hostname parts of the user identifier with trailing zero in  MySQL standard format:  user_name_part@host_name_part\0*/#define USER_HOST_BUFF_SIZE HOSTNAME_LENGTH + USERNAME_LENGTH + 2#define LOCAL_HOST	"localhost"#define LOCAL_HOST_NAMEDPIPE "."#if defined(__WIN__) && !defined( _CUSTOMCONFIG_)#define MYSQL_NAMEDPIPE "MySQL"#define MYSQL_SERVICENAME "MySQL"#endif /* __WIN__ *//*  You should add new commands to the end of this list, otherwise old  servers won't be able to handle them as 'unsupported'.*/enum enum_server_command{  COM_SLEEP, COM_QUIT, COM_INIT_DB, COM_QUERY, COM_FIELD_LIST,  COM_CREATE_DB, COM_DROP_DB, COM_REFRESH, COM_SHUTDOWN, COM_STATISTICS,  COM_PROCESS_INFO, COM_CONNECT, COM_PROCESS_KILL, COM_DEBUG, COM_PING,  COM_TIME, COM_DELAYED_INSERT, COM_CHANGE_USER, COM_BINLOG_DUMP,  COM_TABLE_DUMP, COM_CONNECT_OUT, COM_REGISTER_SLAVE,  COM_STMT_PREPARE, COM_STMT_EXECUTE, COM_STMT_SEND_LONG_DATA, COM_STMT_CLOSE,  COM_STMT_RESET, COM_SET_OPTION, COM_STMT_FETCH,  /* don't forget to update const char *command_name[] in sql_parse.cc */  /* Must be last */  COM_END};/*  Length of random string sent by server on handshake; this is also length of  obfuscated password, recieved from client*/#define SCRAMBLE_LENGTH 20#define SCRAMBLE_LENGTH_323 8/* length of password stored in the db: new passwords are preceeded with '*' */#define SCRAMBLED_PASSWORD_CHAR_LENGTH (SCRAMBLE_LENGTH*2+1)#define SCRAMBLED_PASSWORD_CHAR_LENGTH_323 (SCRAMBLE_LENGTH_323*2)#define NOT_NULL_FLAG	1		/* Field can't be NULL */#define PRI_KEY_FLAG	2		/* Field is part of a primary key */#define UNIQUE_KEY_FLAG 4		/* Field is part of a unique key */#define MULTIPLE_KEY_FLAG 8		/* Field is part of a key */#define BLOB_FLAG	16		/* Field is a blob */#define UNSIGNED_FLAG	32		/* Field is unsigned */#define ZEROFILL_FLAG	64		/* Field is zerofill */#define BINARY_FLAG	128		/* Field is binary   *//* The following are only sent to new clients */#define ENUM_FLAG	256		/* field is an enum */#define AUTO_INCREMENT_FLAG 512		/* field is a autoincrement field */#define TIMESTAMP_FLAG	1024		/* Field is a timestamp */#define SET_FLAG	2048		/* field is a set */#define NO_DEFAULT_VALUE_FLAG 4096	/* Field doesn't have default value */#define NUM_FLAG	32768		/* Field is num (for clients) */#define PART_KEY_FLAG	16384		/* Intern; Part of some key */#define GROUP_FLAG	32768		/* Intern: Group field */#define UNIQUE_FLAG	65536		/* Intern: Used by sql_yacc */#define BINCMP_FLAG	131072		/* Intern: Used by sql_yacc */#define REFRESH_GRANT		1	/* Refresh grant tables */#define REFRESH_LOG		2	/* Start on new log file */#define REFRESH_TABLES		4	/* close all tables */#define REFRESH_HOSTS		8	/* Flush host cache */#define REFRESH_STATUS		16	/* Flush status variables */#define REFRESH_THREADS		32	/* Flush thread cache */#define REFRESH_SLAVE           64      /* Reset master info and restart slave					   thread */#define REFRESH_MASTER          128     /* Remove all bin logs in the index					   and truncate the index *//* The following can't be set with mysql_refresh() */#define REFRESH_READ_LOCK	16384	/* Lock tables for read */#define REFRESH_FAST		32768	/* Intern flag *//* RESET (remove all queries) from query cache */#define REFRESH_QUERY_CACHE	65536#define REFRESH_QUERY_CACHE_FREE 0x20000L /* pack query cache */#define REFRESH_DES_KEY_FILE	0x40000L#define REFRESH_USER_RESOURCES	0x80000L#define CLIENT_LONG_PASSWORD	1	/* new more secure passwords */#define CLIENT_FOUND_ROWS	2	/* Found instead of affected rows */#define CLIENT_LONG_FLAG	4	/* Get all column flags */#define CLIENT_CONNECT_WITH_DB	8	/* One can specify db on connect */#define CLIENT_NO_SCHEMA	16	/* Don't allow database.table.column */#define CLIENT_COMPRESS		32	/* Can use compression protocol */#define CLIENT_ODBC		64	/* Odbc client */#define CLIENT_LOCAL_FILES	128	/* Can use LOAD DATA LOCAL */#define CLIENT_IGNORE_SPACE	256	/* Ignore spaces before '(' */#define CLIENT_PROTOCOL_41	512	/* New 4.1 protocol */#define CLIENT_INTERACTIVE	1024	/* This is an interactive client */#define CLIENT_SSL              2048	/* Switch to SSL after handshake */#define CLIENT_IGNORE_SIGPIPE   4096    /* IGNORE sigpipes */#define CLIENT_TRANSACTIONS	8192	/* Client knows about transactions */#define CLIENT_RESERVED         16384   /* Old flag for 4.1 protocol  */#define CLIENT_SECURE_CONNECTION 32768  /* New 4.1 authentication */#define CLIENT_MULTI_STATEMENTS 65536   /* Enable/disable multi-stmt support */#define CLIENT_MULTI_RESULTS    131072  /* Enable/disable multi-results */#define CLIENT_REMEMBER_OPTIONS	(((ulong) 1) << 31)#define SERVER_STATUS_IN_TRANS     1	/* Transaction has started */#define SERVER_STATUS_AUTOCOMMIT   2	/* Server in auto_commit mode */#define SERVER_STATUS_MORE_RESULTS 4	/* More results on server */#define SERVER_MORE_RESULTS_EXISTS 8    /* Multi query - next query exists */#define SERVER_QUERY_NO_GOOD_INDEX_USED 16#define SERVER_QUERY_NO_INDEX_USED      32/*  The server was able to fulfill the clients request and opened a  read-only non-scrollable cursor for a query. This flag comes  in reply to COM_STMT_EXECUTE and COM_STMT_FETCH commands.*/#define SERVER_STATUS_CURSOR_EXISTS 64/*  This flag is sent when a read-only cursor is exhausted, in reply to  COM_STMT_FETCH command.*/#define SERVER_STATUS_LAST_ROW_SENT 128#define SERVER_STATUS_DB_DROPPED        256 /* A database was dropped */#define SERVER_STATUS_NO_BACKSLASH_ESCAPES 512#define MYSQL_ERRMSG_SIZE	512#define NET_READ_TIMEOUT	30		/* Timeout on read */#define NET_WRITE_TIMEOUT	60		/* Timeout on write */#define NET_WAIT_TIMEOUT	8*60*60		/* Wait for new query */#define ONLY_KILL_QUERY         1struct st_vio;					/* Only C */typedef struct st_vio Vio;#define MAX_TINYINT_WIDTH       3       /* Max width for a TINY w.o. sign */#define MAX_SMALLINT_WIDTH      5       /* Max width for a SHORT w.o. sign */#define MAX_MEDIUMINT_WIDTH     8       /* Max width for a INT24 w.o. sign */#define MAX_INT_WIDTH           10      /* Max width for a LONG w.o. sign */#define MAX_BIGINT_WIDTH        20      /* Max width for a LONGLONG */#define MAX_CHAR_WIDTH		255	/* Max length for a CHAR colum */#define MAX_BLOB_WIDTH		8192	/* Default width for blob */typedef struct st_net {#if !defined(CHECK_EMBEDDED_DIFFERENCES) || !defined(EMBEDDED_LIBRARY)  Vio* vio;  unsigned char *buff,*buff_end,*write_pos,*read_pos;  my_socket fd;					/* For Perl DBI/dbd */  unsigned long max_packet,max_packet_size;  unsigned int pkt_nr,compress_pkt_nr;  unsigned int write_timeout, read_timeout, retry_count;  int fcntl;  my_bool compress;  /*    The following variable is set if we are doing several queries in one    command ( as in LOAD TABLE ... FROM MASTER ),    and do not want to confuse the client with OK at the wrong time  */  unsigned long remain_in_buf,length, buf_length, where_b;  unsigned int *return_status;  unsigned char reading_or_writing;  char save_char;  my_bool no_send_ok;  /* For SPs and other things that do multiple stmts */  my_bool no_send_eof; /* For SPs' first version read-only cursors */  /*    Set if OK packet is already sent, and we do not need to send error    messages  */  my_bool no_send_error;  /*    Pointer to query object in query cache, do not equal NULL (0) for    queries in cache that have not stored its results yet  */#endif  char last_error[MYSQL_ERRMSG_SIZE], sqlstate[SQLSTATE_LENGTH+1];  unsigned int last_errno;  unsigned char error;  gptr query_cache_query;  my_bool report_error; /* We should report error (we have unreported error) */  my_bool return_errno;} NET;#define packet_error (~(unsigned long) 0)enum enum_field_types { MYSQL_TYPE_DECIMAL, MYSQL_TYPE_TINY,			MYSQL_TYPE_SHORT,  MYSQL_TYPE_LONG,			MYSQL_TYPE_FLOAT,  MYSQL_TYPE_DOUBLE,			MYSQL_TYPE_NULL,   MYSQL_TYPE_TIMESTAMP,			MYSQL_TYPE_LONGLONG,MYSQL_TYPE_INT24,			MYSQL_TYPE_DATE,   MYSQL_TYPE_TIME,			MYSQL_TYPE_DATETIME, MYSQL_TYPE_YEAR,			MYSQL_TYPE_NEWDATE, MYSQL_TYPE_VARCHAR,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -