mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 12:32:27 +01:00
Merge work:/home/bk/mysql-4.0 into hundin.mysql.fi:/my/bk/mysql-4.0
Docs/manual.texi: Auto merged
This commit is contained in:
commit
bce935dac8
35 changed files with 290 additions and 535 deletions
13
BUILD/compile-ia64-debug-max
Executable file
13
BUILD/compile-ia64-debug-max
Executable file
|
@ -0,0 +1,13 @@
|
|||
gmake -k clean || true
|
||||
/bin/rm -f */.deps/*.P config.cache
|
||||
|
||||
aclocal && autoheader && aclocal && automake && autoconf
|
||||
(cd bdb/dist && sh s_all)
|
||||
(cd innobase && aclocal && autoheader && aclocal && automake && autoconf)
|
||||
if [ -d gemini ]
|
||||
then
|
||||
(cd gemini && aclocal && autoheader && aclocal && automake && autoconf)
|
||||
fi
|
||||
|
||||
CC=ecc CFLAGS="-w1 -DEXTRA_DEBUG -DSAFEMALLOC -DSAFE_MUTEX -O2" CXX=ecc CXXFLAGS="-w1 -DEXTRA_DEBUG -DSAFEMALLOC -DSAFE_MUTEX -O2" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static --with-debug --with-innodb --with-embedded-server
|
||||
gmake
|
|
@ -105,8 +105,23 @@ $|=1;
|
|||
safe_cd("$host");
|
||||
if ($opt_stage == 0 && ! $opt_use_old_distribution)
|
||||
{
|
||||
my ($name);
|
||||
safe_system("gunzip < $opt_distribution | $tar xf -");
|
||||
|
||||
# Fix file times; This is needed because the time for files may be
|
||||
# in the future
|
||||
system("touch timestamp; find $var -newer timestamp -print | xargs touch; rm -f timestamp");
|
||||
sleep(2);
|
||||
# Ensure that files we don't want to rebuild are newer than other files
|
||||
foreach $name ("configure",
|
||||
"Docs/include.texi",
|
||||
"Docs/*.html", "Docs/manual.txt", "Docs/mysql.info",
|
||||
"sql/sql_yacc.h", "sql/sql_yacc.cc")
|
||||
{
|
||||
system("touch $name");
|
||||
}
|
||||
}
|
||||
|
||||
safe_cd($ver);
|
||||
if ($opt_stage <= 1)
|
||||
{
|
||||
|
|
|
@ -770,9 +770,11 @@ databases that contain 50,000,000 records and we know of users that
|
|||
uses MySQL with 60,000 tables and about 5,000,000,000 rows
|
||||
|
||||
@item
|
||||
All columns have default values. You can use @code{INSERT} to insert a
|
||||
subset of a table's columns; those columns that are not explicitly given
|
||||
values are set to their default values.
|
||||
@cindex default values
|
||||
All columns have default values.
|
||||
You can use @code{INSERT} to insert a subset of a table's columns; those
|
||||
columns that are not explicitly given values are set to their default
|
||||
values.
|
||||
|
||||
@item
|
||||
Uses GNU Automake, Autoconf, and Libtool for portability.
|
||||
|
@ -7905,8 +7907,11 @@ The initial download of the source tree may take a while, depending on the
|
|||
speed of your connection; be patient.
|
||||
|
||||
@item
|
||||
You will need GNU @code{autoconf}, @code{automake}, @code{libtool}, and
|
||||
@code{m4} to run the next set of commands.
|
||||
You will need GNU @code{autoconf 2.13}, @code{automake 1.4},
|
||||
@code{libtool}, and @code{m4} to run the next set of commands.
|
||||
Note that the new versions of @code{autoconf} (2.52) and @code{automake}
|
||||
(1.5) do not work.
|
||||
|
||||
If you get some strange error during this stage, check that you really
|
||||
have @code{libtool} installed!
|
||||
|
||||
|
@ -24278,6 +24283,37 @@ takes more effort and hardware.
|
|||
We are also working on some extensions to solve this problem for some
|
||||
common application niches.
|
||||
|
||||
MySQL can work with both transactional and not transactional tables. To
|
||||
be able to work smoothly with not transactional tables (which can't
|
||||
rollback if something goes wrong), MySQL has the following rules:
|
||||
|
||||
@cindex default values
|
||||
@itemize @bullet
|
||||
@item
|
||||
All columns has default values.
|
||||
@item
|
||||
If you insert a 'wrong' value in a column like a @code{NULL} in a
|
||||
@code{NOT NULL} column or a too big numerical value in a numerical
|
||||
column, MySQL will instead of giving an error instead set the column to
|
||||
the 'best possible value'. For numerical values this is 0, the smallest
|
||||
possible values or the largest possible value. For strings this is
|
||||
either the empty string or the longest possible string that can be in
|
||||
the column.
|
||||
@item
|
||||
All calculated expressions returns a value that can be used instead of
|
||||
signaling an error condition. For example 1/0 returns @code{NULL}
|
||||
@end itemize
|
||||
|
||||
The reason for the above rules is that we can't check these conditions
|
||||
before the query starts to execute. If we encounter a problem after
|
||||
updating a few rows, we can't just rollback as the table type may not
|
||||
support this. We can't stop because in that case the update would be
|
||||
'half done' which is probably the worst possible scenario. In this case
|
||||
it's better to 'do the best you can' and then continue as if nothing
|
||||
happened.
|
||||
|
||||
The above means that one should not use MySQL to check fields content,
|
||||
but one should do this in the application.
|
||||
|
||||
@node Portability, Internal use, Design Limitations, Optimize Overview
|
||||
@subsection Portability
|
||||
|
@ -32550,11 +32586,18 @@ If you specify no column list for @code{INSERT ... VALUES} or @code{INSERT
|
|||
the columns in the table, use @code{DESCRIBE tbl_name} to find out.
|
||||
|
||||
@item
|
||||
@cindex default values
|
||||
Any column not explicitly given a value is set to its default value. For
|
||||
example, if you specify a column list that doesn't name all the columns in
|
||||
the table, unnamed columns are set to their default values. Default value
|
||||
assignment is described in @ref{CREATE TABLE, , @code{CREATE TABLE}}.
|
||||
|
||||
MySQL always has a default value for all fields. This is something
|
||||
that is imposed on MySQL to be able to work with both transactional
|
||||
and not transactional tables.
|
||||
|
||||
Our view is that checking of fields content should be done in the
|
||||
application and not in the database server.
|
||||
@item
|
||||
An @code{expression} may refer to any column that was set earlier in a value
|
||||
list. For example, you can say this:
|
||||
|
@ -33795,6 +33838,7 @@ as setting it to @code{NULL}, because @code{0} is a valid @code{TIMESTAMP}
|
|||
value.
|
||||
|
||||
@item
|
||||
@cindex default values
|
||||
If no @code{DEFAULT} value is specified for a column, MySQL
|
||||
automatically assigns one.
|
||||
|
||||
|
@ -53360,7 +53404,7 @@ in the @code{mysql} mail archive, you should report the bug to
|
|||
online at the @uref{http://www.mysql.com/documentation/, MySQL
|
||||
documentation page}.
|
||||
|
||||
If you have started @code{mysqld} with @code{--with-myisam-recover},
|
||||
If you have started @code{mysqld} with @code{myisam-recover},
|
||||
MySQL will automatically check and try to repair @code{MyISAM}
|
||||
tables if they are marked as 'not closed properly' or 'crashed'. If
|
||||
this happens, MySQL will write an entry in the
|
||||
|
|
|
@ -726,7 +726,7 @@ AC_MSG_CHECKING(for OpenSSL)
|
|||
openssl_includes="-I/usr/local/ssl/include"
|
||||
AC_DEFINE(HAVE_OPENSSL)
|
||||
else
|
||||
AC_MSG_RESULT(disabled because --with-vio wasn not used)
|
||||
AC_MSG_RESULT(disabled because --with-vio was not used)
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
|
|
|
@ -23,15 +23,6 @@
|
|||
|
||||
#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_LOCAL_FILES)
|
||||
|
||||
#ifndef OS2
|
||||
extern "C"
|
||||
{
|
||||
int simple_command(MYSQL *mysql,enum enum_server_command command,
|
||||
const char *arg, uint length, my_bool skipp_check);
|
||||
uint net_safe_read(MYSQL* mysql);
|
||||
}
|
||||
#endif
|
||||
|
||||
char server_version[SERVER_VERSION_LENGTH];
|
||||
uint32 server_id = 0;
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
|
||||
**********************************************************************/
|
||||
|
||||
#define MTEST_VERSION "1.10"
|
||||
#define MTEST_VERSION "1.11"
|
||||
|
||||
#include <my_global.h>
|
||||
#include <mysql_embed.h>
|
||||
|
@ -84,7 +84,7 @@
|
|||
static int record = 0, verbose = 0, silent = 0, opt_sleep=0;
|
||||
static char *db = 0, *pass=0;
|
||||
const char* user = 0, *host = 0, *unix_sock = 0;
|
||||
static int port = 0, opt_big_test=0;
|
||||
static int port = 0, opt_big_test=0, opt_compress=0;
|
||||
static uint start_lineno, *lineno;
|
||||
|
||||
static char **default_argv;
|
||||
|
@ -246,11 +246,11 @@ static uint out_length;
|
|||
static int eval_result = 0;
|
||||
|
||||
/* Disable functions that only exist in MySQL 4.0 */
|
||||
#if MYSQL_VERSION_ID < 40000
|
||||
static void mysql_enable_rpl_parse(MYSQL* mysql __attribute__((unused))) {}
|
||||
static void mysql_disable_rpl_parse(MYSQL* mysql __attribute__((unused))) {}
|
||||
static int mysql_rpl_parse_enabled(MYSQL* mysql __attribute__((unused))) { return 1; }
|
||||
static int mysql_rpl_probe(MYSQL *mysql __attribute__((unused))) { return 1; }
|
||||
#if MYSQL_VERSION_ID < 40000 || defined(EMBEDDED_LIBRARY)
|
||||
void mysql_enable_rpl_parse(MYSQL* mysql __attribute__((unused))) {}
|
||||
void mysql_disable_rpl_parse(MYSQL* mysql __attribute__((unused))) {}
|
||||
int mysql_rpl_parse_enabled(MYSQL* mysql __attribute__((unused))) { return 1; }
|
||||
int mysql_rpl_probe(MYSQL *mysql __attribute__((unused))) { return 1; }
|
||||
#endif
|
||||
|
||||
static void do_eval(DYNAMIC_STRING* query_eval, const char* query)
|
||||
|
@ -1164,6 +1164,8 @@ int do_connect(struct st_query* q)
|
|||
|
||||
if (!mysql_init(&next_con->mysql))
|
||||
die("Failed on mysql_init()");
|
||||
if (opt_compress)
|
||||
mysql_options(&next_con->mysql,MYSQL_OPT_COMPRESS,NullS);
|
||||
if (con_sock)
|
||||
con_sock=fn_format(buff, con_sock, TMPDIR, "",0);
|
||||
if (!con_db[0])
|
||||
|
@ -1503,6 +1505,7 @@ struct option long_options[] =
|
|||
{"debug", optional_argument, 0, '#'},
|
||||
{"database", required_argument, 0, 'D'},
|
||||
{"big-test", no_argument, 0, 'B'},
|
||||
{"compress", no_argument, 0, 'C'},
|
||||
{"help", no_argument, 0, '?'},
|
||||
{"host", required_argument, 0, 'h'},
|
||||
{"password", optional_argument, 0, 'p'},
|
||||
|
@ -1547,6 +1550,7 @@ void usage()
|
|||
-p[password], --password[=...]\n\
|
||||
Password to use when connecting to server.\n\
|
||||
-B, --big-test Define BIG_TEST to 1\n\
|
||||
-C, --compress Use the compressed server/client protocol\n\
|
||||
-D, --database=... Database to use.\n\
|
||||
-P, --port=... Port number to use for connection.\n\
|
||||
-S, --socket=... Socket file to use for connection.\n\
|
||||
|
@ -1569,8 +1573,8 @@ int parse_args(int argc, char **argv)
|
|||
load_defaults("my",load_default_groups,&argc,&argv);
|
||||
default_argv= argv;
|
||||
|
||||
while((c = getopt_long(argc, argv, "h:p::u:BP:D:S:R:x:t:T:#:?rvVq",
|
||||
long_options, &option_index)) != EOF)
|
||||
while ((c = getopt_long(argc, argv, "h:p::u:BCP:D:S:R:x:t:T:#:?rvVq",
|
||||
long_options, &option_index)) != EOF)
|
||||
{
|
||||
switch(c) {
|
||||
case '#':
|
||||
|
@ -1605,6 +1609,9 @@ int parse_args(int argc, char **argv)
|
|||
case 'B':
|
||||
opt_big_test=1;
|
||||
break;
|
||||
case 'C':
|
||||
opt_compress=1;
|
||||
break;
|
||||
case 'P':
|
||||
port = atoi(optarg);
|
||||
break;
|
||||
|
@ -1984,6 +1991,8 @@ int main(int argc, char** argv)
|
|||
|
||||
if (!( mysql_init(&cur_con->mysql)))
|
||||
die("Failed in mysql_init()");
|
||||
if (opt_compress)
|
||||
mysql_options(&cur_con->mysql,MYSQL_OPT_COMPRESS,NullS);
|
||||
cur_con->name = my_strdup("default", MYF(MY_WME));
|
||||
if (!cur_con->name)
|
||||
die("Out of memory");
|
||||
|
|
|
@ -10,7 +10,7 @@ AM_CONFIG_HEADER(config.h)
|
|||
PROTOCOL_VERSION=10
|
||||
DOT_FRM_VERSION=6
|
||||
# See the libtool docs for information on how to do shared lib versions.
|
||||
SHARED_LIB_VERSION=10:0:0
|
||||
SHARED_LIB_VERSION=11:0:0
|
||||
|
||||
# Set all version vars based on $VERSION. How do we do this more elegant ?
|
||||
# Remember that regexps needs to quote [ and ] since this is run through m4
|
||||
|
|
|
@ -72,11 +72,11 @@ typedef struct st_mysql_field {
|
|||
char *name; /* Name of column */
|
||||
char *table; /* Table of column if column was a field */
|
||||
char *def; /* Default value (set by mysql_list_fields) */
|
||||
enum enum_field_types type; /* Type of field. Se mysql_com.h for types */
|
||||
unsigned int length; /* Width of column */
|
||||
unsigned int max_length; /* Max width of selected set */
|
||||
unsigned long length; /* Width of column */
|
||||
unsigned long max_length; /* Max width of selected set */
|
||||
unsigned int flags; /* Div flags */
|
||||
unsigned int decimals; /* Number of decimals in field */
|
||||
enum enum_field_types type; /* Type of field. Se mysql_com.h for types */
|
||||
} MYSQL_FIELD;
|
||||
|
||||
typedef char **MYSQL_ROW; /* return data as array of strings */
|
||||
|
@ -175,25 +175,30 @@ typedef struct st_mysql {
|
|||
gptr connector_fd; /* ConnectorFd for SSL */
|
||||
char *host,*user,*passwd,*unix_socket,*server_version,*host_info,
|
||||
*info,*db;
|
||||
struct charset_info_st *charset;
|
||||
MYSQL_FIELD *fields;
|
||||
MEM_ROOT field_alloc;
|
||||
my_ulonglong affected_rows;
|
||||
my_ulonglong insert_id; /* id if insert on table with NEXTNR */
|
||||
my_ulonglong extra_info; /* Used by mysqlshow */
|
||||
unsigned long thread_id; /* Id for connection in server */
|
||||
unsigned long packet_length;
|
||||
unsigned int port,client_flag,server_capabilities;
|
||||
unsigned int protocol_version;
|
||||
unsigned int field_count;
|
||||
unsigned int server_status;
|
||||
unsigned long thread_id; /* Id for connection in server */
|
||||
my_ulonglong affected_rows;
|
||||
my_ulonglong insert_id; /* id if insert on table with NEXTNR */
|
||||
my_ulonglong extra_info; /* Used by mysqlshow */
|
||||
unsigned long packet_length;
|
||||
unsigned int server_language;
|
||||
struct st_mysql_options options;
|
||||
enum mysql_status status;
|
||||
MYSQL_FIELD *fields;
|
||||
MEM_ROOT field_alloc;
|
||||
my_bool free_me; /* If free in mysql_close */
|
||||
my_bool reconnect; /* set to 1 if automatic reconnect */
|
||||
struct st_mysql_options options;
|
||||
char scramble_buff[9];
|
||||
struct charset_info_st *charset;
|
||||
unsigned int server_language;
|
||||
|
||||
/*
|
||||
Set if this is the original connection, not a master or a slave we have
|
||||
added though mysql_rpl_probe() or mysql_set_master()/ mysql_add_slave()
|
||||
*/
|
||||
my_bool rpl_pivot;
|
||||
/* pointers to the master, and the next slave
|
||||
connections, points to itself if lone connection */
|
||||
struct st_mysql* master, *next_slave;
|
||||
|
@ -201,26 +206,21 @@ typedef struct st_mysql {
|
|||
struct st_mysql* last_used_slave; /* needed for round-robin slave pick */
|
||||
/* needed for send/read/store/use result to work correctly with replication */
|
||||
struct st_mysql* last_used_con;
|
||||
/*
|
||||
Set if this is the original connection, not a master or a slave we have
|
||||
added though mysql_rpl_probe() or mysql_set_master()/ mysql_add_slave()
|
||||
*/
|
||||
my_bool rpl_pivot;
|
||||
} MYSQL;
|
||||
|
||||
|
||||
typedef struct st_mysql_res {
|
||||
my_ulonglong row_count;
|
||||
unsigned int field_count, current_field;
|
||||
MYSQL_FIELD *fields;
|
||||
MYSQL_DATA *data;
|
||||
MYSQL_ROWS *data_cursor;
|
||||
MEM_ROOT field_alloc;
|
||||
MYSQL_ROW row; /* If unbuffered read */
|
||||
MYSQL_ROW current_row; /* buffer to current row */
|
||||
unsigned long *lengths; /* column lengths of current row */
|
||||
MYSQL *handle; /* for unbuffered reads */
|
||||
my_bool eof; /* Used my mysql_fetch_row */
|
||||
MEM_ROOT field_alloc;
|
||||
unsigned int field_count, current_field;
|
||||
MYSQL_ROW row; /* If unbuffered read */
|
||||
MYSQL_ROW current_row; /* buffer to current row */
|
||||
my_bool eof; /* Used by mysql_fetch_row */
|
||||
} MYSQL_RES;
|
||||
|
||||
|
||||
|
@ -228,14 +228,14 @@ typedef struct st_mysql_res {
|
|||
* work when linked against either the standard client library or the
|
||||
* embedded server library, these functions should be called. */
|
||||
int mysql_server_init(int argc, const char **argv, const char **groups);
|
||||
void mysql_server_end();
|
||||
void mysql_server_end(void);
|
||||
|
||||
/* Set up and bring down a thread; these function should be called
|
||||
* for each thread in an application which opens at least one MySQL
|
||||
* connection. All uses of the connection(s) should be between these
|
||||
* function calls. */
|
||||
my_bool mysql_thread_init();
|
||||
void mysql_thread_end();
|
||||
my_bool mysql_thread_init(void);
|
||||
void mysql_thread_end(void);
|
||||
|
||||
/* Functions to get information from the MYSQL and MYSQL_RES structures */
|
||||
/* Should definitely be used if one uses shared libraries */
|
||||
|
@ -276,20 +276,20 @@ void STDCALL mysql_close(MYSQL *sock);
|
|||
int STDCALL mysql_select_db(MYSQL *mysql, const char *db);
|
||||
int STDCALL mysql_query(MYSQL *mysql, const char *q);
|
||||
int STDCALL mysql_send_query(MYSQL *mysql, const char *q,
|
||||
unsigned int length);
|
||||
unsigned long length);
|
||||
int STDCALL mysql_read_query_result(MYSQL *mysql);
|
||||
int STDCALL mysql_real_query(MYSQL *mysql, const char *q,
|
||||
unsigned int length);
|
||||
unsigned long length);
|
||||
/* perform query on master */
|
||||
int STDCALL mysql_master_query(MYSQL *mysql, const char *q,
|
||||
unsigned int length);
|
||||
unsigned long length);
|
||||
int STDCALL mysql_master_send_query(MYSQL *mysql, const char *q,
|
||||
unsigned int length);
|
||||
unsigned long length);
|
||||
/* perform query on slave */
|
||||
int STDCALL mysql_slave_query(MYSQL *mysql, const char *q,
|
||||
unsigned int length);
|
||||
unsigned long length);
|
||||
int STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q,
|
||||
unsigned int length);
|
||||
unsigned long length);
|
||||
|
||||
/*
|
||||
enable/disable parsing of all queries to decide if they go on master or
|
||||
|
@ -369,16 +369,23 @@ char * STDCALL mysql_odbc_escape_string(MYSQL *mysql,
|
|||
void STDCALL myodbc_remove_escape(MYSQL *mysql,char *name);
|
||||
unsigned int STDCALL mysql_thread_safe(void);
|
||||
|
||||
#define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT)
|
||||
|
||||
#ifdef USE_OLD_FUNCTIONS
|
||||
MYSQL * STDCALL mysql_connect(MYSQL *mysql, const char *host,
|
||||
const char *user, const char *passwd);
|
||||
int STDCALL mysql_create_db(MYSQL *mysql, const char *DB);
|
||||
int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB);
|
||||
#define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT)
|
||||
#define HAVE_MYSQL_REAL_CONNECT
|
||||
#endif
|
||||
|
||||
#define HAVE_MYSQL_REAL_CONNECT
|
||||
/*
|
||||
The following functions are mainly exported because of mysqlbinlog;
|
||||
They are not for general usage
|
||||
*/
|
||||
|
||||
int simple_command(MYSQL *mysql,enum enum_server_command command,
|
||||
const char *arg, ulong length, my_bool skipp_check);
|
||||
ulong net_safe_read(MYSQL* mysql);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -108,11 +108,12 @@ typedef struct st_vio Vio;
|
|||
|
||||
typedef struct st_net {
|
||||
Vio* vio;
|
||||
my_socket fd; /* For Perl DBI/dbd */
|
||||
int fcntl;
|
||||
unsigned char *buff,*buff_end,*write_pos,*read_pos;
|
||||
my_socket fd; /* For Perl DBI/dbd */
|
||||
unsigned long max_packet;
|
||||
int fcntl;
|
||||
unsigned int last_errno,timeout,pkt_nr,compress_pkt_nr;
|
||||
char last_error[MYSQL_ERRMSG_SIZE];
|
||||
unsigned int last_errno,max_packet,timeout,pkt_nr;
|
||||
unsigned char error;
|
||||
my_bool return_errno,compress;
|
||||
/*
|
||||
|
@ -120,14 +121,14 @@ typedef struct st_net {
|
|||
command ( as in LOAD TABLE ... FROM MASTER ),
|
||||
and do not want to confuse the client with OK at the wrong time
|
||||
*/
|
||||
my_bool no_send_ok;
|
||||
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;
|
||||
} NET;
|
||||
|
||||
#define packet_error ((unsigned int) -1)
|
||||
#define packet_error (~(unsigned long) 0)
|
||||
|
||||
enum enum_field_types { FIELD_TYPE_DECIMAL, FIELD_TYPE_TINY,
|
||||
FIELD_TYPE_SHORT, FIELD_TYPE_LONG,
|
||||
|
|
|
@ -316,11 +316,11 @@ HANDLE create_named_pipe(NET *net, uint connect_timeout, char **arg_host,
|
|||
** or packet is an error message
|
||||
*****************************************************************************/
|
||||
|
||||
uint
|
||||
ulong
|
||||
net_safe_read(MYSQL *mysql)
|
||||
{
|
||||
NET *net= &mysql->net;
|
||||
uint len=0;
|
||||
ulong len=0;
|
||||
init_sigpipe_variables
|
||||
|
||||
/* Don't give sigpipe errors if the client doesn't want them */
|
||||
|
@ -338,7 +338,7 @@ net_safe_read(MYSQL *mysql)
|
|||
CR_NET_PACKET_TOO_LARGE:
|
||||
CR_SERVER_LOST);
|
||||
strmov(net->last_error,ER(net->last_errno));
|
||||
return(packet_error);
|
||||
return (packet_error);
|
||||
}
|
||||
if (net->read_pos[0] == 255)
|
||||
{
|
||||
|
@ -349,7 +349,7 @@ net_safe_read(MYSQL *mysql)
|
|||
pos+=2;
|
||||
len-=2;
|
||||
(void) strmake(net->last_error,(char*) pos,
|
||||
min(len,sizeof(net->last_error)-1));
|
||||
min((uint) len,(uint) sizeof(net->last_error)-1));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -440,7 +440,7 @@ static void free_rows(MYSQL_DATA *cur)
|
|||
|
||||
int
|
||||
simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg,
|
||||
uint length, my_bool skipp_check)
|
||||
ulong length, my_bool skipp_check)
|
||||
{
|
||||
NET *net= &mysql->net;
|
||||
int result= -1;
|
||||
|
@ -671,8 +671,8 @@ mysql_free_result(MYSQL_RES *result)
|
|||
DBUG_PRINT("warning",("Not all rows in set were read; Ignoring rows"));
|
||||
for (;;)
|
||||
{
|
||||
uint pkt_len;
|
||||
if ((pkt_len=(uint) net_safe_read(result->handle)) == packet_error)
|
||||
ulong pkt_len;
|
||||
if ((pkt_len=net_safe_read(result->handle)) == packet_error)
|
||||
break;
|
||||
if (pkt_len == 1 && result->handle->net.read_pos[0] == 254)
|
||||
break; /* End of data */
|
||||
|
@ -866,7 +866,8 @@ unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
|
|||
MYSQL_FIELD *field,*result;
|
||||
DBUG_ENTER("unpack_fields");
|
||||
|
||||
field=result=(MYSQL_FIELD*) alloc_root(alloc,sizeof(MYSQL_FIELD)*fields);
|
||||
field=result=(MYSQL_FIELD*) alloc_root(alloc,
|
||||
(uint) sizeof(MYSQL_FIELD)*fields);
|
||||
if (!result)
|
||||
DBUG_RETURN(0);
|
||||
|
||||
|
@ -913,7 +914,7 @@ static MYSQL_DATA *read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
|
|||
NET *net = &mysql->net;
|
||||
DBUG_ENTER("read_rows");
|
||||
|
||||
if ((pkt_len=(uint) net_safe_read(mysql)) == packet_error)
|
||||
if ((pkt_len= net_safe_read(mysql)) == packet_error)
|
||||
DBUG_RETURN(0);
|
||||
if (!(result=(MYSQL_DATA*) my_malloc(sizeof(MYSQL_DATA),
|
||||
MYF(MY_WME | MY_ZEROFILL))))
|
||||
|
@ -1020,7 +1021,7 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths)
|
|||
|
||||
/* perform query on master */
|
||||
int STDCALL mysql_master_query(MYSQL *mysql, const char *q,
|
||||
unsigned int length)
|
||||
unsigned long length)
|
||||
{
|
||||
if (mysql_master_send_query(mysql, q, length))
|
||||
return 1;
|
||||
|
@ -1028,7 +1029,7 @@ int STDCALL mysql_master_query(MYSQL *mysql, const char *q,
|
|||
}
|
||||
|
||||
int STDCALL mysql_master_send_query(MYSQL *mysql, const char *q,
|
||||
unsigned int length)
|
||||
unsigned long length)
|
||||
{
|
||||
MYSQL*master = mysql->master;
|
||||
if (!length)
|
||||
|
@ -1042,7 +1043,7 @@ int STDCALL mysql_master_send_query(MYSQL *mysql, const char *q,
|
|||
|
||||
/* perform query on slave */
|
||||
int STDCALL mysql_slave_query(MYSQL *mysql, const char *q,
|
||||
unsigned int length)
|
||||
unsigned long length)
|
||||
{
|
||||
if (mysql_slave_send_query(mysql, q, length))
|
||||
return 1;
|
||||
|
@ -1050,7 +1051,7 @@ int STDCALL mysql_slave_query(MYSQL *mysql, const char *q,
|
|||
}
|
||||
|
||||
int STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q,
|
||||
unsigned int length)
|
||||
unsigned long length)
|
||||
{
|
||||
MYSQL* last_used_slave, *slave_to_use = 0;
|
||||
|
||||
|
@ -1271,7 +1272,7 @@ STDCALL mysql_rpl_query_type(const char* q, int len)
|
|||
case 'c': /* create or check */
|
||||
return tolower(q[1]) == 'h' ? MYSQL_RPL_ADMIN : MYSQL_RPL_MASTER ;
|
||||
case 's': /* select or show */
|
||||
return tolower(q[1] == 'h') ? MYSQL_RPL_ADMIN : MYSQL_RPL_SLAVE;
|
||||
return tolower(q[1]) == 'h' ? MYSQL_RPL_ADMIN : MYSQL_RPL_SLAVE;
|
||||
case 'f': /* flush */
|
||||
case 'r': /* repair */
|
||||
case 'g': /* grant */
|
||||
|
@ -1280,8 +1281,7 @@ STDCALL mysql_rpl_query_type(const char* q, int len)
|
|||
return MYSQL_RPL_SLAVE;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return MYSQL_RPL_MASTER; /* By default, send to master */
|
||||
}
|
||||
|
||||
|
||||
|
@ -1829,7 +1829,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
|
|||
mysql->db=my_strdup(db,MYF(MY_WME));
|
||||
db=0;
|
||||
}
|
||||
if (my_net_write(net,buff,(uint) (end-buff)) || net_flush(net) ||
|
||||
if (my_net_write(net,buff,(ulong) (end-buff)) || net_flush(net) ||
|
||||
net_safe_read(mysql) == packet_error)
|
||||
goto error;
|
||||
if (client_flag & CLIENT_COMPRESS) /* We will use compression */
|
||||
|
@ -1935,7 +1935,7 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
|
|||
pos=scramble(pos, mysql->scramble_buff, passwd,
|
||||
(my_bool) (mysql->protocol_version == 9));
|
||||
pos=strmov(pos+1,db ? db : "");
|
||||
if (simple_command(mysql,COM_CHANGE_USER, buff,(uint) (pos-buff),0))
|
||||
if (simple_command(mysql,COM_CHANGE_USER, buff,(ulong) (pos-buff),0))
|
||||
DBUG_RETURN(1);
|
||||
|
||||
my_free(mysql->user,MYF(MY_ALLOW_ZERO_PTR));
|
||||
|
@ -1960,7 +1960,7 @@ mysql_select_db(MYSQL *mysql, const char *db)
|
|||
DBUG_ENTER("mysql_select_db");
|
||||
DBUG_PRINT("enter",("db: '%s'",db));
|
||||
|
||||
if ((error=simple_command(mysql,COM_INIT_DB,db,(uint) strlen(db),0)))
|
||||
if ((error=simple_command(mysql,COM_INIT_DB,db,(ulong) strlen(db),0)))
|
||||
DBUG_RETURN(error);
|
||||
my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR));
|
||||
mysql->db=my_strdup(db,MYF(MY_WME));
|
||||
|
@ -2111,7 +2111,7 @@ STDCALL mysql_add_slave(MYSQL* mysql, const char* host,
|
|||
*/
|
||||
|
||||
int STDCALL
|
||||
mysql_send_query(MYSQL* mysql, const char* query, uint length)
|
||||
mysql_send_query(MYSQL* mysql, const char* query, ulong length)
|
||||
{
|
||||
if (mysql->options.rpl_parse && mysql->rpl_pivot)
|
||||
{
|
||||
|
@ -2179,13 +2179,13 @@ get_info:
|
|||
CLIENT_LONG_FLAG))))
|
||||
DBUG_RETURN(-1);
|
||||
mysql->status=MYSQL_STATUS_GET_RESULT;
|
||||
mysql->field_count=field_count;
|
||||
mysql->field_count= (uint) field_count;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
||||
int STDCALL
|
||||
mysql_real_query(MYSQL *mysql, const char *query, uint length)
|
||||
mysql_real_query(MYSQL *mysql, const char *query, ulong length)
|
||||
{
|
||||
DBUG_ENTER("mysql_real_query");
|
||||
DBUG_PRINT("enter",("handle: %lx",mysql));
|
||||
|
@ -2276,8 +2276,9 @@ mysql_store_result(MYSQL *mysql)
|
|||
DBUG_RETURN(0);
|
||||
}
|
||||
mysql->status=MYSQL_STATUS_READY; /* server is ready */
|
||||
if (!(result=(MYSQL_RES*) my_malloc(sizeof(MYSQL_RES)+
|
||||
sizeof(ulong)*mysql->field_count,
|
||||
if (!(result=(MYSQL_RES*) my_malloc((uint) (sizeof(MYSQL_RES)+
|
||||
sizeof(ulong) *
|
||||
mysql->field_count),
|
||||
MYF(MY_WME | MY_ZEROFILL))))
|
||||
{
|
||||
mysql->net.last_errno=CR_OUT_OF_MEMORY;
|
||||
|
@ -2433,7 +2434,7 @@ mysql_fetch_lengths(MYSQL_RES *res)
|
|||
continue;
|
||||
}
|
||||
if (start) /* Found end of prev string */
|
||||
*prev_length= (uint) (*column-start-1);
|
||||
*prev_length= (ulong) (*column-start-1);
|
||||
start= *column;
|
||||
prev_length=lengths;
|
||||
}
|
||||
|
@ -2534,7 +2535,7 @@ mysql_list_fields(MYSQL *mysql, const char *table, const char *wild)
|
|||
LINT_INIT(query);
|
||||
|
||||
end=strmake(strmake(buff, table,128)+1,wild ? wild : "",128);
|
||||
if (simple_command(mysql,COM_FIELD_LIST,buff,(uint) (end-buff),1) ||
|
||||
if (simple_command(mysql,COM_FIELD_LIST,buff,(ulong) (end-buff),1) ||
|
||||
!(query = read_rows(mysql,(MYSQL_FIELD*) 0,6)))
|
||||
DBUG_RETURN(NULL);
|
||||
|
||||
|
@ -2590,7 +2591,7 @@ mysql_create_db(MYSQL *mysql, const char *db)
|
|||
{
|
||||
DBUG_ENTER("mysql_createdb");
|
||||
DBUG_PRINT("enter",("db: %s",db));
|
||||
DBUG_RETURN(simple_command(mysql,COM_CREATE_DB,db, (uint) strlen(db),0));
|
||||
DBUG_RETURN(simple_command(mysql,COM_CREATE_DB,db, (ulong) strlen(db),0));
|
||||
}
|
||||
|
||||
|
||||
|
@ -2599,7 +2600,7 @@ mysql_drop_db(MYSQL *mysql, const char *db)
|
|||
{
|
||||
DBUG_ENTER("mysql_drop_db");
|
||||
DBUG_PRINT("enter",("db: %s",db));
|
||||
DBUG_RETURN(simple_command(mysql,COM_DROP_DB,db,(uint) strlen(db),0));
|
||||
DBUG_RETURN(simple_command(mysql,COM_DROP_DB,db,(ulong) strlen(db),0));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <winsock.h>
|
||||
#endif
|
||||
#include <my_global.h>
|
||||
#include "mysql_embed.h"
|
||||
#include <mysql_com.h>
|
||||
#include <violite.h>
|
||||
#include <my_sys.h>
|
||||
|
@ -89,7 +90,7 @@ extern ulong mysqld_net_retry_count;
|
|||
typedef my_bool thr_alarm_t;
|
||||
typedef my_bool ALARM;
|
||||
#define thr_alarm_init(A) (*(A))=0
|
||||
#define thr_alarm_in_use(A) (*(A)!= 0)
|
||||
#define thr_alarm_in_use(A) (*(A) != 0)
|
||||
#define thr_end_alarm(A)
|
||||
#define thr_alarm(A,B,C) local_thr_alarm((A),(B),(C))
|
||||
inline int local_thr_alarm(my_bool *A,int B __attribute__((unused)),ALARM *C __attribute__((unused)))
|
||||
|
@ -129,7 +130,7 @@ int my_net_init(NET *net, Vio* vio)
|
|||
net->no_send_ok = 0;
|
||||
net->error=0; net->return_errno=0; net->return_status=0;
|
||||
net->timeout=(uint) net_read_timeout; /* Timeout for read */
|
||||
net->pkt_nr=0;
|
||||
net->pkt_nr=net->compress_pkt_nr=0;
|
||||
net->write_pos=net->read_pos = net->buff;
|
||||
net->last_error[0]=0;
|
||||
net->compress=0; net->reading_or_writing=0;
|
||||
|
@ -190,7 +191,7 @@ static my_bool net_realloc(NET *net, ulong length)
|
|||
void net_clear(NET *net)
|
||||
{
|
||||
#ifndef EXTRA_DEBUG
|
||||
int count;
|
||||
int count; /* One may get 'unused' warn */
|
||||
bool is_blocking=vio_is_blocking(net->vio);
|
||||
if (is_blocking)
|
||||
vio_blocking(net->vio, FALSE);
|
||||
|
@ -204,7 +205,7 @@ void net_clear(NET *net)
|
|||
vio_blocking(net->vio, TRUE);
|
||||
}
|
||||
#endif /* EXTRA_DEBUG */
|
||||
net->pkt_nr=0; /* Ready for new command */
|
||||
net->pkt_nr=net->compress_pkt_nr=0; /* Ready for new command */
|
||||
net->write_pos=net->buff;
|
||||
}
|
||||
|
||||
|
@ -217,9 +218,12 @@ int net_flush(NET *net)
|
|||
if (net->buff != net->write_pos)
|
||||
{
|
||||
error=net_real_write(net,(char*) net->buff,
|
||||
(uint) (net->write_pos - net->buff));
|
||||
(ulong) (net->write_pos - net->buff));
|
||||
net->write_pos=net->buff;
|
||||
}
|
||||
/* Sync packet number if using compression */
|
||||
if (net->compress)
|
||||
net->pkt_nr=net->compress_pkt_nr;
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
||||
|
@ -248,7 +252,7 @@ my_net_write(NET *net,const char *packet,ulong len)
|
|||
{
|
||||
const ulong z_size = MAX_THREE_BYTES;
|
||||
int3store(buff, z_size);
|
||||
buff[3]= (net->compress) ? 0 : (uchar) (net->pkt_nr++);
|
||||
buff[3]= net->pkt_nr++;
|
||||
if (net_write_buff(net, (char*) buff, NET_HEADER_SIZE) ||
|
||||
net_write_buff(net, packet, z_size))
|
||||
return 1;
|
||||
|
@ -257,7 +261,7 @@ my_net_write(NET *net,const char *packet,ulong len)
|
|||
}
|
||||
/* Write last packet */
|
||||
int3store(buff,len);
|
||||
buff[3]= (net->compress) ? 0 : (uchar) (net->pkt_nr++);
|
||||
buff[3]= net->pkt_nr++;
|
||||
if (net_write_buff(net,(char*) buff,NET_HEADER_SIZE))
|
||||
return 1;
|
||||
return net_write_buff(net,packet,len);
|
||||
|
@ -275,7 +279,7 @@ my_net_write(NET *net,const char *packet,ulong len)
|
|||
int
|
||||
net_write_command(NET *net,uchar command,const char *packet,ulong len)
|
||||
{
|
||||
uint length=len+1; /* 1 extra byte for command */
|
||||
ulong length=len+1; /* 1 extra byte for command */
|
||||
uchar buff[NET_HEADER_SIZE+1];
|
||||
uint header_size=NET_HEADER_SIZE+1;
|
||||
buff[4]=command; /* For first packet */
|
||||
|
@ -287,7 +291,7 @@ net_write_command(NET *net,uchar command,const char *packet,ulong len)
|
|||
do
|
||||
{
|
||||
int3store(buff, MAX_THREE_BYTES);
|
||||
buff[3]= (net->compress) ? 0 : (uchar) (net->pkt_nr++);
|
||||
buff[3]= net->pkt_nr++;
|
||||
if (net_write_buff(net,(char*) buff, header_size) ||
|
||||
net_write_buff(net,packet,len))
|
||||
return 1;
|
||||
|
@ -299,7 +303,7 @@ net_write_command(NET *net,uchar command,const char *packet,ulong len)
|
|||
len=length; /* Data left to be written */
|
||||
}
|
||||
int3store(buff,length);
|
||||
buff[3]= (net->compress) ? 0 : (uchar) (net->pkt_nr++);
|
||||
buff[3]= net->pkt_nr++;
|
||||
return test(net_write_buff(net,(char*) buff,header_size) ||
|
||||
net_write_buff(net,packet,len) || net_flush(net));
|
||||
}
|
||||
|
@ -312,7 +316,7 @@ net_write_command(NET *net,uchar command,const char *packet,ulong len)
|
|||
static int
|
||||
net_write_buff(NET *net,const char *packet,ulong len)
|
||||
{
|
||||
uint left_length=(uint) (net->buff_end - net->write_pos);
|
||||
ulong left_length=(ulong) (net->buff_end - net->write_pos);
|
||||
|
||||
while (len > left_length)
|
||||
{
|
||||
|
@ -338,7 +342,7 @@ net_write_buff(NET *net,const char *packet,ulong len)
|
|||
int
|
||||
net_real_write(NET *net,const char *packet,ulong len)
|
||||
{
|
||||
int length;
|
||||
long int length;
|
||||
char *pos,*end;
|
||||
thr_alarm_t alarmed;
|
||||
#if !defined(__WIN__) && !defined(__EMX__) && !defined(OS2)
|
||||
|
@ -378,7 +382,7 @@ net_real_write(NET *net,const char *packet,ulong len)
|
|||
}
|
||||
int3store(&b[NET_HEADER_SIZE],complen);
|
||||
int3store(b,len);
|
||||
b[3]=(uchar) (net->pkt_nr++);
|
||||
b[3]=(uchar) (net->compress_pkt_nr++);
|
||||
len+= header_length;
|
||||
packet= (char*) b;
|
||||
}
|
||||
|
@ -396,7 +400,7 @@ net_real_write(NET *net,const char *packet,ulong len)
|
|||
pos=(char*) packet; end=pos+len;
|
||||
while (pos != end)
|
||||
{
|
||||
if ((int) (length=vio_write(net->vio,pos,(int) (end-pos))) <= 0)
|
||||
if ((long) (length=vio_write(net->vio,pos,(ulong) (end-pos))) <= 0)
|
||||
{
|
||||
my_bool interrupted = vio_should_retry(net->vio);
|
||||
#if (!defined(__WIN__) && !defined(__EMX__) && !defined(OS2))
|
||||
|
@ -496,7 +500,7 @@ static void my_net_skip_rest(NET *net, ulong remain, thr_alarm_t *alarmed)
|
|||
if ((int) (length=vio_read(net->vio,(char*) net->buff,remain)) <= 0L)
|
||||
{
|
||||
my_bool interrupted = vio_should_retry(net->vio);
|
||||
if (!thr_got_alarm(alarmed) && interrupted)
|
||||
if (!thr_got_alarm(&alarmed) && interrupted)
|
||||
{ /* Probably in MIT threads */
|
||||
if (retry_count++ < RETRY_COUNT)
|
||||
continue;
|
||||
|
@ -516,7 +520,7 @@ static void my_net_skip_rest(NET *net, ulong remain, thr_alarm_t *alarmed)
|
|||
This function reallocates the net->buff buffer if necessary.
|
||||
*/
|
||||
|
||||
static uint
|
||||
static ulong
|
||||
my_real_read(NET *net, ulong *complen)
|
||||
{
|
||||
uchar *pos;
|
||||
|
@ -627,9 +631,9 @@ my_real_read(NET *net, ulong *complen)
|
|||
if (net->buff[net->where_b] != (uchar) 255)
|
||||
{
|
||||
DBUG_PRINT("error",
|
||||
("Packets out of order (Found: %d, expected %d)",
|
||||
("Packets out of order (Found: %d, expected %u)",
|
||||
(int) net->buff[net->where_b + 3],
|
||||
(uint) (uchar) net->pkt_nr));
|
||||
net->pkt_nr));
|
||||
#ifdef EXTRA_DEBUG
|
||||
fprintf(stderr,"Packets out of order (Found: %d, expected %d)\n",
|
||||
(int) net->buff[net->where_b + 3],
|
||||
|
@ -642,7 +646,7 @@ my_real_read(NET *net, ulong *complen)
|
|||
#endif
|
||||
goto end;
|
||||
}
|
||||
net->pkt_nr++;
|
||||
net->compress_pkt_nr= ++net->pkt_nr;
|
||||
#ifdef HAVE_COMPRESS
|
||||
if (net->compress)
|
||||
{
|
||||
|
@ -710,7 +714,7 @@ my_net_read(NET *net)
|
|||
if (len == MAX_THREE_BYTES)
|
||||
{
|
||||
/* First packet of a multi-packet. Concatenate the packets */
|
||||
int save_pos = net->where_b;
|
||||
ulong save_pos = net->where_b;
|
||||
ulong total_length=0;
|
||||
do
|
||||
{
|
||||
|
@ -820,8 +824,8 @@ my_net_read(NET *net)
|
|||
|
||||
net->read_pos= net->buff+ first_packet_offset + NET_HEADER_SIZE;
|
||||
net->buf_length= buf_length;
|
||||
net->remain_in_buf= buf_length - start_of_packet;
|
||||
len = ((uint) (start_of_packet - first_packet_offset) - NET_HEADER_SIZE -
|
||||
net->remain_in_buf= (ulong) (buf_length - start_of_packet);
|
||||
len = ((ulong) (start_of_packet - first_packet_offset) - NET_HEADER_SIZE -
|
||||
multi_byte_packet);
|
||||
net->save_char= net->read_pos[len]; /* Must be saved */
|
||||
net->read_pos[len]=0; /* Safeguard for mysql_use_result */
|
||||
|
|
|
@ -26,7 +26,7 @@ LDADD = $(top_builddir)/libmysqld/libmysqld.la \
|
|||
mysqltest_DEPENDENCIES = ../libmysqld.la
|
||||
mysqltest_SOURCES = mysqltest.c
|
||||
|
||||
mysql_SOURCES = mysql.cc readline.cc sql_string.cc completion_hash.cc \
|
||||
mysql_SOURCES = mysql.cc readline.cc completion_hash.cc \
|
||||
my_readline.h sql_string.h completion_hash.h
|
||||
mysql_LDADD = @readline_link@ @TERMCAP_LIB@ $(LDADD)
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ static MYSQL* spawn_init(MYSQL* parent, const char* host,
|
|||
** or packet is an error message
|
||||
*****************************************************************************/
|
||||
|
||||
static uint
|
||||
ulong
|
||||
net_safe_read(MYSQL *mysql)
|
||||
{
|
||||
NET *net= &mysql->net;
|
||||
|
@ -218,9 +218,9 @@ static void free_rows(MYSQL_DATA *cur)
|
|||
}
|
||||
|
||||
|
||||
static int
|
||||
int
|
||||
simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg,
|
||||
uint length, my_bool skipp_check)
|
||||
ulong length, my_bool skipp_check)
|
||||
{
|
||||
NET *net= &mysql->net;
|
||||
int result= -1;
|
||||
|
@ -700,7 +700,7 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths)
|
|||
ulong pkt_len,len;
|
||||
uchar *pos,*prev_pos;
|
||||
|
||||
if ((pkt_len=(uint) net_safe_read(mysql)) == packet_error)
|
||||
if ((pkt_len=net_safe_read(mysql)) == packet_error)
|
||||
return -1;
|
||||
if (pkt_len == 1 && mysql->net.read_pos[0] == 254)
|
||||
return 1; /* End of data */
|
||||
|
@ -728,301 +728,6 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* perform query on master */
|
||||
int STDCALL mysql_master_query(MYSQL *mysql, const char *q,
|
||||
unsigned int length)
|
||||
{
|
||||
if(mysql_master_send_query(mysql, q, length))
|
||||
return 1;
|
||||
return mysql_read_query_result(mysql);
|
||||
}
|
||||
|
||||
int STDCALL mysql_master_send_query(MYSQL *mysql, const char *q,
|
||||
unsigned int length)
|
||||
{
|
||||
MYSQL*master = mysql->master;
|
||||
if (!length)
|
||||
length = strlen(q);
|
||||
if (!master->net.vio && !mysql_real_connect(master,0,0,0,0,0,0,0))
|
||||
return 1;
|
||||
mysql->last_used_con = master;
|
||||
return simple_command(master, COM_QUERY, q, length, 1);
|
||||
}
|
||||
|
||||
|
||||
/* perform query on slave */
|
||||
int STDCALL mysql_slave_query(MYSQL *mysql, const char *q,
|
||||
unsigned int length)
|
||||
{
|
||||
if(mysql_slave_send_query(mysql, q, length))
|
||||
return 1;
|
||||
return mysql_read_query_result(mysql);
|
||||
}
|
||||
|
||||
int STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q,
|
||||
unsigned int length)
|
||||
{
|
||||
MYSQL* last_used_slave, *slave_to_use = 0;
|
||||
|
||||
if((last_used_slave = mysql->last_used_slave))
|
||||
slave_to_use = last_used_slave->next_slave;
|
||||
else
|
||||
slave_to_use = mysql->next_slave;
|
||||
/* next_slave is always safe to use - we have a circular list of slaves
|
||||
if there are no slaves, mysql->next_slave == mysql
|
||||
*/
|
||||
mysql->last_used_con = mysql->last_used_slave = slave_to_use;
|
||||
if(!length)
|
||||
length = strlen(q);
|
||||
if(!slave_to_use->net.vio && !mysql_real_connect(slave_to_use, 0,0,0,
|
||||
0,0,0,0))
|
||||
return 1;
|
||||
return simple_command(slave_to_use, COM_QUERY, q, length, 1);
|
||||
}
|
||||
|
||||
|
||||
/* enable/disable parsing of all queries to decide
|
||||
if they go on master or slave */
|
||||
void STDCALL mysql_enable_rpl_parse(MYSQL* mysql)
|
||||
{
|
||||
mysql->options.rpl_parse = 1;
|
||||
}
|
||||
|
||||
void STDCALL mysql_disable_rpl_parse(MYSQL* mysql)
|
||||
{
|
||||
mysql->options.rpl_parse = 0;
|
||||
}
|
||||
|
||||
/* get the value of the parse flag */
|
||||
int STDCALL mysql_rpl_parse_enabled(MYSQL* mysql)
|
||||
{
|
||||
return mysql->options.rpl_parse;
|
||||
}
|
||||
|
||||
/* enable/disable reads from master */
|
||||
void STDCALL mysql_enable_reads_from_master(MYSQL* mysql)
|
||||
{
|
||||
mysql->options.no_master_reads = 0;
|
||||
}
|
||||
|
||||
void STDCALL mysql_disable_reads_from_master(MYSQL* mysql)
|
||||
{
|
||||
mysql->options.no_master_reads = 1;
|
||||
}
|
||||
|
||||
/* get the value of the master read flag */
|
||||
int STDCALL mysql_reads_from_master_enabled(MYSQL* mysql)
|
||||
{
|
||||
return !(mysql->options.no_master_reads);
|
||||
}
|
||||
|
||||
/* We may get an error while doing replication internals.
|
||||
In this case, we add a special explanation to the original
|
||||
error
|
||||
*/
|
||||
static inline void expand_error(MYSQL* mysql, int error)
|
||||
{
|
||||
char tmp[MYSQL_ERRMSG_SIZE];
|
||||
char* p, *tmp_end;
|
||||
tmp_end = strnmov(tmp, mysql->net.last_error, MYSQL_ERRMSG_SIZE);
|
||||
p = strnmov(mysql->net.last_error, ER(error), MYSQL_ERRMSG_SIZE);
|
||||
memcpy(p, tmp, tmp_end - tmp);
|
||||
mysql->net.last_errno = error;
|
||||
}
|
||||
|
||||
/* This function assumes we have just called SHOW SLAVE STATUS and have
|
||||
read the given result and row
|
||||
*/
|
||||
static inline int get_master(MYSQL* mysql, MYSQL_RES* res, MYSQL_ROW row)
|
||||
{
|
||||
MYSQL* master;
|
||||
if(mysql_num_fields(res) < 3)
|
||||
return 1; /* safety */
|
||||
|
||||
/* use the same username and password as the original connection */
|
||||
if(!(master = spawn_init(mysql, row[0], atoi(row[2]), 0, 0)))
|
||||
return 1;
|
||||
mysql->master = master;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* assuming we already know that mysql points to a master connection,
|
||||
retrieve all the slaves
|
||||
*/
|
||||
static inline int get_slaves_from_master(MYSQL* mysql)
|
||||
{
|
||||
MYSQL_RES* res = 0;
|
||||
MYSQL_ROW row;
|
||||
int error = 1;
|
||||
int has_auth_info;
|
||||
if (!mysql->net.vio && !mysql_real_connect(mysql,0,0,0,0,0,0,0))
|
||||
{
|
||||
expand_error(mysql, CR_PROBE_MASTER_CONNECT);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (mysql_query(mysql, "SHOW SLAVE HOSTS") ||
|
||||
!(res = mysql_store_result(mysql)))
|
||||
{
|
||||
expand_error(mysql, CR_PROBE_SLAVE_HOSTS);
|
||||
return 1;
|
||||
}
|
||||
|
||||
switch (mysql_num_fields(res))
|
||||
{
|
||||
case 3: has_auth_info = 0; break;
|
||||
case 5: has_auth_info = 1; break;
|
||||
default:
|
||||
goto err;
|
||||
}
|
||||
|
||||
while ((row = mysql_fetch_row(res)))
|
||||
{
|
||||
MYSQL* slave;
|
||||
const char* tmp_user, *tmp_pass;
|
||||
|
||||
if (has_auth_info)
|
||||
{
|
||||
tmp_user = row[3];
|
||||
tmp_pass = row[4];
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp_user = mysql->user;
|
||||
tmp_pass = mysql->passwd;
|
||||
}
|
||||
|
||||
if(!(slave = spawn_init(mysql, row[1], atoi(row[2]),
|
||||
tmp_user, tmp_pass)))
|
||||
goto err;
|
||||
|
||||
/* Now add slave into the circular linked list */
|
||||
slave->next_slave = mysql->next_slave;
|
||||
mysql->next_slave = slave;
|
||||
}
|
||||
error = 0;
|
||||
err:
|
||||
if(res)
|
||||
mysql_free_result(res);
|
||||
return error;
|
||||
}
|
||||
|
||||
int STDCALL mysql_rpl_probe(MYSQL* mysql)
|
||||
{
|
||||
MYSQL_RES* res = 0;
|
||||
MYSQL_ROW row;
|
||||
int error = 1;
|
||||
/* first determine the replication role of the server we connected to
|
||||
the most reliable way to do this is to run SHOW SLAVE STATUS and see
|
||||
if we have a non-empty master host. This is still not fool-proof -
|
||||
it is not a sin to have a master that has a dormant slave thread with
|
||||
a non-empty master host. However, it is more reliable to check
|
||||
for empty master than whether the slave thread is actually running
|
||||
*/
|
||||
if (mysql_query(mysql, "SHOW SLAVE STATUS") ||
|
||||
!(res = mysql_store_result(mysql)))
|
||||
{
|
||||
expand_error(mysql, CR_PROBE_SLAVE_STATUS);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!(row = mysql_fetch_row(res)))
|
||||
goto err;
|
||||
|
||||
/* check master host for emptiness/NULL */
|
||||
if (row[0] && *(row[0]))
|
||||
{
|
||||
/* this is a slave, ask it for the master */
|
||||
if (get_master(mysql, res, row) || get_slaves_from_master(mysql))
|
||||
goto err;
|
||||
}
|
||||
else
|
||||
{
|
||||
mysql->master = mysql;
|
||||
if (get_slaves_from_master(mysql))
|
||||
goto err;
|
||||
}
|
||||
|
||||
error = 0;
|
||||
err:
|
||||
if(res)
|
||||
mysql_free_result(res);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* make a not so fool-proof decision on where the query should go, to
|
||||
the master or the slave. Ideally the user should always make this
|
||||
decision himself with mysql_master_query() or mysql_slave_query().
|
||||
However, to be able to more easily port the old code, we support the
|
||||
option of an educated guess - this should work for most applications,
|
||||
however, it may make the wrong decision in some particular cases. If
|
||||
that happens, the user would have to change the code to call
|
||||
mysql_master_query() or mysql_slave_query() explicitly in the place
|
||||
where we have made the wrong decision
|
||||
*/
|
||||
enum mysql_rpl_type
|
||||
STDCALL mysql_rpl_query_type(const char* q, int len)
|
||||
{
|
||||
const char* q_end;
|
||||
q_end = (len) ? q + len : strend(q);
|
||||
for(; q < q_end; ++q)
|
||||
{
|
||||
char c;
|
||||
if(isalpha(c=*q))
|
||||
switch(tolower(c))
|
||||
{
|
||||
case 'i': /* insert */
|
||||
case 'u': /* update or unlock tables */
|
||||
case 'l': /* lock tables or load data infile */
|
||||
case 'd': /* drop or delete */
|
||||
case 'a': /* alter */
|
||||
return MYSQL_RPL_MASTER;
|
||||
case 'c': /* create or check */
|
||||
return tolower(q[1]) == 'h' ? MYSQL_RPL_ADMIN : MYSQL_RPL_MASTER ;
|
||||
case 's': /* select or show */
|
||||
return tolower(q[1] == 'h') ? MYSQL_RPL_ADMIN : MYSQL_RPL_SLAVE;
|
||||
case 'f': /* flush */
|
||||
case 'r': /* repair */
|
||||
case 'g': /* grant */
|
||||
return MYSQL_RPL_ADMIN;
|
||||
default:
|
||||
return MYSQL_RPL_SLAVE;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static MYSQL* spawn_init(MYSQL* parent, const char* host,
|
||||
unsigned int port,
|
||||
const char* user,
|
||||
const char* passwd)
|
||||
{
|
||||
MYSQL* child;
|
||||
if (!(child = mysql_init(0)))
|
||||
return 0;
|
||||
|
||||
child->options.user = my_strdup((user) ? user :
|
||||
(parent->user ? parent->user :
|
||||
parent->options.user), MYF(0));
|
||||
child->options.password = my_strdup((passwd) ? passwd : (parent->passwd ?
|
||||
parent->passwd :
|
||||
parent->options.password), MYF(0));
|
||||
child->options.port = port;
|
||||
child->options.host = my_strdup((host) ? host : (parent->host ?
|
||||
parent->host :
|
||||
parent->options.host), MYF(0));
|
||||
if(parent->db)
|
||||
child->options.db = my_strdup(parent->db, MYF(0));
|
||||
else if(parent->options.db)
|
||||
child->options.db = my_strdup(parent->options.db, MYF(0));
|
||||
|
||||
child->options.rpl_parse = child->options.rpl_probe = child->rpl_pivot = 0;
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
** Init MySQL structure or allocate one
|
||||
****************************************************************************/
|
||||
|
@ -1269,7 +974,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
|
|||
mysql->db=my_strdup(db,MYF(MY_WME));
|
||||
db=0;
|
||||
}
|
||||
if (my_net_write(net,buff,(uint) (end-buff)) || net_flush(net))
|
||||
if (my_net_write(net,buff,(ulong) (end-buff)) || net_flush(net))
|
||||
goto error;
|
||||
|
||||
lib_connection_phase(net,2);
|
||||
|
@ -1326,7 +1031,7 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
|
|||
pos=scramble(pos, mysql->scramble_buff, passwd,
|
||||
(my_bool) (mysql->protocol_version == 9));
|
||||
pos=strmov(pos+1,db ? db : "");
|
||||
if (simple_command(mysql,COM_CHANGE_USER, buff,(uint) (pos-buff),0))
|
||||
if (simple_command(mysql,COM_CHANGE_USER, buff,(ulong) (pos-buff),0))
|
||||
DBUG_RETURN(1);
|
||||
|
||||
my_free(mysql->user,MYF(MY_ALLOW_ZERO_PTR));
|
||||
|
@ -1351,7 +1056,7 @@ mysql_select_db(MYSQL *mysql, const char *db)
|
|||
DBUG_ENTER("mysql_select_db");
|
||||
DBUG_PRINT("enter",("db: '%s'",db));
|
||||
|
||||
if ((error=simple_command(mysql,COM_INIT_DB,db,(uint) strlen(db),0)))
|
||||
if ((error=simple_command(mysql,COM_INIT_DB,db,(ulong) strlen(db),0)))
|
||||
DBUG_RETURN(error);
|
||||
my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR));
|
||||
mysql->db=my_strdup(db,MYF(MY_WME));
|
||||
|
@ -1414,11 +1119,11 @@ mysql_close(MYSQL *mysql)
|
|||
int STDCALL
|
||||
mysql_query(MYSQL *mysql, const char *query)
|
||||
{
|
||||
return mysql_real_query(mysql,query, (uint) strlen(query));
|
||||
return mysql_real_query(mysql,query, (ulong) strlen(query));
|
||||
}
|
||||
|
||||
int STDCALL
|
||||
mysql_send_query(MYSQL* mysql, const char* query, uint length)
|
||||
mysql_send_query(MYSQL* mysql, const char* query, ulong length)
|
||||
{
|
||||
return simple_command(mysql, COM_QUERY, query, length, 1);
|
||||
}
|
||||
|
@ -1474,7 +1179,7 @@ get_info:
|
|||
}
|
||||
|
||||
int STDCALL
|
||||
mysql_real_query(MYSQL *mysql, const char *query, uint length)
|
||||
mysql_real_query(MYSQL *mysql, const char *query, ulong length)
|
||||
{
|
||||
DBUG_ENTER("mysql_real_query");
|
||||
DBUG_PRINT("enter",("handle: %lx",mysql));
|
||||
|
@ -1872,7 +1577,7 @@ mysql_create_db(MYSQL *mysql, const char *db)
|
|||
{
|
||||
DBUG_ENTER("mysql_createdb");
|
||||
DBUG_PRINT("enter",("db: %s",db));
|
||||
DBUG_RETURN(simple_command(mysql,COM_CREATE_DB,db, (uint) strlen(db),0));
|
||||
DBUG_RETURN(simple_command(mysql,COM_CREATE_DB,db, (ulong) strlen(db),0));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1881,7 +1586,7 @@ mysql_drop_db(MYSQL *mysql, const char *db)
|
|||
{
|
||||
DBUG_ENTER("mysql_drop_db");
|
||||
DBUG_PRINT("enter",("db: %s",db));
|
||||
DBUG_RETURN(simple_command(mysql,COM_DROP_DB,db,(uint) strlen(db),0));
|
||||
DBUG_RETURN(simple_command(mysql,COM_DROP_DB,db,(ulong) strlen(db),0));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -171,6 +171,8 @@ while test $# -gt 0; do
|
|||
;;
|
||||
--big*) # Actually --big-test
|
||||
EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" ;;
|
||||
--compress)
|
||||
EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" ;;
|
||||
--sleep=*)
|
||||
EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1"
|
||||
SLEEP_TIME=`$ECHO "$1" | $SED -e "s;--sleep=;;"`
|
||||
|
|
|
@ -3,6 +3,7 @@ connect (slave,localhost,root,,test,0,mysql-slave.sock);
|
|||
connection master;
|
||||
reset master;
|
||||
grant file on *.* to replicate@localhost identified by 'aaaaaaaaaaaaaaab';
|
||||
grant file on *.* to replicate@127.0.0.1 identified by 'aaaaaaaaaaaaaaab';
|
||||
connection slave;
|
||||
slave start;
|
||||
connection master;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -35,7 +35,7 @@ void caseup_str(my_string str)
|
|||
if (use_mb(default_charset_info))
|
||||
{
|
||||
register uint32 l;
|
||||
register char *end=str+(uint) strlen(str);
|
||||
register char *end=str+strlen(str);
|
||||
while (*str)
|
||||
{
|
||||
if ((l=my_ismbchar(default_charset_info, str,end))) str+=l;
|
||||
|
@ -56,7 +56,7 @@ void casedn_str(my_string str)
|
|||
if (use_mb(default_charset_info))
|
||||
{
|
||||
register uint32 l;
|
||||
register char *end=str+(uint) strlen(str);
|
||||
register char *end=str+strlen(str);
|
||||
while (*str)
|
||||
{
|
||||
if ((l=my_ismbchar(default_charset_info, str,end))) str+=l;
|
||||
|
@ -155,7 +155,7 @@ int my_strcasecmp(const char *s, const char *t)
|
|||
if (use_mb(default_charset_info))
|
||||
{
|
||||
register uint32 l;
|
||||
register const char *end=s+(uint) strlen(s);
|
||||
register const char *end=s+strlen(s);
|
||||
while (s<end)
|
||||
{
|
||||
if ((l=my_ismbchar(default_charset_info, s,end)))
|
||||
|
|
|
@ -96,6 +96,7 @@ uint my_b_fill(IO_CACHE *info)
|
|||
** Read a string ended by '\n' into a buffer of 'max_length' size.
|
||||
** Returns number of characters read, 0 on error.
|
||||
** last byte is set to '\0'
|
||||
** If buffer is full then to[max_length-1] will be set to \0.
|
||||
*/
|
||||
|
||||
uint my_b_gets(IO_CACHE *info, char *to, uint max_length)
|
||||
|
|
|
@ -90,9 +90,10 @@ File create_temp_file(char *to, const char *dir, const char *prefix,
|
|||
uint pfx_len;
|
||||
File org_file;
|
||||
|
||||
pfx_len=(strmov(strnmov(prefix_buff,
|
||||
prefix ? prefix : "tmp.",
|
||||
sizeof(prefix_buff)-7),"XXXXXX") - prefix_buff);
|
||||
pfx_len= (uint) (strmov(strnmov(prefix_buff,
|
||||
prefix ? prefix : "tmp.",
|
||||
sizeof(prefix_buff)-7),"XXXXXX") -
|
||||
prefix_buff);
|
||||
if (!dir && ! (dir =getenv("TMPDIR")))
|
||||
dir=P_tmpdir;
|
||||
if (strlen(dir)+ pfx_len > FN_REFLEN-2)
|
||||
|
|
|
@ -88,7 +88,7 @@ do
|
|||
fi
|
||||
done
|
||||
|
||||
for i in libmysql/.libs/libmysqlclient.a libmysql/.libs/libmysqlclient.so* libmysql/libmysqlclient.* libmysql_r/.libs/libmysqlclient_r.a libmysql_r/.libs/libmysqlclient_r.so* libmysql_r/libmysqlclient_r.* mysys/libmysys.a strings/libmystrings.a dbug/libdbug.a $BASE/lib
|
||||
for i in libmysql/.libs/libmysqlclient.a libmysql/.libs/libmysqlclient.so* libmysql/libmysqlclient.* libmysql_r/.libs/libmysqlclient_r.a libmysql_r/.libs/libmysqlclient_r.so* libmysql_r/libmysqlclient_r.* mysys/libmysys.a strings/libmystrings.a dbug/libdbug.a libmysqld/.libs/libmysqld.a libmysqld/.libs/libmysqld.so* libmysqld/libmysqld.a libmysqld/libmysqld.a
|
||||
do
|
||||
if [ -f $i ]
|
||||
then
|
||||
|
|
|
@ -73,7 +73,7 @@ sub get_server
|
|||
{ $server= new db_interbase($host,$database); }
|
||||
else
|
||||
{
|
||||
die "Unknown sql server name used: $name\nUse one of: Access, Adabas, AdabasD, Empress, FrontBase, Oracle, Informix, DB2, mSQL, Mimer, MS-SQL, MySQL, Pg, Solid or Sybase.\nIf the connection is done trough ODBC the name must end with _ODBC\n";
|
||||
die "Unknown sql server name used: $name\nUse one of: Access, Adabas, AdabasD, Empress, FrontBase, Oracle, Informix, InterBase, DB2, mSQL, Mimer, MS-SQL, MySQL, Pg, Solid or Sybase.\nIf the connection is done trough ODBC the name must end with _ODBC\n";
|
||||
}
|
||||
if ($name =~ /_ODBC$/i || defined($odbc) && $odbc)
|
||||
{
|
||||
|
@ -2962,7 +2962,7 @@ sub new
|
|||
bless $self;
|
||||
|
||||
$self->{'cmp_name'} = "interbase";
|
||||
$self->{'data_source'} = "DBI:InterBase:database=$database";
|
||||
$self->{'data_source'} = "DBI:InterBase:database=$database:ib_dialect=3";
|
||||
$self->{'limits'} = \%limits;
|
||||
$self->{'smds'} = \%smds;
|
||||
$self->{'blob'} = "blob";
|
||||
|
|
|
@ -81,6 +81,7 @@ public:
|
|||
virtual void split_sum_func(List<Item> &fields) {}
|
||||
virtual bool get_date(TIME *ltime,bool fuzzydate);
|
||||
virtual bool get_time(TIME *ltime);
|
||||
virtual bool is_null() { return 0; }
|
||||
};
|
||||
|
||||
|
||||
|
@ -130,6 +131,7 @@ public:
|
|||
Field *tmp_table_field() { return result_field; }
|
||||
bool get_date(TIME *ltime,bool fuzzydate);
|
||||
bool get_time(TIME *ltime);
|
||||
bool is_null() { return field->is_null(); }
|
||||
};
|
||||
|
||||
|
||||
|
@ -150,6 +152,7 @@ public:
|
|||
bool send(String *str);
|
||||
bool basic_const_item() const { return 1; }
|
||||
Item *new_item() { return new Item_null(name); }
|
||||
bool is_null() { return 1; }
|
||||
};
|
||||
|
||||
|
||||
|
@ -383,6 +386,7 @@ public:
|
|||
void copy();
|
||||
table_map used_tables() const { return (table_map) 1L; }
|
||||
bool const_item() const { return 0; }
|
||||
bool is_null() { return null_value; }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1197,20 +1197,12 @@ longlong Item_cond_or::val_int()
|
|||
|
||||
longlong Item_func_isnull::val_int()
|
||||
{
|
||||
if (internal_result_type == REAL_RESULT)
|
||||
(void) args[0]->val();
|
||||
else
|
||||
(void) args[0]->val_int();
|
||||
return (args[0]->null_value) ? 1 : 0;
|
||||
return args[0]->is_null() ? 1: 0;
|
||||
}
|
||||
|
||||
longlong Item_func_isnotnull::val_int()
|
||||
{
|
||||
if (internal_result_type == REAL_RESULT)
|
||||
(void) args[0]->val();
|
||||
else
|
||||
(void) args[0]->val_int();
|
||||
return !(args[0]->null_value) ? 1 : 0;
|
||||
return args[0]->is_null() ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ public:
|
|||
virtual enum Functype rev_functype() const { return UNKNOWN_FUNC; }
|
||||
bool have_rev_func() const { return rev_functype() != UNKNOWN_FUNC; }
|
||||
void print(String *str) { Item_func::print_op(str); }
|
||||
bool is_null() { return test(args[0]->is_null() || args[1]->is_null()); }
|
||||
};
|
||||
|
||||
|
||||
|
@ -429,7 +430,6 @@ class Item_func_in :public Item_int_func
|
|||
|
||||
class Item_func_isnull :public Item_bool_func
|
||||
{
|
||||
enum Item_result internal_result_type;
|
||||
public:
|
||||
Item_func_isnull(Item *a) :Item_bool_func(a) {}
|
||||
longlong val_int();
|
||||
|
@ -438,7 +438,6 @@ public:
|
|||
{
|
||||
decimals=0; max_length=1; maybe_null=0;
|
||||
Item_func_isnull::update_used_tables();
|
||||
internal_result_type=args[0]->result_type();
|
||||
}
|
||||
const char *func_name() const { return "isnull"; }
|
||||
/* Optimize case of not_null_column IS NULL */
|
||||
|
@ -457,7 +456,6 @@ public:
|
|||
|
||||
class Item_func_isnotnull :public Item_bool_func
|
||||
{
|
||||
enum Item_result internal_result_type;
|
||||
public:
|
||||
Item_func_isnotnull(Item *a) :Item_bool_func(a) {}
|
||||
longlong val_int();
|
||||
|
@ -465,7 +463,6 @@ public:
|
|||
void fix_length_and_dec()
|
||||
{
|
||||
decimals=0; max_length=1; maybe_null=0;
|
||||
internal_result_type=args[0]->result_type();
|
||||
}
|
||||
const char *func_name() const { return "isnotnull"; }
|
||||
optimize_type select_optimize() const { return OPTIMIZE_NULL; }
|
||||
|
|
|
@ -209,7 +209,6 @@ void Item_func::fix_num_length_and_dec()
|
|||
max_length=float_length(decimals);
|
||||
}
|
||||
|
||||
|
||||
String *Item_int_func::val_str(String *str)
|
||||
{
|
||||
longlong nr=val_int();
|
||||
|
|
|
@ -119,6 +119,7 @@ public:
|
|||
{
|
||||
return (null_value=args[0]->get_time(ltime));
|
||||
}
|
||||
bool is_null() { (void) val_int(); return null_value; }
|
||||
friend class udf_handler;
|
||||
};
|
||||
|
||||
|
@ -147,6 +148,7 @@ public:
|
|||
longlong val_int() { return (longlong) val(); }
|
||||
enum Item_result result_type () const { return hybrid_type; }
|
||||
void fix_length_and_dec() { fix_num_length_and_dec(); }
|
||||
bool is_null() { (void) val(); return null_value; }
|
||||
};
|
||||
|
||||
|
||||
|
@ -161,6 +163,7 @@ class Item_num_op :public Item_func
|
|||
enum Item_result result_type () const { return hybrid_type; }
|
||||
void fix_length_and_dec() { fix_num_length_and_dec(); find_num_type(); }
|
||||
void find_num_type(void);
|
||||
bool is_null() { (void) val(); return null_value; }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -745,7 +745,7 @@ Item_sum_hybrid::min_max_update_int_field(int offset)
|
|||
(ulonglong) old_nr > (ulonglong) nr :
|
||||
old_nr > nr);
|
||||
/* (cmp_sign > 0 && res) || (!(cmp_sign > 0) && !res) */
|
||||
if (cmp_sign > 0 ^ !res)
|
||||
if ((cmp_sign > 0) ^ (!res))
|
||||
old_nr=nr;
|
||||
}
|
||||
result_field->set_notnull();
|
||||
|
|
|
@ -1493,10 +1493,10 @@ int Query_log_event::exec_event(struct st_master_info* mi)
|
|||
(actual_error = thd->net.last_errno) && expected_error)
|
||||
{
|
||||
const char* errmsg = "Slave: did not get the expected error\
|
||||
running query from master - expected: '%s'(%d), got '%s'(%d)";
|
||||
running query from master - expected: '%s' (%d), got '%s' (%d)";
|
||||
sql_print_error(errmsg, ER_SAFE(expected_error),
|
||||
expected_error,
|
||||
actual_error ? thd->net.last_error:"no error",
|
||||
actual_error ? thd->net.last_error: "no error",
|
||||
actual_error);
|
||||
thd->query_error = 1;
|
||||
}
|
||||
|
|
|
@ -508,7 +508,7 @@ void sql_print_error(const char *format,...)
|
|||
extern uint32 server_id;
|
||||
extern char *mysql_data_home,server_version[SERVER_VERSION_LENGTH],
|
||||
max_sort_char, mysql_real_data_home[];
|
||||
extern my_string mysql_unix_port,mysql_tmpdir;
|
||||
extern my_string mysql_tmpdir;
|
||||
extern const char *first_keyword, *localhost, *delayed_user;
|
||||
extern ulong refresh_version,flush_version, thread_id,query_id,opened_tables,
|
||||
created_tmp_tables, created_tmp_disk_tables,
|
||||
|
@ -522,7 +522,7 @@ extern ulong filesort_merge_passes;
|
|||
extern ulong select_range_check_count, select_range_count, select_scan_count;
|
||||
extern ulong select_full_range_join_count,select_full_join_count,
|
||||
slave_open_temp_tables;
|
||||
extern uint test_flags,select_errors,mysql_port,ha_open_options;
|
||||
extern uint test_flags,select_errors,ha_open_options;
|
||||
extern ulong thd_startup_options, slow_launch_threads, slow_launch_time;
|
||||
extern time_t start_time;
|
||||
extern const char *command_name[];
|
||||
|
|
|
@ -1202,13 +1202,13 @@ static sig_handler handle_segfault(int sig)
|
|||
fprintf(stderr,"\
|
||||
mysqld got signal %d;\n\
|
||||
This could be because you hit a bug. It is also possible that this binary\n\
|
||||
or one of the libraries it was linked agaist is corrupt, improperly built,\n\
|
||||
or one of the libraries it was linked against is corrupt, improperly built,\n\
|
||||
or misconfigured. This error can also be caused by malfunctioning hardware.\n",
|
||||
sig);
|
||||
fprintf(stderr, "\
|
||||
We will try our best to scrape up some info that will hopefully help diagnose\n\
|
||||
the problem, but since we have already crashed, something is definitely wrong\n\
|
||||
and this may fail\n\n");
|
||||
and this may fail.\n\n");
|
||||
fprintf(stderr, "key_buffer_size=%ld\n", keybuff_size);
|
||||
fprintf(stderr, "record_buffer=%ld\n", my_default_record_cache_size);
|
||||
fprintf(stderr, "sort_buffer=%ld\n", sortbuff_size);
|
||||
|
@ -1219,15 +1219,15 @@ and this may fail\n\n");
|
|||
key_buffer_size + (record_buffer + sort_buffer)*max_connections = %ld K\n\
|
||||
bytes of memory\n", (keybuff_size + (my_default_record_cache_size +
|
||||
sortbuff_size) * max_connections)/ 1024);
|
||||
fprintf(stderr, "Hope that's ok, if not, decrease some variables in the equation\n\n");
|
||||
fprintf(stderr, "Hope that's ok; if not, decrease some variables in the equation.\n\n");
|
||||
|
||||
#if defined(HAVE_LINUXTHREADS)
|
||||
if (sizeof(char*) == 4 && thread_count > UNSAFE_DEFAULT_LINUX_THREADS)
|
||||
{
|
||||
fprintf(stderr, "\
|
||||
You seem to be running 32-bit Linux and have %d concurrent connections.\n\
|
||||
If you have not changed STACK_SIZE in LinuxThreads and build the binary \n\
|
||||
yourself, LinuxThreads is quite likely to steal a part of global heap for\n\
|
||||
If you have not changed STACK_SIZE in LinuxThreads and built the binary \n\
|
||||
yourself, LinuxThreads is quite likely to steal a part of the global heap for\n\
|
||||
the thread stack. Please read http://www.mysql.com/doc/L/i/Linux.html\n\n",
|
||||
thread_count);
|
||||
}
|
||||
|
@ -1251,12 +1251,12 @@ Some pointers may be invalid and cause the dump to abort...\n");
|
|||
fprintf(stderr, "\n
|
||||
Successfully dumped variables, if you ran with --log, take a look at the\n\
|
||||
details of what thread %ld did to cause the crash. In some cases of really\n\
|
||||
bad corruption, the values shown above may be invalid\n\n",
|
||||
bad corruption, the values shown above may be invalid.\n\n",
|
||||
thd->thread_id);
|
||||
}
|
||||
fprintf(stderr, "\
|
||||
The manual page at http://www.mysql.com/doc/C/r/Crashing.html contains\n\
|
||||
information that should help you find out what is causing the crash\n");
|
||||
information that should help you find out what is causing the crash.\n");
|
||||
fflush(stderr);
|
||||
#endif /* HAVE_STACKTRACE */
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef MYSQL_SERVER
|
||||
ulong max_allowed_packet=65536;
|
||||
|
@ -91,7 +90,7 @@ extern ulong mysqld_net_retry_count;
|
|||
typedef my_bool thr_alarm_t;
|
||||
typedef my_bool ALARM;
|
||||
#define thr_alarm_init(A) (*(A))=0
|
||||
#define thr_alarm_in_use(A) (*(A))
|
||||
#define thr_alarm_in_use(A) (*(A) != 0)
|
||||
#define thr_end_alarm(A)
|
||||
#define thr_alarm(A,B,C) local_thr_alarm((A),(B),(C))
|
||||
inline int local_thr_alarm(my_bool *A,int B __attribute__((unused)),ALARM *C __attribute__((unused)))
|
||||
|
@ -131,7 +130,7 @@ int my_net_init(NET *net, Vio* vio)
|
|||
net->no_send_ok = 0;
|
||||
net->error=0; net->return_errno=0; net->return_status=0;
|
||||
net->timeout=(uint) net_read_timeout; /* Timeout for read */
|
||||
net->pkt_nr=0;
|
||||
net->pkt_nr=net->compress_pkt_nr=0;
|
||||
net->write_pos=net->read_pos = net->buff;
|
||||
net->last_error[0]=0;
|
||||
net->compress=0; net->reading_or_writing=0;
|
||||
|
@ -192,7 +191,7 @@ static my_bool net_realloc(NET *net, ulong length)
|
|||
void net_clear(NET *net)
|
||||
{
|
||||
#ifndef EXTRA_DEBUG
|
||||
int count; // One may get 'unused' warning
|
||||
int count; /* One may get 'unused' warn */
|
||||
bool is_blocking=vio_is_blocking(net->vio);
|
||||
if (is_blocking)
|
||||
vio_blocking(net->vio, FALSE);
|
||||
|
@ -206,7 +205,7 @@ void net_clear(NET *net)
|
|||
vio_blocking(net->vio, TRUE);
|
||||
}
|
||||
#endif /* EXTRA_DEBUG */
|
||||
net->pkt_nr=0; /* Ready for new command */
|
||||
net->pkt_nr=net->compress_pkt_nr=0; /* Ready for new command */
|
||||
net->write_pos=net->buff;
|
||||
}
|
||||
|
||||
|
@ -219,9 +218,12 @@ int net_flush(NET *net)
|
|||
if (net->buff != net->write_pos)
|
||||
{
|
||||
error=net_real_write(net,(char*) net->buff,
|
||||
(uint) (net->write_pos - net->buff));
|
||||
(ulong) (net->write_pos - net->buff));
|
||||
net->write_pos=net->buff;
|
||||
}
|
||||
/* Sync packet number if using compression */
|
||||
if (net->compress)
|
||||
net->pkt_nr=net->compress_pkt_nr;
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
||||
|
@ -250,7 +252,7 @@ my_net_write(NET *net,const char *packet,ulong len)
|
|||
{
|
||||
const ulong z_size = MAX_THREE_BYTES;
|
||||
int3store(buff, z_size);
|
||||
buff[3]= (net->compress) ? 0 : (uchar) (net->pkt_nr++);
|
||||
buff[3]= net->pkt_nr++;
|
||||
if (net_write_buff(net, (char*) buff, NET_HEADER_SIZE) ||
|
||||
net_write_buff(net, packet, z_size))
|
||||
return 1;
|
||||
|
@ -259,7 +261,7 @@ my_net_write(NET *net,const char *packet,ulong len)
|
|||
}
|
||||
/* Write last packet */
|
||||
int3store(buff,len);
|
||||
buff[3]= (net->compress) ? 0 : (uchar) (net->pkt_nr++);
|
||||
buff[3]= net->pkt_nr++;
|
||||
if (net_write_buff(net,(char*) buff,NET_HEADER_SIZE))
|
||||
return 1;
|
||||
return net_write_buff(net,packet,len);
|
||||
|
@ -277,7 +279,7 @@ my_net_write(NET *net,const char *packet,ulong len)
|
|||
int
|
||||
net_write_command(NET *net,uchar command,const char *packet,ulong len)
|
||||
{
|
||||
uint length=len+1; /* 1 extra byte for command */
|
||||
ulong length=len+1; /* 1 extra byte for command */
|
||||
uchar buff[NET_HEADER_SIZE+1];
|
||||
uint header_size=NET_HEADER_SIZE+1;
|
||||
buff[4]=command; /* For first packet */
|
||||
|
@ -289,7 +291,7 @@ net_write_command(NET *net,uchar command,const char *packet,ulong len)
|
|||
do
|
||||
{
|
||||
int3store(buff, MAX_THREE_BYTES);
|
||||
buff[3]= (net->compress) ? 0 : (uchar) (net->pkt_nr++);
|
||||
buff[3]= net->pkt_nr++;
|
||||
if (net_write_buff(net,(char*) buff, header_size) ||
|
||||
net_write_buff(net,packet,len))
|
||||
return 1;
|
||||
|
@ -301,7 +303,7 @@ net_write_command(NET *net,uchar command,const char *packet,ulong len)
|
|||
len=length; /* Data left to be written */
|
||||
}
|
||||
int3store(buff,length);
|
||||
buff[3]= (net->compress) ? 0 : (uchar) (net->pkt_nr++);
|
||||
buff[3]= net->pkt_nr++;
|
||||
return test(net_write_buff(net,(char*) buff,header_size) ||
|
||||
net_write_buff(net,packet,len) || net_flush(net));
|
||||
}
|
||||
|
@ -314,7 +316,7 @@ net_write_command(NET *net,uchar command,const char *packet,ulong len)
|
|||
static int
|
||||
net_write_buff(NET *net,const char *packet,ulong len)
|
||||
{
|
||||
uint left_length=(uint) (net->buff_end - net->write_pos);
|
||||
ulong left_length=(ulong) (net->buff_end - net->write_pos);
|
||||
|
||||
while (len > left_length)
|
||||
{
|
||||
|
@ -340,10 +342,10 @@ net_write_buff(NET *net,const char *packet,ulong len)
|
|||
int
|
||||
net_real_write(NET *net,const char *packet,ulong len)
|
||||
{
|
||||
int length;
|
||||
long int length;
|
||||
char *pos,*end;
|
||||
thr_alarm_t alarmed;
|
||||
#if !defined(__WIN__)
|
||||
#if !defined(__WIN__) && !defined(__EMX__) && !defined(OS2)
|
||||
ALARM alarm_buff;
|
||||
#endif
|
||||
uint retry_count=0;
|
||||
|
@ -380,7 +382,7 @@ net_real_write(NET *net,const char *packet,ulong len)
|
|||
}
|
||||
int3store(&b[NET_HEADER_SIZE],complen);
|
||||
int3store(b,len);
|
||||
b[3]=(uchar) (net->pkt_nr++);
|
||||
b[3]=(uchar) (net->compress_pkt_nr++);
|
||||
len+= header_length;
|
||||
packet= (char*) b;
|
||||
}
|
||||
|
@ -398,7 +400,7 @@ net_real_write(NET *net,const char *packet,ulong len)
|
|||
pos=(char*) packet; end=pos+len;
|
||||
while (pos != end)
|
||||
{
|
||||
if ((int) (length=vio_write(net->vio,pos,(int) (end-pos))) <= 0)
|
||||
if ((long) (length=vio_write(net->vio,pos,(ulong) (end-pos))) <= 0)
|
||||
{
|
||||
my_bool interrupted = vio_should_retry(net->vio);
|
||||
#if (!defined(__WIN__) && !defined(__EMX__) && !defined(OS2))
|
||||
|
@ -499,7 +501,7 @@ static void my_net_skip_rest(NET *net, ulong remain, thr_alarm_t *alarmed)
|
|||
{
|
||||
my_bool interrupted = vio_should_retry(net->vio);
|
||||
if (!thr_got_alarm(&alarmed) && interrupted)
|
||||
{ /* Probably in MIT threads */
|
||||
{ /* Probably in MIT threads */
|
||||
if (retry_count++ < RETRY_COUNT)
|
||||
continue;
|
||||
}
|
||||
|
@ -518,7 +520,7 @@ static void my_net_skip_rest(NET *net, ulong remain, thr_alarm_t *alarmed)
|
|||
This function reallocates the net->buff buffer if necessary.
|
||||
*/
|
||||
|
||||
static uint
|
||||
static ulong
|
||||
my_real_read(NET *net, ulong *complen)
|
||||
{
|
||||
uchar *pos;
|
||||
|
@ -629,9 +631,9 @@ my_real_read(NET *net, ulong *complen)
|
|||
if (net->buff[net->where_b] != (uchar) 255)
|
||||
{
|
||||
DBUG_PRINT("error",
|
||||
("Packets out of order (Found: %d, expected %d)",
|
||||
("Packets out of order (Found: %d, expected %u)",
|
||||
(int) net->buff[net->where_b + 3],
|
||||
(uint) (uchar) net->pkt_nr));
|
||||
net->pkt_nr));
|
||||
#ifdef EXTRA_DEBUG
|
||||
fprintf(stderr,"Packets out of order (Found: %d, expected %d)\n",
|
||||
(int) net->buff[net->where_b + 3],
|
||||
|
@ -644,7 +646,7 @@ my_real_read(NET *net, ulong *complen)
|
|||
#endif
|
||||
goto end;
|
||||
}
|
||||
net->pkt_nr++;
|
||||
net->compress_pkt_nr= ++net->pkt_nr;
|
||||
#ifdef HAVE_COMPRESS
|
||||
if (net->compress)
|
||||
{
|
||||
|
@ -712,7 +714,7 @@ my_net_read(NET *net)
|
|||
if (len == MAX_THREE_BYTES)
|
||||
{
|
||||
/* First packet of a multi-packet. Concatenate the packets */
|
||||
int save_pos = net->where_b;
|
||||
ulong save_pos = net->where_b;
|
||||
ulong total_length=0;
|
||||
do
|
||||
{
|
||||
|
@ -822,8 +824,8 @@ my_net_read(NET *net)
|
|||
|
||||
net->read_pos= net->buff+ first_packet_offset + NET_HEADER_SIZE;
|
||||
net->buf_length= buf_length;
|
||||
net->remain_in_buf= buf_length - start_of_packet;
|
||||
len = ((uint) (start_of_packet - first_packet_offset) - NET_HEADER_SIZE -
|
||||
net->remain_in_buf= (ulong) (buf_length - start_of_packet);
|
||||
len = ((ulong) (start_of_packet - first_packet_offset) - NET_HEADER_SIZE -
|
||||
multi_byte_packet);
|
||||
net->save_char= net->read_pos[len]; /* Must be saved */
|
||||
net->read_pos[len]=0; /* Safeguard for mysql_use_result */
|
||||
|
|
|
@ -1944,7 +1944,6 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds)
|
|||
// TODO: This could be optimized to use hashed names if t2 had a hash
|
||||
for (j=0 ; j < t2->fields ; j++)
|
||||
{
|
||||
key_map tmp_map;
|
||||
if (!my_strcasecmp(t1->field[i]->field_name,
|
||||
t2->field[j]->field_name))
|
||||
{
|
||||
|
|
|
@ -309,7 +309,6 @@ bool multi_delete::send_data(List<Item> &values)
|
|||
continue;
|
||||
|
||||
table->file->position(table->record[0]);
|
||||
int rl = table->file->ref_length;
|
||||
|
||||
if (secure_counter < 0)
|
||||
{
|
||||
|
@ -397,7 +396,6 @@ int multi_delete::do_deletes (bool from_send_error)
|
|||
table_being_deleted=table_being_deleted->next, counter++)
|
||||
{
|
||||
TABLE *table = table_being_deleted->table;
|
||||
int rl = table->file->ref_length;
|
||||
if (tempfiles[counter]->get(table))
|
||||
{
|
||||
error=1;
|
||||
|
|
|
@ -107,7 +107,6 @@ static uint find_shortest_key(TABLE *table, key_map usable_keys);
|
|||
static bool test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,
|
||||
ha_rows select_limit, bool no_changes);
|
||||
static int create_sort_index(JOIN_TAB *tab,ORDER *order,ha_rows select_limit);
|
||||
static bool fix_having(JOIN *join, Item **having);
|
||||
static int remove_duplicates(JOIN *join,TABLE *entry,List<Item> &fields,
|
||||
Item *having);
|
||||
static int remove_dup_with_compare(THD *thd, TABLE *entry, Field **field,
|
||||
|
@ -5443,39 +5442,6 @@ err:
|
|||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Add the HAVING criteria to table->select
|
||||
*/
|
||||
|
||||
static bool fix_having(JOIN *join, Item **having)
|
||||
{
|
||||
(*having)->update_used_tables(); // Some tables may have been const
|
||||
JOIN_TAB *table=&join->join_tab[join->const_tables];
|
||||
table_map used_tables= join->const_table_map | table->table->map;
|
||||
|
||||
Item* sort_table_cond=make_cond_for_table(*having,used_tables,used_tables);
|
||||
if (sort_table_cond)
|
||||
{
|
||||
if (!table->select)
|
||||
if (!(table->select=new SQL_SELECT))
|
||||
return 1;
|
||||
if (!table->select->cond)
|
||||
table->select->cond=sort_table_cond;
|
||||
else // This should never happen
|
||||
if (!(table->select->cond=new Item_cond_and(table->select->cond,
|
||||
sort_table_cond)))
|
||||
return 1;
|
||||
table->select_cond=table->select->cond;
|
||||
DBUG_EXECUTE("where",print_where(table->select_cond,
|
||||
"select and having"););
|
||||
*having=make_cond_for_table(*having,~ (table_map) 0,~used_tables);
|
||||
DBUG_EXECUTE("where",print_where(*having,"having after make_cond"););
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
** Remove duplicates from tmp table
|
||||
** This should be recoded to add a uniuqe index to the table and remove
|
||||
|
|
|
@ -35,6 +35,19 @@
|
|||
#include "sql_sort.h"
|
||||
|
||||
|
||||
int unique_write_to_file(gptr key, element_count count, Unique *unique)
|
||||
{
|
||||
return my_b_write(&unique->file, (byte*) key,
|
||||
unique->tree.size_of_element) ? 1 : 0;
|
||||
}
|
||||
|
||||
int unique_write_to_ptrs(gptr key, element_count count, Unique *unique)
|
||||
{
|
||||
memcpy(unique->record_pointers, key, unique->tree.size_of_element);
|
||||
unique->record_pointers+=unique->tree.size_of_element;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Unique::Unique(qsort_cmp2 comp_func, void * comp_func_fixed_arg,
|
||||
uint size, ulong max_in_memory_size_arg)
|
||||
:max_in_memory_size(max_in_memory_size_arg),elements(0)
|
||||
|
@ -73,20 +86,6 @@ bool Unique::flush()
|
|||
}
|
||||
|
||||
|
||||
int unique_write_to_file(gptr key, element_count count, Unique *unique)
|
||||
{
|
||||
return my_b_write(&unique->file, (byte*) key,
|
||||
unique->tree.size_of_element) ? 1 : 0;
|
||||
}
|
||||
|
||||
int unique_write_to_ptrs(gptr key, element_count count, Unique *unique)
|
||||
{
|
||||
memcpy(unique->record_pointers, key, unique->tree.size_of_element);
|
||||
unique->record_pointers+=unique->tree.size_of_element;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Modify the TABLE element so that when one calls init_records()
|
||||
the rows will be read in priority order.
|
||||
|
|
Loading…
Reference in a new issue