~mysql/mysql-server/mysql-5.1

1810.3999.1 by Kent Boortz
- Added/updated copyright headers
1
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
973.2.1 by monty at mysql
Update copyright
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
1810.2403.4 by kent at mysql
Many files:
5
   the Free Software Foundation; version 2 of the License.
973.2.1 by monty at mysql
Update copyright
6
7
   This program is distributed in the hope that it will be useful,
2 by bk at mysql
Import changeset
8
   but WITHOUT ANY WARRANTY; without even the implied warranty of
973.2.1 by monty at mysql
Update copyright
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 */
2 by bk at mysql
Import changeset
15
16
/*
17
** Common definition between mysql server & client
18
*/
19
20
#ifndef _mysql_com_h
21
#define _mysql_com_h
22
23
#define HOSTNAME_LENGTH 60
2469.126.2 by gluh at mysql
Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte
24
#define SYSTEM_CHARSET_MBMAXLEN 3
25
#define NAME_CHAR_LEN	64              /* Field/table name length */
26
#define USERNAME_CHAR_LENGTH 16
27
#define NAME_LEN                (NAME_CHAR_LEN*SYSTEM_CHARSET_MBMAXLEN)
28
#define USERNAME_LENGTH         (USERNAME_CHAR_LENGTH*SYSTEM_CHARSET_MBMAXLEN)
29
500 by monty at mysql
Changes for --with-server-suffix
30
#define SERVER_VERSION_LENGTH 60
1538.31.1 by monty at mysql
Cleanup after split of libmysql.c to client.c and libmysql.c. A 4.1 master/slave will now use the 4.1 protocol
31
#define SQLSTATE_LENGTH 5
2 by bk at mysql
Import changeset
32
1810.1237.1 by anozdrin at mysql
Fix for BUG#15110: mysqldump --triggers: does not include DEFINER clause
33
/*
34
  USER_HOST_BUFF_SIZE -- length of string buffer, that is enough to contain
35
  username and hostname parts of the user identifier with trailing zero in
36
  MySQL standard format:
37
  user_name_part@host_name_part\0
38
*/
1810.2127.16 by gluh at mysql
after merge fix
39
#define USER_HOST_BUFF_SIZE HOSTNAME_LENGTH + USERNAME_LENGTH + 2
1810.1237.1 by anozdrin at mysql
Fix for BUG#15110: mysqldump --triggers: does not include DEFINER clause
40
2 by bk at mysql
Import changeset
41
#define LOCAL_HOST	"localhost"
42
#define LOCAL_HOST_NAMEDPIPE "."
43
1379 by peter at mysql
SCRUM: Montymise code
44
2 by bk at mysql
Import changeset
45
#if defined(__WIN__) && !defined( _CUSTOMCONFIG_)
46
#define MYSQL_NAMEDPIPE "MySQL"
1346.392.27 by monty at mysql
Change back service name to MySQL
47
#define MYSQL_SERVICENAME "MySQL"
2 by bk at mysql
Import changeset
48
#endif /* __WIN__ */
49
1624.12.55 by konstantin at mysql
enum_server_command
50
/*
51
  You should add new commands to the end of this list, otherwise old
52
  servers won't be able to handle them as 'unsupported'.
53
*/
54
1249.3.2 by monty at mysql
Fixes and code cleanups after merge with 4.0.3
55
enum enum_server_command
56
{
57
  COM_SLEEP, COM_QUIT, COM_INIT_DB, COM_QUERY, COM_FIELD_LIST,
58
  COM_CREATE_DB, COM_DROP_DB, COM_REFRESH, COM_SHUTDOWN, COM_STATISTICS,
59
  COM_PROCESS_INFO, COM_CONNECT, COM_PROCESS_KILL, COM_DEBUG, COM_PING,
60
  COM_TIME, COM_DELAYED_INSERT, COM_CHANGE_USER, COM_BINLOG_DUMP,
61
  COM_TABLE_DUMP, COM_CONNECT_OUT, COM_REGISTER_SLAVE,
1810.194.4 by konstantin at mysql
Rename all prepared statements COM_ commands to prefix with COM_STMT_
62
  COM_STMT_PREPARE, COM_STMT_EXECUTE, COM_STMT_SEND_LONG_DATA, COM_STMT_CLOSE,
2040.13.1 by tomas at mysql
wl2325 wl2324
63
  COM_STMT_RESET, COM_SET_OPTION, COM_STMT_FETCH, COM_DAEMON,
1616.838.89 by serg at serg
added missing command names to command_name[] array
64
  /* don't forget to update const char *command_name[] in sql_parse.cc */
65
66
  /* Must be last */
67
  COM_END
1249.3.2 by monty at mysql
Fixes and code cleanups after merge with 4.0.3
68
};
2 by bk at mysql
Import changeset
69
1379 by peter at mysql
SCRUM: Montymise code
70
1546.70.1 by kostja at oak
First version of new authentification procedure: now authentification is one-stage (instead of two-stage in 4.1)
71
/*
72
  Length of random string sent by server on handshake; this is also length of
1616.838.89 by serg at serg
added missing command names to command_name[] array
73
  obfuscated password, recieved from client
1546.70.1 by kostja at oak
First version of new authentification procedure: now authentification is one-stage (instead of two-stage in 4.1)
74
*/
75
#define SCRAMBLE_LENGTH 20
76
#define SCRAMBLE_LENGTH_323 8
77
/* length of password stored in the db: new passwords are preceeded with '*' */
78
#define SCRAMBLED_PASSWORD_CHAR_LENGTH (SCRAMBLE_LENGTH*2+1)
79
#define SCRAMBLED_PASSWORD_CHAR_LENGTH_323 (SCRAMBLE_LENGTH_323*2)
1379 by peter at mysql
SCRUM: Montymise code
80
81
2 by bk at mysql
Import changeset
82
#define NOT_NULL_FLAG	1		/* Field can't be NULL */
83
#define PRI_KEY_FLAG	2		/* Field is part of a primary key */
84
#define UNIQUE_KEY_FLAG 4		/* Field is part of a unique key */
85
#define MULTIPLE_KEY_FLAG 8		/* Field is part of a key */
86
#define BLOB_FLAG	16		/* Field is a blob */
87
#define UNSIGNED_FLAG	32		/* Field is unsigned */
88
#define ZEROFILL_FLAG	64		/* Field is zerofill */
1403.1.14 by bar at r18
BINARY_FLAG has been restored.
89
#define BINARY_FLAG	128		/* Field is binary   */
1354.6.1 by bar at r18
BINARY charset is now used instead of binary_flag
90
2 by bk at mysql
Import changeset
91
/* The following are only sent to new clients */
92
#define ENUM_FLAG	256		/* field is an enum */
93
#define AUTO_INCREMENT_FLAG 512		/* field is a autoincrement field */
94
#define TIMESTAMP_FLAG	1024		/* Field is a timestamp */
95
#define SET_FLAG	2048		/* field is a set */
1624.84.1 by monty at mishka
Strict mode & better warnings
96
#define NO_DEFAULT_VALUE_FLAG 4096	/* Field doesn't have default value */
2476.572.1 by evgen at moonbone
Bug#30081: "ON UPDATE CURRENT_TIMESTAMP" wasn't shown by the SHOW FIELDS
97
#define ON_UPDATE_NOW_FLAG 8192         /* Field is set to NOW on UPDATE */
71.2.1 by monty at mysql
Quoting of TIMESTAMP columns and small optimizations
98
#define NUM_FLAG	32768		/* Field is num (for clients) */
2 by bk at mysql
Import changeset
99
#define PART_KEY_FLAG	16384		/* Intern; Part of some key */
100
#define GROUP_FLAG	32768		/* Intern: Group field */
101
#define UNIQUE_FLAG	65536		/* Intern: Used by sql_yacc */
1616.137.67 by bar at r18
1. New data types, from the user point of view:
102
#define BINCMP_FLAG	131072		/* Intern: Used by sql_yacc */
1852 by mronstrom at mysql
Patch for push of wl1354 Partitioning
103
#define GET_FIXED_FIELDS_FLAG (1 << 18) /* Used to get fields in item tree */
104
#define FIELD_IN_PART_FUNC_FLAG (1 << 19)/* Field part of partition func */
2119.582.1 by monty at mysql
This changeset is largely a handler cleanup changeset (WL#3281), but includes fixes and cleanups that was found necessary while testing the handler changes
105
#define FIELD_IN_ADD_INDEX (1<< 20)	/* Intern: Field used in ADD INDEX */
2181.14.2 by mskold at mysql
Added flag to detect renaming of fields (not supported as fast alter table for ndbcluster)
106
#define FIELD_IS_RENAMED (1<< 21)       /* Intern: Field is being renamed */
2 by bk at mysql
Import changeset
107
108
#define REFRESH_GRANT		1	/* Refresh grant tables */
109
#define REFRESH_LOG		2	/* Start on new log file */
110
#define REFRESH_TABLES		4	/* close all tables */
111
#define REFRESH_HOSTS		8	/* Flush host cache */
112
#define REFRESH_STATUS		16	/* Flush status variables */
676.169.34 by monty at mysql
Fixed overflow bug
113
#define REFRESH_THREADS		32	/* Flush thread cache */
2 by bk at mysql
Import changeset
114
#define REFRESH_SLAVE           64      /* Reset master info and restart slave
115
					   thread */
116
#define REFRESH_MASTER          128     /* Remove all bin logs in the index
117
					   and truncate the index */
118
119
/* The following can't be set with mysql_refresh() */
120
#define REFRESH_READ_LOCK	16384	/* Lock tables for read */
121
#define REFRESH_FAST		32768	/* Intern flag */
122
973.1.1 by monty at mysql
Update of query cache code
123
/* RESET (remove all queries) from query cache */
124
#define REFRESH_QUERY_CACHE	65536
125
#define REFRESH_QUERY_CACHE_FREE 0x20000L /* pack query cache */
973.1.20 by monty at mysql
Added FLUSH DES_KEY_FILE.
126
#define REFRESH_DES_KEY_FILE	0x40000L
973.179.1 by Sinisa at nasamreza
Features made for Schlund plus several bug fixes.
127
#define REFRESH_USER_RESOURCES	0x80000L
966.1.1 by monty at mysql
Query cache.
128
2 by bk at mysql
Import changeset
129
#define CLIENT_LONG_PASSWORD	1	/* new more secure passwords */
130
#define CLIENT_FOUND_ROWS	2	/* Found instead of affected rows */
131
#define CLIENT_LONG_FLAG	4	/* Get all column flags */
132
#define CLIENT_CONNECT_WITH_DB	8	/* One can specify db on connect */
133
#define CLIENT_NO_SCHEMA	16	/* Don't allow database.table.column */
134
#define CLIENT_COMPRESS		32	/* Can use compression protocol */
135
#define CLIENT_ODBC		64	/* Odbc client */
136
#define CLIENT_LOCAL_FILES	128	/* Can use LOAD DATA LOCAL */
137
#define CLIENT_IGNORE_SPACE	256	/* Ignore spaces before '(' */
1538.5.1 by monty at mysql
New 4.1 protocol; SQLSTATE, CLIENT_MULTI_RESULTS, client character set
138
#define CLIENT_PROTOCOL_41	512	/* New 4.1 protocol */
2 by bk at mysql
Import changeset
139
#define CLIENT_INTERACTIVE	1024	/* This is an interactive client */
1538.5.1 by monty at mysql
New 4.1 protocol; SQLSTATE, CLIENT_MULTI_RESULTS, client character set
140
#define CLIENT_SSL              2048	/* Switch to SSL after handshake */
141
#define CLIENT_IGNORE_SIGPIPE   4096    /* IGNORE sigpipes */
587.10.1 by monty at mysql
Fixed CLIENT_TRANSACTIONS define
142
#define CLIENT_TRANSACTIONS	8192	/* Client knows about transactions */
1538.5.1 by monty at mysql
New 4.1 protocol; SQLSTATE, CLIENT_MULTI_RESULTS, client character set
143
#define CLIENT_RESERVED         16384   /* Old flag for 4.1 protocol  */
144
#define CLIENT_SECURE_CONNECTION 32768  /* New 4.1 authentication */
1810.2167.1 by ram at mysql
Fix for bug #22227: ulong not defined for client library
145
#define CLIENT_MULTI_STATEMENTS (1UL << 16) /* Enable/disable multi-stmt support */
146
#define CLIENT_MULTI_RESULTS    (1UL << 17) /* Enable/disable multi-results */
1810.1887.13 by cmiller at cornsilk
Bug#21543: 5.0.24 breaks ABI compatibility for python bindings: \
147
1810.2167.1 by ram at mysql
Fix for bug #22227: ulong not defined for client library
148
#define CLIENT_SSL_VERIFY_SERVER_CERT (1UL << 30)
149
#define CLIENT_REMEMBER_OPTIONS (1UL << 31)
2 by bk at mysql
Import changeset
150
2542.48.1 by andrey at hristov
Fix for Bug #27944 Filtering THD::client capabilities
151
/* Gather all possible capabilites (flags) supported by the server */
152
#define CLIENT_ALL_FLAGS  (CLIENT_LONG_PASSWORD | \
153
                           CLIENT_FOUND_ROWS | \
154
                           CLIENT_LONG_FLAG | \
155
                           CLIENT_CONNECT_WITH_DB | \
156
                           CLIENT_NO_SCHEMA | \
157
                           CLIENT_COMPRESS | \
158
                           CLIENT_ODBC | \
159
                           CLIENT_LOCAL_FILES | \
160
                           CLIENT_IGNORE_SPACE | \
161
                           CLIENT_PROTOCOL_41 | \
162
                           CLIENT_INTERACTIVE | \
163
                           CLIENT_SSL | \
164
                           CLIENT_IGNORE_SIGPIPE | \
165
                           CLIENT_TRANSACTIONS | \
166
                           CLIENT_RESERVED | \
167
                           CLIENT_SECURE_CONNECTION | \
168
                           CLIENT_MULTI_STATEMENTS | \
169
                           CLIENT_MULTI_RESULTS | \
170
                           CLIENT_SSL_VERIFY_SERVER_CERT | \
171
                           CLIENT_REMEMBER_OPTIONS)
