Merge msvensson@bk-internal.mysql.com:/home/bk/mysql-4.1

into neptunus.(none):/home/magnus/mysql-4.1
This commit is contained in:
magnus@neptunus.(none) 2004-05-13 13:28:56 +02:00
commit 581819624f
429 changed files with 3143 additions and 2383 deletions

View file

@ -774,3 +774,8 @@ ndb/lib/libndbclient.so
ndb/lib/libndbclient_extra.so
libmysqld/discover.cc
include/readline
ndb/config/autom4te.cache/*
ndb/config/config.mk
ndb/src/common/mgmcommon/printConfig/*.d
ndb/src/mgmclient/test_cpcd/*.d
*.d

View file

@ -112,6 +112,7 @@ mwagner@work.mysql.com
mydev@mysql.com
mysql@home.(none)
mysqldev@build.mysql2.com
ndbdev@ndbmaster.mysql.com
nick@mysql.com
nick@nick.leippe.com
papa@gbichot.local
@ -163,6 +164,8 @@ tonu@hundin.mysql.fi
tonu@volk.internalnet
tonu@x153.internalnet
tonu@x3.internalnet
tsmith@build.mysql.com
tulin@build.mysql.com
ulli@morbus.(none)
venu@hundin.mysql.fi
venu@myvenu.com

View file

@ -95,6 +95,7 @@ $SI_DESC= <$SUPFILEDIR/StartupItem.Description.plist>;
$SI_PARAMS= <$SUPFILEDIR/StartupParameters.plist>;
$SI_POST= <$SUPFILEDIR/StartupItem.postinstall>;
$SI_NAME= "MySQLStartupItem";
$SI_DIR_NAME= "MySQLCOM";
$SI_SCRIPT= <$SUPFILEDIR/MySQL>;
@RESOURCES= qw/ ReadMe.txt postinstall preinstall /;
@LICENSES= ("$SRCBASEDIR/COPYING","$SRCBASEDIR/MySQLEULA.txt");
@ -195,16 +196,18 @@ unless ($opt_skip_si)
&logger("Cleaning up $RESOURCE_DIR");
&run_command("rm -rf $RESOURCE_DIR/*", "Unable to clean up $RESOURCE_DIR!");
&logger("Installing MySQL StartupItem files into $PKGROOT/MySQL");
my $SI_DIR= $PKGROOT . "/" . $SI_DIR_NAME;
&logger("Installing MySQL StartupItem files into $SI_DIR");
unless($opt_dry_run)
{
mkdir("$PKGROOT/MySQL") or &abort("Error creating $PKGROOT/MySQL");
copy("$SI_SCRIPT", "$PKGROOT/MySQL/")
mkdir("$SI_DIR")
or &abort("Error creating $SI_DIR");
copy("$SI_SCRIPT", "$SI_DIR/")
or &abort("Error copying $SI_SCRIPT!");
chmod(0755, "$PKGROOT/MySQL/" . basename("$SI_SCRIPT"));
copy("$SI_PARAMS", "$PKGROOT/MySQL/")
chmod(0755, "$SI_DIR/" . basename("$SI_SCRIPT"));
copy("$SI_PARAMS", "$SI_DIR/")
or &abort("Error copying $SI_PARAMS!");
chmod(0644, "$PKGROOT/MySQL/" . basename("$SI_PARAMS"));
chmod(0644, "$SI_DIR/" . basename("$SI_PARAMS"));
&run_command("chown -R root:wheel $PKGROOT/*", "Cannot chown $PKGROOT!");
copy("$SI_POST", "$RESOURCE_DIR/postinstall")
or &abort("Error copying $SI_POST!");

View file

@ -29,6 +29,6 @@ typedef struct st_line_buffer
} LINE_BUFFER;
extern LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file);
extern LINE_BUFFER *batch_readline_command(my_string str);
extern LINE_BUFFER *batch_readline_command(LINE_BUFFER *buffer, my_string str);
extern char *batch_readline(LINE_BUFFER *buffer);
extern void batch_readline_end(LINE_BUFFER *buffer);

View file

@ -494,7 +494,7 @@ static struct my_option my_long_options[] =
"No automatic rehashing. One has to use 'rehash' to get table and field completion. This gives a quicker start of mysql and disables rehashing on reconnect. WARNING: options deprecated; use --disable-auto-rehash instead.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"batch", 'B',
"Print results with a tab as separator, each row on new line. Doesn't use history file.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
"Don't use history file. Disable interactive behavior. (Enables --silent)", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR,
"Directory where character sets are.", (gptr*) &charsets_dir,
(gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@ -515,7 +515,7 @@ static struct my_option my_long_options[] =
(gptr*) &current_db, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"delimiter", OPT_DELIMITER, "Delimiter to be used.", (gptr*) &delimiter_str,
(gptr*) &delimiter_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"execute", 'e', "Execute command and quit. (Output like with --batch).", 0,
{"execute", 'e', "Execute command and quit. (Disables --force and history file)", 0,
0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"vertical", 'E', "Print the output of a query (rows) vertically.",
(gptr*) &vertical, (gptr*) &vertical, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
@ -597,7 +597,7 @@ static struct my_option my_long_options[] =
0, 0, 0},
{"reconnect", OPT_RECONNECT, "Reconnect if the connection is lost. Disable with --disable-reconnect. This option is enabled by default.",
(gptr*) &opt_reconnect, (gptr*) &opt_reconnect, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"silent", 's', "Be more silent.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0,
{"silent", 's', "Be more silent. Print results with a tab as separator, each row on new line.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0,
0, 0},
#ifdef HAVE_SMEM
{"shared_memory_base_name", OPT_SHARED_MEMORY_BASE_NAME,
@ -755,10 +755,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case 'e':
status.batch= 1;
status.add_to_history= 0;
batch_readline_end(status.line_buff); // If multiple -e
if (!(status.line_buff= batch_readline_command(argument)))
if (!status.line_buff)
ignore_errors= 0; // do it for the first -e only
if (!(status.line_buff= batch_readline_command(status.line_buff, argument)))
return 1;
ignore_errors= 0;
break;
case 'o':
if (argument == disabled_my_option)
@ -798,12 +798,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
verbose++;
break;
case 'B':
if (!status.batch)
{
status.batch= 1;
status.add_to_history= 0;
opt_silent++; // more silent
}
status.batch= 1;
status.add_to_history= 0;
set_if_bigger(opt_silent,1); // more silent
break;
case 'W':
#ifdef __WIN__
@ -1108,11 +1105,8 @@ static bool add_line(String &buffer,char *line,char *in_string,
}
else
{
int error= com_go(&buffer, 0);
if (error)
{
return error < 0 ? 0 : 1; // < 0 is not fatal
}
if (com_go(&buffer, 0) > 0) // < 0 is not fatal
return 1;
}
buffer.length(0);
out= line;

View file

@ -241,10 +241,10 @@ static struct my_option my_long_options[] =
{"no-data", 'd', "No row information.", (gptr*) &dFlag, (gptr*) &dFlag, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"no-set-names", 'N',
"'SET NAMES charset_name' will not be put in the output. Deprecated, use --set-charset or --skip-set-charset to enable/disable charset settings instead",
"Deprecated, use --set-charset or --skip-set-charset to enable/disable charset settings instead",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"set-charset", OPT_SET_CHARSET,
"'SET NAMES charset_name' will be put in the output",
"'SET CHARACTER_SET_CLIENT=default_character_set' will be put in the output",
(gptr*) &opt_set_charset, (gptr*) &opt_set_charset, 0, GET_BOOL, NO_ARG, 1,
0, 0, 0, 0, 0},
{"set-variable", 'O',

View file

@ -31,7 +31,8 @@ static char *intern_read_line(LINE_BUFFER *buffer,ulong *out_length);
LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file)
{
LINE_BUFFER *line_buff;
if (!(line_buff=(LINE_BUFFER*) my_malloc(sizeof(*line_buff),MYF(MY_WME))))
if (!(line_buff=(LINE_BUFFER*)
my_malloc(sizeof(*line_buff),MYF(MY_WME | MY_ZEROFILL))))
return 0;
if (init_line_buffer(line_buff,fileno(file),IO_SIZE,max_size))
{
@ -67,11 +68,12 @@ void batch_readline_end(LINE_BUFFER *line_buff)
}
LINE_BUFFER *batch_readline_command(my_string str)
LINE_BUFFER *batch_readline_command(LINE_BUFFER *line_buff, my_string str)
{
LINE_BUFFER *line_buff;
if (!(line_buff=(LINE_BUFFER*) my_malloc(sizeof(*line_buff),MYF(MY_WME))))
return 0;
if (!line_buff)
if (!(line_buff=(LINE_BUFFER*)
my_malloc(sizeof(*line_buff),MYF(MY_WME | MY_ZEROFILL))))
return 0;
if (init_line_buffer_from_string(line_buff,str))
{
my_free((char*) line_buff,MYF(0));
@ -88,7 +90,6 @@ LINE_BUFFER *batch_readline_command(my_string str)
static bool
init_line_buffer(LINE_BUFFER *buffer,File file,ulong size,ulong max_buffer)
{
bzero((char*) buffer,sizeof(buffer[0]));
buffer->file=file;
buffer->bufread=size;
buffer->max_size=max_buffer;
@ -100,19 +101,26 @@ init_line_buffer(LINE_BUFFER *buffer,File file,ulong size,ulong max_buffer)
return 0;
}
/*
init_line_buffer_from_string can be called on the same buffer
several times. the resulting buffer will contain a
concatenation of all strings separated by spaces
*/
static bool init_line_buffer_from_string(LINE_BUFFER *buffer,my_string str)
{
uint length;
bzero((char*) buffer,sizeof(buffer[0]));
length=(uint) strlen(str);
if (!(buffer->buffer=buffer->start_of_line=buffer->end_of_line=
(char*)my_malloc(length+2,MYF(MY_FAE))))
uint old_length=buffer->end - buffer->buffer;
uint length= (uint) strlen(str);
if (!(buffer->buffer= buffer->start_of_line= buffer->end_of_line=
(char*)my_realloc(buffer->buffer, old_length+length+2,
MYF(MY_FAE|MY_ALLOW_ZERO_PTR))))
return 1;
memcpy(buffer->buffer,str,length);
buffer->buffer[length]='\n';
buffer->buffer[length+1]=0;
buffer->end=buffer->buffer+length+1;
buffer->end= buffer->buffer + old_length;
if (old_length)
buffer->end[-1]=' ';
memcpy(buffer->end, str, length);
buffer->end[length]= '\n';
buffer->end[length+1]= 0;
buffer->end+= length+1;
buffer->eof=1;
buffer->max_size=1;
return 0;

View file

@ -14,7 +14,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include
INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include @ndbcluster_includes@
LDADD = @CLIENT_EXTRA_LDFLAGS@ ../mysys/libmysys.a \
../dbug/libdbug.a ../strings/libmystrings.a
bin_PROGRAMS = replace comp_err perror resolveip my_print_defaults \

View file

@ -23,15 +23,27 @@
#include <m_string.h>
#include <errno.h>
#include <my_getopt.h>
#ifdef HAVE_NDBCLUSTER_DB
#include "../ndb/src/ndbapi/ndberror.c"
#endif
static my_bool verbose, print_all_codes;
#ifdef HAVE_NDBCLUSTER_DB
static my_bool ndb_code;
static char ndb_string[1024];
#endif
static struct my_option my_long_options[] =
{
{"help", '?', "Displays this help and exits.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"info", 'I', "Synonym for --help.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_NDBCLUSTER_DB
{"ndb", 0, "Ndbcluster storage engine specific error codes.", (gptr*) &ndb_code,
(gptr*) &ndb_code, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
#endif
#ifdef HAVE_SYS_ERRLIST
{"all", 'a', "Print all the error messages and the number.",
(gptr*) &print_all_codes, (gptr*) &print_all_codes, 0, GET_BOOL, NO_ARG,
@ -199,7 +211,17 @@ int main(int argc,char *argv[])
{
found=0;
code=atoi(*argv);
msg = strerror(code);
#ifdef HAVE_NDBCLUSTER_DB
if (ndb_code)
{
if (ndb_error_string(code, ndb_string, 1024) < 0)
msg= 0;
else
msg= ndb_string;
}
else
#endif
msg = strerror(code);
if (msg)
{
found=1;

View file

@ -191,7 +191,7 @@ enum ha_base_keytype {
#define HA_UNIQUE_CHECK 256 /* Check the key for uniqueness */
#define HA_SPATIAL 1024 /* For spatial search */
#define HA_NULL_ARE_EQUAL 2048 /* NULL in key are cmp as equal */
#define HA_GENERATED_KEY 8192 /* Automaticly generated key */
/* Automatic bits in key-flag */

View file

@ -55,14 +55,8 @@ int vio_close_pipe(Vio * vio);
void vio_delete(Vio* vio);
int vio_close(Vio* vio);
#ifdef EMBEDDED_LIBRARY
void vio_reset(Vio *vio);
#else
void vio_reset(Vio* vio, enum enum_vio_type type,
my_socket sd, HANDLE hPipe, my_bool localhost);
#endif
void vio_reset(Vio* vio, enum enum_vio_type type,
my_socket sd, HANDLE hPipe, my_bool localhost);
int vio_read(Vio *vio, gptr buf, int size);
int vio_write(Vio *vio, const gptr buf, int size);
int vio_blocking(Vio *vio, my_bool onoff, my_bool *old_mode);

View file

@ -129,16 +129,6 @@ ut_str_catenate(
char* str1, /* in: null-terminated string */
char* str2); /* in: null-terminated string */
/**************************************************************************
Return a copy of the given string. The returned string must be freed
using mem_free. */
char*
ut_strdup(
/*======*/
/* out, own: cnull-terminated string */
char* str); /* in: null-terminated string */
#ifndef UNIV_NONINL
#include "ut0mem.ic"
#endif

View file

@ -2314,18 +2314,18 @@ os_file_dirname(
if (last_slash < 0) {
/* no slash in the path, return "." */
return(ut_strdup((char*)"."));
return(mem_strdup("."));
}
/* ok, there is a slash */
if (last_slash == 0) {
/* last slash is the first char of the path */
return(ut_strdup((char*)"/"));
return(mem_strdup("/"));
}
/* non-trivial directory component */
dir = ut_strdup(path);
dir = mem_strdup(path);
dir[last_slash] = 0;
return(dir);

View file

@ -299,27 +299,3 @@ ut_str_catenate(
return(str);
}
/**************************************************************************
Return a copy of the given string. The returned string must be freed
using mem_free. */
char*
ut_strdup(
/*======*/
/* out, own: cnull-terminated string */
char* str) /* in: null-terminated string */
{
ulint len;
char* copy;
len = ut_strlen(str);
copy = mem_alloc(len + 1);
ut_memcpy(copy, str, len);
copy[len] = 0;
return(copy);
}

View file

@ -42,7 +42,7 @@ my_bool handle_local_infile(MYSQL *mysql, const char *net_filename);
void mysql_read_default_options(struct st_mysql_options *options,
const char *filename,const char *group);
MYSQL *
MYSQL * STDCALL
cli_mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
const char *passwd, const char *db,
uint port, const char *unix_socket,ulong client_flag);

View file

@ -295,7 +295,7 @@ uint emb_count_querycache_size(THD *thd)
cur_row= thd->data->data;
n_rows= thd->data->rows;
}
result= 4+8 + (42 + 4*n_rows)*mysql->field_count;
result= (uint) (4+8 + (42 + 4*n_rows)*mysql->field_count);
for(; field < field_end; field++)
{
@ -414,8 +414,8 @@ int emb_load_querycache_result(THD *thd, Querycache_stream *src)
goto err;
thd->data= data;
init_alloc_root(&data->alloc, 8192,0);
row= (MYSQL_ROWS *)alloc_root(&data->alloc, rows * sizeof(MYSQL_ROWS) +
rows * (mysql->field_count+1)*sizeof(char*));
row= (MYSQL_ROWS *)alloc_root(&data->alloc, (uint) (rows * sizeof(MYSQL_ROWS) +
rows * (mysql->field_count+1)*sizeof(char*)));
end_row= row + rows;
columns= (MYSQL_ROW)end_row;

View file

@ -22,6 +22,8 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) default NULL,
UNIQUE KEY `constraint_1` (`a`)
UNIQUE KEY `constraint_1` (`a`),
UNIQUE KEY `key_1` (`a`),
UNIQUE KEY `key_2` (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;

View file

@ -155,7 +155,37 @@ t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0',
`b` int(11) default NULL,
PRIMARY KEY (`a`),
KEY `b` (`b`)
KEY `b` (`b`),
KEY `b_2` (`b`),
KEY `b_3` (`b`),
KEY `b_4` (`b`),
KEY `b_5` (`b`),
KEY `b_6` (`b`),
KEY `b_7` (`b`),
KEY `b_8` (`b`),
KEY `b_9` (`b`),
KEY `b_10` (`b`),
KEY `b_11` (`b`),
KEY `b_12` (`b`),
KEY `b_13` (`b`),
KEY `b_14` (`b`),
KEY `b_15` (`b`),
KEY `b_16` (`b`),
KEY `b_17` (`b`),
KEY `b_18` (`b`),
KEY `b_19` (`b`),
KEY `b_20` (`b`),
KEY `b_21` (`b`),
KEY `b_22` (`b`),
KEY `b_23` (`b`),
KEY `b_24` (`b`),
KEY `b_25` (`b`),
KEY `b_26` (`b`),
KEY `b_27` (`b`),
KEY `b_28` (`b`),
KEY `b_29` (`b`),
KEY `b_30` (`b`),
KEY `b_31` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 select if(1,'1','0'), month("2002-08-02");

View file

@ -0,0 +1,298 @@
drop table if exists t1;
SET NAMES latin1;
CREATE TABLE t1 (a char(1) character set latin1);
INSERT INTO t1 VALUES (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07);
INSERT INTO t1 VALUES (0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
INSERT INTO t1 VALUES (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17);
INSERT INTO t1 VALUES (0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
INSERT INTO t1 VALUES (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27);
INSERT INTO t1 VALUES (0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
INSERT INTO t1 VALUES (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37);
INSERT INTO t1 VALUES (0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
INSERT INTO t1 VALUES (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47);
INSERT INTO t1 VALUES (0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
INSERT INTO t1 VALUES (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57);
INSERT INTO t1 VALUES (0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
INSERT INTO t1 VALUES (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67);
INSERT INTO t1 VALUES (0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
INSERT INTO t1 VALUES (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77);
INSERT INTO t1 VALUES (0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
INSERT INTO t1 VALUES (0x80),(0x81),(0x82),(0x83),(0x84),(0x85),(0x86),(0x87);
INSERT INTO t1 VALUES (0x88),(0x89),(0x8A),(0x8B),(0x8C),(0x8D),(0x8E),(0x8F);
INSERT INTO t1 VALUES (0x90),(0x91),(0x92),(0x93),(0x94),(0x95),(0x96),(0x97);
INSERT INTO t1 VALUES (0x98),(0x99),(0x9A),(0x9B),(0x9C),(0x9D),(0x9E),(0x9F);
INSERT INTO t1 VALUES (0xA0),(0xA1),(0xA2),(0xA3),(0xA4),(0xA5),(0xA6),(0xA7);
INSERT INTO t1 VALUES (0xA8),(0xA9),(0xAA),(0xAB),(0xAC),(0xAD),(0xAE),(0xAF);
INSERT INTO t1 VALUES (0xB0),(0xB1),(0xB2),(0xB3),(0xB4),(0xB5),(0xB6),(0xB7);
INSERT INTO t1 VALUES (0xB8),(0xB9),(0xBA),(0xBB),(0xBC),(0xBD),(0xBE),(0xBF);
INSERT INTO t1 VALUES (0xC0),(0xC1),(0xC2),(0xC3),(0xC4),(0xC5),(0xC6),(0xC7);
INSERT INTO t1 VALUES (0xC8),(0xC9),(0xCA),(0xCB),(0xCC),(0xCD),(0xCE),(0xCF);
INSERT INTO t1 VALUES (0xD0),(0xD1),(0xD2),(0xD3),(0xD4),(0xD5),(0xD6),(0xD7);
INSERT INTO t1 VALUES (0xD8),(0xD9),(0xDA),(0xDB),(0xDC),(0xDD),(0xDE),(0xDF);
INSERT INTO t1 VALUES (0xE0),(0xE1),(0xE2),(0xE3),(0xE4),(0xE5),(0xE6),(0xE7);
INSERT INTO t1 VALUES (0xE8),(0xE9),(0xEA),(0xEB),(0xEC),(0xED),(0xEE),(0xEF);
INSERT INTO t1 VALUES (0xF0),(0xF1),(0xF2),(0xF3),(0xF4),(0xF5),(0xF6),(0xF7);
INSERT INTO t1 VALUES (0xF8),(0xF9),(0xFA),(0xFB),(0xFC),(0xFD),(0xFE),(0xFF);
SELECT
hex(a),
hex(@u:=convert(a using utf8)),
hex(@l:=convert(@u using latin1)),
a=@l FROM t1;
hex(a) hex(@u:=convert(a using utf8)) hex(@l:=convert(@u using latin1)) a=@l
00 00 00 1
01 01 01 1
02 02 02 1
03 03 03 1
04 04 04 1
05 05 05 1
06 06 06 1
07 07 07 1
08 08 08 1
09 09 09 1
0A 0A 0A 1
0B 0B 0B 1
0C 0C 0C 1
0D 0D 0D 1
0E 0E 0E 1
0F 0F 0F 1
10 10 10 1
11 11 11 1
12 12 12 1
13 13 13 1
14 14 14 1
15 15 15 1
16 16 16 1
17 17 17 1
18 18 18 1
19 19 19 1
1A 1A 1A 1
1B 1B 1B 1
1C 1C 1C 1
1D 1D 1D 1
1E 1E 1E 1
1F 1F 1F 1
1
21 21 21 1
22 22 22 1
23 23 23 1
24 24 24 1
25 25 25 1
26 26 26 1
27 27 27 1
28 28 28 1
29 29 29 1
2A 2A 2A 1
2B 2B 2B 1
2C 2C 2C 1
2D 2D 2D 1
2E 2E 2E 1
2F 2F 2F 1
30 30 30 1
31 31 31 1
32 32 32 1
33 33 33 1
34 34 34 1
35 35 35 1
36 36 36 1
37 37 37 1
38 38 38 1
39 39 39 1
3A 3A 3A 1
3B 3B 3B 1
3C 3C 3C 1
3D 3D 3D 1
3E 3E 3E 1
3F 3F 3F 1
40 40 40 1
41 41 41 1
42 42 42 1
43 43 43 1
44 44 44 1
45 45 45 1
46 46 46 1
47 47 47 1
48 48 48 1
49 49 49 1
4A 4A 4A 1
4B 4B 4B 1
4C 4C 4C 1
4D 4D 4D 1
4E 4E 4E 1
4F 4F 4F 1
50 50 50 1
51 51 51 1
52 52 52 1
53 53 53 1
54 54 54 1
55 55 55 1
56 56 56 1
57 57 57 1
58 58 58 1
59 59 59 1
5A 5A 5A 1
5B 5B 5B 1
5C 5C 5C 1
5D 5D 5D 1
5E 5E 5E 1
5F 5F 5F 1
60 60 60 1
61 61 61 1
62 62 62 1
63 63 63 1
64 64 64 1
65 65 65 1
66 66 66 1
67 67 67 1
68 68 68 1
69 69 69 1
6A 6A 6A 1
6B 6B 6B 1
6C 6C 6C 1
6D 6D 6D 1
6E 6E 6E 1
6F 6F 6F 1
70 70 70 1
71 71 71 1
72 72 72 1
73 73 73 1
74 74 74 1
75 75 75 1
76 76 76 1
77 77 77 1
78 78 78 1
79 79 79 1
7A 7A 7A 1
7B 7B 7B 1
7C 7C 7C 1
7D 7D 7D 1
7E 7E 7E 1
7F 7F 7F 1
80 E282AC 80 1
81 3F 3F 0
82 E2809A 82 1
83 C692 83 1
84 E2809E 84 1
85 E280A6 85 1
86 E280A0 86 1
87 E280A1 87 1
88 CB86 88 1
89 E280B0 89 1
8A C5A0 8A 1
8B E280B9 8B 1
8C C592 8C 1
8D 3F 3F 0
8E C5BD 8E 1
8F 3F 3F 0
90 3F 3F 0
91 E28098 91 1
92 E28099 92 1
93 E2809C 93 1
94 E2809D 94 1
95 E280A2 95 1
96 E28093 96 1
97 E28094 97 1
98 CB9C 98 1
99 E284A2 99 1
9A C5A1 9A 1
9B E280BA 9B 1
9C C593 9C 1
9D 3F 3F 0
9E C5BE 9E 1
9F C5B8 9F 1
A0 C2A0 A0 1
A1 C2A1 A1 1
A2 C2A2 A2 1
A3 C2A3 A3 1
A4 C2A4 A4 1
A5 C2A5 A5 1
A6 C2A6 A6 1
A7 C2A7 A7 1
A8 C2A8 A8 1
A9 C2A9 A9 1
AA C2AA AA 1
AB C2AB AB 1
AC C2AC AC 1
AD C2AD AD 1
AE C2AE AE 1
AF C2AF AF 1
B0 C2B0 B0 1
B1 C2B1 B1 1
B2 C2B2 B2 1
B3 C2B3 B3 1
B4 C2B4 B4 1
B5 C2B5 B5 1
B6 C2B6 B6 1
B7 C2B7 B7 1
B8 C2B8 B8 1
B9 C2B9 B9 1
BA C2BA BA 1
BB C2BB BB 1
BC C2BC BC 1
BD C2BD BD 1
BE C2BE BE 1
BF C2BF BF 1
C0 C380 C0 1
C1 C381 C1 1
C2 C382 C2 1
C3 C383 C3 1
C4 C384 C4 1
C5 C385 C5 1
C6 C386 C6 1
C7 C387 C7 1
C8 C388 C8 1
C9 C389 C9 1
CA C38A CA 1
CB C38B CB 1
CC C38C CC 1
CD C38D CD 1
CE C38E CE 1
CF C38F CF 1
D0 C390 D0 1
D1 C391 D1 1
D2 C392 D2 1
D3 C393 D3 1
D4 C394 D4 1
D5 C395 D5 1
D6 C396 D6 1
D7 C397 D7 1
D8 C398 D8 1
D9 C399 D9 1
DA C39A DA 1
DB C39B DB 1
DC C39C DC 1
DD C39D DD 1
DE C39E DE 1
DF C39F DF 1
E0 C3A0 E0 1
E1 C3A1 E1 1
E2 C3A2 E2 1
E3 C3A3 E3 1
E4 C3A4 E4 1
E5 C3A5 E5 1
E6 C3A6 E6 1
E7 C3A7 E7 1
E8 C3A8 E8 1
E9 C3A9 E9 1
EA C3AA EA 1
EB C3AB EB 1
EC C3AC EC 1
ED C3AD ED 1
EE C3AE EE 1
EF C3AF EF 1
F0 C3B0 F0 1
F1 C3B1 F1 1
F2 C3B2 F2 1
F3 C3B3 F3 1
F4 C3B4 F4 1
F5 C3B5 F5 1
F6 C3B6 F6 1
F7 C3B7 F7 1
F8 C3B8 F8 1
F9 C3B9 F9 1
FA C3BA FA 1
FB C3BB FB 1
FC C3BC FC 1
FD C3BD FD 1
FE C3BE FE 1
FF C3BF FF 1
DROP TABLE t1;

View file

@ -82,6 +82,13 @@ Field Type Null Key Default Extra
SET CHARACTER SET koi8r;
DROP TABLE ÔÁÂÌÉÃÁ;
SET CHARACTER SET default;
SET NAMES UTF8;
CREATE TABLE t1 (t text) DEFAULT CHARSET UTF8;
INSERT INTO t1 (t) VALUES ('x');
SELECT 1 FROM t1 WHERE CONCAT(_latin1'x') = t;
1
1
DROP TABLE t1;
SET CHARACTER SET koi8r;
CREATE DATABASE ÔÅÓÔ;
USE ÔÅÓÔ;

View file

@ -371,6 +371,7 @@ t1 0 PRIMARY 2 b A # NULL NULL BTREE
t1 0 c 1 c A # NULL NULL BTREE
t1 0 b 1 b A # NULL NULL BTREE
t1 1 a 1 a A # NULL NULL BTREE
t1 1 a_2 1 a A # NULL NULL BTREE
drop table t1;
create table t1 (col1 int not null, col2 char(4) not null, primary key(col1));
alter table t1 engine=innodb;
@ -1442,3 +1443,101 @@ drop table t1;
create table t1 (a int) engine=innodb;
create table t2 like t1;
drop table t1,t2;
create table t1 (id int(11) not null, id2 int(11) not null, unique (id,id2)) engine=innodb;
create table t2 (id int(11) not null, constraint t1_id_fk foreign key ( id ) references t1 (id)) engine = innodb;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL default '0',
`id2` int(11) NOT NULL default '0',
UNIQUE KEY `id` (`id`,`id2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0',
KEY `t1_id_fk` (`id`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
create index id on t2 (id);
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0',
KEY `id` (`id`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
create index id2 on t2 (id);
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0',
KEY `id` (`id`),
KEY `id2` (`id`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop index id2 on t2;
drop index id on t2;
Got one of the listed errors
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0',
KEY `id` (`id`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t2;
create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id,id2) references t1 (id,id2)) engine = innodb;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0',
`id2` int(11) NOT NULL default '0',
KEY `t1_id_fk` (`id`,`id2`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
create unique index id on t2 (id,id2);
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0',
`id2` int(11) NOT NULL default '0',
UNIQUE KEY `id` (`id`,`id2`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t2;
create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0',
`id2` int(11) NOT NULL default '0',
UNIQUE KEY `id` (`id`,`id2`),
KEY `t1_id_fk` (`id2`,`id`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t2;
create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2), constraint t1_id_fk foreign key (id) references t1 (id)) engine = innodb;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0',
`id2` int(11) NOT NULL default '0',
UNIQUE KEY `id` (`id`,`id2`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t2;
create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0',
`id2` int(11) NOT NULL default '0',
UNIQUE KEY `id` (`id`,`id2`),
KEY `t1_id_fk` (`id2`,`id`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t2;
create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb;
ERROR HY000: Can't create table './test/t2.frm' (errno: 150)
drop table t1;

View file

@ -105,6 +105,18 @@ select min(a) from t1;
min(a)
-0.010
drop table t1;
create table t1 (a float(200,100), b double(200,100));
insert t1 values (1.0, 2.0);
select * from t1;
a b
1.000000000000000000000000000000 2.000000000000000000000000000000
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` float(200,30) default NULL,
`b` double(200,30) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (f float(54));
ERROR 42000: Incorrect column specifier for column 'f'
drop table if exists t1;

View file

@ -0,0 +1,55 @@
#
# Tests with the latin1 character set
#
--disable_warnings
drop table if exists t1;
--enable_warnings
#
# WL 1494: Treat latin1 as cp1252 for unicode conversion
#
SET NAMES latin1;
CREATE TABLE t1 (a char(1) character set latin1);
INSERT INTO t1 VALUES (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07);
INSERT INTO t1 VALUES (0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
INSERT INTO t1 VALUES (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17);
INSERT INTO t1 VALUES (0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
INSERT INTO t1 VALUES (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27);
INSERT INTO t1 VALUES (0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
INSERT INTO t1 VALUES (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37);
INSERT INTO t1 VALUES (0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
INSERT INTO t1 VALUES (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47);
INSERT INTO t1 VALUES (0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
INSERT INTO t1 VALUES (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57);
INSERT INTO t1 VALUES (0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
INSERT INTO t1 VALUES (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67);
INSERT INTO t1 VALUES (0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
INSERT INTO t1 VALUES (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77);
INSERT INTO t1 VALUES (0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
INSERT INTO t1 VALUES (0x80),(0x81),(0x82),(0x83),(0x84),(0x85),(0x86),(0x87);
INSERT INTO t1 VALUES (0x88),(0x89),(0x8A),(0x8B),(0x8C),(0x8D),(0x8E),(0x8F);
INSERT INTO t1 VALUES (0x90),(0x91),(0x92),(0x93),(0x94),(0x95),(0x96),(0x97);
INSERT INTO t1 VALUES (0x98),(0x99),(0x9A),(0x9B),(0x9C),(0x9D),(0x9E),(0x9F);
INSERT INTO t1 VALUES (0xA0),(0xA1),(0xA2),(0xA3),(0xA4),(0xA5),(0xA6),(0xA7);
INSERT INTO t1 VALUES (0xA8),(0xA9),(0xAA),(0xAB),(0xAC),(0xAD),(0xAE),(0xAF);
INSERT INTO t1 VALUES (0xB0),(0xB1),(0xB2),(0xB3),(0xB4),(0xB5),(0xB6),(0xB7);
INSERT INTO t1 VALUES (0xB8),(0xB9),(0xBA),(0xBB),(0xBC),(0xBD),(0xBE),(0xBF);
INSERT INTO t1 VALUES (0xC0),(0xC1),(0xC2),(0xC3),(0xC4),(0xC5),(0xC6),(0xC7);
INSERT INTO t1 VALUES (0xC8),(0xC9),(0xCA),(0xCB),(0xCC),(0xCD),(0xCE),(0xCF);
INSERT INTO t1 VALUES (0xD0),(0xD1),(0xD2),(0xD3),(0xD4),(0xD5),(0xD6),(0xD7);
INSERT INTO t1 VALUES (0xD8),(0xD9),(0xDA),(0xDB),(0xDC),(0xDD),(0xDE),(0xDF);
INSERT INTO t1 VALUES (0xE0),(0xE1),(0xE2),(0xE3),(0xE4),(0xE5),(0xE6),(0xE7);
INSERT INTO t1 VALUES (0xE8),(0xE9),(0xEA),(0xEB),(0xEC),(0xED),(0xEE),(0xEF);
INSERT INTO t1 VALUES (0xF0),(0xF1),(0xF2),(0xF3),(0xF4),(0xF5),(0xF6),(0xF7);
INSERT INTO t1 VALUES (0xF8),(0xF9),(0xFA),(0xFB),(0xFC),(0xFD),(0xFE),(0xFF);
#
# 0x81 0x8D 0x8F 0x90 0x9D are undefined in cp1252
#
SELECT
hex(a),
hex(@u:=convert(a using utf8)),
hex(@l:=convert(@u using latin1)),
a=@l FROM t1;
DROP TABLE t1;

View file

@ -56,6 +56,13 @@ SET CHARACTER SET koi8r;
DROP TABLE ÔÁÂÌÉÃÁ;
SET CHARACTER SET default;
# Test for Item_func_conv_charset::fix_fields (bug #3704)
SET NAMES UTF8;
CREATE TABLE t1 (t text) DEFAULT CHARSET UTF8;
INSERT INTO t1 (t) VALUES ('x');
SELECT 1 FROM t1 WHERE CONCAT(_latin1'x') = t;
DROP TABLE t1;
SET CHARACTER SET koi8r;
CREATE DATABASE ÔÅÓÔ;
USE ÔÅÓÔ;
@ -71,4 +78,3 @@ SET NAMES koi8r;
SELECT hex('ÔÅÓÔ');
SET character_set_connection=cp1251;
SELECT hex('ÔÅÓÔ');

View file

@ -1044,3 +1044,46 @@ drop table t1;
create table t1 (a int) engine=innodb;
create table t2 like t1;
drop table t1,t2;
#
# Test of automaticly created foreign keys
#
create table t1 (id int(11) not null, id2 int(11) not null, unique (id,id2)) engine=innodb;
create table t2 (id int(11) not null, constraint t1_id_fk foreign key ( id ) references t1 (id)) engine = innodb;
show create table t1;
show create table t2;
create index id on t2 (id);
show create table t2;
create index id2 on t2 (id);
show create table t2;
drop index id2 on t2;
--error 1025,1025
drop index id on t2;
show create table t2;
drop table t2;
create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id,id2) references t1 (id,id2)) engine = innodb;
show create table t2;
create unique index id on t2 (id,id2);
show create table t2;
drop table t2;
# Check foreign key columns created in different order than key columns
create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb;
show create table t2;
drop table t2;
create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2), constraint t1_id_fk foreign key (id) references t1 (id)) engine = innodb;
show create table t2;
drop table t2;
create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb;
show create table t2;
drop table t2;
# Test error handling
--error 1005
create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb;
drop table t1;

View file

@ -71,7 +71,7 @@ show status like 'key_blocks_used';
# Following results differs on 64 and 32 bit systems because of different
# pointer sizes, which takes up different amount of space in key cache
--replace_result 1812 KEY_BLOCKS_UNUSED 1793 KEY_BLOCKS_UNUSED
--replace_result 1812 KEY_BLOCKS_UNUSED 1793 KEY_BLOCKS_UNUSED 1674 KEY_BLOCKS_UNUSED 1818 KEY_BLOCKS_UNUSED
show status like 'key_blocks_unused';
insert into t1 values (1, 'qqqq'), (11, 'yyyy');
@ -84,7 +84,7 @@ update t1 set p=2 where p=1;
update t2 set i=2 where i=1;
show status like 'key_blocks_used';
--replace_result 1808 KEY_BLOCKS_UNUSED 1789 KEY_BLOCKS_UNUSED
--replace_result 1808 KEY_BLOCKS_UNUSED 1789 KEY_BLOCKS_UNUSED 1670 KEY_BLOCKS_UNUSED 1814 KEY_BLOCKS_UNUSED
show status like 'key_blocks_unused';
cache index t1 key (`primary`) in keycache1;
@ -146,7 +146,7 @@ cache index t1,t2 in default;
drop table t1,t2,t3;
show status like 'key_blocks_used';
--replace_result 1812 KEY_BLOCKS_UNUSED 1793 KEY_BLOCKS_UNUSED
--replace_result 1812 KEY_BLOCKS_UNUSED 1793 KEY_BLOCKS_UNUSED 1674 KEY_BLOCKS_UNUSED 1818 KEY_BLOCKS_UNUSED
show status like 'key_blocks_unused';
# Cleanup

View file

@ -54,6 +54,12 @@ select a from t1 order by a;
select min(a) from t1;
drop table t1;
create table t1 (a float(200,100), b double(200,100));
insert t1 values (1.0, 2.0);
select * from t1;
show create table t1;
drop table t1;
# Errors
--error 1063

View file

@ -117,10 +117,12 @@ int my_lock(File fd, int locktype, my_off_t start, my_off_t length,
#if defined(HAVE_FCNTL)
{
struct flock lock;
lock.l_type= (short) locktype;
lock.l_whence=0L;
lock.l_start=(long) start;
lock.l_len=(long) length;
lock.l_type= (short) locktype;
lock.l_whence= SEEK_SET;
lock.l_start= (off_t) start;
lock.l_len= (off_t) length;
if (MyFlags & MY_DONT_WAIT)
{
if (fcntl(fd,F_SETLK,&lock) != -1) /* Check if we can lock */

View file

@ -21,62 +21,43 @@ LIBPREFIX := lib
fixpath = $1
ar_rcs = $(AR_RCS) $1 $2
#check-odbc = $(findstring sqlext.h, $(wildcard /usr/include/sqlext.h) $(wildcard /usr/local/include/sqlext.h))
CCFLAGS_TOP += -DHAVE_STRCASECMP
endif
ifeq ($(NDB_OS), WIN32)
CCFLAGS_TOP += -DHAVE_STRDUP
NDB_STRLCPY := Y
NDB_STRLCAT := Y
SHLIBEXT := dll
endif
ifeq ($(NDB_OS), LINUX)
CCFLAGS_TOP += -DHAVE_STRDUP
NDB_STRLCAT := Y
NDB_STRLCPY := Y
SHLIBEXT := so
endif
ifeq ($(NDB_OS), SOLARIS)
CCFLAGS_TOP += -DHAVE_STRDUP
NDB_STRLCAT := Y
NDB_STRLCPY := Y
SHLIBEXT := so
endif
ifeq ($(NDB_OS), HPUX)
CCFLAGS_TOP += -DHAVE_STRDUP
NDB_STRLCAT := Y
NDB_STRLCPY := Y
SHLIBEXT := sl
endif
ifeq ($(NDB_OS), MACOSX)
CCFLAGS_TOP += -DHAVE_STRLCAT
CCFLAGS_TOP += -DHAVE_STRLCAT
CCFLAGS_TOP += -DHAVE_STRLCPY
CCFLAGS_TOP += -DNDBOUT_UINTPTR
SHLIBEXT := dylib
endif
ifeq ($(NDB_OS), OSE)
NDB_STRDUP := Y
NDB_STRLCAT := Y
NDB_STRLCPY := Y
SHLIBEXT := so
endif
ifeq ($(NDB_OS), SOFTOSE)
NDB_STRDUP := Y
NDB_STRLCAT := Y
NDB_STRLCPY := Y
SHLIBEXT := so
endif
ifeq ($(NDB_SCI), Y)
CCFLAGS_TOP += -DHAVE_SCI
CCFLAGS_TOP += -DHAVE_NDB_SCI
endif
ifeq ($(NDB_SHM), Y)
CCFLAGS_TOP += -DHAVE_NDB_SHM
endif
ifneq ($(findstring OSE, $(NDB_OS)),)

View file

@ -227,7 +227,7 @@ CCFLAGS_LOC += -I$(call fixpath,$(NDB_TOP)/include/util) \
BIN_TARGET_LIBS += logger general portlib
endif
CCFLAGS_LOC += -I$(call fixpath,$(NDB_TOP)/include)
CCFLAGS_LOC += -I$(call fixpath,$(NDB_TOP)/include) -I$(call fixpath,$(NDB_TOP)/../include)
ifeq ($(NDB_SCI), Y)
BIN_TARGET_LIBS += sisci

View file

@ -6,6 +6,13 @@ DIRS := src test tools examples
replace-targets := all clean
NDB_RELEASE := $(shell ../scripts/mysql_config --version)
all:
$(MAKE) -C src
$(MAKE) -C test/src
$(MAKE) -C tools
$(MAKE) -C test/ndbapi/flexBench
$(MAKE) -C test/tools/waiter
include $(NDB_TOP)/Epilogue.mk
_libs_test : _bins_src
@ -15,7 +22,7 @@ _bins_src : _libs_src
_bins_tools : _bins_src
# always release compile except for ndbapi static lib
all:
old-all:
$(MAKE) -C src/ndbapi libs
$(MAKE) libs NDB_VERSION=RELEASE
$(MAKE) bins NDB_VERSION=RELEASE

View file

@ -11,6 +11,11 @@ then
NDB_SCI=N
fi
if [ -z "$NDB_SHM" ]
then
NDB_SHM=N
fi
os=`uname -s`
case $os in
Linux)

View file

@ -63,20 +63,12 @@
*/
#include <ndb_global.h>
#include <NdbApi.hpp>
#include <NdbScanFilter.hpp>
#include <iostream> // Used for cout
#ifdef SOLARIS
#include <sys/types.h>
#include <unistd.h>
#endif
#if defined LINUX || defined MACOSX
#include <time.h>
#include <unistd.h>
#endif
/**
* Helper sleep function
*/

View file

@ -85,21 +85,13 @@
*/
#include <ndb_global.h>
#include <NdbApi.hpp>
#include <NdbScanFilter.hpp>
// Used for cout
#include <iostream>
#ifdef SOLARIS
#include <sys/types.h>
#include <unistd.h>
#endif
#if defined LINUX || defined MACOSX
#include <time.h>
#include <unistd.h>
#endif
/**
* Helper sleep function
*/

View file

@ -24,7 +24,6 @@
#define SignalLoggerManager_H
#include <NdbStdio.h>
#include <kernel_types.h>
#include <BlockNumbers.h>
#include <TransporterDefinitions.hpp>
@ -153,7 +152,7 @@ public:
private:
bool m_logDistributed;
int m_ownNodeId;
Uint32 m_ownNodeId;
FILE * outputStream;
int log(int cmd, BlockNumber bno, LogMode logMode);

View file

@ -17,8 +17,7 @@
#ifndef _LOG_LEVEL_HPP
#define _LOG_LEVEL_HPP
#include <ndb_types.h>
#include <assert.h>
#include <ndb_global.h>
/**
*

View file

@ -19,7 +19,6 @@
#include "SignalData.hpp"
#include <NodeBitmask.hpp>
#include <NdbString.h>
#include <signaldata/DictTabInfo.hpp>
/**

View file

@ -17,11 +17,9 @@
#ifndef SIGNAL_DATA_H
#define SIGNAL_DATA_H
#include <ndb_global.h>
#include <ndb_limits.h>
#include <kernel_types.h>
#include <NdbStdio.h>
#include <NdbConstant.hpp>
#include <stdlib.h>
#ifndef NDB_ASSERT
#ifdef VM_TRACE

View file

@ -17,8 +17,8 @@
#ifndef SIGNAL_DATA_PRINT_H
#define SIGNAL_DATA_PRINT_H
#include <ndb_global.h>
#include <kernel_types.h>
#include <NdbStdio.h>
/**
* Typedef for a Signal Data Print Function

View file

@ -19,7 +19,7 @@
#include "LogHandler.hpp"
class File;
class File_class;
/**
* Logs messages to a file. The log file will be archived depending on
@ -104,7 +104,7 @@ private:
int m_maxNoFiles;
long m_maxFileSize;
unsigned int m_maxLogEntries;
File* m_pLogFile;
File_class* m_pLogFile;
};
#endif

View file

@ -19,7 +19,6 @@
#include "Logger.hpp"
#include <NdbStdio.h> // Defines NULL
/**
* This class is the base class for all log handlers. A log handler is

View file

@ -17,8 +17,8 @@
#ifndef Logger_H
#define Logger_H
#include <ndb_global.h>
#include <BaseString.hpp>
#include <stdarg.h>
class LogHandler;
class LogHandlerList;

View file

@ -80,13 +80,13 @@ extern "C" {
* NDB Cluster node types
*/
enum ndb_mgm_node_type {
NDB_MGM_NODE_TYPE_UNKNOWN = -1, ///< Node type not known
NDB_MGM_NODE_TYPE_API = 0, ///< An application node (API)
NDB_MGM_NODE_TYPE_NDB = 1, ///< A database node (DB)
NDB_MGM_NODE_TYPE_MGM = 2, ///< A management server node (MGM)
NDB_MGM_NODE_TYPE_UNKNOWN = -1, /*/< Node type not known*/
NDB_MGM_NODE_TYPE_API = 0, /*/< An application node (API)*/
NDB_MGM_NODE_TYPE_NDB = 1, /*/< A database node (DB)*/
NDB_MGM_NODE_TYPE_MGM = 2, /*/< A management server node (MGM)*/
NDB_MGM_NODE_TYPE_MIN = 0, ///< Min valid value
NDB_MGM_NODE_TYPE_MAX = 2 ///< Max valid value
NDB_MGM_NODE_TYPE_MIN = 0, /*/< Min valid value*/
NDB_MGM_NODE_TYPE_MAX = 2 /*/< Max valid value*/
};
/**

View file

@ -22,8 +22,8 @@
//******************************************************************************
#include <ndb_global.h> // exit
#include <NdbOut.hpp>
#include <stdlib.h> // exit
#define REPORT_WARNING(message) \
ndbout << "WARNING: " << message << endl

89
ndb/include/ndb_global.h Normal file
View file

@ -0,0 +1,89 @@
#ifndef NDBGLOBAL_H
#define NDBGLOBAL_H
#include <my_global.h>
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
#define NDB_WIN32
#else
#undef NDB_WIN32
#endif
#include <m_string.h>
#include <m_ctype.h>
#include <ndb_types.h>
#include <ctype.h>
#ifdef HAVE_STDARG_H
#include <stdarg.h>
#endif
#ifdef TIME_WITH_SYS_TIME
#include <time.h>
#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#include <sys/param.h>
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#include <sys/resource.h>
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
#endif
#ifdef NDB_WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#define DIR_SEPARATOR "\\"
#define PATH_MAX 256
#pragma warning(disable: 4503 4786)
#else
#define DIR_SEPARATOR "/"
#endif
#ifdef NDB_VC98
#define STATIC_CONST(x) enum { x }
#else
#define STATIC_CONST(x) static const Uint32 x
#endif
#ifdef __cplusplus
#include <new>
#endif
#ifdef __cplusplus
extern "C" {
#endif
#include <assert.h>
#ifndef HAVE_STRDUP
extern char * strdup(const char *s);
#endif
#ifndef HAVE_STRLCPY
extern size_t strlcpy (char *dst, const char *src, size_t dst_sz);
#endif
#ifndef HAVE_STRLCAT
extern size_t strlcat (char *dst, const char *src, size_t dst_sz);
#endif
#ifndef HAVE_STRCASECMP
extern int strcasecmp(const char *s1, const char *s2);
extern int strncasecmp(const char *s1, const char *s2, size_t n);
#endif
#ifdef __cplusplus
}
#endif
#endif

7
ndb/include/ndb_net.h Normal file
View file

@ -0,0 +1,7 @@
#ifndef NDBNET_H
#define NDBNET_H
#include <my_net.h>
#endif

View file

@ -21,9 +21,6 @@
#ifndef SYS_TYPES_H
#define SYS_TYPES_H
#include <sys/types.h>
#include <stddef.h>
typedef char Int8;
typedef unsigned char Uint8;
typedef short Int16;

View file

@ -17,9 +17,6 @@
#ifndef NDB_VERSION_H
#define NDB_VERSION_H
#include <stdio.h>
#include <string.h>
#include <version.h>
#define MAKE_VERSION(A,B,C) (((A) << 16) | ((B) << 8) | ((C) << 0))
@ -47,7 +44,7 @@
* Used by transporter and when communicating with
* managment server
*/
//#define NDB_VERSION_ID 0
/*#define NDB_VERSION_ID 0*/
#endif

View file

@ -860,9 +860,9 @@
#include <ndb_types.h>
#include <ndbapi_limits.h>
#include "AttrType.hpp"
#include <AttrType.hpp>
#include <NdbError.hpp>
#include "NdbDictionary.hpp"
#include <NdbDictionary.hpp>
class NdbObjectIdMap;
class NdbOperation;
@ -1673,7 +1673,7 @@ private:
*/
struct StartTransactionNodeSelectionData {
StartTransactionNodeSelectionData():
fragment2PrimaryNodeMap(NULL) {};
fragment2PrimaryNodeMap(0) {};
Uint32 kValue;
Uint32 hashValueMask;
Uint32 hashpointerValue;

View file

@ -18,9 +18,8 @@
#define NdbConnection_H
#include <ndb_types.h>
#include "AttrType.hpp"
#include <AttrType.hpp>
#include <NdbError.hpp>
#include <stdlib.h>
class NdbConnection;
class NdbOperation;

View file

@ -17,6 +17,8 @@
#ifndef NDB_ERROR_HPP
#define NDB_ERROR_HPP
#include <ndberror.h>
/**
* @struct NdbError
* @brief Contains error information
@ -51,7 +53,7 @@ struct NdbError {
* The error code indicate success<br>
* (Includes classification: NdbError::NoError)
*/
Success = 0,
Success = ndberror_st_success,
/**
* The error code indicates a temporary error.
@ -61,7 +63,7 @@ struct NdbError {
* NdbError::OverloadError, NdbError::NodeShutdown
* and NdbError::TimeoutExpired.)
*/
TemporaryError = 1,
TemporaryError = ndberror_st_temporary,
/**
* The error code indicates a permanent error.<br>
@ -71,14 +73,14 @@ struct NdbError {
* NdbError::UserDefinedError, NdbError::InternalError, and,
* NdbError::FunctionNotImplemented.)
*/
PermanentError = 2,
PermanentError = ndberror_st_permanent,
/**
* The result/status is unknown.<br>
* (Includes classifications: NdbError::UnknownResultError, and
* NdbError::UnknownErrorCode.)
*/
UnknownResult = 3
UnknownResult = ndberror_st_unknown
};
/**
@ -88,85 +90,85 @@ struct NdbError {
/**
* Success. No error occurred.
*/
NoError = 0,
NoError = ndberror_cl_none,
/**
* Error in application program.
*/
ApplicationError = 1,
ApplicationError = ndberror_cl_application,
/**
* Read operation failed due to missing record.
*/
NoDataFound = 2,
NoDataFound = ndberror_cl_no_data_found,
/**
* E.g. inserting a tuple with a primary key already existing
* in the table.
*/
ConstraintViolation = 3,
ConstraintViolation = ndberror_cl_constraint_violation,
/**
* Error in creating table or usage of table.
*/
SchemaError = 4,
SchemaError = ndberror_cl_schema_error,
/**
* Error occurred in interpreted program.
*/
UserDefinedError = 5,
UserDefinedError = ndberror_cl_user_defined,
/**
* E.g. insufficient memory for data or indexes.
*/
InsufficientSpace = 6,
InsufficientSpace = ndberror_cl_insufficient_space,
/**
* E.g. too many active transactions.
*/
TemporaryResourceError = 7,
TemporaryResourceError = ndberror_cl_temporary_resource,
/**
* Temporary failures which are probably inflicted by a node
* recovery in progress. Examples: information sent between
* application and NDB lost, distribution change.
*/
NodeRecoveryError = 8,
NodeRecoveryError = ndberror_cl_node_recovery,
/**
* E.g. out of log file space.
*/
OverloadError = 9,
OverloadError = ndberror_cl_overload,
/**
* Timeouts, often inflicted by deadlocks in NDB.
*/
TimeoutExpired = 10,
TimeoutExpired = ndberror_cl_timeout_expired,
/**
* Is is unknown whether the transaction was committed or not.
*/
UnknownResultError = 11,
UnknownResultError = ndberror_cl_unknown_result,
/**
* A serious error in NDB has occurred.
*/
InternalError = 12,
InternalError = ndberror_cl_internal_error,
/**
* A function used is not yet implemented.
*/
FunctionNotImplemented = 13,
FunctionNotImplemented = ndberror_cl_function_not_implemented,
/**
* Error handler could not determine correct error code.
*/
UnknownErrorCode = 14,
UnknownErrorCode = ndberror_cl_unknown_error_code,
/**
* Node shutdown
*/
NodeShutdown = 15
NodeShutdown = ndberror_cl_node_shutdown
};
/**
@ -204,6 +206,22 @@ struct NdbError {
message = 0;
details = 0;
}
NdbError(const ndberror_struct & ndberror){
status = (NdbError::Status) ndberror.status;
classification = (NdbError::Classification) ndberror.classification;
code = ndberror.code;
message = ndberror.message;
details = ndberror.details;
}
operator ndberror_struct() const {
ndberror_struct ndberror;
ndberror.status = (ndberror_status_enum) status;
ndberror.classification = (ndberror_classification_enum) classification;
ndberror.code = code;
ndberror.message = message;
ndberror.details = details;
return ndberror;
}
};
class NdbOut& operator <<(class NdbOut&, const NdbError &);

View file

@ -157,8 +157,8 @@ public:
* the attribute, or a NULL pointer
* (indicating error).
*/
NdbRecAttr *getValue(const char *anAttrName, char *aValue = NULL);
NdbRecAttr *getPreValue(const char *anAttrName, char *aValue = NULL);
NdbRecAttr *getValue(const char *anAttrName, char *aValue = 0);
NdbRecAttr *getPreValue(const char *anAttrName, char *aValue = 0);
/**
* Retrieves event resultset if available, inserted into the NdbRecAttrs
@ -172,7 +172,7 @@ public:
* overflow and *pOverRun will indicate the number of events that have
* overwritten.
*/
int next(int *pOverRun=NULL);
int next(int *pOverRun=0);
/**
* In the current implementation a nodefailiure may cause loss of events,

View file

@ -17,14 +17,11 @@
#ifndef NdbOperation_H
#define NdbOperation_H
#include <stdlib.h>
#include <assert.h>
#include <ndb_types.h>
#include "AttrType.hpp"
#include "NdbError.hpp"
#include "NdbReceiver.hpp"
#include <stdlib.h>
#include <AttrType.hpp>
#include <NdbError.hpp>
#include <NdbReceiver.hpp>
class Ndb;
class NdbApiSignal;
@ -480,8 +477,8 @@ public:
* the attribute, or a NULL pointer
* (indicating error).
*/
NdbRecAttr* getValue(const char* anAttrName, char* aValue = NULL);
NdbRecAttr* getValue(Uint32 anAttrId, char* aValue = NULL);
NdbRecAttr* getValue(const char* anAttrName, char* aValue = 0);
NdbRecAttr* getValue(Uint32 anAttrId, char* aValue = 0);
/**
* Define an attribute to set or update in query.
@ -925,7 +922,7 @@ protected:
virtual int equal_impl(const NdbColumnImpl* anAttrObject,
const char* aValue,
Uint32 len);
NdbRecAttr* getValue(const NdbColumnImpl* anAttrObject, char* aValue = NULL);
NdbRecAttr* getValue(const NdbColumnImpl* anAttrObject, char* aValue = 0);
int setValue(const NdbColumnImpl* anAttrObject, const char* aValue, Uint32 len);
int incValue(const NdbColumnImpl* anAttrObject, Uint32 aValue);
int incValue(const NdbColumnImpl* anAttrObject, Uint64 aValue);

View file

@ -17,9 +17,6 @@
#ifndef NdbRecAttr_H
#define NdbRecAttr_H
#include <stdlib.h>
#include <ndb_types.h>
#include <NdbDictionary.hpp>
#include "AttrType.hpp"
@ -427,9 +424,9 @@ inline
void
NdbRecAttr::release()
{
if (theStorageX != NULL) {
if (theStorageX != 0) {
delete [] theStorageX;
theStorageX = NULL;
theStorageX = 0;
}
}
@ -437,10 +434,10 @@ inline
void
NdbRecAttr::init()
{
theStorageX = NULL;
theValue = NULL;
theRef = NULL;
theNext = NULL;
theStorageX = 0;
theValue = 0;
theRef = 0;
theNext = 0;
theAttrId = 0xFFFF;
theNULLind = -1;
}
@ -470,7 +467,7 @@ inline
bool
NdbRecAttr::copyoutRequired() const
{
return theRef != theValue && theValue != NULL;
return theRef != theValue && theValue != 0;
}
inline

View file

@ -18,7 +18,7 @@
#define NdbReceiver_H
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL // Not part of public interface
#include <stdlib.h>
#include <ndb_types.h>
class Ndb;
class NdbReceiver

View file

@ -172,25 +172,6 @@ SetValueRec::SetValueRec() :
{
}
inline
SetValueRec::~SetValueRec()
{
if ((stype == SET_STRING_ATTR1) ||
(stype == SET_INT32_ATTR1) ||
(stype == SET_UINT32_ATTR1) ||
(stype == SET_INT64_ATTR1) ||
(stype == SET_UINT64_ATTR1) ||
(stype == SET_FLOAT_ATTR1) ||
(stype == SET_DOUBLE_ATTR1))
free(anAttrName);
if ((stype == SET_STRING_ATTR1) ||
(stype == SET_STRING_ATTR2))
free(stringStruct.aStringValue);
if (next) delete next;
next = 0;
}
class SetValueRecList {
public:
SetValueRecList();

View file

@ -18,11 +18,9 @@
#define NdbSchemaOp_H
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
#include <ndb_types.h>
#include "NdbDictionary.hpp"
#include "AttrType.hpp"
#include "NdbSchemaCon.hpp"
#include <stdlib.h>
#include "NdbDictionary.hpp"
class NdbApiSignal;
class Ndb;

View file

@ -0,0 +1,98 @@
/* Copyright (C) 2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef NDBERROR_H
#define NDBERROR_H
#ifdef __cplusplus
extern "C" {
#endif
typedef enum
{
ndberror_st_success = 0,
ndberror_st_temporary = 1,
ndberror_st_permanent = 2,
ndberror_st_unknown = 3
} ndberror_status_enum;
typedef enum
{
ndberror_cl_none = 0,
ndberror_cl_application = 1,
ndberror_cl_no_data_found = 2,
ndberror_cl_constraint_violation = 3,
ndberror_cl_schema_error = 4,
ndberror_cl_user_defined = 5,
ndberror_cl_insufficient_space = 6,
ndberror_cl_temporary_resource = 7,
ndberror_cl_node_recovery = 8,
ndberror_cl_overload = 9,
ndberror_cl_timeout_expired = 10,
ndberror_cl_unknown_result = 11,
ndberror_cl_internal_error = 12,
ndberror_cl_function_not_implemented = 13,
ndberror_cl_unknown_error_code = 14,
ndberror_cl_node_shutdown = 15
} ndberror_classification_enum;
typedef struct {
/**
* Error status.
*/
ndberror_status_enum status;
/**
* Error type
*/
ndberror_classification_enum classification;
/**
* Error code
*/
int code;
/**
* Error message
*/
const char * message;
/**
* The detailed description. This is extra information regarding the
* error which is not included in the error message.
*
* @note Is NULL when no details specified
*/
char * details;
} ndberror_struct;
typedef ndberror_status_enum ndberror_status;
typedef ndberror_classification_enum ndberror_classification;
const char *ndberror_status_message(ndberror_status);
const char *ndberror_classification_message(ndberror_classification);
void ndberror_update(ndberror_struct *);
int ndb_error_string(int err_no, char *str, unsigned int size);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -102,11 +102,9 @@
/* --- Include files ---- */
#include <ndb_global.h>
#include <defs/pcn_types.h>
#include <stdio.h>
/* --- Types and definitions --- */
/**

View file

@ -17,16 +17,9 @@
#ifndef PCN_TYPES_H
#define PCN_TYPES_H
#include <stddef.h>
#include <NdbUnistd.h>
#include <ndb_global.h>
#ifdef NDB_MACOSX
typedef unsigned int Size_t;
#elif defined(NDB_SPARC_64)
typedef unsigned int Size_t;
#else
typedef size_t Size_t;
#endif
typedef int Boolean_t;

View file

@ -1,28 +0,0 @@
/* Copyright (C) 2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef NDB_CONSTANT_HPP
#define NDB_CONSTANT_HPP
#include <ndb_types.h>
#ifdef NDB_VC98
#define STATIC_CONST(x) enum { x }
#else
#define STATIC_CONST(x) static const Uint32 x
#endif
#endif

View file

@ -17,8 +17,7 @@
#ifndef NDB_MEM_H
#define NDB_MEM_H
#include <stddef.h>
#include <ndb_global.h>
#ifdef __cplusplus
extern "C" {

View file

@ -17,6 +17,8 @@
#ifndef NDB_MUTEX_H
#define NDB_MUTEX_H
#include <ndb_global.h>
#ifdef NDB_WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
@ -34,7 +36,7 @@ typedef SEMAPHORE NdbMutex;
#elif defined NDB_WIN32
typedef CRITICAL_SECTION NdbMutex;
#else
#include <pthread.h>
#include <my_pthread.h>
typedef pthread_mutex_t NdbMutex;
#define NDB_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
#endif

View file

@ -17,6 +17,9 @@
#ifndef NDB_TCP_H
#define NDB_TCP_H
#include <ndb_global.h>
#include <ndb_net.h>
#if defined NDB_OSE || defined NDB_SOFTOSE
/**
* Include files needed
@ -24,7 +27,6 @@
#include "inet.h"
#include <netdb.h>
#include <errno.h>
#define NDB_NONBLOCK FNDELAY
#define NDB_SOCKET_TYPE int
@ -38,65 +40,13 @@ typedef int socklen_t;
#define InetErrno (* inet_errno())
#endif
#elif NDB_WIN32
#if defined NDB_SOLARIS || defined NDB_HPUX || defined NDB_IBMAIX || defined NDB_TRU64X
/**
* Include files needed
*/
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <netdb.h>
#include <errno.h>
#include <fcntl.h>
#define NDB_NONBLOCK O_NONBLOCK
#define NDB_SOCKET_TYPE int
#define NDB_INVALID_SOCKET -1
#define NDB_CLOSE_SOCKET(x) close(x)
#define InetErrno errno
#endif
#if defined NDB_LINUX || defined NDB_MACOSX
/**
* Include files needed
*/
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <netdb.h>
#include <errno.h>
#include <fcntl.h>
#define NDB_NONBLOCK O_NONBLOCK
#define NDB_SOCKET_TYPE int
#define NDB_INVALID_SOCKET -1
#define NDB_CLOSE_SOCKET(x) close(x)
#define InetErrno errno
#endif
#ifdef NDB_WIN32
/**
* Include files needed
*/
#include <winsock2.h>
#include <ws2tcpip.h>
#include <errno.h>
#define InetErrno WSAGetLastError()
#define EWOULDBLOCK WSAEWOULDBLOCK
@ -104,14 +54,23 @@ typedef int socklen_t;
#define NDB_INVALID_SOCKET INVALID_SOCKET
#define NDB_CLOSE_SOCKET(x) closesocket(x)
#endif
#ifndef NDB_MACOSX
#define NDB_SOCKLEN_T socklen_t
#else
#define NDB_SOCKLEN_T int
/**
* Include files needed
*/
#include <netdb.h>
#define NDB_NONBLOCK O_NONBLOCK
#define NDB_SOCKET_TYPE int
#define NDB_INVALID_SOCKET -1
#define NDB_CLOSE_SOCKET(x) close(x)
#define InetErrno errno
#endif
#define NDB_SOCKLEN_T SOCKET_SIZE_TYPE
#ifdef __cplusplus
extern "C" {

View file

@ -17,8 +17,7 @@
#ifndef NDB_THREAD_H
#define NDB_THREAD_H
#include <sys/types.h>
#include <ndb_global.h>
#ifdef __cplusplus
extern "C" {

View file

@ -42,7 +42,7 @@ NDB_TICKS NdbTick_CurrentMillisecond(void);
*/
int NdbTick_CurrentMicrosecond(NDB_TICKS * secs, Uint32 * micros);
//#define TIME_MEASUREMENT
/*#define TIME_MEASUREMENT*/
#ifdef TIME_MEASUREMENT
struct MicroSecondTimer {

View file

@ -1,39 +0,0 @@
/* Copyright (C) 2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef NDB_UNISTD_H
#define NDB_UNISTD_H
#ifdef NDB_WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#include <windows.h>
#include <limits.h>
#define DIR_SEPARATOR "\\"
#define PATH_MAX 256
#pragma warning(disable: 4503 4786)
#else
#include <unistd.h>
#include <limits.h>
#define DIR_SEPARATOR "/"
#endif
#endif

View file

@ -17,8 +17,8 @@
#ifndef TransporterDefinitions_H
#define TransporterDefinitions_H
#include <ndb_global.h>
#include <kernel_types.h>
#include <string.h>
#include <NdbOut.hpp>
/**

View file

@ -17,9 +17,7 @@
#ifndef __UTIL_BASESTRING_HPP_INCLUDED__
#define __UTIL_BASESTRING_HPP_INCLUDED__
#include <ctype.h>
#include <stdlib.h>
#include <ndb_global.h>
#include <Vector.hpp>
/**

View file

@ -17,12 +17,9 @@
#ifndef NDB_BITMASK_H
#define NDB_BITMASK_H
#include <ndb_types.h>
#include <NdbConstant.hpp>
#include <ndb_global.h>
#ifndef NDB_ASSERT
#include <stdio.h>
#include <stdlib.h>
#define NDB_ASSERT(x, s) \
do { if (!(x)) { printf("%s\n", s); abort(); } } while (0)
#endif

View file

@ -17,8 +17,7 @@
#ifndef FILE_H
#define FILE_H
#include <NdbStdio.h>
#include <NdbConstant.hpp>
#include <ndb_global.h>
/**
* This class provides a file abstraction . It has operations
@ -26,7 +25,7 @@
*
* @version #@ $Id: File.hpp,v 1.5 2002/04/26 13:15:38 ejonore Exp $
*/
class File
class File_class
{
public:
/**
@ -65,7 +64,7 @@ public:
/**
* Default constructor.
*/
File();
File_class();
/**
* Creates a new File with the specified filename and file mode.
@ -76,12 +75,12 @@ public:
* @param aFileName a filename.
* @param mode the mode which the file should be opened/created with, default "r".
*/
File(const char* aFileName, const char* mode = "r");
File_class(const char* aFileName, const char* mode = "r");
/**
* Destructor.
*/
~File();
~File_class();
/**
* Opens/creates the file. If open() fails then 'errno' and perror()
@ -198,9 +197,9 @@ private:
char m_fileName[MAX_FILE_NAME_SIZE];
const char* m_fileMode;
/* Prohibit */
File(const File& aCopy);
File operator = (const File&);
bool operator == (const File&);
File_class (const File_class& aCopy);
File_class operator = (const File_class&);
bool operator == (const File_class&);
};
#endif

View file

@ -17,7 +17,7 @@
#ifndef INPUT_STREAM_HPP
#define INPUT_STREAM_HPP
#include <stdio.h>
#include <ndb_global.h>
#include <NdbTCP.h>
/**

View file

@ -17,7 +17,7 @@
#ifndef __NDB_AUTO_PTR_HPP
#define __NDB_AUTO_PTR_HPP
#include <stdlib.h>
#include <ndb_global.h>
template<typename T>
class NdbAutoPtr {

View file

@ -1,48 +0,0 @@
/* Copyright (C) 2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef __NDBSTRING_H_INCLUDED__
#define __NDBSTRING_H_INCLUDED__
#include <sys/types.h>
#include <string.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef HAVE_STRDUP
extern char * strdup(const char *s);
#endif
#ifndef HAVE_STRLCPY
extern size_t strlcpy (char *dst, const char *src, size_t dst_sz);
#endif
#ifndef HAVE_STRLCAT
extern size_t strlcat (char *dst, const char *src, size_t dst_sz);
#endif
#ifndef HAVE_STRCASECMP
extern int strcasecmp(const char *s1, const char *s2);
extern int strncasecmp(const char *s1, const char *s2, size_t n);
#endif
#ifdef __cplusplus
}
#endif
#endif /* !__NDBSTRING_H_INCLUDED__ */

View file

@ -17,7 +17,7 @@
#ifndef OUTPUT_STREAM_HPP
#define OUTPUT_STREAM_HPP
#include <stdio.h>
#include <ndb_global.h>
#include <NdbTCP.h>
/**

View file

@ -17,10 +17,7 @@
#ifndef PROPERTIES_HPP
#define PROPERTIES_HPP
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ndb_types.h>
#include <ndb_global.h>
#include <BaseString.hpp>
#include <UtilBuffer.hpp>

View file

@ -17,8 +17,7 @@
#ifndef SIMPLE_PROPERTIES_HPP
#define SIMPLE_PROPERTIES_HPP
#include <ndb_types.h>
#include <stddef.h> // offsetof
#include <ndb_global.h>
#include <NdbOut.hpp>
/**

View file

@ -17,9 +17,7 @@
#ifndef __BUFFER_HPP_INCLUDED__
#define __BUFFER_HPP_INCLUDED__
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
#include <ndb_global.h>
/* This class represents a buffer of binary data, where you can append
* data at the end, and later read the entire bunch.

View file

@ -17,9 +17,8 @@
#ifndef NDB_VECTOR_HPP
#define NDB_VECTOR_HPP
#include <stdlib.h>
#include <ndb_global.h>
#include <NdbMutex.h>
#include <string.h>
template<class T>
struct Vector {

View file

@ -52,7 +52,7 @@
#ifndef __GETARG_H__
#define __GETARG_H__
#include <stddef.h>
#include <ndb_global.h>
#ifdef __cplusplus
extern "C" {

View file

@ -17,8 +17,9 @@
#ifndef _SOCKET_IO_H
#define _SOCKET_IO_H
#include <ndb_global.h>
#include <NdbTCP.h>
#include <stdarg.h>
#ifdef __cplusplus
extern "C" {

View file

@ -17,7 +17,7 @@
#ifndef UUCODE_H
#define UUCODE_H
#include <stdio.h>
#include <ndb_global.h>
#ifdef __cplusplus
extern "C" {

View file

@ -14,11 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <NdbUnistd.h>
#include <stdlib.h>
#include <string.h>
#include <NdbStdio.h>
#include <stdarg.h>
#include <ndb_global.h>
#include <NdbApi.hpp>
#include <common/common.hpp>
#include "DiagArea.hpp"

View file

@ -14,14 +14,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <NdbUnistd.h>
#include <NdbStdio.h>
#include <stdlib.h>
#include <errno.h>
#include <limits.h>
#include <math.h>
#include <ndb_global.h>
#include "DataField.hpp"
#include <time.h>
#ifndef INT_MAX
#define INT_MAX (2147483647)

View file

@ -15,7 +15,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "DataType.hpp"
#include <NdbStdio.h>
// SqlType

View file

@ -14,9 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <new>
#include <string.h>
#include <NdbStdio.h>
#include <ndb_global.h>
#include "OdbcData.hpp"
OdbcData::OdbcData() :

View file

@ -14,16 +14,14 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h>
#include "DebuggerNames.hpp"
#include <BlockNumbers.h>
#include <GlobalSignalNumbers.h>
#include <signaldata/SignalDataPrint.hpp>
#include <NdbStdio.h>
#include <stdlib.h>
#include <string.h>
static const char * localSignalNames[MAX_GSN+1];
static SignalDataPrintFunction localPrintFunctions[MAX_GSN+1];
static const char * localBlockNames[NO_OF_BLOCKS];

View file

@ -14,6 +14,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h>
#include "EventLogger.hpp"
#include <NdbConfig.h>
@ -22,10 +24,6 @@
#include <GrepEvent.hpp>
#include <NodeState.hpp>
#include <version.h>
#include <NdbStdio.h>
#include <string.h>
#include <ctype.h>
//
// PUBLIC

View file

@ -14,15 +14,11 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h>
#include "SignalLoggerManager.hpp"
#include <LongSignal.hpp>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <time.h>
#include <NdbString.h>
#include <DebuggerNames.hpp>
SignalLoggerManager::SignalLoggerManager()

View file

@ -15,7 +15,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <NdbStdio.h>
#include <kernel_types.h>
#include <BlockNumbers.h>
#include <signaldata/CloseComReqConf.hpp>

View file

@ -15,7 +15,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <NdbStdio.h>
#include <kernel_types.h>
#include <BlockNumbers.h>
#include <signaldata/DihContinueB.hpp>

View file

@ -26,7 +26,7 @@ printCREATE_FRAGMENTATION_REQ(FILE * output, const Uint32 * theData,
fprintf(output, " noOfFragments: %x\n", sig->noOfFragments);
fprintf(output, " fragmentNode: %x\n", sig->fragmentNode);
if (sig->primaryTableId == RNIL)
fprintf(output, " primaryTableId: none\n", sig->primaryTableId);
fprintf(output, " primaryTableId: none\n");
else
fprintf(output, " primaryTableId: %x\n", sig->primaryTableId);
return true;

View file

@ -15,7 +15,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <NdbStdio.h>
#include <kernel_types.h>
#include <BlockNumbers.h>
#include <signaldata/PrepFailReqRef.hpp>

View file

@ -15,7 +15,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <NdbStdio.h>
#include <kernel_types.h>
#include <BlockNumbers.h>
#include <signaldata/SystemError.hpp>

View file

@ -19,10 +19,10 @@
**
** Main editing routines for editline library.
*/
#include <ndb_global.h>
#include "editline_internal.h"
#include <signal.h>
#include <ctype.h>
#include <unistd.h>
/*
** Manifest constants.

View file

@ -19,9 +19,8 @@
** Internal header file for editline library.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ndb_global.h>
#if defined(SYS_UNIX)
#include "unix.h"
#endif /* defined(SYS_UNIX) */

View file

@ -15,8 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <stdio.h>
#include <malloc.h>
#include <ndb_global.h>
char* readline(const char* prompt)

View file

@ -20,11 +20,7 @@
** A "micro-shell" to test editline library.
** If given any arguments, commands aren't executed.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <NdbString.h>
#include <ndb_global.h>
#include <editline/editline.h>
int

View file

@ -14,16 +14,10 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "FileLogHandler.hpp"
#include <FileLogHandler.hpp>
#include <File.hpp>
#include <NdbStdio.h>
#include <sys/param.h>
#include <errno.h>
#include <string.h>
//
// PUBLIC
//
@ -35,7 +29,7 @@ FileLogHandler::FileLogHandler() :
m_maxLogEntries(MAX_LOG_ENTRIES)
{
m_pLogFile = new File("logger.log", "a+");
m_pLogFile = new File_class("logger.log", "a+");
}
FileLogHandler::FileLogHandler(const char* aFileName,
@ -47,7 +41,7 @@ FileLogHandler::FileLogHandler(const char* aFileName,
m_maxFileSize(maxFileSize),
m_maxLogEntries(maxLogEntries)
{
m_pLogFile = new File(aFileName, "a+");
m_pLogFile = new File_class(aFileName, "a+");
}
FileLogHandler::~FileLogHandler()
@ -166,10 +160,10 @@ FileLogHandler::createNewFile()
::snprintf(newName, sizeof(newName),
"%s.%d", m_pLogFile->getName(), fileNo++);
} while (File::exists(newName));
} while (File_class::exists(newName));
m_pLogFile->close();
if (!File::rename(m_pLogFile->getName(), newName))
if (!File_class::rename(m_pLogFile->getName(), newName))
{
setErrorCode(errno);
rc = false;
@ -201,7 +195,7 @@ FileLogHandler::setFilename(const BaseString &filename) {
close();
if(m_pLogFile)
delete m_pLogFile;
m_pLogFile = new File(filename.c_str(), "a+");
m_pLogFile = new File_class(filename.c_str(), "a+");
open();
return true;
};

View file

@ -17,9 +17,6 @@
#include "LogHandler.hpp"
#include <NdbTick.h>
#include <NdbString.h>
#include <time.h>
//
// PUBLIC

Some files were not shown because too many files have changed in this diff Show more