172
173
/*
174
  Switch off the flags that are optional and depending on build flags
175
  If any of the optional flags is supported by the build it will be switched
176
  on before sending to the client during the connection handshake.
177
*/
178
#define CLIENT_BASIC_FLAGS (((CLIENT_ALL_FLAGS & ~CLIENT_SSL) \
179
                                               & ~CLIENT_COMPRESS) \
180
                                               & ~CLIENT_SSL_VERIFY_SERVER_CERT)
181
1249.3.2 by monty at mysql
Fixes and code cleanups after merge with 4.0.3
182
#define SERVER_STATUS_IN_TRANS     1	/* Transaction has started */
183
#define SERVER_STATUS_AUTOCOMMIT   2	/* Server in auto_commit mode */
1403.62.1 by venu at myvenu
Initial multi query execution support
184
#define SERVER_MORE_RESULTS_EXISTS 8    /* Multi query - next query exists */
1616.38.13 by serg at serg
QUERY_NO_GOOD_INDEX_USED and QUERY_NO_INDEX_USED moved from thd->lex.select_lex->options to thd->server_status
185
#define SERVER_QUERY_NO_GOOD_INDEX_USED 16
186
#define SERVER_QUERY_NO_INDEX_USED      32
2646.1.2 by kostja at bodhi
Bug#27430 "Crash in subquery code when in PS and table DDL changed after
187
/**
1810.122.25 by konstantin at mysql
A fix and a test case for Bug#10794 "mysql_stmt_attr_set no
188
  The server was able to fulfill the clients request and opened a
189
  read-only non-scrollable cursor for a query. This flag comes
190
  in reply to COM_STMT_EXECUTE and COM_STMT_FETCH commands.
1624.55.1 by konstantin at mysql
Port of cursors to be pushed into 5.0 tree:
191
*/
192
#define SERVER_STATUS_CURSOR_EXISTS 64
2646.1.2 by kostja at bodhi
Bug#27430 "Crash in subquery code when in PS and table DDL changed after
193
/**
1810.122.25 by konstantin at mysql
A fix and a test case for Bug#10794 "mysql_stmt_attr_set no
194
  This flag is sent when a read-only cursor is exhausted, in reply to
195
  COM_STMT_FETCH command.
1624.55.1 by konstantin at mysql
Port of cursors to be pushed into 5.0 tree:
196
*/
197
#define SERVER_STATUS_LAST_ROW_SENT 128
1616.1698.1 by ram at r18
A fix (bug #4802 prompt in mysql client shows wrong database after dropping default db).
198
#define SERVER_STATUS_DB_DROPPED        256 /* A database was dropped */
1810.273.1 by jimw at mysql
Make status of NO_BACKSLASH_ESCAPES mode known to the client so
199
#define SERVER_STATUS_NO_BACKSLASH_ESCAPES 512
2646.1.2 by kostja at bodhi
Bug#27430 "Crash in subquery code when in PS and table DDL changed after
200
/**
201
  Sent to the client if after a prepared statement reprepare
202
  we discovered that the new statement returns a different 
203
  number of result set columns.
204
*/
205
#define SERVER_STATUS_METADATA_CHANGED 1024
206
207
/**
208
  Server status flags that must be cleared when starting
209
  execution of a new SQL statement.
210
  Flags from this set are only added to the
211
  current server status by the execution engine, but 
212
  never removed -- the execution engine expects them 
213
  to disappear automagically by the next command.
214
*/
215
#define SERVER_STATUS_CLEAR_SET (SERVER_QUERY_NO_GOOD_INDEX_USED| \
216
                                 SERVER_QUERY_NO_INDEX_USED|\
217
                                 SERVER_MORE_RESULTS_EXISTS|\
218
                                 SERVER_STATUS_METADATA_CHANGED)
2 by bk at mysql
Import changeset
219
1538.5.1 by monty at mysql
New 4.1 protocol; SQLSTATE, CLIENT_MULTI_RESULTS, client character set
220
#define MYSQL_ERRMSG_SIZE	512
2 by bk at mysql
Import changeset
221
#define NET_READ_TIMEOUT	30		/* Timeout on read */
222
#define NET_WRITE_TIMEOUT	60		/* Timeout on write */
223
#define NET_WAIT_TIMEOUT	8*60*60		/* Wait for new query */
224
1455.15.13 by hf at genie
SCRUM
225
#define ONLY_KILL_QUERY         1
226
2646.1.2 by kostja at bodhi
Bug#27430 "Crash in subquery code when in PS and table DDL changed after
227
2 by bk at mysql
Import changeset
228
struct st_vio;					/* Only C */
229
typedef struct st_vio Vio;
230
1616.887.1 by ingo at mysql
BUG#4788 - show create table provides incorrect statement.
231
#define MAX_TINYINT_WIDTH       3       /* Max width for a TINY w.o. sign */
232
#define MAX_SMALLINT_WIDTH      5       /* Max width for a SHORT w.o. sign */
233
#define MAX_MEDIUMINT_WIDTH     8       /* Max width for a INT24 w.o. sign */
234
#define MAX_INT_WIDTH           10      /* Max width for a LONG w.o. sign */
235
#define MAX_BIGINT_WIDTH        20      /* Max width for a LONGLONG */
973.111.2 by monty at mysql
support for unsigned FLOAT/DOUBLE
236
#define MAX_CHAR_WIDTH		255	/* Max length for a CHAR colum */
2181.184.1 by jani at omakaista
Fixed result file. Blob width 8192 changed to 16777216.
237
#define MAX_BLOB_WIDTH		16777216	/* Default width for blob */
676.200.21 by monty at mysql
Fixed bug with GROUP BY on NULL fields.
238
2 by bk at mysql
Import changeset
239
typedef struct st_net {
1538.65.1 by hf at deer
SCRUM
240
#if !defined(CHECK_EMBEDDED_DIFFERENCES) || !defined(EMBEDDED_LIBRARY)
2476.284.3 by monty at mysql
Add 'extension' field to all client library structures to make them extensible
241
  Vio *vio;
818.16.2 by monty at mysql
Fixed some build problems.
242
  unsigned char *buff,*buff_end,*write_pos,*read_pos;
2 by bk at mysql
Import changeset
243
  my_socket fd;					/* For Perl DBI/dbd */
2476.284.3 by monty at mysql
Add 'extension' field to all client library structures to make them extensible
244
  /*
245
    The following variable is set if we are doing several queries in one
246
    command ( as in LOAD TABLE ... FROM MASTER ),
247
    and do not want to confuse the client with OK at the wrong time
248
  */
249
  unsigned long remain_in_buf,length, buf_length, where_b;
1098.3.1 by monty at mysql
New SET syntax & system variables.
250
  unsigned long max_packet,max_packet_size;
1388.15.2 by hf at r18
Big purge about embedded library (scrum)
251
  unsigned int pkt_nr,compress_pkt_nr;
1174.1.8 by monty at mysql
Added nety_retry_count as a changeable variable
252
  unsigned int write_timeout, read_timeout, retry_count;
2 by bk at mysql
Import changeset
253
  int fcntl;
254
  unsigned int *return_status;
255
  unsigned char reading_or_writing;
256
  char save_char;
2476.721.1 by kostja at bodhi
Bug#12713 "Error in a stored function called from a SELECT doesn't
257
  my_bool unused0; /* Please remove with the next incompatible ABI change. */
2476.423.23 by kostja at bodhi
Remove an unused variable that was there since the first implementation
258
  my_bool unused; /* Please remove with the next incompatible ABI change */
2476.284.3 by monty at mysql
Add 'extension' field to all client library structures to make them extensible
259
  my_bool compress;
2476.721.1 by kostja at bodhi
Bug#12713 "Error in a stored function called from a SELECT doesn't
260
  my_bool unused1; /* Please remove with the next incompatible ABI change. */
1700.309.2 by bell at com
Fixed problem of sending ERROR to client after OK or EOF (BUG#6804)
261
  /*
1382 by peter at mysql
SCRAM Remove spaces from most changed files.
262
    Pointer to query object in query cache, do not equal NULL (0) for
263
    queries in cache that have not stored its results yet
973.252.1 by bell at com
subselect with union
264
  */
1388.15.2 by hf at r18
Big purge about embedded library (scrum)
265
#endif
1810.2034.1 by tomash at moonlight
BUG#21051: RESET QUERY CACHE very slow when query_cache_type=0
266
  /*
267
    'query_cache_query' should be accessed only via query cache
268
    functions and methods to maintain proper locking.
269
  */
2475.68.2 by monty at mysql
WL#3817: Simplify string / memory area types and make things more consistent (first part)
270
  unsigned char *query_cache_query;
2542.1.9 by davi at mysql
Bug#34655 Compile error
271
  unsigned int last_errno;
2476.721.1 by kostja at bodhi
Bug#12713 "Error in a stored function called from a SELECT doesn't
272
  unsigned char error; 
273
  my_bool unused2; /* Please remove with the next incompatible ABI change. */
1388.15.2 by hf at r18
Big purge about embedded library (scrum)
274
  my_bool return_errno;
2476.721.1 by kostja at bodhi
Bug#12713 "Error in a stored function called from a SELECT doesn't
275
  /** Client library error message buffer. Actually belongs to struct MYSQL. */
2542.1.9 by davi at mysql
Bug#34655 Compile error
276
  char last_error[MYSQL_ERRMSG_SIZE];
2476.721.1 by kostja at bodhi
Bug#12713 "Error in a stored function called from a SELECT doesn't
277
  /** Client library sqlstate buffer. Set along with the error message. */
278
  char sqlstate[SQLSTATE_LENGTH+1];
2476.284.3 by monty at mysql
Add 'extension' field to all client library structures to make them extensible
279
  void *extension;
3351.58.10 by MySQL Build Team
Backport into build-201006221614-5.1.46sp1
280
#if defined(MYSQL_SERVER) && !defined(EMBEDDED_LIBRARY)
281
  /*
282
    Controls whether a big packet should be skipped.
283
284
    Initially set to FALSE by default. Unauthenticated sessions must have
285
    this set to FALSE so that the server can't be tricked to read packets
286
    indefinitely.
287
  */
288
  my_bool skip_big_packet;
289
#endif
2 by bk at mysql
Import changeset
290
} NET;
291
2476.284.3 by monty at mysql
Add 'extension' field to all client library structures to make them extensible
292
818.16.2 by monty at mysql
Fixed some build problems.
293
#define packet_error (~(unsigned long) 0)
2 by bk at mysql
Import changeset
294
973.238.3 by venu at myvenu
Client-Server Protocol 4.1 changes - Client side:
295
enum enum_field_types { MYSQL_TYPE_DECIMAL, MYSQL_TYPE_TINY,
296
			MYSQL_TYPE_SHORT,  MYSQL_TYPE_LONG,
297
			MYSQL_TYPE_FLOAT,  MYSQL_TYPE_DOUBLE,
298
			MYSQL_TYPE_NULL,   MYSQL_TYPE_TIMESTAMP,
299
			MYSQL_TYPE_LONGLONG,MYSQL_TYPE_INT24,
300
			MYSQL_TYPE_DATE,   MYSQL_TYPE_TIME,
301
			MYSQL_TYPE_DATETIME, MYSQL_TYPE_YEAR,
1634.5.4 by monty at mysql
Add support for up to VARCHAR (size up to 65535)
302
			MYSQL_TYPE_NEWDATE, MYSQL_TYPE_VARCHAR,
1659.57.1 by ram at r18
bit type
303
			MYSQL_TYPE_BIT,
1700.191.1 by hf at deer
Precision Math implementation
304
                        MYSQL_TYPE_NEWDECIMAL=246,
973.238.3 by venu at myvenu
Client-Server Protocol 4.1 changes - Client side:
305
			MYSQL_TYPE_ENUM=247,
306
			MYSQL_TYPE_SET=248,
307
			MYSQL_TYPE_TINY_BLOB=249,
308
			MYSQL_TYPE_MEDIUM_BLOB=250,
309
			MYSQL_TYPE_LONG_BLOB=251,
310
			MYSQL_TYPE_BLOB=252,
311
			MYSQL_TYPE_VAR_STRING=253,
312
			MYSQL_TYPE_STRING=254,
313
			MYSQL_TYPE_GEOMETRY=255
314
2 by bk at mysql
Import changeset
315
};
316
973.238.3 by venu at myvenu
Client-Server Protocol 4.1 changes - Client side:
317
/* For backward compatibility */
1590.12.1 by monty at mysql
CLIENT_MULTI_QUERIES -> CLIENT_MULTI_STATEMENTS
318
#define CLIENT_MULTI_QUERIES    CLIENT_MULTI_STATEMENTS    
1382 by peter at mysql
SCRAM Remove spaces from most changed files.
319
#define FIELD_TYPE_DECIMAL     MYSQL_TYPE_DECIMAL
1700.191.1 by hf at deer
Precision Math implementation
320
#define FIELD_TYPE_NEWDECIMAL  MYSQL_TYPE_NEWDECIMAL
1382 by peter at mysql
SCRAM Remove spaces from most changed files.
321
#define FIELD_TYPE_TINY        MYSQL_TYPE_TINY
322
#define FIELD_TYPE_SHORT       MYSQL_TYPE_SHORT
323
#define FIELD_TYPE_LONG        MYSQL_TYPE_LONG
324
#define FIELD_TYPE_FLOAT       MYSQL_TYPE_FLOAT
325
#define FIELD_TYPE_DOUBLE      MYSQL_TYPE_DOUBLE
326
#define FIELD_TYPE_NULL        MYSQL_TYPE_NULL
327
#define FIELD_TYPE_TIMESTAMP   MYSQL_TYPE_TIMESTAMP
328
#define FIELD_TYPE_LONGLONG    MYSQL_TYPE_LONGLONG
329
#define FIELD_TYPE_INT24       MYSQL_TYPE_INT24
330
#define FIELD_TYPE_DATE        MYSQL_TYPE_DATE
331
#define FIELD_TYPE_TIME        MYSQL_TYPE_TIME
332
#define FIELD_TYPE_DATETIME    MYSQL_TYPE_DATETIME
333
#define FIELD_TYPE_YEAR        MYSQL_TYPE_YEAR
334
#define FIELD_TYPE_NEWDATE     MYSQL_TYPE_NEWDATE
335
#define FIELD_TYPE_ENUM        MYSQL_TYPE_ENUM
336
#define FIELD_TYPE_SET         MYSQL_TYPE_SET
337
#define FIELD_TYPE_TINY_BLOB   MYSQL_TYPE_TINY_BLOB
338
#define FIELD_TYPE_MEDIUM_BLOB MYSQL_TYPE_MEDIUM_BLOB
973.238.3 by venu at myvenu
Client-Server Protocol 4.1 changes - Client side:
339
#define FIELD_TYPE_LONG_BLOB   MYSQL_TYPE_LONG_BLOB
1382 by peter at mysql
SCRAM Remove spaces from most changed files.
340
#define FIELD_TYPE_BLOB        MYSQL_TYPE_BLOB
341
#define FIELD_TYPE_VAR_STRING  MYSQL_TYPE_VAR_STRING
342
#define FIELD_TYPE_STRING      MYSQL_TYPE_STRING
343
#define FIELD_TYPE_CHAR        MYSQL_TYPE_TINY
973.238.3 by venu at myvenu
Client-Server Protocol 4.1 changes - Client side:
344
#define FIELD_TYPE_INTERVAL    MYSQL_TYPE_ENUM
1382 by peter at mysql
SCRAM Remove spaces from most changed files.
345
#define FIELD_TYPE_GEOMETRY    MYSQL_TYPE_GEOMETRY
1659.57.1 by ram at r18
bit type
346
#define FIELD_TYPE_BIT         MYSQL_TYPE_BIT
973.238.3 by venu at myvenu
Client-Server Protocol 4.1 changes - Client side:
347
1616.731.1 by guilhem at mysql
Very small API change: changing the values in enum enum_shutdown_level;
348
349
/* Shutdown/kill enums and constants */ 
350
351
/* Bits for THD::killable. */
1616.737.1 by guilhem at mysql
mysql_com.h:
352
#define MYSQL_SHUTDOWN_KILLABLE_CONNECT    (unsigned char)(1 << 0)
353
#define MYSQL_SHUTDOWN_KILLABLE_TRANS      (unsigned char)(1 << 1)
354
#define MYSQL_SHUTDOWN_KILLABLE_LOCK_TABLE (unsigned char)(1 << 2)
355
#define MYSQL_SHUTDOWN_KILLABLE_UPDATE     (unsigned char)(1 << 3)
1616.731.1 by guilhem at mysql
Very small API change: changing the values in enum enum_shutdown_level;
356
1616.732.12 by guilhem at mysql
mysql_com.h:
357
enum mysql_enum_shutdown_level {
1616.531.1 by guilhem at mysql
API change: mysql_shutdown() now needs a 2nd parameter, the shutdown level.
358
  /*
1616.731.1 by guilhem at mysql
Very small API change: changing the values in enum enum_shutdown_level;
359
    We want levels to be in growing order of hardness (because we use number
360
    comparisons). Note that DEFAULT does not respect the growing property, but
361
    it's ok.
362
  */
1616.732.13 by pem at comhem
Fixed symbol name problems that made build fail.
363
  SHUTDOWN_DEFAULT = 0,
1616.731.1 by guilhem at mysql
Very small API change: changing the values in enum enum_shutdown_level;
364
  /* wait for existing connections to finish */
1616.732.13 by pem at comhem
Fixed symbol name problems that made build fail.
365
  SHUTDOWN_WAIT_CONNECTIONS= MYSQL_SHUTDOWN_KILLABLE_CONNECT,
1616.731.1 by guilhem at mysql
Very small API change: changing the values in enum enum_shutdown_level;
366
  /* wait for existing trans to finish */
1616.732.13 by pem at comhem
Fixed symbol name problems that made build fail.
367
  SHUTDOWN_WAIT_TRANSACTIONS= MYSQL_SHUTDOWN_KILLABLE_TRANS,
1616.731.1 by guilhem at mysql
Very small API change: changing the values in enum enum_shutdown_level;
368
  /* wait for existing updates to finish (=> no partial MyISAM update) */
1616.732.13 by pem at comhem
Fixed symbol name problems that made build fail.
369
  SHUTDOWN_WAIT_UPDATES= MYSQL_SHUTDOWN_KILLABLE_UPDATE,
1616.731.1 by guilhem at mysql
Very small API change: changing the values in enum enum_shutdown_level;
370
  /* flush InnoDB buffers and other storage engines' buffers*/
1616.732.13 by pem at comhem
Fixed symbol name problems that made build fail.
371
  SHUTDOWN_WAIT_ALL_BUFFERS= (MYSQL_SHUTDOWN_KILLABLE_UPDATE << 1),
1616.731.1 by guilhem at mysql
Very small API change: changing the values in enum enum_shutdown_level;
372
  /* don't flush InnoDB buffers, flush other storage engines' buffers*/
1616.732.13 by pem at comhem
Fixed symbol name problems that made build fail.
373
  SHUTDOWN_WAIT_CRITICAL_BUFFERS= (MYSQL_SHUTDOWN_KILLABLE_UPDATE << 1) + 1,
1616.536.1 by guilhem at mysql
Including in enum_shutdown_level the 2 types of KILL of 5.0
374
  /* Now the 2 levels of the KILL command */
375
#if MYSQL_VERSION_ID >= 50000
376
  KILL_QUERY= 254,
377
#endif
378
  KILL_CONNECTION= 255
1616.531.1 by guilhem at mysql
API change: mysql_shutdown() now needs a 2nd parameter, the shutdown level.
379
};
380
1624.55.1 by konstantin at mysql
Port of cursors to be pushed into 5.0 tree:
381
382
enum enum_cursor_type
383
{
384
  CURSOR_TYPE_NO_CURSOR= 0,
385
  CURSOR_TYPE_READ_ONLY= 1,
386
  CURSOR_TYPE_FOR_UPDATE= 2,
387
  CURSOR_TYPE_SCROLLABLE= 4
388
};
389
390
1590.12.1 by monty at mysql
CLIENT_MULTI_QUERIES -> CLIENT_MULTI_STATEMENTS
391
/* options for mysql_set_option */
392
enum enum_mysql_set_option
393
{
394
  MYSQL_OPTION_MULTI_STATEMENTS_ON,
395
  MYSQL_OPTION_MULTI_STATEMENTS_OFF
396
};
397
735.2.1 by monty at mysql
Remove warnings and portability fixes
398
#define net_new_transaction(net) ((net)->pkt_nr=0)
399
400
#ifdef __cplusplus
401
extern "C" {
402
#endif
403
1249.3.2 by monty at mysql
Fixes and code cleanups after merge with 4.0.3
404
my_bool	my_net_init(NET *net, Vio* vio);
1098.3.1 by monty at mysql
New SET syntax & system variables.
405
void	my_net_local_init(NET *net);
2 by bk at mysql
Import changeset
406
void	net_end(NET *net);
2303.92.8 by monty at mysql
Fixed compiler warnings (Mostly VC++):
407
  void	net_clear(NET *net, my_bool clear_buffer);
2475.68.2 by monty at mysql
WL#3817: Simplify string / memory area types and make things more consistent (first part)
408
my_bool net_realloc(NET *net, size_t length);
1249.3.2 by monty at mysql
Fixes and code cleanups after merge with 4.0.3
409
my_bool	net_flush(NET *net);
2475.68.2 by monty at mysql
WL#3817: Simplify string / memory area types and make things more consistent (first part)
410
my_bool	my_net_write(NET *net,const unsigned char *packet, size_t len);
1249.3.2 by monty at mysql
Fixes and code cleanups after merge with 4.0.3
411
my_bool	net_write_command(NET *net,unsigned char command,
2475.68.2 by monty at mysql
WL#3817: Simplify string / memory area types and make things more consistent (first part)
412
			  const unsigned char *header, size_t head_len,
413
			  const unsigned char *packet, size_t len);
414
int	net_real_write(NET *net,const unsigned char *packet, size_t len);
669.1.1 by monty at mysql
Added all changes from old 4.0 version:
415
unsigned long my_net_read(NET *net);
818.1.21 by monty at mysql
Portability fix
416
1810.2971.4 by msvensson at pilot
Bug #26664 test suite times out on OS X 64bit
417
#ifdef _global_h
1810.2968.1 by msvensson at pilot
Bug#26664 test suite times out on OS X 64bit
418
void my_net_set_write_timeout(NET *net, uint timeout);
419
void my_net_set_read_timeout(NET *net, uint timeout);
1810.2971.4 by msvensson at pilot
Bug #26664 test suite times out on OS X 64bit
420
#endif
1810.2968.1 by msvensson at pilot
Bug#26664 test suite times out on OS X 64bit
421
1249.3.2 by monty at mysql
Fixes and code cleanups after merge with 4.0.3
422
/*
423
  The following function is not meant for normal usage
424
  Currently it's used internally by manager.c
425
*/
818.1.21 by monty at mysql
Portability fix
426
struct sockaddr;
1546.59.8 by monty at mysql
After merge fixes
427
int my_connect(my_socket s, const struct sockaddr *name, unsigned int namelen,
428
	       unsigned int timeout);
2 by bk at mysql
Import changeset
429
430
struct rand_struct {
431
  unsigned long seed1,seed2,max_value;
432
  double max_value_dbl;
433
};
434
681.2.2 by monty at mysql
Fixes for embedded MySQL
435
#ifdef __cplusplus
436
}
437
#endif
438
2 by bk at mysql
Import changeset
439
  /* The following is for user defined functions */
440
1730 by mskold at mysql
Merge
441
enum Item_result {STRING_RESULT=0, REAL_RESULT, INT_RESULT, ROW_RESULT,
1700.191.1 by hf at deer
Precision Math implementation
442
                  DECIMAL_RESULT};
2 by bk at mysql
Import changeset
443
444
typedef struct st_udf_args
445
{
446
  unsigned int arg_count;		/* Number of arguments */
447
  enum Item_result *arg_type;		/* Pointer to item_results */
448
  char **args;				/* Pointer to argument */
449
  unsigned long *lengths;		/* Length of string arguments */
450
  char *maybe_null;			/* Set to 1 for all maybe_null args */
1563.90.1 by bell at com
new UDF arguments interface (WL#1017) (SCRUM)
451
  char **attributes;                    /* Pointer to attribute name */
452
  unsigned long *attribute_lengths;     /* Length of attribute arguments */
2476.284.3 by monty at mysql
Add 'extension' field to all client library structures to make them extensible
453
  void *extension;
2 by bk at mysql
Import changeset
454
} UDF_ARGS;
455
456
  /* This holds information about the result */
457
458
typedef struct st_udf_init
459
{
1616.3126.1 by hf at mysql
Bug #31900 Wrong confusing comment in mysql_com.h header file.
460
  my_bool maybe_null;          /* 1 if function can return NULL */
461
  unsigned int decimals;       /* for real functions */
462
  unsigned long max_length;    /* For string functions */
463
  char *ptr;                   /* free pointer for function data */
464
  my_bool const_item;          /* 1 if function always returns the same value */
2476.284.3 by monty at mysql
Add 'extension' field to all client library structures to make them extensible
465
  void *extension;
2 by bk at mysql
Import changeset
466
} UDF_INIT;
1810.3525.3 by kgeorge at magare
Bug #30355: Incorrect ordering of UDF results
467
/* 
468
  TODO: add a notion for determinism of the UDF. 
469
  See Item_udf_func::update_used_tables ()
470
*/
2 by bk at mysql
Import changeset
471
472
  /* Constants when using compression */
473
#define NET_HEADER_SIZE 4		/* standard header size */
474
#define COMP_HEADER_SIZE 3		/* compression header extra size */
475
476
  /* Prototypes to password functions */
477
478
#ifdef __cplusplus
479
extern "C" {
480
#endif
973.2.1 by monty at mysql
Update copyright
481
1546.70.1 by kostja at oak
First version of new authentification procedure: now authentification is one-stage (instead of two-stage in 4.1)
482
/*
483
  These functions are used for authentication by client and server and
484
  implemented in sql/password.c
485
*/
486
487
void randominit(struct rand_struct *, unsigned long seed1,
488
                unsigned long seed2);
1346.129.57 by lenz at mysql
- renamed "rnd" to "my_rnd" as the name was too generic (and is an exported
489
double my_rnd(struct rand_struct *);
1578.1.2 by lenz at kallisto
- portability fix: replaced "uint" with "unsigned int"
490
void create_random_string(char *to, unsigned int length, struct rand_struct *rand_st);
1546.70.1 by kostja at oak
First version of new authentification procedure: now authentification is one-stage (instead of two-stage in 4.1)
491
1578.1.2 by lenz at kallisto
- portability fix: replaced "uint" with "unsigned int"
492
void hash_password(unsigned long *to, const char *password, unsigned int password_len);
1546.70.1 by kostja at oak
First version of new authentification procedure: now authentification is one-stage (instead of two-stage in 4.1)
493
void make_scrambled_password_323(char *to, const char *password);
1546.75.2 by kostja at oak
Style fixes, comments for 4.1.1 authorization
494
void scramble_323(char *to, const char *message, const char *password);
1546.70.1 by kostja at oak
First version of new authentification procedure: now authentification is one-stage (instead of two-stage in 4.1)
495
my_bool check_scramble_323(const char *, const char *message,
1546.70.3 by kostja at oak
Preliminary support for options --secure-auth,
496
                           unsigned long *salt);
1546.70.1 by kostja at oak
First version of new authentification procedure: now authentification is one-stage (instead of two-stage in 4.1)
497
void get_salt_from_password_323(unsigned long *res, const char *password);
498
void make_password_from_salt_323(char *to, const unsigned long *salt);
499
500
void make_scrambled_password(char *to, const char *password);
1546.70.2 by kostja at oak
Bug fixes for authentication
501
void scramble(char *to, const char *message, const char *password);
1546.70.1 by kostja at oak
First version of new authentification procedure: now authentification is one-stage (instead of two-stage in 4.1)
502
my_bool check_scramble(const char *reply, const char *message,
503
                       const unsigned char *hash_stage2);
504
void get_salt_from_password(unsigned char *res, const char *password);
505
void make_password_from_salt(char *to, const unsigned char *hash_stage2);
1810.855.2 by monty at mysql
Reviewing new pushed code
506
char *octet2hex(char *to, const char *str, unsigned int len);
1546.70.1 by kostja at oak
First version of new authentification procedure: now authentification is one-stage (instead of two-stage in 4.1)
507
508
/* end of password.c */
509
2119.562.1 by anozdrin at mysql
This is an implementation of two WL items:
510
char *get_tty_password(const char *opt_message);
1538.4.36 by venu at myvenu
Fix for mysql_list_fields & reset stmt buffers from stmt_free_result
511
const char *mysql_errno_to_sqlstate(unsigned int mysql_errno);
2 by bk at mysql
Import changeset
512
513
/* Some other useful functions */
514
676.103.3 by monty at mysql
Portability fixes
515
my_bool my_thread_init(void);
676.91.1 by monty at mysql
Fix when using --without-server --with-thread-safe-client
516
void my_thread_end(void);
2 by bk at mysql
Import changeset
517
1504.26.1 by hf at r18
SCRUM
518
#ifdef _global_h
519
ulong STDCALL net_field_length(uchar **packet);
1504.26.2 by hf at r18
SCRUM
520
my_ulonglong net_field_length_ll(uchar **packet);
2475.68.2 by monty at mysql
WL#3817: Simplify string / memory area types and make things more consistent (first part)
521
uchar *net_store_length(uchar *pkg, ulonglong length);
1504.26.1 by hf at r18
SCRUM
522
#endif
523
676.103.3 by monty at mysql
Portability fixes
524
#ifdef __cplusplus
525
}
526
#endif
527
2 by bk at mysql
Import changeset
528
#define NULL_LENGTH ((unsigned long) ~0) /* For net_store_length */
1354.15.62 by venu at myvenu
Missed include/ files
529
#define MYSQL_STMT_HEADER       4
1616.350.53 by konstantin at mysql
Support for character set conversion in binary protocol: another go
530
#define MYSQL_LONG_DATA_HEADER  6
2 by bk at mysql
Import changeset
531
532
#endif