summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.bzrignore1
-rw-r--r--BitKeeper/etc/logging_ok2
-rwxr-xr-xDocs/Support/texi2html98
-rw-r--r--acinclude.m42
-rw-r--r--client/mysqladmin.c2
-rw-r--r--client/mysqlcheck.c5
-rw-r--r--client/mysqldump.c29
-rw-r--r--client/mysqltest.c84
-rw-r--r--configure.in30
-rw-r--r--include/config-win.h2
-rw-r--r--include/my_list.h4
-rw-r--r--include/mysql.h17
-rw-r--r--include/mysql_com.h6
-rw-r--r--innobase/dict/dict0crea.c16
-rw-r--r--innobase/dict/dict0dict.c4
-rw-r--r--innobase/dict/dict0load.c35
-rw-r--r--innobase/eval/eval0eval.c18
-rw-r--r--innobase/ibuf/ibuf0ibuf.c6
-rw-r--r--innobase/include/lock0lock.h8
-rw-r--r--innobase/include/row0mysql.h6
-rw-r--r--innobase/lock/lock0lock.c13
-rw-r--r--innobase/pars/pars0pars.c8
-rw-r--r--innobase/row/row0mysql.c29
-rw-r--r--libmysql/libmysql.c19
-rw-r--r--libmysql/libmysql.def1
-rw-r--r--myisam/mi_check.c2
-rw-r--r--myisam/myisamchk.c8
-rw-r--r--mysql-test/Makefile.am6
-rw-r--r--mysql-test/include/ps_modify.inc5
-rw-r--r--mysql-test/init_db.sql26
-rw-r--r--mysql-test/my_manage.c851
-rw-r--r--mysql-test/my_manage.h135
-rw-r--r--mysql-test/mysql-test-run.sh8
-rw-r--r--mysql-test/mysql_test_run.c1728
-rw-r--r--mysql-test/mysql_test_run_new.c1771
-rw-r--r--mysql-test/ndb/ndbcluster.sh66
-rw-r--r--mysql-test/r/ctype_recoding.result66
-rw-r--r--mysql-test/r/ctype_sjis.result11
-rw-r--r--mysql-test/r/ctype_ucs.result7
-rw-r--r--mysql-test/r/fulltext.result9
-rw-r--r--mysql-test/r/fulltext_order_by.result54
-rw-r--r--mysql-test/r/func_in.result6
-rw-r--r--mysql-test/r/gis.result74
-rw-r--r--mysql-test/r/join_outer.result65
-rw-r--r--mysql-test/r/mysqltest.result131
-rw-r--r--mysql-test/r/ndb_basic.result152
-rw-r--r--mysql-test/r/ndb_blob.result276
-rw-r--r--mysql-test/r/ndb_insert.result29
-rw-r--r--mysql-test/r/ps.result6
-rw-r--r--mysql-test/r/ps_10nestset.result11
-rw-r--r--mysql-test/r/ps_2myisam.result80
-rw-r--r--mysql-test/r/ps_3innodb.result80
-rw-r--r--mysql-test/r/ps_4heap.result112
-rw-r--r--mysql-test/r/ps_5merge.result160
-rw-r--r--mysql-test/r/ps_6bdb.result80
-rw-r--r--mysql-test/r/ps_7ndb.result109
-rw-r--r--mysql-test/r/range.result17
-rw-r--r--mysql-test/r/rpl_failed_optimize.result15
-rw-r--r--mysql-test/r/sql_mode.result30
-rw-r--r--mysql-test/r/type_float.result4
-rw-r--r--mysql-test/r/user_var.result4
-rw-r--r--mysql-test/t/client_test.test2
-rw-r--r--mysql-test/t/comments.test3
-rw-r--r--mysql-test/t/ctype_recoding.test48
-rw-r--r--mysql-test/t/ctype_sjis.test11
-rw-r--r--mysql-test/t/ctype_ucs.test8
-rw-r--r--mysql-test/t/ctype_utf8.test1
-rw-r--r--mysql-test/t/fulltext.test11
-rw-r--r--mysql-test/t/fulltext_order_by.test12
-rw-r--r--mysql-test/t/func_in.test7
-rw-r--r--mysql-test/t/gis.test75
-rw-r--r--mysql-test/t/innodb.test1
-rw-r--r--mysql-test/t/insert.test10
-rw-r--r--mysql-test/t/join_outer.test91
-rw-r--r--mysql-test/t/key.test3
-rw-r--r--mysql-test/t/mysqltest.test218
-rw-r--r--mysql-test/t/ndb_basic.test153
-rw-r--r--mysql-test/t/ndb_blob.test184
-rw-r--r--mysql-test/t/ndb_insert.test15
-rw-r--r--mysql-test/t/ps.test4
-rw-r--r--mysql-test/t/ps_10nestset.test13
-rw-r--r--mysql-test/t/ps_7ndb.test2
-rw-r--r--mysql-test/t/range.test15
-rw-r--r--mysql-test/t/rpl_failed_optimize-master.opt1
-rw-r--r--mysql-test/t/rpl_failed_optimize.test18
-rw-r--r--mysql-test/t/show_check.test3
-rw-r--r--mysql-test/t/sql_mode.test31
-rw-r--r--mysql-test/t/temp_table.test6
-rw-r--r--mysql-test/t/type_float.test3
-rw-r--r--mysql-test/t/type_ranges.test3
-rw-r--r--mysql-test/t/user_var.test6
-rw-r--r--mysql-test/t/variables.test1
-rwxr-xr-xndb/home/bin/cvschk569
-rw-r--r--ndb/include/kernel/ndb_limits.h5
-rw-r--r--ndb/include/kernel/signaldata/DictTabInfo.hpp1
-rw-r--r--ndb/include/ndb_global.h9
-rw-r--r--ndb/include/ndbapi/NdbBlob.hpp47
-rw-r--r--ndb/include/ndbapi/NdbConnection.hpp4
-rw-r--r--ndb/include/ndbapi/NdbIndexOperation.hpp4
-rw-r--r--ndb/include/ndbapi/NdbOperation.hpp9
-rw-r--r--ndb/include/ndbapi/ndbapi_limits.h9
-rw-r--r--ndb/include/util/ndb_opts.h57
-rw-r--r--ndb/src/common/editline/complete.c16
-rw-r--r--ndb/src/common/editline/editline.c16
-rw-r--r--ndb/src/common/editline/editline_internal.h16
-rw-r--r--ndb/src/common/editline/sysunix.c25
-rw-r--r--ndb/src/common/editline/unix.h16
-rw-r--r--ndb/src/common/util/Makefile.am4
-rw-r--r--ndb/src/common/util/basestring_vsnprintf.c25
-rw-r--r--ndb/src/common/util/getarg.3315
-rw-r--r--ndb/src/common/util/getarg.3.ps458
-rw-r--r--ndb/src/common/util/md5-rfc1321.txt1179
-rw-r--r--ndb/src/common/util/socket_io.cpp39
-rw-r--r--ndb/src/common/util/strlcat.c48
-rw-r--r--ndb/src/common/util/strlcpy.c57
-rw-r--r--ndb/src/cw/cpcc-win32/csharp/AssemblyInfo.cs58
-rw-r--r--ndb/src/cw/cpcc-win32/vb6/frmSplash.frm159
-rw-r--r--ndb/src/cw/cpcd/common.cpp63
-rw-r--r--ndb/src/cw/cpcd/common.hpp3
-rw-r--r--ndb/src/cw/cpcd/main.cpp75
-rw-r--r--ndb/src/external/LINUX.x86/sci/include/list.h56
-rw-r--r--ndb/src/external/LINUX.x86/sci/include/os/inttypes.h53
-rw-r--r--ndb/src/external/LINUX.x86/sci/include/rmlib.h212
-rw-r--r--ndb/src/external/LINUX.x86/sci/include/sci_errno.h216
-rw-r--r--ndb/src/external/LINUX.x86/sci/include/sci_types.h300
-rw-r--r--ndb/src/external/LINUX.x86/sci/include/sisci_api.h2170
-rw-r--r--ndb/src/external/LINUX.x86/sci/include/sisci_demolib.h226
-rw-r--r--ndb/src/external/LINUX.x86/sci/include/sisci_error.h89
-rw-r--r--ndb/src/external/LINUX.x86/sci/include/sisci_types.h133
-rw-r--r--ndb/src/external/LINUX.x86/sci/include/sisci_version.h91
-rw-r--r--ndb/src/external/LINUX.x86/sci/include/version.h25
-rw-r--r--ndb/src/external/SOLARIS.SPARC/sci/include/sisci_api.h2148
-rw-r--r--ndb/src/external/SOLARIS.SPARC/sci/include/sisci_error.h89
-rw-r--r--ndb/src/external/SOLARIS.SPARC/sci/include/sisci_types.h133
-rw-r--r--ndb/src/external/SOLARIS.SPARC/sci/include/sisci_version.h91
-rw-r--r--ndb/src/external/WIN32.x86/sci/include/rmlib.h212
-rw-r--r--ndb/src/external/WIN32.x86/sci/include/scilib.h330
-rw-r--r--ndb/src/external/WIN32.x86/sci/include/sisci_api.h2217
-rw-r--r--ndb/src/external/WIN32.x86/sci/include/sisci_demolib.h226
-rw-r--r--ndb/src/external/WIN32.x86/sci/include/sisci_error.h94
-rw-r--r--ndb/src/external/WIN32.x86/sci/include/sisci_types.h133
-rw-r--r--ndb/src/kernel/blocks/backup/restore/main.cpp178
-rw-r--r--ndb/src/kernel/blocks/dbacc/DbaccMain.cpp17
-rw-r--r--ndb/src/kernel/blocks/dbdict/Dbdict.cpp5
-rw-r--r--ndb/src/kernel/blocks/dblqh/DblqhMain.cpp2
-rw-r--r--ndb/src/kernel/error/ErrorReporter.cpp2
-rw-r--r--ndb/src/kernel/main.cpp8
-rw-r--r--ndb/src/kernel/vm/Configuration.cpp136
-rw-r--r--ndb/src/kernel/vm/Configuration.hpp2
-rw-r--r--ndb/src/kernel/vm/Emulator.hpp1
-rw-r--r--ndb/src/kernel/vm/LongSignal.hpp2
-rw-r--r--ndb/src/mgmclient/main.cpp77
-rw-r--r--ndb/src/mgmsrv/MgmtSrvr.cpp15
-rw-r--r--ndb/src/mgmsrv/MgmtSrvr.hpp1
-rw-r--r--ndb/src/mgmsrv/Services.cpp22
-rw-r--r--ndb/src/mgmsrv/main.cpp133
-rw-r--r--ndb/src/ndbapi/Ndb.cpp7
-rw-r--r--ndb/src/ndbapi/NdbBlob.cpp404
-rw-r--r--ndb/src/ndbapi/NdbConnection.cpp20
-rw-r--r--ndb/src/ndbapi/NdbDictionaryImpl.cpp7
-rw-r--r--ndb/src/ndbapi/NdbIndexOperation.cpp26
-rw-r--r--ndb/src/ndbapi/NdbOperation.cpp4
-rw-r--r--ndb/src/ndbapi/NdbOperationExec.cpp14
-rw-r--r--ndb/src/ndbapi/NdbScanOperation.cpp4
-rw-r--r--ndb/src/ndbapi/TransporterFacade.cpp159
-rw-r--r--ndb/src/ndbapi/TransporterFacade.hpp10
-rw-r--r--ndb/src/ndbapi/ndberror.c2
-rw-r--r--ndb/test/include/getarg.h (renamed from ndb/include/util/getarg.h)0
-rw-r--r--ndb/test/ndbapi/testBlobs.cpp224
-rw-r--r--ndb/test/odbc/tpcb/Makefile30
-rw-r--r--ndb/test/odbc/tpcb/Makefile_mysql33
-rw-r--r--ndb/test/odbc/tpcb/Makefile_ndb30
-rw-r--r--ndb/test/odbc/tpcb/readme.txt15
-rw-r--r--ndb/test/odbc/tpcb/timesten.h188
-rw-r--r--ndb/test/odbc/tpcb/tpcb.cpp1415
-rw-r--r--ndb/test/odbc/tpcb/ttTime.c366
-rw-r--r--ndb/test/odbc/tpcb/ttTime.h125
-rw-r--r--ndb/test/run-test/Makefile.am3
-rw-r--r--ndb/test/run-test/main.cpp2
-rw-r--r--ndb/test/src/Makefile.am2
-rw-r--r--ndb/test/src/getarg.c (renamed from ndb/src/common/util/getarg.c)32
-rw-r--r--ndb/tools/delete_all.cpp73
-rw-r--r--ndb/tools/desc.cpp82
-rw-r--r--ndb/tools/drop_index.cpp70
-rw-r--r--ndb/tools/drop_tab.cpp77
-rw-r--r--ndb/tools/listTables.cpp104
-rw-r--r--ndb/tools/select_all.cpp124
-rw-r--r--ndb/tools/select_count.cpp82
-rw-r--r--ndb/tools/waiter.cpp74
-rw-r--r--sql/field.cc19
-rw-r--r--sql/ha_berkeley.cc10
-rw-r--r--sql/ha_innodb.cc30
-rw-r--r--sql/ha_innodb.h4
-rw-r--r--sql/ha_ndbcluster.cc177
-rw-r--r--sql/ha_ndbcluster.h24
-rw-r--r--sql/item.cc137
-rw-r--r--sql/item.h29
-rw-r--r--sql/item_cmpfunc.cc98
-rw-r--r--sql/item_create.cc5
-rw-r--r--sql/item_func.cc138
-rw-r--r--sql/item_func.h7
-rw-r--r--sql/item_geofunc.cc6
-rw-r--r--sql/item_strfunc.cc74
-rw-r--r--sql/item_subselect.cc35
-rw-r--r--sql/item_sum.cc32
-rw-r--r--sql/item_timefunc.cc10
-rw-r--r--sql/log_event.cc8
-rw-r--r--sql/mysql_priv.h2
-rw-r--r--sql/mysqld.cc11
-rw-r--r--sql/net_serv.cc12
-rw-r--r--sql/opt_range.cc53
-rw-r--r--sql/parse_file.cc26
-rw-r--r--sql/protocol.cc12
-rw-r--r--sql/protocol.h1
-rw-r--r--sql/repl_failsafe.cc2
-rw-r--r--sql/set_var.cc2
-rw-r--r--sql/sp.cc22
-rw-r--r--sql/sp_head.cc28
-rw-r--r--sql/sp_head.h2
-rw-r--r--sql/spatial.cc4
-rw-r--r--sql/sql_acl.cc10
-rw-r--r--sql/sql_base.cc31
-rw-r--r--sql/sql_class.cc24
-rw-r--r--sql/sql_class.h32
-rw-r--r--sql/sql_db.cc2
-rw-r--r--sql/sql_error.cc6
-rw-r--r--sql/sql_help.cc14
-rw-r--r--sql/sql_insert.cc4
-rw-r--r--sql/sql_list.h12
-rw-r--r--sql/sql_parse.cc40
-rw-r--r--sql/sql_prepare.cc31
-rw-r--r--sql/sql_select.cc38
-rw-r--r--sql/sql_select.h2
-rw-r--r--sql/sql_show.cc12
-rw-r--r--sql/sql_string.cc28
-rw-r--r--sql/sql_string.h4
-rw-r--r--sql/sql_table.cc22
-rw-r--r--sql/sql_trigger.cc22
-rw-r--r--sql/sql_union.cc17
-rw-r--r--sql/sql_view.cc8
-rw-r--r--sql/sql_yacc.yy18
-rw-r--r--sql/table.cc15
-rw-r--r--sql/thr_malloc.cc7
-rw-r--r--strings/ctype-sjis.c9
-rw-r--r--tests/client_test.c1350
245 files changed, 10300 insertions, 17015 deletions
diff --git a/.bzrignore b/.bzrignore
index c83b4ed4388..d12c7902bfb 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -519,6 +519,7 @@ mysql-max-4.0.2-alpha-pc-linux-gnu-i686.tar.gz
mysql-test/gmon.out
mysql-test/install_test_db
mysql-test/mysql-test-run
+mysql-test/mysql_test_run_new
mysql-test/ndb/ndbcluster
mysql-test/r/*.reject
mysql-test/r/index_merge_load.result
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok
index e7152099ed3..f09109774f9 100644
--- a/BitKeeper/etc/logging_ok
+++ b/BitKeeper/etc/logging_ok
@@ -98,12 +98,14 @@ kaj@work.mysql.com
kent@mysql.com
konstantin@mysql.com
kostja@oak.local
+lars@mysql.com
lenz@kallisto.mysql.com
lenz@mysql.com
magnus@neptunus.(none)
magnus@shellback.(none)
marko@hundin.mysql.fi
matt@mysql.com
+matthias@three.local.lan
miguel@hegel.(none)
miguel@hegel.br
miguel@hegel.local
diff --git a/Docs/Support/texi2html b/Docs/Support/texi2html
index 8067d8f72ce..f13c006c7dc 100755
--- a/Docs/Support/texi2html
+++ b/Docs/Support/texi2html
@@ -1,4 +1,4 @@
-#!PATH_TO_PERL -*- perl -*-
+#!/usr/bin/perl
# Add path to perl on the previous line and make this executable
# if you want to use this as a normal script.
'di ';
@@ -12,7 +12,7 @@
#-##############################################################################
# @(#)texi2html 1.52 971230 Written (mainly) by Lionel Cons, Lionel.Cons@cern.ch
-# Enhanced by David Axmark, david@detron.se
+# Enhanced by David Axmark
# The man page for this program is included at the end of this file and can be
# viewed using the command 'nroff -man texi2html'.
@@ -40,8 +40,7 @@ $NODESRE = '[^@{}:\'`"]+'; # RE for a list of node names
$XREFRE = '[^@{}]+'; # RE for a xref (should use NODERE)
$ERROR = "***"; # prefix for errors and warnings
-$THISPROG = "texi2html 1.52 (hacked by david\@detron.se)"; # program name and version
-$HOMEPAGE = "http://www.mathematik.uni-kl.de/~obachman/Texi2html/"; # program home page
+$THISPROG = "texi2html 1.52 (with additions by MySQL AB)"; # program name and version
$TODAY = &pretty_date; # like "20 September 1993"
$SPLITTAG = "<!-- SPLIT HERE -->\n"; # tag to know where to split
$PROTECTTAG = "_ThisIsProtected_"; # tag to recognize protected sections
@@ -114,10 +113,12 @@ $html2_doctype = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0 Strict Level 2//E
#
%accent_map = (
'"', 'uml',
+ '\'', 'acute',
+ ',{', 'cedil',
'~', 'tilde',
'^', 'circ',
'`', 'grave',
- '\'', 'acute',
+ 'ringaccent{', 'ring',
);
#
@@ -125,7 +126,7 @@ $html2_doctype = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0 Strict Level 2//E
#
%simple_map = (
# cf. makeinfo.c
- "*", "<BR>", # HTML+
+ "*", "<br />", # HTML+
" ", " ",
"\n", "\n",
"|", "",
@@ -134,6 +135,8 @@ $html2_doctype = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0 Strict Level 2//E
"!", "!",
"?", "?",
".", ".",
+ # @- means "allow word break", not &mdash;
+ "-", "",
);
#
@@ -141,9 +144,10 @@ $html2_doctype = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0 Strict Level 2//E
#
%things_map = (
'TeX', 'TeX',
- 'br', '<P>', # paragraph break
+ 'br', '<p>', # paragraph break
'bullet', '*',
'copyright', '(C)',
+ 'registeredsymbol', '(R)',
'dots', '...',
'equiv', '==',
'error', 'error-->',
@@ -161,27 +165,28 @@ $html2_doctype = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0 Strict Level 2//E
%style_map = (
'asis', '',
'b', 'B',
- 'cite', 'CITE',
- 'code', 'CODE',
+ 'cite', 'cite',
+ 'code', 'code',
+ 'command', 'code',
'ctrl', '&do_ctrl', # special case
- 'dfn', 'STRONG', # DFN tag is illegal in the standard
+ 'dfn', 'strong', # DFN tag is illegal in the standard
'dmn', '', # useless
'email', '&fix_email', # special
- 'emph', 'EM',
- 'file', '"TT', # will put quotes, cf. &apply_style
- 'i', 'I',
- 'kbd', 'KBD',
- 'key', 'KBD',
+ 'emph', 'em',
+ 'file', '"tt', # will put quotes, cf. &apply_style
+ 'i', 'i',
+ 'kbd', 'kbd',
+ 'key', 'kbd',
'r', '', # unsupported
- 'samp', '"SAMP', # will put quotes, cf. &apply_style
+ 'samp', '"samp', # will put quotes, cf. &apply_style
'sc', '&do_sc', # special case
- 'strong', 'STRONG',
- 't', 'TT',
+ 'strong', 'strong',
+ 't', 'tt',
'titlefont', '', # useless
'image', '&fix_image', # Image
'url', '&fix_url', # URL
'uref', '&fix_uref', # URL Reference
- 'var', 'VAR',
+ 'var', 'var',
'w', '', # unsupported
);
@@ -317,6 +322,7 @@ $usage = <<EOT;
This is $THISPROG
To convert a Texinfo file to HMTL: $0 [options] file
where options can be:
+-acc : convert @"-like accents to &entities;
-expandinfo : use \@ifinfo sections, not \@iftex
-glossary : handle a glossary
-invisible name: use 'name' as an invisible anchor
@@ -445,11 +451,15 @@ $html_num = 0;
if ($use_iso) {
$things_map{'bullet'} = "&bull;";
$things_map{'copyright'} = "&copy;";
+ $things_map{'registeredsymbol'} = "&reg;";
$things_map{'dots'} = "&hellip;";
$things_map{'equiv'} = "&equiv;";
$things_map{'expansion'} = "&rarr;";
$things_map{'point'} = "&lowast;";
$things_map{'result'} = "&rArr;";
+ $things_map{'ss'} = "&szlig;";
+ $things_map{'o'} = "&oslash;";
+ $things_map{'O'} = "&Oslash;";
}
#
@@ -505,23 +515,27 @@ $html_element = ''; # current HTML element
# watch out for regexps, / and escaped characters!
$subst_code = '';
foreach (keys(%simple_map)) {
- ($re = $_) =~ s/(\W)/\\$1/g; # protect regexp chars
- $subst_code .= "s/\\\@$re/$simple_map{$_}/g;\n";
+ $re = quotemeta $_; # protect regexp chars
+ $sub = quotemeta $simple_map{$_};
+ $subst_code .= "s/\\\@$re/$sub/g;\n";
}
foreach (keys(%things_map)) {
- $subst_code .= "s/\\\@$_\\{\\}/$things_map{$_}/g;\n";
+ $re = quotemeta $_; # protect regexp chars
+ $sub = quotemeta $things_map{$_};
+ $subst_code .= "s/\\\@$re\\{\\}/$sub/g;\n";
}
if ($use_acc) {
# accentuated characters
foreach (keys(%accent_map)) {
+ my $brace = /{$/ ? '}' : '';
if ($_ eq "`") {
$subst_code .= "s/$;3";
} elsif ($_ eq "'") {
$subst_code .= "s/$;4";
} else {
- $subst_code .= "s/\\\@\\$_";
+ $subst_code .= "s/\\\@\\Q$_\\E";
}
- $subst_code .= "([aeiou])/&\${1}$accent_map{$_};/gi;\n";
+ $subst_code .= "(\\w)$brace/&\${1}$accent_map{$_};/gi;\n";
}
}
eval("sub simple_substitutions { $subst_code }");
@@ -703,7 +717,7 @@ READ_LINE: while ($_ = &next_line)
s/{[^{}]+}//g);
print "# Multitable with $multitable_cols columns\n"
if $debug and $DEBUG_USER;
- push(@lines, &debug("<TABLE BORDER WIDTH=\"100%\">\n", __LINE__));
+ push(@lines, &debug("<TABLE BORDER>\n", __LINE__));
} else {
warn "$ERROR Bad table line: $_";
}
@@ -873,7 +887,7 @@ READ_LINE: while ($_ = &next_line)
&simple_substitutions;
s/\@value{($VARRE)}/$value{$1}/eg;
s/\@footnote\{/\@footnote$docu_doc\{/g; # mark footnotes, cf. pass 4
- s|\s+\@tab\s*| </TD><TD> |g if ($in_multitable);
+ s/(^|\s+)\@tab\s*/ <\/TD><TD> /g if ($in_multitable);
#
# analyze the tag again
@@ -885,7 +899,7 @@ READ_LINE: while ($_ = &next_line)
$name =~ s/\s+$//;
$level = $sec2level{$tag};
$name = &update_sec_num($tag, $level) . " $name"
- if $number_sections && $tag !~ /^unnumbered/;
+ if $number_sections && $tag !~ /^unnumbered/ && $tag ne 'subsubheading';
if ($tag =~ /heading$/) {
push(@lines, &html_debug("\n", __LINE__));
if ($html_element ne 'body') {
@@ -1079,7 +1093,7 @@ EOC
push(@lines, &debug("</TD></TR>\n", __LINE__))
unless $html_element eq 'TABLE';
&html_pop_if('TR');
- $what =~ s|\s+\@tab\s*| </TD><TD> |g;
+ $what =~ s/(^|\s+)\@tab\s*/ <\/TD><TD> /g;
push(@lines, &debug("<TR><TD>$what\n", __LINE__));
&html_push('TR');
if ($deferred_ref)
@@ -1463,11 +1477,7 @@ print "# end of pass 4\n" if $verbose;
# #
#---############################################################################
-$header = <<EOT;
-<!-- This HTML file has been created by $THISPROG
- from $docu on $TODAY -->
-EOT
-
+ $header = '';
$full_title = $value{'_title'} || $value{'_settitle'} || "Untitled Document";
$title = $value{'_settitle'} || $full_title;
$_ = &substitute_style($full_title);
@@ -1815,8 +1825,10 @@ sub fix_image
die "error in image: '$text'" unless defined($1);
$arg1 = $1;
$arg1 =~ s/@@/@/g;
- $ext = "jpg" if -f "$arg1.jpg";
- $ext = "gif" if -f "$arg1.gif";
+ foreach (@include_dirs) {
+ $ext = "jpg" if -f "$_/$arg1.jpg";
+ $ext = "gif" if -f "$_/$arg1.gif";
+ }
if (defined($ext))
{
"<IMG SRC=\"$arg1.$ext\">";
@@ -2010,7 +2022,7 @@ sub print_toplevel_header
{
local($_);
- &print_header; # pass given arg...
+ &print_header unless $opt_empty_headers; # pass given arg...
print FILE $full_title;
if ($value{'_subtitle'}) {
$value{'_subtitle'} =~ s/\n+$//;
@@ -2042,13 +2054,7 @@ EOT
sub print_toplevel_footer
{
- &print_ruler;
- print FILE <<EOT;
-This document was generated on $TODAY using the
-<A HREF=\"$HOMEPAGE\">texi2html</A>
-translator version 1.52 (extended by davida\@detron.se).</P>
-EOT
- &print_footer;
+ &print_footer unless $opt_empty_headers;
}
sub protect_texi
@@ -2065,8 +2071,10 @@ sub protect_html
{
local($what) = @_;
# protect & < >
- # Avoid loop in & replacement. This instead bugs out for &# in text..
- $what =~ s/\&([^#]|$)/\&\#38;$1/g;
+ # hack for the two entity-like variable reference in existing examples
+ $what =~ s/\&(length|ts);/\&\#38;$1;/g;
+ # this leaves alone entities, but encodes standalone ampersands
+ $what =~ s/\&(?!([a-z0-9]+|#\d+);)/\&\#38;/ig;
$what =~ s/\</\&\#60;/g;
$what =~ s/\>/\&\#62;/g;
# but recognize some HTML things
diff --git a/acinclude.m4 b/acinclude.m4
index 7f25b447f10..671e279a9f3 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -208,7 +208,7 @@ INCLUDES="$INCLUDES $ZLIB_INCLUDES"
LIBS="$LIBS $ZLIB_LIBS"
AC_CACHE_VAL([mysql_cv_compress],
[AC_TRY_LINK([#include <zlib.h>],
- [int link_test() { return compress(0, (unsigned long*) 0, "", 0); }],
+ [return compress(0, (unsigned long*) 0, "", 0);],
[mysql_cv_compress="yes"
AC_MSG_RESULT([ok])],
[mysql_cv_compress="no"])
diff --git a/client/mysqladmin.c b/client/mysqladmin.c
index bccbf29ef83..6258b9685a5 100644
--- a/client/mysqladmin.c
+++ b/client/mysqladmin.c
@@ -108,7 +108,7 @@ static const char *command_names[]= {
};
static TYPELIB command_typelib=
-{ array_elements(command_names)-1,"commands", command_names};
+{ array_elements(command_names)-1,"commands", command_names, NULL};
static struct my_option my_long_options[] =
{
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c
index 8182b95fb83..c670b84db44 100644
--- a/client/mysqlcheck.c
+++ b/client/mysqlcheck.c
@@ -81,8 +81,13 @@ static struct my_option my_long_options[] =
"To check several databases. Note the difference in usage; In this case no tables are given. All name arguments are regarded as databasenames.",
(gptr*) &opt_databases, (gptr*) &opt_databases, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
+#ifdef DBUG_OFF
+ {"debug", '#', "This is a non-debug version. Catch this and exit.",
+ 0, 0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
+#else
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+#endif
{"default-character-set", OPT_DEFAULT_CHARSET,
"Set the default character set.", (gptr*) &default_charset,
(gptr*) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
diff --git a/client/mysqldump.c b/client/mysqldump.c
index af271343ab9..2defee27c7e 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -126,7 +126,7 @@ const char *compatible_mode_names[]=
(1<<10) /* ANSI */\
)
TYPELIB compatible_mode_typelib= {array_elements(compatible_mode_names) - 1,
- "", compatible_mode_names};
+ "", compatible_mode_names, NULL};
static struct my_option my_long_options[] =
@@ -319,7 +319,7 @@ static struct my_option my_long_options[] =
{"comments", 'i', "Write additional information.",
(gptr*) &opt_comments, (gptr*) &opt_comments, 0, GET_BOOL, NO_ARG,
1, 0, 0, 0, 0, 0},
- {"hex-blob", OPT_HEXBLOB, "Dump BLOBs in HEX. this mode does not work with extended-insert",
+ {"hex-blob", OPT_HEXBLOB, "Dump BLOBs in HEX.",
(gptr*) &opt_hex_blob, (gptr*) &opt_hex_blob, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@@ -1543,10 +1543,12 @@ static void dumpTable(uint numFields, char *table)
/*
63 is my_charset_bin. If charsetnr is not 63,
we have not a BLOB but a TEXT column.
- we'll dump it in hex only BLOB columns.
+ we'll dump in hex only BLOB columns.
*/
is_blob= (opt_hex_blob && field->charsetnr == 63 &&
- (field->type == FIELD_TYPE_BLOB ||
+ (field->type == FIELD_TYPE_STRING ||
+ field->type == FIELD_TYPE_VAR_STRING ||
+ field->type == FIELD_TYPE_BLOB ||
field->type == FIELD_TYPE_LONG_BLOB ||
field->type == FIELD_TYPE_MEDIUM_BLOB ||
field->type == FIELD_TYPE_TINY_BLOB)) ? 1 : 0;
@@ -1564,6 +1566,13 @@ static void dumpTable(uint numFields, char *table)
{
if (!IS_NUM_FIELD(field))
{
+ /*
+ "length * 2 + 2" is OK for both HEX and non-HEX modes:
+ - In HEX mode we need exactly 2 bytes per character
+ plus 2 bytes for '0x' prefix.
+ - In non-HEX mode we need up to 2 bytes per character,
+ plus 2 bytes for leading and trailing '\'' characters.
+ */
if (dynstr_realloc(&extended_row,length * 2+2))
{
fputs("Aborting dump (out of memory)",stderr);
@@ -1572,15 +1581,11 @@ static void dumpTable(uint numFields, char *table)
}
if (opt_hex_blob && is_blob)
{
- ulong counter;
- unsigned char *ptr= row[i];
dynstr_append(&extended_row, "0x");
- for (counter = 0; counter < lengths[i]; counter++)
- {
- char xx[3];
- sprintf(xx, "%02X", ptr[counter]);
- dynstr_append(&extended_row, xx);
- }
+ extended_row.length+= mysql_hex_string(extended_row.str +
+ extended_row.length,
+ row[i], length);
+ extended_row.str[extended_row.length]= '\0';
}
else
{
diff --git a/client/mysqltest.c b/client/mysqltest.c
index 420d5316cd4..ee28ca00a31 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -42,7 +42,7 @@
**********************************************************************/
-#define MTEST_VERSION "2.3"
+#define MTEST_VERSION "2.4"
#include <my_global.h>
#include <mysql_embed.h>
@@ -243,6 +243,7 @@ VAR var_reg[10];
HASH var_hash;
my_bool disable_query_log=0, disable_result_log=0, disable_warnings=0;
my_bool disable_info= 1; /* By default off */
+my_bool abort_on_error= 1;
struct connection cons[MAX_CONS];
struct connection* cur_con, *next_con, *cons_end;
@@ -274,6 +275,7 @@ Q_ENABLE_WARNINGS, Q_DISABLE_WARNINGS,
Q_ENABLE_INFO, Q_DISABLE_INFO,
Q_ENABLE_METADATA, Q_DISABLE_METADATA,
Q_EXEC, Q_DELIMITER,
+Q_DISABLE_ABORT_ON_ERROR, Q_ENABLE_ABORT_ON_ERROR,
Q_DISPLAY_VERTICAL_RESULTS, Q_DISPLAY_HORIZONTAL_RESULTS,
Q_QUERY_VERTICAL, Q_QUERY_HORIZONTAL,
Q_START_TIMER, Q_END_TIMER,
@@ -353,6 +355,8 @@ const char *command_names[]=
"disable_metadata",
"exec",
"delimiter",
+ "disable_abort_on_error",
+ "enable_abort_on_error",
"vertical_results",
"horizontal_results",
"query_vertical",
@@ -741,7 +745,7 @@ err:
DBUG_RETURN(0);
}
-static VAR* var_obtain(char* name, int len)
+static VAR *var_obtain(const char* name, int len)
{
VAR* v;
if ((v = (VAR*)hash_search(&var_hash, name, len)))
@@ -751,28 +755,33 @@ static VAR* var_obtain(char* name, int len)
return v;
}
-int var_set(char* var_name, char* var_name_end, char* var_val,
- char* var_val_end)
+int var_set(const char *var_name, const char *var_name_end,
+ const char *var_val, const char *var_val_end)
{
int digit;
VAR* v;
+ DBUG_ENTER("var_set");
+ DBUG_PRINT("enter", ("var_name: '%.*s' = '%.*s' (length: %d)",
+ (int) (var_name_end - var_name), var_name,
+ (int) (var_val_end - var_val), var_val,
+ (int) (var_val_end - var_val)));
+
if (*var_name++ != '$')
- {
- --var_name;
- *var_name_end = 0;
- die("Variable name in %s does not start with '$'", var_name);
- }
+ {
+ var_name--;
+ die("Variable name in %s does not start with '$'", var_name);
+ }
digit = *var_name - '0';
if (!(digit < 10 && digit >= 0))
- {
- v = var_obtain(var_name, var_name_end - var_name);
- }
+ {
+ v = var_obtain(var_name, (uint) (var_name_end - var_name));
+ }
else
- v = var_reg + digit;
-
+ v = var_reg + digit;
return eval_expr(v, var_val, (const char**)&var_val_end);
}
+
int open_file(const char* name)
{
char buff[FN_REFLEN];
@@ -942,7 +951,6 @@ static void do_exec(struct st_query* q)
while (fgets(buf, sizeof(buf), res_file))
replace_dynstr_append_mem(ds, buf, strlen(buf));
}
-
error= pclose(res_file);
if (error != 0)
@@ -1241,6 +1249,22 @@ int do_let(struct st_query* q)
return var_set(var_name, var_name_end, var_val_start, q->end);
}
+
+/*
+ Store an integer (typically the returncode of the last SQL)
+ statement in the mysqltest builtin variable $mysql_errno, by
+ simulating of a user statement "let $mysql_errno= <integer>"
+*/
+
+int var_set_errno(int sql_errno)
+{
+ const char *var_name= "$mysql_errno";
+ char var_val[21];
+ uint length= my_sprintf(var_val, (var_val, "%d", sql_errno));
+ return var_set(var_name, var_name + 12, var_val, var_val + length);
+}
+
+
int do_rpl_probe(struct st_query* q __attribute__((unused)))
{
DBUG_ENTER("do_rpl_probe");
@@ -1249,12 +1273,14 @@ int do_rpl_probe(struct st_query* q __attribute__((unused)))
DBUG_RETURN(0);
}
+
int do_enable_rpl_parse(struct st_query* q __attribute__((unused)))
{
mysql_enable_rpl_parse(&cur_con->mysql);
return 0;
}
+
int do_disable_rpl_parse(struct st_query* q __attribute__((unused)))
{
mysql_disable_rpl_parse(&cur_con->mysql);
@@ -1998,7 +2024,7 @@ int read_query(struct st_query** q_ptr)
memcpy((gptr) q->expected_errno, (gptr) global_expected_errno,
sizeof(global_expected_errno));
q->expected_errors= global_expected_errors;
- q->abort_on_error= global_expected_errors == 0;
+ q->abort_on_error= (global_expected_errors == 0 && abort_on_error);
bzero((gptr) global_expected_errno, sizeof(global_expected_errno));
global_expected_errors=0;
if (p[0] == '-' && p[1] == '-')
@@ -2407,7 +2433,7 @@ static int run_query(MYSQL *mysql, struct st_query *q, int flags)
if (ps_protocol_enabled && disable_info &&
(flags & QUERY_SEND) && (flags & QUERY_REAP) && ps_match_re(q->query))
- return run_query_stmt (mysql, q, flags);
+ return run_query_stmt(mysql, q, flags);
return run_query_normal(mysql, q, flags);
}
@@ -2644,6 +2670,13 @@ end:
dynstr_free(&ds_tmp);
if (q->type == Q_EVAL)
dynstr_free(&eval_query);
+
+ /*
+ We save the return code (mysql_errno(mysql)) from the last call sent
+ to the server into the mysqltest builtin variable $mysql_errno. This
+ variable then can be used from the test case itself.
+ */
+ var_set_errno(mysql_errno(mysql));
DBUG_RETURN(error);
}
@@ -2993,6 +3026,7 @@ end:
dynstr_free(&ds_tmp);
if (q->type == Q_EVAL)
dynstr_free(&eval_query);
+ var_set_errno(mysql_stmt_errno(stmt));
mysql_stmt_close(stmt);
DBUG_RETURN(error);
}
@@ -3300,7 +3334,7 @@ static VAR* var_from_env(const char *name, const char *def_val)
if (!(tmp = getenv(name)))
tmp = def_val;
- v = var_init(0, name, 0, tmp, 0);
+ v = var_init(0, name, strlen(name), tmp, strlen(tmp));
my_hash_insert(&var_hash, (byte*)v);
return v;
}
@@ -3396,6 +3430,13 @@ int main(int argc, char **argv)
init_var_hash(&cur_con->mysql);
+ /*
+ Initialize $mysql_errno with -1, so we can
+ - distinguish it from valid values ( >= 0 ) and
+ - detect if there was never a command sent to the server
+ */
+ var_set_errno(-1);
+
while (!abort_flag && !read_query(&q))
{
int current_line_inc = 1, processed = 0;
@@ -3415,6 +3456,8 @@ int main(int argc, char **argv)
case Q_DISABLE_RPL_PARSE: do_disable_rpl_parse(q); break;
case Q_ENABLE_QUERY_LOG: disable_query_log=0; break;
case Q_DISABLE_QUERY_LOG: disable_query_log=1; break;
+ case Q_ENABLE_ABORT_ON_ERROR: abort_on_error=1; break;
+ case Q_DISABLE_ABORT_ON_ERROR: abort_on_error=0; break;
case Q_ENABLE_RESULT_LOG: disable_result_log=0; break;
case Q_DISABLE_RESULT_LOG: disable_result_log=1; break;
case Q_ENABLE_WARNINGS: disable_warnings=0; break;
@@ -4476,8 +4519,7 @@ static void get_replace_column(struct st_query *q)
my_free(start, MYF(0));
}
-#ifdef __NETWARE__
-
+#if defined(__NETWARE__) || defined(__WIN__)
/*
Substitute environment variables with text.
@@ -4573,4 +4615,4 @@ FILE *my_popen(const char *cmd, const char *mode __attribute__((unused)))
return res_file;
}
-#endif /* __NETWARE__ */
+#endif /* __NETWARE__ or __WIN__*/
diff --git a/configure.in b/configure.in
index 754494f7d70..d1f683fcfec 100644
--- a/configure.in
+++ b/configure.in
@@ -974,8 +974,11 @@ case $SYSTEM_TYPE-$MACHINE_TYPE-$ac_cv_prog_gcc in
CFLAGS="$CFLAGS -DBIG_TABLES"
CXXFLAGS="$CXXFLAGS -DBIG_TABLES"
;;
+ *) ;;
+esac
+case $SYSTEM_TYPE-$ac_cv_prog_gcc in
# workaround for Sun Forte compile problem for ndb
- *solaris2.10*-sparc-no)
+ *solaris*-no)
ndb_cxxflags_fix="$ndb_cxxflags_fix -instances=static"
;;
*) ;;
@@ -1036,8 +1039,8 @@ case $SYSTEM_TYPE in
;;
*hpux11.*)
echo "Enabling workarounds for hpux 11"
- CFLAGS="$CFLAGS -DHPUX11 -DHAVE_BROKEN_PREAD -DDONT_USE_FINITE -DHAVE_BROKEN_GETPASS -DNO_FCNTL_NONBLOCK -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHAVE_BROKEN_PTHREAD_COND_TIMEDWAIT"
- CXXFLAGS="$CXXFLAGS -DHPUX11 -DHAVE_BROKEN_PREAD -DDONT_USE_FINITE -D_INCLUDE_LONGLONG -DNO_FCNTL_NONBLOCK -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHAVE_BROKEN_PTHREAD_COND_TIMEDWAIT"
+ CFLAGS="$CFLAGS -DHPUX11 -DSNPRINTF_RETURN_TRUNC -DHAVE_BROKEN_PREAD -DDONT_USE_FINITE -DHAVE_BROKEN_GETPASS -DNO_FCNTL_NONBLOCK -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHAVE_BROKEN_PTHREAD_COND_TIMEDWAIT"
+ CXXFLAGS="$CXXFLAGS -DHPUX11 -DSNPRINTF_RETURN_TRUNC -DHAVE_BROKEN_PREAD -DDONT_USE_FINITE -D_INCLUDE_LONGLONG -DNO_FCNTL_NONBLOCK -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHAVE_BROKEN_PTHREAD_COND_TIMEDWAIT"
if test "$with_named_thread" = "no"
then
echo "Using --with-named-thread=-lpthread"
@@ -1143,9 +1146,10 @@ dnl Is this the right match for DEC OSF on alpha?
fi
echo "Adding defines for OSF1"
# gethostbyname_r is deprecated and doesn't work ok on OSF1
- CFLAGS="$CFLAGS -DUNDEF_HAVE_GETHOSTBYNAME_R"
- CXXFLAGS="$CXXFLAGS -DUNDEF_HAVE_GETHOSTBYNAME_R"
- ndb_cxxflags_fix="$ndb_cxxflags_fix -I/usr/include.dtk"
+ CFLAGS="$CFLAGS -DUNDEF_HAVE_GETHOSTBYNAME_R -DSNPRINTF_RETURN_TRUNC"
+ CXXFLAGS="$CXXFLAGS -DUNDEF_HAVE_GETHOSTBYNAME_R -DSNPRINTF_RETURN_TRUNC"
+ # fix to handle include of <stdint.h> correctly on OSF1 with cxx compiler
+ CXXFLAGS="$CXXFLAGS -I/usr/include/cxx -I/usr/include/cxx_cname -I/usr/include -I/usr/include.dtk"
;;
*netware*)
# No need for curses library so set it to null
@@ -1916,7 +1920,7 @@ AC_CHECK_FUNCS(alarm bcmp bfill bmove bzero chsize cuserid fchmod fcntl \
getcwd gethostbyaddr_r gethostbyname_r getpass getpassphrase getpwnam \
getpwuid getrlimit getrusage getwd gmtime_r index initgroups isnan \
localtime_r locking longjmp lrand48 madvise mallinfo memcpy memmove \
- mkstemp mlockall perror poll pread pthread_attr_create clock_gettime \
+ mkstemp mlockall perror poll pread pthread_attr_create \
pthread_attr_getstacksize pthread_attr_setprio pthread_attr_setschedparam \
pthread_attr_setstacksize pthread_condattr_create pthread_getsequence_np \
pthread_key_delete pthread_rwlock_rdlock pthread_setprio \
@@ -1925,6 +1929,18 @@ AC_CHECK_FUNCS(alarm bcmp bfill bmove bzero chsize cuserid fchmod fcntl \
snprintf socket stpcpy strcasecmp strerror strnlen strpbrk strstr strtol \
strtoll strtoul strtoull tell tempnam thr_setconcurrency vidattr)
+#
+#
+#
+case "$target" in
+ *-*-aix4*)
+ # (grr) aix 4.3 has a stub for clock_gettime, (returning ENOSYS)
+ # and using AC_TRY_RUN is hard when cross-compiling
+ ;;
+ *) AC_CHECK_FUNCS(clock_gettime)
+ ;;
+esac
+
# isinf() could be a function or a macro (HPUX)
AC_MSG_CHECKING(for isinf with <math.h>)
AC_TRY_LINK([#include <math.h>], [float f = 0.0; isinf(f)],
diff --git a/include/config-win.h b/include/config-win.h
index d28bb25cd09..946a91d7d42 100644
--- a/include/config-win.h
+++ b/include/config-win.h
@@ -175,6 +175,8 @@ typedef uint rf_SetTimer;
#define sigset(A,B) signal((A),(B))
#define finite(A) _finite(A)
#define sleep(A) Sleep((A)*1000)
+#define popen(A) popen(A,B) _popen((A),(B))
+#define pclose(A) _pclose(A)
#ifndef __BORLANDC__
#define access(A,B) _access(A,B)
diff --git a/include/my_list.h b/include/my_list.h
index 789bbb50f97..f786621e311 100644
--- a/include/my_list.h
+++ b/include/my_list.h
@@ -33,8 +33,8 @@ extern LIST *list_delete(LIST *root,LIST *element);
extern LIST *list_cons(void *data,LIST *root);
extern LIST *list_reverse(LIST *root);
extern void list_free(LIST *root,unsigned int free_data);
-extern unsigned int list_length(LIST *list);
-extern int list_walk(LIST *list,list_walk_action action,gptr argument);
+extern unsigned int list_length(LIST *);
+extern int list_walk(LIST *,list_walk_action action,gptr argument);
#define rest(a) ((a)->next)
#define list_push(a,b) (a)=list_cons((b),(a))
diff --git a/include/mysql.h b/include/mysql.h
index 87c01c9903f..0a7ab09c57b 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -653,23 +653,6 @@ typedef struct st_mysql_methods
#endif
} MYSQL_METHODS;
-#ifdef HAVE_DEPRECATED_411_API
-/* Deprecated calls (since MySQL 4.1.2) */
-
-/* Use mysql_stmt_init + mysql_stmt_prepare instead */
-MYSQL_STMT * STDCALL mysql_prepare(MYSQL * mysql, const char *query,
- unsigned long length);
-#define mysql_execute mysql_stmt_execute
-#define mysql_fetch mysql_stmt_fetch
-#define mysql_fetch_column mysql_stmt_fetch_column
-#define mysql_bind_param mysql_stmt_bind_param
-#define mysql_bind_result mysql_stmt_bind_result
-#define mysql_param_count mysql_stmt_param_count
-#define mysql_param_result mysql_stmt_param_metadata
-#define mysql_get_metadata mysql_stmt_result_metadata
-#define mysql_send_long_data mysql_stmt_send_long_data
-
-#endif /* HAVE_DEPRECATED_411_API */
MYSQL_STMT * STDCALL mysql_stmt_init(MYSQL *mysql);
int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query,
diff --git a/include/mysql_com.h b/include/mysql_com.h
index 09ee5b22286..92a67ac0279 100644
--- a/include/mysql_com.h
+++ b/include/mysql_com.h
@@ -312,13 +312,7 @@ void my_net_local_init(NET *net);
void net_end(NET *net);
void net_clear(NET *net);
my_bool net_realloc(NET *net, unsigned long length);
-
-#ifndef EMBEDDED_LIBRARY /* To be removed by HF */
my_bool net_flush(NET *net);
-#else
-#define net_flush(A)
-#endif
-
my_bool my_net_write(NET *net,const char *packet,unsigned long len);
my_bool net_write_command(NET *net,unsigned char command,
const char *header, unsigned long head_len,
diff --git a/innobase/dict/dict0crea.c b/innobase/dict/dict0crea.c
index 137964b26c1..cbdc0aab53c 100644
--- a/innobase/dict/dict0crea.c
+++ b/innobase/dict/dict0crea.c
@@ -1067,6 +1067,12 @@ dict_create_or_check_foreign_constraint_tables(void)
there are 2 secondary indexes on SYS_FOREIGN, and they
are defined just like below */
+ /* NOTE: when designing InnoDB's foreign key support in 2001, we made
+ an error and made the table names and the foreign key id of type
+ 'CHAR' (internally, really a VARCHAR). We should have made the type
+ VARBINARY, like in other InnoDB system tables, to get a clean
+ design. */
+
str =
"PROCEDURE CREATE_FOREIGN_SYS_TABLES_PROC () IS\n"
"BEGIN\n"
@@ -1284,9 +1290,17 @@ loop:
fputs(".\nA foreign key constraint of name ", ef);
ut_print_name(ef, trx, foreign->id);
fputs("\nalready exists."
- " (Note that internally InnoDB adds 'databasename/'\n"
+ " (Note that internally InnoDB adds 'databasename/'\n"
"in front of the user-defined constraint name).\n",
ef);
+ fputs("Note that InnoDB's FOREIGN KEY system tables store\n"
+ "constraint names as case-insensitive, with the\n"
+ "MySQL standard latin1_swedish_ci collation. If you\n"
+ "create tables or databases whose names differ only in\n"
+ "the character case, then collisions in constraint\n"
+ "names can occur. Workaround: name your constraints\n"
+ "explicitly with unique names.\n",
+ ef);
mutex_exit(&dict_foreign_err_mutex);
diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c
index c3d0d8d9ac1..bc08fc2437e 100644
--- a/innobase/dict/dict0dict.c
+++ b/innobase/dict/dict0dict.c
@@ -156,7 +156,7 @@ dict_index_build_internal_non_clust(
dict_index_t* index); /* in: user representation of a non-clustered
index */
/**************************************************************************
-Removes a foreign constraint struct from the dictionet cache. */
+Removes a foreign constraint struct from the dictionary cache. */
static
void
dict_foreign_remove_from_cache(
@@ -606,7 +606,7 @@ dict_table_get_on_id(
dict_table_t* table;
if (ut_dulint_cmp(table_id, DICT_FIELDS_ID) <= 0
- || trx->dict_operation) {
+ || trx->dict_operation_lock_mode == RW_X_LATCH) {
/* It is a system table which will always exist in the table
cache: we avoid acquiring the dictionary mutex, because
if we are doing a rollback to handle an error in TABLE
diff --git a/innobase/dict/dict0load.c b/innobase/dict/dict0load.c
index d430eadc97b..8fc6eb9141e 100644
--- a/innobase/dict/dict0load.c
+++ b/innobase/dict/dict0load.c
@@ -19,7 +19,9 @@ Created 4/24/1996 Heikki Tuuri
#include "mach0data.h"
#include "dict0dict.h"
#include "dict0boot.h"
+#include "rem0cmp.h"
#include "srv0start.h"
+#include "srv0srv.h"
/************************************************************************
Finds the first table name in the given database. */
@@ -123,6 +125,13 @@ dict_print(void)
ulint len;
mtr_t mtr;
+ /* Enlarge the fatal semaphore wait timeout during the InnoDB table
+ monitor printout */
+
+ mutex_enter(&kernel_mutex);
+ srv_fatal_semaphore_wait_threshold += 7200; /* 2 hours */
+ mutex_exit(&kernel_mutex);
+
mutex_enter(&(dict_sys->mutex));
mtr_start(&mtr);
@@ -145,6 +154,12 @@ loop:
mutex_exit(&(dict_sys->mutex));
+ /* Restore the fatal semaphore wait timeout */
+
+ mutex_enter(&kernel_mutex);
+ srv_fatal_semaphore_wait_threshold -= 7200; /* 2 hours */
+ mutex_exit(&kernel_mutex);
+
return;
}
@@ -1242,12 +1257,26 @@ loop:
rec = btr_pcur_get_rec(&pcur);
field = rec_get_nth_field(rec, 0, &len);
- /* Check if the table name in record is the one searched for */
- if (len != ut_strlen(table_name)
- || 0 != ut_memcmp(field, table_name, len)) {
+ /* Check if the table name in the record is the one searched for; the
+ following call does the comparison in the latin1_swedish_ci
+ charset-collation, in a case-insensitive way. */
+ if (0 != cmp_data_data(dfield_get_type(dfield),
+ dfield_get_data(dfield), dfield_get_len(dfield),
+ field, len)) {
+
goto load_next_index;
}
+
+ /* Since table names in SYS_FOREIGN are stored in a case-insensitive
+ order, we have to check that the table name matches also in a binary
+ string comparison. On Unix, MySQL allows table names that only differ
+ in character case. */
+
+ if (0 != ut_memcmp(field, table_name, len)) {
+
+ goto next_rec;
+ }
if (rec_get_deleted_flag(rec)) {
diff --git a/innobase/eval/eval0eval.c b/innobase/eval/eval0eval.c
index ebb6cb1b7d9..5b2d1f857b1 100644
--- a/innobase/eval/eval0eval.c
+++ b/innobase/eval/eval0eval.c
@@ -627,7 +627,11 @@ eval_concat(
}
/*********************************************************************
-Evaluates a predefined function node. */
+Evaluates a predefined function node. If the first argument is an integer,
+this function looks at the second argument which is the integer length in
+bytes, and converts the integer to a VARCHAR.
+If the first argument is of some other type, this function converts it to
+BINARY. */
UNIV_INLINE
void
eval_to_binary(
@@ -638,12 +642,24 @@ eval_to_binary(
que_node_t* arg2;
dfield_t* dfield;
byte* str1;
+ ulint len;
ulint len1;
arg1 = func_node->args;
str1 = dfield_get_data(que_node_get_val(arg1));
+ if (dtype_get_mtype(que_node_get_data_type(arg1)) != DATA_INT) {
+
+ len = dfield_get_len(que_node_get_val(arg1));
+
+ dfield = que_node_get_val(func_node);
+
+ dfield_set_data(dfield, str1, len);
+
+ return;
+ }
+
arg2 = que_node_get_next(arg1);
len1 = (ulint)eval_node_get_int_val(arg2);
diff --git a/innobase/ibuf/ibuf0ibuf.c b/innobase/ibuf/ibuf0ibuf.c
index b3c8ade2414..2191cdc0ee6 100644
--- a/innobase/ibuf/ibuf0ibuf.c
+++ b/innobase/ibuf/ibuf0ibuf.c
@@ -2866,6 +2866,8 @@ ibuf_delete_rec(
#ifdef UNIV_IBUF_DEBUG
ibuf_count_set(space, page_no, ibuf_count_get(space, page_no) - 1);
+#else
+ UT_NOT_USED(space);
#endif
ibuf_data_sizes_update(ibuf_data, root, mtr);
@@ -3267,11 +3269,11 @@ leave_loop:
ibuf_data->n_merged_recs += n_inserts;
mutex_exit(&ibuf_mutex);
-
+ /*
fprintf(stderr,
"InnoDB: Discarded %lu ibuf entries for space %lu\n",
(ulong) n_inserts, (ulong) space);
-
+ */
ibuf_exit();
mem_heap_free(heap);
diff --git a/innobase/include/lock0lock.h b/innobase/include/lock0lock.h
index 9f525042dcc..f8435e14d97 100644
--- a/innobase/include/lock0lock.h
+++ b/innobase/include/lock0lock.h
@@ -463,6 +463,14 @@ lock_rec_hash(
ulint space, /* in: space */
ulint page_no);/* in: page number */
/*************************************************************************
+Gets the table covered by an IX table lock. */
+
+dict_table_t*
+lock_get_ix_table(
+/*==============*/
+ /* out: the table covered by the lock */
+ lock_t* lock); /* in: table lock */
+/*************************************************************************
Checks that a transaction id is sensible, i.e., not in the future. */
ibool
diff --git a/innobase/include/row0mysql.h b/innobase/include/row0mysql.h
index 581f1bcade3..d4634482752 100644
--- a/innobase/include/row0mysql.h
+++ b/innobase/include/row0mysql.h
@@ -175,8 +175,12 @@ int
row_lock_table_for_mysql(
/*=====================*/
/* out: error code or DB_SUCCESS */
- row_prebuilt_t* prebuilt); /* in: prebuilt struct in the MySQL
+ row_prebuilt_t* prebuilt, /* in: prebuilt struct in the MySQL
table handle */
+ dict_table_t* table); /* in: table to LOCK_IX, or NULL
+ if prebuilt->table should be
+ locked as LOCK_TABLE_EXP |
+ prebuilt->select_lock_type */
/*************************************************************************
Does an insert for MySQL. */
diff --git a/innobase/lock/lock0lock.c b/innobase/lock/lock0lock.c
index 44eee53212a..98def88fa31 100644
--- a/innobase/lock/lock0lock.c
+++ b/innobase/lock/lock0lock.c
@@ -395,6 +395,19 @@ lock_rec_get_nth_bit(
return(ut_bit_get_nth(b, bit_index));
}
+/*************************************************************************
+Gets the table covered by an IX table lock. */
+
+dict_table_t*
+lock_get_ix_table(
+/*==============*/
+ /* out: the table covered by the lock */
+ lock_t* lock) /* in: table lock */
+{
+ ut_a(lock->type_mode == (LOCK_TABLE | LOCK_IX));
+ return(lock->un_member.tab_lock.table);
+}
+
/*************************************************************************/
#define lock_mutex_enter_kernel() mutex_enter(&kernel_mutex)
diff --git a/innobase/pars/pars0pars.c b/innobase/pars/pars0pars.c
index 846cb060a7e..16d630dd318 100644
--- a/innobase/pars/pars0pars.c
+++ b/innobase/pars/pars0pars.c
@@ -259,9 +259,13 @@ pars_resolve_func_data_type(
dtype_set(que_node_get_data_type(node), DATA_VARCHAR,
DATA_ENGLISH, 0, 0);
} else if (func == PARS_TO_BINARY_TOKEN) {
- ut_a(dtype_get_mtype(que_node_get_data_type(arg)) == DATA_INT);
- dtype_set(que_node_get_data_type(node), DATA_VARCHAR,
+ if (dtype_get_mtype(que_node_get_data_type(arg)) == DATA_INT) {
+ dtype_set(que_node_get_data_type(node), DATA_VARCHAR,
DATA_ENGLISH, 0, 0);
+ } else {
+ dtype_set(que_node_get_data_type(node), DATA_BINARY,
+ 0, 0, 0);
+ }
} else if (func == PARS_TO_NUMBER_TOKEN) {
ut_a(dtype_get_mtype(que_node_get_data_type(arg))
== DATA_VARCHAR);
diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c
index 9ca0b7306fc..6ac8c943dc6 100644
--- a/innobase/row/row0mysql.c
+++ b/innobase/row/row0mysql.c
@@ -779,8 +779,12 @@ int
row_lock_table_for_mysql(
/*=====================*/
/* out: error code or DB_SUCCESS */
- row_prebuilt_t* prebuilt) /* in: prebuilt struct in the MySQL
+ row_prebuilt_t* prebuilt, /* in: prebuilt struct in the MySQL
table handle */
+ dict_table_t* table) /* in: table to LOCK_IX, or NULL
+ if prebuilt->table should be
+ locked as LOCK_TABLE_EXP |
+ prebuilt->select_lock_type */
{
trx_t* trx = prebuilt->trx;
que_thr_t* thr;
@@ -813,8 +817,12 @@ run_again:
trx_start_if_not_started(trx);
- err = lock_table(LOCK_TABLE_EXP, prebuilt->table,
- prebuilt->select_lock_type, thr);
+ if (table) {
+ err = lock_table(0, table, LOCK_IX, thr);
+ } else {
+ err = lock_table(LOCK_TABLE_EXP, prebuilt->table,
+ prebuilt->select_lock_type, thr);
+ }
trx->error_state = err;
@@ -2365,7 +2373,8 @@ row_drop_table_for_mysql(
"WHILE found = 1 LOOP\n"
" SELECT ID INTO foreign_id\n"
" FROM SYS_FOREIGN\n"
- " WHERE FOR_NAME = table_name;\n"
+ " WHERE FOR_NAME = table_name\n"
+ " AND TO_BINARY(FOR_NAME) = TO_BINARY(table_name);\n"
" IF (SQL % NOTFOUND) THEN\n"
" found := 0;\n"
" ELSE"
@@ -2820,7 +2829,8 @@ row_rename_table_for_mysql(
"WHILE found = 1 LOOP\n"
" SELECT ID INTO foreign_id\n"
" FROM SYS_FOREIGN\n"
- " WHERE FOR_NAME = old_table_name;\n"
+ " WHERE FOR_NAME = old_table_name\n"
+ " AND TO_BINARY(FOR_NAME) = TO_BINARY(old_table_name);\n"
" IF (SQL % NOTFOUND) THEN\n"
" found := 0;\n"
" ELSE\n"
@@ -2853,7 +2863,8 @@ row_rename_table_for_mysql(
" END IF;\n"
"END LOOP;\n"
"UPDATE SYS_FOREIGN SET REF_NAME = new_table_name\n"
- "WHERE REF_NAME = old_table_name;\n";
+ "WHERE REF_NAME = old_table_name\n"
+ " AND TO_BINARY(REF_NAME) = TO_BINARY(old_table_name);\n";
static const char str5[] =
"END;\n";
@@ -3063,7 +3074,11 @@ row_rename_table_for_mysql(
if (err != DB_SUCCESS) {
if (err == DB_DUPLICATE_KEY) {
ut_print_timestamp(stderr);
- fputs(" InnoDB: Error: table ", stderr);
+ fputs(
+ " InnoDB: Error; possible reasons:\n"
+ "InnoDB: 1) Table rename would cause two FOREIGN KEY constraints\n"
+ "InnoDB: to have the same internal name in case-insensitive comparison.\n"
+ "InnoDB: 2) table ", stderr);
ut_print_name(stderr, trx, new_name);
fputs(" exists in the InnoDB internal data\n"
"InnoDB: dictionary though MySQL is trying rename table ", stderr);
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index 35d01b5bcec..1728407f374 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -1563,7 +1563,8 @@ void my_net_local_init(NET *net)
trailing '. The caller must supply whichever of those is desired.
*/
-ulong mysql_hex_string(char *to, const char *from, ulong length)
+ulong STDCALL
+mysql_hex_string(char *to, const char *from, ulong length)
{
char *to0= to;
const char *end;
@@ -1887,22 +1888,6 @@ my_bool cli_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt)
DBUG_RETURN(0);
}
-#ifdef HAVE_DEPRECATED_411_API
-MYSQL_STMT * STDCALL mysql_prepare(MYSQL *mysql, const char *query,
- unsigned long query_length)
-{
- MYSQL_STMT *stmt;
- DBUG_ENTER("mysql_prepare");
-
- stmt= mysql_stmt_init(mysql);
- if (stmt && mysql_stmt_prepare(stmt, query, query_length))
- {
- mysql_stmt_close(stmt);
- DBUG_RETURN(0);
- }
- DBUG_RETURN(stmt);
-}
-#endif
/*
Allocate memory and init prepared statement structure.
diff --git a/libmysql/libmysql.def b/libmysql/libmysql.def
index bc91e90a41c..c9ff70f208d 100644
--- a/libmysql/libmysql.def
+++ b/libmysql/libmysql.def
@@ -47,6 +47,7 @@ EXPORTS
mysql_errno
mysql_error
mysql_escape_string
+ mysql_hex_string
mysql_stmt_execute
mysql_stmt_fetch
mysql_stmt_fetch_column
diff --git a/myisam/mi_check.c b/myisam/mi_check.c
index 4da388af1c7..1df518a2712 100644
--- a/myisam/mi_check.c
+++ b/myisam/mi_check.c
@@ -2037,7 +2037,7 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
uint ft_max_word_len_for_sort=FT_MAX_WORD_LEN_FOR_SORT*
sort_param.keyinfo->seg->charset->mbmaxlen;
sort_info.max_records=
- (ha_rows) (sort_info.filelength/ft_max_word_len_for_sort+1);
+ (ha_rows) (sort_info.filelength/ft_min_word_len+1);
sort_param.key_read=sort_ft_key_read;
sort_param.key_write=sort_ft_key_write;
diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c
index cad7be2e802..fe285198641 100644
--- a/myisam/myisamchk.c
+++ b/myisam/myisamchk.c
@@ -354,8 +354,12 @@ static void usage(void)
puts("Description, check and repair of MyISAM tables.");
puts("Used without options all tables on the command will be checked for errors");
printf("Usage: %s [OPTIONS] tables[.MYI]\n", my_progname_short);
- printf("\nGlobal options:\n\
- -#, --debug=... Output debug log. Often this is 'd:t:o,filename'.\n\
+ printf("\nGlobal options:\n");
+#ifndef DBUG_OFF
+ printf("\
+ -#, --debug=... Output debug log. Often this is 'd:t:o,filename'.\n");
+#endif
+ printf("\
-?, --help Display this help and exit.\n\
-O, --set-variable var=option.\n\
Change the value of a variable. Please note that\n\
diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am
index c3f9eea875d..ad02d304d1b 100644
--- a/mysql-test/Makefile.am
+++ b/mysql-test/Makefile.am
@@ -36,6 +36,12 @@ test_SCRIPTS = mysql-test-run install_test_db
test_DATA = std_data/client-key.pem std_data/client-cert.pem std_data/cacert.pem
CLEANFILES = $(test_SCRIPTS) $(test_DATA)
+INCLUDES = -I$(srcdir)/../include -I../include -I..
+bin_PROGRAMS = mysql_test_run_new
+noinst_HEADERS = my_manage.h
+mysql_test_run_new_SOURCES= mysql_test_run_new.c my_manage.c
+
+
dist-hook:
mkdir -p $(distdir)/t $(distdir)/r $(distdir)/include \
$(distdir)/std_data
diff --git a/mysql-test/include/ps_modify.inc b/mysql-test/include/ps_modify.inc
index 372fc12b722..04b9734240b 100644
--- a/mysql-test/include/ps_modify.inc
+++ b/mysql-test/include/ps_modify.inc
@@ -321,8 +321,11 @@ select a,b from t1 where a >= 1000 order by a ;
delete from t1 where a >= 1000 ;
## replace
---error 1295
prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
+execute stmt1;
+execute stmt1;
+execute stmt1;
+
## multi table statements
diff --git a/mysql-test/init_db.sql b/mysql-test/init_db.sql
new file mode 100644
index 00000000000..4613e5c0274
--- /dev/null
+++ b/mysql-test/init_db.sql
@@ -0,0 +1,26 @@
+CREATE DATABASE mysql;
+CREATE DATABASE test;
+
+USE mysql;
+
+CREATE TABLE db (Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL, References_priv enum('N','Y') DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db,User), KEY User (User)) comment='Database privileges';
+
+INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');
+INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');
+
+CREATE TABLE host (Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL, References_priv enum('N','Y') DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db)) comment='Host privileges; Merged with database privileges';
+
+CREATE TABLE user (Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Password char(45) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL, Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL, Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL, Process_priv enum('N','Y') DEFAULT 'N' NOT NULL, File_priv enum('N','Y') DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL, References_priv enum('N','Y') DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL, Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL, Super_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL, Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL, Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL, ssl_type enum('','ANY','X509', 'SPECIFIED') DEFAULT '' NOT NULL, ssl_cipher BLOB NOT NULL, x509_issuer BLOB NOT NULL, x509_subject BLOB NOT NULL, max_questions int(11) unsigned DEFAULT 0 NOT NULL, max_updates int(11) unsigned DEFAULT 0 NOT NULL, max_connections int(11) unsigned DEFAULT 0 NOT NULL, PRIMARY KEY Host (Host,User)) comment='Users and global privileges';
+
+INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
+INSERT INTO user VALUES ('','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
+
+INSERT INTO user (host,user) values ('localhost','');
+INSERT INTO user (host,user) values ('','');
+
+CREATE TABLE func (name char(64) binary DEFAULT '' NOT NULL, ret tinyint(1) DEFAULT '0' NOT NULL, dl char(128) DEFAULT '' NOT NULL, type enum ('function','aggregate') NOT NULL, PRIMARY KEY (name)) comment='User defined functions';
+
+CREATE TABLE tables_priv (Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(60) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp(14), Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor)) comment='Table privileges';
+
+CREATE TABLE columns_priv (Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp(14), Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name)) comment='Column privileges';
+
diff --git a/mysql-test/my_manage.c b/mysql-test/my_manage.c
new file mode 100644
index 00000000000..ba5c674d105
--- /dev/null
+++ b/mysql-test/my_manage.c
@@ -0,0 +1,851 @@
+/*
+ Copyright (c) 2003 Novell, Inc. All Rights Reserved.
+
+ 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
+*/
+
+#include <stdio.h>
+#include <errno.h>
+#ifndef __WIN__
+#include <dirent.h>
+#endif
+#include <string.h>
+#ifdef __NETWARE__
+#include <screen.h>
+#include <proc.h>
+#else
+#include <sys/types.h>
+#ifndef __WIN__
+#include <sys/wait.h>
+#include <unistd.h>
+#include <fnmatch.h>
+#else
+#include <direct.h>
+#include <stdlib.h>
+#include <stdio.h>
+#endif
+#endif
+#include <ctype.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <assert.h>
+
+#include "my_manage.h"
+
+#ifndef __NETWARE__
+#define ASSERT assert
+extern char **environ;
+#endif
+
+
+
+/******************************************************************************
+
+ macros
+
+******************************************************************************/
+
+/******************************************************************************
+
+ global variables
+
+******************************************************************************/
+
+/******************************************************************************
+
+ functions
+
+******************************************************************************/
+
+/******************************************************************************
+
+ init_args()
+
+ Init an argument list.
+
+******************************************************************************/
+
+void init_args(arg_list_t *al)
+{
+ ASSERT(al != NULL);
+
+ al->argc= 0;
+ al->size= ARG_BUF;
+ al->argv= malloc(al->size * sizeof(char *));
+ ASSERT(al->argv != NULL);
+
+ return;
+}
+
+/******************************************************************************
+
+ add_arg()
+
+ Add an argument to a list.
+
+******************************************************************************/
+
+void add_arg(arg_list_t *al, const char *format, ...)
+{
+ va_list ap;
+ char temp[PATH_MAX];
+
+ ASSERT(al != NULL);
+
+ /* increase size */
+ if (al->argc >= (int)al->size)
+ {
+ al->size+= ARG_BUF;
+ al->argv= realloc(al->argv, al->size * sizeof(char *));
+ ASSERT(al->argv != NULL);
+ }
+
+ if (format)
+ {
+ va_start(ap, format);
+ vsprintf(temp, format, ap);
+ va_end(ap);
+
+ al->argv[al->argc]= malloc(strlen(temp)+1);
+ ASSERT(al->argv[al->argc] != NULL);
+ strcpy(al->argv[al->argc], temp);
+
+ ++(al->argc);
+ }
+ else
+ {
+ al->argv[al->argc]= NULL;
+ }
+
+ return;
+}
+
+/******************************************************************************
+
+ free_args()
+
+ Free an argument list.
+
+******************************************************************************/
+
+void free_args(arg_list_t *al)
+{
+ int i;
+
+ ASSERT(al != NULL);
+
+ for (i= 0; i < al->argc; i++)
+ {
+ ASSERT(al->argv[i] != NULL);
+ free(al->argv[i]);
+ al->argv[i]= NULL;
+ }
+
+ free(al->argv);
+ al->argc= 0;
+ al->argv= NULL;
+
+ return;
+}
+
+/******************************************************************************
+
+ sleep_until_file_deleted()
+
+ Sleep until the given file is no longer found.
+
+******************************************************************************/
+
+#ifndef __WIN__
+int sleep_until_file_deleted(char *pid_file)
+#else
+int sleep_until_file_deleted(HANDLE pid_file)
+#endif
+{
+ int err= 0; /* Initiate to supress warning */
+#ifndef __WIN__
+ struct stat buf;
+ int i;
+
+ for (i= 0; (i < TRY_MAX) && (err= !stat(pid_file, &buf)); i++) sleep(1);
+
+ if (err != 0) err= errno;
+#else
+ err= (WaitForSingleObject(pid_file, TRY_MAX*1000) == WAIT_TIMEOUT);
+#endif
+ return err;
+}
+
+/******************************************************************************
+
+ sleep_until_file_exists()
+
+ Sleep until the given file exists.
+
+******************************************************************************/
+
+#ifndef __WIN__
+int sleep_until_file_exists(char *pid_file)
+#else
+int sleep_until_file_exists(HANDLE pid_file)
+#endif
+{
+ int err= 0; /* Initiate to supress warning */
+#ifndef __WIN__
+ struct stat buf;
+ int i;
+
+ for (i= 0; (i < TRY_MAX) && (err= stat(pid_file, &buf)); i++) sleep(1);
+
+ if (err != 0) err= errno;
+#else
+ err= (WaitForSingleObject(pid_file, TRY_MAX*1000) == WAIT_TIMEOUT);
+#endif
+ return err;
+}
+
+/******************************************************************************
+
+ wait_for_server_start()
+
+ Wait for the server on the given port to start.
+
+******************************************************************************/
+
+int wait_for_server_start(char *bin_dir __attribute__((unused)),
+ char *mysqladmin_file,
+ char *user, char *password, int port,char *tmp_dir)
+{
+ arg_list_t al;
+ int err= 0, i;
+ char trash[PATH_MAX];
+
+ /* mysqladmin file */
+ snprintf(trash, PATH_MAX, "%s/trash.out",tmp_dir);
+
+ /* args */
+ init_args(&al);
+ add_arg(&al, "%s", mysqladmin_file);
+ add_arg(&al, "--no-defaults");
+ add_arg(&al, "--port=%u", port);
+ add_arg(&al, "--user=%s", user);
+ add_arg(&al, "--password=%s", password);
+ add_arg(&al, "--silent");
+
+/* #ifdef NOT_USED */
+#ifndef __NETWARE__
+ add_arg(&al, "-O");
+ add_arg(&al, "connect_timeout=10");
+ add_arg(&al, "-w");
+#endif
+
+ add_arg(&al, "--host=localhost");
+#ifndef __NETWARE__
+ add_arg(&al, "--protocol=tcp");
+#endif
+ add_arg(&al, "ping");
+
+ /*
+ NetWare does not support the connect timeout in the TCP/IP stack
+ -- we will try the ping multiple times
+ */
+#ifndef __WIN__
+ for (i= 0; (i < TRY_MAX)
+ && (err= spawn(mysqladmin_file, &al, TRUE, NULL,
+ trash, NULL, NULL)); i++) sleep(1);
+#else
+ err= spawn(mysqladmin_file, &al, TRUE, NULL,trash, NULL, NULL);
+#endif
+
+ /* free args */
+ free_args(&al);
+
+ return err;
+}
+
+/******************************************************************************
+
+ spawn()
+
+ Spawn the given path with the given arguments.
+
+******************************************************************************/
+
+#ifdef __NETWARE__
+int spawn(char *path, arg_list_t *al, int join, char *input,
+ char *output, char *error, char *pid_file)
+{
+ pid_t pid;
+ int result= 0;
+ wiring_t wiring= { FD_UNUSED, FD_UNUSED, FD_UNUSED };
+ unsigned long flags= PROC_CURRENT_SPACE | PROC_INHERIT_CWD;
+
+ /* open wiring */
+ if (input)
+ wiring.infd= open(input, O_RDONLY);
+
+ if (output)
+ wiring.outfd= open(output, O_WRONLY | O_CREAT | O_TRUNC);
+
+ if (error)
+ wiring.errfd= open(error, O_WRONLY | O_CREAT | O_TRUNC);
+
+ /* procve requires a NULL */
+ add_arg(al, NULL);
+
+ /* go */
+ pid= procve(path, flags, NULL, &wiring, NULL, NULL, 0,
+ NULL, (const char **)al->argv);
+
+ /* close wiring */
+ if (wiring.infd != -1)
+ close(wiring.infd);
+
+ if (wiring.outfd != -1)
+ close(wiring.outfd);
+
+ if (wiring.errfd != -1)
+ close(wiring.errfd);
+
+ return result;
+}
+#elif __WIN__
+
+int spawn(char *path, arg_list_t *al, int join, char *input,
+ char *output, char *error, HANDLE *pid)
+{
+ intptr_t result;
+ int i;
+ STARTUPINFO startup_info;
+ PROCESS_INFORMATION process_information;
+ DWORD exit_code;
+ char win_args[1024]= "";
+ char command_line[1024]= "";
+
+ /* Skip the first parameter */
+ for (i= 1; i < al->argc; i++)
+ {
+ ASSERT(al->argv[i] != NULL);
+ strcat(win_args,al->argv[i]);
+ strcat(win_args," ");
+ }
+
+ memset(&startup_info,0,sizeof(STARTUPINFO));
+ startup_info.cb= sizeof(STARTUPINFO);
+
+ if (input)
+ freopen(input, "rb", stdin);
+
+ if (output)
+ freopen(output, "wb", stdout);
+
+ if (error)
+ freopen(error, "wb", stderr);
+
+ result= CreateProcess(
+ path,
+ (LPSTR)&win_args,
+ NULL,
+ NULL,
+ TRUE,
+ 0,
+ NULL,
+ NULL,
+ &startup_info,
+ &process_information
+ );
+
+ if (result && process_information.hProcess)
+ {
+ if (join)
+ {
+ if (WaitForSingleObject(process_information.hProcess, mysqld_timeout)
+ == WAIT_TIMEOUT)
+ {
+ exit_code= -1;
+ }
+ else
+ {
+ GetExitCodeProcess(process_information.hProcess, &exit_code);
+ }
+ CloseHandle(process_information.hProcess);
+ }
+ else
+ {
+ exit_code= 0;
+ }
+ if (pid != NULL)
+ *pid= process_information.hProcess;
+ }
+ else
+ {
+ exit_code= -1;
+ }
+ if (input)
+ freopen("CONIN$","rb",stdin);
+ if (output)
+ freopen("CONOUT$","wb",stdout);
+ if (error)
+ freopen("CONOUT$","wb",stderr);
+
+ return exit_code;
+}
+#else
+int spawn(char *path, arg_list_t *al, int join, char *input,
+ char *output, char *error, char *pid_file __attribute__((unused)))
+{
+ pid_t pid;
+ int res_exec= 0;
+ int result= 0;
+
+ pid= fork();
+
+ if (pid == -1)
+ {
+ fprintf(stderr, "fork was't created\n");
+ /* We can't create the fork...exit with error */
+ return EXIT_FAILURE;
+ }
+
+ if (pid > 0)
+ {
+ /* The parent process is waiting for child process if join is not zero */
+ if (join)
+ {
+ waitpid(pid, &result, 0);
+ if (WIFEXITED(result) != 0)
+ {
+ result= WEXITSTATUS(result);
+ }
+ else
+ {
+ result= EXIT_FAILURE;
+ }
+ }
+ }
+ else
+ {
+
+ /* Child process */
+ add_arg(al, NULL);
+
+ /* Reassign streams */
+ if (input)
+ freopen(input, "r", stdin);
+
+ if (output)
+ freopen(output, "w", stdout);
+
+ if (error)
+ freopen(error, "w", stderr);
+
+ /* Spawn the process */
+ if ((res_exec= execve(path, al->argv, environ)) < 0)
+ exit(EXIT_FAILURE);
+
+ /* Restore streams */
+ if (input)
+ freopen("/dev/tty", "r", stdin);
+
+ if (output)
+ freopen("/dev/tty", "w", stdout);
+
+ if (error)
+ freopen("/dev/tty", "w", stderr);
+
+ exit(0);
+ }
+
+ return result;
+}
+#endif
+/******************************************************************************
+
+ stop_server()
+
+ Stop the server with the given port and pid file.
+
+******************************************************************************/
+
+int stop_server(char *bin_dir __attribute__((unused)), char *mysqladmin_file,
+ char *user, char *password, int port,
+#ifndef __WIN__
+ char *pid_file,
+#else
+ HANDLE pid_file,
+#endif
+ char *tmp_dir)
+{
+ arg_list_t al;
+ int err= 0;
+ char trash[PATH_MAX];
+
+ snprintf(trash, PATH_MAX, "%s/trash.out",tmp_dir);
+
+ /* args */
+ init_args(&al);
+ add_arg(&al, "%s", mysqladmin_file);
+ add_arg(&al, "--no-defaults");
+ add_arg(&al, "--port=%u", port);
+ add_arg(&al, "--user=%s", user);
+ add_arg(&al, "--password=%s", password);
+ add_arg(&al, "-O");
+ add_arg(&al, "shutdown_timeout=20");
+#ifndef __NETWARE__
+ add_arg(&al, "--protocol=tcp");
+#endif
+ add_arg(&al, "shutdown");
+
+ /* spawn */
+ if ((err= spawn(mysqladmin_file, &al, TRUE, NULL,
+ trash, NULL, NULL)) == 0)
+ {
+ sleep_until_file_deleted(pid_file);
+ }
+ else
+ {
+#ifndef __WIN__
+ pid_t pid= get_server_pid(pid_file);
+
+ /* shutdown failed - kill server */
+ kill_server(pid);
+
+ sleep(TRY_MAX);
+
+ /* remove pid file if possible */
+ err= remove(pid_file);
+#else
+ TerminateProcess(pid_file,err);
+#endif
+ }
+
+ /* free args */
+ free_args(&al);
+
+ return err;
+}
+
+/******************************************************************************
+
+ get_server_pid()
+
+ Get the VM id with the given pid file.
+
+******************************************************************************/
+
+#ifndef __WIN__
+pid_t get_server_pid(char *pid_file)
+{
+ char buf[PATH_MAX];
+ int fd, err;
+ char *p;
+ pid_t id= 0;
+
+ /* discover id */
+ fd= open(pid_file, O_RDONLY);
+
+ err= read(fd, buf, PATH_MAX);
+
+ close(fd);
+
+ if (err > 0)
+ {
+ /* terminate string */
+ if ((p= strchr(buf, '\n')) != NULL)
+ {
+ *p= '\0';
+
+ /* check for a '\r' */
+ if ((p= strchr(buf, '\r')) != NULL)
+ {
+ *p= '\0';
+ }
+ }
+ else
+ {
+ buf[err]= '\0';
+ }
+
+ id= strtol(buf, NULL, 0);
+ }
+
+ return id;
+}
+
+/******************************************************************************
+
+ kill_server()
+
+ Force a kill of the server with the given pid.
+
+******************************************************************************/
+
+void kill_server(pid_t pid)
+{
+ if (pid > 0)
+ {
+#if !defined(__NETWARE__)
+ /* Send SIGTERM to pid */
+ kill(pid, SIGTERM);
+#else /* __NETWARE__ */
+ /* destroy vm */
+ NXVmDestroy(pid);
+#endif
+ }
+}
+#endif
+/******************************************************************************
+
+ del_tree()
+
+ Delete the directory and subdirectories.
+
+******************************************************************************/
+
+void del_tree(char *dir)
+{
+#ifndef __WIN__
+ DIR *parent= opendir(dir);
+ struct dirent *entry;
+ char temp[PATH_MAX];
+
+ if (parent == NULL)
+ {
+ return;
+ }
+
+ while ((entry= readdir(parent)) != NULL)
+ {
+ /* create long name */
+ snprintf(temp, PATH_MAX, "%s/%s", dir, entry->d_name);
+
+ if (entry->d_name[0] == '.')
+ {
+ /* Skip */
+ }
+ else
+ if (S_ISDIR(entry->d_type))
+ {
+ /* delete subdirectory */
+ del_tree(temp);
+ }
+ else
+ {
+ /* remove file */
+ remove(temp);
+ }
+ }
+ /* remove directory */
+ rmdir(dir);
+#else
+ struct _finddata_t parent;
+ intptr_t handle;
+ char temp[PATH_MAX];
+ char mask[PATH_MAX];
+
+ snprintf(mask,MAX_PATH,"%s/*.*",dir);
+
+ if ((handle=_findfirst(mask,&parent)) == -1L)
+ {
+ return;
+ }
+
+ do
+ {
+ /* create long name */
+ snprintf(temp, PATH_MAX, "%s/%s", dir, parent.name);
+ if (parent.name[0] == '.')
+ {
+ /* Skip */
+ }
+ else
+ if (parent.attrib & _A_SUBDIR)
+ {
+ /* delete subdirectory */
+ del_tree(temp);
+ }
+ else
+ {
+ /* remove file */
+ remove(temp);
+ }
+ } while (_findnext(handle,&parent) == 0);
+
+ _findclose(handle);
+
+ /* remove directory */
+ _rmdir(dir);
+#endif
+}
+
+/******************************************************************************
+
+ removef()
+
+******************************************************************************/
+
+int removef(const char *format, ...)
+{
+#ifdef __NETWARE__
+ va_list ap;
+ char path[PATH_MAX];
+
+ va_start(ap, format);
+
+ vsnprintf(path, PATH_MAX, format, ap);
+
+ va_end(ap);
+ return remove(path);
+
+#eldef __WIN__
+ {
+ va_list ap;
+ char path[PATH_MAX];
+ struct _finddata_t parent;
+ intptr_t handle;
+ char temp[PATH_MAX];
+ char *p;
+
+ va_start(ap, format);
+
+ vsnprintf(path, PATH_MAX, format, ap);
+
+ va_end(ap);
+
+ p= path + strlen(path);
+ while (*p != '\\' && *p != '/' && p > path) p--;
+
+ if ((handle=_findfirst(path,&parent)) == -1L)
+ {
+ /* if there is not files....it's ok */
+ return 0;
+ }
+
+ *p= '\0';
+
+ do
+ {
+ if (! (parent.attrib & _A_SUBDIR))
+ {
+ snprintf(temp, PATH_MAX, "%s/%s", path, parent.name);
+ remove(temp);
+ }
+ }while (_findnext(handle,&parent) == 0);
+
+ _findclose(handle);
+ }
+#else
+ DIR *parent;
+ struct dirent *entry;
+ char temp[PATH_MAX];
+ va_list ap;
+ char path[PATH_MAX];
+ char *p;
+ /* Get path with mask */
+ va_start(ap, format);
+
+ vsnprintf(path, PATH_MAX, format, ap);
+
+ va_end(ap);
+
+ p= path + strlen(path);
+ while (*p != '\\' && *p != '/' && p > path) p--;
+ *p= '\0';
+ p++;
+
+ parent= opendir(path);
+
+ if (parent == NULL)
+ {
+ return 1; /* Error, directory missing */
+ }
+
+ while ((entry= readdir(parent)) != NULL)
+ {
+ /* entry is not directory and entry matches with mask */
+ if (!S_ISDIR(entry->d_type) && !fnmatch(p, entry->d_name,0))
+ {
+ /* create long name */
+ snprintf(temp, PATH_MAX, "%s/%s", path, entry->d_name);
+ /* Delete only files */
+ remove(temp);
+ }
+ }
+#endif
+ return 0;
+}
+
+/******************************************************************************
+
+ get_basedir()
+
+******************************************************************************/
+
+void get_basedir(char *argv0, char *basedir)
+{
+ char temp[PATH_MAX];
+ char *p;
+ int position;
+
+ ASSERT(argv0 != NULL);
+ ASSERT(basedir != NULL);
+
+ strcpy(temp, strlwr(argv0));
+ while ((p= strchr(temp, '\\')) != NULL) *p= '/';
+
+ if ((position= strinstr(temp, "/bin/")) != 0)
+ {
+ p= temp + position;
+ *p= '\0';
+ strcpy(basedir, temp);
+ }
+}
+
+uint strinstr(reg1 const char *str,reg4 const char *search)
+{
+ reg2 my_string i,j;
+ my_string start= (my_string) str;
+
+ skipp:
+ while (*str != '\0')
+ {
+ if (*str++ == *search)
+ {
+ i=(my_string) str;
+ j= (my_string) search+1;
+ while (*j)
+ if (*i++ != *j++) goto skipp;
+ return ((uint) (str - start));
+ }
+ }
+ return (0);
+}
+
+/******************************************************************************
+
+ remove_empty_file()
+
+******************************************************************************/
+
+void remove_empty_file(const char *file_name)
+{
+ struct stat file;
+
+ if (!stat(file_name,&file))
+ {
+ if (!file.st_size)
+ remove(file_name);
+ }
+}
diff --git a/mysql-test/my_manage.h b/mysql-test/my_manage.h
new file mode 100644
index 00000000000..a61c693c22c
--- /dev/null
+++ b/mysql-test/my_manage.h
@@ -0,0 +1,135 @@
+/*
+ Copyright (c) 2002 Novell, Inc. All Rights Reserved.
+
+ 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 _MY_MANAGE
+#define _MY_MANAGE
+
+/******************************************************************************
+
+ includes
+
+******************************************************************************/
+
+#include <stdlib.h>
+#ifndef __WIN__
+#include <unistd.h>
+#endif
+#ifndef __NETWARE__
+#include <string.h>
+#include <my_global.h>
+#include <m_string.h>
+
+#ifndef __WIN__
+#define strnicmp strncasecmp
+#define strlwr(STRARG) (STRARG)
+#else
+int my_vsnprintf_(char *to, size_t n, const char* value, ...);
+#endif
+#endif
+
+/******************************************************************************
+
+ macros
+
+******************************************************************************/
+
+#define ARG_BUF 10
+#define TRY_MAX 5
+
+#ifdef __WIN__
+#define PATH_MAX _MAX_PATH
+#define NAME_MAX _MAX_FNAME
+#define kill(A,B) TerminateProcess((HANDLE)A,0)
+#define NOT_NEED_PID 0
+#define MASTER_PID 1
+#define SLAVE_PID 2
+#define mysqld_timeout 60000
+
+int pid_mode;
+bool run_server;
+bool skip_first_param;
+
+#define snprintf _snprintf
+#define vsnprintf _vsnprintf
+#endif
+
+
+/******************************************************************************
+
+ structures
+
+******************************************************************************/
+
+typedef struct
+{
+
+ int argc;
+ char **argv;
+
+ size_t size;
+
+} arg_list_t;
+
+#ifdef __WIN__
+typedef int pid_t;
+#endif
+/******************************************************************************
+
+ global variables
+
+******************************************************************************/
+
+/******************************************************************************
+
+ prototypes
+
+******************************************************************************/
+
+void init_args(arg_list_t *);
+void add_arg(arg_list_t *, const char *, ...);
+void free_args(arg_list_t *);
+
+#ifndef __WIN__
+int sleep_until_file_exists(char *);
+int sleep_until_file_deleted(char *);
+#else
+int sleep_until_file_exists(HANDLE);
+int sleep_until_file_deleted(HANDLE);
+#endif
+int wait_for_server_start(char *, char *, char *, char *, int,char *);
+
+#ifndef __WIN__
+int spawn(char *, arg_list_t *, int, char *, char *, char *, char *);
+#else
+int spawn(char *, arg_list_t *, int , char *, char *, char *, HANDLE *);
+#endif
+
+#ifndef __WIN__
+int stop_server(char *, char *, char *, char *, int, char *,char *);
+pid_t get_server_pid(char *);
+void kill_server(pid_t pid);
+#else
+int stop_server(char *, char *, char *, char *, int, HANDLE,char *);
+#endif
+void del_tree(char *);
+int removef(const char *, ...);
+
+void get_basedir(char *, char *);
+void remove_empty_file(const char *file_name);
+
+#endif /* _MY_MANAGE */
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index 07bc256eb2b..0d467e0a734 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -996,9 +996,11 @@ start_master()
if [ -n "$1" ] ; then
id=`$EXPR $1 + 101`;
this_master_myport=`$EXPR $MASTER_MYPORT + $1`
+ NOT_FIRST_MASTER_EXTRA_OPTS="--skip-innodb"
else
id=1;
this_master_myport=$MASTER_MYPORT
+ NOT_FIRST_MASTER_EXTRA_OPTS=""
fi
if [ -z "$DO_BENCH" ]
then
@@ -1022,7 +1024,8 @@ start_master()
--open-files-limit=1024 \
$MASTER_40_ARGS \
$SMALL_SERVER \
- $EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT"
+ $EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT \
+ $NOT_FIRST_MASTER_EXTRA_OPTS"
else
master_args="--no-defaults --log-bin=$MYSQL_TEST_DIR/var/log/master-bin$1 \
--server-id=$id --rpl-recovery-rank=1 \
@@ -1041,7 +1044,8 @@ start_master()
--innodb_data_file_path=ibdata1:50M \
$MASTER_40_ARGS \
$SMALL_SERVER \
- $EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT"
+ $EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT \
+ $NOT_FIRST_MASTER_EXTRA_OPTS"
fi
CUR_MYERR=$MASTER_MYERR
diff --git a/mysql-test/mysql_test_run.c b/mysql-test/mysql_test_run.c
new file mode 100644
index 00000000000..6f388fc4a45
--- /dev/null
+++ b/mysql-test/mysql_test_run.c
@@ -0,0 +1,1728 @@
+/*
+ Copyright (c) 2002, 2003 Novell, Inc. All Rights Reserved.
+
+ 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
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#ifndef __WIN__
+#include <dirent.h>
+#endif
+#include <string.h>
+#ifdef __NETWARE__
+#include <screen.h>
+#include <nks/vm.h>
+#endif
+#include <ctype.h>
+#include <sys/stat.h>
+#ifndef __WIN__
+#include <unistd.h>
+#endif
+#include <fcntl.h>
+#ifdef __NETWARE__
+#include <sys/mode.h>
+#endif
+#ifdef __WIN__
+#include <Shlwapi.h>
+#include <direct.h>
+#endif
+
+#include "my_manage.h"
+
+/******************************************************************************
+
+ macros
+
+******************************************************************************/
+
+#define HEADER "TEST RESULT \n"
+#define DASH "-------------------------------------------------------\n"
+
+#define NW_TEST_SUFFIX ".nw-test"
+#define NW_RESULT_SUFFIX ".nw-result"
+#define TEST_SUFFIX ".test"
+#define RESULT_SUFFIX ".result"
+#define REJECT_SUFFIX ".reject"
+#define OUT_SUFFIX ".out"
+#define ERR_SUFFIX ".err"
+
+const char *TEST_PASS = "[ pass ]";
+const char *TEST_SKIP = "[ skip ]";
+const char *TEST_FAIL = "[ fail ]";
+const char *TEST_BAD = "[ bad ]";
+const char *TEST_IGNORE = "[ignore]";
+
+/******************************************************************************
+
+ global variables
+
+******************************************************************************/
+#ifdef __NETWARE__
+static char base_dir[PATH_MAX] = "sys:/mysql";
+#else
+static char base_dir[PATH_MAX] = "..";
+#endif
+static char db[PATH_MAX] = "test";
+static char user[PATH_MAX] = "root";
+static char password[PATH_MAX] = "";
+
+int master_port = 9306;
+int slave_port = 9307;
+
+#if !defined(__NETWARE__) && !defined(__WIN__)
+static char master_socket[PATH_MAX] = "./var/tmp/master.sock";
+static char slave_socket[PATH_MAX] = "./var/tmp/slave.sock";
+#endif
+
+// comma delimited list of tests to skip or empty string
+#ifndef __WIN__
+static char skip_test[PATH_MAX] = " lowercase_table3 , system_mysql_db_fix ";
+#else
+/*
+ The most ignore testes contain the calls of system command
+*/
+#define MAX_COUNT_TESTES 1024
+/*
+ lowercase_table3 is disabled by Gerg
+ system_mysql_db_fix is disabled by Gerg
+ sp contains a command system
+ rpl_EE_error contains a command system
+ rpl_loaddatalocal contains a command system
+ ndb_autodiscover contains a command system
+ rpl_rotate_logs contains a command system
+ repair contains a command system
+ rpl_trunc_binlog contains a command system
+ mysqldump contains a command system
+ rpl000001 makes non-exit loop...temporary skiped
+*/
+static char skip_test[PATH_MAX] = " lowercase_table3 , system_mysql_db_fix , sp , rpl_EE_error , rpl_loaddatalocal , ndb_autodiscover , rpl_rotate_logs , repair , rpl_trunc_binlog , mysqldump , rpl000001 ";
+#endif
+static char ignore_test[PATH_MAX] = "";
+
+static char bin_dir[PATH_MAX];
+static char mysql_test_dir[PATH_MAX];
+static char test_dir[PATH_MAX];
+static char mysql_tmp_dir[PATH_MAX];
+static char result_dir[PATH_MAX];
+static char master_dir[PATH_MAX];
+static char slave_dir[PATH_MAX];
+static char lang_dir[PATH_MAX];
+static char char_dir[PATH_MAX];
+
+static char mysqladmin_file[PATH_MAX];
+static char mysqld_file[PATH_MAX];
+static char mysqltest_file[PATH_MAX];
+#ifndef __WIN__
+static char master_pid[PATH_MAX];
+static char slave_pid[PATH_MAX];
+static char sh_file[PATH_MAX] = "/bin/sh";
+#else
+static HANDLE master_pid;
+static HANDLE slave_pid;
+#endif
+
+static char master_opt[PATH_MAX] = "";
+static char slave_opt[PATH_MAX] = "";
+
+static char slave_master_info[PATH_MAX] = "";
+
+static char master_init_script[PATH_MAX] = "";
+static char slave_init_script[PATH_MAX] = "";
+
+// OpenSSL
+static char ca_cert[PATH_MAX];
+static char server_cert[PATH_MAX];
+static char server_key[PATH_MAX];
+static char client_cert[PATH_MAX];
+static char client_key[PATH_MAX];
+
+int total_skip = 0;
+int total_pass = 0;
+int total_fail = 0;
+int total_test = 0;
+
+int total_ignore = 0;
+
+int use_openssl = FALSE;
+int master_running = FALSE;
+int slave_running = FALSE;
+int skip_slave = TRUE;
+int single_test = TRUE;
+
+int restarts = 0;
+
+FILE *log_fd = NULL;
+
+/******************************************************************************
+
+ functions
+
+******************************************************************************/
+
+/******************************************************************************
+
+ prototypes
+
+******************************************************************************/
+
+void report_stats();
+void install_db(char *);
+void mysql_install_db();
+void start_master();
+void start_slave();
+void mysql_start();
+void stop_slave();
+void stop_master();
+void mysql_stop();
+void mysql_restart();
+int read_option(char *, char *);
+void run_test(char *);
+void setup(char *);
+void vlog(const char *, va_list);
+void mlog(const char *, ...);
+void log_info(const char *, ...);
+void log_error(const char *, ...);
+void log_errno(const char *, ...);
+void die(const char *);
+char *str_tok(char *string, const char *delim);
+#ifndef __WIN__
+void run_init_script(const char *script_name);
+#endif
+/******************************************************************************
+
+ report_stats()
+
+ Report the gathered statistics.
+
+******************************************************************************/
+void report_stats()
+{
+ if (total_fail == 0)
+ {
+ mlog("\nAll %d test(s) were successful.\n", total_test);
+ }
+ else
+ {
+ double percent = ((double)total_pass / total_test) * 100;
+
+ mlog("\nFailed %u/%u test(s), %.02f%% successful.\n",
+ total_fail, total_test, percent);
+ mlog("\nThe .out and .err files in %s may give you some\n", result_dir);
+ mlog("hint of what when wrong.\n");
+ mlog("\nIf you want to report this error, please first read the documentation\n");
+ mlog("at: http://www.mysql.com/doc/M/y/MySQL_test_suite.html\n");
+ }
+}
+
+/******************************************************************************
+
+ install_db()
+
+ Install the a database.
+
+******************************************************************************/
+void install_db(char *datadir)
+{
+ arg_list_t al;
+ int err;
+ char input[PATH_MAX];
+ char output[PATH_MAX];
+ char error[PATH_MAX];
+
+ // input file
+#ifdef __NETWARE__
+ snprintf(input, PATH_MAX, "%s/bin/init_db.sql", base_dir);
+#else
+ snprintf(input, PATH_MAX, "%s/mysql-test/init_db.sql", base_dir);
+#endif
+ snprintf(output, PATH_MAX, "%s/install.out", datadir);
+ snprintf(error, PATH_MAX, "%s/install.err", datadir);
+
+ // args
+ init_args(&al);
+ add_arg(&al, mysqld_file);
+ add_arg(&al, "--no-defaults");
+ add_arg(&al, "--bootstrap");
+ add_arg(&al, "--skip-grant-tables");
+ add_arg(&al, "--basedir=%s", base_dir);
+ add_arg(&al, "--datadir=%s", datadir);
+ add_arg(&al, "--skip-innodb");
+ add_arg(&al, "--skip-bdb");
+#ifndef __NETWARE__
+ add_arg(&al, "--character-sets-dir=%s", char_dir);
+ add_arg(&al, "--language=%s", lang_dir);
+#endif
+
+ // spawn
+ if ((err = spawn(mysqld_file, &al, TRUE, input, output, error, NULL)) != 0)
+ {
+ die("Unable to create database.");
+ }
+
+ // free args
+ free_args(&al);
+}
+
+/******************************************************************************
+
+ mysql_install_db()
+
+ Install the test databases.
+
+******************************************************************************/
+void mysql_install_db()
+{
+ char temp[PATH_MAX];
+
+ // var directory
+ snprintf(temp, PATH_MAX, "%s/var", mysql_test_dir);
+
+ // clean up old direcotry
+ del_tree(temp);
+
+ // create var directory
+#ifndef __WIN__
+ mkdir(temp, S_IRWXU);
+ // create subdirectories
+ mlog("Creating test-suite folders...\n");
+ snprintf(temp, PATH_MAX, "%s/var/run", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, PATH_MAX, "%s/var/tmp", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, PATH_MAX, "%s/var/master-data", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, PATH_MAX, "%s/var/master-data/mysql", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, PATH_MAX, "%s/var/master-data/test", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, PATH_MAX, "%s/var/slave-data", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, PATH_MAX, "%s/var/slave-data/mysql", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, PATH_MAX, "%s/var/slave-data/test", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+#else
+ mkdir(temp);
+ // create subdirectories
+ mlog("Creating test-suite folders...\n");
+ snprintf(temp, PATH_MAX, "%s/var/run", mysql_test_dir);
+ mkdir(temp);
+ snprintf(temp, PATH_MAX, "%s/var/tmp", mysql_test_dir);
+ mkdir(temp);
+ snprintf(temp, PATH_MAX, "%s/var/master-data", mysql_test_dir);
+ mkdir(temp);
+ snprintf(temp, PATH_MAX, "%s/var/master-data/mysql", mysql_test_dir);
+ mkdir(temp);
+ snprintf(temp, PATH_MAX, "%s/var/master-data/test", mysql_test_dir);
+ mkdir(temp);
+ snprintf(temp, PATH_MAX, "%s/var/slave-data", mysql_test_dir);
+ mkdir(temp);
+ snprintf(temp, PATH_MAX, "%s/var/slave-data/mysql", mysql_test_dir);
+ mkdir(temp);
+ snprintf(temp, PATH_MAX, "%s/var/slave-data/test", mysql_test_dir);
+ mkdir(temp);
+#endif
+
+ // install databases
+ mlog("Creating test databases for master... \n");
+ install_db(master_dir);
+ mlog("Creating test databases for slave... \n");
+ install_db(slave_dir);
+}
+
+/******************************************************************************
+
+ start_master()
+
+ Start the master server.
+
+******************************************************************************/
+void start_master()
+{
+ arg_list_t al;
+ int err;
+ char master_out[PATH_MAX];
+ char master_err[PATH_MAX];
+// char temp[PATH_MAX];
+ char temp2[PATH_MAX];
+
+ // remove old berkeley db log files that can confuse the server
+ removef("%s/log.*", master_dir);
+
+ // remove stale binary logs
+ removef("%s/var/log/*-bin.*", mysql_test_dir);
+
+ // remove stale binary logs
+ removef("%s/var/log/*.index", mysql_test_dir);
+
+ // remove master.info file
+ removef("%s/master.info", master_dir);
+
+ // remove relay files
+ removef("%s/var/log/*relay*", mysql_test_dir);
+
+ // remove relay-log.info file
+ removef("%s/relay-log.info", master_dir);
+
+ // init script
+ if (master_init_script[0] != 0)
+ {
+#ifdef __NETWARE__
+ // TODO: use the scripts
+ if (strinstr(master_init_script, "repair_part2-master.sh") != 0)
+ {
+ FILE *fp;
+
+ // create an empty index file
+ snprintf(temp, PATH_MAX, "%s/test/t1.MYI", master_dir);
+ fp = fopen(temp, "wb+");
+
+ fputs("1", fp);
+
+ fclose(fp);
+ }
+#elif !defined(__WIN__)
+ run_init_script(master_init_script);
+#endif
+ }
+
+ // redirection files
+ snprintf(master_out, PATH_MAX, "%s/var/run/master%u.out",
+ mysql_test_dir, restarts);
+ snprintf(master_err, PATH_MAX, "%s/var/run/master%u.err",
+ mysql_test_dir, restarts);
+#ifndef __WIN__
+ snprintf(temp2,PATH_MAX,"%s/var",mysql_test_dir);
+ mkdir(temp2,S_IRWXU);
+ snprintf(temp2,PATH_MAX,"%s/var/log",mysql_test_dir);
+ mkdir(temp2,S_IRWXU);
+#else
+ snprintf(temp2,PATH_MAX,"%s/var",mysql_test_dir);
+ mkdir(temp2);
+ snprintf(temp2,PATH_MAX,"%s/var/log",mysql_test_dir);
+ mkdir(temp2);
+#endif
+ // args
+ init_args(&al);
+ add_arg(&al, "%s", mysqld_file);
+ add_arg(&al, "--no-defaults");
+ add_arg(&al, "--log-bin=%s/var/log/master-bin",mysql_test_dir);
+ add_arg(&al, "--server-id=1");
+ add_arg(&al, "--basedir=%s", base_dir);
+ add_arg(&al, "--port=%u", master_port);
+#if !defined(__NETWARE__) && !defined(__WIN__)
+ add_arg(&al, "--socket=%s",master_socket);
+#endif
+ add_arg(&al, "--local-infile");
+ add_arg(&al, "--core");
+ add_arg(&al, "--datadir=%s", master_dir);
+#ifndef __WIN__
+ add_arg(&al, "--pid-file=%s", master_pid);
+#endif
+ add_arg(&al, "--character-sets-dir=%s", char_dir);
+ add_arg(&al, "--tmpdir=%s", mysql_tmp_dir);
+ add_arg(&al, "--language=%s", lang_dir);
+#ifdef DEBUG //only for debug builds
+ add_arg(&al, "--debug");
+#endif
+
+ if (use_openssl)
+ {
+ add_arg(&al, "--ssl-ca=%s", ca_cert);
+ add_arg(&al, "--ssl-cert=%s", server_cert);
+ add_arg(&al, "--ssl-key=%s", server_key);
+ }
+
+ // $MASTER_40_ARGS
+ add_arg(&al, "--rpl-recovery-rank=1");
+ add_arg(&al, "--init-rpl-role=master");
+
+ // $SMALL_SERVER
+ add_arg(&al, "-O");
+ add_arg(&al, "key_buffer_size=1M");
+ add_arg(&al, "-O");
+ add_arg(&al, "sort_buffer=256K");
+ add_arg(&al, "-O");
+ add_arg(&al, "max_heap_table_size=1M");
+
+ // $EXTRA_MASTER_OPT
+ if (master_opt[0] != 0)
+ {
+ char *p;
+
+ p = (char *)str_tok(master_opt, " \t");
+ if (!strstr(master_opt, "timezone"))
+ {
+ while (p)
+ {
+ add_arg(&al, "%s", p);
+ p = (char *)str_tok(NULL, " \t");
+ }
+ }
+ }
+
+ // remove the pid file if it exists
+#ifndef __WIN__
+ remove(master_pid);
+#endif
+
+ // spawn
+#ifdef __WIN__
+ if ((err= spawn(mysqld_file, &al, FALSE, NULL, master_out, master_err, &master_pid)) == 0)
+#else
+ if ((err= spawn(mysqld_file, &al, FALSE, NULL, master_out, master_err, master_pid)) == 0)
+#endif
+ {
+ sleep_until_file_exists(master_pid);
+
+ if ((err = wait_for_server_start(bin_dir, mysqladmin_file, user, password, master_port,
+ mysql_tmp_dir)) == 0)
+ {
+ master_running = TRUE;
+ }
+ else
+ {
+ log_error("The master server went down early.");
+ }
+ }
+ else
+ {
+ log_error("Unable to start master server.");
+ }
+
+ // free_args
+ free_args(&al);
+}
+
+/******************************************************************************
+
+ start_slave()
+
+ Start the slave server.
+
+******************************************************************************/
+void start_slave()
+{
+ arg_list_t al;
+ int err;
+ char slave_out[PATH_MAX];
+ char slave_err[PATH_MAX];
+
+ // skip?
+ if (skip_slave) return;
+
+ // remove stale binary logs
+ removef("%s/*-bin.*", slave_dir);
+
+ // remove stale binary logs
+ removef("%s/*.index", slave_dir);
+
+ // remove master.info file
+ removef("%s/master.info", slave_dir);
+
+ // remove relay files
+ removef("%s/var/log/*relay*", mysql_test_dir);
+
+ // remove relay-log.info file
+ removef("%s/relay-log.info", slave_dir);
+
+ // init script
+ if (slave_init_script[0] != 0)
+ {
+#ifdef __NETWARE__
+ // TODO: use the scripts
+ if (strinstr(slave_init_script, "rpl000016-slave.sh") != 0)
+ {
+ // create empty master.info file
+ snprintf(temp, PATH_MAX, "%s/master.info", slave_dir);
+ close(open(temp, O_WRONLY | O_CREAT,S_IRWXU|S_IRWXG|S_IRWXO));
+ }
+ else if (strinstr(slave_init_script, "rpl000017-slave.sh") != 0)
+ {
+ FILE *fp;
+
+ // create a master.info file
+ snprintf(temp, PATH_MAX, "%s/master.info", slave_dir);
+ fp = fopen(temp, "wb+");
+
+ fputs("master-bin.000001\n", fp);
+ fputs("4\n", fp);
+ fputs("127.0.0.1\n", fp);
+ fputs("replicate\n", fp);
+ fputs("aaaaaaaaaaaaaaab\n", fp);
+ fputs("9306\n", fp);
+ fputs("1\n", fp);
+ fputs("0\n", fp);
+
+ fclose(fp);
+ }
+ else if (strinstr(slave_init_script, "rpl_rotate_logs-slave.sh") != 0)
+ {
+ // create empty master.info file
+ snprintf(temp, PATH_MAX, "%s/master.info", slave_dir);
+ close(open(temp, O_WRONLY | O_CREAT,S_IRWXU|S_IRWXG|S_IRWXO));
+ }
+#elif !defined(__WIN__)
+ run_init_script(slave_init_script);
+#endif
+ }
+
+ // redirection files
+ snprintf(slave_out, PATH_MAX, "%s/var/run/slave%u.out",
+ mysql_test_dir, restarts);
+ snprintf(slave_err, PATH_MAX, "%s/var/run/slave%u.err",
+ mysql_test_dir, restarts);
+
+ // args
+ init_args(&al);
+ add_arg(&al, "%s", mysqld_file);
+ add_arg(&al, "--no-defaults");
+ add_arg(&al, "--log-bin=slave-bin");
+ add_arg(&al, "--relay_log=slave-relay-bin");
+ add_arg(&al, "--basedir=%s", base_dir);
+ add_arg(&al, "--port=%u", slave_port);
+#if !defined(__NETWARE__) && !defined(__WIN__)
+ add_arg(&al, "--socket=%s",slave_socket);
+#endif
+ add_arg(&al, "--datadir=%s", slave_dir);
+#ifndef __WIN__
+ add_arg(&al, "--pid-file=%s", slave_pid);
+#endif
+ add_arg(&al, "--character-sets-dir=%s", char_dir);
+ add_arg(&al, "--core");
+ add_arg(&al, "--tmpdir=%s", mysql_tmp_dir);
+ add_arg(&al, "--language=%s", lang_dir);
+
+ add_arg(&al, "--exit-info=256");
+ add_arg(&al, "--log-slave-updates");
+ add_arg(&al, "--init-rpl-role=slave");
+ add_arg(&al, "--skip-innodb");
+ add_arg(&al, "--skip-slave-start");
+ add_arg(&al, "--slave-load-tmpdir=../../var/tmp");
+
+ add_arg(&al, "--report-user=%s", user);
+ add_arg(&al, "--report-host=127.0.0.1");
+ add_arg(&al, "--report-port=%u", slave_port);
+
+ add_arg(&al, "--master-retry-count=10");
+ add_arg(&al, "-O");
+ add_arg(&al, "slave_net_timeout=10");
+#ifdef DEBUG //only for debug builds
+ add_arg(&al, "--debug");
+#endif
+
+ if (use_openssl)
+ {
+ add_arg(&al, "--ssl-ca=%s", ca_cert);
+ add_arg(&al, "--ssl-cert=%s", server_cert);
+ add_arg(&al, "--ssl-key=%s", server_key);
+ }
+
+ // slave master info
+ if (slave_master_info[0] != 0)
+ {
+ char *p;
+
+ p = (char *)str_tok(slave_master_info, " \t");
+
+ while(p)
+ {
+ add_arg(&al, "%s", p);
+
+ p = (char *)str_tok(NULL, " \t");
+ }
+ }
+ else
+ {
+ add_arg(&al, "--master-user=%s", user);
+ add_arg(&al, "--master-password=%s", password);
+ add_arg(&al, "--master-host=127.0.0.1");
+ add_arg(&al, "--master-port=%u", master_port);
+ add_arg(&al, "--master-connect-retry=1");
+ add_arg(&al, "--server-id=2");
+ add_arg(&al, "--rpl-recovery-rank=2");
+ }
+
+ // small server
+ add_arg(&al, "-O");
+ add_arg(&al, "key_buffer_size=1M");
+ add_arg(&al, "-O");
+ add_arg(&al, "sort_buffer=256K");
+ add_arg(&al, "-O");
+ add_arg(&al, "max_heap_table_size=1M");
+
+
+ // opt args
+ if (slave_opt[0] != 0)
+ {
+ char *p;
+
+ p = (char *)str_tok(slave_opt, " \t");
+
+ while(p)
+ {
+ add_arg(&al, "%s", p);
+
+ p = (char *)str_tok(NULL, " \t");
+ }
+ }
+
+ // remove the pid file if it exists
+#ifndef __WIN__
+ remove(slave_pid);
+#endif
+ // spawn
+#ifdef __WIN__
+ if ((err = spawn(mysqld_file, &al, FALSE, NULL, slave_out, slave_err, &slave_pid)) == 0)
+#else
+ if ((err = spawn(mysqld_file, &al, FALSE, NULL, slave_out, slave_err, slave_pid)) == 0)
+#endif
+ {
+ sleep_until_file_exists(slave_pid);
+
+ if ((err = wait_for_server_start(bin_dir, mysqladmin_file, user, password, slave_port,
+ mysql_tmp_dir)) == 0)
+ {
+ slave_running = TRUE;
+ }
+ else
+ {
+ log_error("The slave server went down early.");
+ }
+ }
+ else
+ {
+ log_error("Unable to start slave server.");
+ }
+
+ // free args
+ free_args(&al);
+}
+
+/******************************************************************************
+
+ mysql_start()
+
+ Start the mysql servers.
+
+******************************************************************************/
+void mysql_start()
+{
+// log_info("Starting the MySQL server(s): %u", ++restarts);
+ start_master();
+
+ start_slave();
+
+ // activate the test screen
+#ifdef __NETWARE__
+ ActivateScreen(getscreenhandle());
+#endif
+}
+
+/******************************************************************************
+
+ stop_slave()
+
+ Stop the slave server.
+
+******************************************************************************/
+void stop_slave()
+{
+ int err;
+
+ // running?
+ if (!slave_running) return;
+
+ // stop
+ if ((err = stop_server(bin_dir, mysqladmin_file, user, password, slave_port, slave_pid,
+ mysql_tmp_dir)) == 0)
+ {
+ slave_running = FALSE;
+ }
+ else
+ {
+ log_error("Unable to stop slave server.");
+ }
+}
+
+/******************************************************************************
+
+ stop_master()
+
+ Stop the master server.
+
+******************************************************************************/
+void stop_master()
+{
+ int err;
+
+ // running?
+ if (!master_running) return;
+
+ if ((err = stop_server(bin_dir, mysqladmin_file, user, password, master_port, master_pid,
+ mysql_tmp_dir)) == 0)
+ {
+ master_running = FALSE;
+ }
+ else
+ {
+ log_error("Unable to stop master server.");
+ }
+}
+
+/******************************************************************************
+
+ mysql_stop()
+
+ Stop the mysql servers.
+
+******************************************************************************/
+void mysql_stop()
+{
+
+ stop_master();
+
+ stop_slave();
+
+ // activate the test screen
+#ifdef __NETWARE__
+ ActivateScreen(getscreenhandle());
+#endif
+}
+
+/******************************************************************************
+
+ mysql_restart()
+
+ Restart the mysql servers.
+
+******************************************************************************/
+void mysql_restart()
+{
+// log_info("Restarting the MySQL server(s): %u", ++restarts);
+
+ mysql_stop();
+
+ mlog(DASH);
+
+ mysql_start();
+}
+
+/******************************************************************************
+
+ read_option()
+
+ Read the option file.
+
+******************************************************************************/
+int read_option(char *opt_file, char *opt)
+{
+ int fd, err;
+ char *p;
+ char buf[PATH_MAX];
+
+ // copy current option
+ strncpy(buf, opt, PATH_MAX);
+
+ // open options file
+ fd = open(opt_file, O_RDONLY);
+
+ err = read(fd, opt, PATH_MAX);
+
+ close(fd);
+
+ if (err > 0)
+ {
+ // terminate string
+ if ((p = strchr(opt, '\n')) != NULL)
+ {
+ *p = 0;
+
+ // check for a '\r'
+ if ((p = strchr(opt, '\r')) != NULL)
+ {
+ *p = 0;
+ }
+ }
+ else
+ {
+ opt[err] = 0;
+ }
+
+ // check for $MYSQL_TEST_DIR
+ if ((p = strstr(opt, "$MYSQL_TEST_DIR")) != NULL)
+ {
+ char temp[PATH_MAX];
+
+ *p = 0;
+
+ strcpy(temp, p + strlen("$MYSQL_TEST_DIR"));
+
+ strcat(opt, mysql_test_dir);
+
+ strcat(opt, temp);
+ }
+ // Check for double backslash and replace it with single bakslash
+ if ((p = strstr(opt, "\\\\")) != NULL)
+ {
+ /* bmove is guranteed to work byte by byte */
+ bmove(p, p+1, strlen(p+1));
+ }
+ }
+ else
+ {
+ // clear option
+ *opt = 0;
+ }
+
+ // compare current option with previous
+ return strcmp(opt, buf);
+}
+
+/******************************************************************************
+
+ run_test()
+
+ Run the given test case.
+
+******************************************************************************/
+void run_test(char *test)
+{
+ char temp[PATH_MAX];
+ const char *rstr;
+ int skip = FALSE, ignore=FALSE;
+ int restart = FALSE;
+ int flag = FALSE;
+ struct stat info;
+
+ // skip tests in the skip list
+ snprintf(temp, PATH_MAX, " %s ", test);
+ skip = (strinstr(skip_test, temp) != 0);
+ if (skip == FALSE)
+ ignore = (strinstr(ignore_test, temp) != 0);
+
+ snprintf(master_init_script, PATH_MAX, "%s/%s-master.sh", test_dir, test);
+ snprintf(slave_init_script, PATH_MAX, "%s/%s-slave.sh", test_dir, test);
+#ifdef __WIN__
+ if (! stat(master_init_script, &info))
+ skip = TRUE;
+ if (!stat(slave_init_script, &info))
+ skip = TRUE;
+#endif
+ if (ignore)
+ {
+ // show test
+ mlog("%-46s ", test);
+
+ // ignore
+ rstr = TEST_IGNORE;
+ ++total_ignore;
+ }
+ else if (!skip) // skip test?
+ {
+ char test_file[PATH_MAX];
+ char master_opt_file[PATH_MAX];
+ char slave_opt_file[PATH_MAX];
+ char slave_master_info_file[PATH_MAX];
+ char result_file[PATH_MAX];
+ char reject_file[PATH_MAX];
+ char out_file[PATH_MAX];
+ char err_file[PATH_MAX];
+ int err;
+ arg_list_t al;
+#ifdef __WIN__
+ /*
+ Clean test database
+ */
+ removef("%s/test/*.*", master_dir);
+ removef("%s/test/*.*", slave_dir);
+ removef("%s/mysqltest/*.*", master_dir);
+ removef("%s/mysqltest/*.*", slave_dir);
+
+#endif
+ // skip slave?
+ flag = skip_slave;
+ skip_slave = (strncmp(test, "rpl", 3) != 0);
+ if (flag != skip_slave) restart = TRUE;
+
+ // create files
+ snprintf(master_opt_file, PATH_MAX, "%s/%s-master.opt", test_dir, test);
+ snprintf(slave_opt_file, PATH_MAX, "%s/%s-slave.opt", test_dir, test);
+ snprintf(slave_master_info_file, PATH_MAX, "%s/%s.slave-mi", test_dir, test);
+ snprintf(reject_file, PATH_MAX, "%s/%s%s", result_dir, test, REJECT_SUFFIX);
+ snprintf(out_file, PATH_MAX, "%s/%s%s", result_dir, test, OUT_SUFFIX);
+ snprintf(err_file, PATH_MAX, "%s/%s%s", result_dir, test, ERR_SUFFIX);
+
+ // netware specific files
+ snprintf(test_file, PATH_MAX, "%s/%s%s", test_dir, test, NW_TEST_SUFFIX);
+ if (stat(test_file, &info))
+ {
+ snprintf(test_file, PATH_MAX, "%s/%s%s", test_dir, test, TEST_SUFFIX);
+ if (access(test_file,0))
+ {
+ printf("Invalid test name %s, %s file not found\n",test,test_file);
+ return;
+ }
+ }
+
+ snprintf(result_file, PATH_MAX, "%s/%s%s", result_dir, test, NW_RESULT_SUFFIX);
+ if (stat(result_file, &info))
+ {
+ snprintf(result_file, PATH_MAX, "%s/%s%s", result_dir, test, RESULT_SUFFIX);
+ }
+
+ // init scripts
+ if (stat(master_init_script, &info))
+ master_init_script[0] = 0;
+ else
+ restart = TRUE;
+
+ if (stat(slave_init_script, &info))
+ slave_init_script[0] = 0;
+ else
+ restart = TRUE;
+
+ // read options
+ if (read_option(master_opt_file, master_opt)) restart = TRUE;
+ if (read_option(slave_opt_file, slave_opt)) restart = TRUE;
+ if (read_option(slave_master_info_file, slave_master_info)) restart = TRUE;
+
+ // cleanup previous run
+ remove(reject_file);
+ remove(out_file);
+ remove(err_file);
+
+ // start or restart?
+ if (!master_running) mysql_start();
+ else if (restart) mysql_restart();
+
+ // let the system stabalize
+ sleep(1);
+
+ // show test
+ mlog("%-46s ", test);
+
+
+ // args
+ init_args(&al);
+ add_arg(&al, "%s", mysqltest_file);
+ add_arg(&al, "--no-defaults");
+ add_arg(&al, "--port=%u", master_port);
+#if !defined(__NETWARE__) && !defined(__WIN__)
+ add_arg(&al, "--socket=%s", master_socket);
+ add_arg(&al, "--tmpdir=%s", mysql_tmp_dir);
+#endif
+ add_arg(&al, "--database=%s", db);
+ add_arg(&al, "--user=%s", user);
+ add_arg(&al, "--password=%s", password);
+ add_arg(&al, "--silent");
+ add_arg(&al, "--basedir=%s/", mysql_test_dir);
+ add_arg(&al, "--host=127.0.0.1");
+ add_arg(&al, "-v");
+ add_arg(&al, "-R");
+ add_arg(&al, "%s", result_file);
+
+ if (use_openssl)
+ {
+ add_arg(&al, "--ssl-ca=%s", ca_cert);
+ add_arg(&al, "--ssl-cert=%s", client_cert);
+ add_arg(&al, "--ssl-key=%s", client_key);
+ }
+
+ // spawn
+ err = spawn(mysqltest_file, &al, TRUE, test_file, out_file, err_file, NULL);
+
+ // free args
+ free_args(&al);
+
+ remove_empty_file(out_file);
+ remove_empty_file(err_file);
+
+ if (err == 0)
+ {
+ // pass
+ rstr = TEST_PASS;
+ ++total_pass;
+
+ // increment total
+ ++total_test;
+ }
+ else if (err == 2)
+ {
+ // skip
+ rstr = TEST_SKIP;
+ ++total_skip;
+ }
+ else if (err == 1)
+ {
+ // fail
+ rstr = TEST_FAIL;
+ ++total_fail;
+
+ // increment total
+ ++total_test;
+ }
+ else
+ {
+ rstr = TEST_BAD;
+ }
+ }
+ else // early skips
+ {
+ // show test
+ mlog("%-46s ", test);
+
+ // skip
+ rstr = TEST_SKIP;
+ ++total_skip;
+ }
+
+ // result
+ mlog("%-14s\n", rstr);
+}
+
+/******************************************************************************
+
+ vlog()
+
+ Log the message.
+
+******************************************************************************/
+void vlog(const char *format, va_list ap)
+{
+ vfprintf(stdout, format, ap);
+ fflush(stdout);
+
+ if (log_fd)
+ {
+ vfprintf(log_fd, format, ap);
+ fflush(log_fd);
+ }
+}
+
+/******************************************************************************
+
+ log()
+
+ Log the message.
+
+******************************************************************************/
+void mlog(const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+
+ vlog(format, ap);
+
+ va_end(ap);
+}
+
+/******************************************************************************
+
+ log_info()
+
+ Log the given information.
+
+******************************************************************************/
+void log_info(const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+
+ mlog("-- INFO : ");
+ vlog(format, ap);
+ mlog("\n");
+
+ va_end(ap);
+}
+
+/******************************************************************************
+
+ log_error()
+
+ Log the given error.
+
+******************************************************************************/
+void log_error(const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+
+ mlog("-- ERROR: ");
+ vlog(format, ap);
+ mlog("\n");
+
+ va_end(ap);
+}
+
+/******************************************************************************
+
+ log_errno()
+
+ Log the given error and errno.
+
+******************************************************************************/
+void log_errno(const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+
+ mlog("-- ERROR: (%003u) ", errno);
+ vlog(format, ap);
+ mlog("\n");
+
+ va_end(ap);
+}
+
+/******************************************************************************
+
+ die()
+
+ Exit the application.
+
+******************************************************************************/
+void die(const char *msg)
+{
+ log_error(msg);
+#ifdef __NETWARE__
+ pressanykey();
+#endif
+ exit(-1);
+}
+
+/******************************************************************************
+
+ setup()
+
+ Setup the mysql test enviornment.
+
+******************************************************************************/
+void setup(char *file)
+{
+ char temp[PATH_MAX];
+ char file_path[PATH_MAX*2];
+ char *p;
+ int position;
+
+ // set the timezone for the timestamp test
+#ifdef __WIN__
+ _putenv( "TZ=GMT-3" );
+#else
+ setenv("TZ", "GMT-3", TRUE);
+#endif
+ // find base dir
+#ifdef __NETWARE__
+ strcpy(temp, strlwr(file));
+ while((p = strchr(temp, '\\')) != NULL) *p = '/';
+#else
+ getcwd(temp, PATH_MAX);
+ position = strlen(temp);
+ temp[position] = '/';
+ temp[position+1] = 0;
+#ifdef __WIN__
+ while((p = strchr(temp, '\\')) != NULL) *p = '/';
+#endif
+#endif
+
+ if ((position = strinstr(temp, "/mysql-test/")) != 0)
+ {
+ p = temp + position - 1;
+ *p = 0;
+ strcpy(base_dir, temp);
+ }
+
+ log_info("Currect directory: %s",base_dir);
+
+#ifdef __NETWARE__
+ // setup paths
+ snprintf(bin_dir, PATH_MAX, "%s/bin", base_dir);
+ snprintf(mysql_test_dir, PATH_MAX, "%s/mysql-test", base_dir);
+ snprintf(test_dir, PATH_MAX, "%s/t", mysql_test_dir);
+ snprintf(mysql_tmp_dir, PATH_MAX, "%s/var/tmp", mysql_test_dir);
+ snprintf(result_dir, PATH_MAX, "%s/r", mysql_test_dir);
+ snprintf(master_dir, PATH_MAX, "%s/var/master-data", mysql_test_dir);
+ snprintf(slave_dir, PATH_MAX, "%s/var/slave-data", mysql_test_dir);
+ snprintf(lang_dir, PATH_MAX, "%s/share/english", base_dir);
+ snprintf(char_dir, PATH_MAX, "%s/share/charsets", base_dir);
+
+#ifdef HAVE_OPENSSL
+ use_openssl = TRUE;
+#endif // HAVE_OPENSSL
+
+ // OpenSSL paths
+ snprintf(ca_cert, PATH_MAX, "%s/SSL/cacert.pem", base_dir);
+ snprintf(server_cert, PATH_MAX, "%s/SSL/server-cert.pem", base_dir);
+ snprintf(server_key, PATH_MAX, "%s/SSL/server-key.pem", base_dir);
+ snprintf(client_cert, PATH_MAX, "%s/SSL/client-cert.pem", base_dir);
+ snprintf(client_key, PATH_MAX, "%s/SSL/client-key.pem", base_dir);
+
+ // setup files
+ snprintf(mysqld_file, PATH_MAX, "%s/mysqld", bin_dir);
+ snprintf(mysqltest_file, PATH_MAX, "%s/mysqltest", bin_dir);
+ snprintf(mysqladmin_file, PATH_MAX, "%s/mysqladmin", bin_dir);
+ snprintf(master_pid, PATH_MAX, "%s/var/run/master.pid", mysql_test_dir);
+ snprintf(slave_pid, PATH_MAX, "%s/var/run/slave.pid", mysql_test_dir);
+#elif __WIN__
+ // setup paths
+#ifdef _DEBUG
+ snprintf(bin_dir, PATH_MAX, "%s/client_debug", base_dir);
+#else
+ snprintf(bin_dir, PATH_MAX, "%s/client_release", base_dir);
+#endif
+ snprintf(mysql_test_dir, PATH_MAX, "%s/mysql-test", base_dir);
+ snprintf(test_dir, PATH_MAX, "%s/t", mysql_test_dir);
+ snprintf(mysql_tmp_dir, PATH_MAX, "%s/var/tmp", mysql_test_dir);
+ snprintf(result_dir, PATH_MAX, "%s/r", mysql_test_dir);
+ snprintf(master_dir, PATH_MAX, "%s/var/master-data", mysql_test_dir);
+ snprintf(slave_dir, PATH_MAX, "%s/var/slave-data", mysql_test_dir);
+ snprintf(lang_dir, PATH_MAX, "%s/share/english", base_dir);
+ snprintf(char_dir, PATH_MAX, "%s/share/charsets", base_dir);
+
+#ifdef HAVE_OPENSSL
+ use_openssl = TRUE;
+#endif // HAVE_OPENSSL
+
+ // OpenSSL paths
+ snprintf(ca_cert, PATH_MAX, "%s/SSL/cacert.pem", base_dir);
+ snprintf(server_cert, PATH_MAX, "%s/SSL/server-cert.pem", base_dir);
+ snprintf(server_key, PATH_MAX, "%s/SSL/server-key.pem", base_dir);
+ snprintf(client_cert, PATH_MAX, "%s/SSL/client-cert.pem", base_dir);
+ snprintf(client_key, PATH_MAX, "%s/SSL/client-key.pem", base_dir);
+
+ // setup files
+ snprintf(mysqld_file, PATH_MAX, "%s/mysqld.exe", bin_dir);
+ snprintf(mysqltest_file, PATH_MAX, "%s/mysqltest.exe", bin_dir);
+ snprintf(mysqladmin_file, PATH_MAX, "%s/mysqladmin.exe", bin_dir);
+#else
+ // setup paths
+ snprintf(bin_dir, PATH_MAX, "%s/client", base_dir);
+ snprintf(mysql_test_dir, PATH_MAX, "%s/mysql-test", base_dir);
+ snprintf(test_dir, PATH_MAX, "%s/t", mysql_test_dir);
+ snprintf(mysql_tmp_dir, PATH_MAX, "%s/var/tmp", mysql_test_dir);
+ snprintf(result_dir, PATH_MAX, "%s/r", mysql_test_dir);
+ snprintf(master_dir, PATH_MAX, "%s/var/master-data", mysql_test_dir);
+ snprintf(slave_dir, PATH_MAX, "%s/var/slave-data", mysql_test_dir);
+ snprintf(lang_dir, PATH_MAX, "%s/sql/share/english", base_dir);
+ snprintf(char_dir, PATH_MAX, "%s/sql/share/charsets", base_dir);
+
+#ifdef HAVE_OPENSSL
+ use_openssl = TRUE;
+#endif // HAVE_OPENSSL
+
+ // OpenSSL paths
+ snprintf(ca_cert, PATH_MAX, "%s/SSL/cacert.pem", base_dir);
+ snprintf(server_cert, PATH_MAX, "%s/SSL/server-cert.pem", base_dir);
+ snprintf(server_key, PATH_MAX, "%s/SSL/server-key.pem", base_dir);
+ snprintf(client_cert, PATH_MAX, "%s/SSL/client-cert.pem", base_dir);
+ snprintf(client_key, PATH_MAX, "%s/SSL/client-key.pem", base_dir);
+
+ // setup files
+ snprintf(mysqld_file, PATH_MAX, "%s/sql/mysqld", base_dir);
+ snprintf(mysqltest_file, PATH_MAX, "%s/mysqltest", bin_dir);
+ snprintf(mysqladmin_file, PATH_MAX, "%s/mysqladmin", bin_dir);
+ snprintf(master_pid, PATH_MAX, "%s/var/run/master.pid", mysql_test_dir);
+ snprintf(slave_pid, PATH_MAX, "%s/var/run/slave.pid", mysql_test_dir);
+
+ snprintf(master_socket,PATH_MAX, "%s/var/tmp/master.sock", mysql_test_dir);
+ snprintf(slave_socket,PATH_MAX, "%s/var/tmp/slave.sock", mysql_test_dir);
+
+#endif
+ // create log file
+ snprintf(temp, PATH_MAX, "%s/mysql-test-run.log", mysql_test_dir);
+ if ((log_fd = fopen(temp, "w+")) == NULL)
+ {
+ log_errno("Unable to create log file.");
+ }
+
+ // prepare skip test list
+ while((p = strchr(skip_test, ',')) != NULL) *p = ' ';
+ strcpy(temp, strlwr(skip_test));
+ snprintf(skip_test, PATH_MAX, " %s ", temp);
+
+ // environment
+#ifdef __NETWARE__
+ setenv("MYSQL_TEST_DIR", mysql_test_dir, 1);
+ snprintf(file_path, PATH_MAX*2, "%s/client/mysqldump --no-defaults -u root --port=%u", bin_dir, master_port);
+ setenv("MYSQL_DUMP", file_path, 1);
+ snprintf(file_path, PATH_MAX*2, "%s/client/mysqlbinlog --no-defaults --local-load=%s", bin_dir, mysql_tmp_dir);
+ setenv("MYSQL_BINLOG", file_path, 1);
+#elif __WIN__
+ snprintf(file_path,MAX_PATH,"MYSQL_TEST_DIR=%s",mysql_test_dir);
+ _putenv(file_path);
+ snprintf(file_path, PATH_MAX*2, "MYSQL_DUMP=%s/mysqldump.exe --no-defaults -u root --port=%u", bin_dir, master_port);
+ _putenv(file_path);
+ snprintf(file_path, PATH_MAX*2, "MYSQL_BINLOG=%s/mysqlbinlog.exe --no-defaults --local-load=%s", bin_dir, mysql_tmp_dir);
+ _putenv(file_path);
+#else
+ setenv("MYSQL_TEST_DIR", mysql_test_dir, 1);
+ snprintf(file_path, PATH_MAX*2, "%s/mysqldump --no-defaults -u root --port=%u --socket=%s", bin_dir, master_port, master_socket);
+ setenv("MYSQL_DUMP", file_path, 1);
+ snprintf(file_path, PATH_MAX*2, "%s/mysqlbinlog --no-defaults --local-load=%s", bin_dir, mysql_tmp_dir);
+ setenv("MYSQL_BINLOG", file_path, 1);
+#endif
+
+#ifndef __WIN__
+ setenv("MASTER_MYPORT", "9306", 1);
+ setenv("SLAVE_MYPORT", "9307", 1);
+ setenv("MYSQL_TCP_PORT", "3306", 1);
+#else
+ _putenv("MASTER_MYPORT=9306");
+ _putenv("SLAVE_MYPORT=9307");
+ _putenv("MYSQL_TCP_PORT=3306");
+#endif
+
+}
+
+/******************************************************************************
+
+ main()
+
+******************************************************************************/
+int main(int argc, char **argv)
+{
+ int is_ignore_list = 0;
+ // setup
+ setup(argv[0]);
+
+ /* The --ignore option is comma saperated list of test cases to skip and
+ should be very first command line option to the test suite.
+
+ The usage is now:
+ mysql_test_run --ignore=test1,test2 test3 test4
+ where test1 and test2 are test cases to ignore
+ and test3 and test4 are test cases to run.
+ */
+ if (argc >= 2 && !strnicmp(argv[1], "--ignore=", sizeof("--ignore=")-1))
+ {
+ char *temp, *token;
+ temp= strdup(strchr(argv[1],'=') + 1);
+ for (token=str_tok(temp, ","); token != NULL; token=str_tok(NULL, ","))
+ {
+ if (strlen(ignore_test) + strlen(token) + 2 <= PATH_MAX-1)
+ sprintf(ignore_test+strlen(ignore_test), " %s ", token);
+ else
+ {
+ free(temp);
+ die("ignore list too long.");
+ }
+ }
+ free(temp);
+ is_ignore_list = 1;
+ }
+ // header
+#ifndef __WIN__
+ mlog("MySQL Server %s, for %s (%s)\n\n", VERSION, SYSTEM_TYPE, MACHINE_TYPE);
+#else
+ mlog("MySQL Server ---, for %s (%s)\n\n", SYSTEM_TYPE, MACHINE_TYPE);
+#endif
+
+ mlog("Initializing Tests...\n");
+
+ // install test databases
+ mysql_install_db();
+
+ mlog("Starting Tests...\n");
+
+ mlog("\n");
+ mlog(HEADER);
+ mlog(DASH);
+
+ if ( argc > 1 + is_ignore_list )
+ {
+ int i;
+
+ // single test
+ single_test = TRUE;
+
+ for (i = 1 + is_ignore_list; i < argc; i++)
+ {
+ // run given test
+ run_test(argv[i]);
+ }
+ }
+ else
+ {
+ // run all tests
+#ifndef __WIN__
+ struct dirent **namelist;
+ int i,n;
+ char test[NAME_MAX];
+ char *p;
+ int position;
+
+ n = scandir(test_dir, &namelist, 0, alphasort);
+ if (n < 0)
+ die("Unable to open tests directory.");
+ else
+ {
+ for (i = 0; i < n; i++)
+ {
+ strcpy(test, strlwr(namelist[i]->d_name));
+ // find the test suffix
+ if ((position = strinstr(test, TEST_SUFFIX)) != 0)
+ {
+ p = test + position - 1;
+ // null terminate at the suffix
+ *p = 0;
+ // run test
+ run_test(test);
+ }
+ free(namelist[n]);
+ }
+ free(namelist);
+ }
+#else
+ struct _finddata_t dir;
+ intptr_t handle;
+ char test[NAME_MAX];
+ char mask[PATH_MAX];
+ char *p;
+ int position;
+ char **names = 0;
+ char **testes = 0;
+ int name_index;
+ int index;
+
+ // single test
+ single_test = FALSE;
+
+ snprintf(mask,MAX_PATH,"%s/*.test",test_dir);
+
+ if ((handle=_findfirst(mask,&dir)) == -1L)
+ {
+ die("Unable to open tests directory.");
+ }
+
+ names = malloc(MAX_COUNT_TESTES*4);
+ testes = names;
+ name_index = 0;
+
+ do
+ {
+ if (!(dir.attrib & _A_SUBDIR))
+ {
+ strcpy(test, strlwr(dir.name));
+
+ // find the test suffix
+ if ((position = strinstr(test, TEST_SUFFIX)) != 0)
+ {
+ p = test + position - 1;
+ // null terminate at the suffix
+ *p = 0;
+
+ // insert test
+ *names = malloc(PATH_MAX);
+ strcpy(*names,test);
+ names++;
+ name_index++;
+ }
+ }
+ }while (_findnext(handle,&dir) == 0);
+
+ _findclose(handle);
+
+ qsort( (void *)testes, name_index, sizeof( char * ), compare );
+
+ for (index = 0; index <= name_index; index++)
+ {
+ run_test(testes[index]);
+ free(testes[index]);
+ }
+
+ free(testes);
+#endif
+ }
+
+ // stop server
+ mysql_stop();
+
+ mlog(DASH);
+ mlog("\n");
+
+ mlog("Ending Tests...\n");
+
+ // report stats
+ report_stats();
+
+ // close log
+ if (log_fd) fclose(log_fd);
+
+ // keep results up
+#ifdef __NETWARE__
+ pressanykey();
+#endif
+ return 0;
+}
+
+
+/*
+ Synopsis:
+ This function breaks the string into a sequence of tokens. The difference
+ between this function and strtok is that it respects the quoted string i.e.
+ it skips any delimiter character within the quoted part of the string.
+ It return tokens by eliminating quote character. It modifies the input string
+ passed. It will work with whitespace delimeter but may not work properly with
+ other delimeter. If the delimeter will contain any quote character, then
+ function will not tokenize and will return null string.
+ e.g. if input string is
+ --init-slave="set global max_connections=500" --skip-external-locking
+ then the output will two string i.e.
+ --init-slave=set global max_connections=500
+ --skip-external-locking
+
+Arguments:
+ string: input string
+ delim: set of delimiter character
+Output:
+ return the null terminated token of NULL.
+*/
+
+
+char *str_tok(char *string, const char *delim)
+{
+ char *token; /* current token received from strtok */
+ char *qt_token; /* token delimeted by the matching pair of quote */
+ /*
+ if there are any quote chars found in the token then this variable
+ will hold the concatenated string to return to the caller
+ */
+ char *ptr_token=NULL;
+ /* pointer to the quote character in the token from strtok */
+ char *ptr_quote=NULL;
+
+ /* See if the delimeter contains any quote character */
+ if (strchr(delim,'\'') || strchr(delim,'\"'))
+ return NULL;
+
+ /* repeate till we are getting some token from strtok */
+ while ((token = (char*)strtok(string, delim) ) != NULL)
+ {
+ /*
+ make the input string NULL so that next time onward strtok can
+ be called with NULL input string.
+ */
+ string = NULL;
+ /*
+ We don't need to remove any quote character for Windows version
+ */
+#ifndef __WIN__
+ /* check if the current token contain double quote character*/
+ if ((ptr_quote = (char*)strchr(token,'\"')) != NULL)
+ {
+ /*
+ get the matching the matching double quote in the remaining
+ input string
+ */
+ qt_token = (char*)strtok(NULL,"\"");
+ }
+ /* check if the current token contain single quote character*/
+ else if ((ptr_quote = (char*)strchr(token,'\'')) != NULL)
+ {
+ /*
+ get the matching the matching single quote in the remaining
+ input string
+ */
+ qt_token = (char*)strtok(NULL,"\'");
+ }
+#endif
+ /*
+ if the current token does not contains any quote character then
+ return to the caller.
+ */
+ if (ptr_quote == NULL)
+ {
+ /*
+ if there is any earlier token i.e. ptr_token then append the
+ current token in it and return it else return the current
+ token directly
+ */
+ return ptr_token ? strcat(ptr_token,token) : token;
+ }
+
+ /*
+ remove the quote character i.e. make NULL so that the token will
+ be devided in two part and later both part can be concatenated
+ and hence quote will be removed
+ */
+ *ptr_quote= 0;
+
+ /* check if ptr_token has been initialized or not */
+ if (ptr_token == NULL)
+ {
+ /* initialize the ptr_token with current token */
+ ptr_token= token;
+ /* copy entire string between matching pair of quote*/
+ sprintf(ptr_token+strlen(ptr_token),"%s %s", ptr_quote+1, qt_token);
+ }
+ else
+ {
+ /*
+ copy the current token and entire string between matching pair
+ of quote
+ */
+ if (qt_token == NULL)
+ {
+ sprintf(ptr_token+strlen(ptr_token),"%s%s", token, ptr_quote+1);
+ }
+ else
+ {
+ sprintf(ptr_token+strlen(ptr_token),"%s%s %s", token, ptr_quote+1,
+ qt_token );
+ }
+ }
+ }
+
+ /* return the concatenated token */
+ return ptr_token;
+}
+
+#ifndef __WIN__
+
+/*
+ Synopsis:
+ This function run scripts files on Linux and Netware
+
+Arguments:
+ script_name: name of script file
+
+Output:
+ nothing
+*/
+void run_init_script(const char *script_name)
+{
+ arg_list_t al;
+ int err;
+
+ // args
+ init_args(&al);
+ add_arg(&al, sh_file);
+ add_arg(&al, script_name);
+
+ // spawn
+ if ((err = spawn(sh_file, &al, TRUE, NULL, NULL, NULL, NULL)) != 0)
+ {
+ die("Unable to run script.");
+ }
+
+ // free args
+ free_args(&al);
+}
+#endif
diff --git a/mysql-test/mysql_test_run_new.c b/mysql-test/mysql_test_run_new.c
new file mode 100644
index 00000000000..1e8a1dded51
--- /dev/null
+++ b/mysql-test/mysql_test_run_new.c
@@ -0,0 +1,1771 @@
+/*
+ Copyright (c) 2002, 2003 Novell, Inc. All Rights Reserved.
+
+ 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
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#ifndef __WIN__
+#include <dirent.h>
+#endif
+#include <string.h>
+#ifdef __NETWARE__
+#include <screen.h>
+#include <nks/vm.h>
+#endif
+#include <ctype.h>
+#include <sys/stat.h>
+#ifndef __WIN__
+#include <unistd.h>
+#endif
+#include <fcntl.h>
+#ifdef __NETWARE__
+#include <sys/mode.h>
+#endif
+#ifdef __WIN__
+#include <Shlwapi.h>
+#include <direct.h>
+#endif
+
+#include "my_manage.h"
+
+/******************************************************************************
+
+ macros
+
+******************************************************************************/
+
+#define HEADER "TEST RESULT \n"
+#define DASH "-------------------------------------------------------\n"
+
+#define NW_TEST_SUFFIX ".nw-test"
+#define NW_RESULT_SUFFIX ".nw-result"
+#define TEST_SUFFIX ".test"
+#define RESULT_SUFFIX ".result"
+#define REJECT_SUFFIX ".reject"
+#define OUT_SUFFIX ".out"
+#define ERR_SUFFIX ".err"
+
+const char *TEST_PASS= "[ pass ]";
+const char *TEST_SKIP= "[ skip ]";
+const char *TEST_FAIL= "[ fail ]";
+const char *TEST_BAD= "[ bad ]";
+const char *TEST_IGNORE= "[ignore]";
+
+/******************************************************************************
+
+ global variables
+
+******************************************************************************/
+
+#ifdef __NETWARE__
+static char base_dir[PATH_MAX]= "sys:/mysql";
+#else
+static char base_dir[PATH_MAX]= "..";
+#endif
+static char db[PATH_MAX]= "test";
+static char user[PATH_MAX]= "root";
+static char password[PATH_MAX]= "";
+
+int master_port= 9306;
+int slave_port= 9307;
+
+#if !defined(__NETWARE__) && !defined(__WIN__)
+static char master_socket[PATH_MAX]= "./var/tmp/master.sock";
+static char slave_socket[PATH_MAX]= "./var/tmp/slave.sock";
+#endif
+
+/* comma delimited list of tests to skip or empty string */
+#ifndef __WIN__
+static char skip_test[PATH_MAX]= " lowercase_table3 , system_mysql_db_fix ";
+#else
+/*
+ The most ignore testes contain the calls of system command
+*/
+#define MAX_COUNT_TESTES 1024
+/*
+ lowercase_table3 is disabled by Gerg
+ system_mysql_db_fix is disabled by Gerg
+ sp contains a command system
+ rpl_EE_error contains a command system
+ rpl_loaddatalocal contains a command system
+ ndb_autodiscover contains a command system
+ rpl_rotate_logs contains a command system
+ repair contains a command system
+ rpl_trunc_binlog contains a command system
+ mysqldump contains a command system
+ rpl000001 makes non-exit loop...temporary skiped
+*/
+static char skip_test[PATH_MAX]=
+" lowercase_table3 ,"
+" system_mysql_db_fix ,"
+" sp ,"
+" rpl_EE_error ,"
+" rpl_loaddatalocal ,"
+" ndb_autodiscover ,"
+" rpl_rotate_logs ,"
+" repair ,"
+" rpl_trunc_binlog ,"
+" mysqldump ,"
+" rpl000001 ";
+#endif
+static char ignore_test[PATH_MAX]= "";
+
+static char bin_dir[PATH_MAX];
+static char mysql_test_dir[PATH_MAX];
+static char test_dir[PATH_MAX];
+static char mysql_tmp_dir[PATH_MAX];
+static char result_dir[PATH_MAX];
+static char master_dir[PATH_MAX];
+static char slave_dir[PATH_MAX];
+static char lang_dir[PATH_MAX];
+static char char_dir[PATH_MAX];
+
+static char mysqladmin_file[PATH_MAX];
+static char mysqld_file[PATH_MAX];
+static char mysqltest_file[PATH_MAX];
+#ifndef __WIN__
+static char master_pid[PATH_MAX];
+static char slave_pid[PATH_MAX];
+static char sh_file[PATH_MAX]= "/bin/sh";
+#else
+static HANDLE master_pid;
+static HANDLE slave_pid;
+#endif
+
+static char master_opt[PATH_MAX]= "";
+static char slave_opt[PATH_MAX]= "";
+
+static char slave_master_info[PATH_MAX]= "";
+
+static char master_init_script[PATH_MAX]= "";
+static char slave_init_script[PATH_MAX]= "";
+
+/* OpenSSL */
+static char ca_cert[PATH_MAX];
+static char server_cert[PATH_MAX];
+static char server_key[PATH_MAX];
+static char client_cert[PATH_MAX];
+static char client_key[PATH_MAX];
+
+int total_skip= 0;
+int total_pass= 0;
+int total_fail= 0;
+int total_test= 0;
+
+int total_ignore= 0;
+
+int use_openssl= FALSE;
+int master_running= FALSE;
+int slave_running= FALSE;
+int skip_slave= TRUE;
+int single_test= TRUE;
+
+int restarts= 0;
+
+FILE *log_fd= NULL;
+
+/******************************************************************************
+
+ functions
+
+******************************************************************************/
+
+/******************************************************************************
+
+ prototypes
+
+******************************************************************************/
+
+void report_stats();
+void install_db(char *);
+void mysql_install_db();
+void start_master();
+void start_slave();
+void mysql_start();
+void stop_slave();
+void stop_master();
+void mysql_stop();
+void mysql_restart();
+int read_option(char *, char *);
+void run_test(char *);
+void setup(char *);
+void vlog(const char *, va_list);
+void mlog(const char *, ...);
+void log_info(const char *, ...);
+void log_error(const char *, ...);
+void log_errno(const char *, ...);
+void die(const char *);
+char *str_tok(char *string, const char *delim);
+#ifndef __WIN__
+void run_init_script(const char *script_name);
+#endif
+/******************************************************************************
+
+ report_stats()
+
+ Report the gathered statistics.
+
+******************************************************************************/
+
+void report_stats()
+{
+ if (total_fail == 0)
+ {
+ mlog("\nAll %d test(s) were successful.\n", total_test);
+ }
+ else
+ {
+ double percent= ((double)total_pass / total_test) * 100;
+
+ mlog("\nFailed %u/%u test(s), %.02f%% successful.\n",
+ total_fail, total_test, percent);
+ mlog("\nThe .out and .err files in %s may give you some\n", result_dir);
+ mlog("hint of what when wrong.\n");
+ mlog("\nIf you want to report this error, please first read "
+ "the documentation\n");
+ mlog("at: http://www.mysql.com/doc/M/y/MySQL_test_suite.html\n");
+ }
+}
+
+/******************************************************************************
+
+ install_db()
+
+ Install the a database.
+
+******************************************************************************/
+
+void install_db(char *datadir)
+{
+ arg_list_t al;
+ int err;
+ char input[PATH_MAX];
+ char output[PATH_MAX];
+ char error[PATH_MAX];
+
+ /* input file */
+#ifdef __NETWARE__
+ snprintf(input, PATH_MAX, "%s/bin/init_db.sql", base_dir);
+#else
+ snprintf(input, PATH_MAX, "%s/mysql-test/init_db.sql", base_dir);
+#endif
+ snprintf(output, PATH_MAX, "%s/install.out", datadir);
+ snprintf(error, PATH_MAX, "%s/install.err", datadir);
+
+ /* args */
+ init_args(&al);
+ add_arg(&al, mysqld_file);
+ add_arg(&al, "--no-defaults");
+ add_arg(&al, "--bootstrap");
+ add_arg(&al, "--skip-grant-tables");
+ add_arg(&al, "--basedir=%s", base_dir);
+ add_arg(&al, "--datadir=%s", datadir);
+ add_arg(&al, "--skip-innodb");
+ add_arg(&al, "--skip-bdb");
+#ifndef __NETWARE__
+ add_arg(&al, "--character-sets-dir=%s", char_dir);
+ add_arg(&al, "--language=%s", lang_dir);
+#endif
+
+ /* spawn */
+ if ((err= spawn(mysqld_file, &al, TRUE, input, output, error, NULL)) != 0)
+ {
+ die("Unable to create database.");
+ }
+
+ /* free args */
+ free_args(&al);
+}
+
+/******************************************************************************
+
+ mysql_install_db()
+
+ Install the test databases.
+
+******************************************************************************/
+
+void mysql_install_db()
+{
+ char temp[PATH_MAX];
+
+ /* var directory */
+ snprintf(temp, PATH_MAX, "%s/var", mysql_test_dir);
+
+ /* clean up old direcotry */
+ del_tree(temp);
+
+ /* create var directory */
+#ifndef __WIN__
+ mkdir(temp, S_IRWXU);
+ /* create subdirectories */
+ mlog("Creating test-suite folders...\n");
+ snprintf(temp, PATH_MAX, "%s/var/run", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, PATH_MAX, "%s/var/tmp", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, PATH_MAX, "%s/var/master-data", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, PATH_MAX, "%s/var/master-data/mysql", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, PATH_MAX, "%s/var/master-data/test", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, PATH_MAX, "%s/var/slave-data", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, PATH_MAX, "%s/var/slave-data/mysql", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, PATH_MAX, "%s/var/slave-data/test", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+#else
+ mkdir(temp);
+ /* create subdirectories */
+ mlog("Creating test-suite folders...\n");
+ snprintf(temp, PATH_MAX, "%s/var/run", mysql_test_dir);
+ mkdir(temp);
+ snprintf(temp, PATH_MAX, "%s/var/tmp", mysql_test_dir);
+ mkdir(temp);
+ snprintf(temp, PATH_MAX, "%s/var/master-data", mysql_test_dir);
+ mkdir(temp);
+ snprintf(temp, PATH_MAX, "%s/var/master-data/mysql", mysql_test_dir);
+ mkdir(temp);
+ snprintf(temp, PATH_MAX, "%s/var/master-data/test", mysql_test_dir);
+ mkdir(temp);
+ snprintf(temp, PATH_MAX, "%s/var/slave-data", mysql_test_dir);
+ mkdir(temp);
+ snprintf(temp, PATH_MAX, "%s/var/slave-data/mysql", mysql_test_dir);
+ mkdir(temp);
+ snprintf(temp, PATH_MAX, "%s/var/slave-data/test", mysql_test_dir);
+ mkdir(temp);
+#endif
+
+ /* install databases */
+ mlog("Creating test databases for master... \n");
+ install_db(master_dir);
+ mlog("Creating test databases for slave... \n");
+ install_db(slave_dir);
+}
+
+/******************************************************************************
+
+ start_master()
+
+ Start the master server.
+
+******************************************************************************/
+
+void start_master()
+{
+ arg_list_t al;
+ int err;
+ char master_out[PATH_MAX];
+ char master_err[PATH_MAX];
+/* char temp[PATH_MAX]; */
+ char temp2[PATH_MAX];
+
+ /* remove old berkeley db log files that can confuse the server */
+ removef("%s/log.*", master_dir);
+
+ /* remove stale binary logs */
+ removef("%s/var/log/*-bin.*", mysql_test_dir);
+
+ /* remove stale binary logs */
+ removef("%s/var/log/*.index", mysql_test_dir);
+
+ /* remove master.info file */
+ removef("%s/master.info", master_dir);
+
+ /* remove relay files */
+ removef("%s/var/log/*relay*", mysql_test_dir);
+
+ /* remove relay-log.info file */
+ removef("%s/relay-log.info", master_dir);
+
+ /* init script */
+ if (master_init_script[0] != 0)
+ {
+#ifdef __NETWARE__
+ /* TODO: use the scripts */
+ if (strinstr(master_init_script, "repair_part2-master.sh") != 0)
+ {
+ FILE *fp;
+
+ /* create an empty index file */
+ snprintf(temp, PATH_MAX, "%s/test/t1.MYI", master_dir);
+ fp= fopen(temp, "wb+");
+
+ fputs("1", fp);
+
+ fclose(fp);
+ }
+#elif !defined(__WIN__)
+ run_init_script(master_init_script);
+#endif
+ }
+
+ /* redirection files */
+ snprintf(master_out, PATH_MAX, "%s/var/run/master%u.out",
+ mysql_test_dir, restarts);
+ snprintf(master_err, PATH_MAX, "%s/var/run/master%u.err",
+ mysql_test_dir, restarts);
+#ifndef __WIN__
+ snprintf(temp2,PATH_MAX,"%s/var",mysql_test_dir);
+ mkdir(temp2,S_IRWXU);
+ snprintf(temp2,PATH_MAX,"%s/var/log",mysql_test_dir);
+ mkdir(temp2,S_IRWXU);
+#else
+ snprintf(temp2,PATH_MAX,"%s/var",mysql_test_dir);
+ mkdir(temp2);
+ snprintf(temp2,PATH_MAX,"%s/var/log",mysql_test_dir);
+ mkdir(temp2);
+#endif
+ /* args */
+ init_args(&al);
+ add_arg(&al, "%s", mysqld_file);
+ add_arg(&al, "--no-defaults");
+ add_arg(&al, "--log-bin=%s/var/log/master-bin",mysql_test_dir);
+ add_arg(&al, "--server-id=1");
+ add_arg(&al, "--basedir=%s", base_dir);
+ add_arg(&al, "--port=%u", master_port);
+#if !defined(__NETWARE__) && !defined(__WIN__)
+ add_arg(&al, "--socket=%s",master_socket);
+#endif
+ add_arg(&al, "--local-infile");
+ add_arg(&al, "--core");
+ add_arg(&al, "--datadir=%s", master_dir);
+#ifndef __WIN__
+ add_arg(&al, "--pid-file=%s", master_pid);
+#endif
+ add_arg(&al, "--character-sets-dir=%s", char_dir);
+ add_arg(&al, "--tmpdir=%s", mysql_tmp_dir);
+ add_arg(&al, "--language=%s", lang_dir);
+#ifdef DEBUG /* only for debug builds */
+ add_arg(&al, "--debug");
+#endif
+
+ if (use_openssl)
+ {
+ add_arg(&al, "--ssl-ca=%s", ca_cert);
+ add_arg(&al, "--ssl-cert=%s", server_cert);
+ add_arg(&al, "--ssl-key=%s", server_key);
+ }
+
+ /* $MASTER_40_ARGS */
+ add_arg(&al, "--rpl-recovery-rank=1");
+ add_arg(&al, "--init-rpl-role=master");
+
+ /* $SMALL_SERVER */
+ add_arg(&al, "-O");
+ add_arg(&al, "key_buffer_size=1M");
+ add_arg(&al, "-O");
+ add_arg(&al, "sort_buffer=256K");
+ add_arg(&al, "-O");
+ add_arg(&al, "max_heap_table_size=1M");
+
+ /* $EXTRA_MASTER_OPT */
+ if (master_opt[0] != 0)
+ {
+ char *p;
+
+ p= (char *)str_tok(master_opt, " \t");
+ if (!strstr(master_opt, "timezone"))
+ {
+ while (p)
+ {
+ add_arg(&al, "%s", p);
+ p= (char *)str_tok(NULL, " \t");
+ }
+ }
+ }
+
+ /* remove the pid file if it exists */
+#ifndef __WIN__
+ remove(master_pid);
+#endif
+
+ /* spawn */
+#ifdef __WIN__
+ if ((err= spawn(mysqld_file, &al, FALSE, NULL,
+ master_out, master_err, &master_pid)) == 0)
+#else
+ if ((err= spawn(mysqld_file, &al, FALSE, NULL,
+ master_out, master_err, master_pid)) == 0)
+#endif
+ {
+ sleep_until_file_exists(master_pid);
+
+ if ((err= wait_for_server_start(bin_dir, mysqladmin_file, user, password,
+ master_port, mysql_tmp_dir)) == 0)
+ {
+ master_running= TRUE;
+ }
+ else
+ {
+ log_error("The master server went down early.");
+ }
+ }
+ else
+ {
+ log_error("Unable to start master server.");
+ }
+
+ /* free_args */
+ free_args(&al);
+}
+
+/******************************************************************************
+
+ start_slave()
+
+ Start the slave server.
+
+******************************************************************************/
+
+void start_slave()
+{
+ arg_list_t al;
+ int err;
+ char slave_out[PATH_MAX];
+ char slave_err[PATH_MAX];
+
+ /* skip? */
+ if (skip_slave) return;
+
+ /* remove stale binary logs */
+ removef("%s/*-bin.*", slave_dir);
+
+ /* remove stale binary logs */
+ removef("%s/*.index", slave_dir);
+
+ /* remove master.info file */
+ removef("%s/master.info", slave_dir);
+
+ /* remove relay files */
+ removef("%s/var/log/*relay*", mysql_test_dir);
+
+ /* remove relay-log.info file */
+ removef("%s/relay-log.info", slave_dir);
+
+ /* init script */
+ if (slave_init_script[0] != 0)
+ {
+#ifdef __NETWARE__
+ /* TODO: use the scripts */
+ if (strinstr(slave_init_script, "rpl000016-slave.sh") != 0)
+ {
+ /* create empty master.info file */
+ snprintf(temp, PATH_MAX, "%s/master.info", slave_dir);
+ close(open(temp, O_WRONLY | O_CREAT,S_IRWXU|S_IRWXG|S_IRWXO));
+ }
+ else if (strinstr(slave_init_script, "rpl000017-slave.sh") != 0)
+ {
+ FILE *fp;
+
+ /* create a master.info file */
+ snprintf(temp, PATH_MAX, "%s/master.info", slave_dir);
+ fp= fopen(temp, "wb+");
+
+ fputs("master-bin.000001\n", fp);
+ fputs("4\n", fp);
+ fputs("127.0.0.1\n", fp);
+ fputs("replicate\n", fp);
+ fputs("aaaaaaaaaaaaaaab\n", fp);
+ fputs("9306\n", fp);
+ fputs("1\n", fp);
+ fputs("0\n", fp);
+
+ fclose(fp);
+ }
+ else if (strinstr(slave_init_script, "rpl_rotate_logs-slave.sh") != 0)
+ {
+ /* create empty master.info file */
+ snprintf(temp, PATH_MAX, "%s/master.info", slave_dir);
+ close(open(temp, O_WRONLY | O_CREAT,S_IRWXU|S_IRWXG|S_IRWXO));
+ }
+#elif !defined(__WIN__)
+ run_init_script(slave_init_script);
+#endif
+ }
+
+ /* redirection files */
+ snprintf(slave_out, PATH_MAX, "%s/var/run/slave%u.out",
+ mysql_test_dir, restarts);
+ snprintf(slave_err, PATH_MAX, "%s/var/run/slave%u.err",
+ mysql_test_dir, restarts);
+
+ /* args */
+ init_args(&al);
+ add_arg(&al, "%s", mysqld_file);
+ add_arg(&al, "--no-defaults");
+ add_arg(&al, "--log-bin=slave-bin");
+ add_arg(&al, "--relay_log=slave-relay-bin");
+ add_arg(&al, "--basedir=%s", base_dir);
+ add_arg(&al, "--port=%u", slave_port);
+#if !defined(__NETWARE__) && !defined(__WIN__)
+ add_arg(&al, "--socket=%s",slave_socket);
+#endif
+ add_arg(&al, "--datadir=%s", slave_dir);
+#ifndef __WIN__
+ add_arg(&al, "--pid-file=%s", slave_pid);
+#endif
+ add_arg(&al, "--character-sets-dir=%s", char_dir);
+ add_arg(&al, "--core");
+ add_arg(&al, "--tmpdir=%s", mysql_tmp_dir);
+ add_arg(&al, "--language=%s", lang_dir);
+
+ add_arg(&al, "--exit-info=256");
+ add_arg(&al, "--log-slave-updates");
+ add_arg(&al, "--init-rpl-role=slave");
+ add_arg(&al, "--skip-innodb");
+ add_arg(&al, "--skip-slave-start");
+ add_arg(&al, "--slave-load-tmpdir=../../var/tmp");
+
+ add_arg(&al, "--report-user=%s", user);
+ add_arg(&al, "--report-host=127.0.0.1");
+ add_arg(&al, "--report-port=%u", slave_port);
+
+ add_arg(&al, "--master-retry-count=10");
+ add_arg(&al, "-O");
+ add_arg(&al, "slave_net_timeout=10");
+#ifdef DEBUG /* only for debug builds */
+ add_arg(&al, "--debug");
+#endif
+
+ if (use_openssl)
+ {
+ add_arg(&al, "--ssl-ca=%s", ca_cert);
+ add_arg(&al, "--ssl-cert=%s", server_cert);
+ add_arg(&al, "--ssl-key=%s", server_key);
+ }
+
+ /* slave master info */
+ if (slave_master_info[0] != 0)
+ {
+ char *p;
+
+ p= (char *)str_tok(slave_master_info, " \t");
+
+ while (p)
+ {
+ add_arg(&al, "%s", p);
+ p= (char *)str_tok(NULL, " \t");
+ }
+ }
+ else
+ {
+ add_arg(&al, "--master-user=%s", user);
+ add_arg(&al, "--master-password=%s", password);
+ add_arg(&al, "--master-host=127.0.0.1");
+ add_arg(&al, "--master-port=%u", master_port);
+ add_arg(&al, "--master-connect-retry=1");
+ add_arg(&al, "--server-id=2");
+ add_arg(&al, "--rpl-recovery-rank=2");
+ }
+
+ /* small server */
+ add_arg(&al, "-O");
+ add_arg(&al, "key_buffer_size=1M");
+ add_arg(&al, "-O");
+ add_arg(&al, "sort_buffer=256K");
+ add_arg(&al, "-O");
+ add_arg(&al, "max_heap_table_size=1M");
+
+
+ /* opt args */
+ if (slave_opt[0] != 0)
+ {
+ char *p;
+
+ p= (char *)str_tok(slave_opt, " \t");
+
+ while (p)
+ {
+ add_arg(&al, "%s", p);
+ p= (char *)str_tok(NULL, " \t");
+ }
+ }
+
+ /* remove the pid file if it exists */
+#ifndef __WIN__
+ remove(slave_pid);
+#endif
+ /* spawn */
+#ifdef __WIN__
+ if ((err= spawn(mysqld_file, &al, FALSE, NULL,
+ slave_out, slave_err, &slave_pid)) == 0)
+#else
+ if ((err= spawn(mysqld_file, &al, FALSE, NULL,
+ slave_out, slave_err, slave_pid)) == 0)
+#endif
+ {
+ sleep_until_file_exists(slave_pid);
+
+ if ((err= wait_for_server_start(bin_dir, mysqladmin_file, user, password,
+ slave_port, mysql_tmp_dir)) == 0)
+ {
+ slave_running= TRUE;
+ }
+ else
+ {
+ log_error("The slave server went down early.");
+ }
+ }
+ else
+ {
+ log_error("Unable to start slave server.");
+ }
+
+ /* free args */
+ free_args(&al);
+}
+
+/******************************************************************************
+
+ mysql_start()
+
+ Start the mysql servers.
+
+******************************************************************************/
+
+void mysql_start()
+{
+/* log_info("Starting the MySQL server(s): %u", ++restarts); */
+ start_master();
+
+ start_slave();
+
+ /* activate the test screen */
+#ifdef __NETWARE__
+ ActivateScreen(getscreenhandle());
+#endif
+}
+
+/******************************************************************************
+
+ stop_slave()
+
+ Stop the slave server.
+
+******************************************************************************/
+
+void stop_slave()
+{
+ int err;
+
+ /* running? */
+ if (!slave_running) return;
+
+ /* stop */
+ if ((err= stop_server(bin_dir, mysqladmin_file, user, password,
+ slave_port, slave_pid, mysql_tmp_dir)) == 0)
+ {
+ slave_running= FALSE;
+ }
+ else
+ {
+ log_error("Unable to stop slave server.");
+ }
+}
+
+/******************************************************************************
+
+ stop_master()
+
+ Stop the master server.
+
+******************************************************************************/
+
+void stop_master()
+{
+ int err;
+
+ /* running? */
+ if (!master_running) return;
+
+ if ((err= stop_server(bin_dir, mysqladmin_file, user, password,
+ master_port, master_pid, mysql_tmp_dir)) == 0)
+ {
+ master_running= FALSE;
+ }
+ else
+ {
+ log_error("Unable to stop master server.");
+ }
+}
+
+/******************************************************************************
+
+ mysql_stop()
+
+ Stop the mysql servers.
+
+******************************************************************************/
+
+void mysql_stop()
+{
+
+ stop_master();
+
+ stop_slave();
+
+ /* activate the test screen */
+#ifdef __NETWARE__
+ ActivateScreen(getscreenhandle());
+#endif
+}
+
+/******************************************************************************
+
+ mysql_restart()
+
+ Restart the mysql servers.
+
+******************************************************************************/
+
+void mysql_restart()
+{
+/* log_info("Restarting the MySQL server(s): %u", ++restarts); */
+
+ mysql_stop();
+
+ mlog(DASH);
+
+ mysql_start();
+}
+
+/******************************************************************************
+
+ read_option()
+
+ Read the option file.
+
+******************************************************************************/
+
+int read_option(char *opt_file, char *opt)
+{
+ int fd, err;
+ char *p;
+ char buf[PATH_MAX];
+
+ /* copy current option */
+ strncpy(buf, opt, PATH_MAX);
+
+ /* open options file */
+ fd= open(opt_file, O_RDONLY);
+ err= read(fd, opt, PATH_MAX);
+ close(fd);
+
+ if (err > 0)
+ {
+ /* terminate string */
+ if ((p= strchr(opt, '\n')) != NULL)
+ {
+ *p= 0;
+
+ /* check for a '\r' */
+ if ((p= strchr(opt, '\r')) != NULL)
+ {
+ *p= 0;
+ }
+ }
+ else
+ {
+ opt[err]= 0;
+ }
+
+ /* check for $MYSQL_TEST_DIR */
+ if ((p= strstr(opt, "$MYSQL_TEST_DIR")) != NULL)
+ {
+ char temp[PATH_MAX];
+
+ *p= 0;
+
+ strcpy(temp, p + strlen("$MYSQL_TEST_DIR"));
+ strcat(opt, mysql_test_dir);
+ strcat(opt, temp);
+ }
+ /* Check for double backslash and replace it with single bakslash */
+ if ((p= strstr(opt, "\\\\")) != NULL)
+ {
+ /* bmove is guranteed to work byte by byte */
+ bmove(p, p+1, strlen(p+1));
+ }
+ }
+ else
+ {
+ /* clear option */
+ *opt= 0;
+ }
+
+ /* compare current option with previous */
+ return strcmp(opt, buf);
+}
+
+/******************************************************************************
+
+ run_test()
+
+ Run the given test case.
+
+******************************************************************************/
+
+void run_test(char *test)
+{
+ char temp[PATH_MAX];
+ const char *rstr;
+ int skip= FALSE, ignore=FALSE;
+ int restart= FALSE;
+ int flag= FALSE;
+ struct stat info;
+
+ /* skip tests in the skip list */
+ snprintf(temp, PATH_MAX, " %s ", test);
+ skip= (strinstr(skip_test, temp) != 0);
+ if (skip == FALSE)
+ ignore= (strinstr(ignore_test, temp) != 0);
+
+ snprintf(master_init_script, PATH_MAX, "%s/%s-master.sh", test_dir, test);
+ snprintf(slave_init_script, PATH_MAX, "%s/%s-slave.sh", test_dir, test);
+#ifdef __WIN__
+ if (! stat(master_init_script, &info))
+ skip= TRUE;
+ if (!stat(slave_init_script, &info))
+ skip= TRUE;
+#endif
+ if (ignore)
+ {
+ /* show test */
+ mlog("%-46s ", test);
+
+ /* ignore */
+ rstr= TEST_IGNORE;
+ ++total_ignore;
+ }
+ else if (!skip) /* skip test? */
+ {
+ char test_file[PATH_MAX];
+ char master_opt_file[PATH_MAX];
+ char slave_opt_file[PATH_MAX];
+ char slave_master_info_file[PATH_MAX];
+ char result_file[PATH_MAX];
+ char reject_file[PATH_MAX];
+ char out_file[PATH_MAX];
+ char err_file[PATH_MAX];
+ int err;
+ arg_list_t al;
+#ifdef __WIN__
+ /* Clean test database */
+ removef("%s/test/*.*", master_dir);
+ removef("%s/test/*.*", slave_dir);
+ removef("%s/mysqltest/*.*", master_dir);
+ removef("%s/mysqltest/*.*", slave_dir);
+
+#endif
+ /* skip slave? */
+ flag= skip_slave;
+ skip_slave= (strncmp(test, "rpl", 3) != 0);
+ if (flag != skip_slave) restart= TRUE;
+
+ /* create files */
+ snprintf(master_opt_file, PATH_MAX, "%s/%s-master.opt", test_dir, test);
+ snprintf(slave_opt_file, PATH_MAX, "%s/%s-slave.opt", test_dir, test);
+ snprintf(slave_master_info_file, PATH_MAX, "%s/%s.slave-mi",
+ test_dir, test);
+ snprintf(reject_file, PATH_MAX, "%s/%s%s",
+ result_dir, test, REJECT_SUFFIX);
+ snprintf(out_file, PATH_MAX, "%s/%s%s", result_dir, test, OUT_SUFFIX);
+ snprintf(err_file, PATH_MAX, "%s/%s%s", result_dir, test, ERR_SUFFIX);
+
+ /* netware specific files */
+ snprintf(test_file, PATH_MAX, "%s/%s%s", test_dir, test, NW_TEST_SUFFIX);
+ if (stat(test_file, &info))
+ {
+ snprintf(test_file, PATH_MAX, "%s/%s%s", test_dir, test, TEST_SUFFIX);
+ if (access(test_file,0))
+ {
+ printf("Invalid test name %s, %s file not found\n",test,test_file);
+ return;
+ }
+ }
+
+ snprintf(result_file, PATH_MAX, "%s/%s%s",
+ result_dir, test, NW_RESULT_SUFFIX);
+ if (stat(result_file, &info))
+ {
+ snprintf(result_file, PATH_MAX, "%s/%s%s",
+ result_dir, test, RESULT_SUFFIX);
+ }
+
+ /* init scripts */
+ if (stat(master_init_script, &info))
+ master_init_script[0]= 0;
+ else
+ restart= TRUE;
+
+ if (stat(slave_init_script, &info))
+ slave_init_script[0]= 0;
+ else
+ restart= TRUE;
+
+ /* read options */
+ if (read_option(master_opt_file, master_opt)) restart= TRUE;
+ if (read_option(slave_opt_file, slave_opt)) restart= TRUE;
+ if (read_option(slave_master_info_file, slave_master_info)) restart= TRUE;
+
+ /* cleanup previous run */
+ remove(reject_file);
+ remove(out_file);
+ remove(err_file);
+
+ /* start or restart? */
+ if (!master_running) mysql_start();
+ else if (restart) mysql_restart();
+
+ /* let the system stabalize */
+ sleep(1);
+
+ /* show test */
+ mlog("%-46s ", test);
+
+ /* args */
+ init_args(&al);
+ add_arg(&al, "%s", mysqltest_file);
+ add_arg(&al, "--no-defaults");
+ add_arg(&al, "--port=%u", master_port);
+#if !defined(__NETWARE__) && !defined(__WIN__)
+ add_arg(&al, "--socket=%s", master_socket);
+ add_arg(&al, "--tmpdir=%s", mysql_tmp_dir);
+#endif
+ add_arg(&al, "--database=%s", db);
+ add_arg(&al, "--user=%s", user);
+ add_arg(&al, "--password=%s", password);
+ add_arg(&al, "--silent");
+ add_arg(&al, "--basedir=%s/", mysql_test_dir);
+ add_arg(&al, "--host=127.0.0.1");
+ add_arg(&al, "-v");
+ add_arg(&al, "-R");
+ add_arg(&al, "%s", result_file);
+
+ if (use_openssl)
+ {
+ add_arg(&al, "--ssl-ca=%s", ca_cert);
+ add_arg(&al, "--ssl-cert=%s", client_cert);
+ add_arg(&al, "--ssl-key=%s", client_key);
+ }
+
+ /* spawn */
+ err= spawn(mysqltest_file, &al, TRUE, test_file, out_file, err_file, NULL);
+
+ /* free args */
+ free_args(&al);
+
+ remove_empty_file(out_file);
+ remove_empty_file(err_file);
+
+ if (err == 0)
+ {
+ /* pass */
+ rstr= TEST_PASS;
+ ++total_pass;
+
+ /* increment total */
+ ++total_test;
+ }
+ else if (err == 2)
+ {
+ /* skip */
+ rstr= TEST_SKIP;
+ ++total_skip;
+ }
+ else if (err == 1)
+ {
+ /* fail */
+ rstr= TEST_FAIL;
+ ++total_fail;
+
+ /* increment total */
+ ++total_test;
+ }
+ else
+ {
+ rstr= TEST_BAD;
+ }
+ }
+ else /* early skips */
+ {
+ /* show test */
+ mlog("%-46s ", test);
+
+ /* skip */
+ rstr= TEST_SKIP;
+ ++total_skip;
+ }
+
+ /* result */
+ mlog("%-14s\n", rstr);
+}
+
+/******************************************************************************
+
+ vlog()
+
+ Log the message.
+
+******************************************************************************/
+
+void vlog(const char *format, va_list ap)
+{
+ vfprintf(stdout, format, ap);
+ fflush(stdout);
+
+ if (log_fd)
+ {
+ vfprintf(log_fd, format, ap);
+ fflush(log_fd);
+ }
+}
+
+/******************************************************************************
+
+ log()
+
+ Log the message.
+
+******************************************************************************/
+
+void mlog(const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+
+ vlog(format, ap);
+
+ va_end(ap);
+}
+
+/******************************************************************************
+
+ log_info()
+
+ Log the given information.
+
+******************************************************************************/
+
+void log_info(const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+
+ mlog("-- INFO : ");
+ vlog(format, ap);
+ mlog("\n");
+
+ va_end(ap);
+}
+
+/******************************************************************************
+
+ log_error()
+
+ Log the given error.
+
+******************************************************************************/
+
+void log_error(const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+
+ mlog("-- ERROR: ");
+ vlog(format, ap);
+ mlog("\n");
+
+ va_end(ap);
+}
+
+/******************************************************************************
+
+ log_errno()
+
+ Log the given error and errno.
+
+******************************************************************************/
+
+void log_errno(const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+
+ mlog("-- ERROR: (%003u) ", errno);
+ vlog(format, ap);
+ mlog("\n");
+
+ va_end(ap);
+}
+
+/******************************************************************************
+
+ die()
+
+ Exit the application.
+
+******************************************************************************/
+
+void die(const char *msg)
+{
+ log_error(msg);
+#ifdef __NETWARE__
+ pressanykey();
+#endif
+ exit(-1);
+}
+
+/******************************************************************************
+
+ setup()
+
+ Setup the mysql test enviornment.
+
+******************************************************************************/
+
+void setup(char *file __attribute__((unused)))
+{
+ char temp[PATH_MAX];
+ char file_path[PATH_MAX*2];
+ char *p;
+ int position;
+
+ /* set the timezone for the timestamp test */
+#ifdef __WIN__
+ _putenv( "TZ=GMT-3" );
+#else
+ setenv("TZ", "GMT-3", TRUE);
+#endif
+ /* find base dir */
+#ifdef __NETWARE__
+ strcpy(temp, strlwr(file));
+ while ((p= strchr(temp, '\\')) != NULL) *p= '/';
+#else
+ getcwd(temp, PATH_MAX);
+ position= strlen(temp);
+ temp[position]= '/';
+ temp[position+1]= 0;
+#ifdef __WIN__
+ while ((p= strchr(temp, '\\')) != NULL) *p= '/';
+#endif
+#endif
+
+ if ((position= strinstr(temp, "/mysql-test/")) != 0)
+ {
+ p= temp + position - 1;
+ *p= 0;
+ strcpy(base_dir, temp);
+ }
+
+ log_info("Currect directory: %s",base_dir);
+
+#ifdef __NETWARE__
+ /* setup paths */
+ snprintf(bin_dir, PATH_MAX, "%s/bin", base_dir);
+ snprintf(mysql_test_dir, PATH_MAX, "%s/mysql-test", base_dir);
+ snprintf(test_dir, PATH_MAX, "%s/t", mysql_test_dir);
+ snprintf(mysql_tmp_dir, PATH_MAX, "%s/var/tmp", mysql_test_dir);
+ snprintf(result_dir, PATH_MAX, "%s/r", mysql_test_dir);
+ snprintf(master_dir, PATH_MAX, "%s/var/master-data", mysql_test_dir);
+ snprintf(slave_dir, PATH_MAX, "%s/var/slave-data", mysql_test_dir);
+ snprintf(lang_dir, PATH_MAX, "%s/share/english", base_dir);
+ snprintf(char_dir, PATH_MAX, "%s/share/charsets", base_dir);
+
+#ifdef HAVE_OPENSSL
+ use_openssl= TRUE;
+#endif /* HAVE_OPENSSL */
+
+ /* OpenSSL paths */
+ snprintf(ca_cert, PATH_MAX, "%s/SSL/cacert.pem", base_dir);
+ snprintf(server_cert, PATH_MAX, "%s/SSL/server-cert.pem", base_dir);
+ snprintf(server_key, PATH_MAX, "%s/SSL/server-key.pem", base_dir);
+ snprintf(client_cert, PATH_MAX, "%s/SSL/client-cert.pem", base_dir);
+ snprintf(client_key, PATH_MAX, "%s/SSL/client-key.pem", base_dir);
+
+ /* setup files */
+ snprintf(mysqld_file, PATH_MAX, "%s/mysqld", bin_dir);
+ snprintf(mysqltest_file, PATH_MAX, "%s/mysqltest", bin_dir);
+ snprintf(mysqladmin_file, PATH_MAX, "%s/mysqladmin", bin_dir);
+ snprintf(master_pid, PATH_MAX, "%s/var/run/master.pid", mysql_test_dir);
+ snprintf(slave_pid, PATH_MAX, "%s/var/run/slave.pid", mysql_test_dir);
+#elif __WIN__
+ /* setup paths */
+#ifdef _DEBUG
+ snprintf(bin_dir, PATH_MAX, "%s/client_debug", base_dir);
+#else
+ snprintf(bin_dir, PATH_MAX, "%s/client_release", base_dir);
+#endif
+ snprintf(mysql_test_dir, PATH_MAX, "%s/mysql-test", base_dir);
+ snprintf(test_dir, PATH_MAX, "%s/t", mysql_test_dir);
+ snprintf(mysql_tmp_dir, PATH_MAX, "%s/var/tmp", mysql_test_dir);
+ snprintf(result_dir, PATH_MAX, "%s/r", mysql_test_dir);
+ snprintf(master_dir, PATH_MAX, "%s/var/master-data", mysql_test_dir);
+ snprintf(slave_dir, PATH_MAX, "%s/var/slave-data", mysql_test_dir);
+ snprintf(lang_dir, PATH_MAX, "%s/share/english", base_dir);
+ snprintf(char_dir, PATH_MAX, "%s/share/charsets", base_dir);
+
+#ifdef HAVE_OPENSSL
+ use_openssl= TRUE;
+#endif /* HAVE_OPENSSL */
+
+ /* OpenSSL paths */
+ snprintf(ca_cert, PATH_MAX, "%s/SSL/cacert.pem", base_dir);
+ snprintf(server_cert, PATH_MAX, "%s/SSL/server-cert.pem", base_dir);
+ snprintf(server_key, PATH_MAX, "%s/SSL/server-key.pem", base_dir);
+ snprintf(client_cert, PATH_MAX, "%s/SSL/client-cert.pem", base_dir);
+ snprintf(client_key, PATH_MAX, "%s/SSL/client-key.pem", base_dir);
+
+ /* setup files */
+ snprintf(mysqld_file, PATH_MAX, "%s/mysqld.exe", bin_dir);
+ snprintf(mysqltest_file, PATH_MAX, "%s/mysqltest.exe", bin_dir);
+ snprintf(mysqladmin_file, PATH_MAX, "%s/mysqladmin.exe", bin_dir);
+#else
+ /* setup paths */
+ snprintf(bin_dir, PATH_MAX, "%s/client", base_dir);
+ snprintf(mysql_test_dir, PATH_MAX, "%s/mysql-test", base_dir);
+ snprintf(test_dir, PATH_MAX, "%s/t", mysql_test_dir);
+ snprintf(mysql_tmp_dir, PATH_MAX, "%s/var/tmp", mysql_test_dir);
+ snprintf(result_dir, PATH_MAX, "%s/r", mysql_test_dir);
+ snprintf(master_dir, PATH_MAX, "%s/var/master-data", mysql_test_dir);
+ snprintf(slave_dir, PATH_MAX, "%s/var/slave-data", mysql_test_dir);
+ snprintf(lang_dir, PATH_MAX, "%s/sql/share/english", base_dir);
+ snprintf(char_dir, PATH_MAX, "%s/sql/share/charsets", base_dir);
+
+#ifdef HAVE_OPENSSL
+ use_openssl= TRUE;
+#endif /* HAVE_OPENSSL */
+
+ /* OpenSSL paths */
+ snprintf(ca_cert, PATH_MAX, "%s/SSL/cacert.pem", base_dir);
+ snprintf(server_cert, PATH_MAX, "%s/SSL/server-cert.pem", base_dir);
+ snprintf(server_key, PATH_MAX, "%s/SSL/server-key.pem", base_dir);
+ snprintf(client_cert, PATH_MAX, "%s/SSL/client-cert.pem", base_dir);
+ snprintf(client_key, PATH_MAX, "%s/SSL/client-key.pem", base_dir);
+
+ /* setup files */
+ snprintf(mysqld_file, PATH_MAX, "%s/sql/mysqld", base_dir);
+ snprintf(mysqltest_file, PATH_MAX, "%s/mysqltest", bin_dir);
+ snprintf(mysqladmin_file, PATH_MAX, "%s/mysqladmin", bin_dir);
+ snprintf(master_pid, PATH_MAX, "%s/var/run/master.pid", mysql_test_dir);
+ snprintf(slave_pid, PATH_MAX, "%s/var/run/slave.pid", mysql_test_dir);
+
+ snprintf(master_socket,PATH_MAX, "%s/var/tmp/master.sock", mysql_test_dir);
+ snprintf(slave_socket,PATH_MAX, "%s/var/tmp/slave.sock", mysql_test_dir);
+
+#endif
+ /* create log file */
+ snprintf(temp, PATH_MAX, "%s/mysql-test-run.log", mysql_test_dir);
+ if ((log_fd= fopen(temp, "w+")) == NULL)
+ {
+ log_errno("Unable to create log file.");
+ }
+
+ /* prepare skip test list */
+ while ((p= strchr(skip_test, ',')) != NULL) *p= ' ';
+ strcpy(temp, strlwr(skip_test));
+ snprintf(skip_test, PATH_MAX, " %s ", temp);
+
+ /* environment */
+#ifdef __NETWARE__
+ setenv("MYSQL_TEST_DIR", mysql_test_dir, 1);
+ snprintf(file_path, PATH_MAX*2,
+ "%s/client/mysqldump --no-defaults -u root --port=%u",
+ bin_dir, master_port);
+ setenv("MYSQL_DUMP", file_path, 1);
+ snprintf(file_path, PATH_MAX*2,
+ "%s/client/mysqlbinlog --no-defaults --local-load=%s",
+ bin_dir, mysql_tmp_dir);
+ setenv("MYSQL_BINLOG", file_path, 1);
+#elif __WIN__
+ snprintf(file_path,MAX_PATH,"MYSQL_TEST_DIR=%s",mysql_test_dir);
+ _putenv(file_path);
+ snprintf(file_path, PATH_MAX*2,
+ "MYSQL_DUMP=%s/mysqldump.exe --no-defaults -u root --port=%u",
+ bin_dir, master_port);
+ _putenv(file_path);
+ snprintf(file_path, PATH_MAX*2,
+ "MYSQL_BINLOG=%s/mysqlbinlog.exe --no-defaults --local-load=%s",
+ bin_dir, mysql_tmp_dir);
+ _putenv(file_path);
+#else
+ setenv("MYSQL_TEST_DIR", mysql_test_dir, 1);
+ snprintf(file_path, PATH_MAX*2,
+ "%s/mysqldump --no-defaults -u root --port=%u --socket=%s",
+ bin_dir, master_port, master_socket);
+ setenv("MYSQL_DUMP", file_path, 1);
+ snprintf(file_path, PATH_MAX*2,
+ "%s/mysqlbinlog --no-defaults --local-load=%s",
+ bin_dir, mysql_tmp_dir);
+ setenv("MYSQL_BINLOG", file_path, 1);
+#endif
+
+#ifndef __WIN__
+ setenv("MASTER_MYPORT", "9306", 1);
+ setenv("SLAVE_MYPORT", "9307", 1);
+ setenv("MYSQL_TCP_PORT", "3306", 1);
+#else
+ _putenv("MASTER_MYPORT=9306");
+ _putenv("SLAVE_MYPORT=9307");
+ _putenv("MYSQL_TCP_PORT=3306");
+#endif
+
+}
+
+/******************************************************************************
+
+ main()
+
+******************************************************************************/
+
+int main(int argc, char **argv)
+{
+ int is_ignore_list= 0;
+ /* setup */
+ setup(argv[0]);
+
+ /*
+ The --ignore option is comma saperated list of test cases to skip and
+ should be very first command line option to the test suite.
+
+ The usage is now:
+ mysql_test_run --ignore=test1,test2 test3 test4
+ where test1 and test2 are test cases to ignore
+ and test3 and test4 are test cases to run.
+ */
+ if (argc >= 2 && !strnicmp(argv[1], "--ignore=", sizeof("--ignore=")-1))
+ {
+ char *temp, *token;
+ temp= strdup(strchr(argv[1],'=') + 1);
+ for (token=str_tok(temp, ","); token != NULL; token=str_tok(NULL, ","))
+ {
+ if (strlen(ignore_test) + strlen(token) + 2 <= PATH_MAX-1)
+ sprintf(ignore_test+strlen(ignore_test), " %s ", token);
+ else
+ {
+ free(temp);
+ die("ignore list too long.");
+ }
+ }
+ free(temp);
+ is_ignore_list= 1;
+ }
+ /* header */
+#ifndef __WIN__
+ mlog("MySQL Server %s, for %s (%s)\n\n", VERSION, SYSTEM_TYPE, MACHINE_TYPE);
+#else
+ mlog("MySQL Server ---, for %s (%s)\n\n", SYSTEM_TYPE, MACHINE_TYPE);
+#endif
+
+ mlog("Initializing Tests...\n");
+
+ /* install test databases */
+ mysql_install_db();
+
+ mlog("Starting Tests...\n");
+
+ mlog("\n");
+ mlog(HEADER);
+ mlog(DASH);
+
+ if ( argc > 1 + is_ignore_list )
+ {
+ int i;
+
+ /* single test */
+ single_test= TRUE;
+
+ for (i= 1 + is_ignore_list; i < argc; i++)
+ {
+ /* run given test */
+ run_test(argv[i]);
+ }
+ }
+ else
+ {
+ /* run all tests */
+#ifndef __WIN__
+ struct dirent **namelist;
+ int i,n;
+ char test[NAME_MAX];
+ char *p;
+ int position;
+
+ n= scandir(test_dir, &namelist, 0, alphasort);
+ if (n < 0)
+ die("Unable to open tests directory.");
+ else
+ {
+ for (i= 0; i < n; i++)
+ {
+ strcpy(test, strlwr(namelist[i]->d_name));
+ /* find the test suffix */
+ if ((position= strinstr(test, TEST_SUFFIX)) != 0)
+ {
+ p= test + position - 1;
+ /* null terminate at the suffix */
+ *p= 0;
+ /* run test */
+ run_test(test);
+ }
+ free(namelist[n]);
+ }
+ free(namelist);
+ }
+#else
+ struct _finddata_t dir;
+ intptr_t handle;
+ char test[NAME_MAX];
+ char mask[PATH_MAX];
+ char *p;
+ int position;
+ char **names= 0;
+ char **testes= 0;
+ int name_index;
+ int index;
+
+ /* single test */
+ single_test= FALSE;
+
+ snprintf(mask,MAX_PATH,"%s/*.test",test_dir);
+
+ if ((handle=_findfirst(mask,&dir)) == -1L)
+ {
+ die("Unable to open tests directory.");
+ }
+
+ names= malloc(MAX_COUNT_TESTES*4);
+ testes= names;
+ name_index= 0;
+
+ do
+ {
+ if (!(dir.attrib & _A_SUBDIR))
+ {
+ strcpy(test, strlwr(dir.name));
+
+ /* find the test suffix */
+ if ((position= strinstr(test, TEST_SUFFIX)) != 0)
+ {
+ p= test + position - 1;
+ /* null terminate at the suffix */
+ *p= 0;
+
+ /* insert test */
+ *names= malloc(PATH_MAX);
+ strcpy(*names,test);
+ names++;
+ name_index++;
+ }
+ }
+ }while (_findnext(handle,&dir) == 0);
+
+ _findclose(handle);
+
+ qsort( (void *)testes, name_index, sizeof( char * ), compare );
+
+ for (index= 0; index <= name_index; index++)
+ {
+ run_test(testes[index]);
+ free(testes[index]);
+ }
+
+ free(testes);
+#endif
+ }
+
+ /* stop server */
+ mysql_stop();
+
+ mlog(DASH);
+ mlog("\n");
+
+ mlog("Ending Tests...\n");
+
+ /* report stats */
+ report_stats();
+
+ /* close log */
+ if (log_fd) fclose(log_fd);
+
+ /* keep results up */
+#ifdef __NETWARE__
+ pressanykey();
+#endif
+ return 0;
+}
+
+
+/*
+ Synopsis:
+ This function breaks the string into a sequence of tokens. The difference
+ between this function and strtok is that it respects the quoted string i.e.
+ it skips any delimiter character within the quoted part of the string.
+ It return tokens by eliminating quote character. It modifies the input string
+ passed. It will work with whitespace delimeter but may not work properly with
+ other delimeter. If the delimeter will contain any quote character, then
+ function will not tokenize and will return null string.
+ e.g. if input string is
+ --init-slave="set global max_connections=500" --skip-external-locking
+ then the output will two string i.e.
+ --init-slave=set global max_connections=500
+ --skip-external-locking
+
+Arguments:
+ string: input string
+ delim: set of delimiter character
+Output:
+ return the null terminated token of NULL.
+*/
+
+char *str_tok(char *string, const char *delim)
+{
+ char *token; /* current token received from strtok */
+ char *qt_token; /* token delimeted by the matching pair of quote */
+ /*
+ if there are any quote chars found in the token then this variable
+ will hold the concatenated string to return to the caller
+ */
+ char *ptr_token=NULL;
+ /* pointer to the quote character in the token from strtok */
+ char *ptr_quote=NULL;
+
+ /* See if the delimeter contains any quote character */
+ if (strchr(delim,'\'') || strchr(delim,'\"'))
+ return NULL;
+
+ /* repeate till we are getting some token from strtok */
+ while ((token= (char*)strtok(string, delim) ) != NULL)
+ {
+ /*
+ make the input string NULL so that next time onward strtok can
+ be called with NULL input string.
+ */
+ string= NULL;
+ /* We don't need to remove any quote character for Windows version */
+#ifndef __WIN__
+ /* check if the current token contain double quote character*/
+ if ((ptr_quote= (char*)strchr(token,'\"')) != NULL)
+ {
+ /*
+ get the matching the matching double quote in the remaining
+ input string
+ */
+ qt_token= (char*)strtok(NULL,"\"");
+ }
+ /* check if the current token contain single quote character*/
+ else if ((ptr_quote= (char*)strchr(token,'\'')) != NULL)
+ {
+ /*
+ get the matching the matching single quote in the remaining
+ input string
+ */
+ qt_token= (char*)strtok(NULL,"\'");
+ }
+#endif
+ /*
+ if the current token does not contains any quote character then
+ return to the caller.
+ */
+ if (ptr_quote == NULL)
+ {
+ /*
+ if there is any earlier token i.e. ptr_token then append the
+ current token in it and return it else return the current
+ token directly
+ */
+ return ptr_token ? strcat(ptr_token,token) : token;
+ }
+
+ /*
+ remove the quote character i.e. make NULL so that the token will
+ be devided in two part and later both part can be concatenated
+ and hence quote will be removed
+ */
+ *ptr_quote= 0;
+
+ /* check if ptr_token has been initialized or not */
+ if (ptr_token == NULL)
+ {
+ /* initialize the ptr_token with current token */
+ ptr_token= token;
+ /* copy entire string between matching pair of quote*/
+ sprintf(ptr_token+strlen(ptr_token),"%s %s", ptr_quote+1, qt_token);
+ }
+ else
+ {
+ /*
+ copy the current token and entire string between matching pair
+ of quote
+ */
+ if (qt_token == NULL)
+ {
+ sprintf(ptr_token+strlen(ptr_token),"%s%s", token, ptr_quote+1);
+ }
+ else
+ {
+ sprintf(ptr_token+strlen(ptr_token),"%s%s %s", token, ptr_quote+1,
+ qt_token );
+ }
+ }
+ }
+
+ /* return the concatenated token */
+ return ptr_token;
+}
+
+#ifndef __WIN__
+
+/*
+ Synopsis:
+ This function run scripts files on Linux and Netware
+
+Arguments:
+ script_name: name of script file
+
+Output:
+ nothing
+*/
+
+void run_init_script(const char *script_name)
+{
+ arg_list_t al;
+ int err;
+
+ /* args */
+ init_args(&al);
+ add_arg(&al, sh_file);
+ add_arg(&al, script_name);
+
+ /* spawn */
+ if ((err= spawn(sh_file, &al, TRUE, NULL, NULL, NULL, NULL)) != 0)
+ {
+ die("Unable to run script.");
+ }
+
+ /* free args */
+ free_args(&al);
+}
+#endif
diff --git a/mysql-test/ndb/ndbcluster.sh b/mysql-test/ndb/ndbcluster.sh
index 294d32ac4be..9c6b6093b93 100644
--- a/mysql-test/ndb/ndbcluster.sh
+++ b/mysql-test/ndb/ndbcluster.sh
@@ -102,12 +102,43 @@ if [ ! -x "$exec_mgmtsrvr" ]; then
echo "$exec_mgmtsrvr missing"
exit 1
fi
+if [ ! -x "$exec_waiter" ]; then
+ echo "$exec_waiter missing"
+ exit 1
+fi
+
+exec_mgmtclient="$exec_mgmtclient --no-defaults"
+exec_mgmtsrvr="$exec_mgmtsrvr --no-defaults"
+exec_ndb="$exec_ndb --no-defaults"
+exec_waiter="$exec_waiter --no-defaults"
ndb_host="localhost"
ndb_mgmd_port=$port_base
NDB_CONNECTSTRING="host=$ndb_host:$ndb_mgmd_port"
export NDB_CONNECTSTRING
+sleep_until_file_created () {
+ file=$1
+ loop=$2
+ org_time=$2
+ message=$3
+ while (test $loop -gt 0)
+ do
+ if [ -r $file ]
+ then
+ return 0
+ fi
+ sleep 1
+ loop=`expr $loop - 1`
+ done
+ if [ $message ]
+ then
+ echo $message
+ fi
+ echo "ERROR: $file was not created in $org_time seconds; Aborting"
+ return 1;
+}
+
start_default_ndbcluster() {
# do some checks
@@ -127,8 +158,8 @@ port_transporter=`expr $ndb_mgmd_port + 2`
# Start management server as deamon
# Edit file system path and ports in config file
-
if [ $initial_ndb ] ; then
+ rm -f $fs_ndb/ndb_*
sed \
-e s,"CHOOSE_MaxNoOfOrderedIndexes","$ndb_no_ord",g \
-e s,"CHOOSE_MaxNoOfConcurrentOperations","$ndb_con_op",g \
@@ -146,25 +177,36 @@ fi
rm -f "$cfgfile" 2>&1 | cat > /dev/null
rm -f "$fs_ndb/$cfgfile" 2>&1 | cat > /dev/null
-if ( cd "$fs_ndb" ; $exec_mgmtsrvr -c config.ini ) ; then :; else
+if ( cd "$fs_ndb" ; $exec_mgmtsrvr -f config.ini ) ; then :; else
echo "Unable to start $exec_mgmtsrvr from `pwd`"
exit 1
fi
-
+if sleep_until_file_created $fs_ndb/ndb_3.pid 30
+then :; else
+ exit 1
+fi
cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile"
# Start database node
echo "Starting ndbd"
( cd "$fs_ndb" ; $exec_ndb $flags_ndb & )
-
+if sleep_until_file_created $fs_ndb/ndb_1.pid 30
+then :; else
+ stop_default_ndbcluster
+ exit 1
+fi
cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile"
# Start database node
echo "Starting ndbd"
( cd "$fs_ndb" ; $exec_ndb $flags_ndb & )
-
+if sleep_until_file_created $fs_ndb/ndb_2.pid 30
+then :; else
+ stop_default_ndbcluster
+ exit 1
+fi
cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile"
# test if Ndb Cluster starts properly
@@ -172,6 +214,7 @@ cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile"
echo "Waiting for started..."
if ( $exec_waiter ) | grep "NDBT_ProgramExit: 0 - OK"; then :; else
echo "Ndbcluster startup failed"
+ stop_default_ndbcluster
exit 1
fi
@@ -198,10 +241,12 @@ if [ -f "$fs_ndb/$pidfile" ] ; then
attempt=0
while [ $attempt -lt 10 ] ; do
new_kill_pid=""
+ kill_pids2=""
for p in $kill_pids ; do
kill -0 $p 2> /dev/null
if [ $? -eq 0 ] ; then
new_kill_pid="$p $new_kill_pid"
+ kill_pids2="-$p $kill_pids2"
fi
done
kill_pids=$new_kill_pid
@@ -211,9 +256,14 @@ if [ -f "$fs_ndb/$pidfile" ] ; then
sleep 1
attempt=`expr $attempt + 1`
done
- if [ "$kill_pids" != "" ] ; then
- echo "Failed to shutdown ndbcluster, executing kill -9 "$kill_pids
- kill -9 $kill_pids
+ if [ "$kill_pids2" != "" ] ; then
+ echo "Failed to shutdown ndbcluster, executing kill "$kill_pids2
+ kill -9 -- $kill_pids2 2> /dev/null
+ /bin/kill -9 -- $kill_pids2 2> /dev/null
+ /usr/bin/kill -9 -- $kill_pids2 2> /dev/null
+ kill -9 $kill_pids2 2> /dev/null
+ /bin/kill -9 $kill_pids2 2> /dev/null
+ /usr/bin/kill -9 $kill_pids2 2> /dev/null
fi
rm "$fs_ndb/$pidfile"
fi
diff --git a/mysql-test/r/ctype_recoding.result b/mysql-test/r/ctype_recoding.result
index 78d15c21301..7d5f9d5b59a 100644
--- a/mysql-test/r/ctype_recoding.result
+++ b/mysql-test/r/ctype_recoding.result
@@ -174,3 +174,69 @@ Warnings:
Warning 1265 Data truncated for column 'a' at row 1
Warning 1265 Data truncated for column 'b' at row 1
drop table t1;
+set names koi8r;
+create table t1 (a char(10) character set cp1251);
+insert into t1 values (_koi8r'×ÁÓÑ');
+select * from t1 where a=_koi8r'×ÁÓÑ';
+a
+×ÁÓÑ
+select * from t1 where a=concat(_koi8r'×ÁÓÑ');
+ERROR HY000: Illegal mix of collations (cp1251_general_ci,IMPLICIT) and (koi8r_general_ci,COERCIBLE) for operation '='
+select * from t1 where a=_latin1'×ÁÓÑ';
+ERROR HY000: Illegal mix of collations (cp1251_general_ci,IMPLICIT) and (latin1_swedish_ci,COERCIBLE) for operation '='
+drop table t1;
+set names latin1;
+set names koi8r;
+create table t1 (c1 char(10) character set cp1251);
+insert into t1 values ('ß');
+select c1 from t1 where c1 between 'ß' and 'ß';
+c1
+select ifnull(c1,'ß'), ifnull(null,c1) from t1;
+ifnull(c1,'ß') ifnull(null,c1)
+ß ß
+select if(1,c1,'ö'), if(0,c1,'ö') from t1;
+if(1,c1,'ö') if(0,c1,'ö')
+ß ö
+select coalesce('ö',c1), coalesce(null,c1) from t1;
+coalesce('ö',c1) coalesce(null,c1)
+ö ß
+select least(c1,'ö'), greatest(c1,'ö') from t1;
+least(c1,'ö') greatest(c1,'ö')
+ö ß
+select locate(c1,'ß'), locate('ß',c1) from t1;
+locate(c1,'ß') locate('ß',c1)
+1 1
+select field(c1,'ß'),field('ß',c1) from t1;
+field(c1,'ß') field('ß',c1)
+1 1
+select concat(c1,'ö'), concat('ö',c1) from t1;
+concat(c1,'ö') concat('ö',c1)
+ßö öß
+select concat_ws(c1,'ö','ß'), concat_ws('ö',c1,'ß') from t1;
+concat_ws(c1,'ö','ß') concat_ws('ö',c1,'ß')
+ößß ßöß
+select replace(c1,'ß','ö'), replace('ß',c1,'ö') from t1;
+replace(c1,'ß','ö') replace('ß',c1,'ö')
+ö ö
+select substring_index(c1,'öößß',2) from t1;
+substring_index(c1,'öößß',2)
+select elt(1,c1,'ö'),elt(1,'ö',c1) from t1;
+elt(1,c1,'ö') elt(1,'ö',c1)
+ß ö
+select make_set(3,c1,'ö'), make_set(3,'ö',c1) from t1;
+make_set(3,c1,'ö') make_set(3,'ö',c1)
+ß,ö ö,ß
+select insert(c1,1,2,'ö'),insert('ö',1,2,c1) from t1;
+insert(c1,1,2,'ö') insert('ö',1,2,c1)
+ö ß
+select trim(c1 from 'ß'),trim('ß' from c1) from t1;
+trim(c1 from 'ß') trim('ß' from c1)
+
+select lpad(c1,3,'ö'), lpad('ö',3,c1) from t1;
+lpad(c1,3,'ö') lpad('ö',3,c1)
+ööß ßßö
+select rpad(c1,3,'ö'), rpad('ö',3,c1) from t1;
+rpad(c1,3,'ö') rpad('ö',3,c1)
+ßöö ößß
diff --git a/mysql-test/r/ctype_sjis.result b/mysql-test/r/ctype_sjis.result
index b0edbed1a41..944fa0602a9 100644
--- a/mysql-test/r/ctype_sjis.result
+++ b/mysql-test/r/ctype_sjis.result
@@ -60,3 +60,14 @@ hex(c)
9353
9373
drop table t1;
+SET NAMES sjis;
+CREATE TABLE t1 (
+c char(16) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=sjis;
+insert into t1 values(0xb1),(0xb2),(0xb3);
+select hex(c) from t1;
+hex(c)
+B1
+B2
+B3
+drop table t1;
diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result
index a0ac29b7989..a8182561c66 100644
--- a/mysql-test/r/ctype_ucs.result
+++ b/mysql-test/r/ctype_ucs.result
@@ -480,3 +480,10 @@ a 0061
b 0062
c 0063
drop table t1;
+set @ivar= 1234;
+set @str1 = 'select ?';
+set @str2 = convert(@str1 using ucs2);
+prepare stmt1 from @str2;
+execute stmt1 using @ivar;
+?
+1234
diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result
index 3f4766830b0..1f2ae96d8f6 100644
--- a/mysql-test/r/fulltext.result
+++ b/mysql-test/r/fulltext.result
@@ -330,6 +330,9 @@ t1_id name t2_id t1_id name
select * from t2 where match name against ('a* b* c* d* e* f*' in boolean mode);
t2_id t1_id name
drop table t1,t2;
+create table t1 (a text, fulltext key (a));
+insert into t1 select "xxxx yyyy zzzz";
+drop table t1;
SET NAMES latin1;
CREATE TABLE t1 (t text character set utf8 not null, fulltext(t));
INSERT t1 VALUES ('Mit freundlichem Grüß'), ('aus Osnabrück');
@@ -352,9 +355,9 @@ t collation(t)
aus Osnabrück utf8_general_ci
SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrueck');
t collation(t)
-SELECT t, collation(t),MATCH t AGAINST ('Osnabruck') FROM t1 WHERE MATCH t AGAINST ('Osnabruck');
-t collation(t) MATCH t AGAINST ('Osnabruck')
-aus Osnabrück utf8_general_ci 1.591139793396
+SELECT t, collation(t),FORMAT(MATCH t AGAINST ('Osnabruck'),6) FROM t1 WHERE MATCH t AGAINST ('Osnabruck');
+t collation(t) FORMAT(MATCH t AGAINST ('Osnabruck'),6)
+aus Osnabrück utf8_general_ci 1.591140
alter table t1 modify t varchar(200) collate latin1_german2_ci not null;
Warnings:
Warning 1265 Data truncated for column 't' at row 3
diff --git a/mysql-test/r/fulltext_order_by.result b/mysql-test/r/fulltext_order_by.result
index bfee9eba280..c6c42fa2e8b 100644
--- a/mysql-test/r/fulltext_order_by.result
+++ b/mysql-test/r/fulltext_order_by.result
@@ -6,53 +6,53 @@ FULLTEXT(message)
) comment = 'original testcase by sroussey@network54.com';
INSERT INTO t1 (message) VALUES ("Testing"),("table"),("testbug"),
("steve"),("is"),("cool"),("steve is cool");
-SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE MATCH (message) AGAINST ('steve');
-a MATCH (message) AGAINST ('steve')
-4 0.90587323904037
-7 0.89568990468979
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve');
+a FORMAT(MATCH (message) AGAINST ('steve'),6)
+4 0.905873
+7 0.895690
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve');
a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE)
4 1
7 1
-SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE);
-a MATCH (message) AGAINST ('steve')
-4 0.90587323904037
-7 0.89568990468979
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE);
+a FORMAT(MATCH (message) AGAINST ('steve'),6)
+4 0.905873
+7 0.895690
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE);
a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE)
4 1
7 1
-SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY a;
-a MATCH (message) AGAINST ('steve')
-4 0.90587323904037
-7 0.89568990468979
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY a;
+a FORMAT(MATCH (message) AGAINST ('steve'),6)
+4 0.905873
+7 0.895690
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY a;
a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE)
4 1
7 1
-SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve') ORDER BY a DESC;
-a MATCH (message) AGAINST ('steve')
-7 0.89568990468979
-4 0.90587323904037
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve') ORDER BY a DESC;
+a FORMAT(MATCH (message) AGAINST ('steve'),6)
+7 0.895690
+4 0.905873
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY a DESC;
a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE)
7 1
4 1
-SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve') ORDER BY 1;
-a MATCH (message) AGAINST ('steve')
-7 0.89568990468979
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve') ORDER BY 1;
+a FORMAT(MATCH (message) AGAINST ('steve'),6)
+7 0.895690
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY 1;
a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE)
7 1
-SELECT a, MATCH (message) AGAINST ('steve') as rel FROM t1 ORDER BY rel;
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) as rel FROM t1 ORDER BY rel;
a rel
-1 0
-2 0
-3 0
-5 0
-6 0
-7 0.89568990468979
-4 0.90587323904037
+1 0.000000
+2 0.000000
+3 0.000000
+5 0.000000
+6 0.000000
+7 0.895690
+4 0.905873
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) as rel FROM t1 ORDER BY rel;
a rel
1 0
diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result
index daf36b00693..fa603fd16d5 100644
--- a/mysql-test/r/func_in.result
+++ b/mysql-test/r/func_in.result
@@ -179,3 +179,9 @@ select 1 in ('1.1',2);
select 1 in ('1.1',2.0);
1 in ('1.1',2.0)
0
+create table t1 (a char(20) character set binary);
+insert into t1 values ('aa'), ('bb');
+select * from t1 where a in (NULL, 'aa');
+a
+aa
+drop table t1;
diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result
index c013a01b51b..ee0a30e27d0 100644
--- a/mysql-test/r/gis.result
+++ b/mysql-test/r/gis.result
@@ -581,3 +581,77 @@ t1 CREATE TABLE `t1` (
`POINT(1,3)` longblob NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
+CREATE TABLE `t1` (`object_id` bigint(20) unsigned NOT NULL default '0', `geo`
+geometry NOT NULL default '') ENGINE=MyISAM ;
+insert into t1 values ('85984',GeomFromText('MULTIPOLYGON(((-115.006363
+36.305435,-114.992394 36.305202,-114.991219 36.305975,-114.991163
+36.306845,-114.989432 36.309452,-114.978275 36.312642,-114.977363
+36.311978,-114.975327 36.312344,-114.96502 36.31597,-114.963364
+36.313629,-114.961723 36.313721,-114.956398 36.316057,-114.951882
+36.320979,-114.947073 36.323475,-114.945207 36.326451,-114.945207
+36.326451,-114.944132 36.326061,-114.94003 36.326588,-114.924017
+36.334484,-114.923281 36.334146,-114.92564 36.331504,-114.94072
+36.319282,-114.945348 36.314812,-114.948091 36.314762,-114.951755
+36.316211,-114.952446 36.313883,-114.952644 36.309488,-114.944725
+36.313083,-114.93706 36.32043,-114.932478 36.323497,-114.924556
+36.327708,-114.922608 36.329715,-114.92009 36.328695,-114.912105
+36.323566,-114.901647 36.317952,-114.897436 36.313968,-114.895344
+36.309573,-114.891699 36.304398,-114.890569 36.303551,-114.886356
+36.302702,-114.885141 36.301351,-114.885709 36.297391,-114.892499
+36.290893,-114.902142 36.288974,-114.904941 36.288838,-114.905308
+36.289845,-114.906325 36.290395,-114.909916 36.289549,-114.914527
+36.287535,-114.918797 36.284423,-114.922982 36.279731,-114.924113
+36.277282,-114.924057 36.275817,-114.927733 36.27053,-114.929354
+36.269029,-114.929354 36.269029,-114.950856 36.268715,-114.950768
+36.264324,-114.960206 36.264293,-114.960301 36.268943,-115.006662
+36.268929,-115.008583 36.265619,-115.00665 36.264247,-115.006659
+36.246873,-115.006659 36.246873,-115.006838 36.247697,-115.010764
+36.247774,-115.015609 36.25113,-115.015765 36.254505,-115.029517
+36.254619,-115.038573 36.249317,-115.038573 36.249317,-115.023403
+36.25841,-115.023873 36.258994,-115.031845 36.259829,-115.03183
+36.261053,-115.025561 36.261095,-115.036417 36.274632,-115.033729
+36.276041,-115.032217 36.274851,-115.029845 36.273959,-115.029934
+36.274966,-115.025763 36.274896,-115.025406 36.281044,-115.028731
+36.284471,-115.036497 36.290377,-115.042071 36.291039,-115.026759
+36.298478,-115.008995 36.301966,-115.006363 36.305435),(-115.079835
+36.244369,-115.079735 36.260186,-115.076435 36.262369,-115.069758
+36.265,-115.070235 36.268757,-115.064542 36.268655,-115.061843
+36.269857,-115.062676 36.270693,-115.06305 36.272344,-115.059051
+36.281023,-115.05918 36.283008,-115.060591 36.285246,-115.061913
+36.290022,-115.062499 36.306353,-115.062499 36.306353,-115.060918
+36.30642,-115.06112 36.289779,-115.05713 36.2825,-115.057314
+36.279446,-115.060779 36.274659,-115.061366 36.27209,-115.057858
+36.26557,-115.055805 36.262883,-115.054688 36.262874,-115.047335
+36.25037,-115.044234 36.24637,-115.052434 36.24047,-115.061734
+36.23507,-115.061934 36.22677,-115.061934 36.22677,-115.061491
+36.225267,-115.062024 36.218194,-115.060134 36.218278,-115.060133
+36.210771,-115.057833 36.210771,-115.057433 36.196271,-115.062233
+36.196271,-115.062233 36.190371,-115.062233 36.190371,-115.065533
+36.190371,-115.071333 36.188571,-115.098331 36.188275,-115.098331
+36.188275,-115.098435 36.237569,-115.097535 36.240369,-115.097535
+36.240369,-115.093235 36.240369,-115.089135 36.240469,-115.083135
+36.240569,-115.083135 36.240569,-115.079835
+36.244369)))')),('85998',GeomFromText('MULTIPOLYGON(((-115.333107
+36.264587,-115.333168 36.280638,-115.333168 36.280638,-115.32226
+36.280643,-115.322538 36.274311,-115.327222 36.274258,-115.32733
+36.263026,-115.330675 36.262984,-115.332132 36.264673,-115.333107
+36.264587),(-115.247239 36.247066,-115.247438 36.218267,-115.247438
+36.218267,-115.278525 36.219263,-115.278525 36.219263,-115.301545
+36.219559,-115.332748 36.219197,-115.332757 36.220041,-115.332757
+36.220041,-115.332895 36.233514,-115.349023 36.233479,-115.351489
+36.234475,-115.353681 36.237021,-115.357106 36.239789,-115.36519
+36.243331,-115.368156 36.243487,-115.367389 36.244902,-115.364553
+36.246014,-115.359219 36.24616,-115.356186 36.248025,-115.353347
+36.248004,-115.350813 36.249507,-115.339673 36.25387,-115.333069
+36.255018,-115.333069 36.255018,-115.333042 36.247767,-115.279039
+36.248666,-115.263639 36.247466,-115.263839 36.252766,-115.261439
+36.252666,-115.261439 36.247366,-115.247239 36.247066)))'));
+select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from
+t1 where object_id=85998;
+object_id geometrytype(geo) ISSIMPLE(GEO) ASTEXT(centroid(geo))
+85998 MULTIPOLYGON 0 POINT(115.31877315203 -36.237472821022)
+select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from
+t1 where object_id=85984;
+object_id geometrytype(geo) ISSIMPLE(GEO) ASTEXT(centroid(geo))
+85984 MULTIPOLYGON 0 POINT(-114.87787186923 36.33101763469)
+drop table t1;
diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result
index 35226c56dab..2f420905195 100644
--- a/mysql-test/r/join_outer.result
+++ b/mysql-test/r/join_outer.result
@@ -745,6 +745,71 @@ player_id match_1_h * match_id home UUX
7 4 * 1 2 2
3 3 * 1 2 1
drop table t1, t2;
+create table t1 (a int, b int, unique index idx (a, b));
+create table t2 (a int, b int, c int, unique index idx (a, b));
+insert into t1 values (1, 10), (1,11), (2,10), (2,11);
+insert into t2 values (1,10,3);
+select t1.a, t1.b, t2.c from t1 left join t2
+on t1.a=t2.a and t1.b=t2.b and t2.c=3
+where t1.a=1 and t2.c is null;
+a b c
+1 11 NULL
+drop table t1, t2;
+CREATE TABLE t1 (
+ts_id bigint(20) default NULL,
+inst_id tinyint(4) default NULL,
+flag_name varchar(64) default NULL,
+flag_value text,
+UNIQUE KEY ts_id (ts_id,inst_id,flag_name)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+ts_id bigint(20) default NULL,
+inst_id tinyint(4) default NULL,
+flag_name varchar(64) default NULL,
+flag_value text,
+UNIQUE KEY ts_id (ts_id,inst_id,flag_name)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+INSERT INTO t1 VALUES
+(111056548820001, 0, 'flag1', NULL),
+(111056548820001, 0, 'flag2', NULL),
+(2, 0, 'other_flag', NULL);
+INSERT INTO t2 VALUES
+(111056548820001, 3, 'flag1', 'sss');
+SELECT t1.flag_name,t2.flag_value
+FROM t1 LEFT JOIN t2
+ON (t1.ts_id = t2.ts_id AND t1.flag_name = t2.flag_name AND
+t2.inst_id = 3)
+WHERE t1.inst_id = 0 AND t1.ts_id=111056548820001 AND
+t2.flag_value IS NULL;
+flag_name flag_value
+flag2 NULL
+DROP TABLE t1,t2;
+CREATE TABLE invoice (
+id int(11) unsigned NOT NULL auto_increment,
+text_id int(10) unsigned default NULL,
+PRIMARY KEY (id)
+);
+INSERT INTO invoice VALUES("1", "0");
+INSERT INTO invoice VALUES("2", "10");
+CREATE TABLE text_table (
+text_id char(3) NOT NULL default '',
+language_id char(3) NOT NULL default '',
+text_data text,
+PRIMARY KEY (text_id,language_id)
+);
+INSERT INTO text_table VALUES("0", "EN", "0-EN");
+INSERT INTO text_table VALUES("0", "SV", "0-SV");
+INSERT INTO text_table VALUES("10", "EN", "10-EN");
+INSERT INTO text_table VALUES("10", "SV", "10-SV");
+SELECT invoice.id, invoice.text_id, text_table.text_data
+FROM invoice LEFT JOIN text_table
+ON invoice.text_id = text_table.text_id
+AND text_table.language_id = 'SV'
+ WHERE (invoice.id LIKE '%' OR text_table.text_data LIKE '%');
+id text_id text_data
+1 0 0-SV
+2 10 10-SV
+DROP TABLE invoice, text_table;
CREATE TABLE t0 (a0 int PRIMARY KEY);
CREATE TABLE t1 (a1 int PRIMARY KEY);
CREATE TABLE t2 (a2 int);
diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result
index 4e30d5bc110..d75dbd5d00c 100644
--- a/mysql-test/r/mysqltest.result
+++ b/mysql-test/r/mysqltest.result
@@ -1,14 +1,12 @@
+select -1 as "before_use_test" ;
+before_use_test
+-1
select otto from (select 1 as otto) as t1;
otto
1
select otto from (select 1 as otto) as t1;
otto
1
-select otto from (select 1 as otto) as t1;
-otto
-1
-select friedrich from (select 1 as otto) as t1;
-ERROR 42S22: Unknown column 'friedrich' in 'field list'
select friedrich from (select 1 as otto) as t1;
ERROR 42S22: Unknown column 'friedrich' in 'field list'
select otto from (select 1 as otto) as t1;
@@ -21,3 +19,126 @@ select friedrich from (select 1 as otto) as t1;
ERROR 42S22: Unknown column 'friedrich' in 'field list'
select friedrich from (select 1 as otto) as t1;
ERROR 42S22: Unknown column 'friedrich' in 'field list'
+select otto from (select 1 as otto) as t1;
+otto
+1
+select 0 as "after_successful_stmt_errno" ;
+after_successful_stmt_errno
+0
+garbage ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
+select 1064 as "after_wrong_syntax_errno" ;
+after_wrong_syntax_errno
+1064
+garbage ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
+select 1064 as "after_let_var_equal_value" ;
+after_let_var_equal_value
+1064
+garbage ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
+set @my_var= 'abc' ;
+select 0 as "after_set_var_equal_value" ;
+after_set_var_equal_value
+0
+garbage ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
+select 1064 as "after_disable_warnings_command" ;
+after_disable_warnings_command
+1064
+drop table if exists t1 ;
+garbage ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
+drop table if exists t1 ;
+select 0 as "after_disable_warnings" ;
+after_disable_warnings
+0
+garbage ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
+select 3 from t1 ;
+ERROR 42S02: Table 'test.t1' doesn't exist
+select 1146 as "after_minus_masked" ;
+after_minus_masked
+1146
+garbage ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
+select 3 from t1 ;
+ERROR 42S02: Table 'test.t1' doesn't exist
+select 1146 as "after_!_masked" ;
+after_!_masked
+1146
+garbage ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
+select -1 as "after_let_errno_equal_value" ;
+after_let_errno_equal_value
+-1
+garbage ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
+prepare stmt from "select 3 from t1" ;
+ERROR 42S02: Table 'test.t1' doesn't exist
+select 1146 as "after_failing_prepare" ;
+after_failing_prepare
+1146
+create table t1 ( f1 char(10));
+garbage ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
+prepare stmt from "select 3 from t1" ;
+select 0 as "after_successful_prepare" ;
+after_successful_prepare
+0
+garbage ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
+execute stmt;
+3
+select 0 as "after_successful_execute" ;
+after_successful_execute
+0
+drop table t1;
+garbage ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
+execute stmt;
+ERROR 42S02: Table 'test.t1' doesn't exist
+select 1146 as "after_failing_execute" ;
+after_failing_execute
+1146
+garbage ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
+execute __stmt_;
+ERROR HY000: Unknown prepared statement handler (__stmt_) given to EXECUTE
+select 1243 as "after_failing_execute" ;
+after_failing_execute
+1243
+garbage ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
+deallocate prepare stmt;
+select 0 as "after_successful_deallocate" ;
+after_successful_deallocate
+0
+garbage ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
+deallocate prepare __stmt_;
+ERROR HY000: Unknown prepared statement handler (__stmt_) given to DEALLOCATE PREPARE
+select 1243 as "after_failing_deallocate" ;
+after_failing_deallocate
+1243
+garbage ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
+select 1064 as "after_--disable_abort_on_error" ;
+after_--disable_abort_on_error
+1064
+select 3 from t1 ;
+ERROR 42S02: Table 'test.t1' doesn't exist
+select 3 from t1 ;
+ERROR 42S02: Table 'test.t1' doesn't exist
+select 3 from t1 ;
+ERROR 42S02: Table 'test.t1' doesn't exist
+select 1146 as "after_!errno_masked_error" ;
+after_!errno_masked_error
+1146
+garbage ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
+select 1064 as "after_--enable_abort_on_error" ;
+after_--enable_abort_on_error
+1064
+select 3 from t1 ;
+ERROR 42S02: Table 'test.t1' doesn't exist
diff --git a/mysql-test/r/ndb_basic.result b/mysql-test/r/ndb_basic.result
index abe1b98b536..ba8ee820ad9 100644
--- a/mysql-test/r/ndb_basic.result
+++ b/mysql-test/r/ndb_basic.result
@@ -40,6 +40,11 @@ SELECT * FROM t1 ORDER BY pk1;
pk1 attr1 attr2 attr3
3 1 NULL 9412
9412 9413 17 9413
+UPDATE t1 SET pk1=4 WHERE pk1 = 3;
+SELECT * FROM t1 ORDER BY pk1;
+pk1 attr1 attr2 attr3
+4 1 NULL 9412
+9412 9413 17 9413
DELETE FROM t1;
SELECT * FROM t1;
pk1 attr1 attr2 attr3
@@ -414,3 +419,150 @@ select * from t1 where b IS NOT NULL;
a b
1
drop table t1;
+create table t1 (
+c1 int,
+c2 int,
+c3 int,
+c4 int,
+c5 int,
+c6 int,
+c7 int,
+c8 int,
+c9 int,
+c10 int,
+c11 int,
+c12 int,
+c13 int,
+c14 int,
+c15 int,
+c16 int,
+c17 int,
+c18 int,
+c19 int,
+c20 int,
+c21 int,
+c22 int,
+c23 int,
+c24 int,
+c25 int,
+c26 int,
+c27 int,
+c28 int,
+c29 int,
+c30 int,
+c31 int,
+c32 int,
+c33 int,
+c34 int,
+c35 int,
+c36 int,
+c37 int,
+c38 int,
+c39 int,
+c40 int,
+c41 int,
+c42 int,
+c43 int,
+c44 int,
+c45 int,
+c46 int,
+c47 int,
+c48 int,
+c49 int,
+c50 int,
+c51 int,
+c52 int,
+c53 int,
+c54 int,
+c55 int,
+c56 int,
+c57 int,
+c58 int,
+c59 int,
+c60 int,
+c61 int,
+c62 int,
+c63 int,
+c64 int,
+c65 int,
+c66 int,
+c67 int,
+c68 int,
+c69 int,
+c70 int,
+c71 int,
+c72 int,
+c73 int,
+c74 int,
+c75 int,
+c76 int,
+c77 int,
+c78 int,
+c79 int,
+c80 int,
+c81 int,
+c82 int,
+c83 int,
+c84 int,
+c85 int,
+c86 int,
+c87 int,
+c88 int,
+c89 int,
+c90 int,
+c91 int,
+c92 int,
+c93 int,
+c94 int,
+c95 int,
+c96 int,
+c97 int,
+c98 int,
+c99 int,
+c100 int,
+c101 int,
+c102 int,
+c103 int,
+c104 int,
+c105 int,
+c106 int,
+c107 int,
+c108 int,
+c109 int,
+c110 int,
+c111 int,
+c112 int,
+c113 int,
+c114 int,
+c115 int,
+c116 int,
+c117 int,
+c118 int,
+c119 int,
+c120 int,
+c121 int,
+c122 int,
+c123 int,
+c124 int,
+c125 int,
+c126 int,
+c127 int,
+c128 int,
+primary key(c1)) engine=ndb;
+drop table t1;
+create table t1 (
+a1234567890123456789012345678901234567890 int primary key,
+a12345678901234567890123456789a1234567890 int,
+index(a12345678901234567890123456789a1234567890)
+) engine=ndb;
+show tables;
+Tables_in_test
+t1
+insert into t1 values (1,1),(2,1),(3,1),(4,1),(5,2),(6,1),(7,1);
+explain select * from t1 where a12345678901234567890123456789a1234567890=2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a12345678901234567890123456789a1234567890 a12345678901234567890123456789a1234567890 5 const 10 Using where
+select * from t1 where a12345678901234567890123456789a1234567890=2;
+a1234567890123456789012345678901234567890 a12345678901234567890123456789a1234567890
+5 2
+drop table t1;
diff --git a/mysql-test/r/ndb_blob.result b/mysql-test/r/ndb_blob.result
index 25da313c67e..44109dabbc8 100644
--- a/mysql-test/r/ndb_blob.result
+++ b/mysql-test/r/ndb_blob.result
@@ -1,25 +1,5 @@
drop table if exists t1;
-drop database if exists mysqltest;
-create table t1 (
-a int not null primary key,
-b tinytext
-) engine=ndbcluster;
-insert into t1 values(1, 'x');
-update t1 set b = 'y';
-select * from t1;
-a b
-1 y
-delete from t1;
-drop table t1;
-create table t1 (
-a int not null primary key,
-b text not null
-) engine=ndbcluster;
-insert into t1 values(1, '');
-select * from t1;
-a b
-1
-drop table t1;
+drop database if exists test2;
set autocommit=0;
create table t1 (
a int not null primary key,
@@ -102,6 +82,53 @@ commit;
select count(*) from t1;
count(*)
0
+replace t1 set a=1,b=@b1,c=111,d=@d1;
+replace t1 set a=2,b=@b2,c=222,d=@d2;
+commit;
+explain select * from t1 where a = 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
+select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
+from t1 where a=1;
+a length(b) substr(b,1+2*900,2) length(d) substr(d,1+3*900,3)
+1 2256 b1 3000 dd1
+select a,length(b),substr(b,1+2*9000,2),length(d),substr(d,1+3*9000,3)
+from t1 where a=2;
+a length(b) substr(b,1+2*9000,2) length(d) substr(d,1+3*9000,3)
+2 20000 b2 30000 dd2
+replace t1 set a=1,b=@b2,c=111,d=@d2;
+replace t1 set a=2,b=@b1,c=222,d=@d1;
+commit;
+select a,length(b),substr(b,1+2*9000,2),length(d),substr(d,1+3*9000,3)
+from t1 where a=1;
+a length(b) substr(b,1+2*9000,2) length(d) substr(d,1+3*9000,3)
+1 20000 b2 30000 dd2
+select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
+from t1 where a=2;
+a length(b) substr(b,1+2*900,2) length(d) substr(d,1+3*900,3)
+2 2256 b1 3000 dd1
+replace t1 set a=1,b=concat(@b2,@b2),c=111,d=concat(@d2,@d2);
+replace t1 set a=2,b=concat(@b1,@b1),c=222,d=concat(@d1,@d1);
+commit;
+select a,length(b),substr(b,1+4*9000,2),length(d),substr(d,1+6*9000,3)
+from t1 where a=1;
+a length(b) substr(b,1+4*9000,2) length(d) substr(d,1+6*9000,3)
+1 40000 b2 60000 dd2
+select a,length(b),substr(b,1+4*900,2),length(d),substr(d,1+6*900,3)
+from t1 where a=2;
+a length(b) substr(b,1+4*900,2) length(d) substr(d,1+6*900,3)
+2 4512 b1 6000 dd1
+replace t1 set a=1,b='xyz',c=111,d=null;
+commit;
+select a,b from t1 where d is null;
+a b
+1 xyz
+delete from t1 where a=1;
+delete from t1 where a=2;
+commit;
+select count(*) from t1;
+count(*)
+0
insert into t1 values(1,@b1,111,@d1);
insert into t1 values(2,@b2,222,@d2);
commit;
@@ -241,90 +268,6 @@ a b c d
7 7xb7 777 7xdd7
8 8xb8 888 8xdd8
9 9xb9 999 9xdd9
-select * from t1 order by a;
-a b c d
-1 1xb1 111 1xdd1
-2 2xb2 222 2xdd2
-3 3xb3 333 3xdd3
-4 4xb4 444 4xdd4
-5 5xb5 555 5xdd5
-6 6xb6 666 6xdd6
-7 7xb7 777 7xdd7
-8 8xb8 888 8xdd8
-9 9xb9 999 9xdd9
-alter table t1 add x int;
-select * from t1 order by a;
-a b c d x
-1 1xb1 111 1xdd1 NULL
-2 2xb2 222 2xdd2 NULL
-3 3xb3 333 3xdd3 NULL
-4 4xb4 444 4xdd4 NULL
-5 5xb5 555 5xdd5 NULL
-6 6xb6 666 6xdd6 NULL
-7 7xb7 777 7xdd7 NULL
-8 8xb8 888 8xdd8 NULL
-9 9xb9 999 9xdd9 NULL
-alter table t1 drop x;
-select * from t1 order by a;
-a b c d
-1 1xb1 111 1xdd1
-2 2xb2 222 2xdd2
-3 3xb3 333 3xdd3
-4 4xb4 444 4xdd4
-5 5xb5 555 5xdd5
-6 6xb6 666 6xdd6
-7 7xb7 777 7xdd7
-8 8xb8 888 8xdd8
-9 9xb9 999 9xdd9
-create database mysqltest;
-use mysqltest;
-CREATE TABLE t2 (
-a bigint unsigned NOT NULL PRIMARY KEY,
-b int unsigned not null,
-c int unsigned
-) engine=ndbcluster;
-insert into t2 values (1,1,1),(2,2,2);
-select * from test.t1,t2 where test.t1.a = t2.a order by test.t1.a;
-a b c d a b c
-1 1xb1 111 1xdd1 1 1 1
-2 2xb2 222 2xdd2 2 2 2
-drop table t2;
-use test;
-select * from t1 order by a;
-a b c d
-1 1xb1 111 1xdd1
-2 2xb2 222 2xdd2
-3 3xb3 333 3xdd3
-4 4xb4 444 4xdd4
-5 5xb5 555 5xdd5
-6 6xb6 666 6xdd6
-7 7xb7 777 7xdd7
-8 8xb8 888 8xdd8
-9 9xb9 999 9xdd9
-alter table t1 add x int;
-select * from t1 order by a;
-a b c d x
-1 1xb1 111 1xdd1 NULL
-2 2xb2 222 2xdd2 NULL
-3 3xb3 333 3xdd3 NULL
-4 4xb4 444 4xdd4 NULL
-5 5xb5 555 5xdd5 NULL
-6 6xb6 666 6xdd6 NULL
-7 7xb7 777 7xdd7 NULL
-8 8xb8 888 8xdd8 NULL
-9 9xb9 999 9xdd9 NULL
-alter table t1 drop x;
-select * from t1 order by a;
-a b c d
-1 1xb1 111 1xdd1
-2 2xb2 222 2xdd2
-3 3xb3 333 3xdd3
-4 4xb4 444 4xdd4
-5 5xb5 555 5xdd5
-6 6xb6 666 6xdd6
-7 7xb7 777 7xdd7
-8 8xb8 888 8xdd8
-9 9xb9 999 9xdd9
delete from t1 where c >= 100;
commit;
select count(*) from t1;
@@ -375,8 +318,128 @@ rollback;
select count(*) from t1;
count(*)
0
+insert into t1 values(1,'b1',111,'dd1');
+insert into t1 values(2,'b2',222,'dd2');
+insert into t1 values(3,'b3',333,'dd3');
+insert into t1 values(4,'b4',444,'dd4');
+insert into t1 values(5,'b5',555,'dd5');
+insert into t1 values(6,'b6',666,'dd6');
+insert into t1 values(7,'b7',777,'dd7');
+insert into t1 values(8,'b8',888,'dd8');
+insert into t1 values(9,'b9',999,'dd9');
+commit;
+select * from t1 order by a;
+a b c d
+1 b1 111 dd1
+2 b2 222 dd2
+3 b3 333 dd3
+4 b4 444 dd4
+5 b5 555 dd5
+6 b6 666 dd6
+7 b7 777 dd7
+8 b8 888 dd8
+9 b9 999 dd9
+alter table t1 add x int;
+select * from t1 order by a;
+a b c d x
+1 b1 111 dd1 NULL
+2 b2 222 dd2 NULL
+3 b3 333 dd3 NULL
+4 b4 444 dd4 NULL
+5 b5 555 dd5 NULL
+6 b6 666 dd6 NULL
+7 b7 777 dd7 NULL
+8 b8 888 dd8 NULL
+9 b9 999 dd9 NULL
+alter table t1 drop x;
+select * from t1 order by a;
+a b c d
+1 b1 111 dd1
+2 b2 222 dd2
+3 b3 333 dd3
+4 b4 444 dd4
+5 b5 555 dd5
+6 b6 666 dd6
+7 b7 777 dd7
+8 b8 888 dd8
+9 b9 999 dd9
+create database test2;
+use test2;
+CREATE TABLE t2 (
+a bigint unsigned NOT NULL PRIMARY KEY,
+b int unsigned not null,
+c int unsigned
+) engine=ndbcluster;
+insert into t2 values (1,1,1),(2,2,2);
+select * from test.t1,t2 where test.t1.a = t2.a order by test.t1.a;
+a b c d a b c
+1 b1 111 dd1 1 1 1
+2 b2 222 dd2 2 2 2
+drop table t2;
+use test;
+select * from t1 order by a;
+a b c d
+1 b1 111 dd1
+2 b2 222 dd2
+3 b3 333 dd3
+4 b4 444 dd4
+5 b5 555 dd5
+6 b6 666 dd6
+7 b7 777 dd7
+8 b8 888 dd8
+9 b9 999 dd9
+alter table t1 add x int;
+select * from t1 order by a;
+a b c d x
+1 b1 111 dd1 NULL
+2 b2 222 dd2 NULL
+3 b3 333 dd3 NULL
+4 b4 444 dd4 NULL
+5 b5 555 dd5 NULL
+6 b6 666 dd6 NULL
+7 b7 777 dd7 NULL
+8 b8 888 dd8 NULL
+9 b9 999 dd9 NULL
+alter table t1 drop x;
+select * from t1 order by a;
+a b c d
+1 b1 111 dd1
+2 b2 222 dd2
+3 b3 333 dd3
+4 b4 444 dd4
+5 b5 555 dd5
+6 b6 666 dd6
+7 b7 777 dd7
+8 b8 888 dd8
+9 b9 999 dd9
+drop table t1;
+drop database test2;
+set autocommit=0;
+create table t1 (
+a int not null primary key,
+b tinytext
+) engine=ndbcluster;
+insert into t1 values(1, 'x');
+update t1 set b = 'y';
+select * from t1;
+a b
+1 y
+delete from t1;
+select * from t1;
+a b
+commit;
+drop table t1;
+set autocommit=0;
+create table t1 (
+a int not null primary key,
+b text not null
+) engine=ndbcluster;
+insert into t1 values(1, '');
+select * from t1;
+a b
+1
+commit;
drop table t1;
-drop database mysqltest;
set autocommit=1;
use test;
CREATE TABLE t1 (
@@ -397,6 +460,7 @@ select * from t1 order by a;
a b
1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
2 BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
+set autocommit=1;
alter table t1 engine=myisam;
select * from t1 order by a;
a b
diff --git a/mysql-test/r/ndb_insert.result b/mysql-test/r/ndb_insert.result
index cdc445558b9..16c76f39680 100644
--- a/mysql-test/r/ndb_insert.result
+++ b/mysql-test/r/ndb_insert.result
@@ -557,3 +557,32 @@ select * from t1 where pk1=1;
pk1 b c
1 2 3
DROP TABLE t1;
+CREATE TABLE t1(a INT) ENGINE=ndb;
+INSERT IGNORE INTO t1 VALUES (1);
+INSERT IGNORE INTO t1 VALUES (1);
+INSERT IGNORE INTO t1 SELECT a FROM t1;
+INSERT IGNORE INTO t1 SELECT a FROM t1;
+INSERT IGNORE INTO t1 SELECT a FROM t1;
+INSERT IGNORE INTO t1 VALUES (1);
+INSERT IGNORE INTO t1 VALUES (1);
+SELECT * FROM t1;
+a
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+DROP TABLE t1;
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index 74b9fb9202b..e0f230fa579 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -106,12 +106,6 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
set @fvar= 123.4567;
prepare stmt1 from @fvar;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '123.4567' at line 1
-set @str1 = 'select ?';
-set @str2 = convert(@str1 using ucs2);
-prepare stmt1 from @str2;
-execute stmt1 using @ivar;
-?
-1234
drop table t1,t2;
PREPARE stmt1 FROM "select _utf8 'A' collate utf8_bin = ?";
set @var='A';
diff --git a/mysql-test/r/ps_10nestset.result b/mysql-test/r/ps_10nestset.result
index 68f58a03674..ff63485a5f9 100644
--- a/mysql-test/r/ps_10nestset.result
+++ b/mysql-test/r/ps_10nestset.result
@@ -62,4 +62,15 @@ id emp salary l r
4 Donna 1064.80 5 6
5 Eddie 931.70 7 8
6 Fred 798.60 9 10
+prepare st_round from 'update t1 set salary = salary + ? - ( salary MOD ? )';
+set @arg_round= 50;
+execute st_round using @arg_round, @arg_round;
+select * from t1;
+id emp salary l r
+1 Jerry 1350.00 1 12
+2 Bert 1200.00 2 3
+3 Chuck 1250.00 4 11
+4 Donna 1100.00 5 6
+5 Eddie 950.00 7 8
+6 Fred 800.00 9 10
drop table t1;
diff --git a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result
index 1a096a58252..6773370fbc5 100644
--- a/mysql-test/r/ps_2myisam.result
+++ b/mysql-test/r/ps_2myisam.result
@@ -1580,7 +1580,9 @@ a b
1200 x1000_1updatedupdated
delete from t1 where a >= 1000 ;
prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
-ERROR HY000: This command is not supported in the prepared statement protocol yet
+execute stmt1;
+execute stmt1;
+execute stmt1;
test_sequence
------ multi table tests ------
delete from t1 ;
@@ -1790,7 +1792,7 @@ t5 CREATE TABLE `t5` (
`const12` char(0) default NULL,
`param12` bigint(20) default NULL,
`param13` double default NULL,
- `param14` longblob,
+ `param14` longtext,
`param15` longblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t5 ;
@@ -1820,7 +1822,7 @@ def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
def test t5 t5 const12 const12 254 0 0 Y 0 0 8
def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
-def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63
+def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8
def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
const01 8
param01 8
@@ -1973,19 +1975,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select
@@ -2063,19 +2065,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
@@ -2155,19 +2157,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2239,19 +2241,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
diff --git a/mysql-test/r/ps_3innodb.result b/mysql-test/r/ps_3innodb.result
index 5c22beeb56b..09f19c3763c 100644
--- a/mysql-test/r/ps_3innodb.result
+++ b/mysql-test/r/ps_3innodb.result
@@ -1563,7 +1563,9 @@ a b
1200 x1000_1updatedupdated
delete from t1 where a >= 1000 ;
prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
-ERROR HY000: This command is not supported in the prepared statement protocol yet
+execute stmt1;
+execute stmt1;
+execute stmt1;
test_sequence
------ multi table tests ------
delete from t1 ;
@@ -1773,7 +1775,7 @@ t5 CREATE TABLE `t5` (
`const12` char(0) default NULL,
`param12` bigint(20) default NULL,
`param13` double default NULL,
- `param14` longblob,
+ `param14` longtext,
`param15` longblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t5 ;
@@ -1803,7 +1805,7 @@ def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
def test t5 t5 const12 const12 254 0 0 Y 0 0 8
def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
-def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63
+def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8
def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
const01 8
param01 8
@@ -1956,19 +1958,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select
@@ -2046,19 +2048,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
@@ -2138,19 +2140,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2222,19 +2224,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
diff --git a/mysql-test/r/ps_4heap.result b/mysql-test/r/ps_4heap.result
index 9cbe87b004a..427fee8e757 100644
--- a/mysql-test/r/ps_4heap.result
+++ b/mysql-test/r/ps_4heap.result
@@ -1564,7 +1564,9 @@ a b
1200 x1000_1updatedupdated
delete from t1 where a >= 1000 ;
prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
-ERROR HY000: This command is not supported in the prepared statement protocol yet
+execute stmt1;
+execute stmt1;
+execute stmt1;
test_sequence
------ multi table tests ------
delete from t1 ;
@@ -1774,7 +1776,7 @@ t5 CREATE TABLE `t5` (
`const12` char(0) default NULL,
`param12` bigint(20) default NULL,
`param13` double default NULL,
- `param14` longblob,
+ `param14` longtext,
`param15` longblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t5 ;
@@ -1804,7 +1806,7 @@ def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
def test t5 t5 const12 const12 254 0 0 Y 0 0 8
def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
-def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63
+def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8
def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
const01 8
param01 8
@@ -1957,19 +1959,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
-def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
-def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
-def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
-def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 0 31 8
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 0 31 8
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 0 31 8
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 0 31 8
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select
@@ -2047,19 +2049,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
-def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
-def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
-def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
-def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 0 31 8
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 0 31 8
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 0 31 8
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 0 31 8
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
@@ -2139,19 +2141,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
-def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
-def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
-def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
-def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 0 31 8
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 0 31 8
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 0 31 8
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 0 31 8
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2223,19 +2225,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
-def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
-def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
-def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
-def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 0 31 8
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 0 31 8
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 0 31 8
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 0 31 8
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
diff --git a/mysql-test/r/ps_5merge.result b/mysql-test/r/ps_5merge.result
index 4ed0295a92e..51d842ae000 100644
--- a/mysql-test/r/ps_5merge.result
+++ b/mysql-test/r/ps_5merge.result
@@ -1606,7 +1606,9 @@ a b
1200 x1000_1updatedupdated
delete from t1 where a >= 1000 ;
prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
-ERROR HY000: This command is not supported in the prepared statement protocol yet
+execute stmt1;
+execute stmt1;
+execute stmt1;
test_sequence
------ multi table tests ------
delete from t1 ;
@@ -1713,7 +1715,7 @@ t5 CREATE TABLE `t5` (
`const12` char(0) default NULL,
`param12` bigint(20) default NULL,
`param13` double default NULL,
- `param14` longblob,
+ `param14` longtext,
`param15` longblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t5 ;
@@ -1743,7 +1745,7 @@ def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
def test t5 t5 const12 const12 254 0 0 Y 0 0 8
def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
-def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63
+def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8
def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
const01 8
param01 8
@@ -1896,19 +1898,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select
@@ -1986,19 +1988,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
@@ -2078,19 +2080,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2162,19 +2164,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
@@ -4613,7 +4615,9 @@ a b
1200 x1000_1updatedupdated
delete from t1 where a >= 1000 ;
prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
-ERROR HY000: This command is not supported in the prepared statement protocol yet
+execute stmt1;
+execute stmt1;
+execute stmt1;
test_sequence
------ multi table tests ------
delete from t1 ;
@@ -4720,7 +4724,7 @@ t5 CREATE TABLE `t5` (
`const12` char(0) default NULL,
`param12` bigint(20) default NULL,
`param13` double default NULL,
- `param14` longblob,
+ `param14` longtext,
`param15` longblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t5 ;
@@ -4750,7 +4754,7 @@ def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
def test t5 t5 const12 const12 254 0 0 Y 0 0 8
def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
-def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63
+def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8
def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
const01 8
param01 8
@@ -4903,19 +4907,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select
@@ -4993,19 +4997,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
@@ -5085,19 +5089,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -5169,19 +5173,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
diff --git a/mysql-test/r/ps_6bdb.result b/mysql-test/r/ps_6bdb.result
index 7ec7e303b42..85cb8af652e 100644
--- a/mysql-test/r/ps_6bdb.result
+++ b/mysql-test/r/ps_6bdb.result
@@ -1563,7 +1563,9 @@ a b
1200 x1000_1updatedupdated
delete from t1 where a >= 1000 ;
prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
-ERROR HY000: This command is not supported in the prepared statement protocol yet
+execute stmt1;
+execute stmt1;
+execute stmt1;
test_sequence
------ multi table tests ------
delete from t1 ;
@@ -1773,7 +1775,7 @@ t5 CREATE TABLE `t5` (
`const12` char(0) default NULL,
`param12` bigint(20) default NULL,
`param13` double default NULL,
- `param14` longblob,
+ `param14` longtext,
`param15` longblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t5 ;
@@ -1803,7 +1805,7 @@ def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
def test t5 t5 const12 const12 254 0 0 Y 0 0 8
def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
-def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63
+def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8
def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
const01 8
param01 8
@@ -1956,19 +1958,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select
@@ -2046,19 +2048,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
@@ -2138,19 +2140,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2222,19 +2224,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
diff --git a/mysql-test/r/ps_7ndb.result b/mysql-test/r/ps_7ndb.result
index cf567750b85..e90eff5d1cd 100644
--- a/mysql-test/r/ps_7ndb.result
+++ b/mysql-test/r/ps_7ndb.result
@@ -1543,7 +1543,6 @@ a b
1000 x1000_1
delete from t1 where a >= 1000 ;
prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
-ERROR HY000: This command is not supported in the prepared statement protocol yet
test_sequence
------ multi table tests ------
delete from t1 ;
@@ -1753,7 +1752,7 @@ t5 CREATE TABLE `t5` (
`const12` char(0) default NULL,
`param12` bigint(20) default NULL,
`param13` double default NULL,
- `param14` longblob,
+ `param14` longtext,
`param15` longblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t5 ;
@@ -1783,7 +1782,7 @@ def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
def test t5 t5 const12 const12 254 0 0 Y 0 0 8
def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
-def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63
+def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8
def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
const01 8
param01 8
@@ -1936,19 +1935,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
-def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
-def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
-def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
-def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 0 31 8
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 0 31 8
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 0 31 8
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 0 31 8
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select
@@ -2026,19 +2025,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
-def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
-def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
-def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
-def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 0 31 8
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 0 31 8
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 0 31 8
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 0 31 8
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
@@ -2118,19 +2117,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
-def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
-def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
-def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
-def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 0 31 8
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 0 31 8
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 0 31 8
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 0 31 8
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2202,19 +2201,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
-def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
-def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
-def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
-def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 0 31 8
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 0 31 8
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 0 31 8
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 0 31 8
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result
index e7375b428c2..1374a8fd0ed 100644
--- a/mysql-test/r/range.result
+++ b/mysql-test/r/range.result
@@ -547,3 +547,20 @@ select count(*) from t2 where x = 18446744073709551601;
count(*)
0
drop table t1,t2;
+set names latin1;
+create table t1 (a char(10), b text, key (a)) character set latin1;
+INSERT INTO t1 (a) VALUES
+('111'),('222'),('222'),('222'),('222'),('444'),('aaa'),('AAA'),('bbb');
+explain select * from t1 where a='aaa';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 11 const 2 Using where
+explain select * from t1 where a=binary 'aaa';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 11 NULL 2 Using where
+explain select * from t1 where a='aaa' collate latin1_bin;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 11 NULL 2 Using where
+explain select * from t1 where a='aaa' collate latin1_german1_ci;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL a NULL NULL NULL 9 Using where
+drop table t1;
diff --git a/mysql-test/r/rpl_failed_optimize.result b/mysql-test/r/rpl_failed_optimize.result
new file mode 100644
index 00000000000..1576ec60500
--- /dev/null
+++ b/mysql-test/r/rpl_failed_optimize.result
@@ -0,0 +1,15 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 ( a int ) ENGINE=InnoDB;
+BEGIN;
+INSERT INTO t1 VALUES (1);
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status Operation failed
+OPTIMIZE TABLE non_existing;
+Table Op Msg_type Msg_text
+test.non_existing optimize error Table 'test.non_existing' doesn't exist
diff --git a/mysql-test/r/sql_mode.result b/mysql-test/r/sql_mode.result
index a892967ac79..67446829eca 100644
--- a/mysql-test/r/sql_mode.result
+++ b/mysql-test/r/sql_mode.result
@@ -85,6 +85,36 @@ t1 CREATE TABLE "t1" (
UNIQUE KEY "email" ("email")
)
drop table t1;
+CREATE TABLE t1 (
+a char(10),
+b char(10) collate latin1_bin,
+c binary(10)
+) character set latin1;
+set @@sql_mode="";
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) default NULL,
+ `b` char(10) character set latin1 collate latin1_bin default NULL,
+ `c` binary(10) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+set @@sql_mode="mysql323";
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) default NULL,
+ `b` char(10) binary default NULL,
+ `c` binary(10) default NULL
+) TYPE=MyISAM
+set @@sql_mode="mysql40";
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) default NULL,
+ `b` char(10) binary default NULL,
+ `c` binary(10) default NULL
+) TYPE=MyISAM
+drop table t1;
set session sql_mode = '';
create table t1 ( min_num dec(6,6) default .000001);
show create table t1;
diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result
index 159a6c466de..151ec404455 100644
--- a/mysql-test/r/type_float.result
+++ b/mysql-test/r/type_float.result
@@ -22,14 +22,14 @@ select * from t1;
f1 f2
10 10
100000 100000
-1.23457e+09 1234567890
+1.23457e+9 1234567890
1e+10 10000000000
1e+15 1e+15
1e+20 1e+20
3.40282e+38 1e+50
3.40282e+38 1e+150
-10 -10
-1e-05 1e-05
+1e-5 1e-5
1e-10 1e-10
1e-15 1e-15
1e-20 1e-20
diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result
index 80d8af095cb..36705c33b5d 100644
--- a/mysql-test/r/user_var.result
+++ b/mysql-test/r/user_var.result
@@ -201,3 +201,7 @@ SET @`v`:=_ucs2 0x006100620063 COLLATE ucs2_general_ci;
SET TIMESTAMP=10000;
insert into t2 values (@v);
drop table t1, t2;
+set @var= NULL ;
+select FIELD( @var,'1it','Hit') as my_column;
+my_column
+0
diff --git a/mysql-test/t/client_test.test b/mysql-test/t/client_test.test
index b56e8038d9b..830c5f1b8a2 100644
--- a/mysql-test/t/client_test.test
+++ b/mysql-test/t/client_test.test
@@ -1,2 +1,2 @@
--disable_result_log
---exec $TESTS_BINDIR/client_test --testcase --user=root --socket=$MASTER_MYSOCK --port=$MYSQL_TCP_PORT
+--exec $TESTS_BINDIR/client_test --testcase --user=root --socket=$MASTER_MYSOCK --port=$MYSQL_TCP_PORT --silent
diff --git a/mysql-test/t/comments.test b/mysql-test/t/comments.test
index 2fc6237907c..087df60f3f5 100644
--- a/mysql-test/t/comments.test
+++ b/mysql-test/t/comments.test
@@ -5,7 +5,8 @@
select 1+2/*hello*/+3;
select 1 /* long
multi line comment */;
-!$1065 ;
+--error 1065
+ ;
select 1 /*!32301 +1 */;
select 1 /*!52301 +1 */;
select 1--1;
diff --git a/mysql-test/t/ctype_recoding.test b/mysql-test/t/ctype_recoding.test
index 5f417352d95..0e5e954c720 100644
--- a/mysql-test/t/ctype_recoding.test
+++ b/mysql-test/t/ctype_recoding.test
@@ -131,3 +131,51 @@ create table t1 (a char(10) character set koi8r, b text character set koi8r);
insert into t1 values ('test','test');
insert into t1 values ('ÊÃÕË','ÊÃÕË');
drop table t1;
+
+#
+# Try to apply an automatic conversion in some cases:
+# E.g. when mixing a column to a string, the string
+# is converted into the column character set.
+# If conversion loses data, then error. Otherwise,
+# the string is replaced by its converted representation
+#
+set names koi8r;
+create table t1 (a char(10) character set cp1251);
+insert into t1 values (_koi8r'×ÁÓÑ');
+# this is possible:
+select * from t1 where a=_koi8r'×ÁÓÑ';
+# this is not possible, because we have a function, not just a constant:
+--error 1267
+select * from t1 where a=concat(_koi8r'×ÁÓÑ');
+# this is not posible, cannot convert _latin1'×ÁÓÑ' into cp1251:
+--error 1267
+select * from t1 where a=_latin1'×ÁÓÑ';
+drop table t1;
+set names latin1;
+
+#
+# Check more automatic conversion
+#
+set names koi8r;
+create table t1 (c1 char(10) character set cp1251);
+insert into t1 values ('ß');
+select c1 from t1 where c1 between 'ß' and 'ß';
+select ifnull(c1,'ß'), ifnull(null,c1) from t1;
+select if(1,c1,'ö'), if(0,c1,'ö') from t1;
+select coalesce('ö',c1), coalesce(null,c1) from t1;
+select least(c1,'ö'), greatest(c1,'ö') from t1;
+select locate(c1,'ß'), locate('ß',c1) from t1;
+select field(c1,'ß'),field('ß',c1) from t1;
+select concat(c1,'ö'), concat('ö',c1) from t1;
+select concat_ws(c1,'ö','ß'), concat_ws('ö',c1,'ß') from t1;
+select replace(c1,'ß','ö'), replace('ß',c1,'ö') from t1;
+select substring_index(c1,'öößß',2) from t1;
+select elt(1,c1,'ö'),elt(1,'ö',c1) from t1;
+select make_set(3,c1,'ö'), make_set(3,'ö',c1) from t1;
+select insert(c1,1,2,'ö'),insert('ö',1,2,c1) from t1;
+select trim(c1 from 'ß'),trim('ß' from c1) from t1;
+select lpad(c1,3,'ö'), lpad('ö',3,c1) from t1;
+select rpad(c1,3,'ö'), rpad('ö',3,c1) from t1;
+# TODO
+#select case c1 when 'ß' then 'ß' when 'ö' then 'ö' else 'c' end from t1;
+#select export_set(5,c1,'ö'), export_set(5,'ö',c1) from t1;
diff --git a/mysql-test/t/ctype_sjis.test b/mysql-test/t/ctype_sjis.test
index c910812ef8a..a3a44789975 100644
--- a/mysql-test/t/ctype_sjis.test
+++ b/mysql-test/t/ctype_sjis.test
@@ -51,3 +51,14 @@ insert into t1 values (0x9353);
insert into t1 values (0x9373);
select hex(c) from t1;
drop table t1;
+
+#
+# Bug #6223 Japanese half-width kana characters get truncated
+#
+SET NAMES sjis;
+CREATE TABLE t1 (
+ c char(16) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=sjis;
+insert into t1 values(0xb1),(0xb2),(0xb3);
+select hex(c) from t1;
+drop table t1;
diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test
index d9ef91496e9..4c6d1bbebef 100644
--- a/mysql-test/t/ctype_ucs.test
+++ b/mysql-test/t/ctype_ucs.test
@@ -315,3 +315,11 @@ alter table t1 modify a char(5);
select a, hex(a) from t1;
drop table t1;
+#
+# Check prepare statement from an UCS2 string
+#
+set @ivar= 1234;
+set @str1 = 'select ?';
+set @str2 = convert(@str1 using ucs2);
+prepare stmt1 from @str2;
+execute stmt1 using @ivar;
diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test
index 0c8bdd6a94d..c75b1dee63c 100644
--- a/mysql-test/t/ctype_utf8.test
+++ b/mysql-test/t/ctype_utf8.test
@@ -645,6 +645,7 @@ insert into t1 values(1,'foo'),(2,'foobar');
select * from t1 where b like 'foob%';
--disable_warnings
alter table t1 engine=bdb;
+--enable_warnings
select * from t1 where b like 'foob%';
drop table t1;
diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test
index 66df5b1cb92..5a2f2d87194 100644
--- a/mysql-test/t/fulltext.test
+++ b/mysql-test/t/fulltext.test
@@ -253,10 +253,17 @@ select * from t1 join t2 using(`t1_id`) where match (t1.name, t2.name) against('
# bug with many short (< ft_min_word_len) words in boolean search
#
select * from t2 where match name against ('a* b* c* d* e* f*' in boolean mode);
-
drop table t1,t2;
#
+# bug with repair-by-sort and incorrect records estimation
+#
+
+create table t1 (a text, fulltext key (a));
+insert into t1 select "xxxx yyyy zzzz";
+drop table t1;
+
+#
# UTF8
#
SET NAMES latin1;
@@ -272,7 +279,7 @@ SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrück');
SET NAMES latin1;
SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrück');
SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrueck');
-SELECT t, collation(t),MATCH t AGAINST ('Osnabruck') FROM t1 WHERE MATCH t AGAINST ('Osnabruck');
+SELECT t, collation(t),FORMAT(MATCH t AGAINST ('Osnabruck'),6) FROM t1 WHERE MATCH t AGAINST ('Osnabruck');
#alter table t1 modify t text character set latin1 collate latin1_german2_ci not null;
alter table t1 modify t varchar(200) collate latin1_german2_ci not null;
SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrück');
diff --git a/mysql-test/t/fulltext_order_by.test b/mysql-test/t/fulltext_order_by.test
index f8afe49d95d..5856f68ec9e 100644
--- a/mysql-test/t/fulltext_order_by.test
+++ b/mysql-test/t/fulltext_order_by.test
@@ -10,25 +10,25 @@ CREATE TABLE t1 (
INSERT INTO t1 (message) VALUES ("Testing"),("table"),("testbug"),
("steve"),("is"),("cool"),("steve is cool");
# basic MATCH
-SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE MATCH (message) AGAINST ('steve');
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve');
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve');
-SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE);
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE);
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE);
# MATCH + ORDER BY (with ft-ranges)
-SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY a;
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY a;
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY a;
# MATCH + ORDER BY (with normal ranges) + UNIQUE
-SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve') ORDER BY a DESC;
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve') ORDER BY a DESC;
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY a DESC;
# MATCH + ORDER BY + UNIQUE (const_table)
-SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve') ORDER BY 1;
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve') ORDER BY 1;
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY 1;
# ORDER BY MATCH
-SELECT a, MATCH (message) AGAINST ('steve') as rel FROM t1 ORDER BY rel;
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) as rel FROM t1 ORDER BY rel;
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) as rel FROM t1 ORDER BY rel;
drop table t1;
diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test
index 22079377ad2..3cd8c064817 100644
--- a/mysql-test/t/func_in.test
+++ b/mysql-test/t/func_in.test
@@ -89,3 +89,10 @@ select 1 in ('1.0',2.0);
select 1 in (1.0,'2.0');
select 1 in ('1.1',2);
select 1 in ('1.1',2.0);
+
+# Test case for bug #6365
+
+create table t1 (a char(20) character set binary);
+insert into t1 values ('aa'), ('bb');
+select * from t1 where a in (NULL, 'aa');
+drop table t1;
diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test
index 739fced1f29..86c34eacbc5 100644
--- a/mysql-test/t/gis.test
+++ b/mysql-test/t/gis.test
@@ -284,3 +284,78 @@ drop table t1;
create table t1 select POINT(1,3);
show create table t1;
drop table t1;
+
+CREATE TABLE `t1` (`object_id` bigint(20) unsigned NOT NULL default '0', `geo`
+geometry NOT NULL default '') ENGINE=MyISAM ;
+
+insert into t1 values ('85984',GeomFromText('MULTIPOLYGON(((-115.006363
+36.305435,-114.992394 36.305202,-114.991219 36.305975,-114.991163
+36.306845,-114.989432 36.309452,-114.978275 36.312642,-114.977363
+36.311978,-114.975327 36.312344,-114.96502 36.31597,-114.963364
+36.313629,-114.961723 36.313721,-114.956398 36.316057,-114.951882
+36.320979,-114.947073 36.323475,-114.945207 36.326451,-114.945207
+36.326451,-114.944132 36.326061,-114.94003 36.326588,-114.924017
+36.334484,-114.923281 36.334146,-114.92564 36.331504,-114.94072
+36.319282,-114.945348 36.314812,-114.948091 36.314762,-114.951755
+36.316211,-114.952446 36.313883,-114.952644 36.309488,-114.944725
+36.313083,-114.93706 36.32043,-114.932478 36.323497,-114.924556
+36.327708,-114.922608 36.329715,-114.92009 36.328695,-114.912105
+36.323566,-114.901647 36.317952,-114.897436 36.313968,-114.895344
+36.309573,-114.891699 36.304398,-114.890569 36.303551,-114.886356
+36.302702,-114.885141 36.301351,-114.885709 36.297391,-114.892499
+36.290893,-114.902142 36.288974,-114.904941 36.288838,-114.905308
+36.289845,-114.906325 36.290395,-114.909916 36.289549,-114.914527
+36.287535,-114.918797 36.284423,-114.922982 36.279731,-114.924113
+36.277282,-114.924057 36.275817,-114.927733 36.27053,-114.929354
+36.269029,-114.929354 36.269029,-114.950856 36.268715,-114.950768
+36.264324,-114.960206 36.264293,-114.960301 36.268943,-115.006662
+36.268929,-115.008583 36.265619,-115.00665 36.264247,-115.006659
+36.246873,-115.006659 36.246873,-115.006838 36.247697,-115.010764
+36.247774,-115.015609 36.25113,-115.015765 36.254505,-115.029517
+36.254619,-115.038573 36.249317,-115.038573 36.249317,-115.023403
+36.25841,-115.023873 36.258994,-115.031845 36.259829,-115.03183
+36.261053,-115.025561 36.261095,-115.036417 36.274632,-115.033729
+36.276041,-115.032217 36.274851,-115.029845 36.273959,-115.029934
+36.274966,-115.025763 36.274896,-115.025406 36.281044,-115.028731
+36.284471,-115.036497 36.290377,-115.042071 36.291039,-115.026759
+36.298478,-115.008995 36.301966,-115.006363 36.305435),(-115.079835
+36.244369,-115.079735 36.260186,-115.076435 36.262369,-115.069758
+36.265,-115.070235 36.268757,-115.064542 36.268655,-115.061843
+36.269857,-115.062676 36.270693,-115.06305 36.272344,-115.059051
+36.281023,-115.05918 36.283008,-115.060591 36.285246,-115.061913
+36.290022,-115.062499 36.306353,-115.062499 36.306353,-115.060918
+36.30642,-115.06112 36.289779,-115.05713 36.2825,-115.057314
+36.279446,-115.060779 36.274659,-115.061366 36.27209,-115.057858
+36.26557,-115.055805 36.262883,-115.054688 36.262874,-115.047335
+36.25037,-115.044234 36.24637,-115.052434 36.24047,-115.061734
+36.23507,-115.061934 36.22677,-115.061934 36.22677,-115.061491
+36.225267,-115.062024 36.218194,-115.060134 36.218278,-115.060133
+36.210771,-115.057833 36.210771,-115.057433 36.196271,-115.062233
+36.196271,-115.062233 36.190371,-115.062233 36.190371,-115.065533
+36.190371,-115.071333 36.188571,-115.098331 36.188275,-115.098331
+36.188275,-115.098435 36.237569,-115.097535 36.240369,-115.097535
+36.240369,-115.093235 36.240369,-115.089135 36.240469,-115.083135
+36.240569,-115.083135 36.240569,-115.079835
+36.244369)))')),('85998',GeomFromText('MULTIPOLYGON(((-115.333107
+36.264587,-115.333168 36.280638,-115.333168 36.280638,-115.32226
+36.280643,-115.322538 36.274311,-115.327222 36.274258,-115.32733
+36.263026,-115.330675 36.262984,-115.332132 36.264673,-115.333107
+36.264587),(-115.247239 36.247066,-115.247438 36.218267,-115.247438
+36.218267,-115.278525 36.219263,-115.278525 36.219263,-115.301545
+36.219559,-115.332748 36.219197,-115.332757 36.220041,-115.332757
+36.220041,-115.332895 36.233514,-115.349023 36.233479,-115.351489
+36.234475,-115.353681 36.237021,-115.357106 36.239789,-115.36519
+36.243331,-115.368156 36.243487,-115.367389 36.244902,-115.364553
+36.246014,-115.359219 36.24616,-115.356186 36.248025,-115.353347
+36.248004,-115.350813 36.249507,-115.339673 36.25387,-115.333069
+36.255018,-115.333069 36.255018,-115.333042 36.247767,-115.279039
+36.248666,-115.263639 36.247466,-115.263839 36.252766,-115.261439
+36.252666,-115.261439 36.247366,-115.247239 36.247066)))'));
+
+select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from
+t1 where object_id=85998;
+
+select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from
+t1 where object_id=85984;
+
+drop table t1;
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index f9b1de44b81..cc11539a9b0 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -1110,6 +1110,7 @@ show create table t2;
drop table t2;
# Test error handling
+--replace_result \\ /
--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;
diff --git a/mysql-test/t/insert.test b/mysql-test/t/insert.test
index c56bc74877e..e977de94871 100644
--- a/mysql-test/t/insert.test
+++ b/mysql-test/t/insert.test
@@ -99,22 +99,27 @@ create table t1(number int auto_increment primary key, original_value varchar(50
set @value= "aa";
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+--replace_result e-0 e- e+0 e+
--query_vertical select * from t1 where number =last_insert_id()
set @value= "1aa";
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+--replace_result e-0 e- e+0 e+
--query_vertical select * from t1 where number =last_insert_id()
set @value= "aa1";
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+--replace_result e-0 e- e+0 e+
--query_vertical select * from t1 where number =last_insert_id()
set @value= "1e+1111111111a";
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+--replace_result e-0 e- e+0 e+
--query_vertical select * from t1 where number =last_insert_id()
set @value= "-1e+1111111111a";
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+--replace_result e-0 e- e+0 e+
--query_vertical select * from t1 where number =last_insert_id()
--error 1367
@@ -122,20 +127,25 @@ set @value= 1e+1111111111;
--error 1367
set @value= -1e+1111111111;
+
set @value= 1e+111;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+--replace_result e-0 e- e+0 e+
--query_vertical select * from t1 where number =last_insert_id()
set @value= -1e+111;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+--replace_result e-0 e- e+0 e+
--query_vertical select * from t1 where number =last_insert_id()
set @value= 1;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+--replace_result e-0 e- e+0 e+
--query_vertical select * from t1 where number =last_insert_id()
set @value= -1;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+--replace_result e-0 e- e+0 e+
--query_vertical select * from t1 where number =last_insert_id()
drop table t1;
diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test
index 9b5fdb924e6..665b4fafbca 100644
--- a/mysql-test/t/join_outer.test
+++ b/mysql-test/t/join_outer.test
@@ -34,11 +34,14 @@ explain select t1.*,t2.* from t1 left join t2 on t1.a=t2.a where isnull(t2.a)=1;
select t1.*,t2.*,t3.a from t1 left join t2 on (t1.a=t2.a) left join t1 as t3 on (t2.a=t3.a);
# The next query should rearange the left joins to get this to work
-!$1120 explain select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t1.a=t3.a);
-!$1120 select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t1.a=t3.a);
+--error 1120
+explain select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t1.a=t3.a);
+--error 1120
+select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t1.a=t3.a);
# The next query should give an error in MySQL
-!$1120 select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t2.a=t3.a);
+--error 1120
+select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t2.a=t3.a);
# Test of inner join
select t1.*,t2.* from t1 inner join t2 using (a);
@@ -94,7 +97,8 @@ WHERE t1.uniq_id = 4
ORDER BY t2.c_amount;
INSERT INTO t2 VALUES (2,3,3000,6000,0,0,746584,837484,'yes');
-!$1062 INSERT INTO t2 VALUES (2,3,3000,6000,0,0,746584,837484,'yes');
+--error 1062
+INSERT INTO t2 VALUES (2,3,3000,6000,0,0,746584,837484,'yes');
INSERT INTO t2 VALUES (7,3,1000,2000,0,0,746294,937484,'yes');
#3rd select should show that one record is returned with null entries for the
@@ -288,7 +292,8 @@ insert into t3 values (1);
insert into t4 values (1,1);
insert into t5 values (1,1);
-!$1120 explain select * from t3 left join t4 on t4.seq_1_id = t2.t2_id left join t1 on t1.t1_id = t4.seq_0_id left join t5 on t5.seq_0_id = t1.t1_id left join t2 on t2.t2_id = t5.seq_1_id where t3.t3_id = 23;
+--error 1120
+explain select * from t3 left join t4 on t4.seq_1_id = t2.t2_id left join t1 on t1.t1_id = t4.seq_0_id left join t5 on t5.seq_0_id = t1.t1_id left join t2 on t2.t2_id = t5.seq_1_id where t3.t3_id = 23;
drop table t1,t2,t3,t4,t5;
@@ -502,6 +507,82 @@ select s.*, '*', m.*, (s.match_1_h - m.home) UUX from
drop table t1, t2;
+# Tests for bugs #6307 and 6460
+
+create table t1 (a int, b int, unique index idx (a, b));
+create table t2 (a int, b int, c int, unique index idx (a, b));
+
+insert into t1 values (1, 10), (1,11), (2,10), (2,11);
+insert into t2 values (1,10,3);
+
+select t1.a, t1.b, t2.c from t1 left join t2
+ on t1.a=t2.a and t1.b=t2.b and t2.c=3
+ where t1.a=1 and t2.c is null;
+
+drop table t1, t2;
+
+CREATE TABLE t1 (
+ ts_id bigint(20) default NULL,
+ inst_id tinyint(4) default NULL,
+ flag_name varchar(64) default NULL,
+ flag_value text,
+ UNIQUE KEY ts_id (ts_id,inst_id,flag_name)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+CREATE TABLE t2 (
+ ts_id bigint(20) default NULL,
+ inst_id tinyint(4) default NULL,
+ flag_name varchar(64) default NULL,
+ flag_value text,
+ UNIQUE KEY ts_id (ts_id,inst_id,flag_name)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+INSERT INTO t1 VALUES
+ (111056548820001, 0, 'flag1', NULL),
+ (111056548820001, 0, 'flag2', NULL),
+ (2, 0, 'other_flag', NULL);
+
+INSERT INTO t2 VALUES
+ (111056548820001, 3, 'flag1', 'sss');
+
+SELECT t1.flag_name,t2.flag_value
+ FROM t1 LEFT JOIN t2
+ ON (t1.ts_id = t2.ts_id AND t1.flag_name = t2.flag_name AND
+ t2.inst_id = 3)
+ WHERE t1.inst_id = 0 AND t1.ts_id=111056548820001 AND
+ t2.flag_value IS NULL;
+
+DROP TABLE t1,t2;
+
+CREATE TABLE invoice (
+ id int(11) unsigned NOT NULL auto_increment,
+ text_id int(10) unsigned default NULL,
+ PRIMARY KEY (id)
+);
+
+INSERT INTO invoice VALUES("1", "0");
+INSERT INTO invoice VALUES("2", "10");
+
+CREATE TABLE text_table (
+ text_id char(3) NOT NULL default '',
+ language_id char(3) NOT NULL default '',
+ text_data text,
+ PRIMARY KEY (text_id,language_id)
+);
+
+INSERT INTO text_table VALUES("0", "EN", "0-EN");
+INSERT INTO text_table VALUES("0", "SV", "0-SV");
+INSERT INTO text_table VALUES("10", "EN", "10-EN");
+INSERT INTO text_table VALUES("10", "SV", "10-SV");
+
+SELECT invoice.id, invoice.text_id, text_table.text_data
+ FROM invoice LEFT JOIN text_table
+ ON invoice.text_id = text_table.text_id
+ AND text_table.language_id = 'SV'
+ WHERE (invoice.id LIKE '%' OR text_table.text_data LIKE '%');
+
+DROP TABLE invoice, text_table;
+
# Test for bug #5896
CREATE TABLE t0 (a0 int PRIMARY KEY);
diff --git a/mysql-test/t/key.test b/mysql-test/t/key.test
index 4a3631d3918..8885f69e60c 100644
--- a/mysql-test/t/key.test
+++ b/mysql-test/t/key.test
@@ -150,7 +150,8 @@ create table t1
);
INSERT INTO t1 VALUES (1, 1, 1, 1, 'a');
INSERT INTO t1 VALUES (1, 1, 1, 1, 'b');
-!$1062 INSERT INTO t1 VALUES (1, 1, 1, 1, 'a');
+--error 1062
+INSERT INTO t1 VALUES (1, 1, 1, 1, 'a');
drop table t1;
#
diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test
index c18dfe1e25c..0802c18ed6c 100644
--- a/mysql-test/t/mysqltest.test
+++ b/mysql-test/t/mysqltest.test
@@ -6,17 +6,24 @@
# ============================================================================
# ----------------------------------------------------------------------------
+# $mysql_errno contains the return code of the last command
+# send to the server.
+# ----------------------------------------------------------------------------
+# get $mysql_errno before the first statement
+# $mysql_errno should be -1
+eval select $mysql_errno as "before_use_test" ;
+
+
+# ----------------------------------------------------------------------------
# Positive case(statement)
# ----------------------------------------------------------------------------
select otto from (select 1 as otto) as t1;
# expectation = response
-!$0 select otto from (select 1 as otto) as t1;
--error 0
select otto from (select 1 as otto) as t1;
# expectation <> response
--- // !$1054 select otto from (select 1 as otto) as t1;
-- // --error 1054
-- // select otto from (select 1 as otto) as t1;
@@ -29,12 +36,10 @@ select otto from (select 1 as otto) as t1;
# ----------------------------------------------------------------------------
# expectation <> response
-#!$0 select friedrich from (select 1 as otto) as t1;
#--error 0
#select friedrich from (select 1 as otto) as t1;
# expectation = response
-!$1054 select friedrich from (select 1 as otto) as t1;
--error 1054
select friedrich from (select 1 as otto) as t1;
@@ -76,3 +81,208 @@ select friedrich from (select 1 as otto) as t1;
#--error S00000
#select friedrich from (select 1 as otto) as t1;
+
+# ----------------------------------------------------------------------------
+# test cases for $mysql_errno
+#
+# $mysql_errno is a builtin variable of mysqltest and contains the return code
+# of the last command send to the server.
+#
+# The following test cases often initialize $mysql_errno to 1064 by
+# a command with wrong syntax.
+# Example: --error 1064 To prevent the abort after the error.
+# garbage ;
+# ----------------------------------------------------------------------------
+
+# ----------------------------------------------------------------------------
+# check mysql_errno = 0 after successful statement
+# ----------------------------------------------------------------------------
+select otto from (select 1 as otto) as t1;
+eval select $mysql_errno as "after_successful_stmt_errno" ;
+
+#----------------------------------------------------------------------------
+# check mysql_errno = 1064 after statement with wrong syntax
+# ----------------------------------------------------------------------------
+--error 1064
+garbage ;
+eval select $mysql_errno as "after_wrong_syntax_errno" ;
+
+# ----------------------------------------------------------------------------
+# check if let $my_var= 'abc' ; affects $mysql_errno
+# ----------------------------------------------------------------------------
+--error 1064
+garbage ;
+let $my_var= 'abc' ;
+eval select $mysql_errno as "after_let_var_equal_value" ;
+
+# ----------------------------------------------------------------------------
+# check if set @my_var= 'abc' ; affects $mysql_errno
+# ----------------------------------------------------------------------------
+--error 1064
+garbage ;
+set @my_var= 'abc' ;
+eval select $mysql_errno as "after_set_var_equal_value" ;
+
+# ----------------------------------------------------------------------------
+# check if the setting of --disable-warnings itself affects $mysql_errno
+# (May be --<whatever> modifies $mysql_errno.)
+# ----------------------------------------------------------------------------
+--error 1064
+garbage ;
+--disable_warnings
+eval select $mysql_errno as "after_disable_warnings_command" ;
+
+# ----------------------------------------------------------------------------
+# check if --disable-warnings + command with warning affects the errno
+# stored within $mysql_errno
+# (May be disabled warnings affect $mysql_errno.)
+# ----------------------------------------------------------------------------
+drop table if exists t1 ;
+--error 1064
+garbage ;
+drop table if exists t1 ;
+eval select $mysql_errno as "after_disable_warnings" ;
+--enable_warnings
+
+# ----------------------------------------------------------------------------
+# check if masked errors affect $mysql_errno
+# ----------------------------------------------------------------------------
+--error 1064
+garbage ;
+--error 1146
+select 3 from t1 ;
+eval select $mysql_errno as "after_minus_masked" ;
+--error 1064
+garbage ;
+--error 1146
+select 3 from t1 ;
+eval select $mysql_errno as "after_!_masked" ;
+
+# ----------------------------------------------------------------------------
+# Will manipulations of $mysql_errno be possible and visible ?
+# ----------------------------------------------------------------------------
+--error 1064
+garbage ;
+let $mysql_errno= -1;
+eval select $mysql_errno as "after_let_errno_equal_value" ;
+
+# ----------------------------------------------------------------------------
+# How affect actions on prepared statements $mysql_errno ?
+# ----------------------------------------------------------------------------
+# failing prepare
+--error 1064
+garbage ;
+--error 1146
+prepare stmt from "select 3 from t1" ;
+eval select $mysql_errno as "after_failing_prepare" ;
+create table t1 ( f1 char(10));
+
+# successful prepare
+--error 1064
+garbage ;
+prepare stmt from "select 3 from t1" ;
+eval select $mysql_errno as "after_successful_prepare" ;
+
+# successful execute
+--error 1064
+garbage ;
+execute stmt;
+eval select $mysql_errno as "after_successful_execute" ;
+
+# failing execute (table dropped)
+drop table t1;
+--error 1064
+garbage ;
+--error 1146
+execute stmt;
+eval select $mysql_errno as "after_failing_execute" ;
+
+# failing execute (unknown statement)
+--error 1064
+garbage ;
+--error 1243
+execute __stmt_;
+eval select $mysql_errno as "after_failing_execute" ;
+
+# successful deallocate
+--error 1064
+garbage ;
+deallocate prepare stmt;
+eval select $mysql_errno as "after_successful_deallocate" ;
+
+# failing deallocate ( statement handle does not exist )
+--error 1064
+garbage ;
+--error 1243
+deallocate prepare __stmt_;
+eval select $mysql_errno as "after_failing_deallocate" ;
+
+
+# ----------------------------------------------------------------------------
+# test cases for "--disable_abort_on_error"
+#
+# "--disable_abort_on_error" switches the abort of mysqltest
+# after "unmasked" failing statements off.
+#
+# The default is "--enable_abort_on_error".
+#
+# "Maskings" are
+# --error <error number> and --error <error number>
+# in the line before the failing statement.
+#
+# There are some additional test case for $mysql_errno
+# because "--disable_abort_on_error" enables a new situation.
+# Example: "unmasked" statement fails + analysis of $mysql_errno
+# ----------------------------------------------------------------------------
+
+# ----------------------------------------------------------------------------
+# Switch the abort on error off and check the effect on $mysql_errno
+# ----------------------------------------------------------------------------
+--error 1064
+garbage ;
+--disable_abort_on_error
+eval select $mysql_errno as "after_--disable_abort_on_error" ;
+
+# ----------------------------------------------------------------------------
+# "unmasked" failing statement should not cause an abort
+# ----------------------------------------------------------------------------
+select 3 from t1 ;
+
+# ----------------------------------------------------------------------------
+# masked failing statements
+# ----------------------------------------------------------------------------
+# expected error = response
+--error 1146
+select 3 from t1 ;
+--error 1146
+select 3 from t1 ;
+eval select $mysql_errno as "after_!errno_masked_error" ;
+# expected error <> response
+# --error 1000
+# select 3 from t1 ;
+# --error 1000
+# select 3 from t1 ;
+
+# ----------------------------------------------------------------------------
+# Switch the abort on error on and check the effect on $mysql_errno
+# ----------------------------------------------------------------------------
+--error 1064
+garbage ;
+--enable_abort_on_error
+eval select $mysql_errno as "after_--enable_abort_on_error" ;
+
+# ----------------------------------------------------------------------------
+# masked failing statements
+# ----------------------------------------------------------------------------
+# expected error = response
+--error 1146
+select 3 from t1 ;
+
+# ----------------------------------------------------------------------------
+# check that the old default behaviour is not changed
+# Please remove the '#' to get the abort on error
+# ----------------------------------------------------------------------------
+#--error 1064
+#select 3 from t1 ;
+#
+#select 3 from t1 ;
diff --git a/mysql-test/t/ndb_basic.test b/mysql-test/t/ndb_basic.test
index e79815bbeb1..b62d2a8e0e1 100644
--- a/mysql-test/t/ndb_basic.test
+++ b/mysql-test/t/ndb_basic.test
@@ -36,6 +36,8 @@ UPDATE t1 SET pk1=2 WHERE attr1=1;
SELECT * FROM t1 ORDER BY pk1;
UPDATE t1 SET pk1=pk1 + 1;
SELECT * FROM t1 ORDER BY pk1;
+UPDATE t1 SET pk1=4 WHERE pk1 = 3;
+SELECT * FROM t1 ORDER BY pk1;
# Delete the record
DELETE FROM t1;
@@ -371,3 +373,154 @@ select * from t1 order by b;
select * from t1 where b IS NULL;
select * from t1 where b IS NOT NULL;
drop table t1;
+
+#
+# test the limit of no of attributes in one table
+#
+
+create table t1 (
+c1 int,
+c2 int,
+c3 int,
+c4 int,
+c5 int,
+c6 int,
+c7 int,
+c8 int,
+c9 int,
+c10 int,
+c11 int,
+c12 int,
+c13 int,
+c14 int,
+c15 int,
+c16 int,
+c17 int,
+c18 int,
+c19 int,
+c20 int,
+c21 int,
+c22 int,
+c23 int,
+c24 int,
+c25 int,
+c26 int,
+c27 int,
+c28 int,
+c29 int,
+c30 int,
+c31 int,
+c32 int,
+c33 int,
+c34 int,
+c35 int,
+c36 int,
+c37 int,
+c38 int,
+c39 int,
+c40 int,
+c41 int,
+c42 int,
+c43 int,
+c44 int,
+c45 int,
+c46 int,
+c47 int,
+c48 int,
+c49 int,
+c50 int,
+c51 int,
+c52 int,
+c53 int,
+c54 int,
+c55 int,
+c56 int,
+c57 int,
+c58 int,
+c59 int,
+c60 int,
+c61 int,
+c62 int,
+c63 int,
+c64 int,
+c65 int,
+c66 int,
+c67 int,
+c68 int,
+c69 int,
+c70 int,
+c71 int,
+c72 int,
+c73 int,
+c74 int,
+c75 int,
+c76 int,
+c77 int,
+c78 int,
+c79 int,
+c80 int,
+c81 int,
+c82 int,
+c83 int,
+c84 int,
+c85 int,
+c86 int,
+c87 int,
+c88 int,
+c89 int,
+c90 int,
+c91 int,
+c92 int,
+c93 int,
+c94 int,
+c95 int,
+c96 int,
+c97 int,
+c98 int,
+c99 int,
+c100 int,
+c101 int,
+c102 int,
+c103 int,
+c104 int,
+c105 int,
+c106 int,
+c107 int,
+c108 int,
+c109 int,
+c110 int,
+c111 int,
+c112 int,
+c113 int,
+c114 int,
+c115 int,
+c116 int,
+c117 int,
+c118 int,
+c119 int,
+c120 int,
+c121 int,
+c122 int,
+c123 int,
+c124 int,
+c125 int,
+c126 int,
+c127 int,
+c128 int,
+primary key(c1)) engine=ndb;
+drop table t1;
+
+#
+# test max size of attribute name and truncation
+#
+
+create table t1 (
+a1234567890123456789012345678901234567890 int primary key,
+a12345678901234567890123456789a1234567890 int,
+index(a12345678901234567890123456789a1234567890)
+) engine=ndb;
+show tables;
+insert into t1 values (1,1),(2,1),(3,1),(4,1),(5,2),(6,1),(7,1);
+explain select * from t1 where a12345678901234567890123456789a1234567890=2;
+select * from t1 where a12345678901234567890123456789a1234567890=2;
+drop table t1;
diff --git a/mysql-test/t/ndb_blob.test b/mysql-test/t/ndb_blob.test
index 5454dd91d26..06ecbc66d97 100644
--- a/mysql-test/t/ndb_blob.test
+++ b/mysql-test/t/ndb_blob.test
@@ -2,7 +2,7 @@
--disable_warnings
drop table if exists t1;
-drop database if exists mysqltest;
+drop database if exists test2;
--enable_warnings
#
@@ -12,31 +12,7 @@ drop database if exists mysqltest;
# A prerequisite for this handler test is that "testBlobs" succeeds.
#
-# -- bug-5252 tinytext crashes --
-
-create table t1 (
- a int not null primary key,
- b tinytext
-) engine=ndbcluster;
-
-insert into t1 values(1, 'x');
-update t1 set b = 'y';
-select * from t1;
-delete from t1;
-drop table t1;
-
-# -- bug-5013 insert empty string to text --
-
-create table t1 (
- a int not null primary key,
- b text not null
-) engine=ndbcluster;
-
-insert into t1 values(1, '');
-select * from t1;
-drop table t1;
-
--- general test starts --
+# -- general test starts --
# make test harder with autocommit off
set autocommit=0;
@@ -117,7 +93,6 @@ from t1 where a=2;
# pk update to null
update t1 set d=null where a=1;
commit;
-# FIXME now fails at random due to weird mixup between the 2 rows
select a from t1 where d is null;
# pk delete
@@ -126,6 +101,49 @@ delete from t1 where a=2;
commit;
select count(*) from t1;
+# -- replace ( bug-6018 ) --
+
+# insert
+replace t1 set a=1,b=@b1,c=111,d=@d1;
+replace t1 set a=2,b=@b2,c=222,d=@d2;
+commit;
+explain select * from t1 where a = 1;
+
+# pk read
+select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
+from t1 where a=1;
+select a,length(b),substr(b,1+2*9000,2),length(d),substr(d,1+3*9000,3)
+from t1 where a=2;
+
+# update
+replace t1 set a=1,b=@b2,c=111,d=@d2;
+replace t1 set a=2,b=@b1,c=222,d=@d1;
+commit;
+select a,length(b),substr(b,1+2*9000,2),length(d),substr(d,1+3*9000,3)
+from t1 where a=1;
+select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
+from t1 where a=2;
+
+# update
+replace t1 set a=1,b=concat(@b2,@b2),c=111,d=concat(@d2,@d2);
+replace t1 set a=2,b=concat(@b1,@b1),c=222,d=concat(@d1,@d1);
+commit;
+select a,length(b),substr(b,1+4*9000,2),length(d),substr(d,1+6*9000,3)
+from t1 where a=1;
+select a,length(b),substr(b,1+4*900,2),length(d),substr(d,1+6*900,3)
+from t1 where a=2;
+
+# update to null
+replace t1 set a=1,b='xyz',c=111,d=null;
+commit;
+select a,b from t1 where d is null;
+
+# pk delete
+delete from t1 where a=1;
+delete from t1 where a=2;
+commit;
+select count(*) from t1;
+
# -- hash index ops --
insert into t1 values(1,@b1,111,@d1);
@@ -231,39 +249,6 @@ where c >= 100;
commit;
select * from t1 where c >= 100 order by a;
-# alter table
-
-select * from t1 order by a;
-alter table t1 add x int;
-select * from t1 order by a;
-alter table t1 drop x;
-select * from t1 order by a;
-
-# multi db
-
-create database mysqltest;
-use mysqltest;
-
-CREATE TABLE t2 (
- a bigint unsigned NOT NULL PRIMARY KEY,
- b int unsigned not null,
- c int unsigned
-) engine=ndbcluster;
-
-insert into t2 values (1,1,1),(2,2,2);
-select * from test.t1,t2 where test.t1.a = t2.a order by test.t1.a;
-
-drop table t2;
-use test;
-
-# alter table
-
-select * from t1 order by a;
-alter table t1 add x int;
-select * from t1 order by a;
-alter table t1 drop x;
-select * from t1 order by a;
-
# range scan delete
delete from t1 where c >= 100;
commit;
@@ -306,10 +291,82 @@ select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
from t1 order by a;
rollback;
select count(*) from t1;
+
+# -- alter table and multi db --
+
+insert into t1 values(1,'b1',111,'dd1');
+insert into t1 values(2,'b2',222,'dd2');
+insert into t1 values(3,'b3',333,'dd3');
+insert into t1 values(4,'b4',444,'dd4');
+insert into t1 values(5,'b5',555,'dd5');
+insert into t1 values(6,'b6',666,'dd6');
+insert into t1 values(7,'b7',777,'dd7');
+insert into t1 values(8,'b8',888,'dd8');
+insert into t1 values(9,'b9',999,'dd9');
+commit;
+
+select * from t1 order by a;
+alter table t1 add x int;
+select * from t1 order by a;
+alter table t1 drop x;
+select * from t1 order by a;
+
+create database test2;
+use test2;
+
+CREATE TABLE t2 (
+ a bigint unsigned NOT NULL PRIMARY KEY,
+ b int unsigned not null,
+ c int unsigned
+) engine=ndbcluster;
+
+insert into t2 values (1,1,1),(2,2,2);
+select * from test.t1,t2 where test.t1.a = t2.a order by test.t1.a;
+
+drop table t2;
+use test;
+
+select * from t1 order by a;
+alter table t1 add x int;
+select * from t1 order by a;
+alter table t1 drop x;
+select * from t1 order by a;
+
+# -- end general test --
+
drop table t1;
-drop database mysqltest;
+drop database test2;
-# bug #5349
+# -- bug-5252 tinytext crashes plus no-commit result --
+
+set autocommit=0;
+create table t1 (
+ a int not null primary key,
+ b tinytext
+) engine=ndbcluster;
+
+insert into t1 values(1, 'x');
+update t1 set b = 'y';
+select * from t1;
+delete from t1;
+select * from t1;
+commit;
+drop table t1;
+
+# -- bug-5013 insert empty string to text --
+
+set autocommit=0;
+create table t1 (
+ a int not null primary key,
+ b text not null
+) engine=ndbcluster;
+
+insert into t1 values(1, '');
+select * from t1;
+commit;
+drop table t1;
+
+# -- bug #5349 --
set autocommit=1;
use test;
CREATE TABLE t1 (
@@ -327,7 +384,8 @@ select * from t1 order by a;
alter table t1 engine=ndb;
select * from t1 order by a;
-# bug #5872
+# -- bug #5872 --
+set autocommit=1;
alter table t1 engine=myisam;
select * from t1 order by a;
drop table t1;
diff --git a/mysql-test/t/ndb_insert.test b/mysql-test/t/ndb_insert.test
index 310c16de3d8..c3da4641014 100644
--- a/mysql-test/t/ndb_insert.test
+++ b/mysql-test/t/ndb_insert.test
@@ -583,3 +583,18 @@ INSERT INTO t1 VALUES(1,1,1) ON DUPLICATE KEY UPDATE b=79;
select * from t1 where pk1=1;
DROP TABLE t1;
+
+#
+# Bug #6331: problem with 'insert ignore'
+#
+
+CREATE TABLE t1(a INT) ENGINE=ndb;
+INSERT IGNORE INTO t1 VALUES (1);
+INSERT IGNORE INTO t1 VALUES (1);
+INSERT IGNORE INTO t1 SELECT a FROM t1;
+INSERT IGNORE INTO t1 SELECT a FROM t1;
+INSERT IGNORE INTO t1 SELECT a FROM t1;
+INSERT IGNORE INTO t1 VALUES (1);
+INSERT IGNORE INTO t1 VALUES (1);
+SELECT * FROM t1;
+DROP TABLE t1;
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index 8bd535a08ec..1d23a09a71e 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -110,10 +110,6 @@ set @fvar= 123.4567;
--error 1064
prepare stmt1 from @fvar;
-set @str1 = 'select ?';
-set @str2 = convert(@str1 using ucs2);
-prepare stmt1 from @str2;
-execute stmt1 using @ivar;
drop table t1,t2;
#
diff --git a/mysql-test/t/ps_10nestset.test b/mysql-test/t/ps_10nestset.test
index d2adaca689e..53e84f7a47d 100644
--- a/mysql-test/t/ps_10nestset.test
+++ b/mysql-test/t/ps_10nestset.test
@@ -61,12 +61,11 @@ while ($1)
select * from t1;
-# Waiting for the resolution of bug#6138
-# # Now, increase salary to a multiple of 50
-# prepare st_round from 'update t1 set salary = salary + ? - ( salary MOD ? )';
-# set @arg_round= 50;
-# execute st_round using @arg_round, @arg_round;
-#
-# select * from t1;
+# Now, increase salary to a multiple of 50 (checks for bug#6138)
+prepare st_round from 'update t1 set salary = salary + ? - ( salary MOD ? )';
+set @arg_round= 50;
+execute st_round using @arg_round, @arg_round;
+
+select * from t1;
drop table t1;
diff --git a/mysql-test/t/ps_7ndb.test b/mysql-test/t/ps_7ndb.test
index af669a26400..22370a7f3ac 100644
--- a/mysql-test/t/ps_7ndb.test
+++ b/mysql-test/t/ps_7ndb.test
@@ -339,8 +339,8 @@ select a,b from t1 where a >= 1000 order by a ;
delete from t1 where a >= 1000 ;
## replace
---error 1295
prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
+--error 1031
## multi table statements
--disable_query_log
diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test
index d8794b2f394..0b96f71d585 100644
--- a/mysql-test/t/range.test
+++ b/mysql-test/t/range.test
@@ -418,3 +418,18 @@ select count(*) from t2 where x > -16;
select count(*) from t2 where x = 18446744073709551601;
drop table t1,t2;
+#
+# Bug #6045: Binary Comparison regression in MySQL 4.1
+# Binary searches didn't use a case insensitive index.
+#
+set names latin1;
+create table t1 (a char(10), b text, key (a)) character set latin1;
+INSERT INTO t1 (a) VALUES
+('111'),('222'),('222'),('222'),('222'),('444'),('aaa'),('AAA'),('bbb');
+# all these three can be optimized
+explain select * from t1 where a='aaa';
+explain select * from t1 where a=binary 'aaa';
+explain select * from t1 where a='aaa' collate latin1_bin;
+# this one cannot:
+explain select * from t1 where a='aaa' collate latin1_german1_ci;
+drop table t1;
diff --git a/mysql-test/t/rpl_failed_optimize-master.opt b/mysql-test/t/rpl_failed_optimize-master.opt
new file mode 100644
index 00000000000..3f82baff598
--- /dev/null
+++ b/mysql-test/t/rpl_failed_optimize-master.opt
@@ -0,0 +1 @@
+--loose-innodb-lock-wait-timeout=1
diff --git a/mysql-test/t/rpl_failed_optimize.test b/mysql-test/t/rpl_failed_optimize.test
new file mode 100644
index 00000000000..d245d1bacbb
--- /dev/null
+++ b/mysql-test/t/rpl_failed_optimize.test
@@ -0,0 +1,18 @@
+source include/have_innodb.inc;
+source include/master-slave.inc;
+
+#
+# BUG#5551 "Failed OPTIMIZE TABLE is logged to binary log"
+# Replication should work when OPTIMIZE TABLE timeouts, and
+# when OPTIMIZE TABLE is executed on a non-existing table
+#
+
+CREATE TABLE t1 ( a int ) ENGINE=InnoDB;
+BEGIN;
+INSERT INTO t1 VALUES (1);
+
+connection master1;
+OPTIMIZE TABLE t1;
+
+OPTIMIZE TABLE non_existing;
+sync_slave_with_master;
diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
index 9e18f1cd88c..b09d7240721 100644
--- a/mysql-test/t/show_check.test
+++ b/mysql-test/t/show_check.test
@@ -21,7 +21,8 @@ check table t1 changed;
check table t1 medium;
check table t1 extended;
show index from t1;
-!$1062 insert into t1 values (5,5,5);
+--error 1062
+insert into t1 values (5,5,5);
optimize table t1;
optimize table t1;
drop table t1;
diff --git a/mysql-test/t/sql_mode.test b/mysql-test/t/sql_mode.test
index 26a5d07d951..fa5c6cb8a5b 100644
--- a/mysql-test/t/sql_mode.test
+++ b/mysql-test/t/sql_mode.test
@@ -30,6 +30,37 @@ show create table t1;
drop table t1;
#
+# Check that a binary collation adds 'binary'
+# suffix into a char() column definition in
+# mysql40 and mysql2323 modes. This allows
+# not to lose the column's case sensitivity
+# when loading the dump in pre-4.1 servers.
+#
+# Thus, in 4.0 and 3.23 modes we dump:
+#
+# 'char(10) collate xxx_bin' as 'char(10) binary'
+# 'binary(10)' as 'binary(10)'
+#
+# In mysql-4.1 these types are different, and they will
+# be recreated differently.
+#
+# In mysqld-4.0 the the above two types were the same,
+# so it will create a 'char(10) binary' column for both definitions.
+#
+CREATE TABLE t1 (
+ a char(10),
+ b char(10) collate latin1_bin,
+ c binary(10)
+) character set latin1;
+set @@sql_mode="";
+show create table t1;
+set @@sql_mode="mysql323";
+show create table t1;
+set @@sql_mode="mysql40";
+show create table t1;
+drop table t1;
+
+#
# BUG#5318 - failure: 'IGNORE_SPACE' affects numeric values after DEFAULT
#
# Force the usage of the default
diff --git a/mysql-test/t/temp_table.test b/mysql-test/t/temp_table.test
index 2181d3eb74c..74276c7668c 100644
--- a/mysql-test/t/temp_table.test
+++ b/mysql-test/t/temp_table.test
@@ -20,8 +20,10 @@ create TEMPORARY TABLE t2 engine=heap select * from t1;
create TEMPORARY TABLE IF NOT EXISTS t2 (a int) engine=heap;
# This should give errors
-!$1050 CREATE TEMPORARY TABLE t1 (a int not null, b char (10) not null);
-!$1050 ALTER TABLE t1 RENAME t2;
+--error 1050
+CREATE TEMPORARY TABLE t1 (a int not null, b char (10) not null);
+--error 1050
+ALTER TABLE t1 RENAME t2;
select * from t2;
alter table t2 add primary key (a,b);
diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test
index 216d5bbd286..26ac272c6d4 100644
--- a/mysql-test/t/type_float.test
+++ b/mysql-test/t/type_float.test
@@ -6,7 +6,9 @@
drop table if exists t1;
--enable_warnings
+--replace_result e-0 e- e+0 e+
SELECT 10,10.0,10.,.1e+2,100.0e-1;
+--replace_result e-00 e-0
SELECT 6e-05, -6e-05, --6e-05, -6e-05+1.000000;
SELECT 1e1,1.e1,1.0e1,1e+1,1.e+1,1.0e+1,1e-1,1.e-1,1.0e-1;
@@ -14,6 +16,7 @@ create table t1 (f1 float(24),f2 float(52));
show full columns from t1;
insert into t1 values(10,10),(1e+5,1e+5),(1234567890,1234567890),(1e+10,1e+10),(1e+15,1e+15),(1e+20,1e+20),(1e+50,1e+50),(1e+150,1e+150);
insert into t1 values(-10,-10),(1e-5,1e-5),(1e-10,1e-10),(1e-15,1e-15),(1e-20,1e-20),(1e-50,1e-50),(1e-150,1e-150);
+--replace_result e-0 e- e+0 e+
select * from t1;
drop table t1;
diff --git a/mysql-test/t/type_ranges.test b/mysql-test/t/type_ranges.test
index 09b5867e7a8..572dc0af313 100644
--- a/mysql-test/t/type_ranges.test
+++ b/mysql-test/t/type_ranges.test
@@ -135,7 +135,8 @@ drop table t1,t2;
create table t1 (c int);
insert into t1 values(1),(2);
create table t2 select * from t1;
-!$1060 create table t3 select * from t1, t2; # Should give an error
+--error 1060
+create table t3 select * from t1, t2; # Should give an error
create table t3 select t1.c AS c1, t2.c AS c2,1 as "const" from t1, t2;
show full columns from t3;
drop table t1,t2,t3;
diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test
index 48ca9e0ba32..7d4c706d1fd 100644
--- a/mysql-test/t/user_var.test
+++ b/mysql-test/t/user_var.test
@@ -121,3 +121,9 @@ show binlog events from 95;
drop table t1, t2;
+#
+# Bug #6321 strange error:
+# string function FIELD(<uservariable content NULL>, ...)
+#
+set @var= NULL ;
+select FIELD( @var,'1it','Hit') as my_column;
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test
index 67a05768595..6563f7117cd 100644
--- a/mysql-test/t/variables.test
+++ b/mysql-test/t/variables.test
@@ -20,6 +20,7 @@ select @test, @`test`, @TEST, @`TEST`, @"teSt";
set @select=2,@t5=1.23456;
select @`select`,@not_used;
set @test_int=10,@test_double=1e-10,@test_string="abcdeghi",@test_string2="abcdefghij",@select=NULL;
+--replace_result e-0 e- e+0 e+
select @test_int,@test_double,@test_string,@test_string2,@select;
set @test_int="hello",@test_double="hello",@test_string="hello",@test_string2="hello";
select @test_int,@test_double,@test_string,@test_string2;
diff --git a/ndb/home/bin/cvschk b/ndb/home/bin/cvschk
deleted file mode 100755
index 4510cc30888..00000000000
--- a/ndb/home/bin/cvschk
+++ /dev/null
@@ -1,569 +0,0 @@
-#!/usr/bin/perl -w
-#
-# cvschk -- fast offline check for new files and modifications of files
-
-# cvschk : A perl program which checks the status of the CVS controlled
-# files and gives an ASCII table sorted after the status of files.
-#
-# If you have used CVS, then you know that it is hard to
-# get a good overview the CVS-status of the files in you
-# directories. Any new files? Any files changes?
-# cvschk will help the programmer get the overview in the
-# situation, where we do not have access to the CVS repository.
-#
-# Note that the program does only local checks of the files
-# If you have fast access to the CVS repositiory, then consider
-# the cvsstat-program - which additionally can tell if other
-# people have made newer versions of the files.
-#
-# The program requires Perl 5.004 (maybe previous versions also work).
-#
-# It is tuned to parse the output of cvs(1) version 1.9.
-# Earlier and later versions may require modifications to the script.
-#
-# ** Note that the first line might be wrong depending **
-# ** on the location of your perl program. **
-#
-# Sample output:
-# The directory ./mytempdir is not under CVS control
-#
-# Changed files
-# ---------------
-# ./cvs2html
-# ./cvschk
-# ./cvsstat
-#
-# New files
-# ---------------
-# ./.#cvschk
-# ./XX
-# ./cvs2html.ok
-#
-# Deleted files
-# ---------------
-# (none)
-
-# Changelog:
-#
-# Ver Date Author Changelog
-# --- ---------- -------------------- -------------------------------------
-# 1.12 2002-01-04 Michael Kohne Fixed a $foo=<> warning for
-# 5.004_01 with defined($foo=<>)
-# Added a --tabular|-t switch
-#
-# 1.11 2001-12-27 Michael Kohne Added cvsignore functionality
-# Handling of 'dummy timestamp'
-# Handling of 'Result of Merge'
-#
-# 1.10 2001-11-06 Michael Kohne Added -r and -l options
-#
-# 1.9 2001-08-03 Lars G. T. Jørgensen Hack to allow special entry-line
-#
-# 1.8 2001-06-07 Peter Toft Back to the same as 1.6
-# CVS is my friend
-#
-# 1.7 2001-06-04 Peter Toft Peter was very tired and
-# applied a wrong patch -
-# version 1.7 is crap
-#
-# 1.6 2000-12-17 Peter Toft Better description added
-#
-# 1.5 2000-11-04 Peter Toft URL of cvsstat changed
-#
-# 1.4 2000-09-20 Peter Toft Must show deleted files also
-# as the default
-#
-# 1.3 2000-08-08 Ole Tange and Initial version
-# Peter Toft
-# ---- ---------- -------------------- -------------------------------------
-#
-# -----------------------------------------------------------------------------
-#
-# This program is protected by the GPL, and all modifications of
-# general interest should be emailed to the maintainer (pto@sslug.dk).
-#
-# This program also uses code parts from cvsstat
-# (same homepage as cvschk)
-#
-# Copyright 2000,2001 by Peter Toft <pto@sslug.dk> and Ole Tange <ole@tange.dk>
-# as well as
-# Lars G. T. Jørgensen <larsj@diku.dk>
-#
-# The URL of the home page of cvschk is shown below.
-
-
-use Time::Local;
-use strict;
-use Getopt::Long;
-
-my $startdir = ".";
-
-my $debug = 0;
-my (%files,%filesok,%seen,%skip);
-
-
-# Michael Kohne 12/16/01
-#
-# Simulation of .cvsignore as CVS does it...
-#
-# using .cvsignore handling makes cvschk take from 2 to 3 times
-# longer to run over the same set of files.
-# in my tests, disabling cvsignore altogether, cvschk takes .2
-# seconds on my working directory. Adding cvsignore,takes
-# .4 seconds.
-# Note that I do not use individual .cvsignore files - if there
-# are a lot of them in your directory tree, it will add run time
-#
-# variables used for .cvsignore handling
-my $initcvsignoreregex;# regex holding all startup cvsignore pattersn (no ())
-my $cvsignoreregex;# one regex holding all current cvsignore patterns
-my $disable_cvsignore=0;# set to 1 to disable cvsignore emulation
- # (available in case it's REALLY screwed up)
-my $disable_ind_cvsignore=0;# set to 1 to disable finding .cvsignore files
- # in each directory.
-my $debug_cvsignore = 0; # For debugging .cvsignore problems
-
-my %mon;
-@mon{qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)}=
- 0..11; # Perl months are 0 .. 11
-
-my ($version) = ('$Revision: 1.12 $ ' =~ /^\$\w+: (.*) \$ $/);
-my $URL = "http://cvs.sslug.dk/cvs2html";
-my $version_line = "cvschk version $version (see $URL)\n";
-
-my $opt_all;
-my $restrict;
-my $local;
-my $tabular;
-
-my $opt_restrict;
-
-sub show_version {print $version_line}
-
-sub die_version {die $version_line}
-
-sub die_usage {
- my $bundled = ($] > 5.00399
- ? "can be bundled"
- : "can't be bundled, because your Perl is too old");
- die <<END_OF_USAGE; # Help in the style of GNU `ls --help' or `make --help'
-Usage: $0 [OPTION]...
- Show the CVS status of FILEs (the current directory by default),
- traversing directories recursively and telling if new files exist
- in the repository.
-Options:
- -a, --all Show all statistics, including the names of files that
- are up to date, used tags, ignored patterns and more
- -r, --restrict Don't show the names of the unknown files
- (useful if you have many temporary files)
- -t, --tabular Show one file per line, each preceeded with a status word,
- Sorted by filename.
- -l, --local Don't descend into sub-directories
- -d, --debug Debug info
- -h, --help Show this help end exit immediately
- -V, --version Show the version line and exit immediately
-The one-letter options $bundled.
-END_OF_USAGE
-}
-
-sub die_help {show_version; die_usage}
-
-# Let `-ar' mean `-a -r' and require `--all' (or -a) instead of `-all'.
-if ($] > 5.00399) { # This requires 5.004, so silently skip it for older Perls.
- eval {Getopt::Long::config("bundling")}; # avoid 5.003 compilation error
- warn $@ if $@; # For Perl 5.004+ we do want to see any compilation error
-}
-
-
-GetOptions( "all|a" => \$opt_all,
- "tabular|t" => \$tabular,
- "restrict|r" => \$restrict,
- "local|l" => \$local,
- "help|h" => \&die_help,
- "debug|d" => \$debug,
- "version|V" => \&die_version,
- ) or die_usage;
-
-sub cvs_changed_in_dir($); #define prototype (for recursion)
-
-# functions for .cvsignore handling
-
-# converts a given filename pattern
-# (of the sort that sh(1) takes) to
-# a perl regex of similar meaning.
-#
-# It works by doing the following:
-#
-# change:
-# . to \.
-# $ to \$
-# * to .*
-# ? to .
-#
-sub fpat_to_regex($)
-{
- my $fexp;
- $fexp = shift;
- $fexp =~ s/\./\\\./g;#change . to \.
- $fexp =~ s/\$/\\\$/g;#change dollar sign to \dollar sign
- $fexp =~ s/\*/.*/g;# change * to .*
- $fexp =~ s/\?/./g; # change ? to .
- return $fexp;
-}
-
-# copy the input list to one single regex,
-# items seperated by | symbols.
-# return the regex string
-sub do_regex_convert
-{
- my $rx = "";
- my $first = 1;#true for first element only
-
-
- # convert each element of cvsignore into a regex
- # this makes the patterns usable in perl
- my $cp;
- foreach $cp (@_) {
- if (not $first) { $rx = $rx . "|"; }
- if ($first) { $first = 0; }
- $rx = $rx . fpat_to_regex($cp);
- }
-
- return $rx;
-}
-
-# first parameter is a reference to the array
-# to be loaded
-# the rest of the parameters are just items
-# that need to be loaded into the array.
-# Note that if a ! is found, the list is
-# emptied, then further items are added.
-# returns true if a ! was found
-sub load_list_from_list
-{
- my $arref = shift;# get reference to array from front
- my $item;
- my $ret=0;#false means no ! found
-
- chomp @_;#kill newlines
- foreach $item (@_) {
- $item =~ s/^\s*(.*?)\s*$/$1/;#kill leading/trailing whitespace
- if ($item) { # empty string is false
- push @$arref,$item;
- }
- if ($item eq "!") {
- @$arref = ();# '!' causes list to clear
- $ret = 1;# ! found
- }
- }
-
- return $ret;
-}
-
-# loads the given list with lines from the
-# specified file. Note that if a '!' is found
-# all prior patterns are removed from the list
-# before the following patterns are loaded
-# first param is the filename,
-# second param is a reference to an array
-# that the data is to go into
-# returns true if a ! was found
-sub load_list_from_file
-{
- my @inlist;
- my $fname = shift;#filename to read from
- #if (not -e $fname) { return; }
- my $arref = shift;#array to store into
- open CVSIGNORE,"$fname" or return;#file might not exist, that's OK
- @inlist = <CVSIGNORE>;
- close CVSIGNORE;
- return load_list_from_list($arref,@inlist);
-}
-
-# loads $cvsignoreregex from
-# $initcvsignoreregex and the .cvsignore file
-# in the local directory
-sub load_cvsignore
-{
- if ($disable_ind_cvsignore) {return;}#don't look for local .cvsignore files
- if ($disable_cvsignore) {return;}#don't do anything
-
- my $dir = shift;
- my @cvsignore;
-
- # bang will be true if a ! was found. In such cases, I need
- # to not use the pre-exisitng regex list.
- my $bang = load_list_from_file("$dir/.cvsignore",\@cvsignore);
-
- # if we get a local cvsignore list, then...
- my $rx = do_regex_convert(@cvsignore);
- if ($rx) {
- $cvsignoreregex = "(";
- if (not $bang) {$cvsignoreregex = $cvsignoreregex . $initcvsignoreregex . "|";}
- $cvsignoreregex = $cvsignoreregex . $rx . ")";
- } else {
- if ($bang) {$cvsignoreregex = "";}
- else {$cvsignoreregex = "(" . $initcvsignoreregex . ")";}
- }
-
- if ($debug_cvsignore) {print $dir,":",$cvsignoreregex, "\n";}
-}
-
-
-# loads all of the cvsignore patterns that
-# can be loaded at script startup
-sub load_initial_cvsignore()
-{
- #load the default patterns
- # (taken from http://www.gnu.org/manual/cvs-1.9/html_node/cvs_141.html#IDX399)
- #
- # this gives you the patterns that cvs normally starts with
- my @initcvsignore;
- push @initcvsignore,("RCS");
- push @initcvsignore,("SCCS");
- push @initcvsignore,("CVS");
- push @initcvsignore,("CVS.adm");
- push @initcvsignore,("RCSLOG");
- push @initcvsignore,("cvslog.*");
- push @initcvsignore,("tags");
- push @initcvsignore,("TAGS");
- push @initcvsignore,(".make.state");
- push @initcvsignore,(".nse_depinfo");
- push @initcvsignore,("*~");
- push @initcvsignore,("\#*");
- push @initcvsignore,(".\#*");
- push @initcvsignore,("\,*");
- push @initcvsignore,("_\$\*");
- push @initcvsignore,("*\$");
- push @initcvsignore,("*.old");
- push @initcvsignore,("*.bak");
- push @initcvsignore,("*.BAK");
- push @initcvsignore,("*.orig");
- push @initcvsignore,("*.rej");
- push @initcvsignore,(".del-*");
- push @initcvsignore,("*.a");
- push @initcvsignore,("*.olb");
- push @initcvsignore,("*.o");
- push @initcvsignore,("*.obj");
- push @initcvsignore,("*.so");
- push @initcvsignore,("*.exe");
- push @initcvsignore,("*.Z");
- push @initcvsignore,("*.elc");
- push @initcvsignore,("*.ln");
- push @initcvsignore,("core");
-
-
- # now, load (in proper order!)
- # each of the possible cvsignore files
-
- # there are 4 possible .cvsignore files:
-
- # $CVSROOT/CVSROOT/cvsignore
- # ~/.cvsignore
- # $CVSIGNORE environment variable
- # .cvsignore in current directory
-
- # The first (CVSROOT/cvsignore) would require calling cvs, so
- # we won't do that one.
- # The last (.cvsignore in current directory) is done
- # for each directory. It's handled in the load_cvsignore routine.
-
- # ~/.cvsignore
- my @inlist;
- my $item;
- my $HOME=$ENV{"HOME"};
- if (not $HOME) {$HOME = ".";}
- load_list_from_file("$HOME/.cvsignore",\@initcvsignore);
-
- # $CVSIGNORE environment variable
- my $igstr = $ENV{"CVSIGNORE"}; # get env var
- if ($igstr) {
- my @iglist = split(/\s+/, $igstr); #if it exists, convert to list
- load_list_from_list(\@initcvsignore,@iglist);
- }
-
- # now that @initcvsignore is setup,
- # turn it into a regex string
- $initcvsignoreregex = do_regex_convert(@initcvsignore);
-
- # now preset the cvsignore regex string to match
- # @initcvsignore. That way, if we aren't using local
- # cvsignore files, we do nothing.
- $cvsignoreregex = "(" . $initcvsignoreregex . ")";
-}
-# routine to see if the given name is in the cvsignore regex
-# returns true if it is, false if it's not
-sub ignore_file($)
-{
- #allow user to disable the cvsignore stuff
- if ($disable_cvsignore) {return 0;}
- if (not $cvsignoreregex) {return 0;}# if regex is empty, nothing matches the regex
- my $filename = shift;
-
- if ($debug_cvsignore) {print "ignore_file:",$filename,"\n";}
-
- if ($filename =~ $cvsignoreregex) {
- if ($debug_cvsignore) {print $filename," matches\n";}
- return 1;
- }
-
- if ($debug_cvsignore) {print $filename," doesn't match\n";}
- return 0;
-}
-
-sub cvs_changed_in_dir($) {
- my $dir = shift;
-
- my ($line,$filename,$version,$mtime,$date,
- $dir_filename,$cvstime,@subdirs,
- @new_in_dir,$i);
-
- # Examine status of files in CVS/Entries
- if(not open(ENTRIES,"$dir/CVS/Entries")) {
- if ($tabular) {
- push @{$files{Unknown}}, $dir;
- }
- else {
- warn "The directory $dir is not under CVS control\n";
- }
- } else {
- load_cvsignore($dir);#load up proper cvsignore for given directory
-
- while(defined ($line=<ENTRIES>)) {
- # Parse CVS/Entries-line
- $line=~m!^/(.*)/(.*)/(.*)/.*/! or do {
- $debug and warn("Skipping entry-line $line");
- next;
- };
- ($filename,$version,$date) = ($1,$2,$3);
- $dir_filename=$dir."/".$filename;
-
- # Mark this file as seen
- $seen{$dir_filename}=1;
-
- # if not exists: Deleted
- if(not -e $dir_filename) {
- push @{$files{Deleted}}, $dir_filename; next;
- }
- # if dir: save name for recursion
- -d $dir_filename and do {
- push @subdirs, $dir_filename; next;
- };
-
- # modification time of $dir_filename
- $mtime= (stat $dir_filename)[9];
-
-
- if($date eq "dummy timestamp") {
- # dummy timestamp means it's new to the repository.
- push @{$files{Changed}}, $dir_filename;
- if ($debug) {
- print "$dir_filename is changed\n";
- }
- }
- elsif($date eq "Result of merge") {
- # result of merge means it's changed, then updated.
- push @{$files{Changed}}, $dir_filename;
- if ($debug) {
- print "$dir_filename is changed\n";
- }
- }
- elsif(not
- $date=~/... (...)\s+(\d+)\s+(\d+):(\d+):(\d+) (\d{4})/)
- {
- #bogus entry in Entires
- warn "Warning: $dir_filename -> '$date' ".
- "not in ctime(3) format\n";
- } else {
- $cvstime=timegm($5,$4,$3,$2,$mon{$1},$6);
- if($cvstime != $mtime) {
- push @{$files{Changed}}, $dir_filename;
- if ($debug) {
- print "$dir_filename is changed\n";
- }
- } else {
- push @{$files{Unchanged}}, $dir_filename;
- if ($debug) {
- print "$dir_filename is Unchanged\n";
- }
- }
- }
- }
- close ENTRIES;
-
- # Locate any new files/dirs
- if(not opendir(D,$dir)) {
- warn("Cannot open $dir");
- @new_in_dir= ();
- } else {
- @skip{qw(. .. CVS)}=1..3; # Filenames that that we want to ignore
- #(note: these are exact filenames)
- @new_in_dir=
- (grep { not $seen{$_} } # files we have not already processed
- map { $dir."/".$_ } # map from file to dir/file
- grep { not ignore_file($_) } # ignore files in the cvsignore list
- grep { not $skip{$_} } # skip files to be ignored
- readdir(D));
- closedir(D);
- }
-
- # Remember new files (actually non-directories)
- push @{$files{New}}, grep { not -d $_ } @new_in_dir;
- if ($debug) { print "@{$files{New}} are new in $dir\n"; }
-
- # Remember new subdirs
- push @subdirs, grep { -d $_ } @new_in_dir;
-
- # Recurse all subdirs
- if (not $local) {
- for $i (@subdirs) { cvs_changed_in_dir($i); }
- }
- }
-}
-
-sub print_status()
-{
- my $k;
- my %show_these_states = ("Changed" => 1);
- if(not $restrict) {
- $show_these_states{"New"} = 1;
- $show_these_states{"Deleted"} = 1;
- }
-
- if($opt_all) { $show_these_states{"Unchanged"} = 1; }
-
- if ($tabular) {
- my %allfiles; # key: filesname, value: state
- my ($file, $state, $statefiles);
-
- $show_these_states{"Unknown"} = 1;
- while (($state, $statefiles) = each %files) {
- for my $f (@{$statefiles}) {
- $allfiles{$f} = $state;
- }
- }
- for $file (sort keys %allfiles) {
- $state = $allfiles{$file};
- printf("%-10s %s\n", $state, $file) if $show_these_states{$state};
- }
- }
- else {
- print "\n";
- for $k (keys %show_these_states) {
- if(not $files{$k} or not @{$files{$k}}) {
- # no files
- $files{$k}=["(none)"];
- }
- print("$k files\n",
- "---------------\n",
- map { "$_\n" } sort @{$files{$k}});
- print "\n";
- }
- }
-}
-
-load_initial_cvsignore();
-if ($debug_cvsignore) {print "initial regex:",$cvsignoreregex,"\n";}
-cvs_changed_in_dir($startdir);
-print_status();
-
diff --git a/ndb/include/kernel/ndb_limits.h b/ndb/include/kernel/ndb_limits.h
index 88fcff22da7..48a56c019bb 100644
--- a/ndb/include/kernel/ndb_limits.h
+++ b/ndb/include/kernel/ndb_limits.h
@@ -117,4 +117,9 @@
*/
#define NDB_BLOB_HEAD_SIZE 2 /* sizeof(NdbBlob::Head) >> 2 */
+/*
+ * Long signals
+ */
+#define NDB_SECTION_SEGMENT_SZ 60
+
#endif
diff --git a/ndb/include/kernel/signaldata/DictTabInfo.hpp b/ndb/include/kernel/signaldata/DictTabInfo.hpp
index 6b4a3f34553..ae78c023c2a 100644
--- a/ndb/include/kernel/signaldata/DictTabInfo.hpp
+++ b/ndb/include/kernel/signaldata/DictTabInfo.hpp
@@ -51,7 +51,6 @@ class DictTabInfo {
friend class Trix;
friend class DbUtil;
// API
- friend class Table;
friend class NdbSchemaOp;
/**
diff --git a/ndb/include/ndb_global.h b/ndb/include/ndb_global.h
index 09559f6ddff..bdd4e503cc5 100644
--- a/ndb/include/ndb_global.h
+++ b/ndb/include/ndb_global.h
@@ -82,19 +82,12 @@ extern "C" {
/* call in main() - does not return on error */
extern int ndb_init(void);
extern void ndb_end(int);
+#define NDB_INIT(prog_name) {my_progname=(prog_name); ndb_init();}
#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);
diff --git a/ndb/include/ndbapi/NdbBlob.hpp b/ndb/include/ndbapi/NdbBlob.hpp
index 5df61a0806c..0fb63015da2 100644
--- a/ndb/include/ndbapi/NdbBlob.hpp
+++ b/ndb/include/ndbapi/NdbBlob.hpp
@@ -36,7 +36,7 @@ class NdbColumnImpl;
* Blob data is stored in 2 places:
*
* - "header" and "inline bytes" stored in the blob attribute
- * - "blob parts" stored in a separate table NDB$BLOB_<t>_<v>_<c>
+ * - "blob parts" stored in a separate table NDB$BLOB_<tid>_<cid>
*
* Inline and part sizes can be set via NdbDictionary::Column methods
* when the table is created.
@@ -74,23 +74,21 @@ class NdbColumnImpl;
* NdbBlob methods return -1 on error and 0 on success, and use output
* parameters when necessary.
*
- * Notes:
- * - table and its blob part tables are not created atomically
- * - scan must use the "new" interface NdbScanOperation
- * - to update a blob in a read op requires exclusive tuple lock
- * - update op in scan must do its own getBlobHandle
- * - delete creates implicit, not-accessible blob handles
- * - NdbOperation::writeTuple does not support blobs
- * - there is no support for an asynchronous interface
+ * Operation types:
+ * - insertTuple must use setValue if blob column is non-nullable
+ * - readTuple with exclusive lock can also update existing value
+ * - updateTuple can overwrite with setValue or update existing value
+ * - writeTuple always overwrites and must use setValue if non-nullable
+ * - deleteTuple creates implicit non-accessible blob handles
+ * - scan with exclusive lock can also update existing value
+ * - scan "lock takeover" update op must do its own getBlobHandle
*
* Bugs / limitations:
- * - scan must use exclusive locking for now
- *
- * Todo:
- * - add scan method hold-read-lock + return-keyinfo
- * - check keyinfo length when setting keys
- * - check allowed blob ops vs locking mode
- * - overload control (too many pending ops)
+ * - lock mode upgrade should be handled automatically
+ * - lock mode vs allowed operation is not checked
+ * - too many pending blob ops can blow up i/o buffers
+ * - table and its blob part tables are not created atomically
+ * - there is no support for an asynchronous interface
*/
class NdbBlob {
public:
@@ -173,19 +171,11 @@ public:
*/
int readData(void* data, Uint32& bytes);
/**
- * Read at given position. Does not use or update current position.
- */
- int readData(Uint64 pos, void* data, Uint32& bytes);
- /**
* Write at current position and set new position to first byte after
* the data written. A write past blob end extends the blob value.
*/
int writeData(const void* data, Uint32 bytes);
/**
- * Write at given position. Does not use or update current position.
- */
- int writeData(Uint64 pos, const void* data, Uint32 bytes);
- /**
* Return the blob column.
*/
const NdbDictionary::Column* getColumn();
@@ -266,14 +256,17 @@ private:
Buf();
~Buf();
void alloc(unsigned n);
+ void copyfrom(const Buf& src);
};
Buf theKeyBuf;
Buf theAccessKeyBuf;
Buf theHeadInlineBuf;
+ Buf theHeadInlineCopyBuf; // for writeTuple
Buf thePartBuf;
Head* theHead;
char* theInlineData;
NdbRecAttr* theHeadInlineRecAttr;
+ NdbOperation* theHeadInlineReadOp;
bool theHeadInlineUpdateFlag;
// length and read/write position
int theNullFlag;
@@ -294,6 +287,7 @@ private:
bool isReadOp();
bool isInsertOp();
bool isUpdateOp();
+ bool isWriteOp();
bool isDeleteOp();
bool isScanOp();
// computations
@@ -309,12 +303,13 @@ private:
void getHeadFromRecAttr();
int setHeadInlineValue(NdbOperation* anOp);
// data operations
- int readDataPrivate(Uint64 pos, char* buf, Uint32& bytes);
- int writeDataPrivate(Uint64 pos, const char* buf, Uint32 bytes);
+ int readDataPrivate(char* buf, Uint32& bytes);
+ int writeDataPrivate(const char* buf, Uint32 bytes);
int readParts(char* buf, Uint32 part, Uint32 count);
int insertParts(const char* buf, Uint32 part, Uint32 count);
int updateParts(const char* buf, Uint32 part, Uint32 count);
int deleteParts(Uint32 part, Uint32 count);
+ int deletePartsUnknown(Uint32 part);
// pending ops
int executePendingBlobReads();
int executePendingBlobWrites();
diff --git a/ndb/include/ndbapi/NdbConnection.hpp b/ndb/include/ndbapi/NdbConnection.hpp
index 92b940e96f7..7af5d27b922 100644
--- a/ndb/include/ndbapi/NdbConnection.hpp
+++ b/ndb/include/ndbapi/NdbConnection.hpp
@@ -526,7 +526,7 @@ private:
int sendCOMMIT(); // Send a TC_COMMITREQ signal;
void setGCI(int GCI); // Set the global checkpoint identity
- int OpCompleteFailure(Uint8 abortoption);
+ int OpCompleteFailure(Uint8 abortoption, bool setFailure = true);
int OpCompleteSuccess();
void CompletedOperations(); // Move active ops to list of completed
@@ -552,7 +552,7 @@ private:
void setOperationErrorCode(int anErrorCode);
// Indicate something went wrong in the definition phase
- void setOperationErrorCodeAbort(int anErrorCode);
+ void setOperationErrorCodeAbort(int anErrorCode, int abortOption = -1);
int checkMagicNumber(); // Verify correct object
NdbOperation* getNdbOperation(const class NdbTableImpl* aTable,
diff --git a/ndb/include/ndbapi/NdbIndexOperation.hpp b/ndb/include/ndbapi/NdbIndexOperation.hpp
index 7612fe54d1b..1472f1b249e 100644
--- a/ndb/include/ndbapi/NdbIndexOperation.hpp
+++ b/ndb/include/ndbapi/NdbIndexOperation.hpp
@@ -49,6 +49,9 @@ public:
* @{
*/
+ /** insert is not allowed */
+ int insertTuple();
+
/**
* Define the NdbIndexOperation to be a standard operation of type readTuple.
* When calling NdbConnection::execute, this operation
@@ -193,6 +196,7 @@ private:
// Private attributes
const NdbIndexImpl* m_theIndex;
+ const NdbTableImpl* m_thePrimaryTable;
Uint32 m_theIndexDefined[NDB_MAX_ATTRIBUTES_IN_INDEX][3];
Uint32 m_theIndexLen; // Length of the index in words
Uint32 m_theNoOfIndexDefined; // The number of index attributes
diff --git a/ndb/include/ndbapi/NdbOperation.hpp b/ndb/include/ndbapi/NdbOperation.hpp
index 8e0294e41e6..46d4ddab0f5 100644
--- a/ndb/include/ndbapi/NdbOperation.hpp
+++ b/ndb/include/ndbapi/NdbOperation.hpp
@@ -918,6 +918,13 @@ protected:
// Blobs in this operation
NdbBlob* theBlobList;
+ /*
+ * Abort option per operation, used by blobs. Default -1. If set,
+ * overrides abort option on connection level. If set to IgnoreError,
+ * does not cause execute() to return failure. This is different from
+ * IgnoreError on connection level.
+ */
+ Int8 m_abortOption;
};
#ifdef NDB_NO_DROPPED_SIGNAL
@@ -1160,5 +1167,3 @@ NdbOperation::setValue(Uint32 anAttrId, double aPar)
}
#endif
-
-
diff --git a/ndb/include/ndbapi/ndbapi_limits.h b/ndb/include/ndbapi/ndbapi_limits.h
index 1cf2d9b342d..d1cb135b39d 100644
--- a/ndb/include/ndbapi/ndbapi_limits.h
+++ b/ndb/include/ndbapi/ndbapi_limits.h
@@ -22,12 +22,13 @@
#define NDB_MAX_DATABASE_NAME_SIZE 128
#define NDB_MAX_SCHEMA_NAME_SIZE 128
#define NDB_MAX_TAB_NAME_SIZE 128
-#define NDB_MAX_ATTRIBUTES_IN_TABLE 91
+#define NDB_MAX_ATTR_NAME_SIZE 32
+#define NDB_MAX_ATTRIBUTES_IN_TABLE 128
-#define NDB_MAX_TUPLE_SIZE_IN_WORDS 1023
+#define NDB_MAX_TUPLE_SIZE_IN_WORDS 2013
#define NDB_MAX_KEYSIZE_IN_WORDS 1023
-#define NDB_MAX_KEY_SIZE NDB_MAX_KEYSIZE_IN_WORDS*sizeof(Uint32)
-#define NDB_MAX_TUPLE_SIZE NDB_MAX_TUPLE_SIZE_IN_WORDS*sizeof(uint32)
+#define NDB_MAX_KEY_SIZE (NDB_MAX_KEYSIZE_IN_WORDS*4)
+#define NDB_MAX_TUPLE_SIZE (NDB_MAX_TUPLE_SIZE_IN_WORDS*4)
#define NDB_MAX_ACTIVE_EVENTS 100
#endif
diff --git a/ndb/include/util/ndb_opts.h b/ndb/include/util/ndb_opts.h
new file mode 100644
index 00000000000..6cba9c04449
--- /dev/null
+++ b/ndb/include/util/ndb_opts.h
@@ -0,0 +1,57 @@
+/* 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_OPTS_H
+#define _NDB_OPTS_H
+
+#include <my_sys.h>
+#include <my_getopt.h>
+#include <mysql_version.h>
+#include <ndb_version.h>
+
+#ifndef DBUG_OFF
+#define NDB_STD_OPTS(prog_name) \
+ { "debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", \
+ 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0 }, \
+ { "usage", '?', "Display this help and exit.", \
+ 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \
+ { "help", '?', "Display this help and exit.", \
+ 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \
+ { "version", 'V', "Output version information and exit.", 0, 0, 0, \
+ GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \
+ { "connect-string", 'c', \
+ "Set connect string for connecting to ndb_mgmd. " \
+ "<constr>=\"host=<hostname:port>[;nodeid=<id>]\". " \
+ "Overides specifying entries in NDB_CONNECTSTRING and config file", \
+ (gptr*) &opt_connect_str, (gptr*) &opt_connect_str, 0, \
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }
+#else
+#define NDB_STD_OPTS(prog_name) \
+ { "usage", '?', "Display this help and exit.", \
+ 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \
+ { "help", '?', "Display this help and exit.", \
+ 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \
+ { "version", 'V', "Output version information and exit.", 0, 0, 0, \
+ GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \
+ { "connect-string", 'c', \
+ "Set connect string for connecting to ndb_mgmd. " \
+ "<constr>=\"host=<hostname:port>[;nodeid=<id>]\". " \
+ "Overides specifying entries in NDB_CONNECTSTRING and config file", \
+ (gptr*) &opt_connect_str, (gptr*) &opt_connect_str, 0, \
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }
+#endif
+
+#endif /*_NDB_OPTS_H */
diff --git a/ndb/src/common/editline/complete.c b/ndb/src/common/editline/complete.c
index d1f8b1d3ff4..c524a88c678 100644
--- a/ndb/src/common/editline/complete.c
+++ b/ndb/src/common/editline/complete.c
@@ -1,19 +1,3 @@
-/* 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 */
-
/* -*- c-basic-offset: 4; -*-
** $Revision: 1.8 $
**
diff --git a/ndb/src/common/editline/editline.c b/ndb/src/common/editline/editline.c
index 1e4c1ecba76..886dac2793b 100644
--- a/ndb/src/common/editline/editline.c
+++ b/ndb/src/common/editline/editline.c
@@ -1,19 +1,3 @@
-/* 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 */
-
/* -*- c-basic-offset: 4; -*-
** $Revision: 1.6 $
**
diff --git a/ndb/src/common/editline/editline_internal.h b/ndb/src/common/editline/editline_internal.h
index 5ed2b32a873..d82fa91c44b 100644
--- a/ndb/src/common/editline/editline_internal.h
+++ b/ndb/src/common/editline/editline_internal.h
@@ -1,19 +1,3 @@
-/* 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 */
-
/* $Revision: 1.2 $
**
** Internal header file for editline library.
diff --git a/ndb/src/common/editline/sysunix.c b/ndb/src/common/editline/sysunix.c
index 000bca78dfc..b0242fb99ce 100644
--- a/ndb/src/common/editline/sysunix.c
+++ b/ndb/src/common/editline/sysunix.c
@@ -1,19 +1,3 @@
-/* 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 */
-
/* $Revision: 1.4 $
**
** Unix system-dependant routines for editline library.
@@ -138,6 +122,11 @@ rl_add_slash(char *path, char *p, size_t p_len)
{
struct stat Sb;
- if (stat(path, &Sb) >= 0)
- (void)strlcat(p, S_ISDIR(Sb.st_mode) ? "/" : " ", p_len);
+ if (stat(path, &Sb) >= 0) {
+ size_t len= strlen(p);
+ if (len+1 < p_len) {
+ p[len]= S_ISDIR(Sb.st_mode) ? '/' : ' ';
+ p[len+1]= 0;
+ }
+ }
}
diff --git a/ndb/src/common/editline/unix.h b/ndb/src/common/editline/unix.h
index 37f461b471d..c2fde7547b3 100644
--- a/ndb/src/common/editline/unix.h
+++ b/ndb/src/common/editline/unix.h
@@ -1,19 +1,3 @@
-/* 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 */
-
/* $Revision: 1.3 $
**
** Editline system header file for Unix.
diff --git a/ndb/src/common/util/Makefile.am b/ndb/src/common/util/Makefile.am
index 0235adae7c9..61fd7992002 100644
--- a/ndb/src/common/util/Makefile.am
+++ b/ndb/src/common/util/Makefile.am
@@ -7,8 +7,8 @@ libgeneral_la_SOURCES = \
SocketServer.cpp SocketClient.cpp SocketAuthenticator.cpp\
OutputStream.cpp NdbOut.cpp BaseString.cpp Base64.cpp \
NdbSqlUtil.cpp new.cpp \
- uucode.c random.c getarg.c version.c \
- strdup.c strlcat.c strlcpy.c \
+ uucode.c random.c version.c \
+ strdup.c \
ConfigValues.cpp ndb_init.c basestring_vsnprintf.c
include $(top_srcdir)/ndb/config/common.mk.am
diff --git a/ndb/src/common/util/basestring_vsnprintf.c b/ndb/src/common/util/basestring_vsnprintf.c
index 10932226d18..7307279f345 100644
--- a/ndb/src/common/util/basestring_vsnprintf.c
+++ b/ndb/src/common/util/basestring_vsnprintf.c
@@ -18,6 +18,7 @@
#define _XOPEN_SOURCE 500
#include <stdio.h>
#include <basestring_vsnprintf.h>
+#include <my_config.h>
int
basestring_snprintf(char *str, size_t size, const char *format, ...)
@@ -30,8 +31,30 @@ basestring_snprintf(char *str, size_t size, const char *format, ...)
return(ret);
}
+#ifdef HAVE_SNPRINTF
+ #define BASESTRING_VSNPRINTF_FUNC(a,b,c,d) vsnprintf(a,b,c,d)
+#else
+ #define SNPRINTF_RETURN_TRUNC
+ /* #define BASESTRING_VSNPRINTF_FUNC(a,b,c,d) my_vsnprintf(a,b,c,d)
+ * we would like to use my_vsnprintf but it does not have enough features
+ * Let's hope vsnprintf works anyways
+ */
+ #define BASESTRING_VSNPRINTF_FUNC(a,b,c,d) vsnprintf(a,b,c,d)
+ extern int my_vsnprintf(char *str, size_t size, const char *format, va_list ap);
+#endif
+#ifdef SNPRINTF_RETURN_TRUNC
+static char basestring_vsnprintf_buf[16*1024];
+#endif
int
basestring_vsnprintf(char *str, size_t size, const char *format, va_list ap)
{
- return(vsnprintf(str, size, format, ap));
+ int ret= BASESTRING_VSNPRINTF_FUNC(str, size, format, ap);
+#ifdef SNPRINTF_RETURN_TRUNC
+ if (ret == size-1 || ret == -1) {
+ ret= BASESTRING_VSNPRINTF_FUNC(basestring_vsnprintf_buf,
+ sizeof(basestring_vsnprintf_buf),
+ format, ap);
+ }
+#endif
+ return ret;
}
diff --git a/ndb/src/common/util/getarg.3 b/ndb/src/common/util/getarg.3
deleted file mode 100644
index 43aae5d7b31..00000000000
--- a/ndb/src/common/util/getarg.3
+++ /dev/null
@@ -1,315 +0,0 @@
-.\" Copyright (c) 1999 Kungliga Tekniska Högskolan
-.\" $KTH: getarg.3,v 1.1.4.1 2001/07/26 19:54:45 lha Exp $
-.Dd September 24, 1999
-.Dt GETARG 3
-.Os ROKEN
-.Sh NAME
-.Nm getarg ,
-.Nm arg_printusage
-.Nd collect command line options
-.Sh SYNOPSIS
-.Fd #include <getarg.h>
-
-.Ft int
-.Fn getarg "struct getargs *args" "size_t num_args" "int argc" "char **argv" "int *optind"
-
-.Ft void
-.Fn arg_printusage "struct getargs *args" "size_t num_args" "const char *progname" "const char *extra_string"
-
-.Sh DESCRIPTION
-.Fn getarg
-collects any command line options given to a program in an easily used way.
-.Fn arg_printusage
-pretty-prints the available options, with a short help text.
-.Pp
-.Fa args
-is the option specification to use, and it's an array of
-.Fa struct getargs
-elements.
-.Fa num_args
-is the size of
-.Fa args
-(in elements).
-.Fa argc
-and
-.Fa argv
-are the argument count and argument vector to extract option from.
-.Fa optind
-is a pointer to an integer where the index to the last processed
-argument is stored, it must be initialised to the first index (minus
-one) to process (normally 0) before the first call.
-.Pp
-.Fa arg_printusage
-take the same
-.Fa args
-and
-.Fa num_args
-as getarg;
-.Fa progname is the name of the program (to be used in the help text), and
-.Fa extra_string
-is a string to print after the actual options to indicate more
-arguments. The usefulness of this function is realised only be people
-who has used programs that has help strings that doesn't match what
-the code does.
-.Pp
-The
-.Fa getargs
-struct has the following elements.
-
-.Bd -literal
-struct getargs{
- const char *long_name;
- char short_name;
- enum { arg_integer,
- arg_string,
- arg_flag,
- arg_negative_flag,
- arg_strings,
- arg_double,
- arg_collect
- } type;
- void *value;
- const char *help;
- const char *arg_help;
-};
-.Ed
-.Pp
-.Fa long_name
-is the long name of the option, it can be
-.Dv NULL ,
-if you don't want a long name.
-.Fa short_name
-is the characted to use as short option, it can be zero. If the option
-has a value the
-.Fa value
-field gets filled in with that value interpreted as specified by the
-.Fa type
-field.
-.Fa help
-is a longer help string for the option as a whole, if it's
-.Dv NULL
-the help text for the option is omitted (but it's still displayed in
-the synopsis).
-.Fa arg_help
-is a description of the argument, if
-.Dv NULL
-a default value will be used, depending on the type of the option:
-.Pp
-.Bl -hang -width arg_negative_flag
-.It arg_integer
-the argument is a signed integer, and
-.Fa value
-should point to an
-.Fa int .
-.It Fa arg_string
-the argument is a string, and
-.Fa value
-should point to a
-.Fa char* .
-.It Fa arg_flag
-the argument is a flag, and
-.Fa value
-should point to a
-.Fa int .
-It gets filled in with either zero or one, depending on how the option
-is given, the normal case beeing one. Note that if the option isn't
-given, the value isn't altered, so it should be initialised to some
-useful default.
-.It Fa arg_negative_flag
-this is the same as
-.Fa arg_flag
-but it reverses the meaning of the flag (a given short option clears
-the flag), and the synopsis of a long option is negated.
-.It Fa arg_strings
-the argument can be given multiple times, and the values are collected
-in an array;
-.Fa value
-should be a pointer to a
-.Fa struct getarg_strings
-structure, which holds a length and a string pointer.
-.It Fa arg_double
-argument is a double precision floating point value, and
-.Fa value
-should point to a
-.Fa double .
-.It Fa arg_collect
-allows more fine-grained control of the option parsing process.
-.Fa value
-should be a pointer to a
-.Fa getarg_collect_info
-structure:
-.Bd -literal
-typedef int (*getarg_collect_func)(int short_opt,
- int argc,
- char **argv,
- int *optind,
- int *optarg,
- void *data);
-
-typedef struct getarg_collect_info {
- getarg_collect_func func;
- void *data;
-} getarg_collect_info;
-.Ed
-.Pp
-With the
-.Fa func
-member set to a function to call, and
-.Fa data
-to some application specific data. The parameters to the collect function are:
-.Bl -inset
-.It Fa short_flag
-non-zero if this call is via a short option flag, zero otherwise
-.It Fa argc , argv
-the whole argument list
-.It Fa optind
-pointer to the index in argv where the flag is
-.It Fa optarg
-pointer to the index in argv[*optind] where the flag name starts
-.It Fa data
-application specific data
-.El
-.Pp
-You can modify
-.Fa *optind ,
-and
-.Fa *optarg ,
-but to do this correct you (more or less) have to know about the inner
-workings of getarg.
-
-You can skip parts of arguments by increasing
-.Fa *optarg
-(you could
-implement the
-.Fl z Ns Ar 3
-set of flags from
-.Nm gzip
-with this), or whole argument strings by increasing
-.Fa *optind
-(let's say you want a flag
-.Fl c Ar x y z
-to specify a coordinate); if you also have to set
-.Fa *optarg
-to a sane value.
-.Pp
-The collect function should return one of
-.Dv ARG_ERR_NO_MATCH , ARG_ERR_BAD_ARG , ARG_ERR_NO_ARG
-on error, zero otherwise.
-.Pp
-For your convenience there is a function,
-.Fn getarg_optarg ,
-that returns the traditional argument string, and you pass it all
-arguments, sans data, that where given to the collection function.
-.Pp
-Don't use this more this unless you absolutely have to.
-.El
-.Pp
-Option parsing is similar to what
-.Xr getopt
-uses. Short options without arguments can be compressed
-.Pf ( Fl xyz
-is the same as
-.Fl x y z ) ,
-and short
-options with arguments take these as either the rest of the
-argv-string or as the next option
-.Pf ( Fl o Ns Ar foo ,
-or
-.Fl o Ar foo ) .
-.Pp
-Long option names are prefixed with -- (double dash), and the value
-with a = (equal),
-.Fl -foo= Ns Ar bar .
-Long option flags can either be specified as they are
-.Pf ( Fl -help ) ,
-or with an (boolean parsable) option
-.Pf ( Fl -help= Ns Ar yes ,
-.Fl -help= Ns Ar true ,
-or similar), or they can also be negated
-.Pf ( Fl -no-help
-is the same as
-.Fl -help= Ns no ) ,
-and if you're really confused you can do it multiple times
-.Pf ( Fl -no-no-help= Ns Ar false ,
-or even
-.Fl -no-no-help= Ns Ar maybe ) .
-.Sh EXAMPLE
-.Bd -literal
-#include <stdio.h>
-#include <string.h>
-#include <getarg.h>
-
-char *source = "Ouagadougou";
-char *destination;
-int weight;
-int include_catalog = 1;
-int help_flag;
-
-struct getargs args[] = {
- { "source", 's', arg_string, &source,
- "source of shippment", "city" },
- { "destination", 'd', arg_string, &destination,
- "destination of shippment", "city" },
- { "weight", 'w', arg_integer, &weight,
- "weight of shippment", "tons" },
- { "catalog", 'c', arg_negative_flag, &include_catalog,
- "include product catalog" },
- { "help", 'h', arg_flag, &help_flag }
-};
-
-int num_args = sizeof(args) / sizeof(args[0]); /* number of elements in args */
-
-const char *progname = "ship++";
-
-int
-main(int argc, char **argv)
-{
- int optind = 0;
- if (getarg(args, num_args, argc, argv, &optind)) {
- arg_printusage(args, num_args, progname, "stuff...");
- exit (1);
- }
- if (help_flag) {
- arg_printusage(args, num_args, progname, "stuff...");
- exit (0);
- }
- if (destination == NULL) {
- fprintf(stderr, "%s: must specify destination\n", progname);
- exit(1);
- }
- if (strcmp(source, destination) == 0) {
- fprintf(stderr, "%s: destination must be different from source\n");
- exit(1);
- }
- /* include more stuff here ... */
- exit(2);
-}
-.Ed
-.Pp
-The output help output from this program looks like this:
-.Bd -literal
-$ ship++ --help
-Usage: ship++ [--source=city] [-s city] [--destination=city] [-d city]
- [--weight=tons] [-w tons] [--no-catalog] [-c] [--help] [-h] stuff...
--s city, --source=city source of shippment
--d city, --destination=city destination of shippment
--w tons, --weight=tons weight of shippment
--c, --no-catalog include product catalog
-.Ed
-
-.Sh BUGS
-It should be more flexible, so it would be possible to use other more
-complicated option syntaxes, such as what
-.Xr ps 1 ,
-and
-.Xr tar 1 ,
-uses, or the AFS model where you can skip the flag names as long as
-the options come in the correct order.
-.Pp
-Options with multiple arguments should be handled better.
-.Pp
-Should be integreated with SL.
-.Pp
-It's very confusing that the struct you pass in is called getargS.
-.Sh SEE ALSO
-.Xr getopt 3
diff --git a/ndb/src/common/util/getarg.3.ps b/ndb/src/common/util/getarg.3.ps
deleted file mode 100644
index 146fb8e4961..00000000000
--- a/ndb/src/common/util/getarg.3.ps
+++ /dev/null
@@ -1,458 +0,0 @@
-%!PS-Adobe-3.0
-%%Creator: groff version 1.15
-%%CreationDate: Thu Nov 7 12:53:13 2002
-%%DocumentNeededResources: font Times-Roman
-%%+ font Times-Bold
-%%+ font Courier-Bold
-%%+ font Courier-Oblique
-%%+ font Symbol
-%%+ font Courier
-%%DocumentSuppliedResources: procset grops 1.15 0
-%%Pages: 4
-%%PageOrder: Ascend
-%%Orientation: Portrait
-%%EndComments
-%%BeginProlog
-%%BeginResource: procset grops 1.15 0
-/setpacking where{
-pop
-currentpacking
-true setpacking
-}if
-/grops 120 dict dup begin
-/SC 32 def
-/A/show load def
-/B{0 SC 3 -1 roll widthshow}bind def
-/C{0 exch ashow}bind def
-/D{0 exch 0 SC 5 2 roll awidthshow}bind def
-/E{0 rmoveto show}bind def
-/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def
-/G{0 rmoveto 0 exch ashow}bind def
-/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
-/I{0 exch rmoveto show}bind def
-/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def
-/K{0 exch rmoveto 0 exch ashow}bind def
-/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
-/M{rmoveto show}bind def
-/N{rmoveto 0 SC 3 -1 roll widthshow}bind def
-/O{rmoveto 0 exch ashow}bind def
-/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
-/Q{moveto show}bind def
-/R{moveto 0 SC 3 -1 roll widthshow}bind def
-/S{moveto 0 exch ashow}bind def
-/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def
-/SF{
-findfont exch
-[exch dup 0 exch 0 exch neg 0 0]makefont
-dup setfont
-[exch/setfont cvx]cvx bind def
-}bind def
-/MF{
-findfont
-[5 2 roll
-0 3 1 roll
-neg 0 0]makefont
-dup setfont
-[exch/setfont cvx]cvx bind def
-}bind def
-/level0 0 def
-/RES 0 def
-/PL 0 def
-/LS 0 def
-/MANUAL{
-statusdict begin/manualfeed true store end
-}bind def
-/PLG{
-gsave newpath clippath pathbbox grestore
-exch pop add exch pop
-}bind def
-/BP{
-/level0 save def
-1 setlinecap
-1 setlinejoin
-72 RES div dup scale
-LS{
-90 rotate
-}{
-0 PL translate
-}ifelse
-1 -1 scale
-}bind def
-/EP{
-level0 restore
-showpage
-}bind def
-/DA{
-newpath arcn stroke
-}bind def
-/SN{
-transform
-.25 sub exch .25 sub exch
-round .25 add exch round .25 add exch
-itransform
-}bind def
-/DL{
-SN
-moveto
-SN
-lineto stroke
-}bind def
-/DC{
-newpath 0 360 arc closepath
-}bind def
-/TM matrix def
-/DE{
-TM currentmatrix pop
-translate scale newpath 0 0 .5 0 360 arc closepath
-TM setmatrix
-}bind def
-/RC/rcurveto load def
-/RL/rlineto load def
-/ST/stroke load def
-/MT/moveto load def
-/CL/closepath load def
-/FL{
-currentgray exch setgray fill setgray
-}bind def
-/BL/fill load def
-/LW/setlinewidth load def
-/RE{
-findfont
-dup maxlength 1 index/FontName known not{1 add}if dict begin
-{
-1 index/FID ne{def}{pop pop}ifelse
-}forall
-/Encoding exch def
-dup/FontName exch def
-currentdict end definefont pop
-}bind def
-/DEFS 0 def
-/EBEGIN{
-moveto
-DEFS begin
-}bind def
-/EEND/end load def
-/CNT 0 def
-/level1 0 def
-/PBEGIN{
-/level1 save def
-translate
-div 3 1 roll div exch scale
-neg exch neg exch translate
-0 setgray
-0 setlinecap
-1 setlinewidth
-0 setlinejoin
-10 setmiterlimit
-[]0 setdash
-/setstrokeadjust where{
-pop
-false setstrokeadjust
-}if
-/setoverprint where{
-pop
-false setoverprint
-}if
-newpath
-/CNT countdictstack def
-userdict begin
-/showpage{}def
-}bind def
-/PEND{
-clear
-countdictstack CNT sub{end}repeat
-level1 restore
-}bind def
-end def
-/setpacking where{
-pop
-setpacking
-}if
-%%EndResource
-%%IncludeResource: font Times-Roman
-%%IncludeResource: font Times-Bold
-%%IncludeResource: font Courier-Bold
-%%IncludeResource: font Courier-Oblique
-%%IncludeResource: font Symbol
-%%IncludeResource: font Courier
-grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72
-def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron
-/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef
-/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
-/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
-/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent
-/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen
-/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon
-/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O
-/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex
-/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y
-/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft
-/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl
-/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut
-/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash
-/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen
-/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft
-/logicalnot/minus/registered/macron/degree/plusminus/twosuperior
-/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior
-/ordmasculine/guilsinglright/onequarter/onehalf/threequarters
-/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE
-/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex
-/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis
-/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn
-/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla
-/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis
-/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash
-/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def
-/Courier@0 ENC0/Courier RE/Courier-Oblique@0 ENC0/Courier-Oblique RE
-/Courier-Bold@0 ENC0/Courier-Bold RE/Times-Bold@0 ENC0/Times-Bold RE
-/Times-Roman@0 ENC0/Times-Roman RE
-%%EndProlog
-%%Page: 1 1
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Roman@0 SF(GET)72 48 Q -.834(ARG \( 3 \))-.93 F
-(OpenBSD Programmer')111.062 E 2.5(sM)-.55 G 108.562(anual GET)-2.5 F
--.834(ARG \( 3 \))-.93 F/F1 10/Times-Bold@0 SF -.2(NA)72 108 S(ME).2 E
-/F2 10/Courier-Bold@0 SF(getarg)102 120 Q F0(,)A F2(arg_printusage)2.5 E
-F0 2.5<ad63>2.5 G(ollect command line options)-2.5 E F1(SYNOPSIS)72 144
-Q F2(#include <getarg.h>)102 156 Q/F3 10/Courier-Oblique@0 SF(int)102
-186 Q F2(getarg)102 198 Q F0(\()A F3(struct getargs)A/F4 10/Symbol SF(*)
-6 E F3(args)A F0(,)1.666 E F3(size_t num_args)4.166 E F0(,)1.666 E F3
-(int argc)4.166 E F0(,)1.666 E F3(char)4.166 E F4(**)6 E F3(argv)A F0(,)
-1.666 E F3(int)151.666 210 Q F4(*)6 E F3(optind)A F0(\);)A F3(void)102
-240 Q F2(arg_printusage)102 252 Q F0(\()A F3(struct getargs)A F4(*)6 E
-F3(args)A F0(,)1.666 E F3(size_t num_args)4.166 E F0(,)1.666 E F3
-(const char)4.166 E F4(*)6 E F3(progname)A F0(,)1.666 E F3(const char)
-151.666 264 Q F4(*)6 E F3(extra_string)A F0(\);)A F1(DESCRIPTION)72 300
-Q F2(getarg)102 312 Q F0 2.721 1.666(\(\) c)D 6.053(ollects an)-1.666 F
-8.553(yc)-.15 G 6.053(ommand line options gi)-8.553 F -.15(ve)-.25 G
-8.552(nt).15 G 8.552(oap)-8.552 G 6.052(rogram in an easily used w)
--8.552 F(ay)-.1 E(.)-.65 E F2(arg_printusage)102 324 Q F0 -3.332 1.666
-(\(\) p)D(retty-prints the a)-1.666 E -.25(va)-.2 G
-(ilable options, with a short help te).25 E(xt.)-.15 E F3(args)102 342 Q
-F0 .855(is the option speci\214cation to use, and it')3.355 F 3.356(sa)
--.55 G 3.356(na)-3.356 G .856(rray of)-3.356 F F3 .856(struct getargs)
-3.356 F F0(elements.)3.356 E F3(num_args)5.856 E F0(is)3.356 E .344
-(the size of)102 354 R F3(args)2.844 E F0 .344(\(in elements\).)2.844 F
-F3(argc)5.344 E F0(and)2.844 E F3(argv)2.844 E F0 .344(are the ar)2.844
-F .344(gument count and ar)-.18 F .344(gument v)-.18 F .344(ector to e)
--.15 F .343(xtract op-)-.15 F 1.127(tion from.)102 366 R F3(optind)6.127
-E F0 1.127(is a pointer to an inte)3.627 F 1.127(ger where the inde)-.15
-F 3.627(xt)-.15 G 3.628(ot)-3.627 G 1.128(he last processed ar)-3.628 F
-1.128(gument is stored, it)-.18 F
-(must be initialised to the \214rst inde)102 378 Q 2.5(x\()-.15 G
-(minus one\) to process \(normally 0\) before the \214rst call.)-2.5 E
-F3(arg_printusage)102 396 Q F0(tak)4.178 E 4.178(et)-.1 G 1.678(he same)
--4.178 F F3(args)4.178 E F0(and)4.178 E F3(num_args)4.178 E F0 1.678
-(as getar)4.178 F(g;)-.18 E F3 1.677(progname is the name of)4.178 F
-6.381(the program \(to be)102 408 R F0(progname0)12.381 E F3(0)12.381 E
-F0(progname1)A F3(1)12.381 E F0(progname2)A F3(2)12.382 E F0(progname3)A
-F3(3)12.382 E F0(progname4)A F3(4)102 420 Q F0(progname5)A F3
-(extra_string)3.404 E F0 .904
-(is a string to print after the actual options to indicate more ar)3.404
-F .904(guments. The)-.18 F .025(usefulness of this function is realised\
- only be people who has used programs that has help strings that doesn')
-102 432 R(t)-.18 E(match what the code does.)102 444 Q(The)102 462 Q F3
-(getargs)2.5 E F0(struct has the follo)2.5 E(wing elements.)-.25 E/F5 10
-/Courier@0 SF(struct getargs{)102 504 Q(const char)126 516 Q F4(*)6 E F5
-(long_name;)A(char short_name;)126 528 Q(enum { arg_integer,)126 540 Q
-(arg_string,)165 552 Q(arg_flag,)165 564 Q(arg_negative_flag,)165 576 Q
-(arg_strings,)165 588 Q(arg_double,)165 600 Q(arg_collect)168 612 Q 6
-(}t)126 624 S(ype;)-6 E(void)126 636 Q F4(*)6 E F5(value;)A(const char)
-126 648 Q F4(*)6 E F5(help;)A(const char)126 660 Q F4(*)6 E F5
-(arg_help;)A(};)102 672 Q F3(long_name)102 690 Q F0 .207
-(is the long name of the option, it can be)2.707 F F5(NULL)2.706 E F0
-2.706(,i)C 2.706(fy)-2.706 G .206(ou don')-2.706 F 2.706(tw)-.18 G .206
-(ant a long name.)-2.806 F F3(short_name)5.206 E F0 .397(is the charact\
-ed to use as short option, it can be zero. If the option has a v)102 702
-R .398(alue the)-.25 F F3(value)2.898 E F0 .398
-(\214eld gets \214lled in)2.898 F -.4(RO)77 750 S 152.325(KEN September)
-.4 F(24, 1999)2.5 E(1)188.865 E EP
-%%Page: 2 2
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Roman@0 SF(GET)72 48 Q -.834(ARG \( 3 \))-.93 F
-(OpenBSD Programmer')111.062 E 2.5(sM)-.55 G 108.562(anual GET)-2.5 F
--.834(ARG \( 3 \))-.93 F .737(with that v)102 96 R .737
-(alue interpreted as speci\214ed by the)-.25 F/F1 10/Courier-Oblique@0
-SF(type)3.237 E F0(\214eld.)3.237 E F1(help)5.737 E F0 .737
-(is a longer help string for the option as a)3.237 F 2.833
-(whole, if it')102 108 R(s)-.55 E/F2 10/Courier@0 SF(NULL)5.333 E F0
-2.833(the help te)5.333 F 2.833(xt for the option is omitted \(b)-.15 F
-2.834(ut it')-.2 F 5.334(ss)-.55 G 2.834
-(till displayed in the synopsis\).)-5.334 F F1(arg_help)102 120 Q F0
-.391(is a description of the ar)2.891 F .391(gument, if)-.18 F F2(NULL)
-2.891 E F0 2.891(ad)2.891 G(ef)-2.891 E .39(ault v)-.1 F .39
-(alue will be used, depending on the type of)-.25 F(the option:)102 132
-Q(ar)102 150 Q(g_inte)-.18 E 59.29(ger the)-.15 F(ar)2.5 E
-(gument is a signed inte)-.18 E(ger)-.15 E 2.5(,a)-.4 G(nd)-2.5 E F1
-(value)2.5 E F0(should point to an)2.5 E F1(int)2.5 E F0(.)A F1
-(arg_string)102 168 Q F0(the ar)47 E(gument is a string, and)-.18 E F1
-(value)2.5 E F0(should point to a)2.5 E F1(char)2.5 E/F3 10/Symbol SF(*)
-A F0(.)A F1(arg_flag)102 186 Q F0 .4(the ar)59 F .4
-(gument is a \215ag, and)-.18 F F1(value)2.9 E F0 .4(should point to a)
-2.9 F F1(int)2.9 E F0 2.9(.I)C 2.9(tg)-2.9 G .4
-(ets \214lled in with ei-)-2.9 F 1.154
-(ther zero or one, depending on ho)209 198 R 3.654(wt)-.25 G 1.153
-(he option is gi)-3.654 F -.15(ve)-.25 G 1.153
-(n, the normal case beeing).15 F .526(one. Note that if the option isn')
-209 210 R 3.026(tg)-.18 G -2.15 -.25(iv e)-3.026 H .526(n, the v).25 F
-.526(alue isn')-.25 F 3.026(ta)-.18 G .527(ltered, so it should be ini-)
--3.026 F(tialised to some useful def)209 222 Q(ault.)-.1 E F1
-(arg_negative_flag)102 240 Q F0 .058(this is the same as)2.558 F F1
-(arg_flag)2.558 E F0 -.2(bu)2.558 G 2.558(ti).2 G 2.558(tr)-2.558 G
--2.15 -.25(ev e)-2.558 H .057(rses the meaning of the \215ag \(a gi).25
-F -.15(ve)-.25 G 2.557(ns).15 G(hort)-2.557 E
-(option clears the \215ag\), and the synopsis of a long option is ne)209
-252 Q -.05(ga)-.15 G(ted.).05 E F1(arg_strings)102 270 Q F0 .195(the ar)
-41 F .195(gument can be gi)-.18 F -.15(ve)-.25 G 2.695(nm).15 G .195
-(ultiple times, and the v)-2.695 F .195
-(alues are collected in an array;)-.25 F F1(value)209 282 Q F0 .947
-(should be a pointer to a)3.447 F F1 .947(struct getarg_strings)3.447 F
-F0 .947(structure, which)3.447 F(holds a length and a string pointer)209
-294 Q(.)-.55 E F1(arg_double)102 312 Q F0(ar)47 E .538
-(gument is a double precision \215oating point v)-.18 F .539(alue, and)
--.25 F F1(value)3.039 E F0 .539(should point to a)3.039 F F1(double)209
-324 Q F0(.)A F1(arg_collect)102 342 Q F0(allo)41 E .345
-(ws more \214ne-grained control of the option parsing process.)-.25 F F1
-(value)5.344 E F0 .344(should be)2.844 F 2.5(ap)209 354 S(ointer to a)
--2.5 E F1(getarg_collect_info)2.5 E F0(structure:)2.5 E F2
-(typedef int \()209 372 Q F3(*)A F2
-(getarg_collect_func\)\(int short_opt,)A(int argc,)407 384 Q(char)407
-396 Q F3(**)6 E F2(argv,)A(int)407 408 Q F3(*)6 E F2(optind,)A(int)407
-420 Q F3(*)6 E F2(optarg,)A(void)407 432 Q F3(*)6 E F2(data\);)A
-(typedef struct getarg_collect_info {)209 456 Q
-(getarg_collect_func func;)233 468 Q(void)233 480 Q F3(*)6 E F2(data;)A
-6(}g)209 492 S(etarg_collect_info;)-6 E F0 -.4(Wi)209 510 S 1.018
-(th the).4 F F1(func)3.518 E F0 1.019
-(member set to a function to call, and)3.518 F F1(data)3.519 E F0 1.019
-(to some application)3.519 F
-(speci\214c data. The parameters to the collect function are:)209 522 Q
-F1(short_flag)209 540 Q F0
-(non-zero if this call is via a short option \215ag, zero otherwise)2.5
-E F1(argc)209 558 Q F0(,)A F1(argv)6 E F0(the whole ar)2.5 E
-(gument list)-.18 E F1(optind)209 576 Q F0(pointer to the inde)2.5 E 2.5
-(xi)-.15 G 2.5(na)-2.5 G -.18(rg)-2.5 G 2.5(vw).18 G(here the \215ag is)
--2.5 E F1(optarg)209 594 Q F0(pointer to the inde)2.5 E 2.5(xi)-.15 G
-2.5(na)-2.5 G -.18(rg)-2.5 G(v[).18 E F3(*)A F0
-(optind] where the \215ag name starts)A F1(data)209 612 Q F0
-(application speci\214c data)2.5 E -1.1(Yo)209 630 S 3.915(uc)1.1 G
-1.415(an modify)-3.915 F F3(*)3.915 E F1(optind)A F0 3.915(,a)C(nd)
--3.915 E F3(*)3.915 E F1(optarg)A F0 3.915(,b)C 1.414
-(ut to do this correct you \(more or)-4.115 F(less\) ha)209 642 Q .3
--.15(ve t)-.2 H 2.5(ok).15 G(no)-2.5 E 2.5(wa)-.25 G(bout the inner w)
--2.5 E(orkings of getar)-.1 E(g.)-.18 E -1.1(Yo)209 666 S 3.604(uc)1.1 G
-1.104(an skip parts of ar)-3.604 F 1.105(guments by increasing)-.18 F F3
-(*)3.605 E F1(optarg)A F0 1.105(\(you could implement)3.605 F(the)209
-678 Q/F4 10/Courier-Bold@0 SF<ad7a>4.567 E F1(3)A F0 .401
-(set of \215ags from)2.901 F F4(gzip)2.9 E F0 .4
-(with this\), or whole ar)2.9 F .4(gument strings by increas-)-.18 F
-(ing)209 690 Q F3(*)3.275 E F1(optind)A F0(\(let')3.275 E 3.276(ss)-.55
-G .776(ay you w)-3.276 F .776(ant a \215ag)-.1 F F4<ad63>4.942 E F1
-6.776(xyz)6.776 G F0 .776(to specify a coordinate\); if)-3.5 F
-(you also ha)209 702 Q .3 -.15(ve t)-.2 H 2.5(os).15 G(et)-2.5 E F3(*)
-2.5 E F1(optarg)A F0(to a sane v)2.5 E(alue.)-.25 E -.4(RO)77 750 S
-152.325(KEN September).4 F(24, 1999)2.5 E(2)188.865 E EP
-%%Page: 3 3
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Roman@0 SF(GET)72 48 Q -.834(ARG \( 3 \))-.93 F
-(OpenBSD Programmer')111.062 E 2.5(sM)-.55 G 108.562(anual GET)-2.5 F
--.834(ARG \( 3 \))-.93 F 9.449
-(The collect function should return one of)209 96 R/F1 10/Courier@0 SF
-(ARG_ERR_NO_MATCH)11.948 E F0(,)A F1(ARG_ERR_BAD_ARG)209 108 Q F0(,)A F1
-(ARG_ERR_NO_ARG)6 E F0(on error)2.5 E 2.5(,z)-.4 G(ero otherwise.)-2.5 E
--.15(Fo)209 126 S 4.042(ry).15 G 1.542(our con)-4.042 F -.15(ve)-.4 G
-1.542(nience there is a function,).15 F/F2 10/Courier-Bold@0 SF
-(getarg_optarg)4.042 E F0 1.542(\(\), that returns the)B 1.251
-(traditional ar)209 138 R 1.251(gument string, and you pass it all ar)
--.18 F 1.251(guments, sans data, that where)-.18 F(gi)209 150 Q -.15(ve)
--.25 G 2.5(nt).15 G 2.5(ot)-2.5 G(he collection function.)-2.5 E(Don')
-209 168 Q 2.5(tu)-.18 G(se this more this unless you absolutely ha)-2.5
-E .3 -.15(ve t)-.2 H(o.).15 E .213(Option parsing is similar to what)102
-186 R F1(getopt)2.713 E F0 .214(uses. Short options without ar)2.714 F
-.214(guments can be compressed \()-.18 F F2(\255xyz)1.666 E F0 .207
-(is the same as)102 198 R F2 1.873<ad7820ad7920ad7a>4.373 F F0 .207
-(\), and short options with ar)B .207(guments tak)-.18 F 2.706(et)-.1 G
-.206(hese as either the rest of the ar)-2.706 F(gv-string)-.18 E
-(or as the ne)102 210 Q(xt option \()-.15 E F2<ad6f>1.666 E/F3 10
-/Courier-Oblique@0 SF(foo)A F0 2.5(,o)C(r)-2.5 E F2<ad6f>4.166 E F3(foo)
-6 E F0(\).)A .78(Long option names are pre\214x)102 228 R .781
-(ed with -- \(double dash\), and the v)-.15 F .781
-(alue with a = \(equal\),)-.25 F F2(\255-foo=)4.947 E F3(bar)A F0 3.281
-(.L)C(ong)-3.281 E 3.815
-(option \215ags can either be speci\214ed as the)102 240 R 6.315(ya)-.15
-G 3.815(re \()-6.315 F F2(\255-help)1.666 E F0 3.815
-(\), or with an \(boolean parsable\) option)B(\()102 252 Q F2
-(\255-help=)1.666 E F3(yes)A F0(,)A F2(\255-help=)5.659 E F3(true)A F0
-3.993(,o)C 3.993(rs)-3.993 G 1.493(imilar\), or the)-3.993 F 3.993(yc)
--.15 G 1.493(an also be ne)-3.993 F -.05(ga)-.15 G 1.493(ted \().05 F F2
-(\255-no-help)1.666 E F0 1.493(is the same as)3.993 F F2(\255-help=)
-103.666 264 Q F0 1.363(no\), and if you')B 1.362
-(re really confused you can do it multiple times \()-.5 F F2
-(\255-no-no-help=)1.666 E F3(false)A F0 3.862(,o)C(r)-3.862 E -2.15 -.25
-(ev e)102 276 T(n).25 E F2(\255-no-no-help=)4.166 E F3(maybe)A F0(\).)A
-/F4 10/Times-Bold@0 SF(EXAMPLE)72 300 Q F1(#include <stdio.h>)102 330 Q
-(#include <string.h>)102 342 Q(#include <getarg.h>)102 354 Q(char)102
-378 Q/F5 10/Symbol SF(*)6 E F1(source = "Ouagadougou";)A(char)102 390 Q
-F5(*)6 E F1(destination;)A(int weight;)102 402 Q
-(int include_catalog = 1;)102 414 Q(int help_flag;)102 426 Q
-(struct getargs args[] = {)102 450 Q 6({")126 462 S 30(source", 's',)-6
-F 6(arg_string, &source,)6 F("source of shippment", "city" },)138 474 Q
-6({")126 486 S(destination", 'd', arg_string,)-6 E(&destination,)12 E
-("destination of shippment", "city" },)138 498 Q 6({")126 510 S 30
-(weight", 'w',)-6 F(arg_integer, &weight,)6 E
-("weight of shippment", "tons" },)138 522 Q 6({")126 534 S 24
-(catalog", 'c',)-6 F(arg_negative_flag, &include_catalog,)6 E
-("include product catalog" },)138 546 Q 6({")126 558 S 42(help", 'h',)-6
-F(arg_flag, &help_flag })6 E(};)102 570 Q
-(int num_args = sizeof\(args\) / sizeof\(args[0]\); /)102 594 Q F5(*)A
-F1(number of elements in args)6 E F5(*)6 E F1(/)A(const char)102 618 Q
-F5(*)6 E F1(progname = "ship++";)A(int)102 642 Q(main\(int argc, char)
-102 654 Q F5(**)6 E F1(argv\))A({)102 666 Q(int optind = 0;)126 678 Q
-(if \(getarg\(args, num_args, argc, argv, &optind\)\) {)126 690 Q
-(arg_printusage\(args, num_args, progname, "stuff..."\);)147 702 Q F0
--.4(RO)77 750 S 152.325(KEN September).4 F(24, 1999)2.5 E(3)188.865 E EP
-%%Page: 4 4
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Roman@0 SF(GET)72 48 Q -.834(ARG \( 3 \))-.93 F
-(OpenBSD Programmer')111.062 E 2.5(sM)-.55 G 108.562(anual GET)-2.5 F
--.834(ARG \( 3 \))-.93 F/F1 10/Courier@0 SF(exit \(1\);)147 96 Q(})126
-108 Q(if \(help_flag\) {)126 120 Q
-(arg_printusage\(args, num_args, progname, "stuff..."\);)147 132 Q
-(exit \(0\);)147 144 Q(})126 156 Q(if \(destination == NULL\) {)126 168
-Q(fprintf\(stderr, "%s: must specify destination0, progname\);)147 180 Q
-(exit\(1\);)147 192 Q(})126 204 Q
-(if \(strcmp\(source, destination\) == 0\) {)126 216 Q
-(fprintf\(stderr, "%s: destination must be different from source0\);)147
-228 Q(exit\(1\);)147 240 Q(})126 252 Q(/)126 264 Q/F2 10/Symbol SF(*)A
-F1(include more stuff here ...)6 E F2(*)6 E F1(/)A(exit\(2\);)126 276 Q
-(})102 288 Q F0(The output help output from this program looks lik)102
-306 Q 2.5(et)-.1 G(his:)-2.5 E F1 6($s)102 324 S(hip++ --help)-6 E
-(Usage: ship++ [--source=city] [-s city] [--destination=city] [-d city])
-102 336 Q
-([--weight=tons] [-w tons] [--no-catalog] [-c] [--help] [-h] stuff...)
-120 348 Q(-s city, --source=city)102 360 Q(source of shippment)36 E
-(-d city, --destination=city destination of shippment)102 372 Q
-(-w tons, --weight=tons)102 384 Q(weight of shippment)36 E
-(-c, --no-catalog)102 396 Q(include product catalog)72 E/F3 10
-/Times-Bold@0 SF -.1(BU)72 432 S(GS).1 E F0 .9(It should be more \215e)
-102 444 R .9(xible, so it w)-.15 F .901
-(ould be possible to use other more complicated option syntax)-.1 F .901
-(es, such as)-.15 F(what)102 456 Q F1(ps)3.167 E F0 .667(\(1\), and)B F1
-(tar)3.167 E F0 .666(\(1\), uses, or the AFS model where you can skip t\
-he \215ag names as long as the options)B(come in the correct order)102
-468 Q(.)-.55 E(Options with multiple ar)102 486 Q
-(guments should be handled better)-.18 E(.)-.55 E(Should be inte)102 504
-Q(greated with SL.)-.15 E(It')102 522 Q 2.5(sv)-.55 G
-(ery confusing that the struct you pass in is called getar)-2.65 E(gS.)
--.18 E F3 1.666(SEE ALSO)72 546 R F1(getopt)102 558 Q F0(\(3\))A -.4(RO)
-77 750 S 152.325(KEN September).4 F(24, 1999)2.5 E(4)188.865 E EP
-%%Trailer
-end
-%%EOF
diff --git a/ndb/src/common/util/md5-rfc1321.txt b/ndb/src/common/util/md5-rfc1321.txt
deleted file mode 100644
index c9e09e00cce..00000000000
--- a/ndb/src/common/util/md5-rfc1321.txt
+++ /dev/null
@@ -1,1179 +0,0 @@
-
-
-
-
-
-
-Network Working Group R. Rivest
-Request for Comments: 1321 MIT Laboratory for Computer Science
- and RSA Data Security, Inc.
- April 1992
-
-
- The MD5 Message-Digest Algorithm
-
-Status of this Memo
-
- This memo provides information for the Internet community. It does
- not specify an Internet standard. Distribution of this memo is
- unlimited.
-
-Acknowlegements
-
- We would like to thank Don Coppersmith, Burt Kaliski, Ralph Merkle,
- David Chaum, and Noam Nisan for numerous helpful comments and
- suggestions.
-
-Table of Contents
-
- 1. Executive Summary 1
- 2. Terminology and Notation 2
- 3. MD5 Algorithm Description 3
- 4. Summary 6
- 5. Differences Between MD4 and MD5 6
- References 7
- APPENDIX A - Reference Implementation 7
- Security Considerations 21
- Author's Address 21
-
-1. Executive Summary
-
- This document describes the MD5 message-digest algorithm. The
- algorithm takes as input a message of arbitrary length and produces
- as output a 128-bit "fingerprint" or "message digest" of the input.
- It is conjectured that it is computationally infeasible to produce
- two messages having the same message digest, or to produce any
- message having a given prespecified target message digest. The MD5
- algorithm is intended for digital signature applications, where a
- large file must be "compressed" in a secure manner before being
- encrypted with a private (secret) key under a public-key cryptosystem
- such as RSA.
-
-
-
-
-
-
-
-Rivest [Page 1]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
- The MD5 algorithm is designed to be quite fast on 32-bit machines. In
- addition, the MD5 algorithm does not require any large substitution
- tables; the algorithm can be coded quite compactly.
-
- The MD5 algorithm is an extension of the MD4 message-digest algorithm
- 1,2]. MD5 is slightly slower than MD4, but is more "conservative" in
- design. MD5 was designed because it was felt that MD4 was perhaps
- being adopted for use more quickly than justified by the existing
- critical review; because MD4 was designed to be exceptionally fast,
- it is "at the edge" in terms of risking successful cryptanalytic
- attack. MD5 backs off a bit, giving up a little in speed for a much
- greater likelihood of ultimate security. It incorporates some
- suggestions made by various reviewers, and contains additional
- optimizations. The MD5 algorithm is being placed in the public domain
- for review and possible adoption as a standard.
-
- For OSI-based applications, MD5's object identifier is
-
- md5 OBJECT IDENTIFIER ::=
- iso(1) member-body(2) US(840) rsadsi(113549) digestAlgorithm(2) 5}
-
- In the X.509 type AlgorithmIdentifier [3], the parameters for MD5
- should have type NULL.
-
-2. Terminology and Notation
-
- In this document a "word" is a 32-bit quantity and a "byte" is an
- eight-bit quantity. A sequence of bits can be interpreted in a
- natural manner as a sequence of bytes, where each consecutive group
- of eight bits is interpreted as a byte with the high-order (most
- significant) bit of each byte listed first. Similarly, a sequence of
- bytes can be interpreted as a sequence of 32-bit words, where each
- consecutive group of four bytes is interpreted as a word with the
- low-order (least significant) byte given first.
-
- Let x_i denote "x sub i". If the subscript is an expression, we
- surround it in braces, as in x_{i+1}. Similarly, we use ^ for
- superscripts (exponentiation), so that x^i denotes x to the i-th
- power.
-
- Let the symbol "+" denote addition of words (i.e., modulo-2^32
- addition). Let X <<< s denote the 32-bit value obtained by circularly
- shifting (rotating) X left by s bit positions. Let not(X) denote the
- bit-wise complement of X, and let X v Y denote the bit-wise OR of X
- and Y. Let X xor Y denote the bit-wise XOR of X and Y, and let XY
- denote the bit-wise AND of X and Y.
-
-
-
-
-
-Rivest [Page 2]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
-3. MD5 Algorithm Description
-
- We begin by supposing that we have a b-bit message as input, and that
- we wish to find its message digest. Here b is an arbitrary
- nonnegative integer; b may be zero, it need not be a multiple of
- eight, and it may be arbitrarily large. We imagine the bits of the
- message written down as follows:
-
- m_0 m_1 ... m_{b-1}
-
- The following five steps are performed to compute the message digest
- of the message.
-
-3.1 Step 1. Append Padding Bits
-
- The message is "padded" (extended) so that its length (in bits) is
- congruent to 448, modulo 512. That is, the message is extended so
- that it is just 64 bits shy of being a multiple of 512 bits long.
- Padding is always performed, even if the length of the message is
- already congruent to 448, modulo 512.
-
- Padding is performed as follows: a single "1" bit is appended to the
- message, and then "0" bits are appended so that the length in bits of
- the padded message becomes congruent to 448, modulo 512. In all, at
- least one bit and at most 512 bits are appended.
-
-3.2 Step 2. Append Length
-
- A 64-bit representation of b (the length of the message before the
- padding bits were added) is appended to the result of the previous
- step. In the unlikely event that b is greater than 2^64, then only
- the low-order 64 bits of b are used. (These bits are appended as two
- 32-bit words and appended low-order word first in accordance with the
- previous conventions.)
-
- At this point the resulting message (after padding with bits and with
- b) has a length that is an exact multiple of 512 bits. Equivalently,
- this message has a length that is an exact multiple of 16 (32-bit)
- words. Let M[0 ... N-1] denote the words of the resulting message,
- where N is a multiple of 16.
-
-3.3 Step 3. Initialize MD Buffer
-
- A four-word buffer (A,B,C,D) is used to compute the message digest.
- Here each of A, B, C, D is a 32-bit register. These registers are
- initialized to the following values in hexadecimal, low-order bytes
- first):
-
-
-
-
-Rivest [Page 3]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
- word A: 01 23 45 67
- word B: 89 ab cd ef
- word C: fe dc ba 98
- word D: 76 54 32 10
-
-3.4 Step 4. Process Message in 16-Word Blocks
-
- We first define four auxiliary functions that each take as input
- three 32-bit words and produce as output one 32-bit word.
-
- F(X,Y,Z) = XY v not(X) Z
- G(X,Y,Z) = XZ v Y not(Z)
- H(X,Y,Z) = X xor Y xor Z
- I(X,Y,Z) = Y xor (X v not(Z))
-
- In each bit position F acts as a conditional: if X then Y else Z.
- The function F could have been defined using + instead of v since XY
- and not(X)Z will never have 1's in the same bit position.) It is
- interesting to note that if the bits of X, Y, and Z are independent
- and unbiased, the each bit of F(X,Y,Z) will be independent and
- unbiased.
-
- The functions G, H, and I are similar to the function F, in that they
- act in "bitwise parallel" to produce their output from the bits of X,
- Y, and Z, in such a manner that if the corresponding bits of X, Y,
- and Z are independent and unbiased, then each bit of G(X,Y,Z),
- H(X,Y,Z), and I(X,Y,Z) will be independent and unbiased. Note that
- the function H is the bit-wise "xor" or "parity" function of its
- inputs.
-
- This step uses a 64-element table T[1 ... 64] constructed from the
- sine function. Let T[i] denote the i-th element of the table, which
- is equal to the integer part of 4294967296 times abs(sin(i)), where i
- is in radians. The elements of the table are given in the appendix.
-
- Do the following:
-
- /* Process each 16-word block. */
- For i = 0 to N/16-1 do
-
- /* Copy block i into X. */
- For j = 0 to 15 do
- Set X[j] to M[i*16+j].
- end /* of loop on j */
-
- /* Save A as AA, B as BB, C as CC, and D as DD. */
- AA = A
- BB = B
-
-
-
-Rivest [Page 4]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
- CC = C
- DD = D
-
- /* Round 1. */
- /* Let [abcd k s i] denote the operation
- a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s). */
- /* Do the following 16 operations. */
- [ABCD 0 7 1] [DABC 1 12 2] [CDAB 2 17 3] [BCDA 3 22 4]
- [ABCD 4 7 5] [DABC 5 12 6] [CDAB 6 17 7] [BCDA 7 22 8]
- [ABCD 8 7 9] [DABC 9 12 10] [CDAB 10 17 11] [BCDA 11 22 12]
- [ABCD 12 7 13] [DABC 13 12 14] [CDAB 14 17 15] [BCDA 15 22 16]
-
- /* Round 2. */
- /* Let [abcd k s i] denote the operation
- a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s). */
- /* Do the following 16 operations. */
- [ABCD 1 5 17] [DABC 6 9 18] [CDAB 11 14 19] [BCDA 0 20 20]
- [ABCD 5 5 21] [DABC 10 9 22] [CDAB 15 14 23] [BCDA 4 20 24]
- [ABCD 9 5 25] [DABC 14 9 26] [CDAB 3 14 27] [BCDA 8 20 28]
- [ABCD 13 5 29] [DABC 2 9 30] [CDAB 7 14 31] [BCDA 12 20 32]
-
- /* Round 3. */
- /* Let [abcd k s t] denote the operation
- a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s). */
- /* Do the following 16 operations. */
- [ABCD 5 4 33] [DABC 8 11 34] [CDAB 11 16 35] [BCDA 14 23 36]
- [ABCD 1 4 37] [DABC 4 11 38] [CDAB 7 16 39] [BCDA 10 23 40]
- [ABCD 13 4 41] [DABC 0 11 42] [CDAB 3 16 43] [BCDA 6 23 44]
- [ABCD 9 4 45] [DABC 12 11 46] [CDAB 15 16 47] [BCDA 2 23 48]
-
- /* Round 4. */
- /* Let [abcd k s t] denote the operation
- a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s). */
- /* Do the following 16 operations. */
- [ABCD 0 6 49] [DABC 7 10 50] [CDAB 14 15 51] [BCDA 5 21 52]
- [ABCD 12 6 53] [DABC 3 10 54] [CDAB 10 15 55] [BCDA 1 21 56]
- [ABCD 8 6 57] [DABC 15 10 58] [CDAB 6 15 59] [BCDA 13 21 60]
- [ABCD 4 6 61] [DABC 11 10 62] [CDAB 2 15 63] [BCDA 9 21 64]
-
- /* Then perform the following additions. (That is increment each
- of the four registers by the value it had before this block
- was started.) */
- A = A + AA
- B = B + BB
- C = C + CC
- D = D + DD
-
- end /* of loop on i */
-
-
-
-Rivest [Page 5]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
-3.5 Step 5. Output
-
- The message digest produced as output is A, B, C, D. That is, we
- begin with the low-order byte of A, and end with the high-order byte
- of D.
-
- This completes the description of MD5. A reference implementation in
- C is given in the appendix.
-
-4. Summary
-
- The MD5 message-digest algorithm is simple to implement, and provides
- a "fingerprint" or message digest of a message of arbitrary length.
- It is conjectured that the difficulty of coming up with two messages
- having the same message digest is on the order of 2^64 operations,
- and that the difficulty of coming up with any message having a given
- message digest is on the order of 2^128 operations. The MD5 algorithm
- has been carefully scrutinized for weaknesses. It is, however, a
- relatively new algorithm and further security analysis is of course
- justified, as is the case with any new proposal of this sort.
-
-5. Differences Between MD4 and MD5
-
- The following are the differences between MD4 and MD5:
-
- 1. A fourth round has been added.
-
- 2. Each step now has a unique additive constant.
-
- 3. The function g in round 2 was changed from (XY v XZ v YZ) to
- (XZ v Y not(Z)) to make g less symmetric.
-
- 4. Each step now adds in the result of the previous step. This
- promotes a faster "avalanche effect".
-
- 5. The order in which input words are accessed in rounds 2 and
- 3 is changed, to make these patterns less like each other.
-
- 6. The shift amounts in each round have been approximately
- optimized, to yield a faster "avalanche effect." The shifts in
- different rounds are distinct.
-
-
-
-
-
-
-
-
-
-
-Rivest [Page 6]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
-References
-
- [1] Rivest, R., "The MD4 Message Digest Algorithm", RFC 1320, MIT and
- RSA Data Security, Inc., April 1992.
-
- [2] Rivest, R., "The MD4 message digest algorithm", in A.J. Menezes
- and S.A. Vanstone, editors, Advances in Cryptology - CRYPTO '90
- Proceedings, pages 303-311, Springer-Verlag, 1991.
-
- [3] CCITT Recommendation X.509 (1988), "The Directory -
- Authentication Framework."
-
-APPENDIX A - Reference Implementation
-
- This appendix contains the following files taken from RSAREF: A
- Cryptographic Toolkit for Privacy-Enhanced Mail:
-
- global.h -- global header file
-
- md5.h -- header file for MD5
-
- md5c.c -- source code for MD5
-
- For more information on RSAREF, send email to <rsaref@rsa.com>.
-
- The appendix also includes the following file:
-
- mddriver.c -- test driver for MD2, MD4 and MD5
-
- The driver compiles for MD5 by default but can compile for MD2 or MD4
- if the symbol MD is defined on the C compiler command line as 2 or 4.
-
- The implementation is portable and should work on many different
- plaforms. However, it is not difficult to optimize the implementation
- on particular platforms, an exercise left to the reader. For example,
- on "little-endian" platforms where the lowest-addressed byte in a 32-
- bit word is the least significant and there are no alignment
- restrictions, the call to Decode in MD5Transform can be replaced with
- a typecast.
-
-A.1 global.h
-
-/* GLOBAL.H - RSAREF types and constants
- */
-
-/* PROTOTYPES should be set to one if and only if the compiler supports
- function argument prototyping.
-The following makes PROTOTYPES default to 0 if it has not already
-
-
-
-Rivest [Page 7]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
- been defined with C compiler flags.
- */
-#ifndef PROTOTYPES
-#define PROTOTYPES 0
-#endif
-
-/* POINTER defines a generic pointer type */
-typedef unsigned char *POINTER;
-
-/* UINT2 defines a two byte word */
-typedef unsigned short int UINT2;
-
-/* UINT4 defines a four byte word */
-typedef unsigned long int UINT4;
-
-/* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
-If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
- returns an empty list.
- */
-#if PROTOTYPES
-#define PROTO_LIST(list) list
-#else
-#define PROTO_LIST(list) ()
-#endif
-
-A.2 md5.h
-
-/* MD5.H - header file for MD5C.C
- */
-
-/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
-rights reserved.
-
-License to copy and use this software is granted provided that it
-is identified as the "RSA Data Security, Inc. MD5 Message-Digest
-Algorithm" in all material mentioning or referencing this software
-or this function.
-
-License is also granted to make and use derivative works provided
-that such works are identified as "derived from the RSA Data
-Security, Inc. MD5 Message-Digest Algorithm" in all material
-mentioning or referencing the derived work.
-
-RSA Data Security, Inc. makes no representations concerning either
-the merchantability of this software or the suitability of this
-software for any particular purpose. It is provided "as is"
-without express or implied warranty of any kind.
-
-
-
-
-Rivest [Page 8]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
-These notices must be retained in any copies of any part of this
-documentation and/or software.
- */
-
-/* MD5 context. */
-typedef struct {
- UINT4 state[4]; /* state (ABCD) */
- UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */
- unsigned char buffer[64]; /* input buffer */
-} MD5_CTX;
-
-void MD5Init PROTO_LIST ((MD5_CTX *));
-void MD5Update PROTO_LIST
- ((MD5_CTX *, unsigned char *, unsigned int));
-void MD5Final PROTO_LIST ((unsigned char [16], MD5_CTX *));
-
-A.3 md5c.c
-
-/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm
- */
-
-/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
-rights reserved.
-
-License to copy and use this software is granted provided that it
-is identified as the "RSA Data Security, Inc. MD5 Message-Digest
-Algorithm" in all material mentioning or referencing this software
-or this function.
-
-License is also granted to make and use derivative works provided
-that such works are identified as "derived from the RSA Data
-Security, Inc. MD5 Message-Digest Algorithm" in all material
-mentioning or referencing the derived work.
-
-RSA Data Security, Inc. makes no representations concerning either
-the merchantability of this software or the suitability of this
-software for any particular purpose. It is provided "as is"
-without express or implied warranty of any kind.
-
-These notices must be retained in any copies of any part of this
-documentation and/or software.
- */
-
-#include "global.h"
-#include "md5.h"
-
-/* Constants for MD5Transform routine.
- */
-
-
-
-Rivest [Page 9]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
-#define S11 7
-#define S12 12
-#define S13 17
-#define S14 22
-#define S21 5
-#define S22 9
-#define S23 14
-#define S24 20
-#define S31 4
-#define S32 11
-#define S33 16
-#define S34 23
-#define S41 6
-#define S42 10
-#define S43 15
-#define S44 21
-
-static void MD5Transform PROTO_LIST ((UINT4 [4], unsigned char [64]));
-static void Encode PROTO_LIST
- ((unsigned char *, UINT4 *, unsigned int));
-static void Decode PROTO_LIST
- ((UINT4 *, unsigned char *, unsigned int));
-static void MD5_memcpy PROTO_LIST ((POINTER, POINTER, unsigned int));
-static void MD5_memset PROTO_LIST ((POINTER, int, unsigned int));
-
-static unsigned char PADDING[64] = {
- 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-/* F, G, H and I are basic MD5 functions.
- */
-#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
-#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
-#define H(x, y, z) ((x) ^ (y) ^ (z))
-#define I(x, y, z) ((y) ^ ((x) | (~z)))
-
-/* ROTATE_LEFT rotates x left n bits.
- */
-#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
-
-/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
-Rotation is separate from addition to prevent recomputation.
- */
-#define FF(a, b, c, d, x, s, ac) { \
- (a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
-
-
-
-Rivest [Page 10]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
- (a) += (b); \
- }
-#define GG(a, b, c, d, x, s, ac) { \
- (a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-#define HH(a, b, c, d, x, s, ac) { \
- (a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-#define II(a, b, c, d, x, s, ac) { \
- (a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-
-/* MD5 initialization. Begins an MD5 operation, writing a new context.
- */
-void MD5Init (context)
-MD5_CTX *context; /* context */
-{
- context->count[0] = context->count[1] = 0;
- /* Load magic initialization constants.
-*/
- context->state[0] = 0x67452301;
- context->state[1] = 0xefcdab89;
- context->state[2] = 0x98badcfe;
- context->state[3] = 0x10325476;
-}
-
-/* MD5 block update operation. Continues an MD5 message-digest
- operation, processing another message block, and updating the
- context.
- */
-void MD5Update (context, input, inputLen)
-MD5_CTX *context; /* context */
-unsigned char *input; /* input block */
-unsigned int inputLen; /* length of input block */
-{
- unsigned int i, index, partLen;
-
- /* Compute number of bytes mod 64 */
- index = (unsigned int)((context->count[0] >> 3) & 0x3F);
-
- /* Update number of bits */
- if ((context->count[0] += ((UINT4)inputLen << 3))
-
-
-
-Rivest [Page 11]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
- < ((UINT4)inputLen << 3))
- context->count[1]++;
- context->count[1] += ((UINT4)inputLen >> 29);
-
- partLen = 64 - index;
-
- /* Transform as many times as possible.
-*/
- if (inputLen >= partLen) {
- MD5_memcpy
- ((POINTER)&context->buffer[index], (POINTER)input, partLen);
- MD5Transform (context->state, context->buffer);
-
- for (i = partLen; i + 63 < inputLen; i += 64)
- MD5Transform (context->state, &input[i]);
-
- index = 0;
- }
- else
- i = 0;
-
- /* Buffer remaining input */
- MD5_memcpy
- ((POINTER)&context->buffer[index], (POINTER)&input[i],
- inputLen-i);
-}
-
-/* MD5 finalization. Ends an MD5 message-digest operation, writing the
- the message digest and zeroizing the context.
- */
-void MD5Final (digest, context)
-unsigned char digest[16]; /* message digest */
-MD5_CTX *context; /* context */
-{
- unsigned char bits[8];
- unsigned int index, padLen;
-
- /* Save number of bits */
- Encode (bits, context->count, 8);
-
- /* Pad out to 56 mod 64.
-*/
- index = (unsigned int)((context->count[0] >> 3) & 0x3f);
- padLen = (index < 56) ? (56 - index) : (120 - index);
- MD5Update (context, PADDING, padLen);
-
- /* Append length (before padding) */
- MD5Update (context, bits, 8);
-
-
-
-Rivest [Page 12]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
- /* Store state in digest */
- Encode (digest, context->state, 16);
-
- /* Zeroize sensitive information.
-*/
- MD5_memset ((POINTER)context, 0, sizeof (*context));
-}
-
-/* MD5 basic transformation. Transforms state based on block.
- */
-static void MD5Transform (state, block)
-UINT4 state[4];
-unsigned char block[64];
-{
- UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
-
- Decode (x, block, 64);
-
- /* Round 1 */
- FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */
- FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */
- FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */
- FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */
- FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */
- FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */
- FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */
- FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */
- FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */
- FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */
- FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */
- FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */
- FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */
- FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */
- FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */
- FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */
-
- /* Round 2 */
- GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */
- GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */
- GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
- GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */
- GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */
- GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */
- GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
- GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */
- GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */
- GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */
- GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */
-
-
-
-Rivest [Page 13]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
- GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */
- GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */
- GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */
- GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */
- GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */
-
- /* Round 3 */
- HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */
- HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */
- HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */
- HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */
- HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */
- HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */
- HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */
- HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */
- HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
- HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */
- HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */
- HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */
- HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */
- HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
- HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
- HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */
-
- /* Round 4 */
- II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */
- II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */
- II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */
- II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */
- II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */
- II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */
- II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */
- II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */
- II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */
- II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */
- II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */
- II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */
- II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */
- II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */
- II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */
- II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */
-
- state[0] += a;
- state[1] += b;
- state[2] += c;
- state[3] += d;
-
- /* Zeroize sensitive information.
-
-
-
-Rivest [Page 14]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
-*/
- MD5_memset ((POINTER)x, 0, sizeof (x));
-}
-
-/* Encodes input (UINT4) into output (unsigned char). Assumes len is
- a multiple of 4.
- */
-static void Encode (output, input, len)
-unsigned char *output;
-UINT4 *input;
-unsigned int len;
-{
- unsigned int i, j;
-
- for (i = 0, j = 0; j < len; i++, j += 4) {
- output[j] = (unsigned char)(input[i] & 0xff);
- output[j+1] = (unsigned char)((input[i] >> 8) & 0xff);
- output[j+2] = (unsigned char)((input[i] >> 16) & 0xff);
- output[j+3] = (unsigned char)((input[i] >> 24) & 0xff);
- }
-}
-
-/* Decodes input (unsigned char) into output (UINT4). Assumes len is
- a multiple of 4.
- */
-static void Decode (output, input, len)
-UINT4 *output;
-unsigned char *input;
-unsigned int len;
-{
- unsigned int i, j;
-
- for (i = 0, j = 0; j < len; i++, j += 4)
- output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) |
- (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24);
-}
-
-/* Note: Replace "for loop" with standard memcpy if possible.
- */
-
-static void MD5_memcpy (output, input, len)
-POINTER output;
-POINTER input;
-unsigned int len;
-{
- unsigned int i;
-
- for (i = 0; i < len; i++)
-
-
-
-Rivest [Page 15]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
- output[i] = input[i];
-}
-
-/* Note: Replace "for loop" with standard memset if possible.
- */
-static void MD5_memset (output, value, len)
-POINTER output;
-int value;
-unsigned int len;
-{
- unsigned int i;
-
- for (i = 0; i < len; i++)
- ((char *)output)[i] = (char)value;
-}
-
-A.4 mddriver.c
-
-/* MDDRIVER.C - test driver for MD2, MD4 and MD5
- */
-
-/* Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All
-rights reserved.
-
-RSA Data Security, Inc. makes no representations concerning either
-the merchantability of this software or the suitability of this
-software for any particular purpose. It is provided "as is"
-without express or implied warranty of any kind.
-
-These notices must be retained in any copies of any part of this
-documentation and/or software.
- */
-
-/* The following makes MD default to MD5 if it has not already been
- defined with C compiler flags.
- */
-#ifndef MD
-#define MD MD5
-#endif
-
-#include <stdio.h>
-#include <time.h>
-#include <string.h>
-#include "global.h"
-#if MD == 2
-#include "md2.h"
-#endif
-#if MD == 4
-
-
-
-Rivest [Page 16]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
-#include "md4.h"
-#endif
-#if MD == 5
-#include "md5.h"
-#endif
-
-/* Length of test block, number of test blocks.
- */
-#define TEST_BLOCK_LEN 1000
-#define TEST_BLOCK_COUNT 1000
-
-static void MDString PROTO_LIST ((char *));
-static void MDTimeTrial PROTO_LIST ((void));
-static void MDTestSuite PROTO_LIST ((void));
-static void MDFile PROTO_LIST ((char *));
-static void MDFilter PROTO_LIST ((void));
-static void MDPrint PROTO_LIST ((unsigned char [16]));
-
-#if MD == 2
-#define MD_CTX MD2_CTX
-#define MDInit MD2Init
-#define MDUpdate MD2Update
-#define MDFinal MD2Final
-#endif
-#if MD == 4
-#define MD_CTX MD4_CTX
-#define MDInit MD4Init
-#define MDUpdate MD4Update
-#define MDFinal MD4Final
-#endif
-#if MD == 5
-#define MD_CTX MD5_CTX
-#define MDInit MD5Init
-#define MDUpdate MD5Update
-#define MDFinal MD5Final
-#endif
-
-/* Main driver.
-
-Arguments (may be any combination):
- -sstring - digests string
- -t - runs time trial
- -x - runs test script
- filename - digests file
- (none) - digests standard input
- */
-int main (argc, argv)
-int argc;
-
-
-
-Rivest [Page 17]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
-char *argv[];
-{
- int i;
-
- if (argc > 1)
- for (i = 1; i < argc; i++)
- if (argv[i][0] == '-' && argv[i][1] == 's')
- MDString (argv[i] + 2);
- else if (strcmp (argv[i], "-t") == 0)
- MDTimeTrial ();
- else if (strcmp (argv[i], "-x") == 0)
- MDTestSuite ();
- else
- MDFile (argv[i]);
- else
- MDFilter ();
-
- return (0);
-}
-
-/* Digests a string and prints the result.
- */
-static void MDString (string)
-char *string;
-{
- MD_CTX context;
- unsigned char digest[16];
- unsigned int len = strlen (string);
-
- MDInit (&context);
- MDUpdate (&context, string, len);
- MDFinal (digest, &context);
-
- printf ("MD%d (\"%s\") = ", MD, string);
- MDPrint (digest);
- printf ("\n");
-}
-
-/* Measures the time to digest TEST_BLOCK_COUNT TEST_BLOCK_LEN-byte
- blocks.
- */
-static void MDTimeTrial ()
-{
- MD_CTX context;
- time_t endTime, startTime;
- unsigned char block[TEST_BLOCK_LEN], digest[16];
- unsigned int i;
-
-
-
-
-Rivest [Page 18]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
- printf
- ("MD%d time trial. Digesting %d %d-byte blocks ...", MD,
- TEST_BLOCK_LEN, TEST_BLOCK_COUNT);
-
- /* Initialize block */
- for (i = 0; i < TEST_BLOCK_LEN; i++)
- block[i] = (unsigned char)(i & 0xff);
-
- /* Start timer */
- time (&startTime);
-
- /* Digest blocks */
- MDInit (&context);
- for (i = 0; i < TEST_BLOCK_COUNT; i++)
- MDUpdate (&context, block, TEST_BLOCK_LEN);
- MDFinal (digest, &context);
-
- /* Stop timer */
- time (&endTime);
-
- printf (" done\n");
- printf ("Digest = ");
- MDPrint (digest);
- printf ("\nTime = %ld seconds\n", (long)(endTime-startTime));
- printf
- ("Speed = %ld bytes/second\n",
- (long)TEST_BLOCK_LEN * (long)TEST_BLOCK_COUNT/(endTime-startTime));
-}
-
-/* Digests a reference suite of strings and prints the results.
- */
-static void MDTestSuite ()
-{
- printf ("MD%d test suite:\n", MD);
-
- MDString ("");
- MDString ("a");
- MDString ("abc");
- MDString ("message digest");
- MDString ("abcdefghijklmnopqrstuvwxyz");
- MDString
- ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
- MDString
- ("1234567890123456789012345678901234567890\
-1234567890123456789012345678901234567890");
-}
-
-/* Digests a file and prints the result.
-
-
-
-Rivest [Page 19]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
- */
-static void MDFile (filename)
-char *filename;
-{
- FILE *file;
- MD_CTX context;
- int len;
- unsigned char buffer[1024], digest[16];
-
- if ((file = fopen (filename, "rb")) == NULL)
- printf ("%s can't be opened\n", filename);
-
- else {
- MDInit (&context);
- while (len = fread (buffer, 1, 1024, file))
- MDUpdate (&context, buffer, len);
- MDFinal (digest, &context);
-
- fclose (file);
-
- printf ("MD%d (%s) = ", MD, filename);
- MDPrint (digest);
- printf ("\n");
- }
-}
-
-/* Digests the standard input and prints the result.
- */
-static void MDFilter ()
-{
- MD_CTX context;
- int len;
- unsigned char buffer[16], digest[16];
-
- MDInit (&context);
- while (len = fread (buffer, 1, 16, stdin))
- MDUpdate (&context, buffer, len);
- MDFinal (digest, &context);
-
- MDPrint (digest);
- printf ("\n");
-}
-
-/* Prints a message digest in hexadecimal.
- */
-static void MDPrint (digest)
-unsigned char digest[16];
-{
-
-
-
-Rivest [Page 20]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
- unsigned int i;
-
- for (i = 0; i < 16; i++)
- printf ("%02x", digest[i]);
-}
-
-A.5 Test suite
-
- The MD5 test suite (driver option "-x") should print the following
- results:
-
-MD5 test suite:
-MD5 ("") = d41d8cd98f00b204e9800998ecf8427e
-MD5 ("a") = 0cc175b9c0f1b6a831c399e269772661
-MD5 ("abc") = 900150983cd24fb0d6963f7d28e17f72
-MD5 ("message digest") = f96b697d7cb7938d525a2f31aaf161d0
-MD5 ("abcdefghijklmnopqrstuvwxyz") = c3fcd3d76192e4007dfb496cca67e13b
-MD5 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") =
-d174ab98d277d9f5a5611c2c9f419d9f
-MD5 ("123456789012345678901234567890123456789012345678901234567890123456
-78901234567890") = 57edf4a22be3c955ac49da2e2107b67a
-
-Security Considerations
-
- The level of security discussed in this memo is considered to be
- sufficient for implementing very high security hybrid digital-
- signature schemes based on MD5 and a public-key cryptosystem.
-
-Author's Address
-
- Ronald L. Rivest
- Massachusetts Institute of Technology
- Laboratory for Computer Science
- NE43-324
- 545 Technology Square
- Cambridge, MA 02139-1986
-
- Phone: (617) 253-5880
- EMail: rivest@theory.lcs.mit.edu
-
-
-
-
-
-
-
-
-
-
-
-
-Rivest [Page 21]
-
diff --git a/ndb/src/common/util/socket_io.cpp b/ndb/src/common/util/socket_io.cpp
index 6f4c7e63684..83a546de773 100644
--- a/ndb/src/common/util/socket_io.cpp
+++ b/ndb/src/common/util/socket_io.cpp
@@ -172,22 +172,21 @@ vprint_socket(NDB_SOCKET_TYPE socket, int timeout_millis,
const char * fmt, va_list ap){
char buf[1000];
char *buf2 = buf;
- size_t size = sizeof(buf);
+ size_t size;
- if (fmt != 0) {
+ if (fmt != 0 && fmt[0] != 0) {
size = BaseString::vsnprintf(buf, sizeof(buf), fmt, ap);
/* Check if the output was truncated */
- if(size >= sizeof(buf)) {
- buf2 = (char *)malloc(size+1);
+ if(size > sizeof(buf)) {
+ buf2 = (char *)malloc(size);
if(buf2 == NULL)
return -1;
BaseString::vsnprintf(buf2, size, fmt, ap);
- } else
- size = sizeof(buf);
+ }
} else
- buf[0] = 0;
+ return 0;
- int ret = write_socket(socket, timeout_millis, buf2, strlen(buf2));
+ int ret = write_socket(socket, timeout_millis, buf2, size);
if(buf2 != buf)
free(buf2);
return ret;
@@ -199,23 +198,23 @@ vprintln_socket(NDB_SOCKET_TYPE socket, int timeout_millis,
const char * fmt, va_list ap){
char buf[1000];
char *buf2 = buf;
- size_t size = sizeof(buf);
+ size_t size;
- if (fmt != 0) {
- size = BaseString::vsnprintf(buf, sizeof(buf), fmt, ap);
+ if (fmt != 0 && fmt[0] != 0) {
+ size = BaseString::vsnprintf(buf, sizeof(buf), fmt, ap)+1;// extra byte for '/n'
/* Check if the output was truncated */
- if(size >= sizeof(buf)-1) {
- buf2 = (char *)malloc(size+2);
+ if(size > sizeof(buf)) {
+ buf2 = (char *)malloc(size);
if(buf2 == NULL)
return -1;
- BaseString::vsnprintf(buf2, size+1, fmt, ap);
- } else
- size = sizeof(buf);
- } else
- buf[0] = 0;
- strlcat(buf2, "\n", size+2);
+ BaseString::vsnprintf(buf2, size, fmt, ap);
+ }
+ } else {
+ size = 1;
+ }
+ buf2[size-1]='\n';
- int ret = write_socket(socket, timeout_millis, buf2, strlen(buf2));
+ int ret = write_socket(socket, timeout_millis, buf2, size);
if(buf2 != buf)
free(buf2);
return ret;
diff --git a/ndb/src/common/util/strlcat.c b/ndb/src/common/util/strlcat.c
deleted file mode 100644
index aa282abe48d..00000000000
--- a/ndb/src/common/util/strlcat.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1995 - 1999 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the Institute nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <ndb_global.h>
-
-/* RCSID("$KTH: strlcat.c,v 1.1 2000/08/16 01:23:47 lha Exp $"); */
-
-
-#ifndef HAVE_STRLCAT
-
-size_t
-strlcat (char *dst, const char *src, size_t dst_sz)
-{
- size_t len = strlen(dst);
-
- return len + strlcpy (dst + len, src, dst_sz - len);
-}
-#endif
diff --git a/ndb/src/common/util/strlcpy.c b/ndb/src/common/util/strlcpy.c
deleted file mode 100644
index 97cff177d48..00000000000
--- a/ndb/src/common/util/strlcpy.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 1995 - 1999 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the Institute nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <ndb_global.h>
-
-/* RCSID("$KTH: strlcpy.c,v 1.1 2000/08/16 01:23:48 lha Exp $"); */
-
-#ifndef HAVE_STRLCPY
-
-size_t
-strlcpy (char *dst, const char *src, size_t dst_sz)
-{
- size_t n;
- char *p;
-
- for (p = dst, n = 0;
- n + 1 < dst_sz && *src != '\0';
- ++p, ++src, ++n)
- *p = *src;
- *p = '\0';
- if (*src == '\0')
- return n;
- else
- return n + strlen (src);
-}
-
-#endif
diff --git a/ndb/src/cw/cpcc-win32/csharp/AssemblyInfo.cs b/ndb/src/cw/cpcc-win32/csharp/AssemblyInfo.cs
deleted file mode 100644
index 9f89a3282c5..00000000000
--- a/ndb/src/cw/cpcc-win32/csharp/AssemblyInfo.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-//
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-//
-[assembly: AssemblyTitle("")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("")]
-[assembly: AssemblyCopyright("")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-//
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Revision and Build Numbers
-// by using the '*' as shown below:
-
-[assembly: AssemblyVersion("1.0.*")]
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified, the assembly is not signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine. KeyFile refers to a file which contains
-// a key.
-// (*) If the KeyFile and the KeyName values are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP, that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the KeyFile is installed into the CSP and used.
-// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-// When specifying the KeyFile, the location of the KeyFile should be
-// relative to the project output directory which is
-// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-// located in the project directory, you would specify the AssemblyKeyFile
-// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile("")]
-[assembly: AssemblyKeyName("")]
diff --git a/ndb/src/cw/cpcc-win32/vb6/frmSplash.frm b/ndb/src/cw/cpcc-win32/vb6/frmSplash.frm
deleted file mode 100644
index 56ccbd79876..00000000000
--- a/ndb/src/cw/cpcc-win32/vb6/frmSplash.frm
+++ /dev/null
@@ -1,159 +0,0 @@
-VERSION 5.00
-Begin VB.Form frmSplash
- BorderStyle = 3 'Fixed Dialog
- ClientHeight = 4710
- ClientLeft = 45
- ClientTop = 45
- ClientWidth = 7455
- ControlBox = 0 'False
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 4710
- ScaleWidth = 7455
- ShowInTaskbar = 0 'False
- StartUpPosition = 2 'CenterScreen
- Visible = 0 'False
- Begin VB.Frame fraMainFrame
- Height = 4590
- Left = 45
- TabIndex = 0
- Top = -15
- Width = 7380
- Begin VB.PictureBox picLogo
- Height = 2385
- Left = 510
- Picture = "frmSplash.frx":0000
- ScaleHeight = 2325
- ScaleWidth = 1755
- TabIndex = 2
- Top = 855
- Width = 1815
- End
- Begin VB.Label lblLicenseTo
- Alignment = 1 'Right Justify
- Caption = "LicenseTo"
- Height = 255
- Left = 270
- TabIndex = 1
- Tag = "LicenseTo"
- Top = 300
- Width = 6855
- End
- Begin VB.Label lblProductName
- AutoSize = -1 'True
- Caption = "Product"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 29.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 720
- Left = 2670
- TabIndex = 9
- Tag = "Product"
- Top = 1200
- Width = 2190
- End
- Begin VB.Label lblCompanyProduct
- AutoSize = -1 'True
- Caption = "CompanyProduct"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 18
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 435
- Left = 2505
- TabIndex = 8
- Tag = "CompanyProduct"
- Top = 765
- Width = 3000
- End
- Begin VB.Label lblPlatform
- Alignment = 1 'Right Justify
- AutoSize = -1 'True
- Caption = "Platform"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 13.5
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 360
- Left = 5865
- TabIndex = 7
- Tag = "Platform"
- Top = 2400
- Width = 1140
- End
- Begin VB.Label lblVersion
- Alignment = 1 'Right Justify
- AutoSize = -1 'True
- Caption = "Version"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 12
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 300
- Left = 6075
- TabIndex = 6
- Tag = "Version"
- Top = 2760
- Width = 930
- End
- Begin VB.Label lblWarning
- Caption = "Warning"
- Height = 195
- Left = 300
- TabIndex = 3
- Tag = "Warning"
- Top = 3720
- Width = 6855
- End
- Begin VB.Label lblCompany
- Caption = "Company"
- Height = 255
- Left = 4710
- TabIndex = 5
- Tag = "Company"
- Top = 3330
- Width = 2415
- End
- Begin VB.Label lblCopyright
- Caption = "Copyright"
- Height = 255
- Left = 4710
- TabIndex = 4
- Tag = "Copyright"
- Top = 3120
- Width = 2415
- End
- End
-End
-Attribute VB_Name = "frmSplash"
-Attribute VB_GlobalNameSpace = False
-Attribute VB_Creatable = False
-Attribute VB_PredeclaredId = True
-Attribute VB_Exposed = False
-Private Sub Form_Load()
- lblVersion.Caption = "Version " & App.Major & "." & App.Minor & "." & App.Revision
- lblProductName.Caption = App.Title
-End Sub
-
diff --git a/ndb/src/cw/cpcd/common.cpp b/ndb/src/cw/cpcd/common.cpp
index cb1c0c37183..53c0e4d5a64 100644
--- a/ndb/src/cw/cpcd/common.cpp
+++ b/ndb/src/cw/cpcd/common.cpp
@@ -96,66 +96,3 @@ insert_file(const char * filename, class Properties& p){
if(f) fclose(f);
return res;
}
-
-int
-parse_config_file(struct getargs args[], int num_arg, const Properties& p){
- Properties::Iterator it(&p);
- for(const char * name = it.first(); name != 0; name = it.next()){
- bool found = false;
- for(int i = 0; i<num_arg; i++){
- if(strcmp(name, args[i].long_name) != 0)
- continue;
-
- found = true;
-
- const char * tmp;
- p.get(name, &tmp);
-
- int t = 1;
-
- switch(args[i].type){
- case arg_integer:{
- int val = atoi(tmp);
- if(args[i].value){
- *((int*)args[i].value) = val;
- }
- }
- break;
- case arg_string:
- if(args[i].value){
- *((const char**)args[i].value) = tmp;
- }
- break;
- case arg_negative_flag:
- t = 0;
- case arg_flag:
- if(args[i].value){
- if(!strcasecmp(tmp, "y") ||
- !strcasecmp(tmp, "on") ||
- !strcasecmp(tmp, "true") ||
- !strcasecmp(tmp, "1")){
- *((int*)args[i].value) = t;
- }
- if(!strcasecmp(tmp, "n") ||
- !strcasecmp(tmp, "off") ||
- !strcasecmp(tmp, "false") ||
- !strcasecmp(tmp, "0")){
- *((int*)args[i].value) = t;
- }
- }
- t = 1;
- break;
- case arg_strings:
- case arg_double:
- case arg_collect:
- case arg_counter:
- break;
- }
- }
- if(!found) {
- printf("Unknown parameter: %s\n", name);
- return 1;
- }
- }
- return 0;
-}
diff --git a/ndb/src/cw/cpcd/common.hpp b/ndb/src/cw/cpcd/common.hpp
index c3d87b8b9f5..4f5f702762f 100644
--- a/ndb/src/cw/cpcd/common.hpp
+++ b/ndb/src/cw/cpcd/common.hpp
@@ -19,7 +19,9 @@
#include <ndb_global.h>
#include <logger/Logger.hpp>
+#if 0
#include <getarg.h>
+#endif
extern int debug;
@@ -30,6 +32,5 @@ int insert(const char * pair, class Properties & p);
int insert_file(const char * filename, class Properties&);
int insert_file(FILE *, class Properties&, bool break_on_empty = false);
-int parse_config_file(struct getargs args[], int num_arg, const Properties& p);
#endif /* ! __CPCD_COMMON_HPP_INCLUDED__ */
diff --git a/ndb/src/cw/cpcd/main.cpp b/ndb/src/cw/cpcd/main.cpp
index 207b81bfa89..300b51d7b5a 100644
--- a/ndb/src/cw/cpcd/main.cpp
+++ b/ndb/src/cw/cpcd/main.cpp
@@ -15,13 +15,13 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h> /* Needed for mkdir(2) */
+#include <ndb_opts.h>
#include "CPCD.hpp"
#include "APIService.hpp"
#include <NdbMain.h>
#include <NdbSleep.h>
#include <BaseString.hpp>
-#include <getarg.h>
#include <logger/Logger.hpp>
#include <logger/FileLogHandler.hpp>
#include <logger/SysLogHandler.hpp>
@@ -29,28 +29,44 @@
#include "common.hpp"
static const char *work_dir = CPCD_DEFAULT_WORK_DIR;
-static int port = CPCD_DEFAULT_TCP_PORT;
-static int use_syslog = 0;
+static int port;
+static int use_syslog;
static const char *logfile = NULL;
static const char *config_file = CPCD_DEFAULT_CONFIG_FILE;
static const char *user = 0;
-static struct getargs args[] = {
- { "work-dir", 'w', arg_string, &work_dir,
- "Work directory", "directory" },
- { "port", 'p', arg_integer, &port,
- "TCP port to listen on", "port" },
- { "syslog", 'S', arg_flag, &use_syslog,
- "Log events to syslog", NULL},
- { "logfile", 'L', arg_string, &logfile,
- "File to log events to", "file"},
- { "debug", 'D', arg_flag, &debug,
- "Enable debug mode", NULL},
- { "config", 'c', arg_string, &config_file, "Config file", NULL },
- { "user", 'u', arg_string, &user, "Run as user", NULL }
+static struct my_option my_long_options[] =
+{
+ { "work-dir", 'w', "Work directory",
+ (gptr*) &work_dir, (gptr*) &work_dir, 0,
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
+ { "port", 'p', "TCP port to listen on",
+ (gptr*) &port, (gptr*) &port, 0,
+ GET_INT, REQUIRED_ARG, CPCD_DEFAULT_TCP_PORT, 0, 0, 0, 0, 0 },
+ { "syslog", 'S', "Log events to syslog",
+ (gptr*) &use_syslog, (gptr*) &use_syslog, 0,
+ GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
+ { "logfile", 'L', "File to log events to",
+ (gptr*) &logfile, (gptr*) &logfile, 0,
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
+ { "debug", 'D', "Enable debug mode",
+ (gptr*) &debug, (gptr*) &debug, 0,
+ GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
+ { "config", 'c', "Config file",
+ (gptr*) &config_file, (gptr*) &config_file, 0,
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
+ { "user", 'u', "Run as user",
+ (gptr*) &user, (gptr*) &user, 0,
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
-static const int num_args = sizeof(args) / sizeof(args[0]);
+static my_bool
+get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
+ char *argument)
+{
+ return 0;
+}
static CPCD * g_cpcd = 0;
#if 0
@@ -59,23 +75,16 @@ extern "C" static void sig_child(int signo, siginfo_t*, void*);
const char *progname = "ndb_cpcd";
-NDB_MAIN(ndb_cpcd){
- int optind = 0;
-
- if(getarg(args, num_args, argc, argv, &optind)) {
- arg_printusage(args, num_args, progname, "");
- exit(1);
- }
-
- Properties p;
- insert_file(config_file, p);
- if(parse_config_file(args, num_args, p)){
- ndbout_c("Invalid config file: %s", config_file);
- exit(1);
- }
+int main(int argc, char** argv){
+ int save_argc= argc;
+ char** save_argv= argv;
+ const char *load_default_groups[]= { "ndb_cpcd",0 };
+ MY_INIT(argv[0]);
- if(getarg(args, num_args, argc, argv, &optind)) {
- arg_printusage(args, num_args, progname, "");
+ load_defaults("ndb_cpcd",load_default_groups,&argc,&argv);
+ if (handle_options(&argc, &argv, my_long_options, get_one_option)) {
+ my_print_help(my_long_options);
+ my_print_variables(my_long_options);
exit(1);
}
diff --git a/ndb/src/external/LINUX.x86/sci/include/list.h b/ndb/src/external/LINUX.x86/sci/include/list.h
deleted file mode 100644
index 81c467a461b..00000000000
--- a/ndb/src/external/LINUX.x86/sci/include/list.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* $Id: list.h,v 1.1 2002/12/13 12:17:20 hin Exp $ */
-
-/*******************************************************************************
- * *
- * Copyright (C) 1993 - 2000 *
- * Dolphin Interconnect Solutions AS *
- * *
- * 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 _LIST_H
-#define _LIST_H
-#include "sci_types.h"
-
-
-typedef struct ListElement *ListElement_t;
-typedef struct List *List_t;
-
-struct ListElement {
- void *element;
- u_vkaddr_t key;
- ListElement_t prev,next;
-};
-
-void *Get_Element(ListElement_t el);
-void Set_Element(ListElement_t el,void *elptr,u_vkaddr_t key);
-void Create_Element(ListElement_t *el);
-void Destroy_Element(ListElement_t *el);
-void Create_List(List_t *list);
-void Destroy_List(List_t *list);
-void Add_Element(List_t list,ListElement_t el);
-void Remove_Element(List_t list,ListElement_t el);
-ListElement_t Find_Element(List_t list,u_vkaddr_t key);
-scibool List_Empty(List_t);
-scibool List_Elements(List_t);
-ListElement_t First_Element(List_t list);
-ListElement_t Last_Element(List_t list);
-ListElement_t Next_Element(ListElement_t el);
-
-#endif /* _LIST_H */
diff --git a/ndb/src/external/LINUX.x86/sci/include/os/inttypes.h b/ndb/src/external/LINUX.x86/sci/include/os/inttypes.h
deleted file mode 100644
index b9e5a6cb19f..00000000000
--- a/ndb/src/external/LINUX.x86/sci/include/os/inttypes.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* $Id: inttypes.h,v 1.1 2002/12/13 12:17:21 hin Exp $ */
-
-/*******************************************************************************
- * *
- * Copyright (C) 1993 - 2000 *
- * Dolphin Interconnect Solutions AS *
- * *
- * 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 _SCI_OS_INTTYPES_H_
-#define _SCI_OS_INTTYPES_H_
-
-/*
- * --------------------------------------------------------------------------------------
- * Basic types of various sizes.
- * --------------------------------------------------------------------------------------
- */
-typedef unsigned char unsigned8;
-typedef unsigned short unsigned16;
-typedef unsigned int unsigned32;
-typedef unsigned long long unsigned64;
-
-typedef signed char signed8;
-typedef signed short signed16;
-typedef signed int signed32;
-typedef signed long long signed64;
-
-
-#ifdef CPU_WORD_IS_64_BIT
-typedef unsigned64 uptr_t;
-typedef signed64 iptr_t;
-#else
-typedef unsigned32 uptr_t;
-typedef signed32 iptr_t;
-#endif
-
-#endif /* _SCI_OS_INTTYPES_H_ */
diff --git a/ndb/src/external/LINUX.x86/sci/include/rmlib.h b/ndb/src/external/LINUX.x86/sci/include/rmlib.h
deleted file mode 100644
index 9d2722e9798..00000000000
--- a/ndb/src/external/LINUX.x86/sci/include/rmlib.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/* $Id: rmlib.h,v 1.1 2002/12/13 12:17:20 hin Exp $ */
-
-/*********************************************************************************
- * *
- * Copyright (C) 1993 - 2000 *
- * Dolphin Interconnect Solutions AS *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU Lesser General Public License as published by *
- * the Free Software Foundation; either version 2.1 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 Lesser 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. *
- * *
- * *
- *********************************************************************************/
-
-/********************************************************************************/
-/* This header file contains the declarations of the SCI Reflective Memory */
-/* library rmlib. The implementation of the library functions is in rmlib.c. */
-/* The library contains all the functions that operate on the reflective */
-/* memory. */
-/* */
-/* NB! */
-/* */
-/* DOLPHIN'S SCI REFLECTIVE MEMORY FILES ARE UNDER DEVELOPMENT AND MAY CHANGE. */
-/* PLEASE CONTACT DOLPHIN FOR FURTHER INFORMATION. */
-/* */
-/* */
-/********************************************************************************/
-
-#include "sisci_error.h"
-#include "sisci_api.h"
-#include "sisci_demolib.h"
-#include "sisci_types.h"
-
-unsigned int seqerr, syncseqerr;
-
-#ifndef _RMLIB_H
-#define _RMLIB_H
-
-
-#if defined(_REENTRANT)
-
-#define _RMLIB_EXPAND_NAME(name) _RMLIB_MT_ ## name
-
-#else
-
-#define _RMLIB_EXPAND_NAME(name) _RMLIB_ST_ ## name
-
-#endif
-
-#ifdef __sparc
-#define CACHE_SIZE 2097152
-#else
-#define CACHE_SIZE 8192
-#endif
-
-/*********************************************************************************/
-/* FLAG VALUES */
-/*********************************************************************************/
-
-#define REFLECT_ERRCHECK 0x2
-
-struct ReflectiveMemorySpace {
- unsigned int localAdapterNo;
- unsigned int localNodeId;
- unsigned int remoteNodeId;
- sci_desc_t sd;
- sci_desc_t syncsd;
- sci_map_t localMap;
- sci_map_t remoteMap;
- unsigned int localSegmentId;
- unsigned int remoteSegmentId;
- unsigned int syncSegmentId;
- unsigned int sync_rSegmentId;
- unsigned int segmentSize;
- unsigned int *localMapAddr;
- volatile unsigned int *remoteMapAddr;
- sci_local_segment_t localSegment;
- sci_remote_segment_t remoteSegment;
- sci_local_segment_t syncSegment;
- sci_remote_segment_t sync_rSegment;
- sci_map_t syncMap;
- sci_map_t sync_rMap;
- sci_sequence_t syncsequence;
- sci_sequence_t sequence;
- unsigned int protection;
- unsigned int retry_value;
- sci_sequence_status_t sequenceStatus, syncsequenceStatus;
- volatile unsigned int *syncMapAddr;
- volatile unsigned int *sync_rMapAddr;
-};
-
-/*********************************************************************************/
-/* P R I N T R E F L E C T I V E M E M O R Y S P A C E */
-/* */
-/*********************************************************************************/
-#define ReflectPrintParameters _RMLIB_EXPAND_NAME(ReflectPrintParameters)
-void ReflectPrintParameters(FILE *stream, struct ReflectiveMemorySpace RM_space);
-
-/*********************************************************************************/
-/* R E F L E C T D M A S E T U P */
-/* */
-/*********************************************************************************/
-#define ReflectDmaSetup _RMLIB_EXPAND_NAME(ReflectDmaSetup)
-sci_error_t ReflectDmaSetup(struct ReflectiveMemorySpace RM_space, sci_dma_queue_t *dmaQueue);
-
-/*********************************************************************************/
-/* R E F L E C T D M A R E M O V E */
-/* */
-/*********************************************************************************/
-#define ReflectDmaRemove _RMLIB_EXPAND_NAME(ReflectDmaRemove)
-sci_error_t ReflectDmaRemove(sci_dma_queue_t dmaQueue);
-
-/*********************************************************************************/
-/* R E F L E C T D M A R U N */
-/* */
-/*********************************************************************************/
-#define ReflectDmaRun _RMLIB_EXPAND_NAME(ReflectDmaRun)
-sci_error_t ReflectDmaRun(struct ReflectiveMemorySpace RM_space,
- unsigned int* privateSrc,
- unsigned int size,
- unsigned int offset,
- sci_dma_queue_t dmaQueue);
-/*********************************************************************************/
-/* C L O S E R E F L E C T I V E M E M O R Y S P A C E */
-/* */
-/*********************************************************************************/
-#define ReflectClose _RMLIB_EXPAND_NAME(ReflectClose)
-sci_error_t ReflectClose(struct ReflectiveMemorySpace RM_space, unsigned int segment_no);
-
-/*********************************************************************************/
-/* O P E N R E F L E C T I V E M E M O R Y S P A C E */
-/* */
-/*********************************************************************************/
-#define ReflectOpen _RMLIB_EXPAND_NAME(ReflectOpen)
-sci_error_t ReflectOpen(struct ReflectiveMemorySpace *RM_space,
- unsigned int size,
- unsigned int segment_no,
- unsigned int localAdapterNo,
- unsigned int remoteNodeId,
- unsigned int protection,
- unsigned int retry_value);
-
-/*********************************************************************************/
-/* R E F L E C T G E T A C C E S S */
-/* */
-/*********************************************************************************/
-#define ReflectGetAccess _RMLIB_EXPAND_NAME(ReflectGetAccess)
-sci_error_t ReflectGetAccess(struct ReflectiveMemorySpace *RM_space);
-
-/*********************************************************************************/
-/* R E F L E C T R E L E A S E A C C E S S */
-/* */
-/*********************************************************************************/
-#define ReflectReleaseAccess _RMLIB_EXPAND_NAME(ReflectReleaseAccess)
-sci_error_t ReflectReleaseAccess(struct ReflectiveMemorySpace *RM_space);
-
-/*********************************************************************************/
-/* R E F L E C T D M A */
-/* */
-/*********************************************************************************/
-#define ReflectDma _RMLIB_EXPAND_NAME(ReflectDma)
-sci_error_t ReflectDma(struct ReflectiveMemorySpace RM_space,
- unsigned int* privateSrc,
- unsigned int size,
- unsigned int offset);
-
-/*********************************************************************************/
-/* R E F L E C T M E M C O P Y */
-/* */
-/*********************************************************************************/
-#define ReflectMemCopy _RMLIB_EXPAND_NAME(ReflectMemCopy)
-sci_error_t ReflectMemCopy(struct ReflectiveMemorySpace RM_space,
- unsigned int* privateSrc,
- unsigned int size,
- unsigned int offset,
- unsigned int flags);
-
-/*********************************************************************************/
-/* R E F L E C T S E T */
-/* */
-/*********************************************************************************/
-#define ReflectSet _RMLIB_EXPAND_NAME(ReflectSet)
-sci_error_t ReflectSet(struct ReflectiveMemorySpace RM_space,
- unsigned int value,
- unsigned int size,
- unsigned int offset,
- unsigned int flags
- );
-
-/*********************************************************************************/
-/* R E F L E C T P R I N T */
-/* */
-/*********************************************************************************/
-#define ReflectPrint _RMLIB_EXPAND_NAME(ReflectPrint)
-sci_error_t ReflectPrint(FILE *stream,
- struct ReflectiveMemorySpace RM_space,
- unsigned int size,
- unsigned int offset
- );
-
-
-#endif
diff --git a/ndb/src/external/LINUX.x86/sci/include/sci_errno.h b/ndb/src/external/LINUX.x86/sci/include/sci_errno.h
deleted file mode 100644
index 03f3256a86f..00000000000
--- a/ndb/src/external/LINUX.x86/sci/include/sci_errno.h
+++ /dev/null
@@ -1,216 +0,0 @@
-/* $Id: sci_errno.h,v 1.1 2002/12/13 12:17:20 hin Exp $ */
-
-/*******************************************************************************
- * *
- * Copyright (C) 1993 - 2000 *
- * Dolphin Interconnect Solutions AS *
- * *
- * 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 _SCI_ERRNO_H_
-#define _SCI_ERRNO_H_
-
-
-/*
- * SCI Error return values always have 30 bit set
- * Remote errors should have bit 0 set
- */
-#define SCI_ERR_MASK 0x40000000
-#define ESCI_REMOTE_MASK 0x01000000
-
-#define SCI_ERR(u) ((unsigned32)(u)&0x7FFFFFFF )
-#define _SCI_ERROR(x) ((x) | SCI_ERR_MASK)
-#define _SCI_REMOTE_ERROR(x) ( _SCI_ERROR(x) | ESCI_REMOTE_MASK )
-
-/*
- * Error codes
- */
-typedef enum {
- ESCI_OK = 0x000,
- ESCI_STILL_EXPORTED = _SCI_ERROR(0x800),
-
- ESCI_BUS_ERR = _SCI_ERROR(0x900),
- ESCI_PEND_SCIERR = _SCI_ERROR(0x901),
- ESCI_SCI_ERR = _SCI_ERROR(0x902),
-
- /*
- * Specific SCI error responses:
- */
- ESCI_SCI_ERR_DATA = _SCI_ERROR(0x9021),
- ESCI_SCI_ERR_TYPE = _SCI_ERROR(0x9022),
- ESCI_SCI_ERR_ADDR = _SCI_ERROR(0x9023),
-
- ESCI_LINK_TIMEOUT = _SCI_ERROR(0x903),
- ESCI_EXDEV_TIMEOUT = _SCI_ERROR(0x904),
- ESCI_REMOTE_ERR = _SCI_ERROR(0x905),
- ESCI_MBX_BUSY = _SCI_ERROR(0x906),
- ESCI_DMAERR = _SCI_ERROR(0x907),
- ESCI_DMA_DISABLED = _SCI_ERROR(0x908),
- ESCI_SW_MBX_SEND_FAILED = _SCI_ERROR(0x909),
- ESCI_HW_MBX_SEND_FAILED = _SCI_ERROR(0x90A),
- ESCI_HAS_NO_SESSION = _SCI_ERROR(0xA00),
- ESCI_CONNREFUSED_SESSION = _SCI_ERROR(0xA01),
- ESCI_SESSION_NOT_ESTABLISHED = _SCI_ERROR(0xA11),
- ESCI_REMOTE_NO_VALID_SESSION = _SCI_ERROR(0xA02),
- ESCI_SESSION_DISABLED = _SCI_ERROR(0xA03),
- ESCI_NODE_CLOSED = _SCI_ERROR(0xA04),
- ESCI_NODE_DISABLED = _SCI_ERROR(0xA05),
-
- ESCI_LOCAL_MASTER_ERR = _SCI_ERROR(0xA06),
- ESCI_REMOTE_MASTER_ERR = _SCI_REMOTE_ERROR(0xA06),
-
- ESCI_ILLEGAL_CMD_RECEIVED = _SCI_ERROR(0xA08),
- ESCI_ILLEGAL_CMD_SENT = _SCI_ERROR(0xA09),
-
- /* used above: ESCI_SESSION_NOT_ESTABLISHED = _SCI_ERROR(0xA11), */
-
- /*
- * Remote error codes
- */
- ESCI_CONNREFUSED = _SCI_ERROR(0xB00),
- ESCI_NODE_NOT_RESPONDING = _SCI_ERROR(0xB01),
- ESCI_ISCONN = _SCI_ERROR(0xB02),
- ESCI_HOSTUNREACH = _SCI_ERROR(0xB03),
- ESCI_NO_SUCH_USER_ID = _SCI_ERROR(0xB04),
- ESCI_REMOTE_NO_SUCH_USER_ID = _SCI_REMOTE_ERROR(0xB04), /* ESCI_NO_SUCH_USER_ID */
- ESCI_NO_SUCH_KEY = _SCI_ERROR(0xB04), /* ESCI_NO_SUCH_USER_ID */
- ESCI_REMOTE_NO_SUCH_KEY = _SCI_REMOTE_ERROR(0xB04), /* ESCI_REMOTE_NO_SUCH_USER_ID */
- ESCI_NODE_ERR = _SCI_ERROR(0xB06),
- ESCI_REMOTE_NODE_ERR = _SCI_REMOTE_ERROR(0xB06), /* ESCI_NODE_ERR */
- ESCI_NOSPC = _SCI_ERROR(0xB08),
- ESCI_REMOTE_NOSPC = _SCI_REMOTE_ERROR(0xB08), /* ESCI_NOSPC */
- ESCI_NODMASPC = _SCI_ERROR(0xB0A),
- ESCI_REMOTE_NODMASPC = _SCI_REMOTE_ERROR(0xB0A), /* ESCI_NODMASPC */
- ESCI_NOTMAP = _SCI_ERROR(0xC00),
- ESCI_ISMAP = _SCI_ERROR(0xC01),
- ESCI_NOT_INITIALIZED = _SCI_ERROR(0xD00),
- ESCI_REMOTE_NOT_INITIALIZED = _SCI_REMOTE_ERROR(ESCI_NOT_INITIALIZED),
- /*
- * ???
- */
- ESCI_PARAM_ERR = _SCI_ERROR(0xD01),
- ESCI_NO_FREE_VC = _SCI_ERROR(0xD02),
- ESCI_REMOTE_NO_FREE_VC = _SCI_REMOTE_ERROR(0xD02), /* ESCI_NO_FREE_VC */
-
- /*
- * Adapter state related error codes:
- */
- ESCI_SUSPENDED = _SCI_ERROR(0xD03),
- ESCI_NOT_SUSPENDED = _SCI_ERROR(0xD04),
- ESCI_NOT_READY = _SCI_ERROR(0xD05),
- ESCI_NOT_CONFIGURED = _SCI_ERROR(0xD06),
- ESCI_INVALID_ADAPTERID = _SCI_ERROR(0xD07), /* if an adapter-id is out of range */
- ESCI_NONEXIST_ADAPTERID = _SCI_ERROR(0xD08), /* if adapter-id is valid but no adapter matches */
- ESCI_ADAPTERID_INUSE = _SCI_ERROR(0xD09),
-
- ESCI_INVALID_INSTANCE = _SCI_ERROR(0xD0A),
- ESCI_NONEXIST_INSTANCE = _SCI_ERROR(0xD0B),
-
- ESCI_ADAPTER_INIT_FAILURE = _SCI_ERROR(0xD0C),
-
- ESCI_PAUSED = _SCI_ERROR(0xD0D),
- ESCI_NOT_PAUSED = _SCI_ERROR(0xD0E),
- ESCI_ADAPTER_NEED_RESET = _SCI_ERROR(0xD0F),
-
- ESCI_NONEXIST_SERIAL_NUMBER = _SCI_ERROR(0xD10),
- ESCI_NOT_AVAILABLE = _SCI_ERROR(0xD11),
-
- ESCI_EACCESS = _SCI_ERROR(0xD12),
-
- /*
- * Local error codes
- */
- ESCI_NO_LOCAL_ACCESS = _SCI_ERROR(0xE00),
- ESCI_LRESOURCE_BUSY = _SCI_ERROR(0xE01),
- ESCI_LRESOURCE_EXIST = _SCI_ERROR(0xE02),
- ESCI_NO_LRESOURCE = _SCI_ERROR(0xE03),
- ESCI_NOTCONN = _SCI_ERROR(0xE04),
- ESCI_LOCAL_ERR = _SCI_ERROR(0xE05),
- ESCI_NOVAL_NODEID = _SCI_ERROR(0xE06),
- ESCI_NOT_SUPPORTED = _SCI_ERROR(0xE07),
- ESCI_TIMEOUT = _SCI_ERROR(0xE08),
- ESCI_NO_LOCAL_LC_ACCESS = _SCI_ERROR(0xE0A),
- ESCI_INVALID_ATT = _SCI_ERROR(0xE0B),
- ESCI_BAD_CHECKSUM = _SCI_ERROR(0xE0C),
- ESCI_INTERRUPT_FLAG_DISABLED = _SCI_ERROR(0xE0D),
- ESCI_COND_INT_RACE_PROBLEM = _SCI_ERROR(0xE0E),
- ESCI_OVERFLOW = _SCI_ERROR(0xE0F),
- ESCI_BLINK_PARITY_ERROR = _SCI_ERROR(0xE10),
- ESCI_FIRMWARE_VERSION_MISMATCH = _SCI_ERROR(0xE11),
-
- /*
- * Link error codes
- */
- ESCI_NO_LINK_ACCESS = _SCI_ERROR(0xF00),
- ESCI_NO_REMOTE_LINK_ACCESS = _SCI_REMOTE_ERROR(0xF00), /* ESCI_NO_LINK_ACCESS */
-
- ESCI_NO_SUCH_NODE = _SCI_ERROR(0xF02),
- ESCI_USR_ACCESS_DISABLED = _SCI_ERROR(0xF03),
- ESCI_HW_AVOID_DEADLOCK = _SCI_ERROR(0xF04),
- ESCI_POTENTIAL_ERROR = _SCI_ERROR(0xF05),
-
- ESCI_FENCED = _SCI_ERROR(0xF06),
- ESCI_SWITCH_HW_FAILURE = _SCI_ERROR(0xF07),
- ESCI_SWITCH_WRONG_BLINK_ID = _SCI_ERROR(0xF08),
- ESCI_SWITCH_WRONG_PORT_NUMB = _SCI_ERROR(0xF09),
- ESCI_SWITCH_WRONG_INIT_TYPE = _SCI_ERROR(0xF0A), /* It is determined that the swith initialization
- * do not match the local adapter initialization
- */
- ESCI_SWITCH_WRONG_SWITCH_NUMB = _SCI_ERROR(0xF0B), /* It is determined that we are operationg on the
- * wrong switch port
- */
- ESCI_SWITCH_NOT_CONNECTED = _SCI_ERROR(0xF0C),
- ESCI_SWITCH_NOT_RECOGNIZED = _SCI_ERROR(0xF0D),
- ESCI_SWITCH_INIT_IN_PROGRESS = _SCI_ERROR(0xF0E), /* Switch TINI initialization in progress */
-
-
- ESCI_NO_BACKBONE_LINK_ACCESS = _SCI_ERROR(0xF20),
- ESCI_BACKBONE_FENCED = _SCI_ERROR(0xF21),
- ESCI_NO_BACKBONE_ACCESS = _SCI_ERROR(0xF22),
- ESCI_BACKBONE_CABLE_PROBLEM = _SCI_ERROR(0xF23),
- ESCI_BACKBONE_BLINK_PROBLEM = _SCI_ERROR(0xF24),
- ESCI_BACKBONE_HWINIT_PROBLEM = _SCI_ERROR(0xF25),
- ESCI_BACKBONE_ID_PROBLEM = _SCI_ERROR(0xF26),
- ESCI_BACKBONE_STATE_PROBLEM = _SCI_ERROR(0xF27),
- ESCI_BACKBONE_REQ_LINK_PROBLEM = _SCI_ERROR(0xF28),
- ESCI_BACKBONE_UNFENCING = _SCI_ERROR(0xF29), /* Unfencing in progress */
-
- /*
- * added for pci port
- */
- ESCI_AGAIN = _SCI_ERROR(0xF15),
- ESCI_ORANGE = _SCI_ERROR(0xF16), /* Out of range */
- ESCI_NOSYS = _SCI_ERROR(0xF17), /* Used instead of ENOSYS. Means function not implemented */
- ESCI_REMOTE_NOSYS = _SCI_REMOTE_ERROR(ESCI_NOSYS),
- ESCI_INTR = _SCI_ERROR(0xF18), /* Used instead of EINTR from sys/errno.h */
- ESCI_IO = _SCI_ERROR(0xF19), /* Used instead of EIO from sys/errno.h */
- ESCI_FAULT = _SCI_ERROR(0xF1A), /* Used instead of EFAULT from sys/errno.h */
- ESCI_BUSY = _SCI_ERROR(0xF1B), /* Used instead of EBUST from sys/errno.h */
- ESCI_INVAL = _SCI_ERROR(0xF1C), /* Used instead of EINVAL from sys/errno.h */
- ESCI_NXIO = _SCI_ERROR(0xF1D), /* Used instead of ENXIO from sys/errno.h */
- ESCI_EXIST = _SCI_ERROR(0xF1E) /* Used instead of EEXIST from sys/errno.h */
-
-} scierror_t;
-
-#endif /* _SCI_ERRNO_H_ */
-
-
-
-
diff --git a/ndb/src/external/LINUX.x86/sci/include/sci_types.h b/ndb/src/external/LINUX.x86/sci/include/sci_types.h
deleted file mode 100644
index 740b3a45cfd..00000000000
--- a/ndb/src/external/LINUX.x86/sci/include/sci_types.h
+++ /dev/null
@@ -1,300 +0,0 @@
-/* $Id: sci_types.h,v 1.1 2002/12/13 12:17:21 hin Exp $ */
-
-/*******************************************************************************
- * *
- * Copyright (C) 1993 - 2000 *
- * Dolphin Interconnect Solutions AS *
- * *
- * 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 _SCI_TYPES_H_
-#define _SCI_TYPES_H_
-
-/*
- * Remains for the time being for backward compatibility ....
- */
-
-/* #define UNIQUE(type) struct { type x; } * */
-#ifndef UNIQUE
-#define UNIQUE(type) type
-#endif
-#include "os/inttypes.h"
-
-#if defined(WIN32)
-#if defined(_KERNEL)
-#include <ntddk.h>
-#else
-#include <WTYPES.H>
-#endif /* _KERNEL */
-#else
-#if defined(Linux)
-#if defined(__KERNEL__)
-#include <linux/types.h>
-#else
-#include <sys/types.h>
-#endif
-#else
-#include <sys/types.h>
-#endif
-#ifdef SUNOS5
-#include <sys/ddi.h>
-#include <sys/sunddi.h>
-#endif
-#ifdef OS_IS_TRU64
-#include <io/common/devdriver.h>
-#endif
-#ifdef OS_IS_HP_UX11
-#if defined(_KERNEL)
-#include <../wsio/wsio.h>
-#else
-#include <sys/wsio.h>
-#endif
-#endif
-#endif
-
-/* See comments about "UNCONFIGURED_ADAPTERS" in config.h */
-#define UNCONFIGURED_ADAPTERS 100
-
-#ifndef FALSE
-#define FALSE 0
-#endif
-
-#ifndef TRUE
-#define TRUE 1
-#endif
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-#ifndef IN
-#define IN
-#endif
-
-#ifndef NOT
-#define NOT !
-#endif
-
-/*
- * --------------------------------------------------------------------------------------
- * Basic types of various sizes.
- * --------------------------------------------------------------------------------------
- */
-
-typedef signed32 scibool;
-#ifndef OS_IS_VXWORKS
-typedef signed32 BOOL;
-#else
-/* VXWORKS has already defined BOOL */
-#endif
-typedef unsigned32 node_t; /* This is the logical nodeid */
-typedef unsigned32 sciNodeId_t; /* This is the physical 16 bit SCI nodeid */
-
-/*
- * --------------------------------------------------------------------------------------
- * Various register types.
- * --------------------------------------------------------------------------------------
- */
-typedef volatile unsigned32 register32;
-
-
-/*
-Temporary for Windows NT, until we use only the above types.
-*/
-
-#ifdef WIN32
-
-typedef unsigned char u_char;
-typedef unsigned short u_short;
-typedef unsigned long u_long;
-typedef unsigned int u_int;
-typedef char * caddr_t;
-
-typedef long off_t;
-typedef unsigned int size_t;
-
-#endif
-#ifdef OS_IS_VXWORKS
-#include <vxWorks.h>
-#endif
-
-/*
- * --------------------------------------------------------------------------------------
- * Various address types.
- *
- * We are using a struct * instead of unsigned long (int) inorder to enforce strong
- * type checking
- *
- * --------------------------------------------------------------------------------------
- */
-typedef UNIQUE(void *) vkaddr_t; /* Virtual kernel address */
-typedef UNIQUE(uptr_t) vuaddr_t; /* Virtual user address */
-
-typedef UNIQUE(unsigned32) remaddr_t; /* Remote IO address (physical address on PCs) */
-typedef UNIQUE(unsigned32) sciofs_lo_t; /* Lower 32 bits of an SCI offset. */
-typedef UNIQUE(unsigned32) sciofs_hi_t; /* The upper 16 bits of an SCI offset. */
-
-typedef UNIQUE(unsigned32) ioaddr_t; /* Local IO address (physical address on PCs) */
-typedef unsigned32 u_ioaddr_t;
-typedef unsigned32 iooffset_t;
-typedef unsigned32 iosize_t;
-
-typedef uptr_t vkoffset_t;
-typedef uptr_t u_vkaddr_t;
-typedef uptr_t u_vuaddr_t;
-typedef unsigned32 u_sciofs_lo_t;
-typedef unsigned32 u_sciofs_hi_t;
-typedef unsigned32 u_remaddr_t;
-typedef unsigned32 attOffset_t; /* Address displacement from start of ATT entry */
-
-typedef unsigned32 adapterNo_t;
-
-typedef enum {
- NO_NODE = 0,
- AD_MEM_NODE = 1,
- AD_ALT_NODE = 2,
- AD_MBX_NODE = 3,
- AD_LC_NODE = 4,
- AD_LC_PORT_0 = 5,
- AD_LC_PORT_1 = 6,
- AD_LC_PORT_2 = 7,
- PHYS_NODE = 8
-} node_type_t;
-
-
-/*
- * Currently we don't support more than 32 bit sizes.
- */
-#define SIZEOF(x) ((unsigned32)sizeof(x))
-
-#if defined(_KERNEL)
-
-/*
- * --------------------------------------------------------------------------------------
- * Some small macros intended to ease the transition to more strongly typed address
- * types. The intention is that they in the long run shall be removed ...
- * --------------------------------------------------------------------------------------
- */
-#define P2SIZE_T(x) ((size_t)((uptr_t)(x))) /* Pointer to size_t */
-#define P2U32(x) ((unsigned32)((uptr_t)(x))) /* Pointer to Unsigned 32-bit int */
-#ifdef WIN32
-#define PHADDR(x) ((ioaddr_t)(x))
-#define HASV(x) (x)
-#endif
-#if 0
-static vkaddr_t VKPTR (void * ptr) { return (vkaddr_t)ptr; }
-static vkaddr_t VKADDR(volatile void * ptr) { return (vkaddr_t)ptr; }
-#else
-#define VKPTR(ptr) (vkaddr_t)ptr
-#define VKADDR(ptr) (vkaddr_t)ptr
-#endif
-
-#ifdef KLOG
-#define KLOG_LOG(n,m,v) ts_log((n),(m),(v))
-#else
-#define KLOG_LOG(n,m,v)
-#endif /* KLOG */
-
-
-/*
- * --------------------------------------------------------------------------------------
- *
- * M E M A R E A T
- *
- * Memory area descriptor.
- *
- * paddr -- Physical address (aligned) of memory area
- * ual_vaddr -- (Kernel )Virtual address of the unaligned memory area
- * vaddr -- (Kernel) Virtual address of memory area
- * rsize -- Real (Physical) Size of memory area
- * msize -- Mapped (Virtual) Size of memory area (Size of area mapped
- * into virtual) memory
- *
- * --------------------------------------
- * | | <----- msize ----->| |
- * |<------|------- rsize ------|------>|
- * --------------------------------------
- * /|\ /|\
- * | |
- * ual_vaddr vaddr/paddr
- *
- * --------------------------------------------------------------------------------------
- */
-struct _memarea_ {
- ioaddr_t ioaddr;
- vkaddr_t vaddr;
- vkaddr_t ual_vaddr;
- size_t rsize;
- size_t msize;
- char *id;
- unsigned32 cookie;
-
-
-#ifdef SUNOS5
-#ifdef _USE_NEW_SOLARIS_DDI_INTERFACE
- ddi_acc_handle_t mem_handle;
- ddi_dma_handle_t dma_handle;
-#else
- ddi_dma_handle_t handle;
-#endif
-#endif
-#ifdef OS_IS_TRU64
- dma_handle_t dma_handle;
-#endif
-
-#if OS_IS_LINUX
- unsigned long ph_base_addr;
-#endif
-
-#ifdef OS_IS_HP_UX11
- struct isc_table_type * isc;
- wsio_shmem_attr_t type;
-#endif
-};
-
-typedef struct _memarea_ memarea_t;
-
-#ifdef SCI_MALLOC_DEBUG
-struct _maddr_ {
- char *id;
- size_t size;
- struct _maddr_ *next;
- struct _maddr_ **prev;
- unsigned32 cookie;
-};
-
-typedef struct _maddr_ maddr_t;
-
-#define MALLOC_COOKIE 0xc3c3c3c3
-
-#else
-
-typedef struct { void *p; } *maddr_t;
-
-#endif /* SCI_MALLOC_DEBUG */
-
-
-typedef struct {
- scibool disabled;
- unsigned32 disable_cnt;
-} disable_info_t;
-
-#endif /* _KERNEL */
-
-#endif /* _SCI_TYPES_H_ */
diff --git a/ndb/src/external/LINUX.x86/sci/include/sisci_api.h b/ndb/src/external/LINUX.x86/sci/include/sisci_api.h
deleted file mode 100644
index 38fdf54125f..00000000000
--- a/ndb/src/external/LINUX.x86/sci/include/sisci_api.h
+++ /dev/null
@@ -1,2170 +0,0 @@
-/* $Id: sisci_api.h,v 1.1 2002/12/13 12:17:21 hin Exp $ */
-/*******************************************************************************
- * *
- * Copyright (C) 1993 - 2001 *
- * Dolphin Interconnect Solutions AS *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU Lesser General Public License as published by *
- * the Free Software Foundation; either version 2.1 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 Lesser 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 _SISCI_API_H
-#define _SISCI_API_H
-
-#include "sisci_types.h"
-#include "sisci_error.h"
-
-
-#ifdef WIN32
-#ifdef API_DLL
-#define DLL __declspec(dllexport)
-#elif CLIENT_DLL
-#define DLL __declspec(dllimport)
-#endif
-#endif /* WIN32 */
-
-
-#ifndef DLL
-#define DLL
-#endif
-
-#if defined(_REENTRANT)
-#define _SISCI_EXPANDE_FUNCTION_NAME(name) _SISCI_PUBLIC_FUNC_MT_ ## name
-#define _SISCI_EXPANDE_VARIABLE_NAME(name) _SISCI_PUBLIC_VAR_MT_ ## name
-#else
-#define _SISCI_EXPANDE_FUNCTION_NAME(name) _SISCI_PUBLIC_FUNC_ST_ ## name
-#define _SISCI_EXPANDE_VARIABLE_NAME(name) _SISCI_PUBLIC_VAR_ST_ ## name
-#endif
-#define _SISCI_EXPANDE_CONSTANT_NAME(name) _SISCI_PUBLIC_CONST_ ## name
-
-#if defined(CPLUSPLUS) || defined(__cplusplus)
-extern "C" {
-#endif
-
-
-/*********************************************************************************/
-/* FLAG VALUES */
-/*********************************************************************************/
-
-#define SCI_FLAG_FIXED_INTNO _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FIXED_INTNO)
-extern const unsigned int SCI_FLAG_FIXED_INTNO;
-
-#define SCI_FLAG_SHARED_INT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_SHARED_INT)
-extern const unsigned int SCI_FLAG_SHARED_INT;
-
-#define SCI_FLAG_FIXED_MAP_ADDR _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FIXED_MAP_ADDR)
-extern const unsigned int SCI_FLAG_FIXED_MAP_ADDR;
-
-#define SCI_FLAG_READONLY_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_READONLY_MAP)
-extern const unsigned int SCI_FLAG_READONLY_MAP;
-
-#define SCI_FLAG_USE_CALLBACK _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_USE_CALLBACK)
-extern const unsigned int SCI_FLAG_USE_CALLBACK;
-
-#define SCI_FLAG_BLOCK_READ _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_BLOCK_READ)
-extern const unsigned int SCI_FLAG_BLOCK_READ;
-
-#define SCI_FLAG_THREAD_SAFE _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_THREAD_SAFE)
-extern const unsigned int SCI_FLAG_THREAD_SAFE;
-
-#define SCI_FLAG_ASYNCHRONOUS_CONNECT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_ASYNCHRONOUS_CONNECT)
-extern const unsigned int SCI_FLAG_ASYNCHRONOUS_CONNECT;
-
-#define SCI_FLAG_EMPTY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_EMPTY)
-extern const unsigned int SCI_FLAG_EMPTY;
-
-#define SCI_FLAG_PRIVATE _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_PRIVATE)
-extern const unsigned int SCI_FLAG_PRIVATE;
-
-#define SCI_FLAG_FORCE_DISCONNECT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FORCE_DISCONNECT)
-extern const unsigned int SCI_FLAG_FORCE_DISCONNECT;
-
-#define SCI_FLAG_NOTIFY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_NOTIFY)
-extern const unsigned int SCI_FLAG_NOTIFY;
-
-#define SCI_FLAG_DMA_READ _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_READ)
-extern const unsigned int SCI_FLAG_DMA_READ;
-
-#define SCI_FLAG_DMA_POST _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_POST)
-extern const unsigned int SCI_FLAG_DMA_POST;
-
-#define SCI_FLAG_DMA_WAIT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_WAIT)
-extern const unsigned int SCI_FLAG_DMA_WAIT;
-
-#define SCI_FLAG_DMA_RESET _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_RESET)
-extern const unsigned int SCI_FLAG_DMA_RESET;
-
-#define SCI_FLAG_NO_FLUSH _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_NO_FLUSH)
-extern const unsigned int SCI_FLAG_NO_FLUSH;
-
-#define SCI_FLAG_NO_STORE_BARRIER _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_NO_STORE_BARRIER)
-extern const unsigned int SCI_FLAG_NO_STORE_BARRIER;
-
-#define SCI_FLAG_FAST_BARRIER _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FAST_BARRIER)
-extern const unsigned int SCI_FLAG_FAST_BARRIER;
-
-#define SCI_FLAG_ERROR_CHECK _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_ERROR_CHECK)
-extern const unsigned int SCI_FLAG_ERROR_CHECK;
-
-#define SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY)
-extern const unsigned int SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY;
-
-/* the FLUSH_CPU_BUFFERS_ONLY flag is for backwards compabillity only and should never be used */
-#define FLUSH_CPU_BUFFERS_ONLY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY)
-
-#define SCI_FLAG_LOCK_OPERATION _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_LOCK_OPERATION)
-extern const unsigned int SCI_FLAG_LOCK_OPERATION;
-
-#define SCI_FLAG_READ_PREFETCH_AGGR_HOLD_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_READ_PREFETCH_AGGR_HOLD_MAP)
-extern const unsigned int SCI_FLAG_READ_PREFETCH_AGGR_HOLD_MAP;
-
-#define SCI_FLAG_READ_PREFETCH_NO_HOLD_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_READ_PREFETCH_NO_HOLD_MAP)
-extern const unsigned int SCI_FLAG_READ_PREFETCH_NO_HOLD_MAP;
-
-#define SCI_FLAG_IO_MAP_IOSPACE _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_IO_MAP_IOSPACE)
-extern const unsigned int SCI_FLAG_IO_MAP_IOSPACE;
-
-#define SCI_FLAG_DMOVE_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMOVE_MAP)
-extern const unsigned int SCI_FLAG_DMOVE_MAP;
-
-#define SCI_FLAG_WRITES_DISABLE_GATHER_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_WRITES_DISABLE_GATHER_MAP)
-extern const unsigned int SCI_FLAG_WRITES_DISABLE_GATHER_MAP;
-
-#define SCI_FLAG_DISABLE_128_BYTES_PACKETS _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DISABLE_128_BYTES_PACKETS)
-extern const unsigned int SCI_FLAG_DISABLE_128_BYTES_PACKETS;
-
-#define SCI_FLAG_SHARED_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_SHARED_MAP)
-extern const unsigned int SCI_FLAG_SHARED_MAP;
-
-#define SCI_FLAG_DMA_SOURCE_ONLY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_SOURCE_ONLY)
-extern const unsigned int SCI_FLAG_DMA_SOURCE_ONLY;
-
-#define SCI_FLAG_CONDITIONAL_INTERRUPT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_CONDITIONAL_INTERRUPT)
-extern const unsigned int SCI_FLAG_CONDITIONAL_INTERRUPT;
-
-#define SCI_FLAG_CONDITIONAL_INTERRUPT_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_CONDITIONAL_INTERRUPT_MAP)
-extern const unsigned int SCI_FLAG_CONDITIONAL_INTERRUPT_MAP;
-
-#define SCI_FLAG_UNCONDITIONAL_DATA_INTERRUPT_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_UNCONDITIONAL_DATA_INTERRUPT_MAP)
-extern const unsigned int SCI_FLAG_UNCONDITIONAL_DATA_INTERRUPT_MAP;
-
-#define SCI_FLAG_NO_MEMORY_LOOPBACK_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_NO_MEMORY_LOOPBACK_MAP)
-extern const unsigned int SCI_FLAG_NO_MEMORY_LOOPBACK_MAP;
-
-#if defined(OS_IS_LYNXOS) || defined(OS_IS_VXWORKS)
-#define SCI_FLAG_WRITE_BACK_CACHE_MAP _SISCI_EXPANDE_CONSTANT_NAME(WRITE_BACK_CACHE_MAP)
-extern const unsigned int SCI_FLAG_WRITE_BACK_CACHE_MAP;
-#endif
-
-#define SCI_FLAG_DMA_PHDMA _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_PHDMA)
-extern const unsigned int SCI_FLAG_DMA_PHDMA;
-
-/*********************************************************************************/
-/* GENERAL VALUES */
-/*********************************************************************************/
-#define SCI_LOCAL_HOST _SISCI_EXPANDE_CONSTANT_NAME(SCI_LOCAL_HOST)
-extern const unsigned int SCI_LOCAL_HOST;
-
-#define SCI_INFINITE_TIMEOUT _SISCI_EXPANDE_CONSTANT_NAME(SCI_INFINITE_TIMEOUT)
-extern const unsigned int SCI_INFINITE_TIMEOUT;
-
-/*********************************************************************************/
-/* GENERAL ERROR CODES */
-/* */
-/* SCI_ERR_ILLEGAL_FLAG - Illegal flag value. */
-/* SCI_ERR_FLAG_NOT_IMPLEMENTED - Flag legal but flag feature not implemented. */
-/* SCI_ERR_NOT_IMPLEMENTED - Function not implemented. */
-/* SCI_ERR_SYSTEM - A system error. Check errno. */
-/* SCI_ERR_NOSPC - Unable to allocate OS resources. */
-/* SCI_ERR_API_NOSPC - Unable to allocate API resources. */
-/* SCI_ERR_HW_NOSPC - Unable to allocate HW resources (Hardware) */
-/* */
-/*********************************************************************************/
-
-
-/*********************************************************************************/
-/* GENERAL "ADAPTER" ERROR CODES */
-/* */
-/* SCI_ERR_NO_SUCH_ADAPTERNO - Adapter number is legal but does not exist. */
-/* SCI_ERR_ILLEGAL_ADAPTERNO - Illegal local adapter number (i.e. outside */
-/* legal range). */
-/* */
-/*********************************************************************************/
-
-
-/*********************************************************************************/
-/* GENERAL "NODEID" ERROR CODES */
-/* */
-/* SCI_ERR_NO_SUCH_NODEID - The remote adapter identified by nodeId does */
-/* not respond, but the intermediate link(s) */
-/* seem(s) to be operational. */
-/* SCI_ERR_ILLEGAL_NODEID - Illegal NodeId. */
-/* */
-/*********************************************************************************/
-
-
-
-/*********************************************************************************
- * *
- * S C I I N I T I A L I Z E *
- * *
- * This function initializes the SISCI library. *
- * The function must be called before SCIOpen(). *
- * *
- * Flags: *
- * None *
- * *
- * Specific error codes for this function: *
- * *
- * None *
- * *
- *********************************************************************************/
-#define SCIInitialize _SISCI_EXPANDE_FUNCTION_NAME(SCIInitialize)
-DLL void SCIInitialize(unsigned int flags,
- sci_error_t *error);
-#if 0
-unsigned int __Internal_SISCI_version_var;
-#endif
-
-/*********************************************************************************
- * *
- * S C I T E R M I N A T E *
- * *
- * This function terminates the SISCI library. *
- * The function must be called after SCIClose(). *
- * *
- * *
- *********************************************************************************/
-#define SCITerminate _SISCI_EXPANDE_FUNCTION_NAME(SCITerminate)
-DLL void SCITerminate(void);
-
-/*********************************************************************************
- * *
- * S C I O P E N *
- * *
- * *
- * Opens a SCI virtual device. *
- * Caller must supply a pointer to a variable of type sci_desc_t to be *
- * initialized. *
- * *
- * Flags *
- * SCI_FLAG_THREAD_SAFE - Operations on resources associated with this *
- * descriptor will be performed in a multithread-safe *
- * manner. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_INCONSISTENT_VERSIONS - Inconsistency between the SISCI library *
- * and the SISCI driver versions. *
- * *
- * *
- *********************************************************************************/
-#define SCIOpen _SISCI_EXPANDE_FUNCTION_NAME(SCIOpen)
-DLL void SCIOpen(sci_desc_t *sd,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C L O S E *
- * *
- * This function closes an open SCI virtual device. *
- * *
- * Flags: *
- * None *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_BUSY - All resources are not deallocated. *
- * *
- *********************************************************************************/
-#define SCIClose _SISCI_EXPANDE_FUNCTION_NAME(SCIClose)
-DLL void SCIClose(sci_desc_t sd,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C O N N E C T S E G M E N T *
- * *
- * Connects to a remote shared memory segment located at <nodeId> with the *
- * identifier <segmentId>. *
- * The user may then call SCIMapRemoteSegment() to map shared memory *
- * into user space. *
- * *
- * Flags *
- * SCI_FLAG_USE_CALLBACK *
- * SCI_FLAG_ASYNCHRONOUS_CONNECT *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_NO_SUCH_SEGMENT - Could not find the remote segment with the *
- * given segmentId. *
- * SCI_ERR_CONNECTION_REFUSED - Connection attempt refused by remote node. *
- * SCI_ERR_TIMEOUT - The function timed out after specified *
- * timeout value. *
- * SCI_ERR_NO_LINK_ACCESS - It was not possible to communicate via the *
- * local adapter. *
- * SCI_ERR_NO_REMOTE_LINK_ACCESS - It was not possible to communicate via a *
- * remote switch port. *
- * *
- *********************************************************************************/
-#define SCIConnectSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIConnectSegment)
-DLL void SCIConnectSegment(sci_desc_t sd,
- sci_remote_segment_t *segment,
- unsigned int nodeId,
- unsigned int segmentId,
- unsigned int localAdapterNo,
- sci_cb_remote_segment_t callback,
- void *callbackArg,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-/*********************************************************************************
- * *
- * S C I D I S C O N N E C T S E G M E N T *
- * *
- * Disconnects from the give mapped shared memory segment *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_BUSY - The segment is currently mapped or in use. *
- * *
- *********************************************************************************/
-#define SCIDisconnectSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIDisconnectSegment)
-DLL void SCIDisconnectSegment(sci_remote_segment_t segment,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I G E T R E M O T E S E G M E N T S I Z E *
- * *
- *********************************************************************************/
-#define SCIGetRemoteSegmentSize _SISCI_EXPANDE_FUNCTION_NAME(SCIGetRemoteSegmentSize)
-DLL unsigned int SCIGetRemoteSegmentSize(sci_remote_segment_t segment);
-
-
-
-/*********************************************************************************
- * *
- * S C I W A I T F O R R E M O T E S E G M E N T E V E N T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_TIMEOUT - The function timed out after specified *
- * timeout value. *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation. *
- * SCI_ERR_CANCELLED - The wait operation has been cancelled du *
- * to a SCIDisconnectSegment() on the same *
- * handle. The handle is invalid when this *
- * error is returned. *
- * *
- *********************************************************************************/
-#define SCIWaitForRemoteSegmentEvent _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForRemoteSegmentEvent)
-DLL sci_segment_cb_reason_t SCIWaitForRemoteSegmentEvent(
- sci_remote_segment_t segment,
- sci_error_t *status,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I M A P R E M O T E S E G M E N T *
- * *
- * This function is used to include a shared memory segment in the virtual *
- * address space of the application. *
- * *
- * Flags: *
- * *
- * SCI_FLAG_SHARED_MAP - The low level physical map may be shared by *
- * other applications. *
- * *
- * SCI_FLAG_FIXED_MAP_ADDR - Map at the suggested virtual address *
- * SCI_FLAG_READONLY_MAP - The segment is mapped in read-only mode *
- * SCI_FLAG_LOCK_OPERATION - Enable Lock operations (fetch and add) *
- * SCI_FLAG_READ_PREFETCH_AGGR_HOLD_MAP *
- * - Enable aggressive prefetch with speculative *
- * hold. *
- * *
- * SCI_FLAG_READ_PREFETCH_NO_HOLD_MAP *
- * - The PSB66 will prefetch 64 bytes. As soon *
- * as the PCI read retry has been accepted, *
- * the stream will change state to FREE, even *
- * if less than 64 bytes were actually read. *
- * *
- * SCI_FLAG_IO_MAP_IOSPACE - Enable No Prefetch, no speculative hold. *
- * *
- * SCI_FLAG_DMOVE_MAP - Enable DMOVE packet type. The stream will be *
- * set into FREE state immediately. *
- * *
- * SCI_FLAG_WRITES_DISABLE_GATHER_MAP *
- * - Disable use of gather. *
- * *
- * SCI_FLAG_DISABLE_128_BYTES_PACKETS *
- * - Disable use of 128-Byte packets *
- * *
- * SCI_FLAG_CONDITIONAL_INTERRUPT_MAP *
- * - Write operations through this map will cause *
- * an atomic "fetch-and-add-one" operation on *
- * remote memory, but in addition an interrupt *
- * will be generated if the target memory *
- * location contained a "null value" before the *
- * add operation was carried out. *
- * The conditional interrupt flag must also be *
- * specified in the SCIRegisterInterruptFlag() *
- * function. *
- * *
- * SCI_FLAG_UNCONDITIONAL_INTERRUPT_MAP *
- * - Write operations through this map will cause *
- * an interrupt for the remote adapter *
- * "in addition to" updating the corresponding *
- * remote memory location with the data being *
- * written. *
- * The unconditional interrupt flag must also *
- * be specified in the *
- * SCIRegisterInterruptFlag() function. *
- * *
- * SCI_FLAG_WRITE_BACK_CACHE_MAP *
- * - Enable cacheing of the mapped region. *
- * Writes through this map will be written to a *
- * write back cache, hence no remote SCI updates*
- * until the cache line is flushed. The *
- * application is responsible for the cache *
- * flush operation. *
- * The SCImemCopy() function will handle this *
- * correctly by doing cache flushes internally. *
- * This feature is architechture dependent and *
- * not be available on all plattforms. *
- * *
- * SCI_FLAG_NO_MEMORY_LOOPBACK_MAP *
- * - Forces a map to a remote segment located *
- * in the local machine to be mapped using *
- * SCI loopback. This is useful i.e. if you *
- * want to use a regular map access to be *
- * serialized with lock operations. *
- * The default behaviour is to access a remte *
- * segment located in the local machine as a *
- * local MMU operation. *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the offset and size is *
- * larger than the segment size. *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as *
- * required by the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as *
- * required by the implementation. *
- * *
- *********************************************************************************/
-#define SCIMapRemoteSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIMapRemoteSegment)
-DLL volatile void *SCIMapRemoteSegment(
- sci_remote_segment_t segment,
- sci_map_t *map,
- unsigned int offset,
- unsigned int size,
- void *addr,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I M A P L O C A L S E G M E N T *
- * *
- * Flags *
- * *
- * SCI_FLAG_FIXED_MAP_ADDR *
- * SCI_FLAG_READONLY_MAP *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the offset and size is *
- * larger than the segment size. *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as *
- * required by the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as *
- * required by the implementation. *
- * *
- *********************************************************************************/
-#define SCIMapLocalSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIMapLocalSegment)
-DLL void *SCIMapLocalSegment(sci_local_segment_t segment,
- sci_map_t *map,
- unsigned int offset,
- unsigned int size,
- void *addr,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I U N M A P S E G M E N T *
- * *
- * This function unmaps pages of shared memory from the callers virtual *
- * address space. *
- * *
- * Flags *
- * None. *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_BUSY - The map is currently in use. *
- * *
- *********************************************************************************/
-#define SCIUnmapSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIUnmapSegment)
-DLL void SCIUnmapSegment(sci_map_t map,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C R E A T E S E G M E N T *
- * *
- * Make the specified segment available for connections via the specified *
- * adapter. If successful, the segment can be accessed from remote nodes *
- * via the specified adapter. *
- * *
- * Flags: *
- * *
- * SCI_FLAG_USE_CALLBACK - The callback function will be invoked for events *
- * on this segment. *
- * SCI_FLAG_EMPTY - No memory will be allocated for the segment. *
- * SCI_FLAG_PRIVATE - The segment will be private meaning it will never *
- * be any connections to it. *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_SEGMENTID_USED - The segment with this segmentId is already used *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required *
- * by the implementation. *
- * *
- *********************************************************************************/
-#define SCICreateSegment _SISCI_EXPANDE_FUNCTION_NAME(SCICreateSegment)
-DLL void SCICreateSegment(sci_desc_t sd,
- sci_local_segment_t *segment,
- unsigned int segmentId,
- unsigned int size,
- sci_cb_local_segment_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I W A I T F O R L O C A L S E G M E N T E V E N T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_TIMEOUT - The function timed out after specified timeout value. *
- * SCI_ERR_CANCELLED - The wait operation has been cancelled du to a *
- * SCIRemoveSegment() on the same handle. *
- * The handle is invalid when this error is returned. *
- * *
- *********************************************************************************/
-#define SCIWaitForLocalSegmentEvent _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForLocalSegmentEvent)
-DLL sci_segment_cb_reason_t SCIWaitForLocalSegmentEvent(
- sci_local_segment_t segment,
- unsigned int *sourcenodeId,
- unsigned int *localAdapterNo,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I P R E P A R E S E G M E N T *
- * *
- * Flags *
- * *
- * SCI_FLAG_DMA_SOURCE_ONLY - The segment will be used as a source segment *
- * for DMA operations. On some system types this *
- * will enable the SISCI driver to use performance *
- * improving features. *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIPrepareSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIPrepareSegment)
-DLL void SCIPrepareSegment(sci_local_segment_t segment,
- unsigned int localAdapterNo,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I R E M O V E S E G M E N T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_BUSY - Unable to remove the segment. The segment is currently *
- * in use. *
- * *
- *********************************************************************************/
-#define SCIRemoveSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIRemoveSegment)
-DLL void SCIRemoveSegment(sci_local_segment_t segment,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I S E T S E G M E N T A V A I L A B L E *
- * *
- * Flags *
- * None. *
- * *
- * *
- * SCI_ERR_SEGMENT_NOT_PREPARED - The segment has not been prepared for access *
- * from this adapter. *
- * SCI_ERR_ILLEGAL_OPERATION - The segment is created with the *
- * SCI_FLAG_PRIVATE flag specified and *
- * therefore has no segmentId. *
- * *
- *********************************************************************************/
-#define SCISetSegmentAvailable _SISCI_EXPANDE_FUNCTION_NAME(SCISetSegmentAvailable)
-DLL void SCISetSegmentAvailable(sci_local_segment_t segment,
- unsigned int localAdapterNo,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I S E T S E G M E N T U N A V A I L A B L E *
- * *
- * Flags *
- * *
- * SCI_FLAG_FORCE_DISCONNECT *
- * SCI_FLAG_NOTIFY *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation. *
- * *
- *********************************************************************************/
-#define SCISetSegmentUnavailable _SISCI_EXPANDE_FUNCTION_NAME(SCISetSegmentUnavailable)
-DLL void SCISetSegmentUnavailable(sci_local_segment_t segment,
- unsigned int localAdapterNo,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C R E A T E M A P S E Q U E N C E *
- * *
- * Flags: *
- * *
- * SCI_FLAG_FAST_BARRIER *
- * *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCICreateMapSequence _SISCI_EXPANDE_FUNCTION_NAME(SCICreateMapSequence)
-DLL void SCICreateMapSequence(sci_map_t map,
- sci_sequence_t *sequence,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I R E M O V E S E Q U E N C E *
- * *
- * Flags: *
- * None *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCIRemoveSequence _SISCI_EXPANDE_FUNCTION_NAME(SCIRemoveSequence)
-DLL void SCIRemoveSequence(sci_sequence_t sequence,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I S T A R T S E Q U E N C E *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIStartSequence _SISCI_EXPANDE_FUNCTION_NAME(SCIStartSequence)
-DLL sci_sequence_status_t SCIStartSequence(sci_sequence_t sequence,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I C H E C K S E Q U E N CE *
- * *
- * Flags *
- * *
- * SCI_FLAG_NO_FLUSH *
- * SCI_FLAG_NO_STORE_BARRIER *
- * *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCICheckSequence _SISCI_EXPANDE_FUNCTION_NAME(SCICheckSequence)
-DLL sci_sequence_status_t SCICheckSequence(sci_sequence_t sequence,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I S T O R E B A R R I E R *
- * *
- * Flags *
- * None. *
- * *
- * *
- * *
- *********************************************************************************/
-#define SCIStoreBarrier _SISCI_EXPANDE_FUNCTION_NAME(SCIStoreBarrier)
-DLL void SCIStoreBarrier(sci_sequence_t sequence,
- unsigned int flags);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I F L U S H R E A D B U F F E R S *
- * *
- *********************************************************************************/
-#define SCIFlushReadBuffers _SISCI_EXPANDE_FUNCTION_NAME(SCIFlushReadBuffers)
-DLL void SCIFlushReadBuffers(sci_sequence_t sequence);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I P R O B E N O D E *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_NO_LINK_ACCESS - It was not possible to communicate via the *
- * local adapter. *
- * SCI_ERR_NO_REMOTE_LINK_ACCESS - It was not possible to communicate via a *
- * remote switch port. *
- * *
- *********************************************************************************/
-#define SCIProbeNode _SISCI_EXPANDE_FUNCTION_NAME(SCIProbeNode)
-DLL int SCIProbeNode(sci_desc_t sd,
- unsigned int localAdapterNo,
- unsigned int nodeId,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I G E T C S R R E G I S T E R *
- * *
- * SISCI Priveleged function *
- * *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_NO_LINK_ACCESS - It was not possible to communicate via the *
- * local adapter. *
- * SCI_ERR_NO_REMOTE_LINK_ACCESS - It was not possible to communicate via a *
- * remote switch port. *
- * *
- *********************************************************************************/
-#define SCIGetCSRRegister _SISCI_EXPANDE_FUNCTION_NAME(SCIGetCSRRegister)
-DLL unsigned int SCIGetCSRRegister(sci_desc_t sd,
- unsigned int localAdapterNo,
- unsigned int SCINodeId,
- unsigned int CSROffset,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I S E T C S R R E G I S T E R *
- * *
- * SISCI Priveleged function *
- * *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_NO_LINK_ACCESS - It was not possible to communicate via the *
- * local adapter. *
- * SCI_ERR_NO_REMOTE_LINK_ACCESS - It was not possible to communicate via a *
- * remote switch port. *
- * *
- *********************************************************************************/
-#define SCISetCSRRegister _SISCI_EXPANDE_FUNCTION_NAME(SCISetCSRRegister)
-DLL void SCISetCSRRegister(sci_desc_t sd,
- unsigned int localAdapterNo,
- unsigned int SCINodeId,
- unsigned int CSROffset,
- unsigned int CSRValue,
- unsigned int flags,
- sci_error_t *error);
-
-
-/*********************************************************************************
- * *
- * S C I G E T L O C A L C S R *
- * *
- * SISCI Priveleged function *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIGetLocalCSR _SISCI_EXPANDE_FUNCTION_NAME(SCIGetLocalCSR)
-DLL unsigned int SCIGetLocalCSR(sci_desc_t sd,
- unsigned int localAdapterNo,
- unsigned int CSROffset,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I S E T L O C A L C S R *
- * *
- * SISCI Priveleged function
- *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCISetLocalCSR _SISCI_EXPANDE_FUNCTION_NAME(SCISetLocalCSR)
-DLL void SCISetLocalCSR(sci_desc_t sd,
- unsigned int localAdapterNo,
- unsigned int CSROffset,
- unsigned int CSRValue,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I A T T A C H P H Y S I C A L M E M O R Y *
- * *
- * SISCI Priveleged function *
- * *
- * Description: *
- * *
- * This function enables usage of physical devices and memory regions where the *
- * Physical PCI bus address ( and mapped CPU address ) are already known. *
- * The function will register the physical memory as a SISCI segment which can *
- * be connected and mapped as a regular SISCI segment. *
- * *
- * Requirements: *
- * *
- * SCICreateSegment() with flag SCI_FLAG_EMPTY must have been called in advance *
- * *
- * Parameter description: *
- * sci_ioaddr_t ioaddress : This is the address on the PCI bus that a PCI bus *
- * master has to use to write to the specified memory *
- * void * address : This is the (mapped) virtual address that the *
- * application has to use to access the device. *
- * This means that the device has to be mapped in *
- * advance bye the devices own driver. *
- * If the device is not to be accessed by the local *
- * CPU, the address pointer shold be set to NULL *
- * Flags *
- * *
- * None *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIAttachPhysicalMemory _SISCI_EXPANDE_FUNCTION_NAME(SCIAttachPhysicalMemory)
-DLL void SCIAttachPhysicalMemory(sci_ioaddr_t ioaddress,
- void *address,
- unsigned int busNo,
- unsigned int size,
- sci_local_segment_t segment,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I Q U E R Y *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_QUERY - Unrecognized command. *
- * *
- *********************************************************************************/
-#define SCIQuery _SISCI_EXPANDE_FUNCTION_NAME(SCIQuery)
-DLL void SCIQuery(unsigned int command,
- void *data,
- unsigned int flags,
- sci_error_t *error);
-
-
-/* MAJOR QUERY COMMANDS */
-
-/* This command requires a pointer to a structure of type */
-/* "sci_query_string". The string will be filled in by the query. */
-#define SCI_Q_VENDORID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_VENDORID)
-extern const unsigned int SCI_Q_VENDORID;
-
-
-/* Same as for SCI_VENDOR_ID */
-#define SCI_Q_API _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_API)
-extern const unsigned int SCI_Q_API;
-
-
-/* User passes a pointer to an allocated object of the */
-/* "sci_query_adapter" struct. */
-#define SCI_Q_ADAPTER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER)
-extern const unsigned int SCI_Q_ADAPTER;
-
-
-/* User passes a pointer to an allocated object of the */
-/* "sci_query_system" struct. */
-#define SCI_Q_SYSTEM _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SYSTEM)
-extern const unsigned int SCI_Q_SYSTEM;
-
-#define SCI_Q_LOCAL_SEGMENT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_LOCAL_SEGMENT)
-extern const unsigned int SCI_Q_LOCAL_SEGMENT;
-
-#define SCI_Q_REMOTE_SEGMENT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_REMOTE_SEGMENT)
-extern const unsigned int SCI_Q_REMOTE_SEGMENT;
-
-#define SCI_Q_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_MAP)
-extern const unsigned int SCI_Q_MAP;
-
-typedef struct {
- char *str; /* Pointer to a string of minimum "length" characters */
- unsigned int length;
-} sci_query_string_t;
-
-
-typedef struct {
- unsigned int localAdapterNo; /* The adapter no. that the query concern. */
- unsigned int portNo; /* The SCI Link port number that the query concern. */
- unsigned int subcommand; /* A subcommand as specified below. */
- void *data; /* A pointer to an unsigned int that will return */
- /* the response to the query. */
-} sci_query_adapter_t;
-
-
-typedef struct {
- unsigned int subcommand; /* A subcommand as specified below. */
- void *data; /* A pointer to an unsigned int that will return */
- /* the response to the query. */
-} sci_query_system_t;
-
-typedef struct {
- sci_local_segment_t segment;
- unsigned int subcommand;
- union {
- sci_ioaddr_t ioaddr;
- } data;
-} sci_query_local_segment_t;
-
-typedef struct {
- sci_remote_segment_t segment;
- unsigned int subcommand;
- union {
- sci_ioaddr_t ioaddr;
- } data;
-} sci_query_remote_segment_t;
-
-typedef struct {
- sci_map_t map;
- unsigned int subcommand;
- unsigned int data;
-} sci_query_map_t;
-
-/* Minor query commands (sub-commands) for adapter specific information SCI_ADAPTER */
-#define SCI_Q_ADAPTER_DMA_SIZE_ALIGNMENT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_DMA_SIZE_ALIGNMENT)
-extern const unsigned int SCI_Q_ADAPTER_DMA_SIZE_ALIGNMENT;
-
-#define SCI_Q_ADAPTER_DMA_OFFSET_ALIGNMENT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_DMA_OFFSET_ALIGNMENT)
-extern const unsigned int SCI_Q_ADAPTER_DMA_OFFSET_ALIGNMENT;
-
-#define SCI_Q_ADAPTER_DMA_MTU _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_DMA_MTU)
-extern const unsigned int SCI_Q_ADAPTER_DMA_MTU;
-
-#define SCI_Q_ADAPTER_SUGGESTED_MIN_DMA_SIZE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_SUGGESTED_MIN_DMA_SIZE)
-extern const unsigned int SCI_Q_ADAPTER_SUGGESTED_MIN_DMA_SIZE;
-
-#define SCI_Q_ADAPTER_SUGGESTED_MIN_BLOCK_SIZE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_SUGGESTED_MIN_BLOCK_SIZE)
-extern const unsigned int SCI_Q_ADAPTER_SUGGESTED_MIN_BLOCK_SIZE;
-
-#define SCI_Q_ADAPTER_NODEID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_NODEID)
-extern const unsigned int SCI_Q_ADAPTER_NODEID;
-
-#define SCI_Q_ADAPTER_SERIAL_NUMBER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_SERIAL_NUMBER)
-extern const unsigned int SCI_Q_ADAPTER_SERIAL_NUMBER;
-
-#define SCI_Q_ADAPTER_CARD_TYPE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_CARD_TYPE)
-extern const unsigned int SCI_Q_ADAPTER_CARD_TYPE;
-
-#define SCI_Q_ADAPTER_NUMBER_OF_STREAMS _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_NUMBER_OF_STREAMS)
-extern const unsigned int SCI_Q_ADAPTER_NUMBER_OF_STREAMS;
-
-#define SCI_Q_ADAPTER_STREAM_BUFFER_SIZE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_STREAM_BUFFER_SIZE)
-extern const unsigned int SCI_Q_ADAPTER_STREAM_BUFFER_SIZE;
-
-#define SCI_Q_ADAPTER_CONFIGURED _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_CONFIGURED)
-extern const unsigned int SCI_Q_ADAPTER_CONFIGURED;
-
-#define SCI_Q_ADAPTER_LINK_OPERATIONAL _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_LINK_OPERATIONAL)
-extern const unsigned int SCI_Q_ADAPTER_LINK_OPERATIONAL;
-
-#define SCI_Q_ADAPTER_HW_LINK_STATUS_IS_OK _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_HW_LINK_STATUS_IS_OK)
-extern const unsigned int SCI_Q_ADAPTER_HW_LINK_STATUS_IS_OK;
-
-#define SCI_Q_ADAPTER_NUMBER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_NUMBER)
-extern const unsigned int SCI_Q_ADAPTER_NUMBER;
-
-#define SCI_Q_ADAPTER_INSTANCE_NUMBER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_INSTANCE_NUMBER)
-extern const unsigned int SCI_Q_ADAPTER_INSTANCE_NUMBER;
-
-#define SCI_Q_ADAPTER_FIRMWARE_OK _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_FIRMWARE_OK)
-extern const unsigned int SCI_Q_ADAPTER_FIRMWARE_OK;
-
-#define SCI_Q_ADAPTER_CONNECTED_TO_SWITCH _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_CONNECTED_TO_SWITCH)
-extern const unsigned int SCI_Q_ADAPTER_CONNECTED_TO_SWITCH;
-
-#define SCI_Q_ADAPTER_LOCAL_SWITCH_TYPE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_LOCAL_SWITCH_TYPE)
-extern const unsigned int SCI_Q_ADAPTER_LOCAL_SWITCH_TYPE;
-
-#define SCI_Q_ADAPTER_LOCAL_SWITCH_PORT_NUMBER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_LOCAL_SWITCH_PORT_NUMBER)
-extern const unsigned int SCI_Q_ADAPTER_LOCAL_SWITCH_PORT_NUMBER;
-
-#define SCI_Q_ADAPTER_CONNECTED_TO_EXPECTED_SWITCH_PORT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_CONNECTED_TO_EXPECTED_SWITCH_PORT)
-extern const unsigned int SCI_Q_ADAPTER_CONNECTED_TO_EXPECTED_SWITCH_PORT;
-
-#define SCI_Q_ADAPTER_ATT_PAGE_SIZE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_ATT_PAGE_SIZE)
-extern const unsigned int SCI_Q_ADAPTER_ATT_PAGE_SIZE;
-
-#define SCI_Q_ADAPTER_ATT_NUMBER_OF_ENTRIES _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_ATT_NUMBER_OF_ENTRIES)
-extern const unsigned int SCI_Q_ADAPTER_ATT_NUMBER_OF_ENTRIES;
-
-#define SCI_Q_ADAPTER_ATT_AVAILABLE_ENTRIES _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_ATT_AVAILABLE_ENTRIES)
-extern const unsigned int SCI_Q_ADAPTER_ATT_AVAILABLE_ENTRIES;
-
-#define SCI_Q_ADAPTER_PHYS_MEM_NODEID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SCI_Q_ADAPTER_PHYS_MEM_NODEID)
-extern const unsigned int SCI_Q_ADAPTER_PHYS_MEM_NODEID;
-
-#define SCI_Q_ADAPTER_PHYS_MBX_NODEID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SCI_Q_ADAPTER_PHYS_MBX_NODEID)
-extern const unsigned int SCI_Q_ADAPTER_PHYS_MBX_NODEID;
-
-#define SCI_Q_ADAPTER_PHYS_LINK_PORT_NODEID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_PHYS_LINK_PORT_NODEID)
-extern const unsigned int SCI_Q_ADAPTER_PHYS_LINK_PORT_NODEID;
-
-#define SCI_Q_ADAPTER_SCI_LINK_FREQUENCY _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_SCI_LINK_FREQUENCY)
-extern const unsigned int SCI_Q_ADAPTER_SCI_LINK_FREQUENCY;
-
-#define SCI_Q_ADAPTER_B_LINK_FREQUENCY _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_B_LINK_FREQUENCY)
-extern const unsigned int SCI_Q_ADAPTER_B_LINK_FREQUENCY;
-
-#define SCI_Q_ADAPTER_IO_BUS_FREQUENCY _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_IO_BUS_FREQUENCY)
-extern const unsigned int SCI_Q_ADAPTER_IO_BUS_FREQUENCY;
-
-/* Minor query commands (sub-commands) for adapter specific information SCI_SYSTEM */
-#define SCI_Q_SYSTEM_HOSTBRIDGE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SYSTEM_HOSTBRIDGE)
-extern const unsigned int SCI_Q_SYSTEM_HOSTBRIDGE;
-
-#define SCI_Q_SYSTEM_WRITE_POSTING_ENABLED _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SYSTEM_WRITE_POSTING_ENABLED)
-extern const unsigned int SCI_Q_SYSTEM_WRITE_POSTING_ENABLED;
-
-#define SCI_Q_SYSTEM_WRITE_COMBINING_ENABLED _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SYSTEM_WRITE_COMBINING_ENABLED)
-extern const unsigned int SCI_Q_SYSTEM_WRITE_COMBINING_ENABLED;
-
-#define SCI_Q_LOCAL_SEGMENT_IOADDR _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_LOCAL_SEGMENT_IOADDR)
-extern const unsigned int SCI_Q_LOCAL_SEGMENT_IOADDR;
-
-#define SCI_Q_REMOTE_SEGMENT_IOADDR _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_REMOTE_SEGMENT_IOADDR)
-extern const unsigned int SCI_Q_REMOTE_SEGMENT_IOADDR;
-
-#define SCI_Q_MAP_MAPPED_TO_LOCAL_TARGET _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_MAP_MAPPED_TO_LOCAL_TARGET)
-extern const unsigned int SCI_Q_MAP_MAPPED_TO_LOCAL_TARGET;
-
-#define SCI_Q_MAP_QUERY_REMOTE_MAPPED_TO_LOCAL_TARGET _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_MAP_QUERY_REMOTE_MAPPED_TO_LOCAL_TARGET)
-extern const unsigned int SCI_Q_MAP_QUERY_REMOTE_MAPPED_TO_LOCAL_TARGET;
-
-#define HOSTBRIDGE_NOT_AVAILABLE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_NOT_AVAILABLE)
-extern const unsigned int HOSTBRIDGE_NOT_AVAILABLE;
-
-#define HOSTBRIDGE_UNKNOWN _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_UNKNOWN)
-extern const unsigned int HOSTBRIDGE_UNKNOWN;
-
-#define HOSTBRIDGE_440FX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440FX)
-extern const unsigned int HOSTBRIDGE_440FX;
-
-#define HOSTBRIDGE_440LX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440LX)
-extern const unsigned int HOSTBRIDGE_440LX;
-
-#define HOSTBRIDGE_440BX_A _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440BX_A)
-extern const unsigned int HOSTBRIDGE_440BX_A;
-
-#define HOSTBRIDGE_440BX_B _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440BX_B)
-extern const unsigned int HOSTBRIDGE_440BX_B;
-
-#define HOSTBRIDGE_440GX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440GX)
-extern const unsigned int HOSTBRIDGE_440GX;
-
-#define HOSTBRIDGE_450KX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_450KX)
-extern const unsigned int HOSTBRIDGE_450KX;
-
-#define HOSTBRIDGE_430NX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_430NX)
-extern const unsigned int HOSTBRIDGE_430NX;
-
-#define HOSTBRIDGE_450NX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_450NX)
-extern const unsigned int HOSTBRIDGE_450NX;
-
-#define HOSTBRIDGE_450NX_MICO _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_450NX_MICO)
-extern const unsigned int HOSTBRIDGE_450NX_MICO;
-
-#define HOSTBRIDGE_450NX_PXB _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_450NX_PXB)
-extern const unsigned int HOSTBRIDGE_450NX_PXB;
-
-#define HOSTBRIDGE_I810 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I810)
-extern const unsigned int HOSTBRIDGE_I810;
-
-#define HOSTBRIDGE_I810_DC100 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I810_DC100)
-extern const unsigned int HOSTBRIDGE_I810_DC100;
-
-#define HOSTBRIDGE_I810E _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I810E)
-extern const unsigned int HOSTBRIDGE_I810E;
-
-#define HOSTBRIDGE_I815 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I815)
-extern const unsigned int HOSTBRIDGE_I815;
-
-#define HOSTBRIDGE_I840 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I840)
-extern const unsigned int HOSTBRIDGE_I840;
-
-#define HOSTBRIDGE_I850 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I850)
-extern const unsigned int HOSTBRIDGE_I850;
-
-#define HOSTBRIDGE_I860 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I860)
-extern const unsigned int HOSTBRIDGE_I860;
-
-#define HOSTBRIDGE_INTEL_E7500 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_INTEL_E7500)
-extern const unsigned int HOSTBRIDGE_INTEL_E7500;
-
-#define HOSTBRIDGE_VIA_KT133 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_VIA_KT133)
-extern const unsigned int HOSTBRIDGE_VIA_KT133;
-
-#define HOSTBRIDGE_VIA_KX133 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_VIA_KX133)
-extern const unsigned int HOSTBRIDGE_VIA_KX133;
-
-#define HOSTBRIDGE_VIA_APOLLO_PRO_133A _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_VIA_APOLLO_PRO_133A)
-extern const unsigned int HOSTBRIDGE_VIA_APOLLO_PRO_133A;
-
-#define HOSTBRIDGE_VIA_APOLLO_PRO_266 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_VIA_APOLLO_PRO_266)
-extern const unsigned int HOSTBRIDGE_VIA_APOLLO_PRO_266;
-
-#define HOSTBRIDGE_AMD_760_MP _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_AMD_760_MP)
-extern const unsigned int HOSTBRIDGE_AMD_760_MP;
-
-#define HOSTBRIDGE_AMD_HAMMER _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_AMD_HAMMER)
-extern const unsigned int HOSTBRIDGE_AMD_HAMMER;
-
-#define HOSTBRIDGE_SERVERWORKS_HE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_HE)
-extern const unsigned int HOSTBRIDGE_SERVERWORKS_HE;
-
-#define HOSTBRIDGE_SERVERWORKS_HE_B _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_HE_B)
-extern const unsigned int HOSTBRIDGE_SERVERWORKS_HE_B;
-
-#define HOSTBRIDGE_SERVERWORKS_LE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_LE)
-extern const unsigned int HOSTBRIDGE_SERVERWORKS_LE;
-
-#define HOSTBRIDGE_SERVERWORKS_GC_HE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_GC_HE)
-extern const unsigned int HOSTBRIDGE_SERVERWORKS_GC_HE;
-
-#define HOSTBRIDGE_SERVERWORKS_GC_LE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_GC_LE)
-extern const unsigned int HOSTBRIDGE_SERVERWORKS_GC_LE;
-
-#define HOSTBRIDGE_SERVERWORKS_GC_WS _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_GC_WS)
-extern const unsigned int HOSTBRIDGE_SERVERWORKS_GC_WS;
-
-#define HOSTBRIDGE_SERVERWORKS_GC_SL _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_GC_SL)
-extern const unsigned int HOSTBRIDGE_SERVERWORKS_GC_SL;
-
-
-#define HOSTBRIDGE_WRITE_POSTING_DISABLED _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_WRITE_POSTING_DISABLED)
-extern const unsigned int HOSTBRIDGE_WRITE_POSTING_DISABLED;
-
-#define HOSTBRIDGE_WRITE_POSTING_ENABLED _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_WRITE_POSTING_ENABLED)
-extern const unsigned int HOSTBRIDGE_WRITE_POSTING_ENABLED;
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C R E A T E D M A Q U E U E *
- * *
- * Flags *
- * *
- * SCI_FLAG_DMA_PHDMA : Create physical DMA queue. Please note that this is an *
- * priveleged operation. *
- * *
- * *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCICreateDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCICreateDMAQueue)
-DLL void SCICreateDMAQueue(sci_desc_t sd,
- sci_dma_queue_t *dq,
- unsigned int localAdapterNo,
- unsigned int maxEntries,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I R E M O V E D M A Q U E U E *
- * *
- * Flags *
- * None. * *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Not allowed in this queue state. *
- * *
- *********************************************************************************/
-#define SCIRemoveDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIRemoveDMAQueue)
-DLL void SCIRemoveDMAQueue(sci_dma_queue_t dq,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I E N Q U E U E D M A T R A N S F E R *
- * *
- * Flags: *
- * *
- * SCI_FLAG_DMA_READ - The DMA will be remote --> local *
- * (default is local --> remote) *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the offset and size is larger *
- * than the segment size or larger than max *
- * DMA size. *
- * SCI_ERR_MAX_ENTRIES - The DMA queue is full *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_SEGMENT_NOT_PREPARED - The local segment has not been prepared for *
- * access from the adapter associated with the *
- * queue. *
- * SCI_ERR_SEGMENT_NOT_CONNECTED - The remote segment is not connected through *
- * the adapter associated with the queue. *
- *********************************************************************************/
-#define SCIEnqueueDMATransfer _SISCI_EXPANDE_FUNCTION_NAME(SCIEnqueueDMATransfer)
-DLL sci_dma_queue_state_t SCIEnqueueDMATransfer(sci_dma_queue_t dq,
- sci_local_segment_t localSegment,
- sci_remote_segment_t remoteSegment,
- unsigned int localOffset,
- unsigned int remoteOffset,
- unsigned int size,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I P O S T D M A Q U E U E *
- * *
- * Flags: *
- * *
- * SCI_FLAG_USE_CALLBACK - The end of the transfer will cause the callback *
- * function to be invoked. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation *
- * *
- *********************************************************************************/
-#define SCIPostDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIPostDMAQueue)
-DLL void SCIPostDMAQueue(sci_dma_queue_t dq,
- sci_cb_dma_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I A B O R T D M A Q U E U E *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation *
- * *
- *********************************************************************************/
-#define SCIAbortDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIAbortDMAQueue)
-DLL void SCIAbortDMAQueue(sci_dma_queue_t dq,
- unsigned int flags,
- sci_error_t *error);
-
-
-/*********************************************************************************
- * *
- * S C I R E S E T D M A Q U E U E *
- * *
- * Flags *
- * None. * *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIResetDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIResetDMAQueue)
-DLL void SCIResetDMAQueue(sci_dma_queue_t dq,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I D M A Q U E U E S T A T E *
- * *
- *********************************************************************************/
-#define SCIDMAQueueState _SISCI_EXPANDE_FUNCTION_NAME(SCIDMAQueueState)
-DLL sci_dma_queue_state_t SCIDMAQueueState(sci_dma_queue_t dq);
-
-
-
-/*********************************************************************************
- * *
- * S C I W A I T F O R D M A Q U E U E *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation *
- * SCI_ERR_TIMEOUT - The function timed out after specified *
- * timeout value. *
- * *
- *********************************************************************************/
-#define SCIWaitForDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForDMAQueue)
-DLL sci_dma_queue_state_t SCIWaitForDMAQueue(sci_dma_queue_t dq,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I P H D M A E N Q U E U E *
- * *
- * SISCI Priveleged function *
- * *
- * Flags *
- * *
- * SCI_FLAG_DMA_READ *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCIphDmaEnqueue _SISCI_EXPANDE_FUNCTION_NAME(SCIphDmaEnqueue)
-DLL void SCIphDmaEnqueue(sci_dma_queue_t dmaqueue,
- unsigned int size,
- sci_ioaddr_t localBusAddr,
- unsigned int remote_nodeid,
- unsigned int remote_highaddr,
- unsigned int remote_lowaddr,
- unsigned int flags,
- sci_error_t *error);
-
-/*********************************************************************************
- * *
- * S C I P H D M A S T A R T *
- * *
- * Flags *
- * *
- * SCI_FLAG_DMA_WAIT *
- * SCI_FLAG_USE_CALLBACK *
- * SCI_FLAG_DMA_RESET *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCIphDmaStart _SISCI_EXPANDE_FUNCTION_NAME(SCIphDmaStart)
-DLL sci_dma_queue_state_t SCIphDmaStart(sci_dma_queue_t dmaqueue,
- sci_cb_dma_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-
-/*********************************************************************************
- * *
- * S C I C R E A T E I N T E R R U P T *
- * *
- * Flags *
- * *
- * SCI_FLAG_USE_CALLBACK *
- * SCI_FLAG_FIXED_INTNO *
- * SCI_FLAG_SHARED_INT *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_INTNO_USED - This interrupt number is already used. *
- * *
- *********************************************************************************/
-#define SCICreateInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCICreateInterrupt)
-DLL void SCICreateInterrupt(sci_desc_t sd,
- sci_local_interrupt_t *interrupt,
- unsigned int localAdapterNo,
- unsigned int *interruptNo,
- sci_cb_interrupt_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I R E M O V E I N T E R R U P T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCIRemoveInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIRemoveInterrupt)
-DLL void SCIRemoveInterrupt(sci_local_interrupt_t interrupt,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I W A I T F O R I N T E R R U P T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_TIMEOUT - The function timed out after specified timeout value. *
- * SCI_ERR_CANCELLED - The wait was interrupted by a call to *
- * SCIRemoveInterrupt. *
- * The handle is invalid when this error code is returned.*
- * *
- *********************************************************************************/
-#define SCIWaitForInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForInterrupt)
-DLL void SCIWaitForInterrupt(sci_local_interrupt_t interrupt,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C O N N E C T I N T E R R U P T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_NO_SUCH_INTNO - No such interrupt number. *
- * SCI_ERR_CONNECTION_REFUSED - Connection attempt refused by remote node. *
- * SCI_ERR_TIMEOUT - The function timed out after specified *
- * timeout value. *
- * *
- *********************************************************************************/
-#define SCIConnectInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIConnectInterrupt)
-DLL void SCIConnectInterrupt(sci_desc_t sd,
- sci_remote_interrupt_t *interrupt,
- unsigned int nodeId,
- unsigned int localAdapterNo,
- unsigned int interruptNo,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-/*********************************************************************************
- * *
- * S C I D I S C O N N E C T I N T E R R U P T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIDisconnectInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIDisconnectInterrupt)
-DLL void SCIDisconnectInterrupt(sci_remote_interrupt_t interrupt,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I T R I G G E R I N T E R R U P T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCITriggerInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCITriggerInterrupt)
-DLL void SCITriggerInterrupt(sci_remote_interrupt_t interrupt,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I R E G I S T E R I N T E R R U P T F L A G *
- * *
- * *
- * This function register an "interrupt flag" that is identified as an unique *
- * location within a local segment. If successful, the resulting interrupt *
- * handle will have been associated with the specified local segment. *
- * *
- * It is up to the (remote) client(s) to set up an "interrupt mapping" for the *
- * corresponding segment offset using either the *
- * *
- * - SCI_FLAG_CONDITIONAL_INTERRUPT_MAP *
- * *
- * or the *
- * *
- * - SCI_FLAG_UNCONDITIONAL_DATA_INTERRUPT_MAP *
- * *
- * option to "SCIMapRemoteSegment()". - I.e. after having established a *
- * connection to the corresponding segment. A trigger operation can then *
- * be implemented using a store operation via the relevant "interrupt map". *
- * *
- * *
- * *
- * *
- * *
- * Flags: *
- * *
- * SCI_FLAG_CONDITIONAL_INTERRUPT - Triggering is to take place using *
- * "conditional interrupts". *
- * *
- * *
- * *
- * Specific error codes for this function: *
- * None. *
- * *
- *********************************************************************************/
-#define SCIRegisterInterruptFlag _SISCI_EXPANDE_FUNCTION_NAME(SCIRegisterInterruptFlag)
-DLL void SCIRegisterInterruptFlag(
- unsigned int localAdapterNo,
- sci_local_interrupt_t *interrupt,
- sci_local_segment_t segment,
- unsigned int offset,
- sci_cb_interrupt_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I E N A B L E C O N D I T I O N A L I N T E R R U P T *
- * *
- * *
- * This function make sure that another HW interrupt will take place the next *
- * time the corresponding interrupt flag is triggered by a *
- * "conditional interrupt" operation. *
- * *
- * Default semantics: *
- * *
- * When successful, the client can rely on that the first subsequent trigger *
- * operation will cause a HW interrupt and subsequently cause the client *
- * handler function to be invoked. *
- * *
- * If an interrupt was triggered in parallell with the enable operation, then *
- * the operation will fail (SCI_ERR_COND_INT_RACE_PROBLEM), and the client can *
- * not rely on another trigger operation will lead to handler invocation. *
- * Hence, any state checking normally associated with handling the *
- * corresponding interrupt should take place before attempting to enable *
- * again. *
- * *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_COND_INT_RACE_PROBLEM - The enable operation failed because an *
- * incomming trigger operation happened *
- * concurrently. *
- * *
- *********************************************************************************/
-#define SCIEnableConditionalInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIEnableConditionalInterrupt)
-DLL void SCIEnableConditionalInterrupt(
- sci_local_interrupt_t interrupt,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I D I S A B L E C O N D I T I O N A L I N T E R R U P T *
- * *
- * *
- * Prevent subsequent "conditional interrupt"trigger operations for *
- * the specified interupt flag from causing HW interrupt and handler *
- * invocations. *
- * *
- * *
- * Default semantics: *
- * *
- * If successful, no subsequent HW interrupts will take place, but handler *
- * invocations that have already been scheduled may still take place. *
- * *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIDisableConditionalInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIDisableConditionalInterrupt)
-DLL void SCIDisableConditionalInterrupt(
- sci_local_interrupt_t interrupt,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I G E T C O N D I T I O N A L I N T E R R U P T C O U N T E R *
- * *
- * *
- * Returns a value that indicates the number of times this flag has *
- * been trigged since the last time it was enabled or disabled. *
- * Calling the SCIEnableConditionalInterrupt / SCIDisableConditionalInterrupt *
- * functions will reset the counter value. *
- * *
- * Default semantics: *
- * *
- * If successful, the current trig count is returned in the *
- * interruptTrigCounter parameter. *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OVERFLOW - The number of trig operations have exceeded the range *
- * that can be counted. *
- *********************************************************************************/
-#define SCIGetConditionalInterruptTrigCounter _SISCI_EXPANDE_FUNCTION_NAME(SCIGetConditionalInterruptTrigCounter)
-DLL void SCIGetConditionalInterruptTrigCounter(
- sci_local_interrupt_t interrupt,
- unsigned int *interruptTrigCounter,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I T R A N S F E R B L O C K *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the size and offset is larger *
- * than the corresponding map size. *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_TRANSFER_FAILED - The data transfer failed. *
- * *
- *********************************************************************************/
-#define SCITransferBlock _SISCI_EXPANDE_FUNCTION_NAME(SCITransferBlock)
-DLL void SCITransferBlock(sci_map_t sourceMap,
- unsigned int sourceOffset,
- sci_map_t destinationMap,
- unsigned int destinationOffset,
- unsigned int size,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I T R A N S F E R B L O C K A S Y N C *
- * *
- * Flags *
- * *
- * SCI_FLAG_BLOCK_READ *
- * SCI_FLAG_USE_CALLBACK *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the size and offset is larger than *
- * the corresponding map size. *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required by *
- * the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_TRANSFER_FAILED - The data transfer failed. *
- * *
- *********************************************************************************/
-#define SCITransferBlockAsync _SISCI_EXPANDE_FUNCTION_NAME(SCITransferBlockAsync)
-DLL void SCITransferBlockAsync(sci_map_t sourceMap,
- unsigned int sourceOffset,
- sci_map_t destinationMap,
- unsigned int destinationOffset,
- unsigned int size,
- sci_block_transfer_t *block,
- sci_cb_block_transfer_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I W A I T F O R B L O C K T R A N S F E R *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation *
- * SCI_ERR_TIMEOUT - The function timed out after specified *
- * timeout value. *
- * *
- *********************************************************************************/
-#define SCIWaitForBlockTransfer _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForBlockTransfer)
-DLL void SCIWaitForBlockTransfer(sci_block_transfer_t block,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I A B O R T B L O C K T R A N S F E R *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation *
- * *
- *********************************************************************************/
-#define SCIAbortBlockTransfer _SISCI_EXPANDE_FUNCTION_NAME(SCIAbortBlockTransfer)
-DLL void SCIAbortBlockTransfer(sci_block_transfer_t block,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I M E M C P Y *
- * *
- * Flags: *
- * SCI_FLAG_BLOCK_READ *
- * SCI_FLAG_ERROR_CHECK *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the size and offset is larger *
- * than the corresponding map size. *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_TRANSFER_FAILED - The data transfer failed. *
- * *
- *********************************************************************************/
-
-#define SCIMemCpy _SISCI_EXPANDE_FUNCTION_NAME(SCIMemCpy)
-DLL void SCIMemCpy(sci_sequence_t sequence,
- void *memAddr,
- sci_map_t remoteMap,
- unsigned int remoteOffset,
- unsigned int size,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I M E M C O P Y *
- * *
- * Flags: *
- * SCI_FLAG_BLOCK_READ *
- * SCI_FLAG_ERROR_CHECK *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the size and offset is larger *
- * than the corresponding map size. *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_TRANSFER_FAILED - The data transfer failed. *
- * *
- *********************************************************************************/
-
-
-#define SCIMemCopy _SISCI_EXPANDE_FUNCTION_NAME(SCIMemCopy)
-DLL void SCIMemCopy(void *memAddr,
- sci_map_t remoteMap,
- unsigned int remoteOffset,
- unsigned int size,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I R E G I S T E R S E G M E N T M E M O R Y *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required by *
- * the implementation. *
- * SCI_ERR_ILLEGAL_ADDRESS - Illegal address. *
- * SCI_ERR_OUT_OF_RANGE - Size is larger than the maximum size for the *
- * local segment. *
- * *
- *********************************************************************************/
-#define SCIRegisterSegmentMemory _SISCI_EXPANDE_FUNCTION_NAME(SCIRegisterSegmentMemory)
-DLL void SCIRegisterSegmentMemory(void *address,
- unsigned int size,
- sci_local_segment_t segment,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C O N N E C T S C I S P A C E *
- * *
- * SISCI Priveleged function *
- * *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_CONNECTION_REFUSED - Connection attempt refused by remote node. *
- * *
- *********************************************************************************/
-#define SCIConnectSCISpace _SISCI_EXPANDE_FUNCTION_NAME(SCIConnectSCISpace)
-DLL void SCIConnectSCISpace(sci_desc_t sd,
- unsigned int localAdapterNo,
- sci_remote_segment_t *segment,
- sci_address_t address,
- unsigned int size,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*
- * =====================================================================================
- *
- * S C I A T T A C H L O C A L S E G M E N T
- * Description:
- *
- * SCIAttachLocalSegment() permits an application to "attach" to an already existing
- * local segment, implying that two or more application want
- * share the same local segment. The prerequest, is that the
- * application which originally created the segment ("owner") has
- * preformed a SCIShareSegment() in order to mark the segment
- * "shareable".
- *
- *
- * Flags:
- *
- * SCI_FLAG_USE_CALLBACK - The callback function will be invoked for events
- * on this segment.
- *
- *
- * Specific error codes for this function:
- *
- * SCI_ERR_ACCESS - No such shared segment
- * SCI_ERR_NO_SUCH_SEGMENT - No such segment
- * Note: Current implenentation will return SCI_ERR_ACCESS for both cases. This will
- * change from next release. Application should handle both cases.
- *
- * =====================================================================================
- */
-#define SCIAttachLocalSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIAttachLocalSegment)
-
-DLL void
-SCIAttachLocalSegment(sci_desc_t sd,
- sci_local_segment_t *segment,
- unsigned int segmentId,
- unsigned int *size,
- sci_cb_local_segment_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-/*
- * =====================================================================================
- *
- * S C I S H A R E S E G M E N T
- *
- * Description:
- *
- * SCIShareSegment() permits other application to "attach" to an already existing
- * local segment, implying that two or more application want
- * share the same local segment. The prerequest, is that the
- * application which originally created the segment ("owner") has
- * preformed a SCIShareSegment() in order to mark the segment
- * "shareable".
- *
- *
- * Flags:
- * none
- *
- * Specific error codes for this function:
- *
- *
- *
- * =====================================================================================
- */
-#define SCIShareSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIShareSegment)
-
-DLL void
-SCIShareSegment(sci_local_segment_t segment,
- unsigned int flags,
- sci_error_t *error);
-
-
-/*********************************************************************************
- * *
- * S C I F L U S H *
- * *
- * This function will flush the CPU buffers and the PSB buffers. *
- * *
- * Flags *
- * SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY : *
- * Only flush CPU buffers ( Write combining *
- * etc buffers). *
- * *
- *********************************************************************************/
-
-#define SCIFlush _SISCI_EXPANDE_FUNCTION_NAME(SCIFlush)
-DLL void SCIFlush(sci_sequence_t sequence,
- unsigned int flags);
-
-#if defined(CPLUSPLUS) || defined(__cplusplus)
-}
-#endif
-
-
-#endif
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ndb/src/external/LINUX.x86/sci/include/sisci_demolib.h b/ndb/src/external/LINUX.x86/sci/include/sisci_demolib.h
deleted file mode 100644
index 4284fc5585c..00000000000
--- a/ndb/src/external/LINUX.x86/sci/include/sisci_demolib.h
+++ /dev/null
@@ -1,226 +0,0 @@
-/* $Id: sisci_demolib.h,v 1.1 2002/12/13 12:17:21 hin Exp $ */
-
-/*******************************************************************************
- * *
- * Copyright (C) 1993 - 2000 *
- * Dolphin Interconnect Solutions AS *
- * *
- * 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 _SISCI_DEMOLIB_H
-#define _SISCI_DEMOLIB_H
-
-
-#if defined(_REENTRANT)
-
-#define _SISCI_DEMOLIB_EXPAND_NAME(name) _SISCI_DEMOLIB_MT_ ## name
-
-#else
-
-#define _SISCI_DEMOLIB_EXPAND_NAME(name) _SISCI_DEMOLIB_ST_ ## name
-
-#endif
-
-/*********************************************************************************/
-/* Q U E R Y A D A P T E R */
-/* */
-/*********************************************************************************/
-
-#define QueryAdapter _SISCI_DEMOLIB_EXPAND_NAME(QueryAdapter)
-
-sci_error_t QueryAdapter(
- unsigned int subcommand,
- unsigned int localAdapterNo,
- unsigned int portNo,
- unsigned int *data);
-
-
-/*********************************************************************************/
-/* Q U E R Y S Y S T E M */
-/* */
-/*********************************************************************************/
-
-#define QuerySystem _SISCI_DEMOLIB_EXPAND_NAME(QuerySystem)
-
-sci_error_t QuerySystem(
- unsigned int subcommand,
- unsigned int *data);
-
-
-/*********************************************************************************/
-/* D E T E C T F I R S T A D A P T E R C A R D */
-/* */
-/*********************************************************************************/
-
-#define DetectFirstAdapterCard _SISCI_DEMOLIB_EXPAND_NAME(DetectFirstAdapterCard)
-
-sci_error_t DetectFirstAdapterCard(
- unsigned int *localAdapterNo,
- unsigned int *localNodeId);
-
-
-/*********************************************************************************/
-/* G E T A D A P T E R T Y P E */
-/* */
-/*********************************************************************************/
-
-#define GetAdapterType _SISCI_DEMOLIB_EXPAND_NAME(GetAdapterType)
-
-sci_error_t GetAdapterType(unsigned int localAdapterNo,
- unsigned int *adapterType);
-
-
-/*********************************************************************************/
-/* G E T L O C A L N O D E I D */
-/* */
-/*********************************************************************************/
-
-#define GetLocalNodeId _SISCI_DEMOLIB_EXPAND_NAME(GetLocalNodeId)
-
-sci_error_t GetLocalNodeId(
- unsigned int localAdapterNo,
- unsigned int *localNodeId);
-
-
-/*********************************************************************************/
-/* G E T A D A P T E R S E R I A L N U M B E R */
-/* */
-/*********************************************************************************/
-
-#define GetAdapterSerialNumber _SISCI_DEMOLIB_EXPAND_NAME(GetAdapterSerialNumber)
-
-sci_error_t GetAdapterSerialNumber(
- unsigned int localAdapterNo,
- unsigned int *serialNo);
-
-
-
-/*********************************************************************************/
-/* G E T H O S T B R I D G E T Y P E */
-/* */
-/*********************************************************************************/
-
-#define GetHostbridgeType _SISCI_DEMOLIB_EXPAND_NAME(GetHostbridgeType)
-
-sci_error_t GetHostbridgeType(unsigned int *hostbridgeType);
-
-
-
-/*********************************************************************************/
-/* P R I N T H O S T B R I D G E T Y P E */
-/* */
-/*********************************************************************************/
-
-#define PrintHostbridgeType _SISCI_DEMOLIB_EXPAND_NAME(PrintHostbridgeType)
-
-void PrintHostbridgeType(unsigned int hostbridge);
-
-
-
-/*********************************************************************************/
-/* G E T A P I V E R S I O N S T R I N G */
-/* */
-/*********************************************************************************/
-
-#define GetAPIVersionString _SISCI_DEMOLIB_EXPAND_NAME(GetAPIVersionString)
-
-sci_error_t GetAPIVersionString(char str[], unsigned int strLength);
-
-
-
-/*********************************************************************************/
-/* G E T A D A P T E R I O B U S F R E Q U E N C Y */
-/* */
-/*********************************************************************************/
-
-sci_error_t GetAdapterIoBusFrequency(unsigned int localAdapterNo,
- unsigned int *ioBusFrequency);
-
-
-
-/*********************************************************************************/
-/* G E T A D A P T E R S C I L I N K F R E Q U E N C Y */
-/* */
-/*********************************************************************************/
-
-sci_error_t GetAdapterSciLinkFrequency(unsigned int localAdapterNo,
- unsigned int *sciLinkFrequency);
-
-
-
-/*********************************************************************************/
-/* G E T A D A P T E R B L I N K F R E Q U E N C Y */
-/* */
-/*********************************************************************************/
-
-sci_error_t GetAdapterBlinkFrequency(unsigned int localAdapterNo,
- unsigned int *bLinkFrequency);
-
-
-/*********************************************************************************/
-/* S E N D I N T E R R U P T */
-/* */
-/*********************************************************************************/
-
-#define SendInterrupt _SISCI_DEMOLIB_EXPAND_NAME(SendInterrupt)
-
-sci_error_t SendInterrupt(
- sci_desc_t sd,
- unsigned int localAdapterNo,
- unsigned int localNodeId,
- unsigned int remoteNodeId,
- unsigned int interruptNo);
-
-
-/*********************************************************************************/
-/* R E C E I V E I N T E R R U P T */
-/* */
-/*********************************************************************************/
-
-#define ReceiveInterrupt _SISCI_DEMOLIB_EXPAND_NAME(ReceiveInterrupt)
-
-sci_error_t ReceiveInterrupt(
- sci_desc_t sd,
- unsigned int localAdapterNo,
- unsigned int localNodeId,
- unsigned int interruptNo);
-
-
-/*********************************************************************************/
-/* E N D I A N S W A P */
-/* */
-/*********************************************************************************/
-
-#define EndianSwap _SISCI_DEMOLIB_EXPAND_NAME(EndianSwap)
-
-unsigned int EndianSwap (unsigned int value);
-
-
-/*********************************************************************************/
-/* S L E E P M I L L I S E C O N D S */
-/* */
-/*********************************************************************************/
-
-#define SleepMilliseconds _SISCI_DEMOLIB_EXPAND_NAME(SleepMilliseconds)
-
-void SleepMilliseconds(int milliseconds);
-
-
-
-
-#endif
diff --git a/ndb/src/external/LINUX.x86/sci/include/sisci_error.h b/ndb/src/external/LINUX.x86/sci/include/sisci_error.h
deleted file mode 100644
index c53fe8ad5d9..00000000000
--- a/ndb/src/external/LINUX.x86/sci/include/sisci_error.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* $Id: sisci_error.h,v 1.1 2002/12/13 12:17:21 hin Exp $ */
-
-/*******************************************************************************
- * *
- * Copyright (C) 1993 - 2000 *
- * Dolphin Interconnect Solutions AS *
- * *
- * 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 _SISCI_ERROR_H_
-#define _SISCI_ERROR_H_
-
-
-/* SCI Error return values always have 30 bit set */
-#define SCI_ERR_MASK 0x40000000
-#define SCI_ERR_REMOTE_MASK 0x01 /* Remote errors should have bit 0 set */
-
-#define SCI_ERR(u) ((unsigned32)(u)&0x7FFFFFFF )
-
-/* Error codes */
-typedef enum {
- SCI_ERR_OK = 0x000,
-
-
- SCI_ERR_BUSY = (0x900 | SCI_ERR_MASK),
- SCI_ERR_FLAG_NOT_IMPLEMENTED = (0x901 | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_FLAG = (0x902 | SCI_ERR_MASK),
- SCI_ERR_NOSPC = (0x904 | SCI_ERR_MASK),
- SCI_ERR_API_NOSPC = (0x905 | SCI_ERR_MASK),
- SCI_ERR_HW_NOSPC = (0x906 | SCI_ERR_MASK),
- SCI_ERR_NOT_IMPLEMENTED = (0x907 | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_ADAPTERNO = (0x908 | SCI_ERR_MASK),
- SCI_ERR_NO_SUCH_ADAPTERNO = (0x909 | SCI_ERR_MASK),
- SCI_ERR_TIMEOUT = (0x90A | SCI_ERR_MASK),
- SCI_ERR_OUT_OF_RANGE = (0x90B | SCI_ERR_MASK),
- SCI_ERR_NO_SUCH_SEGMENT = (0x90C | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_NODEID = (0x90D | SCI_ERR_MASK),
- SCI_ERR_CONNECTION_REFUSED = (0x90E | SCI_ERR_MASK),
- SCI_ERR_SEGMENT_NOT_CONNECTED = (0x90F | SCI_ERR_MASK),
- SCI_ERR_SIZE_ALIGNMENT = (0x910 | SCI_ERR_MASK),
- SCI_ERR_OFFSET_ALIGNMENT = (0x911 | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_PARAMETER = (0x912 | SCI_ERR_MASK),
- SCI_ERR_MAX_ENTRIES = (0x913 | SCI_ERR_MASK),
- SCI_ERR_SEGMENT_NOT_PREPARED = (0x914 | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_ADDRESS = (0x915 | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_OPERATION = (0x916 | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_QUERY = (0x917 | SCI_ERR_MASK),
- SCI_ERR_SEGMENTID_USED = (0x918 | SCI_ERR_MASK),
- SCI_ERR_SYSTEM = (0x919 | SCI_ERR_MASK),
- SCI_ERR_CANCELLED = (0x91A | SCI_ERR_MASK),
- SCI_ERR_NOT_CONNECTED = (0x91B | SCI_ERR_MASK),
- SCI_ERR_NOT_AVAILABLE = (0x91C | SCI_ERR_MASK),
- SCI_ERR_INCONSISTENT_VERSIONS = (0x91D | SCI_ERR_MASK),
- SCI_ERR_COND_INT_RACE_PROBLEM = (0x91E | SCI_ERR_MASK),
- SCI_ERR_OVERFLOW = (0x91F | SCI_ERR_MASK),
- SCI_ERR_NOT_INITIALIZED = (0x920 | SCI_ERR_MASK),
-
- SCI_ERR_ACCESS = (0x921 | SCI_ERR_MASK),
-
- SCI_ERR_NO_SUCH_NODEID = (0xA00 | SCI_ERR_MASK),
- SCI_ERR_NODE_NOT_RESPONDING = (0xA02 | SCI_ERR_MASK),
- SCI_ERR_NO_REMOTE_LINK_ACCESS = (0xA04 | SCI_ERR_MASK),
- SCI_ERR_NO_LINK_ACCESS = (0xA05 | SCI_ERR_MASK),
- SCI_ERR_TRANSFER_FAILED = (0xA06 | SCI_ERR_MASK)
-} sci_error_t;
-
-
-#endif /* _SCI_ERROR_H_ */
-
-
-
diff --git a/ndb/src/external/LINUX.x86/sci/include/sisci_types.h b/ndb/src/external/LINUX.x86/sci/include/sisci_types.h
deleted file mode 100644
index f4125fdec69..00000000000
--- a/ndb/src/external/LINUX.x86/sci/include/sisci_types.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/* $Id: sisci_types.h,v 1.1 2002/12/13 12:17:21 hin Exp $ */
-
-/*******************************************************************************
- * *
- * Copyright (C) 1993 - 2000 *
- * Dolphin Interconnect Solutions AS *
- * *
- * 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 _SISCI_TYPES_H
-#define _SISCI_TYPES_H
-
-#include "sisci_error.h"
-
-#ifndef IN
-#define IN
-#endif
-
-#ifndef OUT
-#define OUT
-#endif
-
-#ifndef IN_OUT
-#define IN_OUT
-#endif
-
-/* Opaque data types for descriptors/handles */
-typedef struct sci_desc *sci_desc_t;
-typedef struct sci_local_segment *sci_local_segment_t;
-typedef struct sci_remote_segment *sci_remote_segment_t;
-
-typedef struct sci_map *sci_map_t;
-typedef struct sci_sequence *sci_sequence_t;
-#ifndef KERNEL
-typedef struct sci_dma_queue *sci_dma_queue_t;
-#endif
-typedef struct sci_remote_interrupt *sci_remote_interrupt_t;
-typedef struct sci_local_interrupt *sci_local_interrupt_t;
-typedef struct sci_block_transfer *sci_block_transfer_t;
-
-/*
- * Constants defining reasons for segment callbacks:
- */
-
-typedef enum {
- SCI_CB_CONNECT = 1,
- SCI_CB_DISCONNECT,
- SCI_CB_NOT_OPERATIONAL,
- SCI_CB_OPERATIONAL,
- SCI_CB_LOST
-} sci_segment_cb_reason_t;
-
-#define MAX_CB_REASON SCI_CB_LOST
-
-/* dma_queue_states is identical to the dma_queue_state_t in genif.h, they must be consistent.*/
-typedef enum {
- SCI_DMAQUEUE_IDLE,
- SCI_DMAQUEUE_GATHER,
- SCI_DMAQUEUE_POSTED,
- SCI_DMAQUEUE_DONE,
- SCI_DMAQUEUE_ABORTED,
- SCI_DMAQUEUE_ERROR
-} sci_dma_queue_state_t;
-
-
-typedef enum {
- SCI_SEQ_OK,
- SCI_SEQ_RETRIABLE,
- SCI_SEQ_NOT_RETRIABLE,
- SCI_SEQ_PENDING
-} sci_sequence_status_t;
-
-
-typedef struct {
- unsigned short nodeId; /* SCI Address bit 63 - 48 */
- unsigned short offsHi; /* SCI Address bit 47 - 32 */
- unsigned int offsLo; /* SCI Address bit 31 - 0 */
-} sci_address_t;
-
-
-typedef unsigned int sci_ioaddr_t;
-
-typedef enum {
- SCI_CALLBACK_CANCEL = 1,
- SCI_CALLBACK_CONTINUE
-} sci_callback_action_t;
-
-#ifndef KERNEL
-typedef sci_callback_action_t (*sci_cb_local_segment_t)(void *arg,
- sci_local_segment_t segment,
- sci_segment_cb_reason_t reason,
- unsigned int nodeId,
- unsigned int localAdapterNo,
- sci_error_t error);
-
-typedef sci_callback_action_t (*sci_cb_remote_segment_t)(void *arg,
- sci_remote_segment_t segment,
- sci_segment_cb_reason_t reason,
- sci_error_t status);
-
-
-typedef sci_callback_action_t (*sci_cb_dma_t)(void IN *arg,
- sci_dma_queue_t queue,
- sci_error_t status);
-
-
-typedef int (*sci_cb_block_transfer_t)(void *arg,
- sci_block_transfer_t block,
- sci_error_t status);
-
-
-typedef sci_callback_action_t (*sci_cb_interrupt_t)(void *arg,
- sci_local_interrupt_t interrupt,
- sci_error_t status);
-
-#endif /* KERNEL */
-#endif
diff --git a/ndb/src/external/LINUX.x86/sci/include/sisci_version.h b/ndb/src/external/LINUX.x86/sci/include/sisci_version.h
deleted file mode 100644
index f1807c33aa5..00000000000
--- a/ndb/src/external/LINUX.x86/sci/include/sisci_version.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* $Id: sisci_version.h,v 1.1 2002/12/13 12:17:21 hin Exp $ */
-
-/*******************************************************************************
- * *
- * Copyright (C) 1993 - 2000 *
- * Dolphin Interconnect Solutions AS *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU Lesser General Public License as published by *
- * the Free Software Foundation; either version 2.1 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 Lesser 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 SISCI_VERSION_H
-#define SISCI_VERSION_H
-
-
-#define SISCI_API_VER_MAJOR 0x01
-#define SISCI_API_VER_MAJORC "1"
-
-#define SISCI_API_VER_MINOR 0x010
-#define SISCI_API_VER_MINORC "10"
-#define SISCI_API_VER_MICRO 0x005
-#define SISCI_API_VER_MICROC "5"
-
-#define SISCI_SIGN_VERSION_MASK 0xfffff000 /* used to mask off API_VER_MICRO */
-
-#define SISCI_API_VERSION (SISCI_API_VER_MAJOR << 24 | SISCI_API_VER_MINOR << 12 | SISCI_API_VER_MICRO)
-
-/* the rules are:
- *
- * Changes in API_VER_MICRO should be binary compatible, New flags, functions added. No changes to user code
- * required if new features is not needed.
- *
- * Changes in API_VER_MINOR requires recompilation of user code.
- *
- * Changes in the API_VER_MAJOR will most likely require changes to user code. This should not happen very
- * often...
- *
- */
-
-#ifndef BUILD_DATE
-#define BUILD_DATE __DATE__
-#endif
-
-#ifndef BUILD_NAME
-#define BUILD_NAME ""
-#endif
-
-#define API_VERSION "SISCI API version " SISCI_API_VER_MAJORC "." SISCI_API_VER_MINORC "."SISCI_API_VER_MICROC " ( "BUILD_NAME" "BUILD_DATE" )"
-
-#endif
-
-
-/* Version info: */
-/* */
-/* 1.5.2 First SISCI version */
-/* 1.5.3 Some bug fixes */
-/* 1.5.4 Some bug fixes */
-/* 1.5.5 No release */
-/* 1.5.6 Lock flag implemented in function SCIConnectSegment */
-/* 1.5.7 Expanded query functionality */
-/* 1.5.8 Updated error checking (sequence) functionality for D320 */
-/* 1.6.0 Updated error checking (sequence) D320 and IRM 1.9 support */
-/* 1.9.0 Ported to Solaris_sparc, Solaris_x86 and Linux. IRM 1.9. */
-/* 1.9.1 Some bug fixes */
-/* 1.9.2 Added more adapter queries */
-/* 1.9.3 Bug fix in SCIMapLocalSegment and SCIMapRemoteSegment */
-/* 1.9.4 NT Release Developers Kit 2.40 */
-/* 1.9.5 Added flush after data transfer in SCIMemCopy() */
-/* 1.9.5 NT Release Developers Kit 2.44 */
-/* 1.10.0:
- * New SCIInitialize(), SCITerminate() functions.
- * Support for D330
- *
- *
- */
-
-
diff --git a/ndb/src/external/LINUX.x86/sci/include/version.h b/ndb/src/external/LINUX.x86/sci/include/version.h
deleted file mode 100644
index a0e1fa6c5cd..00000000000
--- a/ndb/src/external/LINUX.x86/sci/include/version.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef _VERSION_H
-#define _VERSION_H
-
-
-/*
-#define DEMO_VER_MAJOR "1"
-#define DEMO_VER_MINOR "5"
-#define DEMO_VER_MICRO "0"
-*/
-
-#ifndef BUILD_DATE
-#define BUILD_DATE __DATE__
-#endif
-
-#ifndef BUILD_NAME
-#define BUILD_NAME ""
-#endif
-
-/*
-#define DEMO_VERSION "version " DEMO_VER_MAJOR "." DEMO_VER_MINOR "."DEMO_VER_MICRO " ("BUILD_NAME" "BUILD_DATE" )"
-*/
-#define DEMO_VERSION " ("BUILD_NAME" "BUILD_DATE" )"
-
-
-#endif
diff --git a/ndb/src/external/SOLARIS.SPARC/sci/include/sisci_api.h b/ndb/src/external/SOLARIS.SPARC/sci/include/sisci_api.h
deleted file mode 100644
index d02d3aafe7f..00000000000
--- a/ndb/src/external/SOLARIS.SPARC/sci/include/sisci_api.h
+++ /dev/null
@@ -1,2148 +0,0 @@
-/* $Id: sisci_api.h,v 1.1 2002/12/13 12:17:22 hin Exp $ */
-/*******************************************************************************
- * *
- * Copyright (C) 1993 - 2001 *
- * Dolphin Interconnect Solutions AS *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU Lesser General Public License as published by *
- * the Free Software Foundation; either version 2.1 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 Lesser 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 _SISCI_API_H
-#define _SISCI_API_H
-
-#include "sisci_types.h"
-#include "sisci_error.h"
-
-
-#ifdef WIN32
-#ifdef API_DLL
-#define DLL __declspec(dllexport)
-#elif CLIENT_DLL
-#define DLL __declspec(dllimport)
-#endif
-#endif /* WIN32 */
-
-
-#ifndef DLL
-#define DLL
-#endif
-
-#if defined(_REENTRANT)
-#define _SISCI_EXPANDE_FUNCTION_NAME(name) _SISCI_PUBLIC_FUNC_MT_ ## name
-#define _SISCI_EXPANDE_VARIABLE_NAME(name) _SISCI_PUBLIC_VAR_MT_ ## name
-#else
-#define _SISCI_EXPANDE_FUNCTION_NAME(name) _SISCI_PUBLIC_FUNC_ST_ ## name
-#define _SISCI_EXPANDE_VARIABLE_NAME(name) _SISCI_PUBLIC_VAR_ST_ ## name
-#endif
-#define _SISCI_EXPANDE_CONSTANT_NAME(name) _SISCI_PUBLIC_CONST_ ## name
-
-#if defined(CPLUSPLUS) || defined(__cplusplus)
-extern "C" {
-#endif
-
-
-/*********************************************************************************/
-/* FLAG VALUES */
-/*********************************************************************************/
-
-#define SCI_FLAG_FIXED_INTNO _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FIXED_INTNO)
-extern const unsigned int SCI_FLAG_FIXED_INTNO;
-
-#define SCI_FLAG_SHARED_INT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_SHARED_INT)
-extern const unsigned int SCI_FLAG_SHARED_INT;
-
-#define SCI_FLAG_FIXED_MAP_ADDR _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FIXED_MAP_ADDR)
-extern const unsigned int SCI_FLAG_FIXED_MAP_ADDR;
-
-#define SCI_FLAG_READONLY_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_READONLY_MAP)
-extern const unsigned int SCI_FLAG_READONLY_MAP;
-
-#define SCI_FLAG_USE_CALLBACK _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_USE_CALLBACK)
-extern const unsigned int SCI_FLAG_USE_CALLBACK;
-
-#define SCI_FLAG_BLOCK_READ _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_BLOCK_READ)
-extern const unsigned int SCI_FLAG_BLOCK_READ;
-
-#define SCI_FLAG_THREAD_SAFE _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_THREAD_SAFE)
-extern const unsigned int SCI_FLAG_THREAD_SAFE;
-
-#define SCI_FLAG_ASYNCHRONOUS_CONNECT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_ASYNCHRONOUS_CONNECT)
-extern const unsigned int SCI_FLAG_ASYNCHRONOUS_CONNECT;
-
-#define SCI_FLAG_EMPTY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_EMPTY)
-extern const unsigned int SCI_FLAG_EMPTY;
-
-#define SCI_FLAG_PRIVATE _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_PRIVATE)
-extern const unsigned int SCI_FLAG_PRIVATE;
-
-#define SCI_FLAG_FORCE_DISCONNECT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FORCE_DISCONNECT)
-extern const unsigned int SCI_FLAG_FORCE_DISCONNECT;
-
-#define SCI_FLAG_NOTIFY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_NOTIFY)
-extern const unsigned int SCI_FLAG_NOTIFY;
-
-#define SCI_FLAG_DMA_READ _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_READ)
-extern const unsigned int SCI_FLAG_DMA_READ;
-
-#define SCI_FLAG_DMA_POST _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_POST)
-extern const unsigned int SCI_FLAG_DMA_POST;
-
-#define SCI_FLAG_DMA_WAIT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_WAIT)
-extern const unsigned int SCI_FLAG_DMA_WAIT;
-
-#define SCI_FLAG_DMA_RESET _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_RESET)
-extern const unsigned int SCI_FLAG_DMA_RESET;
-
-#define SCI_FLAG_NO_FLUSH _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_NO_FLUSH)
-extern const unsigned int SCI_FLAG_NO_FLUSH;
-
-#define SCI_FLAG_NO_STORE_BARRIER _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_NO_STORE_BARRIER)
-extern const unsigned int SCI_FLAG_NO_STORE_BARRIER;
-
-#define SCI_FLAG_FAST_BARRIER _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FAST_BARRIER)
-extern const unsigned int SCI_FLAG_FAST_BARRIER;
-
-#define SCI_FLAG_ERROR_CHECK _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_ERROR_CHECK)
-extern const unsigned int SCI_FLAG_ERROR_CHECK;
-
-#define SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY)
-extern const unsigned int SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY;
-
-/* the FLUSH_CPU_BUFFERS_ONLY flag is for backwards compabillity only and should never be used */
-#define FLUSH_CPU_BUFFERS_ONLY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY)
-
-#define SCI_FLAG_LOCK_OPERATION _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_LOCK_OPERATION)
-extern const unsigned int SCI_FLAG_LOCK_OPERATION;
-
-#define SCI_FLAG_READ_PREFETCH_AGGR_HOLD_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_READ_PREFETCH_AGGR_HOLD_MAP)
-extern const unsigned int SCI_FLAG_READ_PREFETCH_AGGR_HOLD_MAP;
-
-#define SCI_FLAG_READ_PREFETCH_NO_HOLD_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_READ_PREFETCH_NO_HOLD_MAP)
-extern const unsigned int SCI_FLAG_READ_PREFETCH_NO_HOLD_MAP;
-
-#define SCI_FLAG_IO_MAP_IOSPACE _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_IO_MAP_IOSPACE)
-extern const unsigned int SCI_FLAG_IO_MAP_IOSPACE;
-
-#define SCI_FLAG_DMOVE_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMOVE_MAP)
-extern const unsigned int SCI_FLAG_DMOVE_MAP;
-
-#define SCI_FLAG_WRITES_DISABLE_GATHER_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_WRITES_DISABLE_GATHER_MAP)
-extern const unsigned int SCI_FLAG_WRITES_DISABLE_GATHER_MAP;
-
-#define SCI_FLAG_DISABLE_128_BYTES_PACKETS _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DISABLE_128_BYTES_PACKETS)
-extern const unsigned int SCI_FLAG_DISABLE_128_BYTES_PACKETS;
-
-#define SCI_FLAG_DMA_SOURCE_ONLY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_SOURCE_ONLY)
-extern const unsigned int SCI_FLAG_DMA_SOURCE_ONLY;
-
-#define SCI_FLAG_CONDITIONAL_INTERRUPT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_CONDITIONAL_INTERRUPT)
-extern const unsigned int SCI_FLAG_CONDITIONAL_INTERRUPT;
-
-#define SCI_FLAG_CONDITIONAL_INTERRUPT_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_CONDITIONAL_INTERRUPT_MAP)
-extern const unsigned int SCI_FLAG_CONDITIONAL_INTERRUPT_MAP;
-
-#define SCI_FLAG_UNCONDITIONAL_DATA_INTERRUPT_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_UNCONDITIONAL_DATA_INTERRUPT_MAP)
-extern const unsigned int SCI_FLAG_UNCONDITIONAL_DATA_INTERRUPT_MAP;
-
-#define SCI_FLAG_NO_MEMORY_LOOPBACK_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_NO_MEMORY_LOOPBACK_MAP)
-extern const unsigned int SCI_FLAG_NO_MEMORY_LOOPBACK_MAP;
-
-#if defined(OS_IS_LYNXOS) || defined(OS_IS_VXWORKS)
-#define SCI_FLAG_WRITE_BACK_CACHE_MAP _SISCI_EXPANDE_CONSTANT_NAME(WRITE_BACK_CACHE_MAP)
-extern const unsigned int SCI_FLAG_WRITE_BACK_CACHE_MAP;
-#endif
-
-#define SCI_FLAG_DMA_PHDMA _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_PHDMA)
-extern const unsigned int SCI_FLAG_DMA_PHDMA;
-
-/*********************************************************************************/
-/* GENERAL VALUES */
-/*********************************************************************************/
-#define SCI_LOCAL_HOST _SISCI_EXPANDE_CONSTANT_NAME(SCI_LOCAL_HOST)
-extern const unsigned int SCI_LOCAL_HOST;
-
-#define SCI_INFINITE_TIMEOUT _SISCI_EXPANDE_CONSTANT_NAME(SCI_INFINITE_TIMEOUT)
-extern const unsigned int SCI_INFINITE_TIMEOUT;
-
-/*********************************************************************************/
-/* GENERAL ERROR CODES */
-/* */
-/* SCI_ERR_ILLEGAL_FLAG - Illegal flag value. */
-/* SCI_ERR_FLAG_NOT_IMPLEMENTED - Flag legal but flag feature not implemented. */
-/* SCI_ERR_NOT_IMPLEMENTED - Function not implemented. */
-/* SCI_ERR_SYSTEM - A system error. Check errno. */
-/* SCI_ERR_NOSPC - Unable to allocate OS resources. */
-/* SCI_ERR_API_NOSPC - Unable to allocate API resources. */
-/* SCI_ERR_HW_NOSPC - Unable to allocate HW resources (Hardware) */
-/* */
-/*********************************************************************************/
-
-
-/*********************************************************************************/
-/* GENERAL "ADAPTER" ERROR CODES */
-/* */
-/* SCI_ERR_NO_SUCH_ADAPTERNO - Adapter number is legal but does not exist. */
-/* SCI_ERR_ILLEGAL_ADAPTERNO - Illegal local adapter number (i.e. outside */
-/* legal range). */
-/* */
-/*********************************************************************************/
-
-
-/*********************************************************************************/
-/* GENERAL "NODEID" ERROR CODES */
-/* */
-/* SCI_ERR_NO_SUCH_NODEID - The remote adapter identified by nodeId does */
-/* not respond, but the intermediate link(s) */
-/* seem(s) to be operational. */
-/* SCI_ERR_ILLEGAL_NODEID - Illegal NodeId. */
-/* */
-/*********************************************************************************/
-
-
-
-/*********************************************************************************
- * *
- * S C I I N I T I A L I Z E *
- * *
- * This function initializes the SISCI library. *
- * The function must be called before SCIOpen(). *
- * *
- * Flags: *
- * None *
- * *
- * Specific error codes for this function: *
- * *
- * None *
- * *
- *********************************************************************************/
-#define SCIInitialize _SISCI_EXPANDE_FUNCTION_NAME(SCIInitialize)
-DLL void SCIInitialize(unsigned int flags,
- sci_error_t *error);
-#if 0
-unsigned int __Internal_SISCI_version_var;
-#endif
-
-/*********************************************************************************
- * *
- * S C I T E R M I N A T E *
- * *
- * This function terminates the SISCI library. *
- * The function must be called after SCIClose(). *
- * *
- * *
- *********************************************************************************/
-#define SCITerminate _SISCI_EXPANDE_FUNCTION_NAME(SCITerminate)
-DLL void SCITerminate(void);
-
-/*********************************************************************************
- * *
- * S C I O P E N *
- * *
- * *
- * Opens a SCI virtual device. *
- * Caller must supply a pointer to a variable of type sci_desc_t to be *
- * initialized. *
- * *
- * Flags *
- * SCI_FLAG_THREAD_SAFE - Operations on resources associated with this *
- * descriptor will be performed in a multithread-safe *
- * manner. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_INCONSISTENT_VERSIONS - Inconsistency between the SISCI library *
- * and the SISCI driver versions. *
- * *
- * *
- *********************************************************************************/
-#define SCIOpen _SISCI_EXPANDE_FUNCTION_NAME(SCIOpen)
-DLL void SCIOpen(sci_desc_t *sd,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C L O S E *
- * *
- * This function closes an open SCI virtual device. *
- * *
- * Flags: *
- * None *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_BUSY - All resources are not deallocated. *
- * *
- *********************************************************************************/
-#define SCIClose _SISCI_EXPANDE_FUNCTION_NAME(SCIClose)
-DLL void SCIClose(sci_desc_t sd,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C O N N E C T S E G M E N T *
- * *
- * Connects to a remote shared memory segment located at <nodeId> with the *
- * identifier <segmentId>. *
- * The user may then call SCIMapRemoteSegment() to map shared memory *
- * into user space. *
- * *
- * Flags *
- * SCI_FLAG_USE_CALLBACK *
- * SCI_FLAG_ASYNCHRONOUS_CONNECT *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_NO_SUCH_SEGMENT - Could not find the remote segment with the *
- * given segmentId. *
- * SCI_ERR_CONNECTION_REFUSED - Connection attempt refused by remote node. *
- * SCI_ERR_TIMEOUT - The function timed out after specified *
- * timeout value. *
- * SCI_ERR_NO_LINK_ACCESS - It was not possible to communicate via the *
- * local adapter. *
- * SCI_ERR_NO_REMOTE_LINK_ACCESS - It was not possible to communicate via a *
- * remote switch port. *
- * *
- *********************************************************************************/
-#define SCIConnectSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIConnectSegment)
-DLL void SCIConnectSegment(sci_desc_t sd,
- sci_remote_segment_t *segment,
- unsigned int nodeId,
- unsigned int segmentId,
- unsigned int localAdapterNo,
- sci_cb_remote_segment_t callback,
- void *callbackArg,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-/*********************************************************************************
- * *
- * S C I D I S C O N N E C T S E G M E N T *
- * *
- * Disconnects from the give mapped shared memory segment *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_BUSY - The segment is currently mapped or in use. *
- * *
- *********************************************************************************/
-#define SCIDisconnectSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIDisconnectSegment)
-DLL void SCIDisconnectSegment(sci_remote_segment_t segment,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I G E T R E M O T E S E G M E N T S I Z E *
- * *
- *********************************************************************************/
-#define SCIGetRemoteSegmentSize _SISCI_EXPANDE_FUNCTION_NAME(SCIGetRemoteSegmentSize)
-DLL unsigned int SCIGetRemoteSegmentSize(sci_remote_segment_t segment);
-
-
-
-/*********************************************************************************
- * *
- * S C I W A I T F O R R E M O T E S E G M E N T E V E N T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_TIMEOUT - The function timed out after specified *
- * timeout value. *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation. *
- * SCI_ERR_CANCELLED - The wait operation has been cancelled du *
- * to a SCIDisconnectSegment() on the same *
- * handle. The handle is invalid when this *
- * error is returned. *
- * *
- *********************************************************************************/
-#define SCIWaitForRemoteSegmentEvent _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForRemoteSegmentEvent)
-DLL sci_segment_cb_reason_t SCIWaitForRemoteSegmentEvent(
- sci_remote_segment_t segment,
- sci_error_t *status,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I M A P R E M O T E S E G M E N T *
- * *
- * This function is used to include a shared memory segment in the virtual *
- * address space of the application. *
- * *
- * Flags: *
- * *
- * SCI_FLAG_FIXED_MAP_ADDR - Map at the suggested virtual address *
- * SCI_FLAG_READONLY_MAP - The segment is mapped in read-only mode *
- * SCI_FLAG_LOCK_OPERATION - Enable Lock operations (fetch and add) *
- * SCI_FLAG_READ_PREFETCH_AGGR_HOLD_MAP *
- * - Enable aggressive prefetch with speculative *
- * hold. *
- * *
- * SCI_FLAG_READ_PREFETCH_NO_HOLD_MAP *
- * - The PSB66 will prefetch 64 bytes. As soon *
- * as the PCI read retry has been accepted, *
- * the stream will change state to FREE, even *
- * if less than 64 bytes were actually read. *
- * *
- * SCI_FLAG_IO_MAP_IOSPACE - Enable No Prefetch, no speculative hold. *
- * *
- * SCI_FLAG_DMOVE_MAP - Enable DMOVE packet type. The stream will be *
- * set into FREE state immediately. *
- * *
- * SCI_FLAG_WRITES_DISABLE_GATHER_MAP *
- * - Disable use of gather. *
- * *
- * SCI_FLAG_DISABLE_128_BYTES_PACKETS *
- * - Disable use of 128-Byte packets *
- * *
- * SCI_FLAG_CONDITIONAL_INTERRUPT_MAP *
- * - Write operations through this map will cause *
- * an atomic "fetch-and-add-one" operation on *
- * remote memory, but in addition an interrupt *
- * will be generated if the target memory *
- * location contained a "null value" before the *
- * add operation was carried out. *
- * The conditional interrupt flag must also be *
- * specified in the SCIRegisterInterruptFlag() *
- * function. *
- * *
- * SCI_FLAG_UNCONDITIONAL_INTERRUPT_MAP *
- * - Write operations through this map will cause *
- * an interrupt for the remote adapter *
- * "in addition to" updating the corresponding *
- * remote memory location with the data being *
- * written. *
- * The unconditional interrupt flag must also *
- * be specified in the *
- * SCIRegisterInterruptFlag() function. *
- * *
- * SCI_FLAG_WRITE_BACK_CACHE_MAP *
- * - Enable cacheing of the mapped region. *
- * Writes through this map will be written to a *
- * write back cache, hence no remote SCI updates*
- * until the cache line is flushed. The *
- * application is responsible for the cache *
- * flush operation. *
- * The SCImemCopy() function will handle this *
- * correctly by doing cache flushes internally. *
- * This feature is architechture dependent and *
- * not be available on all plattforms. *
- * *
- * SCI_FLAG_NO_MEMORY_LOOPBACK_MAP *
- * - Forces a map to a remote segment located *
- * in the local machine to be mapped using *
- * SCI loopback. This is useful i.e. if you *
- * want to use a regular map access to be *
- * serialized with lock operations. *
- * The default behaviour is to access a remte *
- * segment located in the local machine as a *
- * local MMU operation. *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the offset and size is *
- * larger than the segment size. *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as *
- * required by the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as *
- * required by the implementation. *
- * *
- *********************************************************************************/
-#define SCIMapRemoteSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIMapRemoteSegment)
-DLL volatile void *SCIMapRemoteSegment(
- sci_remote_segment_t segment,
- sci_map_t *map,
- unsigned int offset,
- unsigned int size,
- void *addr,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I M A P L O C A L S E G M E N T *
- * *
- * Flags *
- * *
- * SCI_FLAG_FIXED_MAP_ADDR *
- * SCI_FLAG_READONLY_MAP *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the offset and size is *
- * larger than the segment size. *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as *
- * required by the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as *
- * required by the implementation. *
- * *
- *********************************************************************************/
-#define SCIMapLocalSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIMapLocalSegment)
-DLL void *SCIMapLocalSegment(sci_local_segment_t segment,
- sci_map_t *map,
- unsigned int offset,
- unsigned int size,
- void *addr,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I U N M A P S E G M E N T *
- * *
- * This function unmaps pages of shared memory from the callers virtual *
- * address space. *
- * *
- * Flags *
- * None. *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_BUSY - The map is currently in use. *
- * *
- *********************************************************************************/
-#define SCIUnmapSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIUnmapSegment)
-DLL void SCIUnmapSegment(sci_map_t map,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C R E A T E S E G M E N T *
- * *
- * Make the specified segment available for connections via the specified *
- * adapter. If successful, the segment can be accessed from remote nodes *
- * via the specified adapter. *
- * *
- * Flags: *
- * *
- * SCI_FLAG_USE_CALLBACK - The callback function will be invoked for events *
- * on this segment. *
- * SCI_FLAG_EMPTY - No memory will be allocated for the segment. *
- * SCI_FLAG_PRIVATE - The segment will be private meaning it will never *
- * be any connections to it. *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_SEGMENTID_USED - The segment with this segmentId is already used *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required *
- * by the implementation. *
- * *
- *********************************************************************************/
-#define SCICreateSegment _SISCI_EXPANDE_FUNCTION_NAME(SCICreateSegment)
-DLL void SCICreateSegment(sci_desc_t sd,
- sci_local_segment_t *segment,
- unsigned int segmentId,
- unsigned int size,
- sci_cb_local_segment_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I W A I T F O R L O C A L S E G M E N T E V E N T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_TIMEOUT - The function timed out after specified timeout value. *
- * SCI_ERR_CANCELLED - The wait operation has been cancelled du to a *
- * SCIRemoveSegment() on the same handle. *
- * The handle is invalid when this error is returned. *
- * *
- *********************************************************************************/
-#define SCIWaitForLocalSegmentEvent _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForLocalSegmentEvent)
-DLL sci_segment_cb_reason_t SCIWaitForLocalSegmentEvent(
- sci_local_segment_t segment,
- unsigned int *sourcenodeId,
- unsigned int *localAdapterNo,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I P R E P A R E S E G M E N T *
- * *
- * Flags *
- * *
- * SCI_FLAG_DMA_SOURCE_ONLY - The segment will be used as a source segment *
- * for DMA operations. On some system types this *
- * will enable the SISCI driver to use performance *
- * improving features. *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIPrepareSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIPrepareSegment)
-DLL void SCIPrepareSegment(sci_local_segment_t segment,
- unsigned int localAdapterNo,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I R E M O V E S E G M E N T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_BUSY - Unable to remove the segment. The segment is currently *
- * in use. *
- * *
- *********************************************************************************/
-#define SCIRemoveSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIRemoveSegment)
-DLL void SCIRemoveSegment(sci_local_segment_t segment,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I S E T S E G M E N T A V A I L A B L E *
- * *
- * Flags *
- * None. *
- * *
- * *
- * SCI_ERR_SEGMENT_NOT_PREPARED - The segment has not been prepared for access *
- * from this adapter. *
- * SCI_ERR_ILLEGAL_OPERATION - The segment is created with the *
- * SCI_FLAG_PRIVATE flag specified and *
- * therefore has no segmentId. *
- * *
- *********************************************************************************/
-#define SCISetSegmentAvailable _SISCI_EXPANDE_FUNCTION_NAME(SCISetSegmentAvailable)
-DLL void SCISetSegmentAvailable(sci_local_segment_t segment,
- unsigned int localAdapterNo,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I S E T S E G M E N T U N A V A I L A B L E *
- * *
- * Flags *
- * *
- * SCI_FLAG_FORCE_DISCONNECT *
- * SCI_FLAG_NOTIFY *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation. *
- * *
- *********************************************************************************/
-#define SCISetSegmentUnavailable _SISCI_EXPANDE_FUNCTION_NAME(SCISetSegmentUnavailable)
-DLL void SCISetSegmentUnavailable(sci_local_segment_t segment,
- unsigned int localAdapterNo,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C R E A T E M A P S E Q U E N C E *
- * *
- * Flags: *
- * *
- * SCI_FLAG_FAST_BARRIER *
- * *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCICreateMapSequence _SISCI_EXPANDE_FUNCTION_NAME(SCICreateMapSequence)
-DLL void SCICreateMapSequence(sci_map_t map,
- sci_sequence_t *sequence,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I R E M O V E S E Q U E N C E *
- * *
- * Flags: *
- * None *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCIRemoveSequence _SISCI_EXPANDE_FUNCTION_NAME(SCIRemoveSequence)
-DLL void SCIRemoveSequence(sci_sequence_t sequence,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I S T A R T S E Q U E N C E *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIStartSequence _SISCI_EXPANDE_FUNCTION_NAME(SCIStartSequence)
-DLL sci_sequence_status_t SCIStartSequence(sci_sequence_t sequence,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I C H E C K S E Q U E N CE *
- * *
- * Flags *
- * *
- * SCI_FLAG_NO_FLUSH *
- * SCI_FLAG_NO_STORE_BARRIER *
- * *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCICheckSequence _SISCI_EXPANDE_FUNCTION_NAME(SCICheckSequence)
-DLL sci_sequence_status_t SCICheckSequence(sci_sequence_t sequence,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I S T O R E B A R R I E R *
- * *
- * Flags *
- * None. *
- * *
- * *
- * *
- *********************************************************************************/
-#define SCIStoreBarrier _SISCI_EXPANDE_FUNCTION_NAME(SCIStoreBarrier)
-DLL void SCIStoreBarrier(sci_sequence_t sequence,
- unsigned int flags);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I F L U S H R E A D B U F F E R S *
- * *
- *********************************************************************************/
-#define SCIFlushReadBuffers _SISCI_EXPANDE_FUNCTION_NAME(SCIFlushReadBuffers)
-DLL void SCIFlushReadBuffers(sci_sequence_t sequence);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I P R O B E N O D E *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_NO_LINK_ACCESS - It was not possible to communicate via the *
- * local adapter. *
- * SCI_ERR_NO_REMOTE_LINK_ACCESS - It was not possible to communicate via a *
- * remote switch port. *
- * *
- *********************************************************************************/
-#define SCIProbeNode _SISCI_EXPANDE_FUNCTION_NAME(SCIProbeNode)
-DLL int SCIProbeNode(sci_desc_t sd,
- unsigned int localAdapterNo,
- unsigned int nodeId,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I G E T C S R R E G I S T E R *
- * *
- * SISCI Priveleged function *
- * *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_NO_LINK_ACCESS - It was not possible to communicate via the *
- * local adapter. *
- * SCI_ERR_NO_REMOTE_LINK_ACCESS - It was not possible to communicate via a *
- * remote switch port. *
- * *
- *********************************************************************************/
-#define SCIGetCSRRegister _SISCI_EXPANDE_FUNCTION_NAME(SCIGetCSRRegister)
-DLL unsigned int SCIGetCSRRegister(sci_desc_t sd,
- unsigned int localAdapterNo,
- unsigned int SCINodeId,
- unsigned int CSROffset,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I S E T C S R R E G I S T E R *
- * *
- * SISCI Priveleged function *
- * *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_NO_LINK_ACCESS - It was not possible to communicate via the *
- * local adapter. *
- * SCI_ERR_NO_REMOTE_LINK_ACCESS - It was not possible to communicate via a *
- * remote switch port. *
- * *
- *********************************************************************************/
-#define SCISetCSRRegister _SISCI_EXPANDE_FUNCTION_NAME(SCISetCSRRegister)
-DLL void SCISetCSRRegister(sci_desc_t sd,
- unsigned int localAdapterNo,
- unsigned int SCINodeId,
- unsigned int CSROffset,
- unsigned int CSRValue,
- unsigned int flags,
- sci_error_t *error);
-
-
-/*********************************************************************************
- * *
- * S C I G E T L O C A L C S R *
- * *
- * SISCI Priveleged function *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIGetLocalCSR _SISCI_EXPANDE_FUNCTION_NAME(SCIGetLocalCSR)
-DLL unsigned int SCIGetLocalCSR(sci_desc_t sd,
- unsigned int localAdapterNo,
- unsigned int CSROffset,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I S E T L O C A L C S R *
- * *
- * SISCI Priveleged function
- *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCISetLocalCSR _SISCI_EXPANDE_FUNCTION_NAME(SCISetLocalCSR)
-DLL void SCISetLocalCSR(sci_desc_t sd,
- unsigned int localAdapterNo,
- unsigned int CSROffset,
- unsigned int CSRValue,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I A T T A C H P H Y S I C A L M E M O R Y *
- * *
- * SISCI Priveleged function *
- * *
- * Description: *
- * *
- * This function enables usage of physical devices and memory regions where the *
- * Physical PCI bus address ( and mapped CPU address ) are already known. *
- * The function will register the physical memory as a SISCI segment which can *
- * be connected and mapped as a regular SISCI segment. *
- * *
- * Requirements: *
- * *
- * SCICreateSegment() with flag SCI_FLAG_EMPTY must have been called in advance *
- * *
- * Parameter description: *
- * sci_ioaddr_t ioaddress : This is the address on the PCI bus that a PCI bus *
- * master has to use to write to the specified memory *
- * void * address : This is the (mapped) virtual address that the *
- * application has to use to access the device. *
- * This means that the device has to be mapped in *
- * advance bye the devices own driver. *
- * If the device is not to be accessed by the local *
- * CPU, the address pointer shold be set to NULL *
- * Flags *
- * *
- * None *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIAttachPhysicalMemory _SISCI_EXPANDE_FUNCTION_NAME(SCIAttachPhysicalMemory)
-DLL void SCIAttachPhysicalMemory(sci_ioaddr_t ioaddress,
- void *address,
- unsigned int busNo,
- unsigned int size,
- sci_local_segment_t segment,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I Q U E R Y *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_QUERY - Unrecognized command. *
- * *
- *********************************************************************************/
-#define SCIQuery _SISCI_EXPANDE_FUNCTION_NAME(SCIQuery)
-DLL void SCIQuery(unsigned int command,
- void *data,
- unsigned int flags,
- sci_error_t *error);
-
-
-/* MAJOR QUERY COMMANDS */
-
-/* This command requires a pointer to a structure of type */
-/* "sci_query_string". The string will be filled in by the query. */
-#define SCI_Q_VENDORID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_VENDORID)
-extern const unsigned int SCI_Q_VENDORID;
-
-
-/* Same as for SCI_VENDOR_ID */
-#define SCI_Q_API _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_API)
-extern const unsigned int SCI_Q_API;
-
-
-/* User passes a pointer to an allocated object of the */
-/* "sci_query_adapter" struct. */
-#define SCI_Q_ADAPTER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER)
-extern const unsigned int SCI_Q_ADAPTER;
-
-
-/* User passes a pointer to an allocated object of the */
-/* "sci_query_system" struct. */
-#define SCI_Q_SYSTEM _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SYSTEM)
-extern const unsigned int SCI_Q_SYSTEM;
-
-#define SCI_Q_LOCAL_SEGMENT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_LOCAL_SEGMENT)
-extern const unsigned int SCI_Q_LOCAL_SEGMENT;
-
-#define SCI_Q_REMOTE_SEGMENT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_REMOTE_SEGMENT)
-extern const unsigned int SCI_Q_REMOTE_SEGMENT;
-
-#define SCI_Q_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_MAP)
-extern const unsigned int SCI_Q_MAP;
-
-typedef struct {
- char *str; /* Pointer to a string of minimum "length" characters */
- unsigned int length;
-} sci_query_string_t;
-
-
-typedef struct {
- unsigned int localAdapterNo; /* The adapter no. that the query concern. */
- unsigned int portNo; /* The SCI Link port number that the query concern. */
- unsigned int subcommand; /* A subcommand as specified below. */
- void *data; /* A pointer to an unsigned int that will return */
- /* the response to the query. */
-} sci_query_adapter_t;
-
-
-typedef struct {
- unsigned int subcommand; /* A subcommand as specified below. */
- void *data; /* A pointer to an unsigned int that will return */
- /* the response to the query. */
-} sci_query_system_t;
-
-typedef struct {
- sci_local_segment_t segment;
- unsigned int subcommand;
- union {
- sci_ioaddr_t ioaddr;
- } data;
-} sci_query_local_segment_t;
-
-typedef struct {
- sci_remote_segment_t segment;
- unsigned int subcommand;
- union {
- sci_ioaddr_t ioaddr;
- } data;
-} sci_query_remote_segment_t;
-
-typedef struct {
- sci_map_t map;
- unsigned int subcommand;
- unsigned int data;
-} sci_query_map_t;
-
-/* Minor query commands (sub-commands) for adapter specific information SCI_ADAPTER */
-#define SCI_Q_ADAPTER_DMA_SIZE_ALIGNMENT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_DMA_SIZE_ALIGNMENT)
-extern const unsigned int SCI_Q_ADAPTER_DMA_SIZE_ALIGNMENT;
-
-#define SCI_Q_ADAPTER_DMA_OFFSET_ALIGNMENT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_DMA_OFFSET_ALIGNMENT)
-extern const unsigned int SCI_Q_ADAPTER_DMA_OFFSET_ALIGNMENT;
-
-#define SCI_Q_ADAPTER_DMA_MTU _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_DMA_MTU)
-extern const unsigned int SCI_Q_ADAPTER_DMA_MTU;
-
-#define SCI_Q_ADAPTER_SUGGESTED_MIN_DMA_SIZE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_SUGGESTED_MIN_DMA_SIZE)
-extern const unsigned int SCI_Q_ADAPTER_SUGGESTED_MIN_DMA_SIZE;
-
-#define SCI_Q_ADAPTER_SUGGESTED_MIN_BLOCK_SIZE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_SUGGESTED_MIN_BLOCK_SIZE)
-extern const unsigned int SCI_Q_ADAPTER_SUGGESTED_MIN_BLOCK_SIZE;
-
-#define SCI_Q_ADAPTER_NODEID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_NODEID)
-extern const unsigned int SCI_Q_ADAPTER_NODEID;
-
-#define SCI_Q_ADAPTER_SERIAL_NUMBER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_SERIAL_NUMBER)
-extern const unsigned int SCI_Q_ADAPTER_SERIAL_NUMBER;
-
-#define SCI_Q_ADAPTER_CARD_TYPE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_CARD_TYPE)
-extern const unsigned int SCI_Q_ADAPTER_CARD_TYPE;
-
-#define SCI_Q_ADAPTER_NUMBER_OF_STREAMS _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_NUMBER_OF_STREAMS)
-extern const unsigned int SCI_Q_ADAPTER_NUMBER_OF_STREAMS;
-
-#define SCI_Q_ADAPTER_STREAM_BUFFER_SIZE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_STREAM_BUFFER_SIZE)
-extern const unsigned int SCI_Q_ADAPTER_STREAM_BUFFER_SIZE;
-
-#define SCI_Q_ADAPTER_CONFIGURED _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_CONFIGURED)
-extern const unsigned int SCI_Q_ADAPTER_CONFIGURED;
-
-#define SCI_Q_ADAPTER_LINK_OPERATIONAL _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_LINK_OPERATIONAL)
-extern const unsigned int SCI_Q_ADAPTER_LINK_OPERATIONAL;
-
-#define SCI_Q_ADAPTER_HW_LINK_STATUS_IS_OK _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_HW_LINK_STATUS_IS_OK)
-extern const unsigned int SCI_Q_ADAPTER_HW_LINK_STATUS_IS_OK;
-
-#define SCI_Q_ADAPTER_NUMBER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_NUMBER)
-extern const unsigned int SCI_Q_ADAPTER_NUMBER;
-
-#define SCI_Q_ADAPTER_INSTANCE_NUMBER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_INSTANCE_NUMBER)
-extern const unsigned int SCI_Q_ADAPTER_INSTANCE_NUMBER;
-
-#define SCI_Q_ADAPTER_FIRMWARE_OK _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_FIRMWARE_OK)
-extern const unsigned int SCI_Q_ADAPTER_FIRMWARE_OK;
-
-#define SCI_Q_ADAPTER_CONNECTED_TO_SWITCH _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_CONNECTED_TO_SWITCH)
-extern const unsigned int SCI_Q_ADAPTER_CONNECTED_TO_SWITCH;
-
-#define SCI_Q_ADAPTER_LOCAL_SWITCH_TYPE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_LOCAL_SWITCH_TYPE)
-extern const unsigned int SCI_Q_ADAPTER_LOCAL_SWITCH_TYPE;
-
-#define SCI_Q_ADAPTER_LOCAL_SWITCH_PORT_NUMBER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_LOCAL_SWITCH_PORT_NUMBER)
-extern const unsigned int SCI_Q_ADAPTER_LOCAL_SWITCH_PORT_NUMBER;
-
-#define SCI_Q_ADAPTER_CONNECTED_TO_EXPECTED_SWITCH_PORT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_CONNECTED_TO_EXPECTED_SWITCH_PORT)
-extern const unsigned int SCI_Q_ADAPTER_CONNECTED_TO_EXPECTED_SWITCH_PORT;
-
-#define SCI_Q_ADAPTER_ATT_PAGE_SIZE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_ATT_PAGE_SIZE)
-extern const unsigned int SCI_Q_ADAPTER_ATT_PAGE_SIZE;
-
-#define SCI_Q_ADAPTER_ATT_NUMBER_OF_ENTRIES _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_ATT_NUMBER_OF_ENTRIES)
-extern const unsigned int SCI_Q_ADAPTER_ATT_NUMBER_OF_ENTRIES;
-
-#define SCI_Q_ADAPTER_ATT_AVAILABLE_ENTRIES _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_ATT_AVAILABLE_ENTRIES)
-extern const unsigned int SCI_Q_ADAPTER_ATT_AVAILABLE_ENTRIES;
-
-#define SCI_Q_ADAPTER_PHYS_MEM_NODEID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SCI_Q_ADAPTER_PHYS_MEM_NODEID)
-extern const unsigned int SCI_Q_ADAPTER_PHYS_MEM_NODEID;
-
-#define SCI_Q_ADAPTER_PHYS_MBX_NODEID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SCI_Q_ADAPTER_PHYS_MBX_NODEID)
-extern const unsigned int SCI_Q_ADAPTER_PHYS_MBX_NODEID;
-
-#define SCI_Q_ADAPTER_PHYS_LINK_PORT_NODEID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_PHYS_LINK_PORT_NODEID)
-extern const unsigned int SCI_Q_ADAPTER_PHYS_LINK_PORT_NODEID;
-
-#define SCI_Q_ADAPTER_SCI_LINK_FREQUENCY _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_SCI_LINK_FREQUENCY)
-extern const unsigned int SCI_Q_ADAPTER_SCI_LINK_FREQUENCY;
-
-#define SCI_Q_ADAPTER_B_LINK_FREQUENCY _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_B_LINK_FREQUENCY)
-extern const unsigned int SCI_Q_ADAPTER_B_LINK_FREQUENCY;
-
-#define SCI_Q_ADAPTER_IO_BUS_FREQUENCY _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_IO_BUS_FREQUENCY)
-extern const unsigned int SCI_Q_ADAPTER_IO_BUS_FREQUENCY;
-
-/* Minor query commands (sub-commands) for adapter specific information SCI_SYSTEM */
-#define SCI_Q_SYSTEM_HOSTBRIDGE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SYSTEM_HOSTBRIDGE)
-extern const unsigned int SCI_Q_SYSTEM_HOSTBRIDGE;
-
-#define SCI_Q_SYSTEM_WRITE_POSTING_ENABLED _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SYSTEM_WRITE_POSTING_ENABLED)
-extern const unsigned int SCI_Q_SYSTEM_WRITE_POSTING_ENABLED;
-
-#define SCI_Q_SYSTEM_WRITE_COMBINING_ENABLED _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SYSTEM_WRITE_COMBINING_ENABLED)
-extern const unsigned int SCI_Q_SYSTEM_WRITE_COMBINING_ENABLED;
-
-#define SCI_Q_LOCAL_SEGMENT_IOADDR _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_LOCAL_SEGMENT_IOADDR)
-extern const unsigned int SCI_Q_LOCAL_SEGMENT_IOADDR;
-
-#define SCI_Q_REMOTE_SEGMENT_IOADDR _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_REMOTE_SEGMENT_IOADDR)
-extern const unsigned int SCI_Q_REMOTE_SEGMENT_IOADDR;
-
-#define SCI_Q_MAP_MAPPED_TO_LOCAL_TARGET _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_MAP_MAPPED_TO_LOCAL_TARGET)
-extern const unsigned int SCI_Q_MAP_MAPPED_TO_LOCAL_TARGET;
-
-#define SCI_Q_MAP_QUERY_REMOTE_MAPPED_TO_LOCAL_TARGET _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_MAP_QUERY_REMOTE_MAPPED_TO_LOCAL_TARGET)
-extern const unsigned int SCI_Q_MAP_QUERY_REMOTE_MAPPED_TO_LOCAL_TARGET;
-
-#define HOSTBRIDGE_NOT_AVAILABLE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_NOT_AVAILABLE)
-extern const unsigned int HOSTBRIDGE_NOT_AVAILABLE;
-
-#define HOSTBRIDGE_UNKNOWN _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_UNKNOWN)
-extern const unsigned int HOSTBRIDGE_UNKNOWN;
-
-#define HOSTBRIDGE_440FX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440FX)
-extern const unsigned int HOSTBRIDGE_440FX;
-
-#define HOSTBRIDGE_440LX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440LX)
-extern const unsigned int HOSTBRIDGE_440LX;
-
-#define HOSTBRIDGE_440BX_A _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440BX_A)
-extern const unsigned int HOSTBRIDGE_440BX_A;
-
-#define HOSTBRIDGE_440BX_B _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440BX_B)
-extern const unsigned int HOSTBRIDGE_440BX_B;
-
-#define HOSTBRIDGE_440GX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440GX)
-extern const unsigned int HOSTBRIDGE_440GX;
-
-#define HOSTBRIDGE_450KX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_450KX)
-extern const unsigned int HOSTBRIDGE_450KX;
-
-#define HOSTBRIDGE_430NX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_430NX)
-extern const unsigned int HOSTBRIDGE_430NX;
-
-#define HOSTBRIDGE_450NX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_450NX)
-extern const unsigned int HOSTBRIDGE_450NX;
-
-#define HOSTBRIDGE_450NX_MICO _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_450NX_MICO)
-extern const unsigned int HOSTBRIDGE_450NX_MICO;
-
-#define HOSTBRIDGE_450NX_PXB _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_450NX_PXB)
-extern const unsigned int HOSTBRIDGE_450NX_PXB;
-
-#define HOSTBRIDGE_I810 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I810)
-extern const unsigned int HOSTBRIDGE_I810;
-
-#define HOSTBRIDGE_I810_DC100 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I810_DC100)
-extern const unsigned int HOSTBRIDGE_I810_DC100;
-
-#define HOSTBRIDGE_I810E _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I810E)
-extern const unsigned int HOSTBRIDGE_I810E;
-
-#define HOSTBRIDGE_I815 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I815)
-extern const unsigned int HOSTBRIDGE_I815;
-
-#define HOSTBRIDGE_I840 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I840)
-extern const unsigned int HOSTBRIDGE_I840;
-
-#define HOSTBRIDGE_I850 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I850)
-extern const unsigned int HOSTBRIDGE_I850;
-
-#define HOSTBRIDGE_I860 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I860)
-extern const unsigned int HOSTBRIDGE_I860;
-
-#define HOSTBRIDGE_VIA_KT133 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_VIA_KT133)
-extern const unsigned int HOSTBRIDGE_VIA_KT133;
-
-#define HOSTBRIDGE_VIA_KX133 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_VIA_KX133)
-extern const unsigned int HOSTBRIDGE_VIA_KX133;
-
-#define HOSTBRIDGE_VIA_APOLLO_PRO_133A _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_VIA_APOLLO_PRO_133A)
-extern const unsigned int HOSTBRIDGE_VIA_APOLLO_PRO_133A;
-
-#define HOSTBRIDGE_VIA_APOLLO_PRO_266 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_VIA_APOLLO_PRO_266)
-extern const unsigned int HOSTBRIDGE_VIA_APOLLO_PRO_266;
-
-#define HOSTBRIDGE_AMD_760_MP _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_AMD_760_MP)
-extern const unsigned int HOSTBRIDGE_AMD_760_MP;
-
-#define HOSTBRIDGE_SERVERWORKS_HE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_HE)
-extern const unsigned int HOSTBRIDGE_SERVERWORKS_HE;
-
-#define HOSTBRIDGE_SERVERWORKS_HE_B _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_HE_B)
-extern const unsigned int HOSTBRIDGE_SERVERWORKS_HE_B;
-
-#define HOSTBRIDGE_SERVERWORKS_LE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_LE)
-extern const unsigned int HOSTBRIDGE_SERVERWORKS_LE;
-
-
-
-#define HOSTBRIDGE_WRITE_POSTING_DISABLED _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_WRITE_POSTING_DISABLED)
-extern const unsigned int HOSTBRIDGE_WRITE_POSTING_DISABLED;
-
-#define HOSTBRIDGE_WRITE_POSTING_ENABLED _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_WRITE_POSTING_ENABLED)
-extern const unsigned int HOSTBRIDGE_WRITE_POSTING_ENABLED;
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C R E A T E D M A Q U E U E *
- * *
- * Flags *
- * *
- * SCI_FLAG_DMA_PHDMA : Create physical DMA queue. Please note that this is an *
- * priveleged operation. *
- * *
- * *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCICreateDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCICreateDMAQueue)
-DLL void SCICreateDMAQueue(sci_desc_t sd,
- sci_dma_queue_t *dq,
- unsigned int localAdapterNo,
- unsigned int maxEntries,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I R E M O V E D M A Q U E U E *
- * *
- * Flags *
- * None. * *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Not allowed in this queue state. *
- * *
- *********************************************************************************/
-#define SCIRemoveDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIRemoveDMAQueue)
-DLL void SCIRemoveDMAQueue(sci_dma_queue_t dq,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I E N Q U E U E D M A T R A N S F E R *
- * *
- * Flags: *
- * *
- * SCI_FLAG_DMA_READ - The DMA will be remote --> local *
- * (default is local --> remote) *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the offset and size is larger *
- * than the segment size or larger than max *
- * DMA size. *
- * SCI_ERR_MAX_ENTRIES - The DMA queue is full *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_SEGMENT_NOT_PREPARED - The local segment has not been prepared for *
- * access from the adapter associated with the *
- * queue. *
- * SCI_ERR_SEGMENT_NOT_CONNECTED - The remote segment is not connected through *
- * the adapter associated with the queue. *
- *********************************************************************************/
-#define SCIEnqueueDMATransfer _SISCI_EXPANDE_FUNCTION_NAME(SCIEnqueueDMATransfer)
-DLL sci_dma_queue_state_t SCIEnqueueDMATransfer(sci_dma_queue_t dq,
- sci_local_segment_t localSegment,
- sci_remote_segment_t remoteSegment,
- unsigned int localOffset,
- unsigned int remoteOffset,
- unsigned int size,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I P O S T D M A Q U E U E *
- * *
- * Flags: *
- * *
- * SCI_FLAG_USE_CALLBACK - The end of the transfer will cause the callback *
- * function to be invoked. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation *
- * *
- *********************************************************************************/
-#define SCIPostDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIPostDMAQueue)
-DLL void SCIPostDMAQueue(sci_dma_queue_t dq,
- sci_cb_dma_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I A B O R T D M A Q U E U E *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation *
- * *
- *********************************************************************************/
-#define SCIAbortDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIAbortDMAQueue)
-DLL void SCIAbortDMAQueue(sci_dma_queue_t dq,
- unsigned int flags,
- sci_error_t *error);
-
-
-/*********************************************************************************
- * *
- * S C I R E S E T D M A Q U E U E *
- * *
- * Flags *
- * None. * *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIResetDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIResetDMAQueue)
-DLL void SCIResetDMAQueue(sci_dma_queue_t dq,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I D M A Q U E U E S T A T E *
- * *
- *********************************************************************************/
-#define SCIDMAQueueState _SISCI_EXPANDE_FUNCTION_NAME(SCIDMAQueueState)
-DLL sci_dma_queue_state_t SCIDMAQueueState(sci_dma_queue_t dq);
-
-
-
-/*********************************************************************************
- * *
- * S C I W A I T F O R D M A Q U E U E *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation *
- * SCI_ERR_TIMEOUT - The function timed out after specified *
- * timeout value. *
- * *
- *********************************************************************************/
-#define SCIWaitForDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForDMAQueue)
-DLL sci_dma_queue_state_t SCIWaitForDMAQueue(sci_dma_queue_t dq,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I P H D M A E N Q U E U E *
- * *
- * SISCI Priveleged function *
- * *
- * Flags *
- * *
- * SCI_FLAG_DMA_READ *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCIphDmaEnqueue _SISCI_EXPANDE_FUNCTION_NAME(SCIphDmaEnqueue)
-DLL void SCIphDmaEnqueue(sci_dma_queue_t dmaqueue,
- unsigned int size,
- sci_ioaddr_t localBusAddr,
- unsigned int remote_nodeid,
- unsigned int remote_highaddr,
- unsigned int remote_lowaddr,
- unsigned int flags,
- sci_error_t *error);
-
-/*********************************************************************************
- * *
- * S C I P H D M A S T A R T *
- * *
- * Flags *
- * *
- * SCI_FLAG_DMA_WAIT *
- * SCI_FLAG_USE_CALLBACK *
- * SCI_FLAG_DMA_RESET *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCIphDmaStart _SISCI_EXPANDE_FUNCTION_NAME(SCIphDmaStart)
-DLL sci_dma_queue_state_t SCIphDmaStart(sci_dma_queue_t dmaqueue,
- sci_cb_dma_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-
-/*********************************************************************************
- * *
- * S C I C R E A T E I N T E R R U P T *
- * *
- * Flags *
- * *
- * SCI_FLAG_USE_CALLBACK *
- * SCI_FLAG_FIXED_INTNO *
- * SCI_FLAG_SHARED_INT *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_INTNO_USED - This interrupt number is already used. *
- * *
- *********************************************************************************/
-#define SCICreateInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCICreateInterrupt)
-DLL void SCICreateInterrupt(sci_desc_t sd,
- sci_local_interrupt_t *interrupt,
- unsigned int localAdapterNo,
- unsigned int *interruptNo,
- sci_cb_interrupt_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I R E M O V E I N T E R R U P T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCIRemoveInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIRemoveInterrupt)
-DLL void SCIRemoveInterrupt(sci_local_interrupt_t interrupt,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I W A I T F O R I N T E R R U P T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_TIMEOUT - The function timed out after specified timeout value. *
- * SCI_ERR_CANCELLED - The wait was interrupted by a call to *
- * SCIRemoveInterrupt. *
- * The handle is invalid when this error code is returned.*
- * *
- *********************************************************************************/
-#define SCIWaitForInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForInterrupt)
-DLL void SCIWaitForInterrupt(sci_local_interrupt_t interrupt,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C O N N E C T I N T E R R U P T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_NO_SUCH_INTNO - No such interrupt number. *
- * SCI_ERR_CONNECTION_REFUSED - Connection attempt refused by remote node. *
- * SCI_ERR_TIMEOUT - The function timed out after specified *
- * timeout value. *
- * *
- *********************************************************************************/
-#define SCIConnectInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIConnectInterrupt)
-DLL void SCIConnectInterrupt(sci_desc_t sd,
- sci_remote_interrupt_t *interrupt,
- unsigned int nodeId,
- unsigned int localAdapterNo,
- unsigned int interruptNo,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-/*********************************************************************************
- * *
- * S C I D I S C O N N E C T I N T E R R U P T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIDisconnectInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIDisconnectInterrupt)
-DLL void SCIDisconnectInterrupt(sci_remote_interrupt_t interrupt,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I T R I G G E R I N T E R R U P T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCITriggerInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCITriggerInterrupt)
-DLL void SCITriggerInterrupt(sci_remote_interrupt_t interrupt,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I R E G I S T E R I N T E R R U P T F L A G *
- * *
- * *
- * This function register an "interrupt flag" that is identified as an unique *
- * location within a local segment. If successful, the resulting interrupt *
- * handle will have been associated with the specified local segment. *
- * *
- * It is up to the (remote) client(s) to set up an "interrupt mapping" for the *
- * corresponding segment offset using either the *
- * *
- * - SCI_FLAG_CONDITIONAL_INTERRUPT_MAP *
- * *
- * or the *
- * *
- * - SCI_FLAG_UNCONDITIONAL_DATA_INTERRUPT_MAP *
- * *
- * option to "SCIMapRemoteSegment()". - I.e. after having established a *
- * connection to the corresponding segment. A trigger operation can then *
- * be implemented using a store operation via the relevant "interrupt map". *
- * *
- * *
- * *
- * *
- * *
- * Flags: *
- * *
- * SCI_FLAG_CONDITIONAL_INTERRUPT - Triggering is to take place using *
- * "conditional interrupts". *
- * *
- * *
- * *
- * Specific error codes for this function: *
- * None. *
- * *
- *********************************************************************************/
-#define SCIRegisterInterruptFlag _SISCI_EXPANDE_FUNCTION_NAME(SCIRegisterInterruptFlag)
-DLL void SCIRegisterInterruptFlag(
- unsigned int localAdapterNo,
- sci_local_interrupt_t *interrupt,
- sci_local_segment_t segment,
- unsigned int offset,
- sci_cb_interrupt_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I E N A B L E C O N D I T I O N A L I N T E R R U P T *
- * *
- * *
- * This function make sure that another HW interrupt will take place the next *
- * time the corresponding interrupt flag is triggered by a *
- * "conditional interrupt" operation. *
- * *
- * Default semantics: *
- * *
- * When successful, the client can rely on that the first subsequent trigger *
- * operation will cause a HW interrupt and subsequently cause the client *
- * handler function to be invoked. *
- * *
- * If an interrupt was triggered in parallell with the enable operation, then *
- * the operation will fail (SCI_ERR_COND_INT_RACE_PROBLEM), and the client can *
- * not rely on another trigger operation will lead to handler invocation. *
- * Hence, any state checking normally associated with handling the *
- * corresponding interrupt should take place before attempting to enable *
- * again. *
- * *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_COND_INT_RACE_PROBLEM - The enable operation failed because an *
- * incomming trigger operation happened *
- * concurrently. *
- * *
- *********************************************************************************/
-#define SCIEnableConditionalInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIEnableConditionalInterrupt)
-DLL void SCIEnableConditionalInterrupt(
- sci_local_interrupt_t interrupt,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I D I S A B L E C O N D I T I O N A L I N T E R R U P T *
- * *
- * *
- * Prevent subsequent "conditional interrupt"trigger operations for *
- * the specified interupt flag from causing HW interrupt and handler *
- * invocations. *
- * *
- * *
- * Default semantics: *
- * *
- * If successful, no subsequent HW interrupts will take place, but handler *
- * invocations that have already been scheduled may still take place. *
- * *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIDisableConditionalInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIDisableConditionalInterrupt)
-DLL void SCIDisableConditionalInterrupt(
- sci_local_interrupt_t interrupt,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I G E T C O N D I T I O N A L I N T E R R U P T C O U N T E R *
- * *
- * *
- * Returns a value that indicates the number of times this flag has *
- * been trigged since the last time it was enabled or disabled. *
- * Calling the SCIEnableConditionalInterrupt / SCIDisableConditionalInterrupt *
- * functions will reset the counter value. *
- * *
- * Default semantics: *
- * *
- * If successful, the current trig count is returned in the *
- * interruptTrigCounter parameter. *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OVERFLOW - The number of trig operations have exceeded the range *
- * that can be counted. *
- *********************************************************************************/
-#define SCIGetConditionalInterruptTrigCounter _SISCI_EXPANDE_FUNCTION_NAME(SCIGetConditionalInterruptTrigCounter)
-DLL void SCIGetConditionalInterruptTrigCounter(
- sci_local_interrupt_t interrupt,
- unsigned int *interruptTrigCounter,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I T R A N S F E R B L O C K *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the size and offset is larger *
- * than the corresponding map size. *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_TRANSFER_FAILED - The data transfer failed. *
- * *
- *********************************************************************************/
-#define SCITransferBlock _SISCI_EXPANDE_FUNCTION_NAME(SCITransferBlock)
-DLL void SCITransferBlock(sci_map_t sourceMap,
- unsigned int sourceOffset,
- sci_map_t destinationMap,
- unsigned int destinationOffset,
- unsigned int size,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I T R A N S F E R B L O C K A S Y N C *
- * *
- * Flags *
- * *
- * SCI_FLAG_BLOCK_READ *
- * SCI_FLAG_USE_CALLBACK *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the size and offset is larger than *
- * the corresponding map size. *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required by *
- * the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_TRANSFER_FAILED - The data transfer failed. *
- * *
- *********************************************************************************/
-#define SCITransferBlockAsync _SISCI_EXPANDE_FUNCTION_NAME(SCITransferBlockAsync)
-DLL void SCITransferBlockAsync(sci_map_t sourceMap,
- unsigned int sourceOffset,
- sci_map_t destinationMap,
- unsigned int destinationOffset,
- unsigned int size,
- sci_block_transfer_t *block,
- sci_cb_block_transfer_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I W A I T F O R B L O C K T R A N S F E R *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation *
- * SCI_ERR_TIMEOUT - The function timed out after specified *
- * timeout value. *
- * *
- *********************************************************************************/
-#define SCIWaitForBlockTransfer _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForBlockTransfer)
-DLL void SCIWaitForBlockTransfer(sci_block_transfer_t block,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I A B O R T B L O C K T R A N S F E R *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation *
- * *
- *********************************************************************************/
-#define SCIAbortBlockTransfer _SISCI_EXPANDE_FUNCTION_NAME(SCIAbortBlockTransfer)
-DLL void SCIAbortBlockTransfer(sci_block_transfer_t block,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I M E M C P Y *
- * *
- * Flags: *
- * SCI_FLAG_BLOCK_READ *
- * SCI_FLAG_ERROR_CHECK *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the size and offset is larger *
- * than the corresponding map size. *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_TRANSFER_FAILED - The data transfer failed. *
- * *
- *********************************************************************************/
-
-#define SCIMemCpy _SISCI_EXPANDE_FUNCTION_NAME(SCIMemCpy)
-DLL void SCIMemCpy(sci_sequence_t sequence,
- void *memAddr,
- sci_map_t remoteMap,
- unsigned int remoteOffset,
- unsigned int size,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I M E M C O P Y *
- * *
- * Flags: *
- * SCI_FLAG_BLOCK_READ *
- * SCI_FLAG_ERROR_CHECK *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the size and offset is larger *
- * than the corresponding map size. *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_TRANSFER_FAILED - The data transfer failed. *
- * *
- *********************************************************************************/
-
-
-#define SCIMemCopy _SISCI_EXPANDE_FUNCTION_NAME(SCIMemCopy)
-DLL void SCIMemCopy(void *memAddr,
- sci_map_t remoteMap,
- unsigned int remoteOffset,
- unsigned int size,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I R E G I S T E R S E G M E N T M E M O R Y *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required by *
- * the implementation. *
- * SCI_ERR_ILLEGAL_ADDRESS - Illegal address. *
- * SCI_ERR_OUT_OF_RANGE - Size is larger than the maximum size for the *
- * local segment. *
- * *
- *********************************************************************************/
-#define SCIRegisterSegmentMemory _SISCI_EXPANDE_FUNCTION_NAME(SCIRegisterSegmentMemory)
-DLL void SCIRegisterSegmentMemory(void *address,
- unsigned int size,
- sci_local_segment_t segment,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C O N N E C T S C I S P A C E *
- * *
- * SISCI Priveleged function *
- * *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_CONNECTION_REFUSED - Connection attempt refused by remote node. *
- * *
- *********************************************************************************/
-#define SCIConnectSCISpace _SISCI_EXPANDE_FUNCTION_NAME(SCIConnectSCISpace)
-DLL void SCIConnectSCISpace(sci_desc_t sd,
- unsigned int localAdapterNo,
- sci_remote_segment_t *segment,
- sci_address_t address,
- unsigned int size,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*
- * =====================================================================================
- *
- * S C I A T T A C H L O C A L S E G M E N T
- * Description:
- *
- * SCIAttachLocalSegment() permits an application to "attach" to an already existing
- * local segment, implying that two or more application want
- * share the same local segment. The prerequest, is that the
- * application which originally created the segment ("owner") has
- * preformed a SCIShareSegment() in order to mark the segment
- * "shareable".
- *
- *
- * Flags:
- *
- * SCI_FLAG_USE_CALLBACK - The callback function will be invoked for events
- * on this segment.
- *
- *
- * Specific error codes for this function:
- *
- * SCI_ERR_ACCESS - No such shared segment
- * SCI_ERR_NO_SUCH_SEGMENT - No such segment
- * Note: Current implenentation will return SCI_ERR_ACCESS for both cases. This will
- * change from next release. Application should handle both cases.
- *
- * =====================================================================================
- */
-#define SCIAttachLocalSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIAttachLocalSegment)
-
-DLL void
-SCIAttachLocalSegment(sci_desc_t sd,
- sci_local_segment_t *segment,
- unsigned int segmentId,
- unsigned int *size,
- sci_cb_local_segment_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-/*
- * =====================================================================================
- *
- * S C I S H A R E S E G M E N T
- *
- * Description:
- *
- * SCIShareSegment() permits other application to "attach" to an already existing
- * local segment, implying that two or more application want
- * share the same local segment. The prerequest, is that the
- * application which originally created the segment ("owner") has
- * preformed a SCIShareSegment() in order to mark the segment
- * "shareable".
- *
- *
- * Flags:
- * none
- *
- * Specific error codes for this function:
- *
- *
- *
- * =====================================================================================
- */
-#define SCIShareSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIShareSegment)
-
-DLL void
-SCIShareSegment(sci_local_segment_t segment,
- unsigned int flags,
- sci_error_t *error);
-
-
-/*********************************************************************************
- * *
- * S C I F L U S H *
- * *
- * This function will flush the CPU buffers and the PSB buffers. *
- * *
- * Flags *
- * SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY : *
- * Only flush CPU buffers ( Write combining *
- * etc buffers). *
- * *
- *********************************************************************************/
-
-#define SCIFlush _SISCI_EXPANDE_FUNCTION_NAME(SCIFlush)
-DLL void SCIFlush(sci_sequence_t sequence,
- unsigned int flags);
-
-#if defined(CPLUSPLUS) || defined(__cplusplus)
-}
-#endif
-
-
-#endif
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ndb/src/external/SOLARIS.SPARC/sci/include/sisci_error.h b/ndb/src/external/SOLARIS.SPARC/sci/include/sisci_error.h
deleted file mode 100644
index aab7c136d3a..00000000000
--- a/ndb/src/external/SOLARIS.SPARC/sci/include/sisci_error.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* $Id: sisci_error.h,v 1.1 2002/12/13 12:17:22 hin Exp $ */
-
-/*******************************************************************************
- * *
- * Copyright (C) 1993 - 2000 *
- * Dolphin Interconnect Solutions AS *
- * *
- * 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 _SISCI_ERROR_H_
-#define _SISCI_ERROR_H_
-
-
-/* SCI Error return values always have 30 bit set */
-#define SCI_ERR_MASK 0x40000000
-#define SCI_ERR_REMOTE_MASK 0x01 /* Remote errors should have bit 0 set */
-
-#define SCI_ERR(u) ((unsigned32)(u)&0x7FFFFFFF )
-
-/* Error codes */
-typedef enum {
- SCI_ERR_OK = 0x000,
-
-
- SCI_ERR_BUSY = (0x900 | SCI_ERR_MASK),
- SCI_ERR_FLAG_NOT_IMPLEMENTED = (0x901 | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_FLAG = (0x902 | SCI_ERR_MASK),
- SCI_ERR_NOSPC = (0x904 | SCI_ERR_MASK),
- SCI_ERR_API_NOSPC = (0x905 | SCI_ERR_MASK),
- SCI_ERR_HW_NOSPC = (0x906 | SCI_ERR_MASK),
- SCI_ERR_NOT_IMPLEMENTED = (0x907 | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_ADAPTERNO = (0x908 | SCI_ERR_MASK),
- SCI_ERR_NO_SUCH_ADAPTERNO = (0x909 | SCI_ERR_MASK),
- SCI_ERR_TIMEOUT = (0x90A | SCI_ERR_MASK),
- SCI_ERR_OUT_OF_RANGE = (0x90B | SCI_ERR_MASK),
- SCI_ERR_NO_SUCH_SEGMENT = (0x90C | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_NODEID = (0x90D | SCI_ERR_MASK),
- SCI_ERR_CONNECTION_REFUSED = (0x90E | SCI_ERR_MASK),
- SCI_ERR_SEGMENT_NOT_CONNECTED = (0x90F | SCI_ERR_MASK),
- SCI_ERR_SIZE_ALIGNMENT = (0x910 | SCI_ERR_MASK),
- SCI_ERR_OFFSET_ALIGNMENT = (0x911 | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_PARAMETER = (0x912 | SCI_ERR_MASK),
- SCI_ERR_MAX_ENTRIES = (0x913 | SCI_ERR_MASK),
- SCI_ERR_SEGMENT_NOT_PREPARED = (0x914 | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_ADDRESS = (0x915 | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_OPERATION = (0x916 | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_QUERY = (0x917 | SCI_ERR_MASK),
- SCI_ERR_SEGMENTID_USED = (0x918 | SCI_ERR_MASK),
- SCI_ERR_SYSTEM = (0x919 | SCI_ERR_MASK),
- SCI_ERR_CANCELLED = (0x91A | SCI_ERR_MASK),
- SCI_ERR_NOT_CONNECTED = (0x91B | SCI_ERR_MASK),
- SCI_ERR_NOT_AVAILABLE = (0x91C | SCI_ERR_MASK),
- SCI_ERR_INCONSISTENT_VERSIONS = (0x91D | SCI_ERR_MASK),
- SCI_ERR_COND_INT_RACE_PROBLEM = (0x91E | SCI_ERR_MASK),
- SCI_ERR_OVERFLOW = (0x91F | SCI_ERR_MASK),
- SCI_ERR_NOT_INITIALIZED = (0x920 | SCI_ERR_MASK),
-
- SCI_ERR_ACCESS = (0x921 | SCI_ERR_MASK),
-
- SCI_ERR_NO_SUCH_NODEID = (0xA00 | SCI_ERR_MASK),
- SCI_ERR_NODE_NOT_RESPONDING = (0xA02 | SCI_ERR_MASK),
- SCI_ERR_NO_REMOTE_LINK_ACCESS = (0xA04 | SCI_ERR_MASK),
- SCI_ERR_NO_LINK_ACCESS = (0xA05 | SCI_ERR_MASK),
- SCI_ERR_TRANSFER_FAILED = (0xA06 | SCI_ERR_MASK)
-} sci_error_t;
-
-
-#endif /* _SCI_ERROR_H_ */
-
-
-
diff --git a/ndb/src/external/SOLARIS.SPARC/sci/include/sisci_types.h b/ndb/src/external/SOLARIS.SPARC/sci/include/sisci_types.h
deleted file mode 100644
index 77989ffca59..00000000000
--- a/ndb/src/external/SOLARIS.SPARC/sci/include/sisci_types.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/* $Id: sisci_types.h,v 1.1 2002/12/13 12:17:22 hin Exp $ */
-
-/*******************************************************************************
- * *
- * Copyright (C) 1993 - 2000 *
- * Dolphin Interconnect Solutions AS *
- * *
- * 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 _SISCI_TYPES_H
-#define _SISCI_TYPES_H
-
-#include "sisci_error.h"
-
-#ifndef IN
-#define IN
-#endif
-
-#ifndef OUT
-#define OUT
-#endif
-
-#ifndef IN_OUT
-#define IN_OUT
-#endif
-
-/* Opaque data types for descriptors/handles */
-typedef struct sci_desc *sci_desc_t;
-typedef struct sci_local_segment *sci_local_segment_t;
-typedef struct sci_remote_segment *sci_remote_segment_t;
-
-typedef struct sci_map *sci_map_t;
-typedef struct sci_sequence *sci_sequence_t;
-#ifndef KERNEL
-typedef struct sci_dma_queue *sci_dma_queue_t;
-#endif
-typedef struct sci_remote_interrupt *sci_remote_interrupt_t;
-typedef struct sci_local_interrupt *sci_local_interrupt_t;
-typedef struct sci_block_transfer *sci_block_transfer_t;
-
-/*
- * Constants defining reasons for segment callbacks:
- */
-
-typedef enum {
- SCI_CB_CONNECT = 1,
- SCI_CB_DISCONNECT,
- SCI_CB_NOT_OPERATIONAL,
- SCI_CB_OPERATIONAL,
- SCI_CB_LOST
-} sci_segment_cb_reason_t;
-
-#define MAX_CB_REASON SCI_CB_LOST
-
-/* dma_queue_states is identical to the dma_queue_state_t in genif.h, they must be consistent.*/
-typedef enum {
- SCI_DMAQUEUE_IDLE,
- SCI_DMAQUEUE_GATHER,
- SCI_DMAQUEUE_POSTED,
- SCI_DMAQUEUE_DONE,
- SCI_DMAQUEUE_ABORTED,
- SCI_DMAQUEUE_ERROR
-} sci_dma_queue_state_t;
-
-
-typedef enum {
- SCI_SEQ_OK,
- SCI_SEQ_RETRIABLE,
- SCI_SEQ_NOT_RETRIABLE,
- SCI_SEQ_PENDING
-} sci_sequence_status_t;
-
-
-typedef struct {
- unsigned short nodeId; /* SCI Address bit 63 - 48 */
- unsigned short offsHi; /* SCI Address bit 47 - 32 */
- unsigned int offsLo; /* SCI Address bit 31 - 0 */
-} sci_address_t;
-
-
-typedef unsigned int sci_ioaddr_t;
-
-typedef enum {
- SCI_CALLBACK_CANCEL = 1,
- SCI_CALLBACK_CONTINUE
-} sci_callback_action_t;
-
-#ifndef KERNEL
-typedef sci_callback_action_t (*sci_cb_local_segment_t)(void *arg,
- sci_local_segment_t segment,
- sci_segment_cb_reason_t reason,
- unsigned int nodeId,
- unsigned int localAdapterNo,
- sci_error_t error);
-
-typedef sci_callback_action_t (*sci_cb_remote_segment_t)(void *arg,
- sci_remote_segment_t segment,
- sci_segment_cb_reason_t reason,
- sci_error_t status);
-
-
-typedef sci_callback_action_t (*sci_cb_dma_t)(void IN *arg,
- sci_dma_queue_t queue,
- sci_error_t status);
-
-
-typedef int (*sci_cb_block_transfer_t)(void *arg,
- sci_block_transfer_t block,
- sci_error_t status);
-
-
-typedef sci_callback_action_t (*sci_cb_interrupt_t)(void *arg,
- sci_local_interrupt_t interrupt,
- sci_error_t status);
-
-#endif /* KERNEL */
-#endif
diff --git a/ndb/src/external/SOLARIS.SPARC/sci/include/sisci_version.h b/ndb/src/external/SOLARIS.SPARC/sci/include/sisci_version.h
deleted file mode 100644
index c2fccb9ec33..00000000000
--- a/ndb/src/external/SOLARIS.SPARC/sci/include/sisci_version.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* $Id: sisci_version.h,v 1.1 2002/12/13 12:17:22 hin Exp $ */
-
-/*******************************************************************************
- * *
- * Copyright (C) 1993 - 2000 *
- * Dolphin Interconnect Solutions AS *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU Lesser General Public License as published by *
- * the Free Software Foundation; either version 2.1 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 Lesser 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 SISCI_VERSION_H
-#define SISCI_VERSION_H
-
-
-#define SISCI_API_VER_MAJOR 1
-#define SISCI_API_VER_MAJORC "1"
-
-#define SISCI_API_VER_MINOR 10
-#define SISCI_API_VER_MINORC "10"
-#define SISCI_API_VER_MICRO 4
-#define SISCI_API_VER_MICROC "4"
-
-#define SISCI_SIGN_VERSION_MASK 0xfffff000 /* used to mask off API_VER_MICRO */
-
-#define SISCI_API_VERSION (SISCI_API_VER_MAJOR << 24 | SISCI_API_VER_MINOR << 12 | SISCI_API_VER_MICRO)
-
-/* the rules are:
- *
- * Changes in API_VER_MICRO should be binary compatible, New flags, functions added. No changes to user code
- * required if new features is not needed.
- *
- * Changes in API_VER_MINOR requires recompilation of user code.
- *
- * Changes in the API_VER_MAJOR will most likely require changes to user code. This should not happen very
- * often...
- *
- */
-
-#ifndef BUILD_DATE
-#define BUILD_DATE __DATE__
-#endif
-
-#ifndef BUILD_NAME
-#define BUILD_NAME ""
-#endif
-
-#define API_VERSION "SISCI API version " SISCI_API_VER_MAJORC "." SISCI_API_VER_MINORC "."SISCI_API_VER_MICROC " ( "BUILD_NAME" "BUILD_DATE" )"
-
-#endif
-
-
-/* Version info: */
-/* */
-/* 1.5.2 First SISCI version */
-/* 1.5.3 Some bug fixes */
-/* 1.5.4 Some bug fixes */
-/* 1.5.5 No release */
-/* 1.5.6 Lock flag implemented in function SCIConnectSegment */
-/* 1.5.7 Expanded query functionality */
-/* 1.5.8 Updated error checking (sequence) functionality for D320 */
-/* 1.6.0 Updated error checking (sequence) D320 and IRM 1.9 support */
-/* 1.9.0 Ported to Solaris_sparc, Solaris_x86 and Linux. IRM 1.9. */
-/* 1.9.1 Some bug fixes */
-/* 1.9.2 Added more adapter queries */
-/* 1.9.3 Bug fix in SCIMapLocalSegment and SCIMapRemoteSegment */
-/* 1.9.4 NT Release Developers Kit 2.40 */
-/* 1.9.5 Added flush after data transfer in SCIMemCopy() */
-/* 1.9.5 NT Release Developers Kit 2.44 */
-/* 1.10.0:
- * New SCIInitialize(), SCITerminate() functions.
- * Support for D330
- *
- *
- */
-
-
diff --git a/ndb/src/external/WIN32.x86/sci/include/rmlib.h b/ndb/src/external/WIN32.x86/sci/include/rmlib.h
deleted file mode 100644
index 87ba20db99f..00000000000
--- a/ndb/src/external/WIN32.x86/sci/include/rmlib.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/* $Id: rmlib.h,v 1.1 2002/12/13 12:17:23 hin Exp $ */
-
-/*********************************************************************************
- * *
- * Copyright (C) 1993 - 2000 *
- * Dolphin Interconnect Solutions AS *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU Lesser General Public License as published by *
- * the Free Software Foundation; either version 2.1 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 Lesser 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. *
- * *
- * *
- *********************************************************************************/
-
-/********************************************************************************/
-/* This header file contains the declarations of the SCI Reflective Memory */
-/* library rmlib. The implementation of the library functions is in rmlib.c. */
-/* The library contains all the functions that operate on the reflective */
-/* memory. */
-/* */
-/* NB! */
-/* */
-/* DOLPHIN'S SCI REFLECTIVE MEMORY FILES ARE UNDER DEVELOPMENT AND MAY CHANGE. */
-/* PLEASE CONTACT DOLPHIN FOR FURTHER INFORMATION. */
-/* */
-/* */
-/********************************************************************************/
-
-#include "sisci_error.h"
-#include "sisci_api.h"
-#include "sisci_demolib.h"
-#include "sisci_types.h"
-
-unsigned int seqerr, syncseqerr;
-
-#ifndef _RMLIB_H
-#define _RMLIB_H
-
-
-#if defined(_REENTRANT)
-
-#define _RMLIB_EXPAND_NAME(name) _RMLIB_MT_ ## name
-
-#else
-
-#define _RMLIB_EXPAND_NAME(name) _RMLIB_ST_ ## name
-
-#endif
-
-#ifdef __sparc
-#define CACHE_SIZE 2097152
-#else
-#define CACHE_SIZE 8192
-#endif
-
-/*********************************************************************************/
-/* FLAG VALUES */
-/*********************************************************************************/
-
-#define REFLECT_ERRCHECK 0x2
-
-struct ReflectiveMemorySpace {
- unsigned int localAdapterNo;
- unsigned int localNodeId;
- unsigned int remoteNodeId;
- sci_desc_t sd;
- sci_desc_t syncsd;
- sci_map_t localMap;
- sci_map_t remoteMap;
- unsigned int localSegmentId;
- unsigned int remoteSegmentId;
- unsigned int syncSegmentId;
- unsigned int sync_rSegmentId;
- unsigned int segmentSize;
- unsigned int *localMapAddr;
- volatile unsigned int *remoteMapAddr;
- sci_local_segment_t localSegment;
- sci_remote_segment_t remoteSegment;
- sci_local_segment_t syncSegment;
- sci_remote_segment_t sync_rSegment;
- sci_map_t syncMap;
- sci_map_t sync_rMap;
- sci_sequence_t syncsequence;
- sci_sequence_t sequence;
- unsigned int protection;
- unsigned int retry_value;
- sci_sequence_status_t sequenceStatus, syncsequenceStatus;
- volatile unsigned int *syncMapAddr;
- volatile unsigned int *sync_rMapAddr;
-};
-
-/*********************************************************************************/
-/* P R I N T R E F L E C T I V E M E M O R Y S P A C E */
-/* */
-/*********************************************************************************/
-#define ReflectPrintParameters _RMLIB_EXPAND_NAME(ReflectPrintParameters)
-void ReflectPrintParameters(FILE *stream, struct ReflectiveMemorySpace RM_space);
-
-/*********************************************************************************/
-/* R E F L E C T D M A S E T U P */
-/* */
-/*********************************************************************************/
-#define ReflectDmaSetup _RMLIB_EXPAND_NAME(ReflectDmaSetup)
-sci_error_t ReflectDmaSetup(struct ReflectiveMemorySpace RM_space, sci_dma_queue_t *dmaQueue);
-
-/*********************************************************************************/
-/* R E F L E C T D M A R E M O V E */
-/* */
-/*********************************************************************************/
-#define ReflectDmaRemove _RMLIB_EXPAND_NAME(ReflectDmaRemove)
-sci_error_t ReflectDmaRemove(sci_dma_queue_t dmaQueue);
-
-/*********************************************************************************/
-/* R E F L E C T D M A R U N */
-/* */
-/*********************************************************************************/
-#define ReflectDmaRun _RMLIB_EXPAND_NAME(ReflectDmaRun)
-sci_error_t ReflectDmaRun(struct ReflectiveMemorySpace RM_space,
- unsigned int* privateSrc,
- unsigned int size,
- unsigned int offset,
- sci_dma_queue_t dmaQueue);
-/*********************************************************************************/
-/* C L O S E R E F L E C T I V E M E M O R Y S P A C E */
-/* */
-/*********************************************************************************/
-#define ReflectClose _RMLIB_EXPAND_NAME(ReflectClose)
-sci_error_t ReflectClose(struct ReflectiveMemorySpace RM_space, unsigned int segment_no);
-
-/*********************************************************************************/
-/* O P E N R E F L E C T I V E M E M O R Y S P A C E */
-/* */
-/*********************************************************************************/
-#define ReflectOpen _RMLIB_EXPAND_NAME(ReflectOpen)
-sci_error_t ReflectOpen(struct ReflectiveMemorySpace *RM_space,
- unsigned int size,
- unsigned int segment_no,
- unsigned int localAdapterNo,
- unsigned int remoteNodeId,
- unsigned int protection,
- unsigned int retry_value);
-
-/*********************************************************************************/
-/* R E F L E C T G E T A C C E S S */
-/* */
-/*********************************************************************************/
-#define ReflectGetAccess _RMLIB_EXPAND_NAME(ReflectGetAccess)
-sci_error_t ReflectGetAccess(struct ReflectiveMemorySpace *RM_space);
-
-/*********************************************************************************/
-/* R E F L E C T R E L E A S E A C C E S S */
-/* */
-/*********************************************************************************/
-#define ReflectReleaseAccess _RMLIB_EXPAND_NAME(ReflectReleaseAccess)
-sci_error_t ReflectReleaseAccess(struct ReflectiveMemorySpace *RM_space);
-
-/*********************************************************************************/
-/* R E F L E C T D M A */
-/* */
-/*********************************************************************************/
-#define ReflectDma _RMLIB_EXPAND_NAME(ReflectDma)
-sci_error_t ReflectDma(struct ReflectiveMemorySpace RM_space,
- unsigned int* privateSrc,
- unsigned int size,
- unsigned int offset);
-
-/*********************************************************************************/
-/* R E F L E C T M E M C O P Y */
-/* */
-/*********************************************************************************/
-#define ReflectMemCopy _RMLIB_EXPAND_NAME(ReflectMemCopy)
-sci_error_t ReflectMemCopy(struct ReflectiveMemorySpace RM_space,
- unsigned int* privateSrc,
- unsigned int size,
- unsigned int offset,
- unsigned int flags);
-
-/*********************************************************************************/
-/* R E F L E C T S E T */
-/* */
-/*********************************************************************************/
-#define ReflectSet _RMLIB_EXPAND_NAME(ReflectSet)
-sci_error_t ReflectSet(struct ReflectiveMemorySpace RM_space,
- unsigned int value,
- unsigned int size,
- unsigned int offset,
- unsigned int flags
- );
-
-/*********************************************************************************/
-/* R E F L E C T P R I N T */
-/* */
-/*********************************************************************************/
-#define ReflectPrint _RMLIB_EXPAND_NAME(ReflectPrint)
-sci_error_t ReflectPrint(FILE *stream,
- struct ReflectiveMemorySpace RM_space,
- unsigned int size,
- unsigned int offset
- );
-
-
-#endif
diff --git a/ndb/src/external/WIN32.x86/sci/include/scilib.h b/ndb/src/external/WIN32.x86/sci/include/scilib.h
deleted file mode 100644
index d1501082bab..00000000000
--- a/ndb/src/external/WIN32.x86/sci/include/scilib.h
+++ /dev/null
@@ -1,330 +0,0 @@
-/* $Id: scilib.h,v 1.1 2002/12/13 12:17:23 hin Exp $ */
-
-/*******************************************************************************
- * *
- * Copyright (C) 2002 *
- * Dolphin Interconnect Solutions AS *
- * *
- *******************************************************************************/
-
-
-#if defined(_REENTRANT)
-#define _SCIL_EXPANDE_FUNCTION_NAME(name) _SCIL_PUBLIC_FUNC_MT_ ## name
-#define _SCIL_EXPANDE_VARIABLE_NAME(name) _SCIL_PUBLIC_VAR_MT_ ## name
-#else
-#define _SCIL_EXPANDE_FUNCTION_NAME(name) _SCIL_PUBLIC_FUNC_ST_ ## name
-#define _SCIL_EXPANDE_VARIABLE_NAME(name) _SCIL_PUBLIC_VAR_ST_ ## name
-#endif
-#define _SCIL_EXPANDE_CONSTANT_NAME(name) _SCIL_PUBLIC_CONST_ ## name
-
-#include "sisci_api.h"
-
-#if defined(CPLUSPLUS) || defined(__cplusplus)
-extern "C" {
-#endif
-
-
-/*
- * SISCI segment id pollution:
- * ===========================
- * The SISCI library uses regular SISCI segmens internally.
- * The MSG_QUEUE_LIB_IDENTIFIER_MASK is a mask which is used by the SISCI
- * library to identify internal SISCI segments ids, from segments used directly
- * by the user.
- *
- * Future versions of the library may have its own namespace.
- *
- */
-
-#define MSG_QUEUE_LIB_IDENTIFIER_MASK 0x10000000
-
-
-/*********************************************************************************/
-/* FLAG VALUES */
-/*********************************************************************************/
-
-#define SCIL_FLAG_ERROR_CHECK_DATA _SCIL_EXPANDE_CONSTANT_NAME(SCIL_FLAG_ERROR_CHECK_DATA)
-extern const unsigned int SCIL_FLAG_ERROR_CHECK_DATA;
-
-#define SCIL_FLAG_ERROR_CHECK_PROT _SCIL_EXPANDE_CONSTANT_NAME(SCIL_FLAG_ERROR_CHECK_PROT)
-extern const unsigned int SCIL_FLAG_ERROR_CHECK_PROT;
-
-#define SCIL_FLAG_FULL_ERROR_CHECK _SCIL_EXPANDE_CONSTANT_NAME(SCIL_FLAG_FULL_ERROR_CHECK)
-extern const unsigned int SCIL_FLAG_FULL_ERROR_CHECK;
-
-
-
-
-
-typedef struct sci_msq_queue *sci_msq_queue_t;
-
-
-/*********************************************************************************
- * *
- * S C I L C r e a t e M s g Q u e u e *
- * *
- * Parameters: *
- * *
- * Creates a message queue. The message queue identifier object will be allocated*
- * if the sci_msq_queue_t * msg pointer is NULL. The function will create a *
- * remote connection. If this connection times out, the function shoud be *
- * repeated until connection is established. SCILRemoveMsgQueue() must be called *
- * to remove the connection and deallocate the message queue identifier. *
- * *
- * sci_msq_queue_t *msq : Message queue identifier *
- * The function must be called with a null pointer *
- * the first time. *
- * unsigned int localAdapterNo: Local Adapter Number *
- * unsigned int remoteNodeId : Remote nodeId *
- * unsigned int msqId : Message queue number *
- * unsigned int maxMsgCount : The maximum count of messages in queue *
- * unsigned int maxMsgSize, : The maximum size of each messages in queue *
- * unsigned int timeout : Time to wait for successful connection *
- * unsigned int flags : Flags. *
- * *
- * Flags *
- * *
- * None *
- * *
- * Specific error codes for this function: *
- * *
- * None. Normal SISIC error codes. *
- * *
- *********************************************************************************/
-#define SCILCreateMsgQueue _SCIL_EXPANDE_FUNCTION_NAME(SCILCreateMsgQueue)
-DLL sci_error_t SCILCreateMsgQueue(sci_msq_queue_t *msq,
- unsigned int localAdapterNo,
- unsigned int remoteNodeId,
- unsigned int msqId,
- unsigned int maxMsgCount,
- unsigned int maxMsgSize,
- unsigned int timeout,
- unsigned int flags);
-
-
-/*********************************************************************************
- * *
- * S C I L R e c e i v e M s g *
- * *
- * *
- * Receives a message from the queue. *
- * *
- * Paremeters *
- * *
- * sci_msq_queue_t msq : message queue identifier *
- * void *msg : Location to store received data *
- * unsigned int size : Size of message to read *
- * unsigned int *sizeLeft: Bytes left in buffer, after current receive. This is *
- * just a hint. There may be more. *
- * *
- * Flags *
- * *
- * SCIL_FLAG_ERROR_CHECK_PROT: The internal buffer management is done using full*
- * error checking.
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_EWOULD_BLOCK : There is not enough data in the message buffer *
- * to read the specified number of bytes. *
- * . *
- * SCI_ERR_NOT_CONNECTED : The connection is not established. *
- * *
- *********************************************************************************/
-#define SCILReceiveMsg _SCIL_EXPANDE_FUNCTION_NAME(SCILReceiveMsg)
-DLL sci_error_t SCILReceiveMsg(
- sci_msq_queue_t msq,
- void *msg,
- unsigned int size,
- unsigned int *sizeLeft,
- unsigned int flags);
-
-
-
-/*********************************************************************************
- * *
- * S C I L S e n d M s g *
- * *
- * *
- * Sends a message to the queue. *
- * *
- * Paremeters *
- * *
- * sci_msq_queue_t msq : Message queue identifier *
- * void *msg : Send data *
- * unsigned int size : Size of message to send *
- * unsigned int *sizeFree: Bytes free in buffer, after current send. This is *
- * just a hint. There may be more. *
- * *
- * Flags *
- * *
- * SCIL_FLAG_ERROR_CHECK_DATA: The data is transmitted using full error checking*
- * SCIL_FLAG_ERROR_CHECK_PROT: The internal buffer management is done using full*
- * error checking. *
- * SCIL_FLSG_FULL_ERROR_CHECK: This flag is an combination of both above. *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_EWOULD_BLOCK : There is not enough data in the message buffer *
- * to send the specified number of bytes. *
- * . *
- * SCI_ERR_NOT_CONNECTED : The connection is not established. *
- * *
- *********************************************************************************/
-#define SCILSendMsg _SCIL_EXPANDE_FUNCTION_NAME(SCILSendMsg)
-DLL sci_error_t SCILSendMsg(
- sci_msq_queue_t msq,
- void *msg,
- unsigned int size,
- unsigned int *sizeFree,
- unsigned int flags);
-
-
-/*********************************************************************************
- * *
- * S C I L R e m o v e M s g Q u e ue *
- * *
- * *
- * Removes a message queue. *
- * *
- * sci_msq_queue_t msq : Message queue identifier *
- * *
- * Flags *
- * *
- * None *
- * *
- * Specific error codes for this function: *
- * *
- * None *
- * *
- *********************************************************************************/
-#define SCILRemoveMsgQueue _SCIL_EXPANDE_FUNCTION_NAME(SCILRemoveMsgQueue)
-DLL sci_error_t SCILRemoveMsgQueue(
- sci_msq_queue_t *msq,
- unsigned int flags);
-
-
-
-/*********************************************************************************
- * *
- * S C I L I n i t *
- * *
- * *
- * Initializes the SCI library. This function must be called before any other *
- * function in the library. *
- * *
- * Flags *
- * *
- * None *
- * *
- * Specific error codes for this function: *
- * *
- * None *
- * . *
- *********************************************************************************/
-#define SCILInit _SCIL_EXPANDE_FUNCTION_NAME(SCILInit)
-DLL sci_error_t SCILInit(unsigned int flags);
-
-
-
-/*********************************************************************************
- * *
- * S C I L D e s t r o y *
- * *
- * *
- * Removes internal resources allocated by the SCI Library. No other library *
- * function should be called after this function. *
- * *
- * Flags *
- * *
- * None *
- * *
- * Specific error codes for this function: *
- * *
- * None *
- * *
- *********************************************************************************/
-#define SCILDestroy _SCIL_EXPANDE_FUNCTION_NAME(SCILDestroy)
-DLL sci_error_t SCILDestroy(unsigned int flags);
-
-
-
-/*********************************************************************************
- * *
- * S C I L C o n n e c t M s g Q u e u e *
- * *
- * *
- * Makes a connection to a remote message queue. This must be done before *
- * SCILSendMsg() is called. *
- * *
- * Parameters: *
- * *
- * sci_msq_queue_t *msq : Message queue identifier *
- * unsigned int localAdapterNo: Local Adapter Number *
- * unsigned int remoteNodeId : Remote nodeId *
- * unsigned int msqId : Message queue number *
- * unsigned int maxMsgCount : The maximum count of messages in queue *
- * unsigned int maxMsgSize, : The maximum size of each messages in queue *
- * unsigned int timeout : Time to wait for successful connection *
- * unsigned int flags : Flags. *
- * *
- * Flags *
- * *
- * None *
- * *
- * Specific error codes for this function: *
- * *
- * None. Normal SISIC error codes. *
- * *
- *********************************************************************************/
-#define SCILConnectMsgQueue _SCIL_EXPANDE_FUNCTION_NAME(SCILConnectMsgQueue)
-DLL sci_error_t SCILConnectMsgQueue(sci_msq_queue_t *msq,
- unsigned int localAdapterNo,
- unsigned int remoteNodeId,
- unsigned int rmsgId,
- unsigned int maxMsgCount,
- unsigned int maxMsgSize,
- unsigned int timeout,
- unsigned int flags);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I L D i s c o n n e c t M s g Q u e u e *
- * *
- * *
- * Disconnects from a remote message queue. *
- * *
- * Parameters: *
- * *
- * sci_msq_queue_t *msq : Message queue identifier *
- * *
- * Flags *
- * *
- * None *
- * *
- * Specific error codes for this function: *
- * *
- * None *
- * *
- *********************************************************************************/
-#define SCILDisconnectMsgQueue _SCIL_EXPANDE_FUNCTION_NAME(SCILDisconnectMsgQueue)
-DLL sci_error_t SCILDisconnectMsgQueue(sci_msq_queue_t *msq,
- unsigned int flags);
-
-
-
-#if defined(CPLUSPLUS) || defined(__cplusplus)
-}
-#endif
-
-
-
-
-
-
-
-
-
-
diff --git a/ndb/src/external/WIN32.x86/sci/include/sisci_api.h b/ndb/src/external/WIN32.x86/sci/include/sisci_api.h
deleted file mode 100644
index 9f4a1ddffb3..00000000000
--- a/ndb/src/external/WIN32.x86/sci/include/sisci_api.h
+++ /dev/null
@@ -1,2217 +0,0 @@
-/* $Id: sisci_api.h,v 1.1 2002/12/13 12:17:23 hin Exp $ */
-/*******************************************************************************
- * *
- * Copyright (C) 1993 - 2001 *
- * Dolphin Interconnect Solutions AS *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU Lesser General Public License as published by *
- * the Free Software Foundation; either version 2.1 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 Lesser 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 _SISCI_API_H
-#define _SISCI_API_H
-
-#include "sisci_types.h"
-#include "sisci_error.h"
-
-
-#ifdef WIN32
-#ifdef API_DLL
-#define DLL __declspec(dllexport)
-#elif CLIENT_DLL
-#define DLL __declspec(dllimport)
-#endif
-#endif /* WIN32 */
-
-
-#ifndef DLL
-#define DLL
-#endif
-
-#if defined(_REENTRANT)
-#define _SISCI_EXPANDE_FUNCTION_NAME(name) _SISCI_PUBLIC_FUNC_MT_ ## name
-#define _SISCI_EXPANDE_VARIABLE_NAME(name) _SISCI_PUBLIC_VAR_MT_ ## name
-#else
-#define _SISCI_EXPANDE_FUNCTION_NAME(name) _SISCI_PUBLIC_FUNC_ST_ ## name
-#define _SISCI_EXPANDE_VARIABLE_NAME(name) _SISCI_PUBLIC_VAR_ST_ ## name
-#endif
-#define _SISCI_EXPANDE_CONSTANT_NAME(name) _SISCI_PUBLIC_CONST_ ## name
-
-#if defined(CPLUSPLUS) || defined(__cplusplus)
-extern "C" {
-#endif
-
-
-/*********************************************************************************/
-/* FLAG VALUES */
-/*********************************************************************************/
-
-#define SCI_FLAG_FIXED_INTNO _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FIXED_INTNO)
-extern const unsigned int SCI_FLAG_FIXED_INTNO;
-
-#define SCI_FLAG_SHARED_INT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_SHARED_INT)
-extern const unsigned int SCI_FLAG_SHARED_INT;
-
-#define SCI_FLAG_COUNTING_INT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_COUNTING_INT)
-extern const unsigned int SCI_FLAG_COUNTING_INT;
-
-#define SCI_FLAG_FIXED_MAP_ADDR _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FIXED_MAP_ADDR)
-extern const unsigned int SCI_FLAG_FIXED_MAP_ADDR;
-
-#define SCI_FLAG_READONLY_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_READONLY_MAP)
-extern const unsigned int SCI_FLAG_READONLY_MAP;
-
-#define SCI_FLAG_USE_CALLBACK _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_USE_CALLBACK)
-extern const unsigned int SCI_FLAG_USE_CALLBACK;
-
-#define SCI_FLAG_BLOCK_READ _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_BLOCK_READ)
-extern const unsigned int SCI_FLAG_BLOCK_READ;
-
-#define SCI_FLAG_THREAD_SAFE _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_THREAD_SAFE)
-extern const unsigned int SCI_FLAG_THREAD_SAFE;
-
-#define SCI_FLAG_ASYNCHRONOUS_CONNECT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_ASYNCHRONOUS_CONNECT)
-extern const unsigned int SCI_FLAG_ASYNCHRONOUS_CONNECT;
-
-#define SCI_FLAG_EMPTY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_EMPTY)
-extern const unsigned int SCI_FLAG_EMPTY;
-
-#define SCI_FLAG_PRIVATE _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_PRIVATE)
-extern const unsigned int SCI_FLAG_PRIVATE;
-
-#define SCI_FLAG_FORCE_DISCONNECT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FORCE_DISCONNECT)
-extern const unsigned int SCI_FLAG_FORCE_DISCONNECT;
-
-#define SCI_FLAG_NOTIFY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_NOTIFY)
-extern const unsigned int SCI_FLAG_NOTIFY;
-
-#define SCI_FLAG_DMA_READ _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_READ)
-extern const unsigned int SCI_FLAG_DMA_READ;
-
-#define SCI_FLAG_DMA_POST _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_POST)
-extern const unsigned int SCI_FLAG_DMA_POST;
-
-#define SCI_FLAG_DMA_WAIT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_WAIT)
-extern const unsigned int SCI_FLAG_DMA_WAIT;
-
-#define SCI_FLAG_DMA_RESET _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_RESET)
-extern const unsigned int SCI_FLAG_DMA_RESET;
-
-#define SCI_FLAG_NO_FLUSH _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_NO_FLUSH)
-extern const unsigned int SCI_FLAG_NO_FLUSH;
-
-#define SCI_FLAG_NO_STORE_BARRIER _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_NO_STORE_BARRIER)
-extern const unsigned int SCI_FLAG_NO_STORE_BARRIER;
-
-#define SCI_FLAG_FAST_BARRIER _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FAST_BARRIER)
-extern const unsigned int SCI_FLAG_FAST_BARRIER;
-
-#define SCI_FLAG_ERROR_CHECK _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_ERROR_CHECK)
-extern const unsigned int SCI_FLAG_ERROR_CHECK;
-
-#define SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY)
-extern const unsigned int SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY;
-
-/* the FLUSH_CPU_BUFFERS_ONLY flag is for backwards compabillity only and should never be used */
-#define FLUSH_CPU_BUFFERS_ONLY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY)
-
-#define SCI_FLAG_LOCK_OPERATION _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_LOCK_OPERATION)
-extern const unsigned int SCI_FLAG_LOCK_OPERATION;
-
-#define SCI_FLAG_READ_PREFETCH_AGGR_HOLD_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_READ_PREFETCH_AGGR_HOLD_MAP)
-extern const unsigned int SCI_FLAG_READ_PREFETCH_AGGR_HOLD_MAP;
-
-#define SCI_FLAG_READ_PREFETCH_NO_HOLD_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_READ_PREFETCH_NO_HOLD_MAP)
-extern const unsigned int SCI_FLAG_READ_PREFETCH_NO_HOLD_MAP;
-
-#define SCI_FLAG_IO_MAP_IOSPACE _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_IO_MAP_IOSPACE)
-extern const unsigned int SCI_FLAG_IO_MAP_IOSPACE;
-
-#define SCI_FLAG_DMOVE_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMOVE_MAP)
-extern const unsigned int SCI_FLAG_DMOVE_MAP;
-
-#define SCI_FLAG_WRITES_DISABLE_GATHER_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_WRITES_DISABLE_GATHER_MAP)
-extern const unsigned int SCI_FLAG_WRITES_DISABLE_GATHER_MAP;
-
-#define SCI_FLAG_DISABLE_128_BYTES_PACKETS _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DISABLE_128_BYTES_PACKETS)
-extern const unsigned int SCI_FLAG_DISABLE_128_BYTES_PACKETS;
-
-#define SCI_FLAG_SHARED_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_SHARED_MAP)
-extern const unsigned int SCI_FLAG_SHARED_MAP;
-
-#define SCI_FLAG_DMA_SOURCE_ONLY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_SOURCE_ONLY)
-extern const unsigned int SCI_FLAG_DMA_SOURCE_ONLY;
-
-#define SCI_FLAG_CONDITIONAL_INTERRUPT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_CONDITIONAL_INTERRUPT)
-extern const unsigned int SCI_FLAG_CONDITIONAL_INTERRUPT;
-
-#define SCI_FLAG_CONDITIONAL_INTERRUPT_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_CONDITIONAL_INTERRUPT_MAP)
-extern const unsigned int SCI_FLAG_CONDITIONAL_INTERRUPT_MAP;
-
-#define SCI_FLAG_UNCONDITIONAL_DATA_INTERRUPT_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_UNCONDITIONAL_DATA_INTERRUPT_MAP)
-extern const unsigned int SCI_FLAG_UNCONDITIONAL_DATA_INTERRUPT_MAP;
-
-#define SCI_FLAG_NO_MEMORY_LOOPBACK_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_NO_MEMORY_LOOPBACK_MAP)
-extern const unsigned int SCI_FLAG_NO_MEMORY_LOOPBACK_MAP;
-
-#if defined(OS_IS_LYNXOS) || defined(OS_IS_VXWORKS)
-#define SCI_FLAG_WRITE_BACK_CACHE_MAP _SISCI_EXPANDE_CONSTANT_NAME(WRITE_BACK_CACHE_MAP)
-extern const unsigned int SCI_FLAG_WRITE_BACK_CACHE_MAP;
-#endif
-
-#define SCI_FLAG_DMA_PHDMA _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_PHDMA)
-extern const unsigned int SCI_FLAG_DMA_PHDMA;
-
-/*********************************************************************************/
-/* GENERAL VALUES */
-/*********************************************************************************/
-#define SCI_LOCAL_HOST _SISCI_EXPANDE_CONSTANT_NAME(SCI_LOCAL_HOST)
-extern const unsigned int SCI_LOCAL_HOST;
-
-#define SCI_INFINITE_TIMEOUT _SISCI_EXPANDE_CONSTANT_NAME(SCI_INFINITE_TIMEOUT)
-extern const unsigned int SCI_INFINITE_TIMEOUT;
-
-/*********************************************************************************/
-/* GENERAL ERROR CODES */
-/* */
-/* SCI_ERR_ILLEGAL_FLAG - Illegal flag value. */
-/* SCI_ERR_FLAG_NOT_IMPLEMENTED - Flag legal but flag feature not implemented. */
-/* SCI_ERR_NOT_IMPLEMENTED - Function not implemented. */
-/* SCI_ERR_SYSTEM - A system error. Check errno. */
-/* SCI_ERR_NOSPC - Unable to allocate OS resources. */
-/* SCI_ERR_API_NOSPC - Unable to allocate API resources. */
-/* SCI_ERR_HW_NOSPC - Unable to allocate HW resources (Hardware) */
-/* */
-/*********************************************************************************/
-
-
-/*********************************************************************************/
-/* GENERAL "ADAPTER" ERROR CODES */
-/* */
-/* SCI_ERR_NO_SUCH_ADAPTERNO - Adapter number is legal but does not exist. */
-/* SCI_ERR_ILLEGAL_ADAPTERNO - Illegal local adapter number (i.e. outside */
-/* legal range). */
-/* */
-/*********************************************************************************/
-
-
-/*********************************************************************************/
-/* GENERAL "NODEID" ERROR CODES */
-/* */
-/* SCI_ERR_NO_SUCH_NODEID - The remote adapter identified by nodeId does */
-/* not respond, but the intermediate link(s) */
-/* seem(s) to be operational. */
-/* SCI_ERR_ILLEGAL_NODEID - Illegal NodeId. */
-/* */
-/*********************************************************************************/
-
-
-
-/*********************************************************************************
- * *
- * S C I I N I T I A L I Z E *
- * *
- * This function initializes the SISCI library. *
- * The function must be called before SCIOpen(). *
- * *
- * Flags: *
- * None *
- * *
- * Specific error codes for this function: *
- * *
- * None *
- * *
- *********************************************************************************/
-#define SCIInitialize _SISCI_EXPANDE_FUNCTION_NAME(SCIInitialize)
-DLL void SCIInitialize(unsigned int flags,
- sci_error_t *error);
-#if 0
-unsigned int __Internal_SISCI_version_var;
-#endif
-
-/*********************************************************************************
- * *
- * S C I T E R M I N A T E *
- * *
- * This function terminates the SISCI library. *
- * The function must be called after SCIClose(). *
- * *
- * *
- *********************************************************************************/
-#define SCITerminate _SISCI_EXPANDE_FUNCTION_NAME(SCITerminate)
-DLL void SCITerminate(void);
-
-/*********************************************************************************
- * *
- * S C I O P E N *
- * *
- * *
- * Opens a SCI virtual device. *
- * Caller must supply a pointer to a variable of type sci_desc_t to be *
- * initialized. *
- * *
- * Flags *
- * SCI_FLAG_THREAD_SAFE - Operations on resources associated with this *
- * descriptor will be performed in a multithread-safe *
- * manner. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_INCONSISTENT_VERSIONS - Inconsistency between the SISCI library *
- * and the SISCI driver versions. *
- * *
- * *
- *********************************************************************************/
-#define SCIOpen _SISCI_EXPANDE_FUNCTION_NAME(SCIOpen)
-DLL void SCIOpen(sci_desc_t *sd,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C L O S E *
- * *
- * This function closes an open SCI virtual device. *
- * *
- * Flags: *
- * None *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_BUSY - All resources are not deallocated. *
- * *
- *********************************************************************************/
-#define SCIClose _SISCI_EXPANDE_FUNCTION_NAME(SCIClose)
-DLL void SCIClose(sci_desc_t sd,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C O N N E C T S E G M E N T *
- * *
- * Connects to a remote shared memory segment located at <nodeId> with the *
- * identifier <segmentId>. *
- * The user may then call SCIMapRemoteSegment() to map shared memory *
- * into user space. *
- * *
- * Flags *
- * SCI_FLAG_USE_CALLBACK *
- * SCI_FLAG_ASYNCHRONOUS_CONNECT *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_NO_SUCH_SEGMENT - Could not find the remote segment with the *
- * given segmentId. *
- * SCI_ERR_CONNECTION_REFUSED - Connection attempt refused by remote node. *
- * SCI_ERR_TIMEOUT - The function timed out after specified *
- * timeout value. *
- * SCI_ERR_NO_LINK_ACCESS - It was not possible to communicate via the *
- * local adapter. *
- * SCI_ERR_NO_REMOTE_LINK_ACCESS - It was not possible to communicate via a *
- * remote switch port. *
- * *
- *********************************************************************************/
-#define SCIConnectSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIConnectSegment)
-DLL void SCIConnectSegment(sci_desc_t sd,
- sci_remote_segment_t *segment,
- unsigned int nodeId,
- unsigned int segmentId,
- unsigned int localAdapterNo,
- sci_cb_remote_segment_t callback,
- void *callbackArg,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-/*********************************************************************************
- * *
- * S C I D I S C O N N E C T S E G M E N T *
- * *
- * Disconnects from the give mapped shared memory segment *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_BUSY - The segment is currently mapped or in use. *
- * *
- *********************************************************************************/
-#define SCIDisconnectSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIDisconnectSegment)
-DLL void SCIDisconnectSegment(sci_remote_segment_t segment,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I G E T R E M O T E S E G M E N T S I Z E *
- * *
- *********************************************************************************/
-#define SCIGetRemoteSegmentSize _SISCI_EXPANDE_FUNCTION_NAME(SCIGetRemoteSegmentSize)
-DLL unsigned int SCIGetRemoteSegmentSize(sci_remote_segment_t segment);
-
-
-
-/*********************************************************************************
- * *
- * S C I W A I T F O R R E M O T E S E G M E N T E V E N T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_TIMEOUT - The function timed out after specified *
- * timeout value. *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation. *
- * SCI_ERR_CANCELLED - The wait operation has been cancelled du *
- * to a SCIDisconnectSegment() on the same *
- * handle. The handle is invalid when this *
- * error is returned. *
- * *
- *********************************************************************************/
-#define SCIWaitForRemoteSegmentEvent _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForRemoteSegmentEvent)
-DLL sci_segment_cb_reason_t SCIWaitForRemoteSegmentEvent(
- sci_remote_segment_t segment,
- sci_error_t *status,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I M A P R E M O T E S E G M E N T *
- * *
- * This function is used to include a shared memory segment in the virtual *
- * address space of the application. *
- * *
- * Flags: *
- * *
- * SCI_FLAG_SHARED_MAP - The low level physical map may be shared by *
- * other applications. *
- * *
- * SCI_FLAG_FIXED_MAP_ADDR - Map at the suggested virtual address *
- * SCI_FLAG_READONLY_MAP - The segment is mapped in read-only mode *
- * SCI_FLAG_LOCK_OPERATION - Enable Lock operations (fetch and add) *
- * SCI_FLAG_READ_PREFETCH_AGGR_HOLD_MAP *
- * - Enable aggressive prefetch with speculative *
- * hold. *
- * *
- * SCI_FLAG_READ_PREFETCH_NO_HOLD_MAP *
- * - The PSB66 will prefetch 64 bytes. As soon *
- * as the PCI read retry has been accepted, *
- * the stream will change state to FREE, even *
- * if less than 64 bytes were actually read. *
- * *
- * SCI_FLAG_IO_MAP_IOSPACE - Enable No Prefetch, no speculative hold. *
- * *
- * SCI_FLAG_DMOVE_MAP - Enable DMOVE packet type. The stream will be *
- * set into FREE state immediately. *
- * *
- * SCI_FLAG_WRITES_DISABLE_GATHER_MAP *
- * - Disable use of gather. *
- * *
- * SCI_FLAG_DISABLE_128_BYTES_PACKETS *
- * - Disable use of 128-Byte packets *
- * *
- * SCI_FLAG_CONDITIONAL_INTERRUPT_MAP *
- * - Write operations through this map will cause *
- * an atomic "fetch-and-add-one" operation on *
- * remote memory, but in addition an interrupt *
- * will be generated if the target memory *
- * location contained a "null value" before the *
- * add operation was carried out. *
- * The conditional interrupt flag must also be *
- * specified in the SCIRegisterInterruptFlag() *
- * function. *
- * *
- * SCI_FLAG_UNCONDITIONAL_INTERRUPT_MAP *
- * - Write operations through this map will cause *
- * an interrupt for the remote adapter *
- * "in addition to" updating the corresponding *
- * remote memory location with the data being *
- * written. *
- * The unconditional interrupt flag must also *
- * be specified in the *
- * SCIRegisterInterruptFlag() function. *
- * *
- * SCI_FLAG_WRITE_BACK_CACHE_MAP *
- * - Enable cacheing of the mapped region. *
- * Writes through this map will be written to a *
- * write back cache, hence no remote SCI updates*
- * until the cache line is flushed. The *
- * application is responsible for the cache *
- * flush operation. *
- * The SCImemCopy() function will handle this *
- * correctly by doing cache flushes internally. *
- * This feature is architechture dependent and *
- * not be available on all plattforms. *
- * *
- * SCI_FLAG_NO_MEMORY_LOOPBACK_MAP *
- * - Forces a map to a remote segment located *
- * in the local machine to be mapped using *
- * SCI loopback. This is useful i.e. if you *
- * want to use a regular map access to be *
- * serialized with lock operations. *
- * The default behaviour is to access a remte *
- * segment located in the local machine as a *
- * local MMU operation. *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the offset and size is *
- * larger than the segment size. *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as *
- * required by the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as *
- * required by the implementation. *
- * *
- *********************************************************************************/
-#define SCIMapRemoteSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIMapRemoteSegment)
-DLL volatile void *SCIMapRemoteSegment(
- sci_remote_segment_t segment,
- sci_map_t *map,
- unsigned int offset,
- unsigned int size,
- void *addr,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I M A P L O C A L S E G M E N T *
- * *
- * Flags *
- * *
- * SCI_FLAG_FIXED_MAP_ADDR *
- * SCI_FLAG_READONLY_MAP *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the offset and size is *
- * larger than the segment size. *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as *
- * required by the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as *
- * required by the implementation. *
- * *
- *********************************************************************************/
-#define SCIMapLocalSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIMapLocalSegment)
-DLL void *SCIMapLocalSegment(sci_local_segment_t segment,
- sci_map_t *map,
- unsigned int offset,
- unsigned int size,
- void *addr,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I U N M A P S E G M E N T *
- * *
- * This function unmaps pages of shared memory from the callers virtual *
- * address space. *
- * *
- * Flags *
- * None. *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_BUSY - The map is currently in use. *
- * *
- *********************************************************************************/
-#define SCIUnmapSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIUnmapSegment)
-DLL void SCIUnmapSegment(sci_map_t map,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C R E A T E S E G M E N T *
- * *
- * Make the specified segment available for connections via the specified *
- * adapter. If successful, the segment can be accessed from remote nodes *
- * via the specified adapter. *
- * *
- * Flags: *
- * *
- * SCI_FLAG_USE_CALLBACK - The callback function will be invoked for events *
- * on this segment. *
- * SCI_FLAG_EMPTY - No memory will be allocated for the segment. *
- * SCI_FLAG_PRIVATE - The segment will be private meaning it will never *
- * be any connections to it. *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_SEGMENTID_USED - The segment with this segmentId is already used *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required *
- * by the implementation. *
- * *
- *********************************************************************************/
-#define SCICreateSegment _SISCI_EXPANDE_FUNCTION_NAME(SCICreateSegment)
-DLL void SCICreateSegment(sci_desc_t sd,
- sci_local_segment_t *segment,
- unsigned int segmentId,
- unsigned int size,
- sci_cb_local_segment_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I W A I T F O R L O C A L S E G M E N T E V E N T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_TIMEOUT - The function timed out after specified timeout value. *
- * SCI_ERR_CANCELLED - The wait operation has been cancelled du to a *
- * SCIRemoveSegment() on the same handle. *
- * The handle is invalid when this error is returned. *
- * *
- *********************************************************************************/
-#define SCIWaitForLocalSegmentEvent _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForLocalSegmentEvent)
-DLL sci_segment_cb_reason_t SCIWaitForLocalSegmentEvent(
- sci_local_segment_t segment,
- unsigned int *sourcenodeId,
- unsigned int *localAdapterNo,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I P R E P A R E S E G M E N T *
- * *
- * Flags *
- * *
- * SCI_FLAG_DMA_SOURCE_ONLY - The segment will be used as a source segment *
- * for DMA operations. On some system types this *
- * will enable the SISCI driver to use performance *
- * improving features. *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIPrepareSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIPrepareSegment)
-DLL void SCIPrepareSegment(sci_local_segment_t segment,
- unsigned int localAdapterNo,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I R E M O V E S E G M E N T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_BUSY - Unable to remove the segment. The segment is currently *
- * in use. *
- * *
- *********************************************************************************/
-#define SCIRemoveSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIRemoveSegment)
-DLL void SCIRemoveSegment(sci_local_segment_t segment,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I S E T S E G M E N T A V A I L A B L E *
- * *
- * Flags *
- * None. *
- * *
- * *
- * SCI_ERR_SEGMENT_NOT_PREPARED - The segment has not been prepared for access *
- * from this adapter. *
- * SCI_ERR_ILLEGAL_OPERATION - The segment is created with the *
- * SCI_FLAG_PRIVATE flag specified and *
- * therefore has no segmentId. *
- * *
- *********************************************************************************/
-#define SCISetSegmentAvailable _SISCI_EXPANDE_FUNCTION_NAME(SCISetSegmentAvailable)
-DLL void SCISetSegmentAvailable(sci_local_segment_t segment,
- unsigned int localAdapterNo,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I S E T S E G M E N T U N A V A I L A B L E *
- * *
- * Flags *
- * *
- * SCI_FLAG_FORCE_DISCONNECT *
- * SCI_FLAG_NOTIFY *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation. *
- * *
- *********************************************************************************/
-#define SCISetSegmentUnavailable _SISCI_EXPANDE_FUNCTION_NAME(SCISetSegmentUnavailable)
-DLL void SCISetSegmentUnavailable(sci_local_segment_t segment,
- unsigned int localAdapterNo,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C R E A T E M A P S E Q U E N C E *
- * *
- * Flags: *
- * *
- * SCI_FLAG_FAST_BARRIER *
- * *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCICreateMapSequence _SISCI_EXPANDE_FUNCTION_NAME(SCICreateMapSequence)
-DLL void SCICreateMapSequence(sci_map_t map,
- sci_sequence_t *sequence,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I R E M O V E S E Q U E N C E *
- * *
- * Flags: *
- * None *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCIRemoveSequence _SISCI_EXPANDE_FUNCTION_NAME(SCIRemoveSequence)
-DLL void SCIRemoveSequence(sci_sequence_t sequence,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I S T A R T S E Q U E N C E *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIStartSequence _SISCI_EXPANDE_FUNCTION_NAME(SCIStartSequence)
-DLL sci_sequence_status_t SCIStartSequence(sci_sequence_t sequence,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I C H E C K S E Q U E N CE *
- * *
- * Flags *
- * *
- * SCI_FLAG_NO_FLUSH *
- * SCI_FLAG_NO_STORE_BARRIER *
- * *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCICheckSequence _SISCI_EXPANDE_FUNCTION_NAME(SCICheckSequence)
-DLL sci_sequence_status_t SCICheckSequence(sci_sequence_t sequence,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I S T O R E B A R R I E R *
- * *
- * Flags *
- * None. *
- * *
- * *
- * *
- *********************************************************************************/
-#define SCIStoreBarrier _SISCI_EXPANDE_FUNCTION_NAME(SCIStoreBarrier)
-DLL void SCIStoreBarrier(sci_sequence_t sequence,
- unsigned int flags);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I F L U S H R E A D B U F F E R S *
- * *
- *********************************************************************************/
-#define SCIFlushReadBuffers _SISCI_EXPANDE_FUNCTION_NAME(SCIFlushReadBuffers)
-DLL void SCIFlushReadBuffers(sci_sequence_t sequence);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I P R O B E N O D E *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_NO_LINK_ACCESS - It was not possible to communicate via the *
- * local adapter. *
- * SCI_ERR_NO_REMOTE_LINK_ACCESS - It was not possible to communicate via a *
- * remote switch port. *
- * *
- *********************************************************************************/
-#define SCIProbeNode _SISCI_EXPANDE_FUNCTION_NAME(SCIProbeNode)
-DLL int SCIProbeNode(sci_desc_t sd,
- unsigned int localAdapterNo,
- unsigned int nodeId,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I G E T C S R R E G I S T E R *
- * *
- * SISCI Priveleged function *
- * *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_NO_LINK_ACCESS - It was not possible to communicate via the *
- * local adapter. *
- * SCI_ERR_NO_REMOTE_LINK_ACCESS - It was not possible to communicate via a *
- * remote switch port. *
- * *
- *********************************************************************************/
-#define SCIGetCSRRegister _SISCI_EXPANDE_FUNCTION_NAME(SCIGetCSRRegister)
-DLL unsigned int SCIGetCSRRegister(sci_desc_t sd,
- unsigned int localAdapterNo,
- unsigned int SCINodeId,
- unsigned int CSROffset,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I S E T C S R R E G I S T E R *
- * *
- * SISCI Priveleged function *
- * *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_NO_LINK_ACCESS - It was not possible to communicate via the *
- * local adapter. *
- * SCI_ERR_NO_REMOTE_LINK_ACCESS - It was not possible to communicate via a *
- * remote switch port. *
- * *
- *********************************************************************************/
-#define SCISetCSRRegister _SISCI_EXPANDE_FUNCTION_NAME(SCISetCSRRegister)
-DLL void SCISetCSRRegister(sci_desc_t sd,
- unsigned int localAdapterNo,
- unsigned int SCINodeId,
- unsigned int CSROffset,
- unsigned int CSRValue,
- unsigned int flags,
- sci_error_t *error);
-
-
-/*********************************************************************************
- * *
- * S C I G E T L O C A L C S R *
- * *
- * SISCI Priveleged function *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIGetLocalCSR _SISCI_EXPANDE_FUNCTION_NAME(SCIGetLocalCSR)
-DLL unsigned int SCIGetLocalCSR(sci_desc_t sd,
- unsigned int localAdapterNo,
- unsigned int CSROffset,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I S E T L O C A L C S R *
- * *
- * SISCI Priveleged function
- *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCISetLocalCSR _SISCI_EXPANDE_FUNCTION_NAME(SCISetLocalCSR)
-DLL void SCISetLocalCSR(sci_desc_t sd,
- unsigned int localAdapterNo,
- unsigned int CSROffset,
- unsigned int CSRValue,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I A T T A C H P H Y S I C A L M E M O R Y *
- * *
- * SISCI Priveleged function *
- * *
- * Description: *
- * *
- * This function enables usage of physical devices and memory regions where the *
- * Physical PCI bus address ( and mapped CPU address ) are already known. *
- * The function will register the physical memory as a SISCI segment which can *
- * be connected and mapped as a regular SISCI segment. *
- * *
- * Requirements: *
- * *
- * SCICreateSegment() with flag SCI_FLAG_EMPTY must have been called in advance *
- * *
- * Parameter description: *
- * sci_ioaddr_t ioaddress : This is the address on the PCI bus that a PCI bus *
- * master has to use to write to the specified memory *
- * void * address : This is the (mapped) virtual address that the *
- * application has to use to access the device. *
- * This means that the device has to be mapped in *
- * advance bye the devices own driver. *
- * If the device is not to be accessed by the local *
- * CPU, the address pointer shold be set to NULL *
- * Flags *
- * *
- * None *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIAttachPhysicalMemory _SISCI_EXPANDE_FUNCTION_NAME(SCIAttachPhysicalMemory)
-DLL void SCIAttachPhysicalMemory(sci_ioaddr_t ioaddress,
- void *address,
- unsigned int busNo,
- unsigned int size,
- sci_local_segment_t segment,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I Q U E R Y *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_QUERY - Unrecognized command. *
- * *
- *********************************************************************************/
-#define SCIQuery _SISCI_EXPANDE_FUNCTION_NAME(SCIQuery)
-DLL void SCIQuery(unsigned int command,
- void *data,
- unsigned int flags,
- sci_error_t *error);
-
-
-/* MAJOR QUERY COMMANDS */
-
-/* This command requires a pointer to a structure of type */
-/* "sci_query_string". The string will be filled in by the query. */
-#define SCI_Q_VENDORID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_VENDORID)
-extern const unsigned int SCI_Q_VENDORID;
-
-
-/* Same as for SCI_VENDOR_ID */
-#define SCI_Q_API _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_API)
-extern const unsigned int SCI_Q_API;
-
-
-/* User passes a pointer to an allocated object of the */
-/* "sci_query_adapter" struct. */
-#define SCI_Q_ADAPTER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER)
-extern const unsigned int SCI_Q_ADAPTER;
-
-
-/* User passes a pointer to an allocated object of the */
-/* "sci_query_system" struct. */
-#define SCI_Q_SYSTEM _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SYSTEM)
-extern const unsigned int SCI_Q_SYSTEM;
-
-#define SCI_Q_LOCAL_SEGMENT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_LOCAL_SEGMENT)
-extern const unsigned int SCI_Q_LOCAL_SEGMENT;
-
-#define SCI_Q_REMOTE_SEGMENT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_REMOTE_SEGMENT)
-extern const unsigned int SCI_Q_REMOTE_SEGMENT;
-
-#define SCI_Q_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_MAP)
-extern const unsigned int SCI_Q_MAP;
-
-typedef char* sci_semaphoreId_t;
-
-#ifdef WIN32
-struct _semaphoreid {
- char *semaphoreName;
-};
-#endif /*WIN32*/
-
-typedef struct {
- char *str; /* Pointer to a string of minimum "length" characters */
- unsigned int length;
-} sci_query_string_t;
-
-
-typedef struct {
- unsigned int localAdapterNo; /* The adapter no. that the query concern. */
- unsigned int portNo; /* The SCI Link port number that the query concern. */
- unsigned int subcommand; /* A subcommand as specified below. */
- void *data; /* A pointer to an unsigned int that will return */
- /* the response to the query. */
-} sci_query_adapter_t;
-
-
-typedef struct {
- unsigned int subcommand; /* A subcommand as specified below. */
- void *data; /* A pointer to an unsigned int that will return */
- /* the response to the query. */
-} sci_query_system_t;
-
-typedef struct {
- sci_local_segment_t segment;
- unsigned int subcommand;
- union {
- sci_ioaddr_t ioaddr;
- } data;
-} sci_query_local_segment_t;
-
-typedef struct {
- sci_remote_segment_t segment;
- unsigned int subcommand;
- union {
- sci_ioaddr_t ioaddr;
- } data;
-} sci_query_remote_segment_t;
-
-typedef struct {
- sci_map_t map;
- unsigned int subcommand;
- unsigned int data;
-} sci_query_map_t;
-
-/* Minor query commands (sub-commands) for adapter specific information SCI_ADAPTER */
-#define SCI_Q_ADAPTER_DMA_SIZE_ALIGNMENT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_DMA_SIZE_ALIGNMENT)
-extern const unsigned int SCI_Q_ADAPTER_DMA_SIZE_ALIGNMENT;
-
-#define SCI_Q_ADAPTER_DMA_OFFSET_ALIGNMENT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_DMA_OFFSET_ALIGNMENT)
-extern const unsigned int SCI_Q_ADAPTER_DMA_OFFSET_ALIGNMENT;
-
-#define SCI_Q_ADAPTER_DMA_MTU _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_DMA_MTU)
-extern const unsigned int SCI_Q_ADAPTER_DMA_MTU;
-
-#define SCI_Q_ADAPTER_SUGGESTED_MIN_DMA_SIZE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_SUGGESTED_MIN_DMA_SIZE)
-extern const unsigned int SCI_Q_ADAPTER_SUGGESTED_MIN_DMA_SIZE;
-
-#define SCI_Q_ADAPTER_SUGGESTED_MIN_BLOCK_SIZE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_SUGGESTED_MIN_BLOCK_SIZE)
-extern const unsigned int SCI_Q_ADAPTER_SUGGESTED_MIN_BLOCK_SIZE;
-
-#define SCI_Q_ADAPTER_NODEID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_NODEID)
-extern const unsigned int SCI_Q_ADAPTER_NODEID;
-
-#define SCI_Q_ADAPTER_SERIAL_NUMBER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_SERIAL_NUMBER)
-extern const unsigned int SCI_Q_ADAPTER_SERIAL_NUMBER;
-
-#define SCI_Q_ADAPTER_CARD_TYPE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_CARD_TYPE)
-extern const unsigned int SCI_Q_ADAPTER_CARD_TYPE;
-
-#define SCI_Q_ADAPTER_NUMBER_OF_STREAMS _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_NUMBER_OF_STREAMS)
-extern const unsigned int SCI_Q_ADAPTER_NUMBER_OF_STREAMS;
-
-#define SCI_Q_ADAPTER_STREAM_BUFFER_SIZE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_STREAM_BUFFER_SIZE)
-extern const unsigned int SCI_Q_ADAPTER_STREAM_BUFFER_SIZE;
-
-#define SCI_Q_ADAPTER_CONFIGURED _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_CONFIGURED)
-extern const unsigned int SCI_Q_ADAPTER_CONFIGURED;
-
-#define SCI_Q_ADAPTER_LINK_OPERATIONAL _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_LINK_OPERATIONAL)
-extern const unsigned int SCI_Q_ADAPTER_LINK_OPERATIONAL;
-
-#define SCI_Q_ADAPTER_HW_LINK_STATUS_IS_OK _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_HW_LINK_STATUS_IS_OK)
-extern const unsigned int SCI_Q_ADAPTER_HW_LINK_STATUS_IS_OK;
-
-#define SCI_Q_ADAPTER_NUMBER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_NUMBER)
-extern const unsigned int SCI_Q_ADAPTER_NUMBER;
-
-#define SCI_Q_ADAPTER_INSTANCE_NUMBER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_INSTANCE_NUMBER)
-extern const unsigned int SCI_Q_ADAPTER_INSTANCE_NUMBER;
-
-#define SCI_Q_ADAPTER_FIRMWARE_OK _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_FIRMWARE_OK)
-extern const unsigned int SCI_Q_ADAPTER_FIRMWARE_OK;
-
-#define SCI_Q_ADAPTER_CONNECTED_TO_SWITCH _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_CONNECTED_TO_SWITCH)
-extern const unsigned int SCI_Q_ADAPTER_CONNECTED_TO_SWITCH;
-
-#define SCI_Q_ADAPTER_LOCAL_SWITCH_TYPE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_LOCAL_SWITCH_TYPE)
-extern const unsigned int SCI_Q_ADAPTER_LOCAL_SWITCH_TYPE;
-
-#define SCI_Q_ADAPTER_LOCAL_SWITCH_PORT_NUMBER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_LOCAL_SWITCH_PORT_NUMBER)
-extern const unsigned int SCI_Q_ADAPTER_LOCAL_SWITCH_PORT_NUMBER;
-
-#define SCI_Q_ADAPTER_CONNECTED_TO_EXPECTED_SWITCH_PORT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_CONNECTED_TO_EXPECTED_SWITCH_PORT)
-extern const unsigned int SCI_Q_ADAPTER_CONNECTED_TO_EXPECTED_SWITCH_PORT;
-
-#define SCI_Q_ADAPTER_ATT_PAGE_SIZE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_ATT_PAGE_SIZE)
-extern const unsigned int SCI_Q_ADAPTER_ATT_PAGE_SIZE;
-
-#define SCI_Q_ADAPTER_ATT_NUMBER_OF_ENTRIES _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_ATT_NUMBER_OF_ENTRIES)
-extern const unsigned int SCI_Q_ADAPTER_ATT_NUMBER_OF_ENTRIES;
-
-#define SCI_Q_ADAPTER_ATT_AVAILABLE_ENTRIES _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_ATT_AVAILABLE_ENTRIES)
-extern const unsigned int SCI_Q_ADAPTER_ATT_AVAILABLE_ENTRIES;
-
-#define SCI_Q_ADAPTER_PHYS_MEM_NODEID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SCI_Q_ADAPTER_PHYS_MEM_NODEID)
-extern const unsigned int SCI_Q_ADAPTER_PHYS_MEM_NODEID;
-
-#define SCI_Q_ADAPTER_PHYS_MBX_NODEID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SCI_Q_ADAPTER_PHYS_MBX_NODEID)
-extern const unsigned int SCI_Q_ADAPTER_PHYS_MBX_NODEID;
-
-#define SCI_Q_ADAPTER_PHYS_LINK_PORT_NODEID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_PHYS_LINK_PORT_NODEID)
-extern const unsigned int SCI_Q_ADAPTER_PHYS_LINK_PORT_NODEID;
-
-#define SCI_Q_ADAPTER_SCI_LINK_FREQUENCY _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_SCI_LINK_FREQUENCY)
-extern const unsigned int SCI_Q_ADAPTER_SCI_LINK_FREQUENCY;
-
-#define SCI_Q_ADAPTER_B_LINK_FREQUENCY _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_B_LINK_FREQUENCY)
-extern const unsigned int SCI_Q_ADAPTER_B_LINK_FREQUENCY;
-
-#define SCI_Q_ADAPTER_IO_BUS_FREQUENCY _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_IO_BUS_FREQUENCY)
-extern const unsigned int SCI_Q_ADAPTER_IO_BUS_FREQUENCY;
-
-/* Minor query commands (sub-commands) for adapter specific information SCI_SYSTEM */
-#define SCI_Q_SYSTEM_HOSTBRIDGE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SYSTEM_HOSTBRIDGE)
-extern const unsigned int SCI_Q_SYSTEM_HOSTBRIDGE;
-
-#define SCI_Q_SYSTEM_WRITE_POSTING_ENABLED _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SYSTEM_WRITE_POSTING_ENABLED)
-extern const unsigned int SCI_Q_SYSTEM_WRITE_POSTING_ENABLED;
-
-#define SCI_Q_SYSTEM_WRITE_COMBINING_ENABLED _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SYSTEM_WRITE_COMBINING_ENABLED)
-extern const unsigned int SCI_Q_SYSTEM_WRITE_COMBINING_ENABLED;
-
-#define SCI_Q_LOCAL_SEGMENT_IOADDR _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_LOCAL_SEGMENT_IOADDR)
-extern const unsigned int SCI_Q_LOCAL_SEGMENT_IOADDR;
-
-#define SCI_Q_REMOTE_SEGMENT_IOADDR _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_REMOTE_SEGMENT_IOADDR)
-extern const unsigned int SCI_Q_REMOTE_SEGMENT_IOADDR;
-
-#define SCI_Q_MAP_MAPPED_TO_LOCAL_TARGET _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_MAP_MAPPED_TO_LOCAL_TARGET)
-extern const unsigned int SCI_Q_MAP_MAPPED_TO_LOCAL_TARGET;
-
-#define SCI_Q_MAP_QUERY_REMOTE_MAPPED_TO_LOCAL_TARGET _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_MAP_QUERY_REMOTE_MAPPED_TO_LOCAL_TARGET)
-extern const unsigned int SCI_Q_MAP_QUERY_REMOTE_MAPPED_TO_LOCAL_TARGET;
-
-#define HOSTBRIDGE_NOT_AVAILABLE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_NOT_AVAILABLE)
-extern const unsigned int HOSTBRIDGE_NOT_AVAILABLE;
-
-#define HOSTBRIDGE_UNKNOWN _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_UNKNOWN)
-extern const unsigned int HOSTBRIDGE_UNKNOWN;
-
-#define HOSTBRIDGE_440FX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440FX)
-extern const unsigned int HOSTBRIDGE_440FX;
-
-#define HOSTBRIDGE_440LX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440LX)
-extern const unsigned int HOSTBRIDGE_440LX;
-
-#define HOSTBRIDGE_440BX_A _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440BX_A)
-extern const unsigned int HOSTBRIDGE_440BX_A;
-
-#define HOSTBRIDGE_440BX_B _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440BX_B)
-extern const unsigned int HOSTBRIDGE_440BX_B;
-
-#define HOSTBRIDGE_440GX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440GX)
-extern const unsigned int HOSTBRIDGE_440GX;
-
-#define HOSTBRIDGE_450KX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_450KX)
-extern const unsigned int HOSTBRIDGE_450KX;
-
-#define HOSTBRIDGE_430NX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_430NX)
-extern const unsigned int HOSTBRIDGE_430NX;
-
-#define HOSTBRIDGE_450NX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_450NX)
-extern const unsigned int HOSTBRIDGE_450NX;
-
-#define HOSTBRIDGE_450NX_MICO _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_450NX_MICO)
-extern const unsigned int HOSTBRIDGE_450NX_MICO;
-
-#define HOSTBRIDGE_450NX_PXB _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_450NX_PXB)
-extern const unsigned int HOSTBRIDGE_450NX_PXB;
-
-#define HOSTBRIDGE_I810 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I810)
-extern const unsigned int HOSTBRIDGE_I810;
-
-#define HOSTBRIDGE_I810_DC100 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I810_DC100)
-extern const unsigned int HOSTBRIDGE_I810_DC100;
-
-#define HOSTBRIDGE_I810E _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I810E)
-extern const unsigned int HOSTBRIDGE_I810E;
-
-#define HOSTBRIDGE_I815 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I815)
-extern const unsigned int HOSTBRIDGE_I815;
-
-#define HOSTBRIDGE_I840 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I840)
-extern const unsigned int HOSTBRIDGE_I840;
-
-#define HOSTBRIDGE_I850 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I850)
-extern const unsigned int HOSTBRIDGE_I850;
-
-#define HOSTBRIDGE_I860 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I860)
-extern const unsigned int HOSTBRIDGE_I860;
-
-#define HOSTBRIDGE_INTEL_E7500 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_INTEL_E7500)
-extern const unsigned int HOSTBRIDGE_INTEL_E7500;
-
-#define HOSTBRIDGE_VIA_KT133 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_VIA_KT133)
-extern const unsigned int HOSTBRIDGE_VIA_KT133;
-
-#define HOSTBRIDGE_VIA_KX133 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_VIA_KX133)
-extern const unsigned int HOSTBRIDGE_VIA_KX133;
-
-#define HOSTBRIDGE_VIA_APOLLO_PRO_133A _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_VIA_APOLLO_PRO_133A)
-extern const unsigned int HOSTBRIDGE_VIA_APOLLO_PRO_133A;
-
-#define HOSTBRIDGE_VIA_APOLLO_PRO_266 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_VIA_APOLLO_PRO_266)
-extern const unsigned int HOSTBRIDGE_VIA_APOLLO_PRO_266;
-
-#define HOSTBRIDGE_AMD_760_MP _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_AMD_760_MP)
-extern const unsigned int HOSTBRIDGE_AMD_760_MP;
-
-#define HOSTBRIDGE_AMD_HAMMER _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_AMD_HAMMER)
-extern const unsigned int HOSTBRIDGE_AMD_HAMMER;
-
-#define HOSTBRIDGE_SERVERWORKS_HE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_HE)
-extern const unsigned int HOSTBRIDGE_SERVERWORKS_HE;
-
-#define HOSTBRIDGE_SERVERWORKS_HE_B _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_HE_B)
-extern const unsigned int HOSTBRIDGE_SERVERWORKS_HE_B;
-
-#define HOSTBRIDGE_SERVERWORKS_LE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_LE)
-extern const unsigned int HOSTBRIDGE_SERVERWORKS_LE;
-
-#define HOSTBRIDGE_SERVERWORKS_GC_HE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_GC_HE)
-extern const unsigned int HOSTBRIDGE_SERVERWORKS_GC_HE;
-
-#define HOSTBRIDGE_SERVERWORKS_GC_LE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_GC_LE)
-extern const unsigned int HOSTBRIDGE_SERVERWORKS_GC_LE;
-
-#define HOSTBRIDGE_SERVERWORKS_GC_WS _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_GC_WS)
-extern const unsigned int HOSTBRIDGE_SERVERWORKS_GC_WS;
-
-#define HOSTBRIDGE_SERVERWORKS_GC_SL _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_GC_SL)
-extern const unsigned int HOSTBRIDGE_SERVERWORKS_GC_SL;
-
-
-#define HOSTBRIDGE_WRITE_POSTING_DISABLED _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_WRITE_POSTING_DISABLED)
-extern const unsigned int HOSTBRIDGE_WRITE_POSTING_DISABLED;
-
-#define HOSTBRIDGE_WRITE_POSTING_ENABLED _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_WRITE_POSTING_ENABLED)
-extern const unsigned int HOSTBRIDGE_WRITE_POSTING_ENABLED;
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C R E A T E D M A Q U E U E *
- * *
- * Flags *
- * *
- * SCI_FLAG_DMA_PHDMA : Create physical DMA queue. Please note that this is an *
- * priveleged operation. *
- * *
- * *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCICreateDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCICreateDMAQueue)
-DLL void SCICreateDMAQueue(sci_desc_t sd,
- sci_dma_queue_t *dq,
- unsigned int localAdapterNo,
- unsigned int maxEntries,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I R E M O V E D M A Q U E U E *
- * *
- * Flags *
- * None. * *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Not allowed in this queue state. *
- * *
- *********************************************************************************/
-#define SCIRemoveDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIRemoveDMAQueue)
-DLL void SCIRemoveDMAQueue(sci_dma_queue_t dq,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I E N Q U E U E D M A T R A N S F E R *
- * *
- * Flags: *
- * *
- * SCI_FLAG_DMA_READ - The DMA will be remote --> local *
- * (default is local --> remote) *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the offset and size is larger *
- * than the segment size or larger than max *
- * DMA size. *
- * SCI_ERR_MAX_ENTRIES - The DMA queue is full *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_SEGMENT_NOT_PREPARED - The local segment has not been prepared for *
- * access from the adapter associated with the *
- * queue. *
- * SCI_ERR_SEGMENT_NOT_CONNECTED - The remote segment is not connected through *
- * the adapter associated with the queue. *
- *********************************************************************************/
-#define SCIEnqueueDMATransfer _SISCI_EXPANDE_FUNCTION_NAME(SCIEnqueueDMATransfer)
-DLL sci_dma_queue_state_t SCIEnqueueDMATransfer(sci_dma_queue_t dq,
- sci_local_segment_t localSegment,
- sci_remote_segment_t remoteSegment,
- unsigned int localOffset,
- unsigned int remoteOffset,
- unsigned int size,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I P O S T D M A Q U E U E *
- * *
- * Flags: *
- * *
- * SCI_FLAG_USE_CALLBACK - The end of the transfer will cause the callback *
- * function to be invoked. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation *
- * *
- *********************************************************************************/
-#define SCIPostDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIPostDMAQueue)
-DLL void SCIPostDMAQueue(sci_dma_queue_t dq,
- sci_cb_dma_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I A B O R T D M A Q U E U E *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation *
- * *
- *********************************************************************************/
-#define SCIAbortDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIAbortDMAQueue)
-DLL void SCIAbortDMAQueue(sci_dma_queue_t dq,
- unsigned int flags,
- sci_error_t *error);
-
-
-/*********************************************************************************
- * *
- * S C I R E S E T D M A Q U E U E *
- * *
- * Flags *
- * None. * *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIResetDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIResetDMAQueue)
-DLL void SCIResetDMAQueue(sci_dma_queue_t dq,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I D M A Q U E U E S T A T E *
- * *
- *********************************************************************************/
-#define SCIDMAQueueState _SISCI_EXPANDE_FUNCTION_NAME(SCIDMAQueueState)
-DLL sci_dma_queue_state_t SCIDMAQueueState(sci_dma_queue_t dq);
-
-
-
-/*********************************************************************************
- * *
- * S C I W A I T F O R D M A Q U E U E *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation *
- * SCI_ERR_TIMEOUT - The function timed out after specified *
- * timeout value. *
- * *
- *********************************************************************************/
-#define SCIWaitForDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForDMAQueue)
-DLL sci_dma_queue_state_t SCIWaitForDMAQueue(sci_dma_queue_t dq,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I P H D M A E N Q U E U E *
- * *
- * SISCI Priveleged function *
- * *
- * Flags *
- * *
- * SCI_FLAG_DMA_READ *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCIphDmaEnqueue _SISCI_EXPANDE_FUNCTION_NAME(SCIphDmaEnqueue)
-DLL void SCIphDmaEnqueue(sci_dma_queue_t dmaqueue,
- unsigned int size,
- sci_ioaddr_t localBusAddr,
- unsigned int remote_nodeid,
- unsigned int remote_highaddr,
- unsigned int remote_lowaddr,
- unsigned int flags,
- sci_error_t *error);
-
-/*********************************************************************************
- * *
- * S C I P H D M A S T A R T *
- * *
- * Flags *
- * *
- * SCI_FLAG_DMA_WAIT *
- * SCI_FLAG_USE_CALLBACK *
- * SCI_FLAG_DMA_RESET *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCIphDmaStart _SISCI_EXPANDE_FUNCTION_NAME(SCIphDmaStart)
-DLL sci_dma_queue_state_t SCIphDmaStart(sci_dma_queue_t dmaqueue,
- sci_cb_dma_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-
-#ifdef WIN32
-/*********************************************************************************
- * *
- * S C I C R E A T E N A M E D I N T E R R U P T *
- * *
- * Flags *
- * *
- * SCI_FLAG_USE_CALLBACK *
- * SCI_FLAG_FIXED_INTNO *
- * SCI_FLAG_SHARED_INT *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_INTNO_USED - This interrupt number is already used. *
- * *
- *********************************************************************************/
-#define SCICreateNamedInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCICreateNamedInterrupt)
-DLL void SCICreateNamedInterrupt(sci_desc_t sd,
- sci_local_interrupt_t *interrupt,
- unsigned int localAdapterNo,
- unsigned int *interruptNo,
- sci_cb_interrupt_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_semaphoreId_t semId,
- sci_error_t *error);
-#endif /*WIN32*/
-
-/*********************************************************************************
- * *
- * S C I C R E A T E I N T E R R U P T *
- * *
- * Flags *
- * *
- * SCI_FLAG_USE_CALLBACK *
- * SCI_FLAG_FIXED_INTNO *
- * SCI_FLAG_SHARED_INT *
- * SCI_FLAG_COUNTING_INT: This flag will enable counting interrupts. This means *
- * that the number of trigged interrupts is equal to the *
- * number of received interrupts. *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_INTNO_USED - This interrupt number is already used. *
- * *
- *********************************************************************************/
-#define SCICreateInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCICreateInterrupt)
-DLL void SCICreateInterrupt(sci_desc_t sd,
- sci_local_interrupt_t *interrupt,
- unsigned int localAdapterNo,
- unsigned int *interruptNo,
- sci_cb_interrupt_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I R E M O V E I N T E R R U P T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCIRemoveInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIRemoveInterrupt)
-DLL void SCIRemoveInterrupt(sci_local_interrupt_t interrupt,
- unsigned int flags,
- sci_error_t *error);
-
-
-/*********************************************************************************
- * *
- * S C I W A I T F O R I N T E R R U P T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_TIMEOUT - The function timed out after specified timeout value. *
- * SCI_ERR_CANCELLED - The wait was interrupted by a call to *
- * SCIRemoveInterrupt. *
- * The handle is invalid when this error code is returned.*
- * *
- *********************************************************************************/
-#define SCIWaitForInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForInterrupt)
-DLL void SCIWaitForInterrupt(sci_local_interrupt_t interrupt,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C O N N E C T I N T E R R U P T *
- * *
- * Flags *
- * *
- * SCI_FLAG_COUNTING_INT: This flag will enable counting interrupts. This means *
- * that the number of trigged interrupts is equal to the *
- * number of received interrupts. *
- * if SCI_FLAG_COUNTING_INT is not used, the interface *
- * guarentees that there always will be an remote *
- * interrupt generated after the first and after the last*
- * trigger. If interupts is triggered faster than the *
- * remote interrupt handler can handle, interrupts may be*
- * lost. *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_NO_SUCH_INTNO - No such interrupt number. *
- * SCI_ERR_CONNECTION_REFUSED - Connection attempt refused by remote node. *
- * SCI_ERR_TIMEOUT - The function timed out after specified *
- * timeout value. *
- * *
- *********************************************************************************/
-#define SCIConnectInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIConnectInterrupt)
-DLL void SCIConnectInterrupt(sci_desc_t sd,
- sci_remote_interrupt_t *interrupt,
- unsigned int nodeId,
- unsigned int localAdapterNo,
- unsigned int interruptNo,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-/*********************************************************************************
- * *
- * S C I D I S C O N N E C T I N T E R R U P T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIDisconnectInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIDisconnectInterrupt)
-DLL void SCIDisconnectInterrupt(sci_remote_interrupt_t interrupt,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I T R I G G E R I N T E R R U P T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCITriggerInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCITriggerInterrupt)
-DLL void SCITriggerInterrupt(sci_remote_interrupt_t interrupt,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I R E G I S T E R I N T E R R U P T F L A G *
- * *
- * *
- * This function register an "interrupt flag" that is identified as an unique *
- * location within a local segment. If successful, the resulting interrupt *
- * handle will have been associated with the specified local segment. *
- * *
- * It is up to the (remote) client(s) to set up an "interrupt mapping" for the *
- * corresponding segment offset using either the *
- * *
- * - SCI_FLAG_CONDITIONAL_INTERRUPT_MAP *
- * *
- * or the *
- * *
- * - SCI_FLAG_UNCONDITIONAL_DATA_INTERRUPT_MAP *
- * *
- * option to "SCIMapRemoteSegment()". - I.e. after having established a *
- * connection to the corresponding segment. A trigger operation can then *
- * be implemented using a store operation via the relevant "interrupt map". *
- * *
- * *
- * *
- * *
- * *
- * Flags: *
- * *
- * SCI_FLAG_CONDITIONAL_INTERRUPT - Triggering is to take place using *
- * "conditional interrupts". *
- * *
- * *
- * *
- * Specific error codes for this function: *
- * None. *
- * *
- *********************************************************************************/
-#define SCIRegisterInterruptFlag _SISCI_EXPANDE_FUNCTION_NAME(SCIRegisterInterruptFlag)
-DLL void SCIRegisterInterruptFlag(
- unsigned int localAdapterNo,
- sci_local_interrupt_t *interrupt,
- sci_local_segment_t segment,
- unsigned int offset,
- sci_cb_interrupt_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I E N A B L E C O N D I T I O N A L I N T E R R U P T *
- * *
- * *
- * This function make sure that another HW interrupt will take place the next *
- * time the corresponding interrupt flag is triggered by a *
- * "conditional interrupt" operation. *
- * *
- * Default semantics: *
- * *
- * When successful, the client can rely on that the first subsequent trigger *
- * operation will cause a HW interrupt and subsequently cause the client *
- * handler function to be invoked. *
- * *
- * If an interrupt was triggered in parallell with the enable operation, then *
- * the operation will fail (SCI_ERR_COND_INT_RACE_PROBLEM), and the client can *
- * not rely on another trigger operation will lead to handler invocation. *
- * Hence, any state checking normally associated with handling the *
- * corresponding interrupt should take place before attempting to enable *
- * again. *
- * *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_COND_INT_RACE_PROBLEM - The enable operation failed because an *
- * incomming trigger operation happened *
- * concurrently. *
- * *
- *********************************************************************************/
-#define SCIEnableConditionalInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIEnableConditionalInterrupt)
-DLL void SCIEnableConditionalInterrupt(
- sci_local_interrupt_t interrupt,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I D I S A B L E C O N D I T I O N A L I N T E R R U P T *
- * *
- * *
- * Prevent subsequent "conditional interrupt"trigger operations for *
- * the specified interupt flag from causing HW interrupt and handler *
- * invocations. *
- * *
- * *
- * Default semantics: *
- * *
- * If successful, no subsequent HW interrupts will take place, but handler *
- * invocations that have already been scheduled may still take place. *
- * *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIDisableConditionalInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIDisableConditionalInterrupt)
-DLL void SCIDisableConditionalInterrupt(
- sci_local_interrupt_t interrupt,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I G E T C O N D I T I O N A L I N T E R R U P T C O U N T E R *
- * *
- * *
- * Returns a value that indicates the number of times this flag has *
- * been trigged since the last time it was enabled or disabled. *
- * Calling the SCIEnableConditionalInterrupt / SCIDisableConditionalInterrupt *
- * functions will reset the counter value. *
- * *
- * Default semantics: *
- * *
- * If successful, the current trig count is returned in the *
- * interruptTrigCounter parameter. *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OVERFLOW - The number of trig operations have exceeded the range *
- * that can be counted. *
- *********************************************************************************/
-#define SCIGetConditionalInterruptTrigCounter _SISCI_EXPANDE_FUNCTION_NAME(SCIGetConditionalInterruptTrigCounter)
-DLL void SCIGetConditionalInterruptTrigCounter(
- sci_local_interrupt_t interrupt,
- unsigned int *interruptTrigCounter,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I T R A N S F E R B L O C K *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the size and offset is larger *
- * than the corresponding map size. *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_TRANSFER_FAILED - The data transfer failed. *
- * *
- *********************************************************************************/
-#define SCITransferBlock _SISCI_EXPANDE_FUNCTION_NAME(SCITransferBlock)
-DLL void SCITransferBlock(sci_map_t sourceMap,
- unsigned int sourceOffset,
- sci_map_t destinationMap,
- unsigned int destinationOffset,
- unsigned int size,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I T R A N S F E R B L O C K A S Y N C *
- * *
- * Flags *
- * *
- * SCI_FLAG_BLOCK_READ *
- * SCI_FLAG_USE_CALLBACK *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the size and offset is larger than *
- * the corresponding map size. *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required by *
- * the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_TRANSFER_FAILED - The data transfer failed. *
- * *
- *********************************************************************************/
-#define SCITransferBlockAsync _SISCI_EXPANDE_FUNCTION_NAME(SCITransferBlockAsync)
-DLL void SCITransferBlockAsync(sci_map_t sourceMap,
- unsigned int sourceOffset,
- sci_map_t destinationMap,
- unsigned int destinationOffset,
- unsigned int size,
- sci_block_transfer_t *block,
- sci_cb_block_transfer_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I W A I T F O R B L O C K T R A N S F E R *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation *
- * SCI_ERR_TIMEOUT - The function timed out after specified *
- * timeout value. *
- * *
- *********************************************************************************/
-#define SCIWaitForBlockTransfer _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForBlockTransfer)
-DLL void SCIWaitForBlockTransfer(sci_block_transfer_t block,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I A B O R T B L O C K T R A N S F E R *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation *
- * *
- *********************************************************************************/
-#define SCIAbortBlockTransfer _SISCI_EXPANDE_FUNCTION_NAME(SCIAbortBlockTransfer)
-DLL void SCIAbortBlockTransfer(sci_block_transfer_t block,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I M E M C P Y *
- * *
- * Flags: *
- * SCI_FLAG_BLOCK_READ *
- * SCI_FLAG_ERROR_CHECK *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the size and offset is larger *
- * than the corresponding map size. *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_TRANSFER_FAILED - The data transfer failed. *
- * *
- *********************************************************************************/
-
-#define SCIMemCpy _SISCI_EXPANDE_FUNCTION_NAME(SCIMemCpy)
-DLL void SCIMemCpy(sci_sequence_t sequence,
- void *memAddr,
- sci_map_t remoteMap,
- unsigned int remoteOffset,
- unsigned int size,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I M E M C O P Y *
- * *
- * Flags: *
- * SCI_FLAG_BLOCK_READ *
- * SCI_FLAG_ERROR_CHECK *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the size and offset is larger *
- * than the corresponding map size. *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_TRANSFER_FAILED - The data transfer failed. *
- * *
- *********************************************************************************/
-
-
-#define SCIMemCopy _SISCI_EXPANDE_FUNCTION_NAME(SCIMemCopy)
-DLL void SCIMemCopy(void *memAddr,
- sci_map_t remoteMap,
- unsigned int remoteOffset,
- unsigned int size,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I R E G I S T E R S E G M E N T M E M O R Y *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required by *
- * the implementation. *
- * SCI_ERR_ILLEGAL_ADDRESS - Illegal address. *
- * SCI_ERR_OUT_OF_RANGE - Size is larger than the maximum size for the *
- * local segment. *
- * *
- *********************************************************************************/
-#define SCIRegisterSegmentMemory _SISCI_EXPANDE_FUNCTION_NAME(SCIRegisterSegmentMemory)
-DLL void SCIRegisterSegmentMemory(void *address,
- unsigned int size,
- sci_local_segment_t segment,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C O N N E C T S C I S P A C E *
- * *
- * SISCI Priveleged function *
- * *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_CONNECTION_REFUSED - Connection attempt refused by remote node. *
- * *
- *********************************************************************************/
-#define SCIConnectSCISpace _SISCI_EXPANDE_FUNCTION_NAME(SCIConnectSCISpace)
-DLL void SCIConnectSCISpace(sci_desc_t sd,
- unsigned int localAdapterNo,
- sci_remote_segment_t *segment,
- sci_address_t address,
- unsigned int size,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*
- * =====================================================================================
- *
- * S C I A T T A C H L O C A L S E G M E N T
- * Description:
- *
- * SCIAttachLocalSegment() permits an application to "attach" to an already existing
- * local segment, implying that two or more application want
- * share the same local segment. The prerequest, is that the
- * application which originally created the segment ("owner") has
- * preformed a SCIShareSegment() in order to mark the segment
- * "shareable".
- *
- *
- * Flags:
- *
- * SCI_FLAG_USE_CALLBACK - The callback function will be invoked for events
- * on this segment.
- *
- *
- * Specific error codes for this function:
- *
- * SCI_ERR_ACCESS - No such shared segment
- * SCI_ERR_NO_SUCH_SEGMENT - No such segment
- * Note: Current implenentation will return SCI_ERR_ACCESS for both cases. This will
- * change from next release. Application should handle both cases.
- *
- * =====================================================================================
- */
-#define SCIAttachLocalSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIAttachLocalSegment)
-
-DLL void
-SCIAttachLocalSegment(sci_desc_t sd,
- sci_local_segment_t *segment,
- unsigned int segmentId,
- unsigned int *size,
- sci_cb_local_segment_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-/*
- * =====================================================================================
- *
- * S C I S H A R E S E G M E N T
- *
- * Description:
- *
- * SCIShareSegment() permits other application to "attach" to an already existing
- * local segment, implying that two or more application want
- * share the same local segment. The prerequest, is that the
- * application which originally created the segment ("owner") has
- * preformed a SCIShareSegment() in order to mark the segment
- * "shareable".
- *
- *
- * Flags:
- * none
- *
- * Specific error codes for this function:
- *
- *
- *
- * =====================================================================================
- */
-#define SCIShareSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIShareSegment)
-
-DLL void
-SCIShareSegment(sci_local_segment_t segment,
- unsigned int flags,
- sci_error_t *error);
-
-
-/*********************************************************************************
- * *
- * S C I F L U S H *
- * *
- * This function will flush the CPU buffers and the PSB buffers. *
- * *
- * Flags *
- * SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY : *
- * Only flush CPU buffers ( Write combining *
- * etc buffers). *
- * *
- *********************************************************************************/
-
-#define SCIFlush _SISCI_EXPANDE_FUNCTION_NAME(SCIFlush)
-DLL void SCIFlush(sci_sequence_t sequence,
- unsigned int flags);
-
-#if defined(CPLUSPLUS) || defined(__cplusplus)
-}
-#endif
-
-
-#endif
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ndb/src/external/WIN32.x86/sci/include/sisci_demolib.h b/ndb/src/external/WIN32.x86/sci/include/sisci_demolib.h
deleted file mode 100644
index ce5bb2aec8e..00000000000
--- a/ndb/src/external/WIN32.x86/sci/include/sisci_demolib.h
+++ /dev/null
@@ -1,226 +0,0 @@
-/* $Id: sisci_demolib.h,v 1.1 2002/12/13 12:17:23 hin Exp $ */
-
-/*******************************************************************************
- * *
- * Copyright (C) 1993 - 2000 *
- * Dolphin Interconnect Solutions AS *
- * *
- * 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 _SISCI_DEMOLIB_H
-#define _SISCI_DEMOLIB_H
-
-
-#if defined(_REENTRANT)
-
-#define _SISCI_DEMOLIB_EXPAND_NAME(name) _SISCI_DEMOLIB_MT_ ## name
-
-#else
-
-#define _SISCI_DEMOLIB_EXPAND_NAME(name) _SISCI_DEMOLIB_ST_ ## name
-
-#endif
-
-/*********************************************************************************/
-/* Q U E R Y A D A P T E R */
-/* */
-/*********************************************************************************/
-
-#define QueryAdapter _SISCI_DEMOLIB_EXPAND_NAME(QueryAdapter)
-
-sci_error_t QueryAdapter(
- unsigned int subcommand,
- unsigned int localAdapterNo,
- unsigned int portNo,
- unsigned int *data);
-
-
-/*********************************************************************************/
-/* Q U E R Y S Y S T E M */
-/* */
-/*********************************************************************************/
-
-#define QuerySystem _SISCI_DEMOLIB_EXPAND_NAME(QuerySystem)
-
-sci_error_t QuerySystem(
- unsigned int subcommand,
- unsigned int *data);
-
-
-/*********************************************************************************/
-/* D E T E C T F I R S T A D A P T E R C A R D */
-/* */
-/*********************************************************************************/
-
-#define DetectFirstAdapterCard _SISCI_DEMOLIB_EXPAND_NAME(DetectFirstAdapterCard)
-
-sci_error_t DetectFirstAdapterCard(
- unsigned int *localAdapterNo,
- unsigned int *localNodeId);
-
-
-/*********************************************************************************/
-/* G E T A D A P T E R T Y P E */
-/* */
-/*********************************************************************************/
-
-#define GetAdapterType _SISCI_DEMOLIB_EXPAND_NAME(GetAdapterType)
-
-sci_error_t GetAdapterType(unsigned int localAdapterNo,
- unsigned int *adapterType);
-
-
-/*********************************************************************************/
-/* G E T L O C A L N O D E I D */
-/* */
-/*********************************************************************************/
-
-#define GetLocalNodeId _SISCI_DEMOLIB_EXPAND_NAME(GetLocalNodeId)
-
-sci_error_t GetLocalNodeId(
- unsigned int localAdapterNo,
- unsigned int *localNodeId);
-
-
-/*********************************************************************************/
-/* G E T A D A P T E R S E R I A L N U M B E R */
-/* */
-/*********************************************************************************/
-
-#define GetAdapterSerialNumber _SISCI_DEMOLIB_EXPAND_NAME(GetAdapterSerialNumber)
-
-sci_error_t GetAdapterSerialNumber(
- unsigned int localAdapterNo,
- unsigned int *serialNo);
-
-
-
-/*********************************************************************************/
-/* G E T H O S T B R I D G E T Y P E */
-/* */
-/*********************************************************************************/
-
-#define GetHostbridgeType _SISCI_DEMOLIB_EXPAND_NAME(GetHostbridgeType)
-
-sci_error_t GetHostbridgeType(unsigned int *hostbridgeType);
-
-
-
-/*********************************************************************************/
-/* P R I N T H O S T B R I D G E T Y P E */
-/* */
-/*********************************************************************************/
-
-#define PrintHostbridgeType _SISCI_DEMOLIB_EXPAND_NAME(PrintHostbridgeType)
-
-void PrintHostbridgeType(unsigned int hostbridge);
-
-
-
-/*********************************************************************************/
-/* G E T A P I V E R S I O N S T R I N G */
-/* */
-/*********************************************************************************/
-
-#define GetAPIVersionString _SISCI_DEMOLIB_EXPAND_NAME(GetAPIVersionString)
-
-sci_error_t GetAPIVersionString(char str[], unsigned int strLength);
-
-
-
-/*********************************************************************************/
-/* G E T A D A P T E R I O B U S F R E Q U E N C Y */
-/* */
-/*********************************************************************************/
-
-sci_error_t GetAdapterIoBusFrequency(unsigned int localAdapterNo,
- unsigned int *ioBusFrequency);
-
-
-
-/*********************************************************************************/
-/* G E T A D A P T E R S C I L I N K F R E Q U E N C Y */
-/* */
-/*********************************************************************************/
-
-sci_error_t GetAdapterSciLinkFrequency(unsigned int localAdapterNo,
- unsigned int *sciLinkFrequency);
-
-
-
-/*********************************************************************************/
-/* G E T A D A P T E R B L I N K F R E Q U E N C Y */
-/* */
-/*********************************************************************************/
-
-sci_error_t GetAdapterBlinkFrequency(unsigned int localAdapterNo,
- unsigned int *bLinkFrequency);
-
-
-/*********************************************************************************/
-/* S E N D I N T E R R U P T */
-/* */
-/*********************************************************************************/
-
-#define SendInterrupt _SISCI_DEMOLIB_EXPAND_NAME(SendInterrupt)
-
-sci_error_t SendInterrupt(
- sci_desc_t sd,
- unsigned int localAdapterNo,
- unsigned int localNodeId,
- unsigned int remoteNodeId,
- unsigned int interruptNo);
-
-
-/*********************************************************************************/
-/* R E C E I V E I N T E R R U P T */
-/* */
-/*********************************************************************************/
-
-#define ReceiveInterrupt _SISCI_DEMOLIB_EXPAND_NAME(ReceiveInterrupt)
-
-sci_error_t ReceiveInterrupt(
- sci_desc_t sd,
- unsigned int localAdapterNo,
- unsigned int localNodeId,
- unsigned int interruptNo);
-
-
-/*********************************************************************************/
-/* E N D I A N S W A P */
-/* */
-/*********************************************************************************/
-
-#define EndianSwap _SISCI_DEMOLIB_EXPAND_NAME(EndianSwap)
-
-unsigned int EndianSwap (unsigned int value);
-
-
-/*********************************************************************************/
-/* S L E E P M I L L I S E C O N D S */
-/* */
-/*********************************************************************************/
-
-#define SleepMilliseconds _SISCI_DEMOLIB_EXPAND_NAME(SleepMilliseconds)
-
-void SleepMilliseconds(int milliseconds);
-
-
-
-
-#endif
diff --git a/ndb/src/external/WIN32.x86/sci/include/sisci_error.h b/ndb/src/external/WIN32.x86/sci/include/sisci_error.h
deleted file mode 100644
index 56fa0d18b3a..00000000000
--- a/ndb/src/external/WIN32.x86/sci/include/sisci_error.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* $Id: sisci_error.h,v 1.1 2002/12/13 12:17:23 hin Exp $ */
-
-/*******************************************************************************
- * *
- * Copyright (C) 1993 - 2000 *
- * Dolphin Interconnect Solutions AS *
- * *
- * 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 _SISCI_ERROR_H_
-#define _SISCI_ERROR_H_
-
-
-/* SCI Error return values always have 30 bit set */
-#define SCI_ERR_MASK 0x40000000
-#define SCI_ERR_REMOTE_MASK 0x01 /* Remote errors should have bit 0 set */
-
-#define SCI_ERR(u) ((unsigned32)(u)&0x7FFFFFFF )
-
-/* Error codes */
-typedef enum {
- SCI_ERR_OK = 0x000,
-
-
- SCI_ERR_BUSY = (0x900 | SCI_ERR_MASK),
- SCI_ERR_FLAG_NOT_IMPLEMENTED = (0x901 | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_FLAG = (0x902 | SCI_ERR_MASK),
- SCI_ERR_NOSPC = (0x904 | SCI_ERR_MASK),
- SCI_ERR_API_NOSPC = (0x905 | SCI_ERR_MASK),
- SCI_ERR_HW_NOSPC = (0x906 | SCI_ERR_MASK),
- SCI_ERR_NOT_IMPLEMENTED = (0x907 | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_ADAPTERNO = (0x908 | SCI_ERR_MASK),
- SCI_ERR_NO_SUCH_ADAPTERNO = (0x909 | SCI_ERR_MASK),
- SCI_ERR_TIMEOUT = (0x90A | SCI_ERR_MASK),
- SCI_ERR_OUT_OF_RANGE = (0x90B | SCI_ERR_MASK),
- SCI_ERR_NO_SUCH_SEGMENT = (0x90C | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_NODEID = (0x90D | SCI_ERR_MASK),
- SCI_ERR_CONNECTION_REFUSED = (0x90E | SCI_ERR_MASK),
- SCI_ERR_SEGMENT_NOT_CONNECTED = (0x90F | SCI_ERR_MASK),
- SCI_ERR_SIZE_ALIGNMENT = (0x910 | SCI_ERR_MASK),
- SCI_ERR_OFFSET_ALIGNMENT = (0x911 | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_PARAMETER = (0x912 | SCI_ERR_MASK),
- SCI_ERR_MAX_ENTRIES = (0x913 | SCI_ERR_MASK),
- SCI_ERR_SEGMENT_NOT_PREPARED = (0x914 | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_ADDRESS = (0x915 | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_OPERATION = (0x916 | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_QUERY = (0x917 | SCI_ERR_MASK),
- SCI_ERR_SEGMENTID_USED = (0x918 | SCI_ERR_MASK),
- SCI_ERR_SYSTEM = (0x919 | SCI_ERR_MASK),
- SCI_ERR_CANCELLED = (0x91A | SCI_ERR_MASK),
- SCI_ERR_NOT_CONNECTED = (0x91B | SCI_ERR_MASK),
- SCI_ERR_NOT_AVAILABLE = (0x91C | SCI_ERR_MASK),
- SCI_ERR_INCONSISTENT_VERSIONS = (0x91D | SCI_ERR_MASK),
- SCI_ERR_COND_INT_RACE_PROBLEM = (0x91E | SCI_ERR_MASK),
- SCI_ERR_OVERFLOW = (0x91F | SCI_ERR_MASK),
- SCI_ERR_NOT_INITIALIZED = (0x920 | SCI_ERR_MASK),
-
- SCI_ERR_ACCESS = (0x921 | SCI_ERR_MASK),
-
- SCI_ERR_NO_SUCH_NODEID = (0xA00 | SCI_ERR_MASK),
- SCI_ERR_NODE_NOT_RESPONDING = (0xA02 | SCI_ERR_MASK),
- SCI_ERR_NO_REMOTE_LINK_ACCESS = (0xA04 | SCI_ERR_MASK),
- SCI_ERR_NO_LINK_ACCESS = (0xA05 | SCI_ERR_MASK),
- SCI_ERR_TRANSFER_FAILED = (0xA06 | SCI_ERR_MASK),
-
- SCI_ERR_EWOULD_BLOCK = ( 0xB00 | SCI_ERR_MASK),
- SCI_ERR_SEMAPHORE_COUNT_EXCEEDED = ( 0xB01 | SCI_ERR_MASK),
- SCI_ERR_IRQL_ILLEGAL = ( 0xB02 | SCI_ERR_MASK)
-
-} sci_error_t;
-
-
-#endif /* _SCI_ERROR_H_ */
-
-
-
diff --git a/ndb/src/external/WIN32.x86/sci/include/sisci_types.h b/ndb/src/external/WIN32.x86/sci/include/sisci_types.h
deleted file mode 100644
index 03e7957c3f2..00000000000
--- a/ndb/src/external/WIN32.x86/sci/include/sisci_types.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/* $Id: sisci_types.h,v 1.1 2002/12/13 12:17:23 hin Exp $ */
-
-/*******************************************************************************
- * *
- * Copyright (C) 1993 - 2000 *
- * Dolphin Interconnect Solutions AS *
- * *
- * 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 _SISCI_TYPES_H
-#define _SISCI_TYPES_H
-
-#include "sisci_error.h"
-
-#ifndef IN
-#define IN
-#endif
-
-#ifndef OUT
-#define OUT
-#endif
-
-#ifndef IN_OUT
-#define IN_OUT
-#endif
-
-/* Opaque data types for descriptors/handles */
-typedef struct sci_desc *sci_desc_t;
-typedef struct sci_local_segment *sci_local_segment_t;
-typedef struct sci_remote_segment *sci_remote_segment_t;
-
-typedef struct sci_map *sci_map_t;
-typedef struct sci_sequence *sci_sequence_t;
-#ifndef KERNEL
-typedef struct sci_dma_queue *sci_dma_queue_t;
-#endif
-typedef struct sci_remote_interrupt *sci_remote_interrupt_t;
-typedef struct sci_local_interrupt *sci_local_interrupt_t;
-typedef struct sci_block_transfer *sci_block_transfer_t;
-
-/*
- * Constants defining reasons for segment callbacks:
- */
-
-typedef enum {
- SCI_CB_CONNECT = 1,
- SCI_CB_DISCONNECT,
- SCI_CB_NOT_OPERATIONAL,
- SCI_CB_OPERATIONAL,
- SCI_CB_LOST
-} sci_segment_cb_reason_t;
-
-#define MAX_CB_REASON SCI_CB_LOST
-
-/* dma_queue_states is identical to the dma_queue_state_t in genif.h, they must be consistent.*/
-typedef enum {
- SCI_DMAQUEUE_IDLE,
- SCI_DMAQUEUE_GATHER,
- SCI_DMAQUEUE_POSTED,
- SCI_DMAQUEUE_DONE,
- SCI_DMAQUEUE_ABORTED,
- SCI_DMAQUEUE_ERROR
-} sci_dma_queue_state_t;
-
-
-typedef enum {
- SCI_SEQ_OK,
- SCI_SEQ_RETRIABLE,
- SCI_SEQ_NOT_RETRIABLE,
- SCI_SEQ_PENDING
-} sci_sequence_status_t;
-
-
-typedef struct {
- unsigned short nodeId; /* SCI Address bit 63 - 48 */
- unsigned short offsHi; /* SCI Address bit 47 - 32 */
- unsigned int offsLo; /* SCI Address bit 31 - 0 */
-} sci_address_t;
-
-
-typedef unsigned int sci_ioaddr_t;
-
-typedef enum {
- SCI_CALLBACK_CANCEL = 1,
- SCI_CALLBACK_CONTINUE
-} sci_callback_action_t;
-
-#ifndef KERNEL
-typedef sci_callback_action_t (*sci_cb_local_segment_t)(void *arg,
- sci_local_segment_t segment,
- sci_segment_cb_reason_t reason,
- unsigned int nodeId,
- unsigned int localAdapterNo,
- sci_error_t error);
-
-typedef sci_callback_action_t (*sci_cb_remote_segment_t)(void *arg,
- sci_remote_segment_t segment,
- sci_segment_cb_reason_t reason,
- sci_error_t status);
-
-
-typedef sci_callback_action_t (*sci_cb_dma_t)(void IN *arg,
- sci_dma_queue_t queue,
- sci_error_t status);
-
-
-typedef int (*sci_cb_block_transfer_t)(void *arg,
- sci_block_transfer_t block,
- sci_error_t status);
-
-
-typedef sci_callback_action_t (*sci_cb_interrupt_t)(void *arg,
- sci_local_interrupt_t interrupt,
- sci_error_t status);
-
-#endif /* KERNEL */
-#endif
diff --git a/ndb/src/kernel/blocks/backup/restore/main.cpp b/ndb/src/kernel/blocks/backup/restore/main.cpp
index f7b1479cc93..482212911cb 100644
--- a/ndb/src/kernel/blocks/backup/restore/main.cpp
+++ b/ndb/src/kernel/blocks/backup/restore/main.cpp
@@ -14,7 +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 <getarg.h>
+#include <ndb_global.h>
+#include <ndb_opts.h>
#include <Vector.hpp>
#include <ndb_limits.h>
#include <NdbTCP.h>
@@ -35,80 +36,107 @@ static Vector<class BackupConsumer *> g_consumers;
static const char* ga_backupPath = "." DIR_SEPARATOR;
-static const char* ga_connect_NDB = NULL;
+static const char* opt_connect_str= NULL;
/**
* print and restore flags
*/
static bool ga_restore = false;
static bool ga_print = false;
+static int _print = 0;
+static int _print_meta = 0;
+static int _print_data = 0;
+static int _print_log = 0;
+static int _restore_data = 0;
+static int _restore_meta = 0;
+
+static struct my_option my_long_options[] =
+{
+ NDB_STD_OPTS("ndb_restore"),
+ { "connect", 'c', "same as --connect-string",
+ (gptr*) &opt_connect_str, (gptr*) &opt_connect_str, 0,
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
+ { "nodeid", 'n', "Backup files from node with id",
+ (gptr*) &ga_nodeId, (gptr*) &ga_nodeId, 0,
+ GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
+ { "backupid", 'b', "Backup id",
+ (gptr*) &ga_backupId, (gptr*) &ga_backupId, 0,
+ GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
+ { "restore_data", 'r',
+ "Restore table data/logs into NDB Cluster using NDBAPI",
+ (gptr*) &_restore_data, (gptr*) &_restore_data, 0,
+ GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
+ { "restore_meta", 'm',
+ "Restore meta data into NDB Cluster using NDBAPI",
+ (gptr*) &_restore_meta, (gptr*) &_restore_meta, 0,
+ GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
+ { "parallelism", 'p',
+ "No of parallel transactions during restore of data."
+ "(parallelism can be 1 to 1024)",
+ (gptr*) &ga_nParallelism, (gptr*) &ga_nParallelism, 0,
+ GET_INT, REQUIRED_ARG, 128, 0, 0, 0, 0, 0 },
+ { "print", 256, "Print data and log to stdout",
+ (gptr*) &_print, (gptr*) &_print, 0,
+ GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
+ { "print_data", 257, "Print data to stdout",
+ (gptr*) &_print_data, (gptr*) &_print_data, 0,
+ GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
+ { "print_meta", 258, "Print meta data to stdout",
+ (gptr*) &_print_meta, (gptr*) &_print_meta, 0,
+ GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
+ { "print_log", 259, "Print log to stdout",
+ (gptr*) &_print_log, (gptr*) &_print_log, 0,
+ GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
+ { "dont_ignore_systab_0", 'f',
+ "Experimental. Do not ignore system table during restore.",
+ (gptr*) &ga_dont_ignore_systab_0, (gptr*) &ga_dont_ignore_systab_0, 0,
+ GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
+};
+
+static void short_usage_sub(void)
+{
+ printf("Usage: %s [OPTIONS] [<path to backup files>]\n", my_progname);
+}
+static void print_version()
+{
+ printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
+}
+static void usage()
+{
+ short_usage_sub();
+ print_version();
+ my_print_help(my_long_options);
+ my_print_variables(my_long_options);
+}
+static my_bool
+get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
+ char *argument)
+{
+ switch (optid) {
+ case '#':
+ DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_restore.trace");
+ break;
+ case 'V':
+ print_version();
+ exit(0);
+ case '?':
+ usage();
+ exit(0);
+ }
+ return 0;
+}
bool
-readArguments(const int argc, const char** argv)
+readArguments(int *pargc, char*** pargv)
{
-
- int _print = 0;
- int _print_meta = 0;
- int _print_data = 0;
- int _print_log = 0;
- int _restore_data = 0;
- int _restore_meta = 0;
-
-
- struct getargs args[] =
- {
- { "connect", 'c', arg_string, &ga_connect_NDB,
- "NDB Cluster connection", "\"nodeid=<api id>;host=<hostname:port>\""},
- { "nodeid", 'n', arg_integer, &ga_nodeId,
- "Backup files from node", "db node id"},
- { "backupid", 'b',arg_integer, &ga_backupId, "Backup id", "backup id"},
- { "print", '\0', arg_flag, &_print,
- "Print data and log to stdout", "print data and log"},
- { "print_data", '\0', arg_flag, &_print_data,
- "Print data to stdout", "print data"},
- { "print_meta", '\0', arg_flag, &_print_meta,
- "Print meta data to stdout", "print meta data"},
- { "print_log", '\0', arg_flag, &_print_log,
- "Print log to stdout", "print log"},
- { "restore_data", 'r', arg_flag, &_restore_data,
- "Restore table data/logs into NDB Cluster using NDBAPI",
- "Restore table data/log"},
- { "restore_meta", 'm', arg_flag, &_restore_meta,
- "Restore meta data into NDB Cluster using NDBAPI", "Restore meta data"},
- { "parallelism", 'p', arg_integer, &ga_nParallelism,
- "No of parallel transactions during restore of data."
- "(parallelism can be 1 to 1024)",
- "Parallelism"},
-#ifdef USE_MYSQL
- { "use_mysql", '\0', arg_flag, &use_mysql,
- "Restore meta data via mysql. Systab will be ignored. Data is restored "
- "using NDBAPI.", "use mysql"},
- { "user", '\0', arg_string, &ga_user, "MySQL user", "Default: root"},
- { "password", '\0', arg_string, &ga_password, "MySQL user's password",
- "Default: \"\" "},
- { "host", '\0', arg_string, &ga_host, "Hostname of MySQL server",
- "Default: localhost"},
- { "socket", '\0', arg_string, &ga_socket, "Path to MySQL server socket file",
- "Default: /tmp/mysql.sock"},
- { "port", '\0', arg_integer, &ga_port, "Port number of MySQL server",
- "Default: 3306"},
-#endif
- { "dont_ignore_systab_0", 'f', arg_flag, &ga_dont_ignore_systab_0,
- "Experimental. Do not ignore system table during restore.",
- "dont_ignore_systab_0"}
-
- };
-
- int num_args = sizeof(args) / sizeof(args[0]);
- int optind = 0;
-
- if (getarg(args, num_args, argc, argv, &optind) ||
+ const char *load_default_groups[]= { "ndb_tools","ndb_restore",0 };
+ load_defaults("my",load_default_groups,pargc,pargv);
+ if (handle_options(pargc, pargv, my_long_options, get_one_option) ||
ga_nodeId == 0 ||
ga_backupId == 0 ||
ga_nParallelism < 1 ||
- ga_nParallelism >1024)
- {
- arg_printusage(args, num_args, argv[0], "<path to backup files>\n");
- return false;
+ ga_nParallelism >1024) {
+ exit(1);
}
BackupPrinter* printer = new BackupPrinter();
@@ -122,10 +150,6 @@ readArguments(const int argc, const char** argv)
return false;
}
- /**
- * Got segmentation fault when using the printer's attributes directly
- * in getargs... Do not have the time to found out why... this is faster...
- */
if (_print)
{
ga_print = true;
@@ -169,15 +193,14 @@ readArguments(const int argc, const char** argv)
g_consumers.push_back(c);
}
// Set backup file path
- if (argv[optind] != NULL)
+ if (*pargv[0] != NULL)
{
- ga_backupPath = argv[optind];
+ ga_backupPath = *pargv[0];
}
return true;
}
-
void
clearConsumers()
{
@@ -204,19 +227,16 @@ free_data_callback()
}
int
-main(int argc, const char** argv)
+main(int argc, char** argv)
{
- ndb_init();
- if (!readArguments(argc, argv))
+ NDB_INIT(argv[0]);
+
+ if (!readArguments(&argc, &argv))
{
return -1;
}
- if (ga_connect_NDB != NULL)
- {
- // Use connection string
- Ndb::setConnectString(ga_connect_NDB);
- }
+ Ndb::setConnectString(opt_connect_str);
/**
* we must always load meta data, even if we will only print it to stdout
diff --git a/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp b/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp
index 9a1bbd86562..c275e5382f7 100644
--- a/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp
+++ b/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp
@@ -4501,6 +4501,17 @@ void Dbacc::getdirindex(Signal* signal)
/* BUCKET, AND SERCH FOR ELEMENT.THE PRIMARY KEYS WHICH IS SAVED */
/* IN THE OPERATION REC ARE THE CHECK ITEMS IN THE SEARCHING. */
/* --------------------------------------------------------------------------------- */
+
+#if __ia64 == 1
+#if __INTEL_COMPILER == 810
+int ndb_acc_ia64_icc810_dummy_var = 0;
+void ndb_acc_ia64_icc810_dummy_func()
+{
+ ndb_acc_ia64_icc810_dummy_var++;
+}
+#endif
+#endif
+
void Dbacc::getElement(Signal* signal)
{
DirRangePtr geOverflowrangeptr;
@@ -4595,6 +4606,12 @@ void Dbacc::getElement(Signal* signal)
/* WE HAVE FOUND THE ELEMENT. GET THE LOCK INDICATOR AND RETURN FOUND. */
/* --------------------------------------------------------------------------------- */
jam();
+#if __ia64 == 1
+#if __INTEL_COMPILER == 810
+ // prevents SIGSEGV under icc -O1
+ ndb_acc_ia64_icc810_dummy_func();
+#endif
+#endif
tgeLocked = ElementHeader::getLocked(gePageptr.p->word32[tgeElementptr]);
tgeResult = ZTRUE;
TdataIndex = tgeElementptr + tgeForward;
diff --git a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
index d1a8128ea7f..882557daae1 100644
--- a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
+++ b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
@@ -3661,9 +3661,8 @@ Dbdict::execCREATE_FRAGMENTATION_CONF(Signal* signal){
req->tableId = tabPtr.i;
req->tableVersion = tabEntry->m_tableVersion + 1;
- sendSignal(rg, GSN_CREATE_TAB_REQ, signal,
- CreateTabReq::SignalLength, JBB);
-
+ sendFragmentedSignal(rg, GSN_CREATE_TAB_REQ, signal,
+ CreateTabReq::SignalLength, JBB);
return;
}
diff --git a/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp b/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
index cd15ad0c3b2..af1131e5e55 100644
--- a/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
+++ b/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
@@ -8725,7 +8725,7 @@ void Dblqh::sendKeyinfo20(Signal* signal,
sendSignal(ref, GSN_KEYINFO20, signal, 25, JBB);
src += KeyInfo20::DataLength;;
keyLen -= KeyInfo20::DataLength;
- } while(keyLen >= KeyInfo20::DataLength);
+ }
MEMCOPY_NO_WORDS(keyInfo->keyData, src, keyLen);
sendSignal(ref, GSN_KEYINFO20, signal,
diff --git a/ndb/src/kernel/error/ErrorReporter.cpp b/ndb/src/kernel/error/ErrorReporter.cpp
index 35c99b30994..35cd3f099d9 100644
--- a/ndb/src/kernel/error/ErrorReporter.cpp
+++ b/ndb/src/kernel/error/ErrorReporter.cpp
@@ -137,7 +137,7 @@ ErrorReporter::formatMessage(ErrorCategory type,
faultID,
(problemData == NULL) ? "" : problemData,
objRef,
- programName,
+ my_progname,
processId,
theNameOfTheTraceFile ? theNameOfTheTraceFile : "<no tracefile>");
diff --git a/ndb/src/kernel/main.cpp b/ndb/src/kernel/main.cpp
index fa44704807d..926647838c9 100644
--- a/ndb/src/kernel/main.cpp
+++ b/ndb/src/kernel/main.cpp
@@ -53,11 +53,9 @@ extern "C" void handler_error(int signum); // for process signal handling
void systemInfo(const Configuration & conf,
const LogLevel & ll);
-const char programName[] = "NDB Kernel";
-
-NDB_MAIN(ndb_kernel){
-
- ndb_init();
+int main(int argc, char** argv)
+{
+ NDB_INIT(argv[0]);
// Print to stdout/console
g_eventLogger.createConsoleHandler();
g_eventLogger.setCategory("NDB");
diff --git a/ndb/src/kernel/vm/Configuration.cpp b/ndb/src/kernel/vm/Configuration.cpp
index 706f60fd9cf..b3a436275f7 100644
--- a/ndb/src/kernel/vm/Configuration.cpp
+++ b/ndb/src/kernel/vm/Configuration.cpp
@@ -15,6 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h>
+#include <ndb_opts.h>
#include <LocalConfig.hpp>
#include "Configuration.hpp"
@@ -28,8 +29,6 @@
#include <NdbOut.hpp>
#include <WatchDog.hpp>
-#include <getarg.h>
-
#include <mgmapi_configuration.hpp>
#include <mgmapi_config_parameters_debug.h>
#include <kernel_config_parameters.h>
@@ -47,81 +46,86 @@ extern "C" {
#include <EventLogger.hpp>
extern EventLogger g_eventLogger;
+static const char* opt_connect_str= 0;
+static int _daemon, _no_daemon, _initial, _no_start;
+/**
+ * Arguments to NDB process
+ */
+static struct my_option my_long_options[] =
+{
+ NDB_STD_OPTS("ndbd"),
+ { "initial", 256,
+ "Perform initial start of ndbd, including cleaning the file system. "
+ "Consult documentation before using this",
+ (gptr*) &_initial, (gptr*) &_initial, 0,
+ GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
+ { "nostart", 'n',
+ "Don't start ndbd immediately. Ndbd will await command from ndb_mgmd",
+ (gptr*) &_no_start, (gptr*) &_no_start, 0,
+ GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
+ { "daemon", 'd', "Start ndbd as daemon (default)",
+ (gptr*) &_daemon, (gptr*) &_daemon, 0,
+ GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0 },
+ { "nodaemon", 257,
+ "Do not start ndbd as daemon, provided for testing purposes",
+ (gptr*) &_no_daemon, (gptr*) &_no_daemon, 0,
+ GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
+};
+static void short_usage_sub(void)
+{
+ printf("Usage: %s [OPTIONS]\n", my_progname);
+}
+static void print_version()
+{
+ printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
+}
+static void usage()
+{
+ short_usage_sub();
+ print_version();
+ my_print_help(my_long_options);
+ my_print_variables(my_long_options);
+}
+static my_bool
+get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
+ char *argument)
+{
+ switch (optid) {
+ case '#':
+ DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndbd.trace");
+ break;
+ case 'V':
+ print_version();
+ exit(0);
+ case '?':
+ usage();
+ exit(0);
+ }
+ return 0;
+}
+
bool
-Configuration::init(int argc, const char** argv){
+Configuration::init(int argc, char** argv)
+{
+ const char *load_default_groups[]= { "ndbd",0 };
+ load_defaults("my",load_default_groups,&argc,&argv);
- /**
- * Default values for arguments
- */
- int _no_start = 0;
- int _initial = 0;
- const char* _connect_str = NULL;
- int _daemon = 1;
- int _no_daemon = 0;
- int _help = 0;
- int _print_version = 0;
-#ifndef DBUG_OFF
- const char *debug_option= 0;
-#endif
-
- /**
- * Arguments to NDB process
- */
-
- struct getargs args[] = {
- { "version", 'v', arg_flag, &_print_version, "Print ndbd version", "" },
- { "nostart", 'n', arg_flag, &_no_start,
- "Don't start ndbd immediately. Ndbd will await command from ndb_mgmd", "" },
- { "daemon", 'd', arg_flag, &_daemon, "Start ndbd as daemon (default)", "" },
- { "nodaemon", 0, arg_flag, &_no_daemon, "Do not start ndbd as daemon, provided for testing purposes", "" },
-#ifndef DBUG_OFF
- { "debug", 0, arg_string, &debug_option,
- "Specify debug options e.g. d:t:i:o,out.trace", "options" },
-#endif
- { "initial", 0, arg_flag, &_initial,
- "Perform initial start of ndbd, including cleaning the file system. Consult documentation before using this", "" },
+ int ho_error;
+ if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
+ exit(ho_error);
- { "connect-string", 'c', arg_string, &_connect_str,
- "Set connect string for connecting to ndb_mgmd. <constr>=\"host=<hostname:port>[;nodeid=<id>]\". Overides specifying entries in NDB_CONNECTSTRING and config file",
- "<constr>" },
- { "usage", '?', arg_flag, &_help, "Print help", "" }
- };
- int num_args = sizeof(args) / sizeof(args[0]);
- int optind = 0;
- char desc[] =
- "The MySQL Cluster kernel";
-
- if(getarg(args, num_args, argc, argv, &optind) || _help) {
- arg_printusage(args, num_args, argv[0], desc);
- for (int i = 0; i < argc; i++) {
- if (strcmp("-i",argv[i]) == 0) {
- printf("flag depricated %s, use %s\n", "-i", "--initial");
- }
- }
- return false;
- }
if (_no_daemon) {
_daemon= 0;
}
- // check for depricated flag '-i'
-
-#ifndef DBUG_OFF
- if (debug_option)
- DBUG_PUSH(debug_option);
-#endif
DBUG_PRINT("info", ("no_start=%d", _no_start));
DBUG_PRINT("info", ("initial=%d", _initial));
DBUG_PRINT("info", ("daemon=%d", _daemon));
- DBUG_PRINT("info", ("connect_str=%s", _connect_str));
+ DBUG_PRINT("info", ("connect_str=%s", opt_connect_str));
ndbSetOwnVersion();
- if (_print_version) {
- ndbPrintVersion();
- return false;
- }
-
// Check the start flag
if (_no_start)
globalData.theRestartFlag = initial_state;
@@ -133,8 +137,8 @@ Configuration::init(int argc, const char** argv){
_initialStart = true;
// Check connectstring
- if (_connect_str)
- _connectString = strdup(_connect_str);
+ if (opt_connect_str)
+ _connectString = strdup(opt_connect_str);
// Check daemon flag
if (_daemon)
diff --git a/ndb/src/kernel/vm/Configuration.hpp b/ndb/src/kernel/vm/Configuration.hpp
index 2ea32ffea37..e4cd64f5ca8 100644
--- a/ndb/src/kernel/vm/Configuration.hpp
+++ b/ndb/src/kernel/vm/Configuration.hpp
@@ -31,7 +31,7 @@ public:
/**
* Returns false if arguments are invalid
*/
- bool init(int argc, const char** argv);
+ bool init(int argc, char** argv);
void fetch_configuration(LocalConfig &local_config);
void setupConfiguration();
diff --git a/ndb/src/kernel/vm/Emulator.hpp b/ndb/src/kernel/vm/Emulator.hpp
index bd240f8679b..b3c64830802 100644
--- a/ndb/src/kernel/vm/Emulator.hpp
+++ b/ndb/src/kernel/vm/Emulator.hpp
@@ -25,6 +25,7 @@
//
//===========================================================================
#include <kernel_types.h>
+#include <TransporterRegistry.hpp>
extern class JobTable globalJobTable;
extern class TimeQueue globalTimeQueue;
diff --git a/ndb/src/kernel/vm/LongSignal.hpp b/ndb/src/kernel/vm/LongSignal.hpp
index f9ed443d995..9818358011f 100644
--- a/ndb/src/kernel/vm/LongSignal.hpp
+++ b/ndb/src/kernel/vm/LongSignal.hpp
@@ -25,7 +25,7 @@
*/
struct SectionSegment {
- STATIC_CONST( DataLength = 60 );
+ STATIC_CONST( DataLength = NDB_SECTION_SEGMENT_SZ );
Uint32 m_ownerRef;
Uint32 m_sz;
diff --git a/ndb/src/mgmclient/main.cpp b/ndb/src/mgmclient/main.cpp
index cc6d4bf600e..a37214d366b 100644
--- a/ndb/src/mgmclient/main.cpp
+++ b/ndb/src/mgmclient/main.cpp
@@ -15,11 +15,12 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h>
+#include <ndb_opts.h>
#include <NdbMain.h>
#include <NdbHost.h>
-#include <util/getarg.h>
#include <mgmapi.h>
+#include <ndb_version.h>
#include <LocalConfig.hpp>
#include "CommandInterpreter.hpp"
@@ -43,28 +44,62 @@ handler(int sig){
}
}
-int main(int argc, const char** argv){
- ndb_init();
- int optind = 0;
+
+static unsigned _try_reconnect;
+static char *opt_connect_str= 0;
+
+static struct my_option my_long_options[] =
+{
+ NDB_STD_OPTS("ndb_mgm"),
+ { "try-reconnect", 't',
+ "Specify number of retries for connecting to ndb_mgmd, default infinite",
+ (gptr*) &_try_reconnect, (gptr*) &_try_reconnect, 0,
+ GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
+};
+static void short_usage_sub(void)
+{
+ printf("Usage: %s [OPTIONS] [hostname [port]]\n", my_progname);
+}
+static void print_version()
+{
+ printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
+}
+static void usage()
+{
+ short_usage_sub();
+ print_version();
+ my_print_help(my_long_options);
+ my_print_variables(my_long_options);
+}
+static my_bool
+get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
+ char *argument)
+{
+ switch (optid) {
+ case '#':
+ DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_mgm.trace");
+ break;
+ case 'V':
+ print_version();
+ exit(0);
+ case '?':
+ usage();
+ exit(0);
+ }
+ return 0;
+}
+
+int main(int argc, char** argv){
+ NDB_INIT(argv[0]);
const char *_host = 0;
int _port = 0;
- int _help = 0;
- int _try_reconnect = 0;
-
- struct getargs args[] = {
- { "try-reconnect", 't', arg_integer, &_try_reconnect, "Specify number of retries for connecting to ndb_mgmd, default infinite", "#" },
- { "usage", '?', arg_flag, &_help, "Print help", "" },
- };
- int num_args = sizeof(args) / sizeof(args[0]); /* Number of arguments */
-
-
- if(getarg(args, num_args, argc, argv, &optind) || _help) {
- arg_printusage(args, num_args, progname, "[host [port]]");
- exit(1);
- }
+ const char *load_default_groups[]= { "ndb_mgm",0 };
- argv += optind;
- argc -= optind;
+ load_defaults("my",load_default_groups,&argc,&argv);
+ int ho_error;
+ if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
+ exit(ho_error);
LocalConfig cfg;
@@ -74,7 +109,7 @@ int main(int argc, const char** argv){
_port = atoi(argv[1]);
}
} else {
- if(cfg.init(0, 0) && cfg.ids.size() > 0 && cfg.ids[0].type == MgmId_TCP){
+ if(cfg.init(opt_connect_str, 0) && cfg.ids.size() > 0 && cfg.ids[0].type == MgmId_TCP){
_host = cfg.ids[0].name.c_str();
_port = cfg.ids[0].port;
} else {
diff --git a/ndb/src/mgmsrv/MgmtSrvr.cpp b/ndb/src/mgmsrv/MgmtSrvr.cpp
index 29df10630f3..2e30d73290b 100644
--- a/ndb/src/mgmsrv/MgmtSrvr.cpp
+++ b/ndb/src/mgmsrv/MgmtSrvr.cpp
@@ -407,7 +407,6 @@ MgmtSrvr::MgmtSrvr(NodeId nodeId,
// signals to other management servers.
_ownReference(0),
m_local_config(local_config),
- m_allocated_resources(*this),
theSignalIdleList(NULL),
theWaitState(WAIT_SUBSCRIBE_CONF),
m_statisticsListner(this)
@@ -480,6 +479,13 @@ MgmtSrvr::MgmtSrvr(NodeId nodeId,
_ownNodeId= 0;
NodeId tmp= nodeId;
BaseString error_string;
+
+ if ((m_node_id_mutex = NdbMutex_Create()) == 0)
+ {
+ ndbout << "mutex creation failed line = " << __LINE__ << endl;
+ exit(-1);
+ }
+
#if 0
char my_hostname[256];
struct sockaddr_in tmp_addr;
@@ -512,7 +518,6 @@ MgmtSrvr::MgmtSrvr(NodeId nodeId,
#endif
_ownNodeId = tmp;
-
{
DBUG_PRINT("info", ("verifyConfig"));
ConfigRetriever cr(m_local_config, NDB_VERSION, NDB_MGM_NODE_TYPE_MGM);
@@ -534,12 +539,6 @@ MgmtSrvr::MgmtSrvr(NodeId nodeId,
m_statisticsListner.m_logLevel = se.m_logLevel;
}
- if ((m_node_id_mutex = NdbMutex_Create()) == 0)
- {
- ndbout << "mutex creation failed line = " << __LINE__ << endl;
- exit(-1);
- }
-
DBUG_VOID_RETURN;
}
diff --git a/ndb/src/mgmsrv/MgmtSrvr.hpp b/ndb/src/mgmsrv/MgmtSrvr.hpp
index a5f21b6bc4a..c796e1e9219 100644
--- a/ndb/src/mgmsrv/MgmtSrvr.hpp
+++ b/ndb/src/mgmsrv/MgmtSrvr.hpp
@@ -534,7 +534,6 @@ private:
Uint32 m_nextConfigGenerationNumber;
NodeBitmask m_reserved_nodes;
- Allocated_resources m_allocated_resources;
struct in_addr m_connect_address[MAX_NODES];
//**************************************************************************
diff --git a/ndb/src/mgmsrv/Services.cpp b/ndb/src/mgmsrv/Services.cpp
index 5b552836955..2672d8c9d4b 100644
--- a/ndb/src/mgmsrv/Services.cpp
+++ b/ndb/src/mgmsrv/Services.cpp
@@ -773,8 +773,10 @@ MgmApiSession::setClusterLogLevel(Parser<MgmApiSession>::Context &,
/* XXX should use constants for this value */
if(level > 15) {
- errorString.assign("Invalied loglevel");
- goto error;
+ m_output->println("set cluster loglevel reply");
+ m_output->println("result: Invalid loglevel");
+ m_output->println("");
+ return;
}
EventSubscribeReq req;
@@ -786,11 +788,6 @@ MgmApiSession::setClusterLogLevel(Parser<MgmApiSession>::Context &,
m_output->println("set cluster loglevel reply");
m_output->println("result: Ok");
m_output->println("");
- return;
-error:
- m_output->println("set cluster loglevel reply");
- m_output->println("result: %s", errorString.c_str());
- m_output->println("");
}
void
@@ -807,8 +804,10 @@ MgmApiSession::setLogLevel(Parser<MgmApiSession>::Context &,
/* XXX should use constants for this value */
if(level > 15) {
- errorString.assign("Invalied loglevel");
- goto error;
+ m_output->println("set loglevel reply");
+ m_output->println("result: Invalid loglevel", errorString.c_str());
+ m_output->println("");
+ return;
}
EventSubscribeReq req;
@@ -820,11 +819,6 @@ MgmApiSession::setLogLevel(Parser<MgmApiSession>::Context &,
m_output->println("set loglevel reply");
m_output->println("result: Ok");
m_output->println("");
- return;
- error:
- m_output->println("set loglevel reply");
- m_output->println("result: %s", errorString.c_str());
- m_output->println("");
}
void
diff --git a/ndb/src/mgmsrv/main.cpp b/ndb/src/mgmsrv/main.cpp
index 5ee48e4cfcc..15767e4766d 100644
--- a/ndb/src/mgmsrv/main.cpp
+++ b/ndb/src/mgmsrv/main.cpp
@@ -15,6 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h>
+#include <ndb_opts.h>
#include "MgmtSrvr.hpp"
#include "EventLogger.hpp"
@@ -33,7 +34,6 @@
#include <ndb_version.h>
#include <ConfigRetriever.hpp>
#include <mgmapi_config_parameters.h>
-#include <getarg.h>
#include <NdbAutoPtr.hpp>
@@ -97,41 +97,93 @@ bool g_StopServer;
extern EventLogger g_EventLogger;
extern int global_mgmt_server_check;
-int _print_version = 0;
-#ifndef DBUG_OFF
-const char *debug_option= 0;
-#endif
+static char *opt_connect_str= 0;
-struct getargs args[] = {
- { "version", 'v', arg_flag, &_print_version,
- "Print ndb_mgmd version",""},
- { "config-file", 'c', arg_string, &glob.config_filename,
- "Specify cluster configuration file (default config.ini if available)",
- "filename"},
+static struct my_option my_long_options[] =
+{
#ifndef DBUG_OFF
- { "debug", 0, arg_string, &debug_option,
- "Specify debug options e.g. d:t:i:o,out.trace", "options"},
+ { "debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
+ 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0 },
#endif
- { "daemon", 'd', arg_flag, &glob.daemon,
- "Run ndb_mgmd in daemon mode (default)",""},
- { NULL, 'l', arg_string, &glob.local_config_filename,
- "Specify configuration file connect string (default Ndb.cfg if available)",
- "filename"},
- { "interactive", 0, arg_flag, &glob.interactive,
- "Run interactive. Not supported but provided for testing purposes", ""},
- { "no-nodeid-checks", 0, arg_flag, &g_no_nodeid_checks,
- "Do not provide any node id checks", ""},
- { "nodaemon", 0, arg_flag, &glob.non_interactive,
- "Don't run as daemon, but don't read from stdin", "non-interactive"}
+ { "usage", '?', "Display this help and exit.",
+ 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 },
+ { "help", '?', "Display this help and exit.",
+ 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 },
+ { "version", 'V', "Output version information and exit.", 0, 0, 0,
+ GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 },
+ { "connect-string", 1023,
+ "Set connect string for connecting to ndb_mgmd. "
+ "<constr>=\"host=<hostname:port>[;nodeid=<id>]\". "
+ "Overides specifying entries in NDB_CONNECTSTRING and config file",
+ (gptr*) &opt_connect_str, (gptr*) &opt_connect_str, 0,
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
+ { "config-file", 'f', "Specify cluster configuration file",
+ (gptr*) &glob.config_filename, (gptr*) &glob.config_filename, 0,
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
+ { "daemon", 'd', "Run ndb_mgmd in daemon mode (default)",
+ (gptr*) &glob.daemon, (gptr*) &glob.daemon, 0,
+ GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0 },
+ { "l", 'l', "Specify configuration file connect string (default Ndb.cfg if available)",
+ (gptr*) &glob.local_config_filename, (gptr*) &glob.local_config_filename, 0,
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
+ { "interactive", 256, "Run interactive. Not supported but provided for testing purposes",
+ (gptr*) &glob.interactive, (gptr*) &glob.interactive, 0,
+ GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
+ { "no-nodeid-checks", 257, "Do not provide any node id checks",
+ (gptr*) &g_no_nodeid_checks, (gptr*) &g_no_nodeid_checks, 0,
+ GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
+ { "nodaemon", 258, "Don't run as daemon, but don't read from stdin",
+ (gptr*) &glob.non_interactive, (gptr*) &glob.non_interactive, 0,
+ GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
+ { "config-file", 'c',
+ "-c provided for backwards compatability, will be removed in 5.0."
+ " Use -f instead",
+ (gptr*) &glob.config_filename, (gptr*) &glob.config_filename, 0,
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
-
-int num_args = sizeof(args) / sizeof(args[0]);
+static void short_usage_sub(void)
+{
+ printf("Usage: %s [OPTIONS]\n", my_progname);
+}
+static void print_version()
+{
+ printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
+}
+static void usage()
+{
+ short_usage_sub();
+ print_version();
+ my_print_help(my_long_options);
+ my_print_variables(my_long_options);
+}
+static my_bool
+get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
+ char *argument)
+{
+ switch (optid) {
+ case '#':
+ DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_mgmd.trace");
+ break;
+ case 'V':
+ print_version();
+ exit(0);
+ case 'c':
+ printf("Warning: -c will be removed in 5.0, use -f instead\n");
+ break;
+ case '?':
+ usage();
+ exit(0);
+ }
+ return 0;
+}
/*
* MAIN
*/
-NDB_MAIN(mgmsrv){
- ndb_init();
+int main(int argc, char** argv)
+{
+ NDB_INIT(argv[0]);
/**
* OSE specific. Enable shared ownership of file system resources.
@@ -143,31 +195,20 @@ NDB_MAIN(mgmsrv){
#endif
global_mgmt_server_check = 1;
+ glob.config_filename= "config.ini";
- int optind = 0;
- if(getarg(args, num_args, argc, argv, &optind)) {
- arg_printusage(args, num_args, progname, "");
- exit(1);
- }
+ const char *load_default_groups[]= { "ndb_mgmd",0 };
+ load_defaults("my",load_default_groups,&argc,&argv);
+
+ int ho_error;
+ if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
+ exit(ho_error);
if (glob.interactive ||
glob.non_interactive) {
glob.daemon= 0;
}
-#ifndef DBUG_OFF
- if (debug_option)
- DBUG_PUSH(debug_option);
-#endif
-
- if (_print_version) {
- ndbPrintVersion();
- exit(0);
- }
-
- if(glob.config_filename == NULL) {
- glob.config_filename= "config.ini";
- }
glob.socketServer = new SocketServer();
MgmApiService * mapi = new MgmApiService();
diff --git a/ndb/src/ndbapi/Ndb.cpp b/ndb/src/ndbapi/Ndb.cpp
index d7b8a695fe2..75ae539fc8b 100644
--- a/ndb/src/ndbapi/Ndb.cpp
+++ b/ndb/src/ndbapi/Ndb.cpp
@@ -1386,6 +1386,7 @@ Ndb::printState(const char* fmt, ...)
va_end(ap);
NdbMutex_Lock(ndb_print_state_mutex);
bool dups = false;
+ unsigned i;
ndbout << buf << " ndb=" << hex << this << dec;
#ifndef NDB_WIN32
ndbout << " thread=" << (int)pthread_self();
@@ -1406,21 +1407,21 @@ Ndb::printState(const char* fmt, ...)
ndbout << "!! DUPS !!" << endl;
dups = true;
}
- for (unsigned i = 0; i < theNoOfPreparedTransactions; i++)
+ for (i = 0; i < theNoOfPreparedTransactions; i++)
thePreparedTransactionsArray[i]->printState();
ndbout << "sent: " << theNoOfSentTransactions<< endl;
if (checkdups(theSentTransactionsArray, theNoOfSentTransactions)) {
ndbout << "!! DUPS !!" << endl;
dups = true;
}
- for (unsigned i = 0; i < theNoOfSentTransactions; i++)
+ for (i = 0; i < theNoOfSentTransactions; i++)
theSentTransactionsArray[i]->printState();
ndbout << "completed: " << theNoOfCompletedTransactions<< endl;
if (checkdups(theCompletedTransactionsArray, theNoOfCompletedTransactions)) {
ndbout << "!! DUPS !!" << endl;
dups = true;
}
- for (unsigned i = 0; i < theNoOfCompletedTransactions; i++)
+ for (i = 0; i < theNoOfCompletedTransactions; i++)
theCompletedTransactionsArray[i]->printState();
NdbMutex_Unlock(ndb_print_state_mutex);
}
diff --git a/ndb/src/ndbapi/NdbBlob.cpp b/ndb/src/ndbapi/NdbBlob.cpp
index feab95d8ca5..53c0a0e07f9 100644
--- a/ndb/src/ndbapi/NdbBlob.cpp
+++ b/ndb/src/ndbapi/NdbBlob.cpp
@@ -33,21 +33,24 @@
ndbout << prefix << " " << hex << (void*)this << " " << cname; \
ndbout << " " << dec << __LINE__ << " " << x << " " << *this << endl; \
} while (0)
-#else
-#define DBG(x)
-#endif
static char*
ndb_blob_debug(const Uint32* data, unsigned size)
{
- static char buf[128 + 1]; // MT irrelevant
+ static char buf[200]; // MT irrelevant
buf[0] = 0;
- for (unsigned i = 0; i < size && i < 128 / 4; i++) {
- sprintf(buf + strlen(buf), "%*s%08x", i != 0, "", data[i]);
+ for (unsigned i = 0; i < size; i++) {
+ unsigned n = strlen(buf);
+ if (n + 10 < sizeof(buf))
+ sprintf(buf + n, "%*s%08x", i != 0, "", data[i]);
}
return buf;
}
+#else
+#define DBG(x)
+#endif
+
/*
* Reading index table directly (as a table) is faster but there are
* bugs or limitations. Keep the code and make possible to choose.
@@ -94,22 +97,24 @@ NdbBlob::getBlobTable(NdbTableImpl& bt, const NdbTableImpl* t, const NdbColumnIm
bt.setName(btname);
bt.setLogging(t->getLogging());
bt.setFragmentType(t->getFragmentType());
- { NdbDictionary::Column bc("DIST");
+ { NdbDictionary::Column bc("PK");
bc.setType(NdbDictionary::Column::Unsigned);
+ assert(t->m_sizeOfKeysInWords != 0);
+ bc.setLength(t->m_sizeOfKeysInWords);
bc.setPrimaryKey(true);
bc.setDistributionKey(true);
bt.addColumn(bc);
}
- { NdbDictionary::Column bc("PART");
+ { NdbDictionary::Column bc("DIST");
bc.setType(NdbDictionary::Column::Unsigned);
bc.setPrimaryKey(true);
+ bc.setDistributionKey(true);
bt.addColumn(bc);
}
- { NdbDictionary::Column bc("PK");
+ { NdbDictionary::Column bc("PART");
bc.setType(NdbDictionary::Column::Unsigned);
- assert(t->m_sizeOfKeysInWords != 0);
- bc.setLength(t->m_sizeOfKeysInWords);
bc.setPrimaryKey(true);
+ bc.setDistributionKey(false);
bt.addColumn(bc);
}
{ NdbDictionary::Column bc("DATA");
@@ -162,6 +167,7 @@ NdbBlob::init()
theHead = NULL;
theInlineData = NULL;
theHeadInlineRecAttr = NULL;
+ theHeadInlineReadOp = NULL;
theHeadInlineUpdateFlag = false;
theNullFlag = -1;
theLength = 0;
@@ -206,6 +212,13 @@ NdbBlob::Buf::alloc(unsigned n)
#endif
}
+void
+NdbBlob::Buf::copyfrom(const NdbBlob::Buf& src)
+{
+ assert(size == src.size);
+ memcpy(data, src.data, size);
+}
+
// classify operations (inline)
inline bool
@@ -226,6 +239,7 @@ NdbBlob::isKeyOp()
return
theNdbOp->theOperationType == NdbOperation::InsertRequest ||
theNdbOp->theOperationType == NdbOperation::UpdateRequest ||
+ theNdbOp->theOperationType == NdbOperation::WriteRequest ||
theNdbOp->theOperationType == NdbOperation::ReadRequest ||
theNdbOp->theOperationType == NdbOperation::ReadExclusive ||
theNdbOp->theOperationType == NdbOperation::DeleteRequest;
@@ -254,6 +268,13 @@ NdbBlob::isUpdateOp()
}
inline bool
+NdbBlob::isWriteOp()
+{
+ return
+ theNdbOp->theOperationType == NdbOperation::WriteRequest;
+}
+
+inline bool
NdbBlob::isDeleteOp()
{
return
@@ -373,9 +394,10 @@ NdbBlob::setPartKeyValue(NdbOperation* anOp, Uint32 part)
Uint32* data = (Uint32*)theKeyBuf.data;
unsigned size = theTable->m_sizeOfKeysInWords;
DBG("setPartKeyValue dist=" << getDistKey(part) << " part=" << part << " key=" << ndb_blob_debug(data, size));
- if (anOp->equal((Uint32)0, getDistKey(part)) == -1 ||
- anOp->equal((Uint32)1, part) == -1 ||
- anOp->equal((Uint32)2, theKeyBuf.data) == -1) {
+ // TODO use attr ids after compatibility with 4.1.7 not needed
+ if (anOp->equal("PK", theKeyBuf.data) == -1 ||
+ anOp->equal("DIST", getDistKey(part)) == -1 ||
+ anOp->equal("PART", part) == -1) {
setErrorCode(anOp);
return -1;
}
@@ -401,7 +423,7 @@ NdbBlob::getHeadFromRecAttr()
theNullFlag = theHeadInlineRecAttr->isNULL();
assert(theNullFlag != -1);
theLength = ! theNullFlag ? theHead->length : 0;
- DBG("getHeadFromRecAttr out");
+ DBG("getHeadFromRecAttr [out]");
}
int
@@ -453,7 +475,7 @@ NdbBlob::setValue(const void* data, Uint32 bytes)
setErrorCode(ErrState);
return -1;
}
- if (! isInsertOp() && ! isUpdateOp()) {
+ if (! isInsertOp() && ! isUpdateOp() && ! isWriteOp()) {
setErrorCode(ErrUsage);
return -1;
}
@@ -466,11 +488,12 @@ NdbBlob::setValue(const void* data, Uint32 bytes)
theGetSetBytes = bytes;
if (isInsertOp()) {
// write inline part now
- if (theSetBuf != 0) {
- unsigned n = theGetSetBytes;
+ if (theSetBuf != NULL) {
+ Uint32 n = theGetSetBytes;
if (n > theInlineSize)
n = theInlineSize;
- if (writeDataPrivate(0, theSetBuf, n) == -1)
+ assert(thePos == 0);
+ if (writeDataPrivate(theSetBuf, n) == -1)
return -1;
} else {
theNullFlag = true;
@@ -555,7 +578,7 @@ NdbBlob::getLength(Uint64& len)
int
NdbBlob::truncate(Uint64 length)
{
- DBG("truncate length=" << length);
+ DBG("truncate [in] length=" << length);
if (theNullFlag == -1) {
setErrorCode(ErrState);
return -1;
@@ -573,7 +596,10 @@ NdbBlob::truncate(Uint64 length)
}
theLength = length;
theHeadInlineUpdateFlag = true;
+ if (thePos > length)
+ thePos = length;
}
+ DBG("truncate [out]");
return 0;
}
@@ -610,32 +636,20 @@ NdbBlob::setPos(Uint64 pos)
int
NdbBlob::readData(void* data, Uint32& bytes)
{
- if (readData(thePos, data, bytes) == -1)
- return -1;
- thePos += bytes;
- assert(thePos <= theLength);
- return 0;
-}
-
-int
-NdbBlob::readData(Uint64 pos, void* data, Uint32& bytes)
-{
if (theState != Active) {
setErrorCode(ErrState);
return -1;
}
char* buf = static_cast<char*>(data);
- return readDataPrivate(pos, buf, bytes);
+ return readDataPrivate(buf, bytes);
}
int
-NdbBlob::readDataPrivate(Uint64 pos, char* buf, Uint32& bytes)
+NdbBlob::readDataPrivate(char* buf, Uint32& bytes)
{
- DBG("readData pos=" << pos << " bytes=" << bytes);
- if (pos > theLength) {
- setErrorCode(ErrSeek);
- return -1;
- }
+ DBG("readData [in] bytes=" << bytes);
+ assert(thePos <= theLength);
+ Uint64 pos = thePos;
if (bytes > theLength - pos)
bytes = theLength - pos;
Uint32 len = bytes;
@@ -665,7 +679,6 @@ NdbBlob::readDataPrivate(Uint64 pos, char* buf, Uint32& bytes)
if (readParts(thePartBuf.data, part, 1) == -1)
return -1;
// need result now
- DBG("execute pending part reads");
if (executePendingBlobReads() == -1)
return -1;
Uint32 n = thePartSize - off;
@@ -699,7 +712,6 @@ NdbBlob::readDataPrivate(Uint64 pos, char* buf, Uint32& bytes)
if (readParts(thePartBuf.data, part, 1) == -1)
return -1;
// need result now
- DBG("execute pending part reads");
if (executePendingBlobReads() == -1)
return -1;
memcpy(buf, thePartBuf.data, len);
@@ -709,38 +721,29 @@ NdbBlob::readDataPrivate(Uint64 pos, char* buf, Uint32& bytes)
len -= n;
}
assert(len == 0);
- return 0;
-}
-
-int
-NdbBlob::writeData(const void* data, Uint32 bytes)
-{
- if (writeData(thePos, data, bytes) == -1)
- return -1;
- thePos += bytes;
+ thePos = pos;
assert(thePos <= theLength);
+ DBG("readData [out]");
return 0;
}
int
-NdbBlob::writeData(Uint64 pos, const void* data, Uint32 bytes)
+NdbBlob::writeData(const void* data, Uint32 bytes)
{
if (theState != Active) {
setErrorCode(ErrState);
return -1;
}
const char* buf = static_cast<const char*>(data);
- return writeDataPrivate(pos, buf, bytes);
+ return writeDataPrivate(buf, bytes);
}
int
-NdbBlob::writeDataPrivate(Uint64 pos, const char* buf, Uint32 bytes)
+NdbBlob::writeDataPrivate(const char* buf, Uint32 bytes)
{
- DBG("writeData pos=" << pos << " bytes=" << bytes);
- if (pos > theLength) {
- setErrorCode(ErrSeek);
- return -1;
- }
+ DBG("writeData [in] bytes=" << bytes);
+ assert(thePos <= theLength);
+ Uint64 pos = thePos;
Uint32 len = bytes;
// any write makes blob not NULL
if (theNullFlag) {
@@ -771,14 +774,12 @@ NdbBlob::writeDataPrivate(Uint64 pos, const char* buf, Uint32 bytes)
if (off != 0) {
DBG("partial first block pos=" << pos << " len=" << len);
// flush writes to guarantee correct read
- DBG("execute pending part writes");
if (executePendingBlobWrites() == -1)
return -1;
Uint32 part = (pos - theInlineSize) / thePartSize;
if (readParts(thePartBuf.data, part, 1) == -1)
return -1;
// need result now
- DBG("execute pending part reafs");
if (executePendingBlobReads() == -1)
return -1;
Uint32 n = thePartSize - off;
@@ -822,13 +823,11 @@ NdbBlob::writeDataPrivate(Uint64 pos, const char* buf, Uint32 bytes)
Uint32 part = (pos - theInlineSize) / thePartSize;
if (theLength > pos + len) {
// flush writes to guarantee correct read
- DBG("execute pending part writes");
if (executePendingBlobWrites() == -1)
return -1;
if (readParts(thePartBuf.data, part, 1) == -1)
return -1;
// need result now
- DBG("execute pending part reads");
if (executePendingBlobReads() == -1)
return -1;
memcpy(thePartBuf.data, buf, len);
@@ -855,14 +854,16 @@ NdbBlob::writeDataPrivate(Uint64 pos, const char* buf, Uint32 bytes)
theLength = pos;
theHeadInlineUpdateFlag = true;
}
- DBG("writeData out");
+ thePos = pos;
+ assert(thePos <= theLength);
+ DBG("writeData [out]");
return 0;
}
int
NdbBlob::readParts(char* buf, Uint32 part, Uint32 count)
{
- DBG("readParts part=" << part << " count=" << count);
+ DBG("readParts [in] part=" << part << " count=" << count);
Uint32 n = 0;
while (n < count) {
NdbOperation* tOp = theNdbCon->getNdbOperation(theBlobTable);
@@ -873,6 +874,7 @@ NdbBlob::readParts(char* buf, Uint32 part, Uint32 count)
setErrorCode(tOp);
return -1;
}
+ tOp->m_abortOption = AbortOnError;
buf += thePartSize;
n++;
thePendingBlobOps |= (1 << NdbOperation::ReadRequest);
@@ -884,7 +886,7 @@ NdbBlob::readParts(char* buf, Uint32 part, Uint32 count)
int
NdbBlob::insertParts(const char* buf, Uint32 part, Uint32 count)
{
- DBG("insertParts part=" << part << " count=" << count);
+ DBG("insertParts [in] part=" << part << " count=" << count);
Uint32 n = 0;
while (n < count) {
NdbOperation* tOp = theNdbCon->getNdbOperation(theBlobTable);
@@ -895,6 +897,7 @@ NdbBlob::insertParts(const char* buf, Uint32 part, Uint32 count)
setErrorCode(tOp);
return -1;
}
+ tOp->m_abortOption = AbortOnError;
buf += thePartSize;
n++;
thePendingBlobOps |= (1 << NdbOperation::InsertRequest);
@@ -906,7 +909,7 @@ NdbBlob::insertParts(const char* buf, Uint32 part, Uint32 count)
int
NdbBlob::updateParts(const char* buf, Uint32 part, Uint32 count)
{
- DBG("updateParts part=" << part << " count=" << count);
+ DBG("updateParts [in] part=" << part << " count=" << count);
Uint32 n = 0;
while (n < count) {
NdbOperation* tOp = theNdbCon->getNdbOperation(theBlobTable);
@@ -917,6 +920,7 @@ NdbBlob::updateParts(const char* buf, Uint32 part, Uint32 count)
setErrorCode(tOp);
return -1;
}
+ tOp->m_abortOption = AbortOnError;
buf += thePartSize;
n++;
thePendingBlobOps |= (1 << NdbOperation::UpdateRequest);
@@ -928,7 +932,7 @@ NdbBlob::updateParts(const char* buf, Uint32 part, Uint32 count)
int
NdbBlob::deleteParts(Uint32 part, Uint32 count)
{
- DBG("deleteParts part=" << part << " count=" << count);
+ DBG("deleteParts [in] part=" << part << " count=" << count);
Uint32 n = 0;
while (n < count) {
NdbOperation* tOp = theNdbCon->getNdbOperation(theBlobTable);
@@ -938,6 +942,7 @@ NdbBlob::deleteParts(Uint32 part, Uint32 count)
setErrorCode(tOp);
return -1;
}
+ tOp->m_abortOption = AbortOnError;
n++;
thePendingBlobOps |= (1 << NdbOperation::DeleteRequest);
theNdbCon->thePendingBlobOps |= (1 << NdbOperation::DeleteRequest);
@@ -945,6 +950,59 @@ NdbBlob::deleteParts(Uint32 part, Uint32 count)
return 0;
}
+/*
+ * Number of blob parts not known. Used to check for race condition
+ * when writeTuple is used for insert. Deletes all parts found.
+ */
+int
+NdbBlob::deletePartsUnknown(Uint32 part)
+{
+ DBG("deletePartsUnknown [in] part=" << part << " count=all");
+ static const unsigned maxbat = 256;
+ static const unsigned minbat = 1;
+ unsigned bat = minbat;
+ NdbOperation* tOpList[maxbat];
+ Uint32 count = 0;
+ while (true) {
+ Uint32 n;
+ n = 0;
+ while (n < bat) {
+ NdbOperation*& tOp = tOpList[n]; // ref
+ tOp = theNdbCon->getNdbOperation(theBlobTable);
+ if (tOp == NULL ||
+ tOp->deleteTuple() == -1 ||
+ setPartKeyValue(tOp, part + count + n) == -1) {
+ setErrorCode(tOp);
+ return -1;
+ }
+ tOp->m_abortOption = IgnoreError;
+ n++;
+ }
+ DBG("deletePartsUnknown: executeNoBlobs [in] bat=" << bat);
+ if (theNdbCon->executeNoBlobs(NoCommit) == -1)
+ return -1;
+ DBG("deletePartsUnknown: executeNoBlobs [out]");
+ n = 0;
+ while (n < bat) {
+ NdbOperation* tOp = tOpList[n];
+ if (tOp->theError.code != 0) {
+ if (tOp->theError.code != 626) {
+ setErrorCode(tOp);
+ return -1;
+ }
+ // first non-existent part
+ DBG("deletePartsUnknown [out] count=" << count);
+ return 0;
+ }
+ n++;
+ count++;
+ }
+ bat *= 4;
+ if (bat > maxbat)
+ bat = maxbat;
+ }
+}
+
// pending ops
int
@@ -952,8 +1010,10 @@ NdbBlob::executePendingBlobReads()
{
Uint8 flags = (1 << NdbOperation::ReadRequest);
if (thePendingBlobOps & flags) {
+ DBG("executePendingBlobReads: executeNoBlobs [in]");
if (theNdbCon->executeNoBlobs(NoCommit) == -1)
return -1;
+ DBG("executePendingBlobReads: executeNoBlobs [out]");
thePendingBlobOps = 0;
theNdbCon->thePendingBlobOps = 0;
}
@@ -965,8 +1025,10 @@ NdbBlob::executePendingBlobWrites()
{
Uint8 flags = 0xFF & ~(1 << NdbOperation::ReadRequest);
if (thePendingBlobOps & flags) {
+ DBG("executePendingBlobWrites: executeNoBlobs [in]");
if (theNdbCon->executeNoBlobs(NoCommit) == -1)
return -1;
+ DBG("executePendingBlobWrites: executeNoBlobs [out]");
thePendingBlobOps = 0;
theNdbCon->thePendingBlobOps = 0;
}
@@ -978,10 +1040,10 @@ NdbBlob::executePendingBlobWrites()
int
NdbBlob::invokeActiveHook()
{
- DBG("invokeActiveHook");
+ DBG("invokeActiveHook [in]");
assert(theState == Active && theActiveHook != NULL);
int ret = (*theActiveHook)(this, theActiveHookArg);
- DBG("invokeActiveHook ret=" << ret);
+ DBG("invokeActiveHook [out] ret=" << ret);
if (ret != 0) {
// no error is set on blob level
return -1;
@@ -1007,7 +1069,7 @@ NdbBlob::atPrepare(NdbConnection* aCon, NdbOperation* anOp, const NdbColumnImpl*
theTable = anOp->m_currentTable;
theAccessTable = anOp->m_accessTable;
theColumn = aColumn;
- DBG("atPrepare");
+ DBG("atPrepare [in]");
NdbDictionary::Column::Type partType = NdbDictionary::Column::Undefined;
switch (theColumn->getType()) {
case NdbDictionary::Column::Blob:
@@ -1046,6 +1108,7 @@ NdbBlob::atPrepare(NdbConnection* aCon, NdbOperation* anOp, const NdbColumnImpl*
theKeyBuf.alloc(theTable->m_sizeOfKeysInWords << 2);
theAccessKeyBuf.alloc(theAccessTable->m_sizeOfKeysInWords << 2);
theHeadInlineBuf.alloc(sizeof(Head) + theInlineSize);
+ theHeadInlineCopyBuf.alloc(sizeof(Head) + theInlineSize);
thePartBuf.alloc(thePartSize);
theHead = (Head*)theHeadInlineBuf.data;
theInlineData = theHeadInlineBuf.data + sizeof(Head);
@@ -1080,6 +1143,12 @@ NdbBlob::atPrepare(NdbConnection* aCon, NdbOperation* anOp, const NdbColumnImpl*
theNullFlag = true;
theLength = 0;
}
+ if (isWriteOp()) {
+ // becomes NULL unless set before execute
+ theNullFlag = true;
+ theLength = 0;
+ theHeadInlineUpdateFlag = true;
+ }
supportedOp = true;
}
if (isScanOp()) {
@@ -1093,19 +1162,21 @@ NdbBlob::atPrepare(NdbConnection* aCon, NdbOperation* anOp, const NdbColumnImpl*
return -1;
}
setState(Prepared);
- DBG("atPrepare out");
+ DBG("atPrepare [out]");
return 0;
}
/*
* Before execute of prepared operation. May add new operations before
* this one. May ask that this operation and all before it (a "batch")
- * is executed immediately in no-commit mode.
+ * is executed immediately in no-commit mode. In this case remaining
+ * prepared operations are saved in a separate list. They are added
+ * back after postExecute.
*/
int
NdbBlob::preExecute(ExecType anExecType, bool& batch)
{
- DBG("preExecute");
+ DBG("preExecute [in]");
if (theState == Invalid)
return -1;
assert(theState == Prepared);
@@ -1120,11 +1191,11 @@ NdbBlob::preExecute(ExecType anExecType, bool& batch)
if (isInsertOp()) {
if (theSetFlag && theGetSetBytes > theInlineSize) {
// add ops to write rest of a setValue
- assert(theSetBuf != 0);
- Uint64 pos = theInlineSize;
+ assert(theSetBuf != NULL);
const char* buf = theSetBuf + theInlineSize;
Uint32 bytes = theGetSetBytes - theInlineSize;
- if (writeDataPrivate(pos, buf, bytes) == -1)
+ assert(thePos == theInlineSize);
+ if (writeDataPrivate(buf, bytes) == -1)
return -1;
if (theHeadInlineUpdateFlag) {
// add an operation to update head+inline
@@ -1136,11 +1207,12 @@ NdbBlob::preExecute(ExecType anExecType, bool& batch)
setErrorCode(ErrAbort);
return -1;
}
+ DBG("add op to update head+inline");
}
}
}
if (isTableOp()) {
- if (isUpdateOp() || isDeleteOp()) {
+ if (isUpdateOp() || isWriteOp() || isDeleteOp()) {
// add operation before this one to read head+inline
NdbOperation* tOp = theNdbCon->getNdbOperation(theTable, theNdbOp);
if (tOp == NULL ||
@@ -1150,8 +1222,13 @@ NdbBlob::preExecute(ExecType anExecType, bool& batch)
setErrorCode(tOp);
return -1;
}
+ if (isWriteOp()) {
+ tOp->m_abortOption = IgnoreError;
+ }
+ theHeadInlineReadOp = tOp;
// execute immediately
batch = true;
+ DBG("add op before to read head+inline");
}
}
if (isIndexOp()) {
@@ -1170,7 +1247,7 @@ NdbBlob::preExecute(ExecType anExecType, bool& batch)
return -1;
}
} else {
- NdbOperation* tOp = theNdbCon->getNdbIndexOperation(theAccessTable->m_index, theTable, theNdbOp);
+ NdbIndexOperation* tOp = theNdbCon->getNdbIndexOperation(theAccessTable->m_index, theTable, theNdbOp);
if (tOp == NULL ||
tOp->readTuple() == -1 ||
setAccessKeyValue(tOp) == -1 ||
@@ -1180,6 +1257,7 @@ NdbBlob::preExecute(ExecType anExecType, bool& batch)
}
}
}
+ DBG("added op before to read table key");
if (isUpdateOp() || isDeleteOp()) {
// add op before this one to read head+inline via index
NdbIndexOperation* tOp = theNdbCon->getNdbIndexOperation(theAccessTable->m_index, theTable, theNdbOp);
@@ -1190,15 +1268,43 @@ NdbBlob::preExecute(ExecType anExecType, bool& batch)
setErrorCode(tOp);
return -1;
}
+ if (isWriteOp()) {
+ tOp->m_abortOption = IgnoreError;
+ }
+ theHeadInlineReadOp = tOp;
// execute immediately
batch = true;
+ DBG("added index op before to read head+inline");
+ }
+ if (isWriteOp()) {
+ // XXX until IgnoreError fixed for index op
+ batch = true;
+ }
+ }
+ if (isWriteOp()) {
+ if (theSetFlag) {
+ // write head+inline now
+ theNullFlag = true;
+ theLength = 0;
+ if (theSetBuf != NULL) {
+ Uint32 n = theGetSetBytes;
+ if (n > theInlineSize)
+ n = theInlineSize;
+ assert(thePos == 0);
+ if (writeDataPrivate(theSetBuf, n) == -1)
+ return -1;
+ }
+ if (setHeadInlineValue(theNdbOp) == -1)
+ return -1;
+ // the read op before us may overwrite
+ theHeadInlineCopyBuf.copyfrom(theHeadInlineBuf);
}
}
if (theActiveHook != NULL) {
// need blob head for callback
batch = true;
}
- DBG("preExecute out batch=" << batch);
+ DBG("preExecute [out] batch=" << batch);
return 0;
}
@@ -1211,15 +1317,16 @@ NdbBlob::preExecute(ExecType anExecType, bool& batch)
int
NdbBlob::postExecute(ExecType anExecType)
{
- DBG("postExecute type=" << anExecType);
+ DBG("postExecute [in] type=" << anExecType);
if (theState == Invalid)
return -1;
if (theState == Active) {
setState(anExecType == NoCommit ? Active : Closed);
- DBG("postExecute skip");
+ DBG("postExecute [skip]");
return 0;
}
assert(theState == Prepared);
+ setState(anExecType == NoCommit ? Active : Closed);
assert(isKeyOp());
if (isIndexOp()) {
NdbBlob* tFirstBlob = theNdbOp->theBlobList;
@@ -1231,22 +1338,13 @@ NdbBlob::postExecute(ExecType anExecType)
}
if (isReadOp()) {
getHeadFromRecAttr();
- if (theGetFlag && theGetSetBytes > 0) {
- // copy inline bytes to user buffer
- assert(theGetBuf != NULL);
- unsigned n = theGetSetBytes;
- if (n > theInlineSize)
- n = theInlineSize;
- memcpy(theGetBuf, theInlineData, n);
- }
- if (theGetFlag && theGetSetBytes > theInlineSize) {
- // add ops to read rest of a getValue
- assert(anExecType == NoCommit);
- assert(theGetBuf != 0);
- Uint64 pos = theInlineSize;
- char* buf = theGetBuf + theInlineSize;
- Uint32 bytes = theGetSetBytes - theInlineSize;
- if (readDataPrivate(pos, buf, bytes) == -1)
+ if (setPos(0) == -1)
+ return -1;
+ if (theGetFlag) {
+ assert(theGetSetBytes == 0 || theGetBuf != 0);
+ assert(theGetSetBytes <= theInlineSize || anExecType == NoCommit);
+ Uint32 bytes = theGetSetBytes;
+ if (readDataPrivate(theGetBuf, bytes) == -1)
return -1;
}
}
@@ -1255,10 +1353,11 @@ NdbBlob::postExecute(ExecType anExecType)
getHeadFromRecAttr();
if (theSetFlag) {
// setValue overwrites everything
- if (theSetBuf != 0) {
+ if (theSetBuf != NULL) {
if (truncate(0) == -1)
return -1;
- if (writeDataPrivate(0, theSetBuf, theGetSetBytes) == -1)
+ assert(thePos == 0);
+ if (writeDataPrivate(theSetBuf, theGetSetBytes) == -1)
return -1;
} else {
if (setNull() == -1)
@@ -1266,6 +1365,57 @@ NdbBlob::postExecute(ExecType anExecType)
}
}
}
+ if (isWriteOp() && isTableOp()) {
+ assert(anExecType == NoCommit);
+ if (theHeadInlineReadOp->theError.code == 0) {
+ int tNullFlag = theNullFlag;
+ Uint64 tLength = theLength;
+ Uint64 tPos = thePos;
+ getHeadFromRecAttr();
+ DBG("tuple found");
+ if (truncate(0) == -1)
+ return -1;
+ // restore previous head+inline
+ theHeadInlineBuf.copyfrom(theHeadInlineCopyBuf);
+ theNullFlag = tNullFlag;
+ theLength = tLength;
+ thePos = tPos;
+ } else {
+ if (theHeadInlineReadOp->theError.code != 626) {
+ setErrorCode(theHeadInlineReadOp);
+ return -1;
+ }
+ DBG("tuple not found");
+ /*
+ * Read found no tuple but it is possible that a tuple was
+ * created after the read by another transaction. Delete all
+ * blob parts which may exist.
+ */
+ if (deletePartsUnknown(0) == -1)
+ return -1;
+ }
+ if (theSetFlag && theGetSetBytes > theInlineSize) {
+ assert(theSetBuf != NULL);
+ const char* buf = theSetBuf + theInlineSize;
+ Uint32 bytes = theGetSetBytes - theInlineSize;
+ assert(thePos == theInlineSize);
+ if (writeDataPrivate(buf, bytes) == -1)
+ return -1;
+ }
+ }
+ if (isWriteOp() && isIndexOp()) {
+ // XXX until IgnoreError fixed for index op
+ if (deletePartsUnknown(0) == -1)
+ return -1;
+ if (theSetFlag && theGetSetBytes > theInlineSize) {
+ assert(theSetBuf != NULL);
+ const char* buf = theSetBuf + theInlineSize;
+ Uint32 bytes = theGetSetBytes - theInlineSize;
+ assert(thePos == theInlineSize);
+ if (writeDataPrivate(buf, bytes) == -1)
+ return -1;
+ }
+ }
if (isDeleteOp()) {
assert(anExecType == NoCommit);
getHeadFromRecAttr();
@@ -1278,7 +1428,19 @@ NdbBlob::postExecute(ExecType anExecType)
if (invokeActiveHook() == -1)
return -1;
}
- DBG("postExecute out");
+ if (anExecType == NoCommit && theHeadInlineUpdateFlag) {
+ NdbOperation* tOp = theNdbCon->getNdbOperation(theTable);
+ if (tOp == NULL ||
+ tOp->updateTuple() == -1 ||
+ setTableKeyValue(tOp) == -1 ||
+ setHeadInlineValue(tOp) == -1) {
+ setErrorCode(ErrAbort);
+ return -1;
+ }
+ tOp->m_abortOption = AbortOnError;
+ DBG("added op to update head+inline");
+ }
+ DBG("postExecute [out]");
return 0;
}
@@ -1289,12 +1451,12 @@ NdbBlob::postExecute(ExecType anExecType)
int
NdbBlob::preCommit()
{
- DBG("preCommit");
+ DBG("preCommit [in]");
if (theState == Invalid)
return -1;
assert(theState == Active);
assert(isKeyOp());
- if (isInsertOp() || isUpdateOp()) {
+ if (isInsertOp() || isUpdateOp() || isWriteOp()) {
if (theHeadInlineUpdateFlag) {
// add an operation to update head+inline
NdbOperation* tOp = theNdbCon->getNdbOperation(theTable);
@@ -1305,9 +1467,11 @@ NdbBlob::preCommit()
setErrorCode(ErrAbort);
return -1;
}
+ tOp->m_abortOption = AbortOnError;
+ DBG("added op to update head+inline");
}
}
- DBG("preCommit out");
+ DBG("preCommit [out]");
return 0;
}
@@ -1317,13 +1481,10 @@ NdbBlob::preCommit()
int
NdbBlob::atNextResult()
{
- DBG("atNextResult");
+ DBG("atNextResult [in]");
if (theState == Invalid)
return -1;
assert(isScanOp());
- getHeadFromRecAttr();
- // reset position
- thePos = 0;
// get primary key
{ Uint32* data = (Uint32*)theKeyBuf.data;
unsigned size = theTable->m_sizeOfKeysInWords;
@@ -1332,26 +1493,14 @@ NdbBlob::atNextResult()
return -1;
}
}
- if (! theNullFlag) {
- if (theGetFlag && theGetSetBytes > 0) {
- // copy inline bytes to user buffer
- assert(theGetBuf != NULL);
- unsigned n = theGetSetBytes;
- if (n > theLength)
- n = theLength;
- if (n > theInlineSize)
- n = theInlineSize;
- memcpy(theGetBuf, theInlineData, n);
- }
- if (theGetFlag && theGetSetBytes > theInlineSize && theLength > theInlineSize) {
- // add ops to read rest of a getValue
- assert(theGetBuf != 0);
- Uint64 pos = theInlineSize;
- char* buf = theGetBuf + theInlineSize;
- Uint32 bytes = theGetSetBytes - theInlineSize;
- if (readDataPrivate(pos, buf, bytes) == -1)
- return -1;
- }
+ getHeadFromRecAttr();
+ if (setPos(0) == -1)
+ return -1;
+ if (theGetFlag) {
+ assert(theGetSetBytes == 0 || theGetBuf != 0);
+ Uint32 bytes = theGetSetBytes;
+ if (readDataPrivate(theGetBuf, bytes) == -1)
+ return -1;
}
setState(Active);
// activation callback
@@ -1359,7 +1508,7 @@ NdbBlob::atNextResult()
if (invokeActiveHook() == -1)
return -1;
}
- DBG("atNextResult out");
+ DBG("atNextResult [out]");
return 0;
}
@@ -1444,7 +1593,8 @@ operator<<(NdbOut& out, const NdbBlob& blob)
ndbout << dec << " n=" << blob.theNullFlag;;
ndbout << dec << " l=" << blob.theLength;
ndbout << dec << " p=" << blob.thePos;
- ndbout << dec << " u=" << (Uint32) blob.theHeadInlineUpdateFlag;
+ ndbout << dec << " u=" << (Uint32)blob.theHeadInlineUpdateFlag;
+ ndbout << dec << " g=" << (Uint32)blob.theGetSetBytes;
return out;
}
#endif
diff --git a/ndb/src/ndbapi/NdbConnection.cpp b/ndb/src/ndbapi/NdbConnection.cpp
index 1457792cf28..4f6468eb4ae 100644
--- a/ndb/src/ndbapi/NdbConnection.cpp
+++ b/ndb/src/ndbapi/NdbConnection.cpp
@@ -170,12 +170,14 @@ Remark: Sets an error code on the connection object from an
operation object.
*****************************************************************************/
void
-NdbConnection::setOperationErrorCodeAbort(int error)
+NdbConnection::setOperationErrorCodeAbort(int error, int abortOption)
{
DBUG_ENTER("NdbConnection::setOperationErrorCodeAbort");
+ if (abortOption == -1)
+ abortOption = m_abortOption;
if (theTransactionIsStarted == false) {
theCommitStatus = Aborted;
- } else if ((m_abortOption == AbortOnError) &&
+ } else if ((abortOption == AbortOnError) &&
(theCommitStatus != Committed) &&
(theCommitStatus != Aborted)) {
theCommitStatus = NeedAbort;
@@ -335,8 +337,16 @@ NdbConnection::execute(ExecType aTypeOfExec,
tOp = tOp->next();
}
}
+
if (executeNoBlobs(tExecType, abortOption, forceSend) == -1)
ret = -1;
+#ifndef VM_TRACE
+ // can happen in complex abort cases
+ theFirstOpInList = theLastOpInList = NULL;
+#else
+ assert(theFirstOpInList == NULL && theLastOpInList == NULL);
+#endif
+
{
NdbOperation* tOp = theCompletedFirstOp;
while (tOp != NULL) {
@@ -360,6 +370,7 @@ NdbConnection::execute(ExecType aTypeOfExec,
theLastOpInList->next(tRestOp);
theLastOpInList = tLastOp;
}
+ assert(theFirstOpInList == NULL || tExecType == NoCommit);
} while (theFirstOpInList != NULL || tExecType != aTypeOfExec);
DBUG_RETURN(ret);
@@ -1806,11 +1817,12 @@ Parameters: aErrorCode: The error code.
Remark: An operation was completed with failure.
*******************************************************************************/
int
-NdbConnection::OpCompleteFailure(Uint8 abortOption)
+NdbConnection::OpCompleteFailure(Uint8 abortOption, bool setFailure)
{
Uint32 tNoComp = theNoOfOpCompleted;
Uint32 tNoSent = theNoOfOpSent;
- theCompletionStatus = NdbConnection::CompletedFailure;
+ if (setFailure)
+ theCompletionStatus = NdbConnection::CompletedFailure;
tNoComp++;
theNoOfOpCompleted = tNoComp;
if (tNoComp == tNoSent) {
diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.cpp b/ndb/src/ndbapi/NdbDictionaryImpl.cpp
index cf51a30fe0b..304d1b904d4 100644
--- a/ndb/src/ndbapi/NdbDictionaryImpl.cpp
+++ b/ndb/src/ndbapi/NdbDictionaryImpl.cpp
@@ -47,13 +47,13 @@
* Column
*/
NdbColumnImpl::NdbColumnImpl()
- : NdbDictionary::Column(* this), m_facade(this)
+ : NdbDictionary::Column(* this), m_attrId(-1), m_facade(this)
{
init();
}
NdbColumnImpl::NdbColumnImpl(NdbDictionary::Column & f)
- : NdbDictionary::Column(* this), m_facade(&f)
+ : NdbDictionary::Column(* this), m_attrId(-1), m_facade(&f)
{
init();
}
@@ -93,8 +93,7 @@ NdbColumnImpl::init(Type t)
{
// do not use default_charset_info as it may not be initialized yet
// use binary collation until NDB tests can handle charsets
- CHARSET_INFO* default_cs = &my_charset_latin1_bin;
- m_attrId = -1;
+ CHARSET_INFO* default_cs = &my_charset_bin;
m_type = t;
switch (m_type) {
case Tinyint:
diff --git a/ndb/src/ndbapi/NdbIndexOperation.cpp b/ndb/src/ndbapi/NdbIndexOperation.cpp
index 9abde639914..3f174a61b64 100644
--- a/ndb/src/ndbapi/NdbIndexOperation.cpp
+++ b/ndb/src/ndbapi/NdbIndexOperation.cpp
@@ -71,6 +71,7 @@ NdbIndexOperation::indxInit(const NdbIndexImpl * anIndex,
return -1;
}
m_theIndex = anIndex;
+ m_thePrimaryTable = aTable;
m_accessTable = anIndex->m_table;
m_theIndexLen = 0;
m_theNoOfIndexDefined = 0;
@@ -102,6 +103,12 @@ int NdbIndexOperation::readTuple(NdbOperation::LockMode lm)
};
}
+int NdbIndexOperation::insertTuple()
+{
+ setErrorCode(4200);
+ return -1;
+}
+
int NdbIndexOperation::readTuple()
{
// First check that index is unique
@@ -341,12 +348,11 @@ int NdbIndexOperation::equal_impl(const NdbColumnImpl* tAttrInfo,
theDistrGroupIndicator = 1;
}//if
/**************************************************************************
- * If the operation is an insert request and the attribute is stored then
+ * If the operation is a write request and the attribute is stored then
* we also set the value in the stored part through putting the
* information in the INDXATTRINFO signals.
*************************************************************************/
- if ((tOpType == InsertRequest) ||
- (tOpType == WriteRequest)) {
+ if ((tOpType == WriteRequest)) {
if (!tAttrInfo->m_indexOnly){
// invalid data can crash kernel
if (cs != NULL &&
@@ -357,7 +363,13 @@ int NdbIndexOperation::equal_impl(const NdbColumnImpl* tAttrInfo,
goto equal_error4;
Uint32 ahValue;
Uint32 sz = totalSizeInWords;
- AttributeHeader::init(&ahValue, tAttrId, sz);
+ /*
+ * XXX should be linked in metadata but cannot now because
+ * things can be defined in arbitrary order
+ */
+ const NdbColumnImpl* primaryCol = m_thePrimaryTable->getColumn(tAttrInfo->m_name.c_str());
+ assert(primaryCol != NULL);
+ AttributeHeader::init(&ahValue, primaryCol->m_attrId, sz);
insertATTRINFO( ahValue );
insertATTRINFOloop((Uint32*)aValueToWrite, sizeInWords);
if (bitsInLastWord != 0) {
@@ -369,7 +381,6 @@ int NdbIndexOperation::equal_impl(const NdbColumnImpl* tAttrInfo,
}//if
}//if
}//if
-
/**************************************************************************
* Store the Key information in the TCINDXREQ and INDXKEYINFO signals.
*************************************************************************/
@@ -734,13 +745,10 @@ NdbIndexOperation::receiveTCINDXREF( NdbApiSignal* aSignal)
}//if
theStatus = Finished;
-
+
theNdbCon->theReturnStatus = NdbConnection::ReturnFailure;
Uint32 errorCode = tcIndxRef->errorCode;
theError.code = errorCode;
theNdbCon->setOperationErrorCodeAbort(errorCode);
return theNdbCon->OpCompleteFailure(theNdbCon->m_abortOption);
}//NdbIndexOperation::receiveTCINDXREF()
-
-
-
diff --git a/ndb/src/ndbapi/NdbOperation.cpp b/ndb/src/ndbapi/NdbOperation.cpp
index b0b95d0ff43..88d8a000d50 100644
--- a/ndb/src/ndbapi/NdbOperation.cpp
+++ b/ndb/src/ndbapi/NdbOperation.cpp
@@ -78,7 +78,8 @@ NdbOperation::NdbOperation(Ndb* aNdb) :
m_tcReqGSN(GSN_TCKEYREQ),
m_keyInfoGSN(GSN_KEYINFO),
m_attrInfoGSN(GSN_ATTRINFO),
- theBlobList(NULL)
+ theBlobList(NULL),
+ m_abortOption(-1)
{
theReceiver.init(NdbReceiver::NDB_OPERATION, this);
theError.code = 0;
@@ -167,6 +168,7 @@ NdbOperation::init(const NdbTableImpl* tab, NdbConnection* myConnection){
theTotalNrOfKeyWordInSignal = 8;
theMagicNumber = 0xABCDEF01;
theBlobList = NULL;
+ m_abortOption = -1;
tSignal = theNdb->getSignal();
if (tSignal == NULL)
diff --git a/ndb/src/ndbapi/NdbOperationExec.cpp b/ndb/src/ndbapi/NdbOperationExec.cpp
index f1338ae01e4..13664794dcd 100644
--- a/ndb/src/ndbapi/NdbOperationExec.cpp
+++ b/ndb/src/ndbapi/NdbOperationExec.cpp
@@ -191,7 +191,8 @@ NdbOperation::prepareSend(Uint32 aTC_ConnectPtr, Uint64 aTransId)
Uint8 tDirtyIndicator = theDirtyIndicator;
OperationType tOperationType = theOperationType;
Uint32 tTupKeyLen = theTupKeyLen;
- Uint8 abortOption = theNdbCon->m_abortOption;
+ Uint8 abortOption =
+ m_abortOption != (Int8)-1 ? m_abortOption : theNdbCon->m_abortOption;
tcKeyReq->setDirtyFlag(tReqInfo, tDirtyIndicator);
tcKeyReq->setOperationType(tReqInfo, tOperationType);
@@ -541,17 +542,20 @@ NdbOperation::receiveTCKEYREF( NdbApiSignal* aSignal)
return -1;
}//if
- AbortOption ao = (AbortOption)theNdbCon->m_abortOption;
+ AbortOption ao = (AbortOption)
+ (m_abortOption != (Int8)-1 ? m_abortOption : theNdbCon->m_abortOption);
theReceiver.m_received_result_length = ~0;
theStatus = Finished;
- theNdbCon->theReturnStatus = NdbConnection::ReturnFailure;
+ // blobs want this
+ if (m_abortOption != IgnoreError)
+ theNdbCon->theReturnStatus = NdbConnection::ReturnFailure;
theError.code = aSignal->readData(4);
- theNdbCon->setOperationErrorCodeAbort(aSignal->readData(4));
+ theNdbCon->setOperationErrorCodeAbort(aSignal->readData(4), m_abortOption);
if(theOperationType != ReadRequest || !theSimpleIndicator) // not simple read
- return theNdbCon->OpCompleteFailure(ao);
+ return theNdbCon->OpCompleteFailure(ao, m_abortOption != IgnoreError);
/**
* If TCKEYCONF has arrived
diff --git a/ndb/src/ndbapi/NdbScanOperation.cpp b/ndb/src/ndbapi/NdbScanOperation.cpp
index fd63ce96f25..86bac7deb16 100644
--- a/ndb/src/ndbapi/NdbScanOperation.cpp
+++ b/ndb/src/ndbapi/NdbScanOperation.cpp
@@ -612,7 +612,7 @@ NdbScanOperation::send_next_scan(Uint32 cnt, bool stopScanFlag){
LinearSectionPtr ptr[3];
ptr[0].p = prep_array;
ptr[0].sz = cnt;
- ret = tp->sendFragmentedSignal(&tSignal, nodeId, ptr, 1);
+ ret = tp->sendSignal(&tSignal, nodeId, ptr, 1);
} else {
tSignal.setLength(4+cnt);
ret = tp->sendSignal(&tSignal, nodeId);
@@ -803,7 +803,7 @@ NdbScanOperation::doSendScan(int aProcessorId)
LinearSectionPtr ptr[3];
ptr[0].p = m_prepared_receivers;
ptr[0].sz = theParallelism;
- if (tp->sendFragmentedSignal(tSignal, aProcessorId, ptr, 1) == -1) {
+ if (tp->sendSignal(tSignal, aProcessorId, ptr, 1) == -1) {
setErrorCode(4002);
return -1;
}
diff --git a/ndb/src/ndbapi/TransporterFacade.cpp b/ndb/src/ndbapi/TransporterFacade.cpp
index bc24110ea14..dfb090c8416 100644
--- a/ndb/src/ndbapi/TransporterFacade.cpp
+++ b/ndb/src/ndbapi/TransporterFacade.cpp
@@ -34,6 +34,7 @@
#include <NdbConfig.h>
#include <ndb_version.h>
#include <SignalLoggerManager.hpp>
+#include <kernel/ndb_limits.h>
//#define REPORT_TRANSPORTER
//#define API_TRACE;
@@ -475,7 +476,8 @@ TransporterFacade::TransporterFacade() :
theTransporterRegistry(0),
theStopReceive(0),
theSendThread(NULL),
- theReceiveThread(NULL)
+ theReceiveThread(NULL),
+ m_fragmented_signal_id(0)
{
theOwnId = 0;
@@ -833,9 +835,129 @@ TransporterFacade::sendSignalUnCond(NdbApiSignal * aSignal, NodeId aNode){
return (ss == SEND_OK ? 0 : -1);
}
+#define CHUNK_SZ NDB_SECTION_SEGMENT_SZ*64 // related to MAX_MESSAGE_SIZE
int
TransporterFacade::sendFragmentedSignal(NdbApiSignal* aSignal, NodeId aNode,
- LinearSectionPtr ptr[3], Uint32 secs){
+ LinearSectionPtr ptr[3], Uint32 secs)
+{
+ if(getIsNodeSendable(aNode) != true)
+ return -1;
+
+#ifdef API_TRACE
+ if(setSignalLog() && TRACE_GSN(aSignal->theVerId_signalNumber)){
+ Uint32 tmp = aSignal->theSendersBlockRef;
+ aSignal->theSendersBlockRef = numberToRef(tmp, theOwnId);
+ signalLogger.sendSignal(* aSignal,
+ 1,
+ aSignal->getDataPtrSend(),
+ aNode,
+ ptr, secs);
+ aSignal->theSendersBlockRef = tmp;
+ }
+#endif
+
+ NdbApiSignal tmp_signal(*(SignalHeader*)aSignal);
+ LinearSectionPtr tmp_ptr[3];
+ Uint32 unique_id= m_fragmented_signal_id++; // next unique id
+ unsigned i;
+ for (i= 0; i < secs; i++)
+ tmp_ptr[i]= ptr[i];
+
+ unsigned start_i= 0;
+ unsigned chunk_sz= 0;
+ unsigned fragment_info= 0;
+ Uint32 *tmp_data= tmp_signal.getDataPtrSend();
+ for (i= 0; i < secs;) {
+ unsigned save_sz= tmp_ptr[i].sz;
+ tmp_data[i-start_i]= i;
+ if (chunk_sz + save_sz > CHUNK_SZ) {
+ // truncate
+ unsigned send_sz= CHUNK_SZ - chunk_sz;
+ if (i != start_i) // first piece of a new section has to be a multiple of NDB_SECTION_SEGMENT_SZ
+ {
+ send_sz=
+ NDB_SECTION_SEGMENT_SZ
+ *(send_sz+NDB_SECTION_SEGMENT_SZ-1)
+ /NDB_SECTION_SEGMENT_SZ;
+ if (send_sz > save_sz)
+ send_sz= save_sz;
+ }
+ tmp_ptr[i].sz= send_sz;
+
+ if (fragment_info < 2) // 1 = first fragment, 2 = middle fragments
+ fragment_info++;
+
+ // send tmp_signal
+ tmp_data[i-start_i+1]= unique_id;
+ tmp_signal.setLength(i-start_i+2);
+ tmp_signal.m_fragmentInfo= fragment_info;
+ tmp_signal.m_noOfSections= i-start_i+1;
+ // do prepare send
+ {
+ SendStatus ss = theTransporterRegistry->prepareSend
+ (&tmp_signal,
+ 1, /*JBB*/
+ tmp_data,
+ aNode,
+ &tmp_ptr[start_i]);
+ assert(ss != SEND_MESSAGE_TOO_BIG);
+ if (ss != SEND_OK) return -1;
+ }
+ // setup variables for next signal
+ start_i= i;
+ chunk_sz= 0;
+ tmp_ptr[i].sz= save_sz-send_sz;
+ tmp_ptr[i].p+= send_sz;
+ if (tmp_ptr[i].sz == 0)
+ i++;
+ }
+ else
+ {
+ chunk_sz+=save_sz;
+ i++;
+ }
+ }
+
+ unsigned a_sz= aSignal->getLength();
+
+ if (fragment_info > 0) {
+ // update the original signal to include section info
+ Uint32 *a_data= aSignal->getDataPtrSend();
+ unsigned tmp_sz= i-start_i;
+ memcpy(a_data+a_sz,
+ tmp_data,
+ tmp_sz*sizeof(Uint32));
+ a_data[a_sz+tmp_sz]= unique_id;
+ aSignal->setLength(a_sz+tmp_sz+1);
+
+ // send last fragment
+ aSignal->m_fragmentInfo= 3; // 3 = last fragment
+ aSignal->m_noOfSections= i-start_i;
+ } else {
+ aSignal->m_noOfSections= secs;
+ }
+
+ // send aSignal
+ int ret;
+ {
+ SendStatus ss = theTransporterRegistry->prepareSend
+ (aSignal,
+ 1/*JBB*/,
+ aSignal->getDataPtrSend(),
+ aNode,
+ &tmp_ptr[start_i]);
+ assert(ss != SEND_MESSAGE_TOO_BIG);
+ ret = (ss == SEND_OK ? 0 : -1);
+ }
+ aSignal->m_noOfSections = 0;
+ aSignal->m_fragmentInfo = 0;
+ aSignal->setLength(a_sz);
+ return ret;
+}
+
+int
+TransporterFacade::sendSignal(NdbApiSignal* aSignal, NodeId aNode,
+ LinearSectionPtr ptr[3], Uint32 secs){
aSignal->m_noOfSections = secs;
if(getIsNodeSendable(aNode) == true){
#ifdef API_TRACE
@@ -865,39 +987,6 @@ TransporterFacade::sendFragmentedSignal(NdbApiSignal* aSignal, NodeId aNode,
return -1;
}
-
-
-int
-TransporterFacade::sendFragmentedSignalUnCond(NdbApiSignal* aSignal,
- NodeId aNode,
- LinearSectionPtr ptr[3],
- Uint32 secs){
- aSignal->m_noOfSections = secs;
-
-#ifdef API_TRACE
- if(setSignalLog() && TRACE_GSN(aSignal->theVerId_signalNumber)){
- Uint32 tmp = aSignal->theSendersBlockRef;
- aSignal->theSendersBlockRef = numberToRef(tmp, theOwnId);
- signalLogger.sendSignal(* aSignal,
- 1,
- aSignal->getDataPtrSend(),
- aNode,
- ptr, secs);
- aSignal->theSendersBlockRef = tmp;
- }
-#endif
- SendStatus ss = theTransporterRegistry->prepareSend(aSignal,
- 1, // JBB
- aSignal->getDataPtrSend(),
- aNode,
- ptr);
- assert(ss != SEND_MESSAGE_TOO_BIG);
- aSignal->m_noOfSections = 0;
- return (ss == SEND_OK ? 0 : -1);
-}
-
-
-
/******************************************************************************
* CONNECTION METHODS Etc
******************************************************************************/
diff --git a/ndb/src/ndbapi/TransporterFacade.hpp b/ndb/src/ndbapi/TransporterFacade.hpp
index 5f473975585..5680e3a6f03 100644
--- a/ndb/src/ndbapi/TransporterFacade.hpp
+++ b/ndb/src/ndbapi/TransporterFacade.hpp
@@ -69,14 +69,11 @@ public:
// Only sends to nodes which are alive
int sendSignal(NdbApiSignal * signal, NodeId nodeId);
+ int sendSignal(NdbApiSignal*, NodeId,
+ LinearSectionPtr ptr[3], Uint32 secs);
int sendFragmentedSignal(NdbApiSignal*, NodeId,
LinearSectionPtr ptr[3], Uint32 secs);
- //Dirrrrty
- int sendFragmentedSignalUnCond(NdbApiSignal*, NodeId,
- LinearSectionPtr ptr[3], Uint32 secs);
-
-
// Is node available for running transactions
bool get_node_alive(NodeId nodeId) const;
bool get_node_stopping(NodeId nodeId) const;
@@ -224,7 +221,8 @@ private:
} m_threads;
Uint32 m_max_trans_id;
-
+ Uint32 m_fragmented_signal_id;
+
/**
* execute function
*/
diff --git a/ndb/src/ndbapi/ndberror.c b/ndb/src/ndbapi/ndberror.c
index 20661b89517..17a80082023 100644
--- a/ndb/src/ndbapi/ndberror.c
+++ b/ndb/src/ndbapi/ndberror.c
@@ -150,7 +150,7 @@ ErrorBundle ErrorCodes[] = {
{ 623, IS, "623" },
{ 624, IS, "624" },
{ 625, IS, "Out of memory in Ndb Kernel, index part" },
- { 826, IS, "826" },
+ { 826, IS, "Too many tables and attributes (increase MaxNoOfAttributes)" },
{ 827, IS, "Out of memory in Ndb Kernel, data part" },
{ 832, IS, "832" },
diff --git a/ndb/include/util/getarg.h b/ndb/test/include/getarg.h
index 03ed25f6828..03ed25f6828 100644
--- a/ndb/include/util/getarg.h
+++ b/ndb/test/include/getarg.h
diff --git a/ndb/test/ndbapi/testBlobs.cpp b/ndb/test/ndbapi/testBlobs.cpp
index 41bb82f3e06..efa0811aa39 100644
--- a/ndb/test/ndbapi/testBlobs.cpp
+++ b/ndb/test/ndbapi/testBlobs.cpp
@@ -42,13 +42,14 @@ struct Opt {
bool m_core;
bool m_dbg;
bool m_dbgall;
+ const char* m_dbug;
bool m_full;
unsigned m_loop;
unsigned m_parts;
unsigned m_rows;
unsigned m_seed;
const char* m_skip;
- const char* m_style;
+ const char* m_test;
// metadata
const char* m_tname;
const char* m_x1name; // hash index
@@ -66,13 +67,14 @@ struct Opt {
m_core(false),
m_dbg(false),
m_dbgall(false),
+ m_dbug(0),
m_full(false),
m_loop(1),
m_parts(10),
m_rows(100),
m_seed(0),
- m_skip(""),
- m_style("012"),
+ m_skip(0),
+ m_test(0),
// metadata
m_tname("TBLOB1"),
m_x1name("TBLOB1X1"),
@@ -100,46 +102,46 @@ printusage()
<< " -core dump core on error" << endl
<< " -dbg print debug" << endl
<< " -dbgall print also NDB API debug (if compiled in)" << endl
+ << " -dbug opt dbug options" << endl
<< " -full read/write only full blob values" << endl
- << " -inline read/write only blobs which fit inline" << endl
<< " -loop N loop N times 0=forever [" << d.m_loop << "]" << endl
<< " -parts N max parts in blob value [" << d.m_parts << "]" << endl
<< " -rows N number of rows [" << d.m_rows << "]" << endl
<< " -seed N random seed 0=loop number [" << d.m_seed << "]" << endl
- << " -skip xxx skip these tests (see list) [" << d.m_skip << endl
- << " -style xxx access styles to test (see list) [" << d.m_style << "]" << endl
+ << " -skip xxx skip given tests (see list) [no tests]" << endl
+ << " -test xxx only given tests (see list) [all tests]" << endl
<< "metadata" << endl
<< " -pk2len N length of PK2 [" << d.m_pk2len << "/" << g_max_pk2len <<"]" << endl
<< " -oneblob only 1 blob attribute [default 2]" << endl
- << "testcases for -skip" << endl
+ << "testcases for test/skip" << endl
<< " k primary key ops" << endl
<< " i hash index ops" << endl
<< " s table scans" << endl
<< " r ordered index scans" << endl
- << " u update blob value" << endl
- << "access styles for -style" << endl
+ << "additional flags for test/skip" << endl
+ << " u update existing blob value" << endl
+ << " n normal insert and update" << endl
+ << " w insert and update using writeTuple" << endl
<< " 0 getValue / setValue" << endl
<< " 1 setActiveHook" << endl
<< " 2 readData / writeData" << endl
<< "bug tests (no blob test)" << endl
<< " -bug 4088 ndb api hang with mixed ops on index table" << endl
- << " -bug 2222 delete + write gives 626" << endl
- << " -bug 3333 acc crash on delete and long key" << endl
+ << " -bug nnnn delete + write gives 626" << endl
+ << " -bug nnnn acc crash on delete and long key" << endl
;
}
static Opt g_opt;
static bool
-skipcase(int x)
+testcase(char x)
{
- return strchr(g_opt.m_skip, x) != 0;
-}
-
-static bool
-skipstyle(int x)
-{
- return strchr(g_opt.m_style, '0' + x) == 0;
+ if (x < 10)
+ x += '0';
+ return
+ (g_opt.m_test == 0 || strchr(g_opt.m_test, x) != 0) &&
+ (g_opt.m_skip == 0 || strchr(g_opt.m_skip, x) == 0);
}
static Ndb* g_ndb = 0;
@@ -435,7 +437,9 @@ getBlobLength(NdbBlob* h, unsigned& len)
CHK(h->getLength(len2) == 0);
len = (unsigned)len2;
assert(len == len2);
- DBG("getBlobLength " << h->getColumn()->getName() << " len=" << len);
+ bool isNull;
+ CHK(h->getNull(isNull) == 0);
+ DBG("getBlobLength " << h->getColumn()->getName() << " len=" << len << " null=" << isNull);
return 0;
}
@@ -912,6 +916,41 @@ updatePk(int style)
}
static int
+writePk(int style)
+{
+ DBG("--- writePk " << stylename[style] << " ---");
+ for (unsigned k = 0; k < g_opt.m_rows; k++) {
+ Tup& tup = g_tups[k];
+ DBG("writePk pk1=" << hex << tup.m_pk1);
+ CHK((g_con = g_ndb->startTransaction()) != 0);
+ CHK((g_opr = g_con->getNdbOperation(g_opt.m_tname)) != 0);
+ CHK(g_opr->writeTuple() == 0);
+ CHK(g_opr->equal("PK1", tup.m_pk1) == 0);
+ if (g_opt.m_pk2len != 0)
+ CHK(g_opr->equal("PK2", tup.m_pk2) == 0);
+ CHK(getBlobHandles(g_opr) == 0);
+ if (style == 0) {
+ CHK(setBlobValue(tup) == 0);
+ } else if (style == 1) {
+ // non-nullable must be set
+ CHK(g_bh1->setValue("", 0) == 0);
+ CHK(setBlobWriteHook(tup) == 0);
+ } else {
+ // non-nullable must be set
+ CHK(g_bh1->setValue("", 0) == 0);
+ CHK(g_con->execute(NoCommit) == 0);
+ CHK(writeBlobData(tup) == 0);
+ }
+ CHK(g_con->execute(Commit) == 0);
+ g_ndb->closeTransaction(g_con);
+ g_opr = 0;
+ g_con = 0;
+ tup.m_exists = true;
+ }
+ return 0;
+}
+
+static int
deletePk()
{
DBG("--- deletePk ---");
@@ -996,6 +1035,39 @@ updateIdx(int style)
}
static int
+writeIdx(int style)
+{
+ DBG("--- writeIdx " << stylename[style] << " ---");
+ for (unsigned k = 0; k < g_opt.m_rows; k++) {
+ Tup& tup = g_tups[k];
+ DBG("writeIdx pk1=" << hex << tup.m_pk1);
+ CHK((g_con = g_ndb->startTransaction()) != 0);
+ CHK((g_opx = g_con->getNdbIndexOperation(g_opt.m_x1name, g_opt.m_tname)) != 0);
+ CHK(g_opx->writeTuple() == 0);
+ CHK(g_opx->equal("PK2", tup.m_pk2) == 0);
+ CHK(getBlobHandles(g_opx) == 0);
+ if (style == 0) {
+ CHK(setBlobValue(tup) == 0);
+ } else if (style == 1) {
+ // non-nullable must be set
+ CHK(g_bh1->setValue("", 0) == 0);
+ CHK(setBlobWriteHook(tup) == 0);
+ } else {
+ // non-nullable must be set
+ CHK(g_bh1->setValue("", 0) == 0);
+ CHK(g_con->execute(NoCommit) == 0);
+ CHK(writeBlobData(tup) == 0);
+ }
+ CHK(g_con->execute(Commit) == 0);
+ g_ndb->closeTransaction(g_con);
+ g_opx = 0;
+ g_con = 0;
+ tup.m_exists = true;
+ }
+ return 0;
+}
+
+static int
deleteIdx()
{
DBG("--- deleteIdx ---");
@@ -1167,10 +1239,16 @@ deleteScan(bool idx)
// main
+// from here on print always
+#undef DBG
+#define DBG(x) \
+ do { \
+ ndbout << "line " << __LINE__ << " " << x << endl; \
+ } while (0)
+
static int
testmain()
{
- int style;
g_ndb = new Ndb("TEST_DB");
CHK(g_ndb->init() == 0);
CHK(g_ndb->waitUntilReady() == 0);
@@ -1194,55 +1272,88 @@ testmain()
if (g_opt.m_seed != 0)
srandom(g_opt.m_seed);
for (g_loop = 0; g_opt.m_loop == 0 || g_loop < g_opt.m_loop; g_loop++) {
+ int style;
DBG("=== loop " << g_loop << " ===");
if (g_opt.m_seed == 0)
srandom(g_loop);
// pk
for (style = 0; style <= 2; style++) {
- if (skipcase('k') || skipstyle(style))
+ if (! testcase('k') || ! testcase(style))
continue;
DBG("--- pk ops " << stylename[style] << " ---");
- calcTups(false);
- CHK(insertPk(style) == 0);
- CHK(verifyBlob() == 0);
- CHK(readPk(style) == 0);
- if (! skipcase('u')) {
- calcTups(style);
- CHK(updatePk(style) == 0);
+ if (testcase('n')) {
+ calcTups(false);
+ CHK(insertPk(style) == 0);
+ CHK(verifyBlob() == 0);
+ CHK(readPk(style) == 0);
+ if (testcase('u')) {
+ calcTups(style);
+ CHK(updatePk(style) == 0);
+ CHK(verifyBlob() == 0);
+ CHK(readPk(style) == 0);
+ }
+ CHK(deletePk() == 0);
+ CHK(verifyBlob() == 0);
+ }
+ if (testcase('w')) {
+ calcTups(false);
+ CHK(writePk(style) == 0);
+ CHK(verifyBlob() == 0);
+ CHK(readPk(style) == 0);
+ if (testcase('u')) {
+ calcTups(style);
+ CHK(writePk(style) == 0);
+ CHK(verifyBlob() == 0);
+ CHK(readPk(style) == 0);
+ }
+ CHK(deletePk() == 0);
CHK(verifyBlob() == 0);
}
- CHK(readPk(style) == 0);
- CHK(deletePk() == 0);
- CHK(verifyBlob() == 0);
}
// hash index
for (style = 0; style <= 2; style++) {
- if (skipcase('i') || skipstyle(style))
+ if (! testcase('i') || ! testcase(style))
continue;
DBG("--- idx ops " << stylename[style] << " ---");
- calcTups(false);
- CHK(insertPk(style) == 0);
- CHK(verifyBlob() == 0);
- CHK(readIdx(style) == 0);
- calcTups(style);
- if (! skipcase('u')) {
- CHK(updateIdx(style) == 0);
+ if (testcase('n')) {
+ calcTups(false);
+ CHK(insertPk(style) == 0);
+ CHK(verifyBlob() == 0);
+ CHK(readIdx(style) == 0);
+ if (testcase('u')) {
+ calcTups(style);
+ CHK(updateIdx(style) == 0);
+ CHK(verifyBlob() == 0);
+ CHK(readIdx(style) == 0);
+ }
+ CHK(deleteIdx() == 0);
+ CHK(verifyBlob() == 0);
+ }
+ if (testcase('w')) {
+ calcTups(false);
+ CHK(writePk(style) == 0);
CHK(verifyBlob() == 0);
CHK(readIdx(style) == 0);
+ if (testcase('u')) {
+ calcTups(style);
+ CHK(writeIdx(style) == 0);
+ CHK(verifyBlob() == 0);
+ CHK(readIdx(style) == 0);
+ }
+ CHK(deleteIdx() == 0);
+ CHK(verifyBlob() == 0);
}
- CHK(deleteIdx() == 0);
- CHK(verifyBlob() == 0);
}
// scan table
for (style = 0; style <= 2; style++) {
- if (skipcase('s') || skipstyle(style))
+ if (! testcase('s') || ! testcase(style))
continue;
DBG("--- table scan " << stylename[style] << " ---");
calcTups(false);
CHK(insertPk(style) == 0);
CHK(verifyBlob() == 0);
CHK(readScan(style, false) == 0);
- if (! skipcase('u')) {
+ if (testcase('u')) {
CHK(updateScan(style, false) == 0);
CHK(verifyBlob() == 0);
}
@@ -1251,14 +1362,14 @@ testmain()
}
// scan index
for (style = 0; style <= 2; style++) {
- if (skipcase('r') || skipstyle(style))
+ if (! testcase('r') || ! testcase(style))
continue;
DBG("--- index scan " << stylename[style] << " ---");
calcTups(false);
CHK(insertPk(style) == 0);
CHK(verifyBlob() == 0);
CHK(readScan(style, true) == 0);
- if (! skipcase('u')) {
+ if (testcase('u')) {
CHK(updateScan(style, true) == 0);
CHK(verifyBlob() == 0);
}
@@ -1331,9 +1442,7 @@ static struct {
int m_bug;
int (*m_test)();
} g_bugtest[] = {
- { 4088, bugtest_4088 },
- { 2222, bugtest_2222 },
- { 3333, bugtest_3333 }
+ { 4088, bugtest_4088 }
};
NDB_COMMAND(testOdbcDriver, "testBlobs", "testBlobs", "testBlobs", 65535)
@@ -1361,6 +1470,12 @@ NDB_COMMAND(testOdbcDriver, "testBlobs", "testBlobs", "testBlobs", 65535)
putenv(strdup("NDB_BLOB_DEBUG=1"));
continue;
}
+ if (strcmp(arg, "-dbug") == 0) {
+ if (++argv, --argc > 0) {
+ g_opt.m_dbug = strdup(argv[0]);
+ continue;
+ }
+ }
if (strcmp(arg, "-full") == 0) {
g_opt.m_full = true;
continue;
@@ -1395,9 +1510,9 @@ NDB_COMMAND(testOdbcDriver, "testBlobs", "testBlobs", "testBlobs", 65535)
continue;
}
}
- if (strcmp(arg, "-style") == 0) {
+ if (strcmp(arg, "-test") == 0) {
if (++argv, --argc > 0) {
- g_opt.m_style = strdup(argv[0]);
+ g_opt.m_test = strdup(argv[0]);
continue;
}
}
@@ -1431,9 +1546,14 @@ NDB_COMMAND(testOdbcDriver, "testBlobs", "testBlobs", "testBlobs", 65535)
printusage();
return NDBT_ProgramExit(NDBT_WRONGARGS);
}
+ if (g_opt.m_dbug != 0) {
+ DBUG_PUSH(g_opt.m_dbug);
+ }
if (g_opt.m_pk2len == 0) {
char b[100];
- strcpy(b, g_opt.m_skip);
+ b[0] = 0;
+ if (g_opt.m_skip != 0)
+ strcpy(b, g_opt.m_skip);
strcat(b, "i");
strcat(b, "r");
g_opt.m_skip = strdup(b);
diff --git a/ndb/test/odbc/tpcb/Makefile b/ndb/test/odbc/tpcb/Makefile
deleted file mode 100644
index 8ab429c8ea1..00000000000
--- a/ndb/test/odbc/tpcb/Makefile
+++ /dev/null
@@ -1,30 +0,0 @@
-include .defs.mk
-
-TYPE = *
-
-BIN_TARGET = tpcb
-
-SOURCES = ttTime.c tpcb.cpp
-
-CCFLAGS_LOC += \
- -I$(NDB_TOP)/include \
- -I$(NDB_TOP)/include/ndbapi \
- -I$(NDB_TOP)/include/portlib \
- -I$(NDB_TOP)/include/util \
- -I$(NDB_TOP)/test/include \
- -I/usr/local/include
-
-CCFLAGS_WARNINGS += -Wno-unused -Wno-sign-compare -Wformat
-
-CCFLAGS_TOP += -DndbODBC
-
-BIN_TARGET_LIBS = NDB_API_pic NDB_ODBC_pic NDBT
-
-ifeq ($(NDB_OS),SOLARIS)
-BIN_TARGET_LIBS += dmallocthcxx
-CCFLAGS_TOP += -DDMALLOC
-endif
-
-include $(NDB_TOP)/Epilogue.mk
-
-$(BIN_DIR)$(BIN_TARGET): Makefile
diff --git a/ndb/test/odbc/tpcb/Makefile_mysql b/ndb/test/odbc/tpcb/Makefile_mysql
deleted file mode 100644
index 4e1b9a25fe2..00000000000
--- a/ndb/test/odbc/tpcb/Makefile_mysql
+++ /dev/null
@@ -1,33 +0,0 @@
-include $(NDB_TOP)/Defs.mk
-
-TYPE = odbcclient
-
-BIN_TARGET = tpcb
-
-SOURCES = ttTime.c tpcb.cpp
-
-CCFLAGS_LOC += -I/usr/local/include \
- -I$(NDB_TOP)/test/include \
- -I$(NDB_TOP)/include \
- -I$(NDB_TOP)/include/util \
- -I$(NDB_TOP)/src/client/odbc/common
-
-
-
-
-#CCFLAGS_WARNINGS += -Wno-unused
-
-LIBS_LOC += -L/usr/local/lib
-BIN_TARGET_LIBS_DIRS += /usr/local/lib
-BIN_TARGET_LIBS += odbc odbcinst
-
-#LIBS_SPEC += -pg
-# -lNDBT \
-# -lodbc \
-# -lodbcinst \
-# -lportlib
-
-
-
-include $(NDB_TOP)/Epilogue.mk
-
diff --git a/ndb/test/odbc/tpcb/Makefile_ndb b/ndb/test/odbc/tpcb/Makefile_ndb
deleted file mode 100644
index 85960413ef0..00000000000
--- a/ndb/test/odbc/tpcb/Makefile_ndb
+++ /dev/null
@@ -1,30 +0,0 @@
-include $(NDB_TOP)/Defs.mk
-
-TYPE = *
-
-BIN_TARGET = tpcb
-
-SOURCES = ttTime.c tpcb.cpp
-
-CCFLAGS_LOC += \
- -I$(NDB_TOP)/include \
- -I$(NDB_TOP)/include/ndbapi \
- -I$(NDB_TOP)/include/portlib \
- -I$(NDB_TOP)/include/util \
- -I$(NDB_TOP)/test/include \
- -I/usr/local/include
-
-CCFLAGS_WARNINGS += -Wno-unused -Wno-sign-compare -Wformat
-
-CCFLAGS_TOP += -DndbODBC
-
-BIN_TARGET_LIBS = NDB_API_pic NDB_ODBC_pic NDBT
-
-ifeq ($(NDB_OS),SOLARIS)
-BIN_TARGET_LIBS += dmallocthcxx
-CCFLAGS_TOP += -DDMALLOC
-endif
-
-include $(NDB_TOP)/Epilogue.mk
-
-$(BIN_DIR)$(BIN_TARGET): Makefile
diff --git a/ndb/test/odbc/tpcb/readme.txt b/ndb/test/odbc/tpcb/readme.txt
deleted file mode 100644
index 008cafb9d2f..00000000000
--- a/ndb/test/odbc/tpcb/readme.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-'tpcb' requires an .odbc.ini file in
-/etc/
-or in
-/home/user/
-
-The .odbc.ini file must contain a DSN entry called ndb:
-
-#--------- .odbc.ini example --------------------
-
-[ndb]
-Driver = /path_to_installation/lib/libNDB_ODBC.so
-
-#--------- End of example -----------------------
-
-
diff --git a/ndb/test/odbc/tpcb/timesten.h b/ndb/test/odbc/tpcb/timesten.h
deleted file mode 100644
index 45579f9d277..00000000000
--- a/ndb/test/odbc/tpcb/timesten.h
+++ /dev/null
@@ -1,188 +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 */
-
-/*
- * $Revision: 1.1 $
- * (c) Copyright 1997-2003, TimesTen, Inc.
- * All rights reserved.
- */
-
-#ifndef TIMESTEN_H_INCLUDED
-#define TIMESTEN_H_INCLUDED
-
-#ifdef _WIN32
-#include <windows.h>
-#endif
-
-#include <sql.h>
-#include <sqltypes.h>
-#include <sqlext.h>
-/*
- * TimesTen extension to application data types; only usable
- * when application directly linked to the TimesTen driver.
- */
-#define SQL_C_ADDR 100
-
-#ifndef SQL_C_SBIGINT
-#if (ODBCVER < 0x0300)
-#define SQL_C_SBIGINT (SQL_BIGINT+SQL_SIGNED_OFFSET)
-#define SQL_C_UBIGINT (SQL_BIGINT+SQL_UNSIGNED_OFFSET)
-#endif
-#endif
-
-#define SQL_C_BIGINT SQL_C_SBIGINT
-
-#if (ODBCVER < 0x0300)
-#ifdef _WIN32
-typedef __int64 SQLBIGINT;
-/* On Unix platforms SQLBIGINT is defined in odbcinclude directory*/
-#endif
-#endif
-
-#define BIGINT SQLBIGINT
-
-#ifdef _WIN32
-#define UBIGINT unsigned __int64
-#else
-#define UBIGINT unsigned long long
-#endif
-
-
-#define SQL_WCHAR (-8)
-#define SQL_WVARCHAR (-9)
-#define SQL_WLONGVARCHAR (-10)
-#define SQL_C_WCHAR SQL_WCHAR
-
-/* SQLGetInfo() InfoTypes */
-#define SQL_CONVERT_WCHAR 122
-#define SQL_CONVERT_WLONGVARCHAR 125
-#define SQL_CONVERT_WVARCHAR 126
-
-/* TimesTen specific SQLGetInfo types */
-#define TT_REPLICATION_INVALID (SQL_INFO_DRIVER_START + 2000)
-
-/* SQLGetInfo() return value bitmasks */
-#ifndef SQL_CVT_WCHAR
-/*
-** These definitions differ from Microsoft in that they are not
-** specified as long (e.g. 0x00200000L), hence they are protected
-** by the ifndef above.
-*/
-#define SQL_CVT_WCHAR 0x00200000
-#define SQL_CVT_WLONGVARCHAR 0x00400000
-#define SQL_CVT_WVARCHAR 0x00800000
-#endif
-
-/*
-** The Microsoft Driver Manager SQLBindParameter() will not pass SQL_WCHAR
-** through. Use this hack to get around it.
-*/
-#define SQL_WCHAR_DM_SQLBINDPARAMETER_BYPASS -888
-
-/* This is an extension to ODBC's isolation levels. It reflects an
- * earlier implementation of read-committed that released locks on
- * next fetch, rather than releasing locks before returning value to
- * application. */
-#define SQL_TXN_CURSOR_STABILITY 0x00001000
-#define SQL_TXN_NOBLOCK_DELETE 0x00002000
-
-/* TimesTen-specific connection option */
-#define TT_PREFETCH_CLOSE 10001
-#define TT_PREFETCH_CLOSE_OFF 0
-#define TT_PREFETCH_CLOSE_ON 1
-
-/* Adding a new sql connection option */
-#define TT_PREFETCH_COUNT 10003
-#define TT_PREFETCH_COUNT_MAX 128
-
-/*
- * Platform specific data types for integers that scale
- * with pointer size
- */
-
-#ifdef _IA64_
-typedef signed __int64 tt_ptrint;
-typedef unsigned __int64 tt_uptrint;
-#else
-#ifdef _WIN32
-typedef signed long tt_ptrint;
-typedef unsigned long tt_uptrint;
-#else
-typedef signed long tt_ptrint;
-typedef unsigned long tt_uptrint;
-#endif
-#endif
-
-#ifdef _WIN32
-typedef signed __int64 tt_int8;
-typedef unsigned __int64 tt_uint8;
-#else
-typedef signed long long tt_int8;
-typedef unsigned long long tt_uint8;
-#endif
-
-/* printf formats for pointer-sized integers */
-#ifdef _IA64_ /* 64-bit NT */
-#define PTRINT_FMT "I64d"
-#define UPTRINT_FMT "I64u"
-#define xPTRINT_FMT "I64x"
-#define XPTRINT_FMT "I64X"
-#else
-#ifdef _WIN32 /* 32-bit NT */
-#define PTRINT_FMT "ld"
-#define UPTRINT_FMT "lu"
-#define xPTRINT_FMT "lx"
-#define XPTRINT_FMT "lX"
-#else /* 32 and 64-bit UNIX */
-#define PTRINT_FMT "ld"
-#define UPTRINT_FMT "lu"
-#define xPTRINT_FMT "lx"
-#define XPTRINT_FMT "lX"
-#endif
-#endif
-
-/* printf formats for 8-byte integers */
-#ifndef INT8_FMT_DEFINED
-#ifdef _WIN32 /* 32 and 64-bit NT */
-#define INT8_FMT "I64d"
-#define UINT8_FMT "I64u"
-#define xINT8_FMT "I64x"
-#define XINT8_FMT "I64X"
-#else /* 32 and 64-bit UNIX */
-#define INT8_FMT "lld"
-#define UINT8_FMT "llu"
-#define xINT8_FMT "llx"
-#define XINT8_FMT "llX"
-#endif
-#define INT8_FMT_DEFINED 1
-#endif
-
-/* The following types are defined in the newer odbc include files
- from Microsoft
-*/
-#if defined (_WIN32) && !defined (_IA64_)
-#ifndef SQLROWSETSIZE
-#define SQLROWSETSIZE SQLUINTEGER
-#define SQLLEN SQLINTEGER
-#define SQLROWOFFSET SQLINTEGER
-#define SQLROWCOUNT SQLUINTEGER
-#define SQLULEN SQLUINTEGER
-#define SQLSETPOSIROW SQLUSMALLINT
-#endif
-#endif
-
-
-#endif
diff --git a/ndb/test/odbc/tpcb/tpcb.cpp b/ndb/test/odbc/tpcb/tpcb.cpp
deleted file mode 100644
index 60d746e7844..00000000000
--- a/ndb/test/odbc/tpcb/tpcb.cpp
+++ /dev/null
@@ -1,1415 +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 */
-
-static const volatile char cvsid[] = "$Id: tpcb.cpp,v 1.4 2003/09/26 09:04:34 johan Exp $";
-/*
- * $Revision: 1.4 $
- * (c) Copyright 1996-2003, TimesTen, Inc.
- * All rights reserved.
- */
-
-/* This source is best displayed with a tabstop of 4 */
-
-#define NDB
-
-//#define MYSQL
-
-#ifdef WIN32
-#include <windows.h>
-#include "ttRand.h"
-#else
-#if !defined NDB && !defined MYSQL
-#include <sqlunix.h>
-#endif
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#ifdef SB_P_OS_CHORUS
-#include "ttRand.h"
-#endif
-#endif
-
-#include <math.h>
-#include <time.h>
-#include <sql.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-
-#if !defined NDB && !defined MYSQL
-#include "ttTime.h"
-#include "utils.h"
-#include "tt_version.h"
-#include "timesten.h"
-#endif
-
-#if defined NDB || defined MYSQL
-#include <NdbOut.hpp>
-#include <string.h>
-
-#include <sqlext.h>
-#include <sql.h>
-extern "C" {
-#include "ttTime.h"
-#include "timesten.h"
- void ttGetWallClockTime(ttWallClockTime* timeP);
- void ttCalcElapsedWallClockTime(ttWallClockTime* beforeP,
- ttWallClockTime* afterP,
- double* nmillisecondsP);
- void ttGetThreadTimes(ttThreadTimes * endRes);
- void ttCalcElapsedThreadTimes(ttThreadTimes* startRes,
- ttThreadTimes * endRes,
- double * kernel,
- double * user);
-}
-
-#define app_exit exit
-#define status_msg0 ndbout_c
-#define status_msg1 ndbout_c
-#define status_msg2 ndbout_c
-#define err_msg0 ndbout_c
-#define err_msg1 ndbout_c
-#define err_msg3 ndbout_c
-#define out_msg0 ndbout_c
-#define out_msg1 ndbout_c
-#define out_msg3 ndbout_c
-#define CONN_STR_LEN 255
-#define DBMS_TIMESTEN 1
-#define DBMS_MSSQL 2
-#define DBMS_UNKNOWN 3
-#define ABORT_DISCONNECT_EXIT 1
-#define NO_EXIT 0
-#define ERROR_EXIT 1
-#define DISCONNECT_EXIT 2
-#endif
-
-#define VERBOSE_NOMSGS 0
-/* this value is used for results (and err msgs) only */
-#define VERBOSE_RESULTS 1
-/* this value is the default for the cmdline demo */
-#define VERBOSE_DFLT 2
-#define VERBOSE_ALL 3
-
-#ifdef MYSQL
-#define DSNNAME "DSN=myodbc3"
-#elif defined NDB
-#define DSNNAME "DSN=ndb"
-#else
-#define DSNNAME "DSN="
-#endif
-
-/* number of branches, tellers, and accounts */
-
-#define NumBranches 1
-#define TellersPerBranch 10
-#define AccountsPerBranch 10000
-
-/* number of transactions to execute */
-
-#define NumXacts 25000
-
-/* starting seed value for the random number generator */
-
-#define SeedVal 84773
-
-/* for MS SQL, the drop, create and use database statements */
-
-#define DatabaseDropStmt "drop database tpcbDB;"
-#ifdef MYSQL
-#define DatabaseCreateStmt "create database tpcbDB;"
-#else
-#define DatabaseCreateStmt "create database tpcbDB ON DEFAULT = %d;"
-#endif
-#define DatabaseUseStmt "use tpcbDB;"
-
-/*
- * Specifications of table columns.
- * Fillers of 80, 80, 84, and 24 bytes, respectively, are used
- * to ensure that rows are the width required by the benchmark.
- *
- * Note: The TimesTen and MS SQL CREATE TABLE statements for the
- * accounts, tellers and branches tables are different.
- *
- */
-
-#define TuplesPerPage 256
-
-
-#ifdef MYSQL
-
-#define AccountCrTblStmt "create table accounts \
-(number integer not null primary key, \
-branchnum integer not null, \
-balance float not null, \
-filler char(80));"
-
-#define TellerCrTblStmt "create table tellers \
-(number integer not null primary key, \
-branchnum integer not null, \
-balance float not null, \
-filler char(80));"
-
-#define BranchCrTblStmt "create table branches \
-(number integer not null primary key, \
-balance float not null, \
-filler char(84));"
-
-#endif
-
-
-#ifdef NDB
-#define AccountCrTblStmt "create table accounts \
-(number integer not null primary key, \
-branchnum integer not null, \
-balance float not null, \
-filler char(80)) nologging"
-
-#define TellerCrTblStmt "create table tellers \
-(number integer not null primary key, \
-branchnum integer not null, \
-balance float not null, \
-filler char(80)) nologging"
-
-#define BranchCrTblStmt "create table branches \
-(number integer not null primary key, \
-balance float not null, \
-filler char(84)) nologging"
-#endif
-
-#ifdef NDB
-
-#define HistoryCrTblStmt "create table History \
-(tellernum integer not null, \
-branchnum integer not null, \
-accountnum integer not null, \
-delta float not null, \
-createtime integer not null, \
-filler char(24), \
-primary key (tellernum, branchnum, accountnum, delta, createtime)) nologging"
-
-#else
-
-#ifdef MYSQL
-
-#define HistoryCrTblStmt "create table History \
-(tellernum integer not null, \
-branchnum integer not null, \
-accountnum integer not null, \
-delta float(53) not null, \
-createtime integer not null, \
-filler char(24))"
-#endif
-
-#define HistoryCrTblStmt "create table History \
-(tellernum integer not null, \
-branchnum integer not null, \
-accountnum integer not null, \
-delta float(53) not null, \
-createtime integer not null, \
-filler char(24));"
-#endif
-
-#define TTAccountCrTblStmt "create table accounts \
-(number integer not null primary key, \
-branchnum integer not null, \
-balance float(53) not null, \
-filler char(80)) unique hash on (number) pages = %" PTRINT_FMT ";"
-
-#define TTTellerCrTblStmt "create table tellers \
-(number integer not null primary key, \
-branchnum integer not null, \
-balance float(53) not null, \
-filler char(80)) unique hash on (number) pages = %" PTRINT_FMT ";"
-
-#define TTBranchCrTblStmt "create table branches \
-(number integer not null primary key, \
-balance float(53) not null, \
-filler char(84)) unique hash on (number) pages = %" PTRINT_FMT ";"
-
-
-/* Insertion statements used to populate the tables */
-
-#define NumInsStmts 3
-char* insStmt[NumInsStmts] = {
- "insert into branches values (?, 0.0, NULL)",
- "insert into tellers values (?, ?, 0.0, NULL)",
- "insert into accounts values (?, ?, 0.0, NULL)"
-};
-
-/* Transaction statements used to update the tables */
-
-#define NumXactStmts 5
-
-#ifdef NDB
-char* tpcbXactStmt[NumXactStmts] = {
- "update accounts \
-set balance = balance + ? \
-where number = ?",
-
- "select balance \
-from accounts \
-where number = ?",
-
- "update tellers \
-set balance = balance + ? \
-where number = ?",
-
- "update branches \
-set balance = balance + ? \
-where number = ?",
-
- "insert into History(tellernum, branchnum, \
-accountnum, delta, createtime, filler) \
-values (?, ?, ?, ?, ?, NULL)"
-};
-
-#else
-char* tpcbXactStmt[NumXactStmts] = {
- "update accounts \
-set balance = balance + ? \
-where number = ?;",
-
- "select balance \
-from accounts \
-where number = ?;",
-
- "update tellers \
-set balance = balance + ? \
-where number = ?;",
-
- "update branches \
-set balance = balance + ? \
-where number = ?;",
-
- "insert into History \
-values (?, ?, ?, ?, ?, NULL);"
-};
-
-
-#endif
-
-/* Global parameters and flags (typically set by parse_args()) */
-
-int tabFlag = 0; /* Default is NOT tab output mode */
-char szConnStrIn[CONN_STR_LEN]; /* ODBC Connection String */
-int printXactTimes = 0; /* Transaction statistics
- * gathering flag */
-char statFile[FILENAME_MAX]; /* Transaction statistics filename */
-int scaleFactor = 2; /* Default TPS scale factor */
-int numBranchTups; /* Number of branches */
-int numTellerTups; /* Number of tellers */
-int numAccountTups; /* Number of accounts */
-int numNonLocalAccountTups; /* Number of local accounts */
-int numXacts = NumXacts; /* Default number of transactions */
-int verbose = VERBOSE_DFLT; /* Verbose level */
-FILE *statusfp; /* File for status messages */
-
-
-
-int DBMSType; /* DBMS type (DBMS_TIMESTEN, DBMS_MSSQL...) */
-
-
-SQLHENV henv; /* Environment handle */
-
-
-
-
-
-
-
-void handle_errors( SQLHDBC hdbc, SQLHSTMT hstmt, int errcode, int action, char * msg,
- char * file, int line) {
-
- if (errcode == SQL_SUCCESS)
- return;
-
- if(errcode == SQL_ERROR) {
- int ret;
- long diagCount=0;
- short length=0;
- SQLCHAR state[10] = "";
- SQLCHAR message[200] = "";
- long native = 0;
- if(hstmt != 0) {
- ret = SQLGetDiagField(SQL_HANDLE_STMT, hstmt, 0, SQL_DIAG_NUMBER, &diagCount, SQL_IS_INTEGER, 0);
-
- for(long i = 0; i < diagCount; i++) {
- ret = SQLGetDiagRec(SQL_HANDLE_STMT, hstmt, i, (SQLCHAR*)state, &native, (SQLCHAR*)message, 200, &length);
- ndbout_c("GetDiagRec: Message : %s ", message);
- }
- }
- }
-
- if(errcode != SQL_SUCCESS) {
- ndbout_c("Message: %s", msg);
- switch(errcode) {
- case SQL_SUCCESS_WITH_INFO:
- ndbout_c("SQL_SUCCESS_WITH_INFO");
- break;
- case SQL_STILL_EXECUTING:
- ndbout_c("SQL_STILL_EXECUTING");
- break;
- case SQL_ERROR:
- ndbout_c("SQL_ERROR");
- break;
- case SQL_INVALID_HANDLE:
- ndbout_c("SQL_INVALID_HANDLE");
- break;
- default:
- ndbout_c("Some other error");
- }
- exit(1);
- }
-
-
-}
-
-
-
-
-
-/*********************************************************************
- * FUNCTION: usage
- *
- * DESCRIPTION: This function prints a usage message describing
- * the command line options of the program.
- *
- * PARAMETERS: char* prog full program path name
- *
- * RETURNS: void
- *
- * NOTES: NONE
- *
- *********************************************************************/
-
-static void usage(char *prog)
-{
- char *progname;
-
- /* Get the name of the program (sans path). */
-
-#ifdef WIN32
- progname = strrchr(prog, '\\');
-#else
- progname = strrchr(prog, '/');
-#endif
- if (progname == 0)
- progname = prog;
- else
- ++progname;
-
- /* Print the usage message */
-
- fprintf(stderr,
- "Usage:\t%s [-h] [-help] [-V] [-connStr <string>] [-v <level>]\n"
- "\t\t[-xact <xacts>] [-scale <scale>] [-tabs] [-s <statfile>]\n\n"
- " -h Prints this message and exits.\n"
- " -help Same as -h.\n"
- " -V Prints version number and exits.\n"
- " -connStr <string> Specifies an ODBC connection string to replace the\n"
- " default DSN for the program. The default is\n"
- " \"DSN=TpcbData<version>;OverWrite=1\".\n"
- " -v <level> Verbose level\n"
- " 0 = errors only\n"
- " 1 = results only\n"
- " 2 = results and some status messages (default)\n"
- " 3 = all messages\n"
- " -xact <xacts> Specifies the number of transactions to be run\n"
- " The default is 25000 transactions.\n"
- " -scale <scale> Specifies a scale factor which determines the\n"
- " number of branches (scale), tellers (scale x 10),\n"
- " accounts (scale x 10000) and non-local accounts\n"
- " ((scale-1) x 10000. The default scale factor is 2.\n"
- " -tabs Specifies that the output be a tab-separated\n"
- " format suitable for import into a spreadsheet.\n"
- " Results only go to stdout; status and other\n"
- " messages go to stderr.\n"
- " -s <statfile> Prints individual transaction times to <statfile>.\n",
- progname);
-}
-
-/*********************************************************************
- *
- * FUNCTION: parse_args
- *
- * DESCRIPTION: This function parses the command line arguments
- * passed to main(), setting the appropriate global
- * variables and issuing a usage message for
- * invalid arguments.
- *
- * PARAMETERS: int argc # of arguments from main()
- * char *argv[] arguments from main()
- *
- * RETURNS: void
- *
- * NOTES: NONE
- *
- *********************************************************************/
-
-void
-parse_args(int argc, char *argv[])
-{
- int i = 1;
-
- *szConnStrIn = 0;
-
- while (i < argc) {
-
- if ( !strcmp(argv[i], "-h") || !strcmp(argv[i], "-help") ) {
- usage(argv[0]);
- app_exit(0);
- }
- /*
- if (!strcmp(argv[i], "-V")) {
- printf("%s\n", TTVERSION_STRING);
- app_exit(0);
- }
- */
- if (strcmp(argv[i], "-s") == 0) {
- if (argc < i+2 ) {
- usage(argv[0]);
- app_exit(1);
- }
- if (sscanf(argv[i+1], "%s", statFile) == 0) {
- usage(argv[0]);
- app_exit(1);
- }
- printXactTimes = 1;
- i += 2;
- }
- else if (!strcmp(argv[i], "-connStr")) {
- if (argc < i+2 ) {
- usage(argv[0]);
- app_exit(1);
- }
- strcpy(szConnStrIn, argv[i+1]);
- i += 2;
- continue;
- }
- else if (strcmp("-v", argv[i]) == 0) {
- if (argc < i+2 ) {
- usage(argv[0]);
- app_exit(1);
- }
- if (sscanf(argv[i+1], "%d", &verbose) == -1 ||
- verbose < 0 || verbose > 3) {
- fprintf(stderr, "-v flag requires an integer parameter (0-3)\n");
- usage(argv[0]);
- app_exit(1);
- }
- i += 2;
- }
- else if (strcmp("-xact",argv[i]) == 0) {
- if (argc < i+2 ) {
- usage(argv[0]);
- app_exit(1);
- }
-
- if (sscanf(argv[i+1], "%" PTRINT_FMT, &numXacts) == -1 || numXacts < 0) {
- fprintf(stderr, "-xact flag requires a non-negative integer argument\n");
- usage(argv[0]);
- app_exit(1);
- }
-
- i += 2;
- }
- else if (strcmp("-scale",argv[i]) == 0) {
- if (argc < i+2 ) {
- usage(argv[0]);
- app_exit(1);
- }
- if (sscanf(argv[i+1], "%d", &scaleFactor) == -1 || scaleFactor < 1) {
- fprintf(stderr, "-scale flag requires an integer argument >= 1\n");
- usage(argv[0]);
- app_exit(1);
- }
- /* Calculate tuple sizes */
- numBranchTups = NumBranches * scaleFactor;
- numTellerTups = TellersPerBranch * scaleFactor;
- numAccountTups = AccountsPerBranch * scaleFactor;
- numNonLocalAccountTups = AccountsPerBranch * (scaleFactor-1);
- i += 2;
- }
- else if (strcmp("-tabs",argv[i]) == 0) {
- tabFlag = 1;
- statusfp = stderr;
- i += 1;
- }
- else {
- usage(argv[0]);
- app_exit(1);
- }
- }
-}
-
-/*********************************************************************
- *
- * FUNCTION: doImmed
- *
- * DESCRIPTION: This function executes and frees the specified
- * statement. It is used as a direct means to
- * create the tables used by this benchmark,
- *
- * PARAMETERS: SQLHDBC hdbc SQL Connection handle
- * SQLHSTMT hs SQL Statement handle
- * char* cmd SQL Statement text
- *
- * RETURNS: void
- *
- * NOTES: NONE
- *
- *********************************************************************/
-
-void
-doImmed(SQLHDBC hdbc, SQLHSTMT hs, char* cmd)
-{
- SQLRETURN rc;
-
- /* Execute the command */
-
- rc = SQLExecDirect(hs, (SQLCHAR *) cmd, SQL_NTS);
- handle_errors(hdbc, hs, rc, ABORT_DISCONNECT_EXIT,
- "Error executing statement", __FILE__, __LINE__);
-
- /* Close associated cursor and drop pending results */
-
- rc = SQLFreeStmt(hs, SQL_CLOSE);
- handle_errors(hdbc, hs, rc, ABORT_DISCONNECT_EXIT,
- "closing statement handle",
- __FILE__, __LINE__);
-
-}
-
-
-/*********************************************************************
- *
- * FUNCTION: main
- *
- * DESCRIPTION: This is the main function of the tpcb benchmark.
- * It connects to an ODBC data source, creates and
- * populates tables, updates the tables in a user-
- * specified number of transactions and reports on
- * on the transaction times.
- *
- * PARAMETERS: int argc # of command line arguments
- * char *argv[] command line arguments
- *
- * RETURNS: void
- *
- * NOTES: NONE
- *
- *********************************************************************/
-
-int
-main(int argc, char *argv[])
-{
-
- /* variables used for setting up the tables */
-
- char cmdStr[1024];
- char errstr[4096];
-
- /* variables used during transactions */
-
- int accountNum;
- int tellerNum;
- int branchNum;
- int timeStamp;
- double delta;
- unsigned int lrand;
- unsigned short *srands, localLimit;
- int lp64;
-
- /* variables used for timing and statistics */
-
- int warmup;
- double kernel, user, real;
- ttThreadTimes startRes, endRes;
- ttWallClockTime startT, endT;
- ttWallClockTime** rtStart;
- ttWallClockTime** rtEnd;
- double** resTime;
- double maxTime, totTime;
- int i;
- int j;
- int numLocalXacts=0, numRemoteXacts=0;
-
- /* variables for ODBC */
-
- SQLHDBC hdbc;
- SQLHSTMT hstmt;
- SQLHSTMT txstmt[NumXactStmts];
- SQLRETURN rc;
- char DBMSName[32];
- char DBMSVersion[32];
- int databaseSize;
-
- int fThreadTime = 1;
-
-#ifdef WIN32
- OSVERSIONINFO sysInfo;
-
- sysInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- GetVersionEx (&sysInfo);
-
- /* GetThreadTimes is not supported on 95/98. Hence,
- we do not support Resource/User/System times */
- if (sysInfo.dwPlatformId != VER_PLATFORM_WIN32_NT)
- fThreadTime = 0;
-#endif
-#if defined(TTCLIENTSERVER) && defined(__hpux) && !defined(__LP64__)
- /* HP requires this for C main programs that call aC++ shared libs */
- _main();
-#endif /* hpux32 */
-
- /* Set up default signal handlers */
-
-#ifndef NDB
- /* StopRequestClear();
- if (HandleSignals() != 0) {
- err_msg0("Unable to set signal handlers\n");
- return 1;
- }
- */
-#endif
- /* set IO mode for demo */
- /* set_io_mode(); */
-
- /* initialize the file for status messages */
- statusfp = stdout;
-
- /* set variable for 8-byte longs */
- lp64 = (sizeof(lrand) == 8);
-
- /* set the default tuple sizes */
-
- numBranchTups = NumBranches * scaleFactor;
- numTellerTups = TellersPerBranch * scaleFactor;
- numAccountTups = AccountsPerBranch * scaleFactor;
- numNonLocalAccountTups = AccountsPerBranch * (scaleFactor-1);
-
- /* parse the command arguments */
- parse_args(argc, argv);
-
- /* allocate the transaction-based variables */
-
- rtStart = (ttWallClockTime**) malloc(numXacts * sizeof(ttWallClockTime*));
- if (!rtStart) {
- err_msg0("Cannot allocate the transaction timing structures");
- app_exit(1);
- }
- for (i = 0; i < numXacts; i++) {
- rtStart[i] = (ttWallClockTime*) malloc(sizeof(ttWallClockTime));
- if (!rtStart[i]) {
- err_msg0("Cannot allocate the transaction timing structures");
- app_exit(1);
- }
- }
-
- rtEnd = (ttWallClockTime**) malloc(numXacts * sizeof(ttWallClockTime*));
- if (!rtEnd) {
- err_msg0("Cannot allocate the transaction timing structures");
- app_exit(1);
- }
- for (i = 0; i < numXacts; i++) {
- rtEnd[i] = (ttWallClockTime*) malloc(sizeof(ttWallClockTime));
- if (!rtEnd[i]) {
- err_msg0("Cannot allocate the transaction timing structures");
- app_exit(1);
- }
- }
-
- resTime = (double**) malloc(numXacts * sizeof(double*));
- if (!resTime) {
- err_msg0("Cannot allocate the transaction timing structures");
- app_exit(1);
- }
- for (i = 0; i < numXacts; i++) {
- resTime[i] = (double*) malloc(sizeof(double));
- if (!resTime[i]) {
- err_msg0("Cannot allocate the transaction timing structures");
- app_exit(1);
- }
- }
-
- /* ODBC initialization */
-
- rc = SQLAllocEnv(&henv);
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
- /* error occurred -- don't bother calling handle_errors, since handle
- * is not valid so SQLError won't work */
- err_msg3("ERROR in %s, line %d: %s\n",
- __FILE__, __LINE__, "allocating an environment handle");
- app_exit(1);
- }
- SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (SQLPOINTER)SQL_OV_ODBC3, SQL_IS_INTEGER);
-
- /* call this in case of warning */
- handle_errors(NULL, NULL, rc, NO_EXIT,
- "allocating execution environment",
- __FILE__, __LINE__);
-
- rc = SQLAllocConnect(henv, &hdbc);
- handle_errors(NULL, NULL, rc, ERROR_EXIT,
- "allocating connection handle",
- __FILE__, __LINE__);
-
- /* Connect to data store */
-
- status_msg0("Connecting to the data source...\n");
-
- /* Set up the connection options if not specified on the command line
- * (default to TimesTen settings).
- */
-
- if ( !*szConnStrIn ) {
- /* Running the benchmark with a scale factor creates (scale) branches,
- * (scale x 10) tellers, (scale x 10000) accounts and ((scale-1) x 10000)
- * non-local accounts. The size of the table rows are branches (141)
- * tellers (141) and accounts (141). Therefore the data size requirements
- * of this benchmark is:
- * size ~= 141 * ((scale * 20011) - 10000) (bytes)
- *
- * Multiply data size by 20% to account for additional DB overhead (e.g.
- * indexes), and round up the nearest 10Mb for safety.
- */
-
- int est_size = (int) (3.6 * scaleFactor + 10.0);
- est_size = est_size - (est_size % 10);
-
- sprintf(szConnStrIn,"OverWrite=1;PermSize=%d;%s",
- est_size, DSNNAME);
- status_msg0("Connecting to the data source... %s \n", szConnStrIn);
- }
-
- rc = SQLDriverConnect(hdbc, NULL, (SQLCHAR *) szConnStrIn, SQL_NTS,
- NULL, 0, NULL,
- SQL_DRIVER_NOPROMPT);
-
- status_msg0("Connected to the data source...\n");
- sprintf(errstr, "connecting to driver (connect string %s)\n",
- szConnStrIn);
- handle_errors(hdbc, NULL, rc, ERROR_EXIT,
- errstr, __FILE__, __LINE__);
-
- /* Turn auto-commit off */
-
- rc = SQLSetConnectOption(hdbc, SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF);
- handle_errors(hdbc, NULL, rc, DISCONNECT_EXIT,
- "switching off the AUTO_COMMIT option",
- __FILE__, __LINE__);
-
- /* Allocate a statement handle */
-
- rc = SQLAllocStmt(hdbc, &hstmt);
- handle_errors(hdbc, NULL, rc, DISCONNECT_EXIT,
- "allocating a statement handle",
- __FILE__, __LINE__);
-
- /* (Implicit) Transaction begin */
-
- /* Determine the DBMS Type*/
-
- DBMSName[0] = '\0';
- rc = SQLGetInfo(hdbc, SQL_DBMS_NAME, (PTR) &DBMSName,
- sizeof(DBMSName), NULL);
- rc = SQLGetInfo(hdbc, SQL_DRIVER_VER, (PTR) &DBMSVersion,
- sizeof(DBMSVersion), NULL);
-
- if (strcmp(DBMSName, "TimesTen") == 0)
- DBMSType = DBMS_TIMESTEN;
- else if (strcmp(DBMSName, "Microsoft SQL Server") == 0)
- DBMSType = DBMS_MSSQL;
- else DBMSType = DBMS_UNKNOWN;
-
- /* if not TimesTen: delete (if it exists), create & use the new database */
-
- if (DBMSType != DBMS_TIMESTEN) {
- status_msg0("Deleting the database...\n");
- rc = SQLExecDirect(hstmt, (SQLCHAR *) DatabaseDropStmt, SQL_NTS);
-
- /* estimate database size, size = data space + log space
- * data space = (#tuples)/(tuples per page) * 2K bytes/page
- * tuples per page = useable page size / row size (no index) = 2016/(96+2)
- * log space = #transactions * average log size for the program transaction mix
- * database size is in MB
- */
-
- databaseSize = (int) ceil((((numBranchTups + numTellerTups + numAccountTups)/
- (2016/98)) * 2048 + (numXacts * 600)) / 1000000.0);
-
- status_msg1("Creating the database (%dMB)...\n", databaseSize);
-#ifndef NDB
- sprintf(cmdStr, DatabaseCreateStmt, databaseSize);
- doImmed(hdbc, hstmt, cmdStr);
- strcpy(cmdStr, DatabaseUseStmt);
- doImmed(hdbc, hstmt, cmdStr);
-#endif
- }
-
- status_msg2("Connected to '%s' version '%s'...\n", DBMSName, DBMSVersion);
-
- /* create branches table */
- status_msg0("Creating tasddbles...\n");
-#ifndef NDB
- if (DBMSType == DBMS_TIMESTEN)
- sprintf(cmdStr, TTBranchCrTblStmt, numBranchTups/TuplesPerPage + 1);
- else
-#endif
- sprintf(cmdStr, BranchCrTblStmt);
- doImmed(hdbc, hstmt, cmdStr);
-
- /* create tellers table */
-#ifndef NDB
- if (DBMSType == DBMS_TIMESTEN)
- sprintf(cmdStr, TTTellerCrTblStmt, numTellerTups/TuplesPerPage + 1);
-
- else
-#endif
- sprintf(cmdStr, TellerCrTblStmt);
- doImmed(hdbc, hstmt, cmdStr);
-
- /* create accounts table */
-#ifndef NDB
- if (DBMSType == DBMS_TIMESTEN)
- sprintf(cmdStr, TTAccountCrTblStmt, numAccountTups/TuplesPerPage + 1);
- else
-#endif
- sprintf(cmdStr, AccountCrTblStmt);
- doImmed(hdbc, hstmt, cmdStr);
-
- /* create History table */
-
- doImmed(hdbc, hstmt, HistoryCrTblStmt);
-
- /* lock the database during population */
-#ifndef NDB
- if ( DBMSType == DBMS_TIMESTEN ) {
- rc = SQLExecDirect(hstmt, (SQLCHAR *)"call ttlocklevel('DS')", SQL_NTS);
- handle_errors(hdbc, hstmt, rc, ABORT_DISCONNECT_EXIT,
- "specifying dbs lock usage",
- __FILE__, __LINE__);
- /* make sure dbs lock take effect in next transaction */
- rc = SQLTransact(henv,hdbc,SQL_COMMIT);
- if ( rc != SQL_SUCCESS) {
- handle_errors(hdbc, SQL_NULL_HSTMT, rc, ERROR_EXIT,
- "committing transaction",
- __FILE__, __LINE__);
- }
- }
-#endif
- /* populate branches table */
-
-
- rc = SQLPrepare(hstmt, (SQLCHAR *) insStmt[0], SQL_NTS);
- handle_errors(hdbc, hstmt, rc, ABORT_DISCONNECT_EXIT,
- "preparing statement",
- __FILE__, __LINE__);
-
- rc = SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 10, 0, &branchNum, sizeof branchNum, NULL);
-
- handle_errors(hdbc, hstmt, rc, ABORT_DISCONNECT_EXIT,
- "binding parameter",
- __FILE__, __LINE__);
-
-
- status_msg1("Populating branches table (%" PTRINT_FMT " rows)...\n",
- numBranchTups);
-
-
- for (i=0; i<numBranchTups; i++) {
- branchNum = i;
- rc = SQLExecute(hstmt);
- handle_errors(hdbc, hstmt, rc, ABORT_DISCONNECT_EXIT,
- "Error executing statement",
- __FILE__, __LINE__);
- }
-
- /* Reset all bind-parameters for the statement handle. */
- rc = SQLFreeStmt(hstmt, SQL_RESET_PARAMS);
- handle_errors(hdbc, hstmt, rc, ABORT_DISCONNECT_EXIT,
- "resetting parms on statement handle",
- __FILE__, __LINE__);
-
- /* populate tellers table */
-
- status_msg1("Populating tellers table (%" PTRINT_FMT " rows)...\n",
- numTellerTups);
-
-
- rc = SQLPrepare(hstmt, (SQLCHAR *) insStmt[1], SQL_NTS);
- handle_errors(hdbc, hstmt, rc, ABORT_DISCONNECT_EXIT,
- "preparing statement",
- __FILE__, __LINE__);
-
- rc = SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER,
- 10, 0, &tellerNum, sizeof tellerNum, NULL);
- handle_errors(hdbc, hstmt, rc, ABORT_DISCONNECT_EXIT,
- "binding parameter",
- __FILE__, __LINE__);
-
- rc = SQLBindParameter(hstmt, 2, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER,
- 10, 0, &branchNum, sizeof branchNum, NULL);
- handle_errors(hdbc, hstmt, rc, ABORT_DISCONNECT_EXIT,
- "binding parameter",
- __FILE__, __LINE__);
-
- for (i=0; i<numTellerTups; i++) {
- tellerNum = i;
- branchNum = i/TellersPerBranch;
- rc = SQLExecute(hstmt);
- handle_errors(hdbc, hstmt, rc, ABORT_DISCONNECT_EXIT,
- "Error executing statement",
- __FILE__, __LINE__);
- }
-
- /* Reset all bind-parameters for the statement handle. */
-
- rc = SQLFreeStmt(hstmt, SQL_RESET_PARAMS);
- handle_errors(hdbc, hstmt, rc, ABORT_DISCONNECT_EXIT,
- "resetting parms on statement handle",
- __FILE__, __LINE__);
-
- /* populate accounts table */
-
- status_msg1("Populating accounts table (%" PTRINT_FMT " rows)...\n",
- numAccountTups);
-
- rc = SQLPrepare(hstmt, (SQLCHAR *) insStmt[2], SQL_NTS);
- handle_errors(hdbc, hstmt, rc, ABORT_DISCONNECT_EXIT,
- "preparing statement",
- __FILE__, __LINE__);
-
- rc = SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER,
- 10, 0, &accountNum, sizeof accountNum, NULL);
- handle_errors(hdbc, hstmt, rc, ABORT_DISCONNECT_EXIT,
- "binding parameter",
- __FILE__, __LINE__);
-
- rc = SQLBindParameter(hstmt, 2, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER,
- 10, 0, &branchNum, sizeof branchNum, NULL);
- handle_errors(hdbc, hstmt, rc, ABORT_DISCONNECT_EXIT,
- "binding parameter",
- __FILE__, __LINE__);
-
- for (i=0; i<numAccountTups; i++) {
- accountNum = i;
- branchNum = i/AccountsPerBranch;
- rc = SQLExecute(hstmt);
- handle_errors(hdbc, hstmt, rc, ABORT_DISCONNECT_EXIT,
- "Error executing statement",
- __FILE__, __LINE__);
- }
- status_msg0("Commit...\n");
- rc = SQLTransact(henv, hdbc, SQL_COMMIT);
- status_msg0("Commit done...\n");
- handle_errors(hdbc, NULL, rc, ERROR_EXIT,
- "committing transaction",
- __FILE__, __LINE__);
-
- /* compile SQL statements of transaction */
-
- status_msg0("Compiling statements of transaction...\n");
- for (i=0; i<NumXactStmts; i++) {
-#ifndef NDB
- rc = SQLAllocStmt(hdbc, &txstmt[i]);
- handle_errors(hdbc, NULL, rc, ABORT_DISCONNECT_EXIT,
- "allocating a statement handle",
- __FILE__, __LINE__);
-#else
- rc = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &txstmt[i]);
- handle_errors(hdbc, NULL, rc, ABORT_DISCONNECT_EXIT,
- "allocating a statement handle",
- __FILE__, __LINE__);
-
-#endif
-
- rc = SQLPrepare(txstmt[i], (SQLCHAR *) tpcbXactStmt[i], SQL_NTS);
- handle_errors(hdbc, txstmt[i], rc, ABORT_DISCONNECT_EXIT,
- "preparing statement",
- __FILE__, __LINE__);
- }
-
- /* unuse dbs lock */
-#ifndef NDB
- if ( DBMSType == DBMS_TIMESTEN ) {
- rc = SQLExecDirect(hstmt, (SQLCHAR *)"call ttlocklevel('Row')", SQL_NTS);
- handle_errors(hdbc, hstmt, rc, ABORT_DISCONNECT_EXIT,
- "specifying row lock usage",
- __FILE__, __LINE__);
- }
-#endif
-
- /* commit transaction */
-
- rc = SQLTransact(henv, hdbc, SQL_COMMIT);
- handle_errors(hdbc, NULL, rc, ERROR_EXIT,
- "committing transaction",
- __FILE__, __LINE__);
-
-
- /* Initialize random seed and timers */
-
- srand48(SeedVal);
- localLimit = (unsigned short)((1<<16) * 0.85);
-
- /* Initialize parameter lists for each of the transactions */
-
- rc = SQLBindParameter(txstmt[0], 1, SQL_PARAM_INPUT, SQL_C_DOUBLE,
- SQL_DOUBLE, 15, 0, &delta, sizeof delta, NULL);
- handle_errors(hdbc, txstmt[0], rc, ABORT_DISCONNECT_EXIT,
- "binding parameter",
- __FILE__, __LINE__);
-
- rc = SQLBindParameter(txstmt[0], 2, SQL_PARAM_INPUT, SQL_C_SLONG,
- SQL_INTEGER, 10, 0, &accountNum, sizeof accountNum,
- NULL);
- handle_errors(hdbc, txstmt[0], rc, ABORT_DISCONNECT_EXIT,
- "binding parameter",
- __FILE__, __LINE__);
-
- rc = SQLBindParameter(txstmt[1], 1, SQL_PARAM_INPUT, SQL_C_SLONG,
- SQL_INTEGER, 10, 0, &accountNum, sizeof accountNum,
- NULL);
- handle_errors(hdbc, txstmt[1], rc, ABORT_DISCONNECT_EXIT,
- "binding parameter",
- __FILE__, __LINE__);
-
- rc = SQLBindParameter(txstmt[2], 1, SQL_PARAM_INPUT, SQL_C_DOUBLE,
- SQL_DOUBLE, 15, 0, &delta, sizeof delta, NULL);
- handle_errors(hdbc, txstmt[2], rc, ABORT_DISCONNECT_EXIT,
- "binding parameter",
- __FILE__, __LINE__);
-
- rc = SQLBindParameter(txstmt[2], 2, SQL_PARAM_INPUT, SQL_C_SLONG,
- SQL_INTEGER, 10, 0, &tellerNum, sizeof tellerNum,
- NULL);
- handle_errors(hdbc, txstmt[2], rc, ABORT_DISCONNECT_EXIT,
- "binding parameter",
- __FILE__, __LINE__);
-
- rc = SQLBindParameter(txstmt[3], 1, SQL_PARAM_INPUT, SQL_C_DOUBLE,
- SQL_DOUBLE, 15, 0, &delta, sizeof delta, NULL);
- handle_errors(hdbc, txstmt[3], rc, ABORT_DISCONNECT_EXIT,
- "binding parameter",
- __FILE__, __LINE__);
-
- rc = SQLBindParameter(txstmt[3], 2, SQL_PARAM_INPUT, SQL_C_SLONG,
- SQL_INTEGER, 10, 0, &branchNum, sizeof branchNum,
- NULL);
- handle_errors(hdbc, txstmt[3], rc, ABORT_DISCONNECT_EXIT,
- "binding parameter",
- __FILE__, __LINE__);
-
- rc = SQLBindParameter(txstmt[4], 1, SQL_PARAM_INPUT, SQL_C_SLONG,
- SQL_INTEGER, 10, 0, &tellerNum, sizeof tellerNum,
- NULL);
- handle_errors(hdbc, txstmt[4], rc, ABORT_DISCONNECT_EXIT,
- "binding parameter",
- __FILE__, __LINE__);
-
- rc = SQLBindParameter(txstmt[4], 2, SQL_PARAM_INPUT, SQL_C_SLONG,
- SQL_INTEGER, 10, 0, &branchNum, sizeof branchNum,
- NULL);
- handle_errors(hdbc, txstmt[4], rc, ABORT_DISCONNECT_EXIT,
- "binding parameter",
- __FILE__, __LINE__);
-
- rc = SQLBindParameter(txstmt[4], 3, SQL_PARAM_INPUT, SQL_C_SLONG,
- SQL_INTEGER, 10, 0, &accountNum, sizeof accountNum,
- NULL);
- handle_errors(hdbc, txstmt[4], rc, ABORT_DISCONNECT_EXIT,
- "binding parameter",
- __FILE__, __LINE__);
-
- rc = SQLBindParameter(txstmt[4], 4, SQL_PARAM_INPUT, SQL_C_DOUBLE,
- SQL_DOUBLE, 15, 0, &delta, sizeof delta, NULL);
- handle_errors(hdbc, txstmt[4], rc, ABORT_DISCONNECT_EXIT,
- "binding parameter",
- __FILE__, __LINE__);
-
- rc = SQLBindParameter(txstmt[4], 5, SQL_PARAM_INPUT, SQL_C_SLONG,
- SQL_INTEGER, 10, 0, &timeStamp, sizeof timeStamp,
- NULL);
- handle_errors(hdbc, txstmt[4], rc, ABORT_DISCONNECT_EXIT,
- "binding parameter",
- __FILE__, __LINE__);
-
- /* Execute transaction loop.
- * Do it twice, once briefly as a warm-up. */
-
-
-
- for (warmup = 1; warmup >= 0; warmup--) {
-
- int max_i = (warmup ? numXacts/10 : numXacts);
-
- /* Execute tpcb transaction max_i times.*/
-
- if (warmup) {
- status_msg1("\nWarming up with %d tpcb transactions...\n", max_i);
- }
- else {
- status_msg1("Executing and timing %d tpcb transactions...\n", max_i);
- }
-
- ttGetWallClockTime(&startT);
- ttGetThreadTimes(&startRes);
-
- for (i = 0; i < max_i; i++) {
-
- lrand = lrand48();
- srands = (unsigned short *)(&lrand);
- if (lp64) srands += 2; /* skip high half -- all zero */
-
- /* randomly choose a teller */
-
- tellerNum = srands[0] % numTellerTups;
-
- /* compute branch */
-
- branchNum = (tellerNum / TellersPerBranch);
-
- /* randomly choose an account */
-
- if (srands[1] < localLimit || numBranchTups == 1) {
-
- /* choose account local to selected branch */
-
- accountNum = branchNum * AccountsPerBranch +
- (lrand48() % AccountsPerBranch);
-
- ++numLocalXacts;
-
- }
- else {
- /* choose account not local to selected branch */
-
- /* first select account in range [0,numNonLocalAccountTups) */
-
- accountNum = lrand48() % numNonLocalAccountTups;
-
- /* if branch number of selected account is at least as big
- * as local branch number, then increment account number
- * by AccountsPerBranch to skip over local accounts
- */
-
- if ((accountNum/AccountsPerBranch) >= branchNum)
- accountNum += AccountsPerBranch;
-
- ++numRemoteXacts;
- }
-
- /* select delta amount, -999,999 to +999,999 */
-
- delta = ((lrand48() % 1999999) - 999999);
-
-
- /* begin timing the "residence time" */
-
- ttGetWallClockTime(rtStart[i]);
-
- for ( j = 0; j < NumXactStmts - 2; j++) {
- rc = SQLExecute(txstmt[j]);
- handle_errors(hdbc, txstmt[j], rc, ABORT_DISCONNECT_EXIT,
- "Error executing statement1",
- __FILE__, __LINE__);
-
- /* Close the handle after the SELECT statement
- * (txstmt[1]) for non TimesTen DBMS' */
-
- if ((DBMSType != DBMS_TIMESTEN) && (j == 1)) {
- SQLFreeStmt(txstmt[1], SQL_CLOSE);
- }
-
-
- }
-
- /* note that time must be taken within the */
- timeStamp = time(NULL);
-
- rc = SQLExecute(txstmt[NumXactStmts - 1]);
- handle_errors(hdbc, txstmt[NumXactStmts - 1], rc,
- ABORT_DISCONNECT_EXIT, "Error executing statement2",
- __FILE__, __LINE__);
-
- rc = SQLTransact(henv, hdbc, SQL_COMMIT);
- handle_errors(hdbc, NULL, rc, ERROR_EXIT,
- "Error committing transaction",
- __FILE__, __LINE__);
-
- ttGetWallClockTime(rtEnd[i]);
-
- } /* end fortransaction loop */
-
-
-
-
- ttGetThreadTimes(&endRes);
- ttGetWallClockTime(&endT);
- ttCalcElapsedThreadTimes(&startRes, &endRes, &kernel, &user);
- ttCalcElapsedWallClockTime(&startT, &endT, &real);
-
- if (warmup) {
- if (!tabFlag) {
- if (verbose) {
- if (fThreadTime) {
- out_msg0(" time user system\n");
-
- out_msg3("Warmup time (sec): %12.3f %12.3f %12.3f\n\n",
- real/1000.0, user, kernel);
- } else {
- out_msg1("Warmup time (sec): %12.3f\n\n", real/1000.0);
- }
- }
- } else {
- if (verbose) {
- if (fThreadTime) {
- out_msg0("\ttime\tuser\tsystem\n");
-
- out_msg3("Warmup time (sec):\t%12.3f\t%12.3f\t%12.3f\n",
- real/1000.0, user, kernel);
- } else {
- out_msg1("Warmup time (sec):\t%12.3f\n", real/1000.0);
- }
- }
- }
- }
- }
-
- status_msg0("\nExecution completed...\n");
-
- /* Compute and report timing statistics */
-
- maxTime = 0.0;
- totTime = 0.0;
-
- for (i = 0; i < numXacts; i++) {
- ttCalcElapsedWallClockTime(rtStart[i], rtEnd[i], resTime[i]);
- totTime += *(resTime[i]);
-
- if (*(resTime[i]) > maxTime) maxTime = *(resTime[i]);
- }
-
- if (!tabFlag) {
- if (verbose) {
- if (fThreadTime) {
- out_msg0(" time user system\n");
- out_msg3("Total time (sec): %12.3f %12.3f %12.3f\n",
- real/1000.0, user, kernel);
- } else {
- out_msg1("Total time (sec): %12.3f\n", real/1000.0);
- }
- }
-
- if (verbose)
- out_msg1("\nAverage transaction time (msec):%12.3f\n",
- totTime/numXacts);
- if (verbose)
- out_msg1("Maximum transaction time (msec):%12.3f\n", maxTime);
- if (verbose)
- out_msg1("\nLocal transactions: %7" PTRINT_FMT "\n", numLocalXacts);
- if (verbose)
- out_msg1("Remote transactions: %7" PTRINT_FMT "\n", numRemoteXacts);
-
- } else {
- if (verbose) {
- if (fThreadTime) {
- out_msg0("\ttime\tuser\tsystem\n");
- out_msg3("Total time (sec):\t%12.3f\t%12.3f\t%12.3f\n",
- real/1000.0, user, kernel);
- } else {
- out_msg1("Total time (sec):\t%12.3f\n", real/1000.0);
- }
- }
-
- if (verbose)
- out_msg1("\nAverage transaction time (msec):\t%12.3f\n",
- totTime/numXacts);
- if (verbose)
- out_msg1("Maximum transaction time (msec):\t%12.3f\n", maxTime);
- if (verbose)
- out_msg1("Local transactions:\t%7" PTRINT_FMT "\n", numLocalXacts);
-
- if (verbose)
- out_msg1("Remote transactions:\t%7" PTRINT_FMT "\n", numRemoteXacts);
-
-
-
- }
-
- /* If the statfile option is selected, print each transaction's time */
-
- if (printXactTimes) {
- FILE * fp;
- if ( (fp = fopen (statFile, "w")) == NULL ) {
- err_msg1("Unable to open stat file %s for writing\n\n", statFile);
- } else {
- for (int i = 0; i < numXacts; i++)
- fprintf(fp,"%6d: %12.3f\n", i, *(resTime[i]));
- fclose(fp);
- }
- }
-
- /* Disconnect and return */
-
- rc = SQLFreeStmt(hstmt, SQL_DROP);
- handle_errors(hdbc, hstmt, rc, ABORT_DISCONNECT_EXIT,
- "dropping the statement handle",
- __FILE__, __LINE__);
-
- for (int i=0; i<NumXactStmts; i++) {
- rc = SQLFreeStmt(txstmt[i], SQL_DROP);
- handle_errors(hdbc, hstmt, rc, ABORT_DISCONNECT_EXIT,
- "dropping the statement handle",
- __FILE__, __LINE__);
- }
-
- if (verbose >= VERBOSE_DFLT)
- status_msg0("Disconnecting from the data source...\n");
-
- rc = SQLDisconnect(hdbc);
- handle_errors(hdbc, NULL, rc, ERROR_EXIT,
- "disconnecting",
- __FILE__, __LINE__);
-
- rc = SQLFreeConnect(hdbc);
- handle_errors(hdbc, NULL, rc, ERROR_EXIT,
- "freeing connection handle",
- __FILE__, __LINE__);
-
- rc = SQLFreeEnv(henv);
- handle_errors(NULL, NULL, rc, ERROR_EXIT,
- "freeing environment handle",
- __FILE__, __LINE__);
-
- app_exit(0);
- return 0;
-}
-
-
-
-
-
-/* Emacs variable settings */
-/* Local Variables: */
-/* tab-width:8 */
-/* indent-tabs-mode:nil */
-/* c-basic-offset:2 */
-/* End: */
-
-
-
diff --git a/ndb/test/odbc/tpcb/ttTime.c b/ndb/test/odbc/tpcb/ttTime.c
deleted file mode 100644
index 8f10b0c6b91..00000000000
--- a/ndb/test/odbc/tpcb/ttTime.c
+++ /dev/null
@@ -1,366 +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 */
-
-static const volatile char cvsid[] = "$Id: ttTime.c,v 1.1 2003/09/23 12:43:46 johan Exp $";
-/*
- * $Revision: 1.1 $
- * (c) Copyright 1996-2003, TimesTen, Inc.
- * All rights reserved.
- *
- */
-
-
-/* Contains functions for performing elapsed-time calculations
- in a portable manner */
-
-#include "ttTime.h"
-
-#ifdef WIN32
-
-#include <stdio.h>
-#include <mapiutil.h>
-
-/*------------*/
-/* NT VERSION */
-/*------------*/
-
-/*********************************************************************
- *
- * FUNCTION: ttGetThreadTimes
- *
- * DESCRIPTION: This function sets the supplied parameter's
- * user and kernel time for the current thread.
- *
- * PARAMETERS: ttThreadTimes* timesP thread time structure
- *
- * RETURNS: void
- *
- * NOTES: NONE
- *
- *********************************************************************/
-
-void
-ttGetThreadTimes(ttThreadTimes* timesP)
-{
- BOOL rc;
- HANDLE curThread;
- FILETIME creationTime;
- FILETIME exitTime;
- FILETIME kTime;
- FILETIME uTime;
-
- memset (&kTime, 0, sizeof (FILETIME));
- memset (&uTime, 0, sizeof (FILETIME));
-
- curThread = GetCurrentThread();
- rc = GetThreadTimes(curThread,
- &creationTime,
- &exitTime,
- &kTime,
- &uTime);
-
- timesP->kernelTime = kTime;
- timesP->userTime = uTime;
-
-}
-
-/*********************************************************************
- *
- * FUNCTION: ttCalcElapsedThreadTimes
- *
- * DESCRIPTION: This function calculates the user and kernel
- * time deltas.
- *
- * PARAMETERS: ttThreadTimes* beforeP beginning timestamp (IN)
- * ttThreadTimes* afterP ending timestamp (IN)
- * double* kernelDeltaP kernel time delta (OUT)
- * double* userDeltaP user time delta (OUT)
- *
- * RETURNS: void
- *
- * NOTES: NONE
- *
- *********************************************************************/
-
-void
-ttCalcElapsedThreadTimes(ttThreadTimes* beforeP,
- ttThreadTimes* afterP,
- double* kernelDeltaP,
- double* userDeltaP)
-{
- static const double secPerHi = (double) 4.294967296; /* 2**32 * 10**-9 */
- FILETIME *before, *after;
-
- before = &beforeP->kernelTime;
- after = &afterP->kernelTime;
- *kernelDeltaP = (double) ((after->dwHighDateTime - before->dwHighDateTime) * secPerHi
- + (after->dwLowDateTime - before->dwLowDateTime) * 100e-9);
- before = &beforeP->userTime;
- after = &afterP->userTime;
- *userDeltaP = (double) ((after->dwHighDateTime - before->dwHighDateTime) * secPerHi
- + (after->dwLowDateTime - before->dwLowDateTime) * 100e-9);
-}
-
-/*********************************************************************
- *
- * FUNCTION: ttGetWallClockTime
- *
- * DESCRIPTION: This function gets the current wall-clock time.
- *
- * PARAMETERS: ttWallClockTime* timeP tms time structure (OUT)
- *
- * RETURNS: void
- *
- * NOTES: NONE
- *
- *********************************************************************/
-
-void
-ttGetWallClockTime(ttWallClockTime* timeP)
-{
- LARGE_INTEGER frequency;
- if ( QueryPerformanceFrequency(&frequency) ) {
- QueryPerformanceCounter(&(timeP->time64));
- }
- else {
- _ftime(&(timeP->notSoLargeTime));
- }
-}
-
-/*********************************************************************
- *
- * FUNCTION: ttCalcElapsedWallClockTime
- *
- * DESCRIPTION: This function calculates the elapsed wall-clock
- * time in msec.
- *
- * PARAMETERS: ttWallClockTime* beforeP starting timestamp
- * ttWallClockTime* afterP ending timestamp
- * double* nmillisecondsP elapsed time (OUT)
- *
- * RETURNS: void
- *
- * NOTES: NONE
- *
- *********************************************************************/
-
-void
-ttCalcElapsedWallClockTime(ttWallClockTime* beforeP,
- ttWallClockTime* afterP,
- double* nmillisecondsP)
-{
- LARGE_INTEGER frequency;
-
- if ( QueryPerformanceFrequency(&frequency) ) {
- *nmillisecondsP = 1000 * ((double) (afterP->time64.QuadPart
- - beforeP->time64.QuadPart))
- / frequency.QuadPart;
-
- }
- else {
- double start;
- double end;
-
- start = (double) beforeP->notSoLargeTime.time * 1000. +
- (double) beforeP->notSoLargeTime.millitm;
- end = (double) afterP->notSoLargeTime.time * 1000. +
- (double) afterP->notSoLargeTime.millitm;
-
- *nmillisecondsP = (double) (end - start);
- }
-}
-
-#elif defined (RTSYS_VXWORKS)
-
-/*-----------------*/
-/* VxWorks VERSION */
-/*-----------------*/
-
-/*
- * The TimeBase registers have a period of 60ns, i.e.
- * 0.00000006 or (6e-8) seconds.
- */
-#define TIMER_MSEC_PER_CYC (6e-5)
-
-void
-ttGetWallClockTime(ttWallClockTime* timeP)
-{
- vxTimeBaseGet(&timeP->sep.upper32, &timeP->sep.lower32);
-}
-
-
-void
-ttCalcElapsedWallClockTime(ttWallClockTime* beforeP,
- ttWallClockTime* afterP,
- double* nmillisecondsP)
-{
- *nmillisecondsP = (double)(afterP->val - beforeP->val) * TIMER_MSEC_PER_CYC;
-}
-
-
-#else
-
-/*--------------*/
-/* UNIX VERSION */
-/*--------------*/
-
-#include <unistd.h>
-
-/*********************************************************************
- *
- * FUNCTION: ttGetThreadTimes
- *
- * DESCRIPTION: This function sets the supplied parameter's
- * tms structure.
- *
- * PARAMETERS: ttThreadTimes* timesP tms time structure
- *
- * RETURNS: void
- *
- * NOTES: NONE
- *
- *********************************************************************/
-
-#ifdef SB_P_OS_CHORUS
-void ttGetThreadTimes(ttThreadTimes* timesP)
-{
- KnCap actorCap;
-
- if (acap (agetId(), &actorCap) == -1) {
- timesP->ins.tmSec = 0;
- timesP->ins.tmNSec = 0;
- timesP->ext.tmSec = 0;
- timesP->ext.tmNSec = 0;
- }
- else {
- (void) threadTimes (&actorCap, K_ALLACTORTHREADS,
- &timesP->ins, &timesP->ext);
- }
-}
-#else
-void ttGetThreadTimes(ttThreadTimes* timesP)
-{
- (void) times(timesP);
-}
-#endif
-
-/*********************************************************************
- *
- * FUNCTION: ttCalcElapsedThreadTimes
- *
- * DESCRIPTION: This function calculates the user and kernel
- * time deltas.
- *
- * PARAMETERS: ttThreadTimes* beforeP beginning timestamp (IN)
- * ttThreadTimes* afterP ending timestamp (IN)
- * double* kernelDeltaP kernel time delta (OUT)
- * double* userDeltaP user time delta (OUT)
- *
- * RETURNS: void
- *
- * NOTES: NONE
- *
- *********************************************************************/
-
-#ifdef SB_P_OS_CHORUS
-void
-ttCalcElapsedThreadTimes(ttThreadTimes* beforeP,
- ttThreadTimes* afterP,
- double* kernelDeltaP,
- double* userDeltaP)
-{
- double kernelBefore;
- double kernelAfter;
- double userBefore;
- double userAfter;
-
- kernelBefore = (beforeP->ext.tmSec) + (beforeP->ext.tmNSec / 1e9);
- kernelAfter = (afterP->ext.tmSec) + (afterP->ext.tmNSec / 1e9);
- *kernelDeltaP = kernelAfter - kernelBefore;
-
- userBefore = (beforeP->ins.tmSec) + (beforeP->ins.tmNSec / 1e9);
- userAfter = (afterP->ins.tmSec) + (afterP->ins.tmNSec / 1e9);
- *userDeltaP = userAfter - userBefore;
-
-}
-#else
-void
-ttCalcElapsedThreadTimes(ttThreadTimes* beforeP,
- ttThreadTimes* afterP,
- double* kernelDeltaP,
- double* userDeltaP)
-{
- double ticks = (double)sysconf(_SC_CLK_TCK);
-
- *kernelDeltaP = (afterP->tms_stime - beforeP->tms_stime) / ticks;
- *userDeltaP = (afterP->tms_utime - beforeP->tms_utime) / ticks;
-}
-#endif
-
-/*********************************************************************
- *
- * FUNCTION: ttGetWallClockTime
- *
- * DESCRIPTION: This function gets the current wall-clock time.
- *
- * PARAMETERS: ttWallClockTime* timeP tms time structure (OUT)
- *
- * RETURNS: void
- *
- * NOTES: NONE
- *
- *********************************************************************/
-
-void
-ttGetWallClockTime(ttWallClockTime* timeP)
-{
- gettimeofday(timeP, NULL);
-}
-
-/*********************************************************************
- *
- * FUNCTION: ttCalcElapsedWallClockTime
- *
- * DESCRIPTION: This function calculates the elapsed wall-clock
- * time is msec.
- *
- * PARAMETERS: ttWallClockTime* beforeP starting timestamp
- * ttWallClockTime* afterP ending timestamp
- * double* nmillisecondsP elapsed time (OUT)
- *
- * RETURNS: void
- *
- * NOTES: NONE
- *
- *********************************************************************/
-
-void
-ttCalcElapsedWallClockTime(ttWallClockTime* beforeP,
- ttWallClockTime* afterP,
- double* nmillisP)
-{
- *nmillisP = (afterP->tv_sec - beforeP->tv_sec)*1000.0 +
- (afterP->tv_usec - beforeP->tv_usec)/1000.0;
-}
-
-#endif
-
-/* Emacs variable settings */
-/* Local Variables: */
-/* tab-width:8 */
-/* indent-tabs-mode:nil */
-/* c-basic-offset:2 */
-/* End: */
diff --git a/ndb/test/odbc/tpcb/ttTime.h b/ndb/test/odbc/tpcb/ttTime.h
deleted file mode 100644
index f78b71667fe..00000000000
--- a/ndb/test/odbc/tpcb/ttTime.h
+++ /dev/null
@@ -1,125 +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 */
-
-/*
- * $Revision: 1.1 $
- * (c) Copyright 1996-2003, TimesTen, Inc.
- * All rights reserved.
- *
- */
-
-#ifndef __TT_TIME
-#define __TT_TIME
-
-
-#ifdef WIN32
-
-#include <windows.h>
-#include <sys/types.h>
-#include <sys/timeb.h>
-
-typedef struct {
- FILETIME kernelTime;
- FILETIME userTime;
-} ttThreadTimes;
-
-
-typedef union {
- LARGE_INTEGER time64;
- struct _timeb notSoLargeTime;
-} ttWallClockTime;
-
-#elif defined(RTSYS_VXWORKS)
-
-#define srand48(x) sb_srand48((x))
-#define drand48() sb_drand48()
-
-#ifdef SB_P_OS_VXPPC
-/* For little-endian switch the lower, upper fields */
-typedef union {
- struct {
- unsigned int upper32;
- unsigned int lower32;
- } sep;
- long long val;
-} ttWallClockTime;
-
-/*
- * This is a VxWorks private function to read the PPC's 64 bit Time Base
- * Register. This is the assembler dump of this function.
- 001126e4 7cad42e6 mftb r5, TBU
- 001126e8 7ccc42e6 mftb r6, TBL
- 001126ec 7ced42e6 mftb r7, TBU
- 001126f0 7c053800 cmp crf0, 0, r5, r7
- 001126f4 4082fff0 bc 0x4, 0x2, vxTimeBaseGet
- 001126f8 90a30000 stw r5, 0x0(r3)
- 001126fc 90c40000 stw r6, 0x0(r4)
- 00112700 4e800020 blr
- * This is a fine grained timer with a period of 60ns.
- */
-void vxTimeBaseGet(unsigned int* pUpper32, unsigned int* pLower32);
-#endif /* SB_P_OS_VXPPC */
-
-#elif defined(SB_P_OS_CHORUS)
-#include <sys/types.h>
-#include <sys/times.h>
-#include <sys/time.h>
-
-#include <vtimer/chVtimer.h>
-
-struct chrTimes {
- KnTimeVal ins;
- KnTimeVal ext;
-};
-typedef struct chrTimes ttThreadTimes;
-
-typedef struct timeval ttWallClockTime;
-
-#else
-/* UNIX version */
-
-#include <sys/times.h>
-#include <sys/time.h>
-
-typedef struct tms ttThreadTimes;
-
-typedef struct timeval ttWallClockTime;
-
-#endif /* NT, VxWorks, Chorus, Unix */
-
-
-#ifndef RTSYS_VXWORKS
-void ttGetThreadTimes(ttThreadTimes* timesP);
-void ttCalcElapsedThreadTimes(ttThreadTimes* beforeP, ttThreadTimes* afterP,
- double* kernelDeltaP, double* userDeltaP);
-#endif /* ! VXWORKS */
-void ttGetWallClockTime(ttWallClockTime* timeP);
-void ttCalcElapsedWallClockTime(ttWallClockTime* beforeP,
- ttWallClockTime* afterP,
- double* nmillisecondsP);
-
-
-
-
-
-#endif /* __TT_TIME */
-
-/* Emacs variable settings */
-/* Local Variables: */
-/* tab-width:8 */
-/* indent-tabs-mode:nil */
-/* c-basic-offset:2 */
-/* End: */
diff --git a/ndb/test/run-test/Makefile.am b/ndb/test/run-test/Makefile.am
index 3bf2edde47a..1eac96e7ac7 100644
--- a/ndb/test/run-test/Makefile.am
+++ b/ndb/test/run-test/Makefile.am
@@ -11,8 +11,9 @@ test_SCRIPTS=atrt-analyze-result.sh atrt-gather-result.sh atrt-setup.sh \
atrt-clear-result.sh make-config.sh make-index.sh make-html-reports.sh
atrt_SOURCES = main.cpp
-INCLUDES_LOC = -I$(top_srcdir)/ndb/src/mgmclient
+INCLUDES_LOC = -I$(top_srcdir)/ndb/test/include -I$(top_srcdir)/ndb/src/mgmclient
LDADD_LOC = $(top_builddir)/ndb/src/mgmclient/CpcClient.o \
+ $(top_builddir)/ndb/test/src/libNDBT.a \
$(top_builddir)/ndb/src/libndbclient.la \
$(top_builddir)/dbug/libdbug.a \
$(top_builddir)/mysys/libmysys.a \
diff --git a/ndb/test/run-test/main.cpp b/ndb/test/run-test/main.cpp
index 22799a9a1b2..e5f73bc6a5c 100644
--- a/ndb/test/run-test/main.cpp
+++ b/ndb/test/run-test/main.cpp
@@ -459,7 +459,7 @@ setup_config(atrt_config& config){
proc.m_type = atrt_process::NDB_MGM;
proc.m_proc.m_name.assfmt("%d-%s", index, "ndb_mgmd");
proc.m_proc.m_path.assign(dir).append("/libexec/ndb_mgmd");
- proc.m_proc.m_args = "--nodaemon -c initconfig.txt";
+ proc.m_proc.m_args = "--nodaemon -f config.ini";
proc.m_proc.m_cwd.appfmt("%d.ndb_mgmd", index);
connect_string.appfmt("host=%s:%d;",
proc.m_hostname.c_str(), proc.m_ndb_mgm_port);
diff --git a/ndb/test/src/Makefile.am b/ndb/test/src/Makefile.am
index a513086dc33..a8f34a0ea22 100644
--- a/ndb/test/src/Makefile.am
+++ b/ndb/test/src/Makefile.am
@@ -9,7 +9,7 @@ libNDBT_a_SOURCES = \
HugoAsynchTransactions.cpp UtilTransactions.cpp \
NdbRestarter.cpp NdbRestarts.cpp NDBT_Output.cpp \
NdbBackup.cpp NdbConfig.cpp NdbGrep.cpp NDBT_Table.cpp \
- NdbSchemaCon.cpp NdbSchemaOp.cpp
+ NdbSchemaCon.cpp NdbSchemaOp.cpp getarg.c
INCLUDES_LOC = -I$(top_srcdir)/ndb/src/common/mgmcommon -I$(top_srcdir)/ndb/include/mgmcommon -I$(top_srcdir)/ndb/include/kernel -I$(top_srcdir)/ndb/src/mgmapi
diff --git a/ndb/src/common/util/getarg.c b/ndb/test/src/getarg.c
index 99b2840a5a6..9f03af69824 100644
--- a/ndb/src/common/util/getarg.c
+++ b/ndb/test/src/getarg.c
@@ -36,15 +36,33 @@
#include "getarg.h"
-#define ISFLAG(X) ((X).type == arg_flag || (X).type == arg_negative_flag)
-
#ifndef HAVE_STRLCPY
-extern size_t strlcpy (char *dst, const char *src, size_t dst_sz);
-#endif /* !HAVE_STRLCPY */
-
+static size_t
+strlcpy (char *dst, const char *src, size_t dst_sz)
+{
+ size_t n;
+ char *p;
+ for (p = dst, n = 0;
+ n + 1 < dst_sz && *src != '\0';
+ ++p, ++src, ++n)
+ *p = *src;
+ *p = '\0';
+ if (*src == '\0')
+ return n;
+ else
+ return n + strlen (src);
+}
+#endif
#ifndef HAVE_STRLCAT
-extern size_t strlcat (char *dst, const char *src, size_t dst_sz);
-#endif /* !HAVE_STRLCAT */
+static size_t
+strlcat (char *dst, const char *src, size_t dst_sz)
+{
+ size_t len = strlen(dst);
+ return len + strlcpy (dst + len, src, dst_sz - len);
+}
+#endif
+
+#define ISFLAG(X) ((X).type == arg_flag || (X).type == arg_negative_flag)
#ifndef max
#define max(a, b) (a) > (b) ? (a) : (b)
diff --git a/ndb/tools/delete_all.cpp b/ndb/tools/delete_all.cpp
index aa5798376ae..a4fd73a5128 100644
--- a/ndb/tools/delete_all.cpp
+++ b/ndb/tools/delete_all.cpp
@@ -15,41 +15,65 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h>
+#include <ndb_opts.h>
#include <NdbOut.hpp>
#include <NdbApi.hpp>
#include <NdbSleep.h>
#include <NDBT.hpp>
-#include <getarg.h>
-
static int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, int parallelism=240);
-int main(int argc, const char** argv){
- ndb_init();
-
- const char* _tabname = NULL;
- const char* _dbname = "TEST_DB";
- int _help = 0;
-
- struct getargs args[] = {
- { "usage", '?', arg_flag, &_help, "Print help", "" },
- { "database", 'd', arg_string, &_dbname, "dbname",
- "Name of database table is in"}
- };
- int num_args = sizeof(args) / sizeof(args[0]);
- int optind = 0;
+static const char* opt_connect_str= 0;
+static const char* _dbname = "TEST_DB";
+static struct my_option my_long_options[] =
+{
+ NDB_STD_OPTS("ndb_desc"),
+ { "database", 'd', "Name of database table is in",
+ (gptr*) &_dbname, (gptr*) &_dbname, 0,
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
+};
+static void print_version()
+{
+ printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
+}
+static void usage()
+{
char desc[] =
"tabname\n"\
"This program will delete all records in the specified table using scan delete.\n";
-
- if(getarg(args, num_args, argc, argv, &optind) ||
- argv[optind] == NULL || _help) {
- arg_printusage(args, num_args, argv[0], desc);
- return NDBT_ProgramExit(NDBT_WRONGARGS);
+ print_version();
+ my_print_help(my_long_options);
+ my_print_variables(my_long_options);
+}
+static my_bool
+get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
+ char *argument)
+{
+ switch (optid) {
+ case '#':
+ DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_delete_all.trace");
+ break;
+ case 'V':
+ print_version();
+ exit(0);
+ case '?':
+ usage();
+ exit(0);
}
- _tabname = argv[optind];
+ return 0;
+}
+int main(int argc, char** argv){
+ NDB_INIT(argv[0]);
+ const char *load_default_groups[]= { "ndb_tools",0 };
+ load_defaults("my",load_default_groups,&argc,&argv);
+ int ho_error;
+ if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
+ return NDBT_ProgramExit(NDBT_WRONGARGS);
+
+ Ndb::setConnectString(opt_connect_str);
// Connect to Ndb
Ndb MyNdb(_dbname);
@@ -64,13 +88,12 @@ int main(int argc, const char** argv){
// Check if table exists in db
int res = NDBT_OK;
- for(int i = optind; i<argc; i++){
+ for(int i = 0; i<argc; i++){
const NdbDictionary::Table * pTab = NDBT_Table::discoverTableFromDb(&MyNdb, argv[i]);
if(pTab == NULL){
- ndbout << " Table " << _tabname << " does not exist!" << endl;
+ ndbout << " Table " << argv[i] << " does not exist!" << endl;
return NDBT_ProgramExit(NDBT_WRONGARGS);
}
-
ndbout << "Deleting all from " << argv[i] << "...";
if(clear_table(&MyNdb, pTab) == NDBT_FAILED){
res = NDBT_FAILED;
diff --git a/ndb/tools/desc.cpp b/ndb/tools/desc.cpp
index 9eed1485a6d..8f7a2031ef0 100644
--- a/ndb/tools/desc.cpp
+++ b/ndb/tools/desc.cpp
@@ -14,40 +14,66 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <getarg.h>
+#include <ndb_global.h>
+#include <ndb_opts.h>
#include <NDBT.hpp>
#include <NdbApi.hpp>
-
-
-
-int main(int argc, const char** argv){
- ndb_init();
- const char* _tabname = NULL;
- const char* _dbname = "TEST_DB";
- int _unqualified = 0;
- int _help = 0;
-
- struct getargs args[] = {
- { "unqualified", 'u', arg_flag, &_unqualified, "unqualified",
- "Use unqualified table names"},
- { "database", 'd', arg_string, &_dbname, "dbname",
- "Name of database table is in"},
- { "usage", '?', arg_flag, &_help, "Print help", "" }
- };
- int num_args = sizeof(args) / sizeof(args[0]);
- int optind = 0;
+static const char* opt_connect_str= 0;
+static const char* _dbname = "TEST_DB";
+static int _unqualified = 0;
+static struct my_option my_long_options[] =
+{
+ NDB_STD_OPTS("ndb_desc"),
+ { "database", 'd', "Name of database table is in",
+ (gptr*) &_dbname, (gptr*) &_dbname, 0,
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
+ { "unqualified", 'u', "Use unqualified table names",
+ (gptr*) &_unqualified, (gptr*) &_unqualified, 0,
+ GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
+};
+static void print_version()
+{
+ printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
+}
+static void usage()
+{
char desc[] =
"tabname\n"\
"This program list all properties of table(s) in NDB Cluster.\n"\
- " ex: desc T1 T2 T4\n";
-
- if(getarg(args, num_args, argc, argv, &optind) ||
- argv[optind] == NULL ||_help) {
- arg_printusage(args, num_args, argv[0], desc);
- return NDBT_ProgramExit(NDBT_WRONGARGS);
+ " ex: desc T1 T2 T4\n";
+ print_version();
+ my_print_help(my_long_options);
+ my_print_variables(my_long_options);
+}
+static my_bool
+get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
+ char *argument)
+{
+ switch (optid) {
+ case '#':
+ DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_desc.trace");
+ break;
+ case 'V':
+ print_version();
+ exit(0);
+ case '?':
+ usage();
+ exit(0);
}
- _tabname = argv[optind];
+ return 0;
+}
+
+int main(int argc, char** argv){
+ NDB_INIT(argv[0]);
+ const char *load_default_groups[]= { "ndb_tools",0 };
+ load_defaults("my",load_default_groups,&argc,&argv);
+ int ho_error;
+ if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
+ return NDBT_ProgramExit(NDBT_WRONGARGS);
+
+ Ndb::setConnectString(opt_connect_str);
Ndb* pMyNdb;
pMyNdb = new Ndb(_dbname);
@@ -60,7 +86,7 @@ int main(int argc, const char** argv){
ndbout << endl;
NdbDictionary::Dictionary * dict = pMyNdb->getDictionary();
- for (int i = optind; i < argc; i++) {
+ for (int i = 0; i < argc; i++) {
NDBT_Table* pTab = (NDBT_Table*)dict->getTable(argv[i]);
if (pTab != 0){
ndbout << (* pTab) << endl;
diff --git a/ndb/tools/drop_index.cpp b/ndb/tools/drop_index.cpp
index 70c29461c23..1d4b454682f 100644
--- a/ndb/tools/drop_index.cpp
+++ b/ndb/tools/drop_index.cpp
@@ -15,38 +15,66 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h>
+#include <ndb_opts.h>
#include <NdbOut.hpp>
#include <NdbApi.hpp>
#include <NDBT.hpp>
-#include <getarg.h>
-
-int main(int argc, const char** argv){
- ndb_init();
-
- const char* _tabname = NULL;
- const char* _dbname = "TEST_DB";
- int _help = 0;
-
- struct getargs args[] = {
- { "database", 'd', arg_string, &_dbname, "dbname",
- "Name of database table is in"},
- { "usage", '?', arg_flag, &_help, "Print help", "" }
- };
- int num_args = sizeof(args) / sizeof(args[0]);
- int optind = 0;
+static const char* opt_connect_str= 0;
+static const char* _dbname = "TEST_DB";
+static struct my_option my_long_options[] =
+{
+ NDB_STD_OPTS("ndb_desc"),
+ { "database", 'd', "Name of database table is in",
+ (gptr*) &_dbname, (gptr*) &_dbname, 0,
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
+};
+static void print_version()
+{
+ printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
+}
+static void usage()
+{
char desc[] =
"<indexname>+\n"\
"This program will drop index(es) in Ndb\n";
+ print_version();
+ my_print_help(my_long_options);
+ my_print_variables(my_long_options);
+}
+static my_bool
+get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
+ char *argument)
+{
+ switch (optid) {
+ case '#':
+ DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_drop_index.trace");
+ break;
+ case 'V':
+ print_version();
+ exit(0);
+ case '?':
+ usage();
+ exit(0);
+ }
+ return 0;
+}
- if(getarg(args, num_args, argc, argv, &optind) ||
- argv[optind] == NULL || _help){
- arg_printusage(args, num_args, argv[0], desc);
+int main(int argc, char** argv){
+ NDB_INIT(argv[0]);
+ const char *load_default_groups[]= { "ndb_tools",0 };
+ load_defaults("my",load_default_groups,&argc,&argv);
+ int ho_error;
+ if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
+ return NDBT_ProgramExit(NDBT_WRONGARGS);
+ if (argc < 1) {
+ usage();
return NDBT_ProgramExit(NDBT_WRONGARGS);
}
- _tabname = argv[optind];
+ Ndb::setConnectString(opt_connect_str);
// Connect to Ndb
Ndb MyNdb(_dbname);
if(MyNdb.init() != 0){
@@ -58,7 +86,7 @@ int main(int argc, const char** argv){
ndbout << "Waiting for ndb to become ready..." << endl;
int res = 0;
- for(int i = optind; i<argc; i++){
+ for(int i = 0; i<argc; i++){
ndbout << "Dropping index " << argv[i] << "...";
int tmp;
if((tmp = MyNdb.getDictionary()->dropIndex(argv[i], 0)) != 0){
diff --git a/ndb/tools/drop_tab.cpp b/ndb/tools/drop_tab.cpp
index 15c229cb0fb..3362c7de47b 100644
--- a/ndb/tools/drop_tab.cpp
+++ b/ndb/tools/drop_tab.cpp
@@ -15,43 +15,66 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h>
+#include <ndb_opts.h>
#include <NdbOut.hpp>
#include <NdbApi.hpp>
#include <NDBT.hpp>
-#include <getarg.h>
-
-int main(int argc, const char** argv){
- ndb_init();
-
- const char* _tabname = NULL;
- const char* _dbname = "TEST_DB";
- const char* _connectstr = NULL;
- int _help = 0;
-
- struct getargs args[] = {
- { "database", 'd', arg_string, &_dbname, "dbname",
- "Name of database table is in"},
- { "connstr", 'c', arg_string, &_connectstr, "connect string",
- "How to connect to NDB"},
- { "usage", '?', arg_flag, &_help, "Print help", "" }
- };
- int num_args = sizeof(args) / sizeof(args[0]);
- int optind = 0;
+static const char* opt_connect_str= 0;
+static const char* _dbname = "TEST_DB";
+static struct my_option my_long_options[] =
+{
+ NDB_STD_OPTS("ndb_desc"),
+ { "database", 'd', "Name of database table is in",
+ (gptr*) &_dbname, (gptr*) &_dbname, 0,
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
+};
+static void print_version()
+{
+ printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
+}
+static void usage()
+{
char desc[] =
"tabname\n"\
"This program will drop one table in Ndb\n";
+ print_version();
+ my_print_help(my_long_options);
+ my_print_variables(my_long_options);
+}
+static my_bool
+get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
+ char *argument)
+{
+ switch (optid) {
+ case '#':
+ DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_drop_table.trace");
+ break;
+ case 'V':
+ print_version();
+ exit(0);
+ case '?':
+ usage();
+ exit(0);
+ }
+ return 0;
+}
- if(getarg(args, num_args, argc, argv, &optind) ||
- argv[optind] == NULL || _help){
- arg_printusage(args, num_args, argv[0], desc);
+int main(int argc, char** argv){
+ NDB_INIT(argv[0]);
+ const char *load_default_groups[]= { "ndb_tools",0 };
+ load_defaults("my",load_default_groups,&argc,&argv);
+ int ho_error;
+ if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
+ return NDBT_ProgramExit(NDBT_WRONGARGS);
+ if (argc < 1) {
+ usage();
return NDBT_ProgramExit(NDBT_WRONGARGS);
}
- _tabname = argv[optind];
-
- if (_connectstr)
- Ndb::setConnectString(_connectstr);
+
+ Ndb::setConnectString(opt_connect_str);
Ndb MyNdb(_dbname);
if(MyNdb.init() != 0){
ERR(MyNdb.getNdbError());
@@ -62,7 +85,7 @@ int main(int argc, const char** argv){
ndbout << "Waiting for ndb to become ready..." << endl;
int res = 0;
- for(int i = optind; i<argc; i++){
+ for(int i = 0; i<argc; i++){
ndbout << "Dropping table " << argv[i] << "...";
int tmp;
if((tmp = MyNdb.getDictionary()->dropTable(argv[i])) != 0){
diff --git a/ndb/tools/listTables.cpp b/ndb/tools/listTables.cpp
index 4fc5bcd7f21..05e864a35c4 100644
--- a/ndb/tools/listTables.cpp
+++ b/ndb/tools/listTables.cpp
@@ -22,7 +22,7 @@
*/
#include <ndb_global.h>
-#include <getarg.h>
+#include <ndb_opts.h>
#include <NdbApi.hpp>
#include <NDBT.hpp>
@@ -161,39 +161,33 @@ list(const char * tabname,
}
}
-#ifndef DBUG_OFF
-const char *debug_option= 0;
-#endif
-
-int main(int argc, const char** argv){
- ndb_init();
- int _loops = 1;
- const char* _tabname = NULL;
- const char* _dbname = "TEST_DB";
- int _type = 0;
- int _help = 0;
- const char* _connect_str = NULL;
-
- struct getargs args[] = {
- { "loops", 'l', arg_integer, &_loops, "loops",
- "Number of times to run(default = 1)" },
- { "unqualified", 'u', arg_flag, &_unqualified, "unqualified",
- "Use unqualified table names"},
- { "database", 'd', arg_string, &_dbname, "dbname",
- "Name of database table is in"},
- { "type", 't', arg_integer, &_type, "type",
- "Type of objects to show, see NdbDictionary.hpp for numbers(default = 0)" },
- { "connect-string", 'c', arg_string, &_connect_str,
- "Set connect string for connecting to ndb_mgmd. <constr>=\"host=<hostname:port>[;nodeid=<id>]\". Overides specifying entries in NDB_CONNECTSTRING and config file",
- "<constr>" },
-#ifndef DBUG_OFF
- { "debug", 0, arg_string, &debug_option,
- "Specify debug options e.g. d:t:i:o,out.trace", "options" },
-#endif
- { "usage", '?', arg_flag, &_help, "Print help", "" }
- };
- int num_args = sizeof(args) / sizeof(args[0]);
- int optind = 0;
+static const char* opt_connect_str= 0;
+static const char* _dbname = "TEST_DB";
+static int _loops;
+static int _type;
+static struct my_option my_long_options[] =
+{
+ NDB_STD_OPTS("ndb_desc"),
+ { "database", 'd', "Name of database table is in",
+ (gptr*) &_dbname, (gptr*) &_dbname, 0,
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
+ { "loops", 'l', "loops",
+ (gptr*) &_loops, (gptr*) &_loops, 0,
+ GET_INT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0 },
+ { "type", 't', "type",
+ (gptr*) &_type, (gptr*) &_type, 0,
+ GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
+ { "unqualified", 'u', "Use unqualified table names",
+ (gptr*) &_unqualified, (gptr*) &_unqualified, 0,
+ GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
+};
+static void print_version()
+{
+ printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
+}
+static void usage()
+{
char desc[] =
"tabname\n"\
"This program list all system objects in NDB Cluster.\n"\
@@ -201,19 +195,39 @@ int main(int argc, const char** argv){
" ex: list_tables -t 2 would show all UserTables\n"\
"To show all indexes for a table write table name as final argument\n"\
" ex: list_tables T1\n";
-
- if(getarg(args, num_args, argc, argv, &optind) || _help) {
- arg_printusage(args, num_args, argv[0], desc);
- return NDBT_ProgramExit(NDBT_WRONGARGS);
+ print_version();
+ my_print_help(my_long_options);
+ my_print_variables(my_long_options);
+}
+static my_bool
+get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
+ char *argument)
+{
+ switch (optid) {
+ case '#':
+ DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_show_tables.trace");
+ break;
+ case 'V':
+ print_version();
+ exit(0);
+ case '?':
+ usage();
+ exit(0);
}
- _tabname = argv[optind];
-
-#ifndef DBUG_OFF
- if (debug_option)
- DBUG_PUSH(debug_option);
-#endif
+ return 0;
+}
+
+int main(int argc, char** argv){
+ NDB_INIT(argv[0]);
+ const char* _tabname;
+ const char *load_default_groups[]= { "ndb_tools",0 };
+ load_defaults("my",load_default_groups,&argc,&argv);
+ int ho_error;
+ if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
+ return NDBT_ProgramExit(NDBT_WRONGARGS);
+ _tabname = argv[0];
- ndb_cluster_connection = new Ndb_cluster_connection(_connect_str);
+ ndb_cluster_connection = new Ndb_cluster_connection(opt_connect_str);
ndb = new Ndb(ndb_cluster_connection, _dbname);
if (ndb->init() != 0)
fatal("init");
diff --git a/ndb/tools/select_all.cpp b/ndb/tools/select_all.cpp
index 9f8108d9f32..758c1e48c88 100644
--- a/ndb/tools/select_all.cpp
+++ b/ndb/tools/select_all.cpp
@@ -16,6 +16,7 @@
#include <ndb_global.h>
+#include <ndb_opts.h>
#include <NdbOut.hpp>
@@ -23,13 +24,8 @@
#include <NdbMain.h>
#include <NDBT.hpp>
#include <NdbSleep.h>
-#include <getarg.h>
#include <NdbScanFilter.hpp>
-#ifndef DBUG_OFF
-const char *debug_option= 0;
-#endif
-
int scanReadRecords(Ndb*,
const NdbDictionary::Table*,
const NdbDictionary::Index*,
@@ -40,39 +36,44 @@ int scanReadRecords(Ndb*,
char delim,
bool orderby);
-int main(int argc, const char** argv){
- ndb_init();
- int _parallelism = 240;
- const char* _delimiter = "\t";
- int _header = true;
- int _useHexFormat = false;
- const char* _tabname = NULL;
- const char* _dbname = "TEST_DB";
- int _help = 0;
- int _lock = 0;
- int _order = 0;
-
- struct getargs args[] = {
- { "database", 'd', arg_string, &_dbname, "dbname",
- "Name of database table is in"},
- { "parallelism", 'p', arg_integer, &_parallelism, "parallelism",
- "parallelism" },
- { "header", 'h', arg_flag, &_header, "Print header", "header" },
- { "useHexFormat", 'x', arg_flag, &_useHexFormat,
- "Output numbers in hexadecimal format", "useHexFormat" },
- { "delimiter", 'd', arg_string, &_delimiter, "Column delimiter",
- "delimiter" },
-#ifndef DBUG_OFF
- { "debug", 0, arg_string, &debug_option,
- "Specify debug options e.g. d:t:i:o,out.trace", "options" },
-#endif
- { "usage", '?', arg_flag, &_help, "Print help", "" },
- { "lock", 'l', arg_integer, &_lock,
- "Read(0), Read-hold(1), Exclusive(2)", "lock"},
- { "order", 'o', arg_flag, &_order, "Sort resultset according to index", ""}
- };
- int num_args = sizeof(args) / sizeof(args[0]);
- int optind = 0;
+static const char* opt_connect_str= 0;
+static const char* _dbname = "TEST_DB";
+static const char* _delimiter = "\t";
+static int _unqualified, _header, _parallelism, _useHexFormat, _lock,
+ _order;
+
+static struct my_option my_long_options[] =
+{
+ NDB_STD_OPTS("ndb_desc"),
+ { "database", 'd', "Name of database table is in",
+ (gptr*) &_dbname, (gptr*) &_dbname, 0,
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
+ { "parallelism", 'p', "parallelism",
+ (gptr*) &_parallelism, (gptr*) &_parallelism, 0,
+ GET_INT, REQUIRED_ARG, 240, 0, 0, 0, 0, 0 },
+ { "lock", 'l', "Read(0), Read-hold(1), Exclusive(2)",
+ (gptr*) &_lock, (gptr*) &_lock, 0,
+ GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
+ { "order", 'o', "Sort resultset according to index",
+ (gptr*) &_order, (gptr*) &_order, 0,
+ GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
+ { "header", 'h', "Print header",
+ (gptr*) &_header, (gptr*) &_header, 0,
+ GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0 },
+ { "useHexFormat", 'x', "Output numbers in hexadecimal format",
+ (gptr*) &_useHexFormat, (gptr*) &_useHexFormat, 0,
+ GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
+ { "delimiter", 'D', "Column delimiter",
+ (gptr*) &_delimiter, (gptr*) &_delimiter, 0,
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
+};
+static void print_version()
+{
+ printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
+}
+static void usage()
+{
char desc[] =
"tabname\n"\
"This program reads all records from one table in NDB Cluster\n"\
@@ -80,19 +81,42 @@ int main(int argc, const char** argv){
"(It only print error messages if it encounters a permanent error.)\n"\
"It can also be used to dump the content of a table to file \n"\
" ex: select_all --no-header --delimiter=';' T4 > T4.data\n";
-
- if(getarg(args, num_args, argc, argv, &optind) ||
- argv[optind] == NULL || _help) {
- arg_printusage(args, num_args, argv[0], desc);
- return NDBT_ProgramExit(NDBT_WRONGARGS);
+ print_version();
+ my_print_help(my_long_options);
+ my_print_variables(my_long_options);
+}
+static my_bool
+get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
+ char *argument)
+{
+ switch (optid) {
+ case '#':
+ DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_select_all.trace");
+ break;
+ case 'V':
+ print_version();
+ exit(0);
+ case '?':
+ usage();
+ exit(0);
}
- _tabname = argv[optind];
+ return 0;
+}
-#ifndef DBUG_OFF
- if (debug_option)
- DBUG_PUSH(debug_option);
-#endif
+int main(int argc, char** argv){
+ NDB_INIT(argv[0]);
+ const char *load_default_groups[]= { "ndb_tools",0 };
+ load_defaults("my",load_default_groups,&argc,&argv);
+ const char* _tabname;
+ int ho_error;
+ if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
+ return NDBT_ProgramExit(NDBT_WRONGARGS);
+ if ((_tabname = argv[0]) == 0) {
+ usage();
+ return NDBT_ProgramExit(NDBT_WRONGARGS);
+ }
+ Ndb::setConnectString(opt_connect_str);
// Connect to Ndb
Ndb MyNdb(_dbname);
@@ -108,8 +132,8 @@ int main(int argc, const char** argv){
// Check if table exists in db
const NdbDictionary::Table* pTab = NDBT_Table::discoverTableFromDb(&MyNdb, _tabname);
const NdbDictionary::Index * pIdx = 0;
- if(optind+1 < argc){
- pIdx = MyNdb.getDictionary()->getIndex(argv[optind+1], _tabname);
+ if(argc > 1){
+ pIdx = MyNdb.getDictionary()->getIndex(argv[0], _tabname);
}
if(pTab == NULL){
diff --git a/ndb/tools/select_count.cpp b/ndb/tools/select_count.cpp
index 6650421e637..6ee49ddbff0 100644
--- a/ndb/tools/select_count.cpp
+++ b/ndb/tools/select_count.cpp
@@ -16,6 +16,7 @@
#include <ndb_global.h>
+#include <ndb_opts.h>
#include <NdbOut.hpp>
@@ -23,7 +24,6 @@
#include <NdbMain.h>
#include <NDBT.hpp>
#include <NdbSleep.h>
-#include <getarg.h>
#include <UtilTransactions.hpp>
static int
@@ -32,34 +32,68 @@ select_count(Ndb* pNdb, const NdbDictionary::Table* pTab,
int* count_rows,
UtilTransactions::ScanLock lock);
-int main(int argc, const char** argv){
- ndb_init();
- const char* _dbname = "TEST_DB";
- int _parallelism = 240;
- int _help = 0;
- int _lock = 0;
-
- struct getargs args[] = {
- { "database", 'd', arg_string, &_dbname, "dbname",
- "Name of database table is in"},
- { "parallelism", 's', arg_integer, &_parallelism, "parallelism", "parallelism" },
- { "usage", '?', arg_flag, &_help, "Print help", "" },
- { "lock", 'l', arg_integer, &_lock,
- "Read(0), Read-hold(1), Exclusive(2)", "lock"}
-
- };
- int num_args = sizeof(args) / sizeof(args[0]);
- int optind = 0;
+static const char* opt_connect_str= 0;
+static const char* _dbname = "TEST_DB";
+static int _parallelism = 240;
+static int _lock = 0;
+static struct my_option my_long_options[] =
+{
+ NDB_STD_OPTS("ndb_desc"),
+ { "database", 'd', "Name of database table is in",
+ (gptr*) &_dbname, (gptr*) &_dbname, 0,
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
+ { "parallelism", 'p', "parallelism",
+ (gptr*) &_parallelism, (gptr*) &_parallelism, 0,
+ GET_INT, REQUIRED_ARG, 240, 0, 0, 0, 0, 0 },
+ { "lock", 'l', "Read(0), Read-hold(1), Exclusive(2)",
+ (gptr*) &_lock, (gptr*) &_lock, 0,
+ GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
+};
+static void print_version()
+{
+ printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
+}
+static void usage()
+{
char desc[] =
"tabname1 ... tabnameN\n"\
"This program will count the number of records in tables\n";
-
- if(getarg(args, num_args, argc, argv, &optind) ||
- argv[optind] == NULL || _help) {
- arg_printusage(args, num_args, argv[0], desc);
+ print_version();
+ my_print_help(my_long_options);
+ my_print_variables(my_long_options);
+}
+static my_bool
+get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
+ char *argument)
+{
+ switch (optid) {
+ case '#':
+ DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_select_count.trace");
+ break;
+ case 'V':
+ print_version();
+ exit(0);
+ case '?':
+ usage();
+ exit(0);
+ }
+ return 0;
+}
+
+int main(int argc, char** argv){
+ NDB_INIT(argv[0]);
+ const char *load_default_groups[]= { "ndb_tools",0 };
+ load_defaults("my",load_default_groups,&argc,&argv);
+ int ho_error;
+ if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
+ return NDBT_ProgramExit(NDBT_WRONGARGS);
+ if (argc < 1) {
+ usage();
return NDBT_ProgramExit(NDBT_WRONGARGS);
}
+ Ndb::setConnectString(opt_connect_str);
// Connect to Ndb
Ndb MyNdb(_dbname);
@@ -72,7 +106,7 @@ int main(int argc, const char** argv){
while(MyNdb.waitUntilReady() != 0)
ndbout << "Waiting for ndb to become ready..." << endl;
- for(int i = optind; i<argc; i++){
+ for(int i = 0; i<argc; i++){
// Check if table exists in db
const NdbDictionary::Table * pTab = NDBT_Table::discoverTableFromDb(&MyNdb, argv[i]);
if(pTab == NULL){
diff --git a/ndb/tools/waiter.cpp b/ndb/tools/waiter.cpp
index c01a3f9192e..c9e76bb8ed3 100644
--- a/ndb/tools/waiter.cpp
+++ b/ndb/tools/waiter.cpp
@@ -16,11 +16,12 @@
#include <ndb_global.h>
+#include <ndb_opts.h>
+
#include <mgmapi.h>
#include <NdbMain.h>
#include <NdbOut.hpp>
#include <NdbSleep.h>
-#include <getarg.h>
#include <kernel/ndb_limits.h>
#include "../include/mgmcommon/LocalConfig.hpp"
@@ -29,34 +30,59 @@
int
waitClusterStatus(const char* _addr, ndb_mgm_node_status _status, unsigned int _timeout);
-int main(int argc, const char** argv){
- ndb_init();
+static const char* opt_connect_str= 0;
+static int _no_contact = 0;
+static int _timeout = 120;
+static struct my_option my_long_options[] =
+{
+ NDB_STD_OPTS("ndb_desc"),
+ { "no-contact", 'n', "Wait for cluster no contact",
+ (gptr*) &_no_contact, (gptr*) &_no_contact, 0,
+ GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
+ { "timeout", 't', "Timeout to wait",
+ (gptr*) &_timeout, (gptr*) &_timeout, 0,
+ GET_INT, REQUIRED_ARG, 120, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
+};
+static void print_version()
+{
+ printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
+}
+static void usage()
+{
+ print_version();
+ my_print_help(my_long_options);
+ my_print_variables(my_long_options);
+}
+static my_bool
+get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
+ char *argument)
+{
+ switch (optid) {
+ case '#':
+ DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_drop_table.trace");
+ break;
+ case 'V':
+ print_version();
+ exit(0);
+ case '?':
+ usage();
+ exit(0);
+ }
+ return 0;
+}
+int main(int argc, char** argv){
+ NDB_INIT(argv[0]);
+ const char *load_default_groups[]= { "ndb_tools",0 };
+ load_defaults("my",load_default_groups,&argc,&argv);
const char* _hostName = NULL;
- int _no_contact = 0;
- int _help = 0;
- int _timeout = 120;
-
- struct getargs args[] = {
- { "timeout", 0, arg_integer, &_timeout, "Timeout to wait", "#" },
- { "no-contact", 0, arg_flag, &_no_contact, "Wait for cluster no contact", "" },
- { "usage", '?', arg_flag, &_help, "Print help", "" }
- };
-
- int num_args = sizeof(args) / sizeof(args[0]);
- int optind = 0;
- char desc[] =
- "hostname:port\n"\
- "This program will connect to the mgmsrv of a NDB cluster.\n"\
- "It will then wait for all nodes to be started\n";
-
- if(getarg(args, num_args, argc, argv, &optind) || _help) {
- arg_printusage(args, num_args, argv[0], desc);
+ int ho_error;
+ if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
return NDBT_ProgramExit(NDBT_WRONGARGS);
- }
char buf[255];
- _hostName = argv[optind];
+ _hostName = argv[0];
if (_hostName == NULL){
LocalConfig lcfg;
diff --git a/sql/field.cc b/sql/field.cc
index 7a8f59c25fe..1275e1bbb8e 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -547,7 +547,8 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs)
/* Convert character set if the old one is multi byte */
if (cs->mbmaxlen > 1)
{
- tmp.copy(from, len, cs, &my_charset_bin);
+ uint dummy_errors;
+ tmp.copy(from, len, cs, &my_charset_bin, &dummy_errors);
from= tmp.ptr();
len= tmp.length();
}
@@ -4444,6 +4445,7 @@ void Field_string::sort_string(char *to,uint length)
void Field_string::sql_type(String &res) const
{
+ THD *thd= table->in_use;
CHARSET_INFO *cs=res.charset();
ulong length= cs->cset->snprintf(cs,(char*) res.ptr(),
res.alloced_length(), "%s(%d)",
@@ -4454,6 +4456,9 @@ void Field_string::sql_type(String &res) const
(has_charset() ? "char" : "binary")),
(int) field_length / charset()->mbmaxlen);
res.length(length);
+ if ((thd->variables.sql_mode & (MODE_MYSQL323 | MODE_MYSQL40)) &&
+ has_charset() && (charset()->state & MY_CS_BINSORT))
+ res.append(" binary");
}
char *Field_string::pack(char *to, const char *from, uint max_length)
@@ -5530,7 +5535,8 @@ int Field_enum::store(const char *from,uint length,CHARSET_INFO *cs)
/* Convert character set if nesessary */
if (String::needs_conversion(length, cs, field_charset, &not_used))
{
- tmpstr.copy(from, length, cs, field_charset);
+ uint dummy_errors;
+ tmpstr.copy(from, length, cs, field_charset, &dummy_errors);
from= tmpstr.ptr();
length= tmpstr.length();
}
@@ -5678,10 +5684,11 @@ void Field_enum::sql_type(String &res) const
bool flag=0;
for (const char **pos= typelib->type_names; *pos; pos++)
{
+ uint dummy_errors;
if (flag)
res.append(',');
/* convert to res.charset() == utf8, then quote */
- enum_item.copy(*pos, strlen(*pos), charset(), res.charset());
+ enum_item.copy(*pos, strlen(*pos), charset(), res.charset(), &dummy_errors);
append_unescaped(&res, enum_item.ptr(), enum_item.length());
flag= 1;
}
@@ -5712,7 +5719,8 @@ int Field_set::store(const char *from,uint length,CHARSET_INFO *cs)
/* Convert character set if nesessary */
if (String::needs_conversion(length, cs, field_charset, &not_used_offset))
{
- tmpstr.copy(from, length, cs, field_charset);
+ uint dummy_errors;
+ tmpstr.copy(from, length, cs, field_charset, &dummy_errors);
from= tmpstr.ptr();
length= tmpstr.length();
}
@@ -5788,10 +5796,11 @@ void Field_set::sql_type(String &res) const
bool flag=0;
for (const char **pos= typelib->type_names; *pos; pos++)
{
+ uint dummy_errors;
if (flag)
res.append(',');
/* convert to res.charset() == utf8, then quote */
- set_item.copy(*pos, strlen(*pos), charset(), res.charset());
+ set_item.copy(*pos, strlen(*pos), charset(), res.charset(), &dummy_errors);
append_unescaped(&res, set_item.ptr(), set_item.length());
flag= 1;
}
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc
index a5d0023b875..ff6b10fe504 100644
--- a/sql/ha_berkeley.cc
+++ b/sql/ha_berkeley.cc
@@ -234,13 +234,13 @@ int berkeley_show_logs(Protocol *protocol)
{
char **all_logs, **free_logs, **a, **f;
int error=1;
- MEM_ROOT show_logs_root;
- MEM_ROOT *old_root=my_pthread_getspecific_ptr(MEM_ROOT*,THR_MALLOC);
+ MEM_ROOT **root_ptr= my_pthread_getspecific_ptr(MEM_ROOT**,THR_MALLOC);
+ MEM_ROOT show_logs_root, *old_mem_root= *root_ptr;
DBUG_ENTER("berkeley_show_logs");
init_sql_alloc(&show_logs_root, BDB_LOG_ALLOC_BLOCK_SIZE,
BDB_LOG_ALLOC_BLOCK_SIZE);
- my_pthread_setspecific_ptr(THR_MALLOC,&show_logs_root);
+ *root_ptr= &show_logs_root;
if ((error= db_env->log_archive(db_env, &all_logs,
DB_ARCH_ABS | DB_ARCH_LOG)) ||
@@ -277,15 +277,17 @@ int berkeley_show_logs(Protocol *protocol)
}
err:
free_root(&show_logs_root,MYF(0));
- my_pthread_setspecific_ptr(THR_MALLOC,old_root);
+ *root_ptr= old_mem_root;
DBUG_RETURN(error);
}
+
static void berkeley_print_error(const char *db_errpfx, char *buffer)
{
sql_print_error("%s: %s",db_errpfx,buffer); /* purecov: tested */
}
+
static void berkeley_noticecall(DB_ENV *db_env, db_notices notice)
{
switch (notice)
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index 722a6259d3d..370458c6e01 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -2318,6 +2318,34 @@ ha_innobase::write_row(
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
table->timestamp_field->set_time();
+ if (user_thd->lex->sql_command == SQLCOM_ALTER_TABLE
+ && num_write_row >= 10000) {
+ /* ALTER TABLE is COMMITted at every 10000 copied rows.
+ The IX table lock for the original table has to be re-issued.
+ As this method will be called on a temporary table where the
+ contents of the original table is being copied to, it is
+ a bit tricky to determine the source table. The cursor
+ position in the source table need not be adjusted after the
+ intermediate COMMIT, since writes by other transactions are
+ being blocked by a MySQL table lock TL_WRITE_ALLOW_READ. */
+ ut_a(prebuilt->trx->mysql_n_tables_locked == 2);
+ ut_a(UT_LIST_GET_LEN(prebuilt->trx->trx_locks) >= 2);
+ dict_table_t* table = lock_get_ix_table(
+ UT_LIST_GET_FIRST(prebuilt->trx->trx_locks));
+ num_write_row = 0;
+ /* Commit the transaction. This will release the table
+ locks, so they have to be acquired again. */
+ innobase_commit(user_thd, prebuilt->trx);
+ /* Note that this transaction is still active. */
+ user_thd->transaction.all.innodb_active_trans = 1;
+ /* Re-acquire the IX table lock on the source table. */
+ row_lock_table_for_mysql(prebuilt, table);
+ /* We will need an IX lock on the destination table. */
+ prebuilt->sql_stat_start = TRUE;
+ }
+
+ num_write_row++;
+
if (last_query_id != user_thd->query_id) {
prebuilt->sql_stat_start = TRUE;
last_query_id = user_thd->query_id;
@@ -4939,7 +4967,7 @@ ha_innobase::external_lock(
if (thd->in_lock_tables &&
thd->variables.innodb_table_locks) {
ulint error;
- error = row_lock_table_for_mysql(prebuilt);
+ error = row_lock_table_for_mysql(prebuilt, 0);
if (error != DB_SUCCESS) {
error = convert_error_code_to_mysql(
diff --git a/sql/ha_innodb.h b/sql/ha_innodb.h
index b74af1db90b..7e337afed0e 100644
--- a/sql/ha_innodb.h
+++ b/sql/ha_innodb.h
@@ -64,6 +64,7 @@ class ha_innobase: public handler
uint last_match_mode;/* match mode of the latest search:
ROW_SEL_EXACT, ROW_SEL_EXACT_PREFIX,
or undefined */
+ uint num_write_row; /* number of write_row() calls */
longlong auto_inc_counter_for_this_stat;
ulong max_supported_row_length(const byte *buf);
@@ -85,7 +86,8 @@ class ha_innobase: public handler
HA_PRIMARY_KEY_IN_READ_INDEX |
HA_TABLE_SCAN_ON_INDEX),
last_dup_key((uint) -1),
- start_of_scan(0)
+ start_of_scan(0),
+ num_write_row(0)
{
}
~ha_innobase() {}
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 7878684718c..b2e115e9779 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -324,7 +324,7 @@ int ha_ndbcluster::ndb_err(NdbConnection *trans)
DBUG_PRINT("info", ("transformed ndbcluster error %d to mysql error %d",
err.code, res));
if (res == HA_ERR_FOUND_DUPP_KEY)
- dupkey= table->primary_key;
+ m_dupkey= table->primary_key;
DBUG_RETURN(res);
}
@@ -551,7 +551,7 @@ int ha_ndbcluster::get_ndb_blobs_value(NdbBlob *last_ndb_blob)
blob_size+= 8 - blob_size % 8;
if (loop == 1)
{
- char *buf= blobs_buffer + offset;
+ char *buf= m_blobs_buffer + offset;
uint32 len= 0xffffffff; // Max uint32
DBUG_PRINT("value", ("read blob ptr=%x len=%u",
(uint)buf, (uint)blob_len));
@@ -563,15 +563,15 @@ int ha_ndbcluster::get_ndb_blobs_value(NdbBlob *last_ndb_blob)
offset+= blob_size;
}
}
- if (loop == 0 && offset > blobs_buffer_size)
+ if (loop == 0 && offset > m_blobs_buffer_size)
{
- my_free(blobs_buffer, MYF(MY_ALLOW_ZERO_PTR));
- blobs_buffer_size= 0;
+ my_free(m_blobs_buffer, MYF(MY_ALLOW_ZERO_PTR));
+ m_blobs_buffer_size= 0;
DBUG_PRINT("value", ("allocate blobs buffer size %u", offset));
- blobs_buffer= my_malloc(offset, MYF(MY_WME));
- if (blobs_buffer == NULL)
+ m_blobs_buffer= my_malloc(offset, MYF(MY_WME));
+ if (m_blobs_buffer == NULL)
DBUG_RETURN(-1);
- blobs_buffer_size= offset;
+ m_blobs_buffer_size= offset;
}
}
DBUG_RETURN(0);
@@ -854,7 +854,7 @@ int ha_ndbcluster::get_ndb_lock_type(enum thr_lock_type type)
{
if (type >= TL_WRITE_ALLOW_WRITE)
return NdbOperation::LM_Exclusive;
- else if (uses_blob_value(retrieve_all_fields))
+ else if (uses_blob_value(m_retrieve_all_fields))
return NdbOperation::LM_Read;
else
return NdbOperation::LM_CommittedRead;
@@ -1018,7 +1018,7 @@ int ha_ndbcluster::pk_read(const byte *key, uint key_len, byte *buf)
{
Field *field= table->field[i];
if ((thd->query_id == field->query_id) ||
- retrieve_all_fields)
+ m_retrieve_all_fields)
{
if (get_ndb_value(op, field, i, buf))
ERR_RETURN(trans->getNdbError());
@@ -1055,7 +1055,7 @@ int ha_ndbcluster::complemented_pk_read(const byte *old_data, byte *new_data)
THD *thd= current_thd;
DBUG_ENTER("complemented_pk_read");
- if (retrieve_all_fields)
+ if (m_retrieve_all_fields)
// We have allready retrieved all fields, nothing to complement
DBUG_RETURN(0);
@@ -1192,12 +1192,12 @@ inline int ha_ndbcluster::next_result(byte *buf)
/*
We can only handle one tuple with blobs at a time.
*/
- if (ops_pending && blobs_pending)
+ if (m_ops_pending && m_blobs_pending)
{
if (execute_no_commit(this,trans) != 0)
DBUG_RETURN(ndb_err(trans));
- ops_pending= 0;
- blobs_pending= FALSE;
+ m_ops_pending= 0;
+ m_blobs_pending= FALSE;
}
check= cursor->nextResult(contact_ndb);
if (check == 0)
@@ -1219,8 +1219,8 @@ inline int ha_ndbcluster::next_result(byte *buf)
all pending update or delete operations should
be sent to NDB
*/
- DBUG_PRINT("info", ("ops_pending: %d", ops_pending));
- if (ops_pending)
+ DBUG_PRINT("info", ("ops_pending: %d", m_ops_pending));
+ if (m_ops_pending)
{
if (current_thd->transaction.on)
{
@@ -1234,7 +1234,7 @@ inline int ha_ndbcluster::next_result(byte *buf)
int res= trans->restart();
DBUG_ASSERT(res == 0);
}
- ops_pending= 0;
+ m_ops_pending= 0;
}
contact_ndb= (check == 2);
@@ -1393,8 +1393,13 @@ int ha_ndbcluster::set_bounds(NdbIndexScanOperation *op,
// Set bound if not cancelled via type -1
if (p.bound_type != -1)
- if (op->setBound(field->field_name, p.bound_type, p.bound_ptr))
+ {
+ char truncated_field_name[NDB_MAX_ATTR_NAME_SIZE];
+ strnmov(truncated_field_name,field->field_name,sizeof(truncated_field_name));
+ truncated_field_name[sizeof(truncated_field_name)-1]= '\0';
+ if (op->setBound(truncated_field_name, p.bound_type, p.bound_ptr))
ERR_RETURN(op->getNdbError());
+ }
}
}
@@ -1418,7 +1423,7 @@ int ha_ndbcluster::define_read_attrs(byte* buf, NdbOperation* op)
Field *field= table->field[i];
if ((thd->query_id == field->query_id) ||
(field->flags & PRI_KEY_FLAG) ||
- retrieve_all_fields)
+ m_retrieve_all_fields)
{
if (get_ndb_value(op, field, i, buf))
ERR_RETURN(op->getNdbError());
@@ -1663,9 +1668,9 @@ int ha_ndbcluster::write_row(byte *record)
if (has_auto_increment)
{
- skip_auto_increment= FALSE;
+ m_skip_auto_increment= FALSE;
update_auto_increment();
- skip_auto_increment= !auto_increment_column_changed;
+ m_skip_auto_increment= !auto_increment_column_changed;
}
if ((res= set_primary_key(op)))
@@ -1680,7 +1685,7 @@ int ha_ndbcluster::write_row(byte *record)
if (!(field->flags & PRI_KEY_FLAG) &&
set_ndb_value(op, field, i, &set_blob_value))
{
- skip_auto_increment= TRUE;
+ m_skip_auto_increment= TRUE;
ERR_RETURN(op->getNdbError());
}
}
@@ -1692,25 +1697,25 @@ int ha_ndbcluster::write_row(byte *record)
to NoCommit the transaction between each row.
Find out how this is detected!
*/
- rows_inserted++;
+ m_rows_inserted++;
no_uncommitted_rows_update(1);
- bulk_insert_not_flushed= TRUE;
- if ((rows_to_insert == 1) ||
- ((rows_inserted % bulk_insert_rows) == 0) ||
+ m_bulk_insert_not_flushed= TRUE;
+ if ((m_rows_to_insert == 1) ||
+ ((m_rows_inserted % m_bulk_insert_rows) == 0) ||
set_blob_value)
{
THD *thd= current_thd;
// Send rows to NDB
DBUG_PRINT("info", ("Sending inserts to NDB, "\
"rows_inserted:%d, bulk_insert_rows: %d",
- (int)rows_inserted, (int)bulk_insert_rows));
+ (int)m_rows_inserted, (int)m_bulk_insert_rows));
- bulk_insert_not_flushed= FALSE;
+ m_bulk_insert_not_flushed= FALSE;
if (thd->transaction.on)
{
if (execute_no_commit(this,trans) != 0)
{
- skip_auto_increment= TRUE;
+ m_skip_auto_increment= TRUE;
no_uncommitted_rows_execute_failure();
DBUG_RETURN(ndb_err(trans));
}
@@ -1719,7 +1724,7 @@ int ha_ndbcluster::write_row(byte *record)
{
if (execute_commit(this,trans) != 0)
{
- skip_auto_increment= TRUE;
+ m_skip_auto_increment= TRUE;
no_uncommitted_rows_execute_failure();
DBUG_RETURN(ndb_err(trans));
}
@@ -1727,7 +1732,7 @@ int ha_ndbcluster::write_row(byte *record)
DBUG_ASSERT(res == 0);
}
}
- if ((has_auto_increment) && (skip_auto_increment))
+ if ((has_auto_increment) && (m_skip_auto_increment))
{
Uint64 next_val= (Uint64) table->next_number_field->val_int() + 1;
DBUG_PRINT("info",
@@ -1737,7 +1742,7 @@ int ha_ndbcluster::write_row(byte *record)
DBUG_PRINT("info",
("Setting next auto increment value to %u", next_val));
}
- skip_auto_increment= TRUE;
+ m_skip_auto_increment= TRUE;
DBUG_RETURN(0);
}
@@ -1817,7 +1822,9 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data)
}
// Delete old row
DBUG_PRINT("info", ("insert succeded"));
+ m_primary_key_update= TRUE;
delete_res= delete_row(old_data);
+ m_primary_key_update= FALSE;
if (delete_res)
{
DBUG_PRINT("info", ("delete failed"));
@@ -1840,9 +1847,9 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data)
DBUG_PRINT("info", ("Calling updateTuple on cursor"));
if (!(op= cursor->updateTuple()))
ERR_RETURN(trans->getNdbError());
- ops_pending++;
+ m_ops_pending++;
if (uses_blob_value(FALSE))
- blobs_pending= TRUE;
+ m_blobs_pending= TRUE;
}
else
{
@@ -1919,7 +1926,7 @@ int ha_ndbcluster::delete_row(const byte *record)
DBUG_PRINT("info", ("Calling deleteTuple on cursor"));
if (cursor->deleteTuple() != 0)
ERR_RETURN(trans->getNdbError());
- ops_pending++;
+ m_ops_pending++;
no_uncommitted_rows_update(-1);
@@ -1949,8 +1956,10 @@ int ha_ndbcluster::delete_row(const byte *record)
else
{
int res;
- if ((res= set_primary_key(op)))
- return res;
+ if ((res= (m_primary_key_update ?
+ set_primary_key_from_old_data(op, record)
+ : set_primary_key(op))))
+ return res;
}
}
@@ -2412,18 +2421,18 @@ int ha_ndbcluster::close_scan()
DBUG_RETURN(1);
- if (ops_pending)
+ if (m_ops_pending)
{
/*
Take over any pending transactions to the
deleteing/updating transaction before closing the scan
*/
- DBUG_PRINT("info", ("ops_pending: %d", ops_pending));
+ DBUG_PRINT("info", ("ops_pending: %d", m_ops_pending));
if (execute_no_commit(this,trans) != 0) {
no_uncommitted_rows_execute_failure();
DBUG_RETURN(ndb_err(trans));
}
- ops_pending= 0;
+ m_ops_pending= 0;
}
cursor->close();
@@ -2558,7 +2567,7 @@ void ha_ndbcluster::info(uint flag)
if (flag & HA_STATUS_ERRKEY)
{
DBUG_PRINT("info", ("HA_STATUS_ERRKEY"));
- errkey= dupkey;
+ errkey= m_dupkey;
}
if (flag & HA_STATUS_AUTO)
DBUG_PRINT("info", ("HA_STATUS_AUTO"));
@@ -2653,7 +2662,8 @@ int ha_ndbcluster::extra(enum ha_extra_function operation)
m_use_write= TRUE;
} else
{
- m_ignore_dup_key_not_supported= TRUE;
+ if (table->keys)
+ m_ignore_dup_key_not_supported= TRUE;
}
break;
case HA_EXTRA_NO_IGNORE_DUP_KEY:
@@ -2666,7 +2676,7 @@ int ha_ndbcluster::extra(enum ha_extra_function operation)
where field->query_id is the same as
the current query id */
DBUG_PRINT("info", ("HA_EXTRA_RETRIEVE_ALL_COLS"));
- retrieve_all_fields= TRUE;
+ m_retrieve_all_fields= TRUE;
break;
case HA_EXTRA_PREPARE_FOR_DELETE:
DBUG_PRINT("info", ("HA_EXTRA_PREPARE_FOR_DELETE"));
@@ -2712,8 +2722,8 @@ void ha_ndbcluster::start_bulk_insert(ha_rows rows)
DBUG_ENTER("start_bulk_insert");
DBUG_PRINT("enter", ("rows: %d", (int)rows));
- rows_inserted= 0;
- rows_to_insert= rows;
+ m_rows_inserted= 0;
+ m_rows_to_insert= rows;
/*
Calculate how many rows that should be inserted
@@ -2727,7 +2737,7 @@ void ha_ndbcluster::start_bulk_insert(ha_rows rows)
batch= bytesperbatch/bytes;
batch= batch == 0 ? 1 : batch;
DBUG_PRINT("info", ("batch: %d, bytes: %d", batch, bytes));
- bulk_insert_rows= batch;
+ m_bulk_insert_rows= batch;
DBUG_VOID_RETURN;
}
@@ -2741,22 +2751,22 @@ int ha_ndbcluster::end_bulk_insert()
DBUG_ENTER("end_bulk_insert");
// Check if last inserts need to be flushed
- if (bulk_insert_not_flushed)
+ if (m_bulk_insert_not_flushed)
{
NdbConnection *trans= m_active_trans;
// Send rows to NDB
DBUG_PRINT("info", ("Sending inserts to NDB, "\
"rows_inserted:%d, bulk_insert_rows: %d",
- rows_inserted, bulk_insert_rows));
- bulk_insert_not_flushed= FALSE;
+ m_rows_inserted, m_bulk_insert_rows));
+ m_bulk_insert_not_flushed= FALSE;
if (execute_no_commit(this,trans) != 0) {
no_uncommitted_rows_execute_failure();
my_errno= error= ndb_err(trans);
}
}
- rows_inserted= 0;
- rows_to_insert= 1;
+ m_rows_inserted= 0;
+ m_rows_to_insert= 1;
DBUG_RETURN(error);
}
@@ -2942,8 +2952,8 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
(NdbConnection*)thd->transaction.stmt.ndb_tid;
DBUG_ASSERT(m_active_trans);
// Start of transaction
- retrieve_all_fields= FALSE;
- ops_pending= 0;
+ m_retrieve_all_fields= FALSE;
+ m_ops_pending= 0;
{
NDBDICT *dict= m_ndb->getDictionary();
const NDBTAB *tab;
@@ -2991,13 +3001,13 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
DBUG_PRINT("warning", ("m_active_cursor != NULL"));
m_active_cursor= NULL;
- if (blobs_pending)
+ if (m_blobs_pending)
DBUG_PRINT("warning", ("blobs_pending != 0"));
- blobs_pending= 0;
+ m_blobs_pending= 0;
- if (ops_pending)
+ if (m_ops_pending)
DBUG_PRINT("warning", ("ops_pending != 0L"));
- ops_pending= 0;
+ m_ops_pending= 0;
}
DBUG_RETURN(error);
}
@@ -3034,8 +3044,8 @@ int ha_ndbcluster::start_stmt(THD *thd)
m_active_trans= trans;
// Start of statement
- retrieve_all_fields= FALSE;
- ops_pending= 0;
+ m_retrieve_all_fields= FALSE;
+ m_ops_pending= 0;
DBUG_RETURN(error);
}
@@ -3112,7 +3122,12 @@ static int create_ndb_column(NDBCOL &col,
HA_CREATE_INFO *info)
{
// Set name
- col.setName(field->field_name);
+ {
+ char truncated_field_name[NDB_MAX_ATTR_NAME_SIZE];
+ strnmov(truncated_field_name,field->field_name,sizeof(truncated_field_name));
+ truncated_field_name[sizeof(truncated_field_name)-1]= '\0';
+ col.setName(truncated_field_name);
+ }
// Get char set
CHARSET_INFO *cs= field->charset();
// Set type and sizes
@@ -3440,7 +3455,12 @@ int ha_ndbcluster::create_index(const char *name,
{
Field *field= key_part->field;
DBUG_PRINT("info", ("attr: %s", field->field_name));
- ndb_index.addColumnName(field->field_name);
+ {
+ char truncated_field_name[NDB_MAX_ATTR_NAME_SIZE];
+ strnmov(truncated_field_name,field->field_name,sizeof(truncated_field_name));
+ truncated_field_name[sizeof(truncated_field_name)-1]= '\0';
+ ndb_index.addColumnName(truncated_field_name);
+ }
}
if (dict->createIndex(ndb_index))
@@ -3567,10 +3587,10 @@ ulonglong ha_ndbcluster::get_auto_increment()
Uint64 auto_value;
DBUG_ENTER("get_auto_increment");
DBUG_PRINT("enter", ("m_tabname: %s", m_tabname));
- cache_size= ((rows_to_insert - rows_inserted < autoincrement_prefetch) ?
- rows_to_insert - rows_inserted :
- max(rows_to_insert, autoincrement_prefetch));
- auto_value= ((skip_auto_increment) ?
+ cache_size= ((m_rows_to_insert - m_rows_inserted < autoincrement_prefetch) ?
+ m_rows_to_insert - m_rows_inserted :
+ max(m_rows_to_insert, autoincrement_prefetch));
+ auto_value= ((m_skip_auto_increment) ?
m_ndb->readAutoIncrementValue((const NDBTAB *) m_table) :
m_ndb->getAutoIncrementValue((const NDBTAB *) m_table, cache_size));
DBUG_RETURN((ulonglong) auto_value);
@@ -3595,17 +3615,18 @@ ha_ndbcluster::ha_ndbcluster(TABLE *table_arg):
m_share(0),
m_use_write(FALSE),
m_ignore_dup_key_not_supported(FALSE),
- retrieve_all_fields(FALSE),
- rows_to_insert(1),
- rows_inserted(0),
- bulk_insert_rows(1024),
- bulk_insert_not_flushed(FALSE),
- ops_pending(0),
- skip_auto_increment(TRUE),
- blobs_pending(0),
- blobs_buffer(0),
- blobs_buffer_size(0),
- dupkey((uint) -1)
+ m_primary_key_update(FALSE),
+ m_retrieve_all_fields(FALSE),
+ m_rows_to_insert(1),
+ m_rows_inserted(0),
+ m_bulk_insert_rows(1024),
+ m_bulk_insert_not_flushed(FALSE),
+ m_ops_pending(0),
+ m_skip_auto_increment(TRUE),
+ m_blobs_pending(0),
+ m_blobs_buffer(0),
+ m_blobs_buffer_size(0),
+ m_dupkey((uint) -1)
{
int i;
@@ -3639,8 +3660,8 @@ ha_ndbcluster::~ha_ndbcluster()
if (m_share)
free_share(m_share);
release_metadata();
- my_free(blobs_buffer, MYF(MY_ALLOW_ZERO_PTR));
- blobs_buffer= 0;
+ my_free(m_blobs_buffer, MYF(MY_ALLOW_ZERO_PTR));
+ m_blobs_buffer= 0;
// Check for open cursor/transaction
if (m_active_cursor) {
diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h
index 245d906c5ae..d61876b1357 100644
--- a/sql/ha_ndbcluster.h
+++ b/sql/ha_ndbcluster.h
@@ -26,7 +26,6 @@
#endif
#include <ndbapi_limits.h>
-#include <ndb_types.h>
class Ndb; // Forward declaration
class NdbOperation; // Forward declaration
@@ -244,18 +243,19 @@ class ha_ndbcluster: public handler
NdbValue m_value[NDB_MAX_ATTRIBUTES_IN_TABLE];
bool m_use_write;
bool m_ignore_dup_key_not_supported;
- bool retrieve_all_fields;
- ha_rows rows_to_insert;
- ha_rows rows_inserted;
- ha_rows bulk_insert_rows;
- bool bulk_insert_not_flushed;
- ha_rows ops_pending;
- bool skip_auto_increment;
- bool blobs_pending;
+ bool m_primary_key_update;
+ bool m_retrieve_all_fields;
+ ha_rows m_rows_to_insert;
+ ha_rows m_rows_inserted;
+ ha_rows m_bulk_insert_rows;
+ bool m_bulk_insert_not_flushed;
+ ha_rows m_ops_pending;
+ bool m_skip_auto_increment;
+ bool m_blobs_pending;
// memory for blobs in one tuple
- char *blobs_buffer;
- uint32 blobs_buffer_size;
- uint dupkey;
+ char *m_blobs_buffer;
+ uint32 m_blobs_buffer_size;
+ uint m_dupkey;
void set_rec_per_key();
void records_update();
diff --git a/sql/item.cc b/sql/item.cc
index 4c738c9a4c5..d78c6f5b8ba 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -278,6 +278,41 @@ bool Item::eq(const Item *item, bool binary_cmp) const
}
+Item *Item::safe_charset_converter(CHARSET_INFO *tocs)
+{
+ /*
+ Don't allow automatic conversion to non-Unicode charsets,
+ as it potentially loses data.
+ */
+ if (!(tocs->state & MY_CS_UNICODE))
+ return NULL; // safe conversion is not possible
+ return new Item_func_conv_charset(this, tocs);
+}
+
+
+Item *Item_string::safe_charset_converter(CHARSET_INFO *tocs)
+{
+ Item_string *conv;
+ uint conv_errors;
+ String tmp, cstr, *ostr= val_str(&tmp);
+ cstr.copy(ostr->ptr(), ostr->length(), ostr->charset(), tocs, &conv_errors);
+ if (conv_errors || !(conv= new Item_string(cstr.ptr(), cstr.length(),
+ cstr.charset(),
+ collation.derivation)))
+ {
+ /*
+ Safe conversion is not possible (or EOM).
+ We could not convert a string into the requested character set
+ without data loss. The target charset does not cover all the
+ characters from the string. Operation cannot be done correctly.
+ */
+ return NULL;
+ }
+ conv->str_value.copy();
+ return conv;
+}
+
+
bool Item_string::eq(const Item *item, bool binary_cmp) const
{
if (type() == item->type())
@@ -372,7 +407,43 @@ Item_splocal::type() const
}
-bool DTCollation::aggregate(DTCollation &dt, bool superset_conversion)
+
+/*
+ Aggregate two collations together taking
+ into account their coercibility (aka derivation):
+
+ 0 == DERIVATION_EXPLICIT - an explicitely written COLLATE clause
+ 1 == DERIVATION_NONE - a mix of two different collations
+ 2 == DERIVATION_IMPLICIT - a column
+ 3 == DERIVATION_COERCIBLE - a string constant
+
+ The most important rules are:
+
+ 1. If collations are the same:
+ chose this collation, and the strongest derivation.
+
+ 2. If collations are different:
+ - Character sets may differ, but only if conversion without
+ data loss is possible. The caller provides flags whether
+ character set conversion attempts should be done. If no
+ flags are substituted, then the character sets must be the same.
+ Currently processed flags are:
+ MY_COLL_ALLOW_SUPERSET_CONV - allow conversion to a superset
+ MY_COLL_ALLOW_COERCIBLE_CONV - allow conversion of a coercible value
+ - two EXPLICIT collations produce an error, e.g. this is wrong:
+ CONCAT(expr1 collate latin1_swedish_ci, expr2 collate latin1_german_ci)
+ - the side with smaller derivation value wins,
+ i.e. a column is stronger than a string constant,
+ an explicit COLLATE clause is stronger than a column.
+ - if derivations are the same, we have DERIVATION_NONE,
+ we'll wait for an explicit COLLATE clause which possibly can
+ come from another argument later: for example, this is valid,
+ but we don't know yet when collecting the first two arguments:
+ CONCAT(latin1_swedish_ci_column,
+ latin1_german1_ci_column,
+ expr COLLATE latin1_german2_ci)
+*/
+bool DTCollation::aggregate(DTCollation &dt, uint flags)
{
nagg++;
if (!my_charset_same(collation, dt.collation))
@@ -403,28 +474,37 @@ bool DTCollation::aggregate(DTCollation &dt, bool superset_conversion)
else
; // Do nothing
}
- else if (superset_conversion)
+ else if ((flags & MY_COLL_ALLOW_SUPERSET_CONV) &&
+ derivation < dt.derivation &&
+ collation->state & MY_CS_UNICODE)
{
- if (derivation < dt.derivation &&
- collation->state & MY_CS_UNICODE)
- ; // Do nothing
- else if (dt.derivation < derivation &&
- dt.collation->state & MY_CS_UNICODE)
- {
- set(dt);
- strong= nagg;
- }
- else
- {
- // Cannot convert to superset
- set(0, DERIVATION_NONE);
- return 1;
- }
+ // Do nothing
+ }
+ else if ((flags & MY_COLL_ALLOW_SUPERSET_CONV) &&
+ dt.derivation < derivation &&
+ dt.collation->state & MY_CS_UNICODE)
+ {
+ set(dt);
+ strong= nagg;
+ }
+ else if ((flags & MY_COLL_ALLOW_COERCIBLE_CONV) &&
+ derivation < dt.derivation &&
+ dt.derivation == DERIVATION_COERCIBLE)
+ {
+ // Do nothing;
+ }
+ else if ((flags & MY_COLL_ALLOW_COERCIBLE_CONV) &&
+ dt.derivation < derivation &&
+ derivation == DERIVATION_COERCIBLE)
+ {
+ set(dt);
+ strong= nagg;
}
else
{
+ // Cannot apply conversion
set(0, DERIVATION_NONE);
- return 1;
+ return 1;
}
}
else if (derivation < dt.derivation)
@@ -847,6 +927,12 @@ String *Item_null::val_str(String *str)
}
+Item *Item_null::safe_charset_converter(CHARSET_INFO *tocs)
+{
+ collation.set(tocs);
+ return this;
+}
+
/*********************** Item_param related ******************************/
/*
@@ -942,7 +1028,9 @@ bool Item_param::set_str(const char *str, ulong length)
Assign string with no conversion: data is converted only after it's
been written to the binary log.
*/
- if (str_value.copy(str, length, &my_charset_bin, &my_charset_bin))
+ uint dummy_errors;
+ if (str_value.copy(str, length, &my_charset_bin, &my_charset_bin,
+ &dummy_errors))
DBUG_RETURN(TRUE);
state= STRING_VALUE;
maybe_null= 0;
@@ -1299,6 +1387,10 @@ bool Item_param::convert_str_value(THD *thd)
value.cs_info.character_set_client,
value.cs_info.final_character_set_of_str_value);
}
+ else
+ str_value.set_charset(value.cs_info.final_character_set_of_str_value);
+ /* Here str_value is guaranteed to be in final_character_set_of_str_value */
+
max_length= str_value.length();
decimals= 0;
/*
@@ -1662,6 +1754,13 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
return 0;
}
+Item *Item_field::safe_charset_converter(CHARSET_INFO *tocs)
+{
+ no_const_subst= 1;
+ return Item::safe_charset_converter(tocs);
+}
+
+
void Item_field::cleanup()
{
DBUG_ENTER("Item_field::cleanup");
diff --git a/sql/item.h b/sql/item.h
index eed0b065a83..93c396b95b0 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -38,6 +38,25 @@ enum Derivation
DERIVATION_EXPLICIT= 0
};
+/*
+ Flags for collation aggregation modes:
+ MY_COLL_ALLOW_SUPERSET_CONV - allow conversion to a superset
+ MY_COLL_ALLOW_COERCIBLE_CONV - allow conversion of a coercible value
+ (i.e. constant).
+ MY_COLL_ALLOW_CONV - allow any kind of conversion
+ (combintion of the above two)
+ MY_COLL_DISALLOW_NONE - don't allow return DERIVATION_NONE
+ (e.g. when aggregating for comparison)
+ MY_COLL_CMP_CONV - combination of MY_COLL_ALLOW_CONV
+ and MY_COLL_DISALLOW_NONE
+*/
+
+#define MY_COLL_ALLOW_SUPERSET_CONV 1
+#define MY_COLL_ALLOW_COERCIBLE_CONV 2
+#define MY_COLL_ALLOW_CONV 3
+#define MY_COLL_DISALLOW_NONE 4
+#define MY_COLL_CMP_CONV 7
+
class DTCollation {
public:
CHARSET_INFO *collation;
@@ -73,9 +92,9 @@ public:
{ collation= collation_arg; }
void set(Derivation derivation_arg)
{ derivation= derivation_arg; }
- bool aggregate(DTCollation &dt, bool superset_conversion= FALSE);
- bool set(DTCollation &dt1, DTCollation &dt2, bool superset_conversion= FALSE)
- { set(dt1); return aggregate(dt2, superset_conversion); }
+ bool aggregate(DTCollation &dt, uint flags= 0);
+ bool set(DTCollation &dt1, DTCollation &dt2, uint flags= 0)
+ { set(dt1); return aggregate(dt2, flags); }
const char *derivation_name() const
{
switch(derivation)
@@ -306,6 +325,7 @@ public:
virtual Item_field *filed_for_view_update() { return 0; }
virtual Item *neg_transformer(THD *thd) { return NULL; }
+ virtual Item *safe_charset_converter(CHARSET_INFO *tocs);
void delete_self()
{
cleanup();
@@ -542,6 +562,7 @@ public:
bool replace_equal_field_processor(byte *arg);
inline uint32 max_disp_length() { return field->max_length(); }
Item_field *filed_for_view_update() { return this; }
+ Item *safe_charset_converter(CHARSET_INFO *tocs);
friend class Item_default_value;
friend class Item_insert_value;
friend class st_select_lex_unit;
@@ -573,6 +594,7 @@ public:
Item *new_item() { return new Item_null(name); }
bool is_null() { return 1; }
void print(String *str) { str->append("NULL", 4); }
+ Item *safe_charset_converter(CHARSET_INFO *tocs);
};
@@ -862,6 +884,7 @@ public:
return new Item_string(name, str_value.ptr(),
str_value.length(), &my_charset_bin);
}
+ Item *safe_charset_converter(CHARSET_INFO *tocs);
String *const_string() { return &str_value; }
inline void append(char *str, uint length) { str_value.append(str, length); }
void print(String *str);
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 467cd8313a4..905250ed96f 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -185,55 +185,14 @@ void Item_bool_func2::fix_length_and_dec()
to the collation of A.
*/
- if (args[0] && args[1])
- {
- uint strong= 0;
- uint weak= 0;
- uint32 dummy_offset;
- DTCollation coll;
-
- if (args[0]->result_type() == STRING_RESULT &&
- args[1]->result_type() == STRING_RESULT &&
- String::needs_conversion(0, args[0]->collation.collation,
- args[1]->collation.collation,
- &dummy_offset) &&
- !coll.set(args[0]->collation, args[1]->collation, TRUE))
- {
- Item* conv= 0;
- Item_arena *arena= thd->current_arena, backup;
- strong= coll.strong;
- weak= strong ? 0 : 1;
- /*
- In case we're in statement prepare, create conversion item
- in its memory: it will be reused on each execute.
- */
- if (arena->is_stmt_prepare())
- thd->set_n_backup_item_arena(arena, &backup);
- if (args[weak]->type() == STRING_ITEM)
- {
- String tmp, cstr;
- String *ostr= args[weak]->val_str(&tmp);
- cstr.copy(ostr->ptr(), ostr->length(), ostr->charset(),
- args[strong]->collation.collation);
- conv= new Item_string(cstr.ptr(),cstr.length(),cstr.charset(),
- args[weak]->collation.derivation);
- ((Item_string*)conv)->str_value.copy();
- }
- else
- {
- conv= new Item_func_conv_charset(args[weak],
- args[strong]->collation.collation);
- conv->collation.set(args[weak]->collation.derivation);
- conv->fix_fields(thd, 0, &conv);
- }
- if (arena->is_stmt_prepare())
- thd->restore_backup_item_arena(arena, &backup);
- if (args[weak]->type() == FIELD_ITEM)
- ((Item_field *)args[weak])->no_const_subst= 1;
- args[weak]= conv ? conv : args[weak];
- }
- }
+ DTCollation coll;
+ if (args[0]->result_type() == STRING_RESULT &&
+ args[1]->result_type() == STRING_RESULT &&
+ agg_arg_charsets(coll, args, 2, MY_COLL_CMP_CONV))
+ return;
+
+
// Make a special case of compare with fields to get nicer DATE comparisons
if (functype() == LIKE_FUNC) // Disable conversion in case of LIKE function.
@@ -859,7 +818,7 @@ void Item_func_between::fix_length_and_dec()
return;
agg_cmp_type(&cmp_type, args, 3);
if (cmp_type == STRING_RESULT &&
- agg_arg_collations_for_comparison(cmp_collation, args, 3))
+ agg_arg_charsets(cmp_collation, args, 3, MY_COLL_CMP_CONV))
return;
/*
@@ -975,7 +934,7 @@ Item_func_ifnull::fix_length_and_dec()
decimals=max(args[0]->decimals,args[1]->decimals);
agg_result_type(&cached_result_type, args, 2);
if (cached_result_type == STRING_RESULT)
- agg_arg_collations(collation, args, arg_count);
+ agg_arg_charsets(collation, args, arg_count, MY_COLL_CMP_CONV);
else if (cached_result_type != REAL_RESULT)
decimals= 0;
@@ -1071,8 +1030,8 @@ Item_func_if::fix_length_and_dec()
agg_result_type(&cached_result_type, args+1, 2);
if (cached_result_type == STRING_RESULT)
{
- if (agg_arg_collations(collation, args+1, 2))
- return;
+ if (agg_arg_charsets(collation, args+1, 2, MY_COLL_ALLOW_CONV))
+ return;
}
else
{
@@ -1331,8 +1290,10 @@ void Item_func_case::fix_length_and_dec()
if (!(agg= (Item**) sql_alloc(sizeof(Item*)*(ncases+1))))
return;
- // Aggregate all THEN and ELSE expression types
- // and collations when string result
+ /*
+ Aggregate all THEN and ELSE expression types
+ and collations when string result
+ */
for (nagg= 0 ; nagg < ncases/2 ; nagg++)
agg[nagg]= args[nagg*2+1];
@@ -1342,7 +1303,7 @@ void Item_func_case::fix_length_and_dec()
agg_result_type(&cached_result_type, agg, nagg);
if ((cached_result_type == STRING_RESULT) &&
- agg_arg_collations(collation, agg, nagg))
+ agg_arg_charsets(collation, agg, nagg, MY_COLL_ALLOW_CONV))
return;
@@ -1358,7 +1319,7 @@ void Item_func_case::fix_length_and_dec()
nagg++;
agg_cmp_type(&cmp_type, agg, nagg);
if ((cmp_type == STRING_RESULT) &&
- agg_arg_collations_for_comparison(cmp_collation, agg, nagg))
+ agg_arg_charsets(cmp_collation, agg, nagg, MY_COLL_CMP_CONV))
return;
}
@@ -1465,7 +1426,7 @@ void Item_func_coalesce::fix_length_and_dec()
set_if_bigger(decimals,args[i]->decimals);
}
if (cached_result_type == STRING_RESULT)
- agg_arg_collations(collation, args, arg_count);
+ agg_arg_charsets(collation, args, arg_count, MY_COLL_ALLOW_CONV);
else if (cached_result_type != REAL_RESULT)
decimals= 0;
}
@@ -1795,14 +1756,13 @@ void Item_func_in::fix_length_and_dec()
via creating Item_func_conv_charset().
*/
- if (agg_arg_collations_for_comparison(cmp_collation,
- args, arg_count, TRUE))
+ if (agg_arg_collations_for_comparison(cmp_collation, args, arg_count,
+ MY_COLL_ALLOW_SUPERSET_CONV))
return;
if ((!my_charset_same(args[0]->collation.collation,
cmp_collation.collation) || !const_itm))
{
- if (agg_arg_collations_for_comparison(cmp_collation,
- args, arg_count, FALSE))
+ if (agg_arg_collations_for_comparison(cmp_collation, args, arg_count))
return;
}
else
@@ -1811,25 +1771,27 @@ void Item_func_in::fix_length_and_dec()
Conversion is possible:
All IN arguments are constants.
*/
- Item_arena *arena= thd->current_arena, backup;
- if (arena->is_stmt_prepare())
- thd->set_n_backup_item_arena(arena, &backup);
+ Item_arena *arena, backup;
+ arena= thd->change_arena_if_needed(&backup);
+
for (arg= args+1, arg_end= args+arg_count; arg < arg_end; arg++)
{
- if (!my_charset_same(cmp_collation.collation,
+ if (!arg[0]->null_value &&
+ !my_charset_same(cmp_collation.collation,
arg[0]->collation.collation))
{
Item_string *conv;
String tmp, cstr, *ostr= arg[0]->val_str(&tmp);
+ uint dummy_errors;
cstr.copy(ostr->ptr(), ostr->length(), ostr->charset(),
- cmp_collation.collation);
+ cmp_collation.collation, &dummy_errors);
conv= new Item_string(cstr.ptr(),cstr.length(), cstr.charset(),
arg[0]->collation.derivation);
conv->str_value.copy();
arg[0]= conv;
}
}
- if (arena->is_stmt_prepare())
+ if (arena)
thd->restore_backup_item_arena(arena, &backup);
}
}
@@ -2449,7 +2411,7 @@ Item_func_regex::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
max_length= 1;
decimals= 0;
- if (agg_arg_collations(cmp_collation, args, 2))
+ if (agg_arg_charsets(cmp_collation, args, 2, MY_COLL_CMP_CONV))
return 1;
used_tables_cache=args[0]->used_tables() | args[1]->used_tables();
diff --git a/sql/item_create.cc b/sql/item_create.cc
index e21364045ba..cec6de3eede 100644
--- a/sql/item_create.cc
+++ b/sql/item_create.cc
@@ -370,7 +370,10 @@ Item *create_func_space(Item *a)
{
sp= new Item_string("",0,cs);
if (sp)
- sp->str_value.copy(" ",1,&my_charset_latin1,cs);
+ {
+ uint dummy_errors;
+ sp->str_value.copy(" ", 1, &my_charset_latin1, cs, &dummy_errors);
+ }
}
else
{
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 3cc0fd077a4..185d4f115ad 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -79,7 +79,7 @@ static void my_coll_agg_error(Item** args, uint count, const char *fname)
bool Item_func::agg_arg_collations(DTCollation &c, Item **av, uint count,
- bool allow_superset_conversion)
+ uint flags)
{
uint i;
c.nagg= 0;
@@ -87,29 +87,27 @@ bool Item_func::agg_arg_collations(DTCollation &c, Item **av, uint count,
c.set(av[0]->collation);
for (i= 1; i < count; i++)
{
- if (c.aggregate(av[i]->collation, allow_superset_conversion))
+ if (c.aggregate(av[i]->collation, flags))
{
my_coll_agg_error(av, count, func_name());
return TRUE;
}
}
+ if ((flags & MY_COLL_DISALLOW_NONE) &&
+ c.derivation == DERIVATION_NONE)
+ {
+ my_coll_agg_error(av, count, func_name());
+ return TRUE;
+ }
return FALSE;
}
bool Item_func::agg_arg_collations_for_comparison(DTCollation &c,
Item **av, uint count,
- bool allow_superset_conv)
+ uint flags)
{
- if (agg_arg_collations(c, av, count, allow_superset_conv))
- return TRUE;
-
- if (c.derivation == DERIVATION_NONE)
- {
- my_coll_agg_error(av, count, func_name());
- return TRUE;
- }
- return FALSE;
+ return (agg_arg_collations(c, av, count, flags | MY_COLL_DISALLOW_NONE));
}
@@ -122,6 +120,90 @@ eval_const_cond(COND *cond)
}
+
+/*
+ Collect arguments' character sets together.
+ We allow to apply automatic character set conversion in some cases.
+ The conditions when conversion is possible are:
+ - arguments A and B have different charsets
+ - A wins according to coercibility rules
+ (i.e. a column is stronger than a string constant,
+ an explicit COLLATE clause is stronger than a column)
+ - character set of A is either superset for character set of B,
+ or B is a string constant which can be converted into the
+ character set of A without data loss.
+
+ If all of the above is true, then it's possible to convert
+ B into the character set of A, and then compare according
+ to the collation of A.
+
+ For functions with more than two arguments:
+
+ collect(A,B,C) ::= collect(collect(A,B),C)
+*/
+
+bool Item_func::agg_arg_charsets(DTCollation &coll,
+ Item **args, uint nargs, uint flags)
+{
+ Item **arg, **last, *safe_args[2];
+ if (agg_arg_collations(coll, args, nargs, flags))
+ return TRUE;
+
+ /*
+ For better error reporting: save the first and the second argument.
+ We need this only if the the number of args is 3 or 2:
+ - for a longer argument list, "Illegal mix of collations"
+ doesn't display each argument's characteristics.
+ - if nargs is 1, then this error cannot happen.
+ */
+ if (nargs >=2 && nargs <= 3)
+ {
+ safe_args[0]= args[0];
+ safe_args[1]= args[1];
+ }
+
+ THD *thd= current_thd;
+ Item_arena *arena, backup;
+ bool res= FALSE;
+ /*
+ In case we're in statement prepare, create conversion item
+ in its memory: it will be reused on each execute.
+ */
+ arena= thd->change_arena_if_needed(&backup);
+
+ for (arg= args, last= args + nargs; arg < last; arg++)
+ {
+ Item* conv;
+ uint dummy_offset;
+ if (!String::needs_conversion(0, coll.collation,
+ (*arg)->collation.collation,
+ &dummy_offset))
+ continue;
+
+ if (!(conv= (*arg)->safe_charset_converter(coll.collation)))
+ {
+ if (nargs >=2 && nargs <= 3)
+ {
+ /* restore the original arguments for better error message */
+ args[0]= safe_args[0];
+ args[1]= safe_args[1];
+ }
+ my_coll_agg_error(args, nargs, func_name());
+ res= TRUE;
+ break; // we cannot return here, we need to restore "arena".
+ }
+ if ((*arg)->type() == FIELD_ITEM)
+ ((Item_field *)(*arg))->no_const_subst= 1;
+ conv->fix_fields(thd, 0, &conv);
+ *arg= conv;
+ }
+ if (arena)
+ thd->restore_backup_item_arena(arena, &backup);
+ return res;
+}
+
+
+
void Item_func::set_arguments(List<Item> &list)
{
allowed_arg_cols= 1;
@@ -1185,7 +1267,7 @@ void Item_func_min_max::fix_length_and_dec()
cmp_type=item_cmp_type(cmp_type,args[i]->result_type());
}
if (cmp_type == STRING_RESULT)
- agg_arg_collations_for_comparison(collation, args, arg_count);
+ agg_arg_charsets(collation, args, arg_count, MY_COLL_CMP_CONV);
}
@@ -1339,7 +1421,7 @@ longlong Item_func_coercibility::val_int()
void Item_func_locate::fix_length_and_dec()
{
maybe_null=0; max_length=11;
- agg_arg_collations_for_comparison(cmp_collation, args, 2);
+ agg_arg_charsets(cmp_collation, args, 2, MY_COLL_CMP_CONV);
}
@@ -1438,7 +1520,7 @@ void Item_func_field::fix_length_and_dec()
for (uint i=1; i < arg_count ; i++)
cmp_type= item_cmp_type(cmp_type, args[i]->result_type());
if (cmp_type == STRING_RESULT)
- agg_arg_collations_for_comparison(cmp_collation, args, arg_count);
+ agg_arg_charsets(cmp_collation, args, arg_count, MY_COLL_CMP_CONV);
}
@@ -2346,6 +2428,7 @@ static user_var_entry *get_variable(HASH *hash, LEX_STRING &name,
entry->value=0;
entry->length=0;
entry->update_query_id=0;
+ entry->collation.set(NULL, DERIVATION_NONE);
/*
If we are here, we were called from a SET or a query which sets a
variable. Imagine it is this:
@@ -2387,7 +2470,24 @@ bool Item_func_set_user_var::fix_fields(THD *thd, TABLE_LIST *tables,
is different from query_id).
*/
entry->update_query_id= thd->query_id;
- entry->collation.set(args[0]->collation);
+ /*
+ As it is wrong and confusing to associate any
+ character set with NULL, @a should be latin2
+ after this query sequence:
+
+ SET @a=_latin2'string';
+ SET @a=NULL;
+
+ I.e. the second query should not change the charset
+ to the current default value, but should keep the
+ original value assigned during the first query.
+ In order to do it, we don't copy charset
+ from the argument if the argument is NULL
+ and the variable has previously been initialized.
+ */
+ if (!entry->collation.collation || !args[0]->null_value)
+ entry->collation.set(args[0]->collation);
+ collation.set(entry->collation);
cached_result_type= args[0]->result_type();
return 0;
}
@@ -2415,7 +2515,6 @@ bool Item_func_set_user_var::update_hash(void *ptr, uint length,
my_free(entry->value,MYF(0));
entry->value=0;
entry->length=0;
- entry->collation.set(cs, dv);
}
else
{
@@ -3003,8 +3102,9 @@ void Item_func_match::init_search(bool no_order)
if (ft_tmp->charset() != cmp_collation.collation)
{
+ uint dummy_errors;
search_value.copy(ft_tmp->ptr(), ft_tmp->length(), ft_tmp->charset(),
- cmp_collation.collation);
+ cmp_collation.collation, &dummy_errors);
ft_tmp= &search_value;
}
@@ -3414,7 +3514,7 @@ Item_func_sp::func_name() const
1 + // .
1 + // end of string
ALIGN_SIZE(1)); // to avoid String reallocation
- String qname((char *)alloc_root(&thd->mem_root, len), len,
+ String qname((char *)alloc_root(thd->mem_root, len), len,
system_charset_info);
qname.length(0);
diff --git a/sql/item_func.h b/sql/item_func.h
index 3b941c4a40c..602b77ae956 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -146,11 +146,12 @@ public:
Item *get_tmp_table_item(THD *thd);
bool agg_arg_collations(DTCollation &c, Item **items, uint nitems,
- bool allow_superset_conversion= FALSE);
+ uint flags= 0);
bool agg_arg_collations_for_comparison(DTCollation &c,
Item **items, uint nitems,
- bool allow_superset_comversion= FALSE);
-
+ uint flags= 0);
+ bool agg_arg_charsets(DTCollation &c, Item **items, uint nitems,
+ uint flags= 0);
bool walk(Item_processor processor, byte *arg);
Item *transform(Item_transformer transformer, byte *arg);
};
diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc
index 935925c1e83..7c3319bbfea 100644
--- a/sql/item_geofunc.cc
+++ b/sql/item_geofunc.cc
@@ -148,9 +148,9 @@ String *Item_func_geometry_type::val_str(String *str)
swkb->length() - SRID_SIZE)))))
return 0;
/* String will not move */
- str->set(geom->get_class_info()->m_name.str,
- geom->get_class_info()->m_name.length,
- default_charset());
+ str->copy(geom->get_class_info()->m_name.str,
+ geom->get_class_info()->m_name.length,
+ default_charset());
return str;
}
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index d015ca36eac..889b00eb6a0 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -346,7 +346,7 @@ void Item_func_concat::fix_length_and_dec()
{
max_length=0;
- if (agg_arg_collations(collation, args, arg_count))
+ if (agg_arg_charsets(collation, args, arg_count, MY_COLL_ALLOW_CONV))
return;
for (uint i=0 ; i < arg_count ; i++)
@@ -640,10 +640,15 @@ void Item_func_concat_ws::fix_length_and_dec()
{
max_length=0;
- if (agg_arg_collations(collation, args, arg_count))
+ if (agg_arg_charsets(collation, args, arg_count, MY_COLL_ALLOW_CONV))
return;
- max_length= arg_count > 1 ? args[0]->max_length * (arg_count - 2) : 0;
+ /*
+ arg_count cannot be less than 2,
+ it is done on parser level in sql_yacc.yy
+ so, (arg_count - 2) is safe here.
+ */
+ max_length= args[0]->max_length * (arg_count - 2);
for (uint i=1 ; i < arg_count ; i++)
max_length+=args[i]->max_length;
@@ -843,7 +848,7 @@ void Item_func_replace::fix_length_and_dec()
maybe_null=1;
}
- if (agg_arg_collations_for_comparison(collation, args, 3))
+ if (agg_arg_charsets(collation, args, 3, MY_COLL_CMP_CONV))
return;
}
@@ -888,11 +893,13 @@ null:
void Item_func_insert::fix_length_and_dec()
{
- if (collation.set(args[0]->collation, args[3]->collation))
- {
- my_coll_agg_error(args[0]->collation, args[3]->collation, func_name());
- return;
- }
+ Item *cargs[2];
+ cargs[0]= args[0];
+ cargs[1]= args[3];
+ if (agg_arg_charsets(collation, cargs, 2, MY_COLL_ALLOW_CONV))
+ return;
+ args[0]= cargs[0];
+ args[3]= cargs[1];
max_length=args[0]->max_length+args[3]->max_length;
if (max_length > MAX_BLOB_WIDTH)
{
@@ -1058,7 +1065,7 @@ void Item_func_substr_index::fix_length_and_dec()
{
max_length= args[0]->max_length;
- if (agg_arg_collations_for_comparison(collation, args, 2))
+ if (agg_arg_charsets(collation, args, 2, MY_COLL_CMP_CONV))
return;
}
@@ -1350,10 +1357,14 @@ void Item_func_trim::fix_length_and_dec()
remove.set_ascii(" ",1);
}
else
- if (collation.set(args[1]->collation, args[0]->collation) ||
- collation.derivation == DERIVATION_NONE)
{
- my_coll_agg_error(args[1]->collation, args[0]->collation, func_name());
+ Item *cargs[2];
+ cargs[0]= args[1];
+ cargs[1]= args[0];
+ if (agg_arg_charsets(collation, cargs, 2, MY_COLL_CMP_CONV))
+ return;
+ args[0]= cargs[1];
+ args[1]= cargs[0];
}
}
@@ -1674,7 +1685,7 @@ void Item_func_elt::fix_length_and_dec()
max_length=0;
decimals=0;
- if (agg_arg_collations(collation, args+1, arg_count-1))
+ if (agg_arg_charsets(collation, args+1, arg_count-1, MY_COLL_ALLOW_CONV))
return;
for (uint i= 1 ; i < arg_count ; i++)
@@ -1750,7 +1761,7 @@ void Item_func_make_set::fix_length_and_dec()
{
max_length=arg_count-1;
- if (agg_arg_collations(collation, args, arg_count))
+ if (agg_arg_charsets(collation, args, arg_count, MY_COLL_ALLOW_CONV))
return;
for (uint i=0 ; i < arg_count ; i++)
@@ -1958,12 +1969,13 @@ err:
void Item_func_rpad::fix_length_and_dec()
{
- if (collation.set(args[0]->collation, args[2]->collation))
- {
- my_coll_agg_error(args[0]->collation, args[2]->collation, func_name());
+ Item *cargs[2];
+ cargs[0]= args[0];
+ cargs[1]= args[2];
+ if (agg_arg_charsets(collation, cargs, 2, MY_COLL_ALLOW_CONV))
return;
- }
-
+ args[0]= cargs[0];
+ args[2]= cargs[1];
if (args[1]->const_item())
{
uint32 length= (uint32) args[1]->val_int() * collation.collation->mbmaxlen;
@@ -2042,11 +2054,13 @@ String *Item_func_rpad::val_str(String *str)
void Item_func_lpad::fix_length_and_dec()
{
- if (collation.set(args[0]->collation, args[2]->collation))
- {
- my_coll_agg_error(args[0]->collation, args[2]->collation, func_name());
+ Item *cargs[2];
+ cargs[0]= args[0];
+ cargs[1]= args[2];
+ if (agg_arg_charsets(collation, cargs, 2, MY_COLL_ALLOW_CONV))
return;
- }
+ args[0]= cargs[0];
+ args[2]= cargs[1];
if (args[1]->const_item())
{
@@ -2155,13 +2169,14 @@ String *Item_func_conv_charset::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
String *arg= args[0]->val_str(str);
+ uint dummy_errors;
if (!arg)
{
null_value=1;
return 0;
}
null_value= str_value.copy(arg->ptr(),arg->length(),arg->charset(),
- conv_charset);
+ conv_charset, &dummy_errors);
return null_value ? 0 : &str_value;
}
@@ -2256,11 +2271,12 @@ String *Item_func_charset::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
String *res = args[0]->val_str(str);
+ uint dummy_errors;
if ((null_value=(args[0]->null_value || !res->charset())))
return 0;
str->copy(res->charset()->csname,strlen(res->charset()->csname),
- &my_charset_latin1, collation.collation);
+ &my_charset_latin1, collation.collation, &dummy_errors);
return str;
}
@@ -2268,11 +2284,12 @@ String *Item_func_collation::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
String *res = args[0]->val_str(str);
+ uint dummy_errors;
if ((null_value=(args[0]->null_value || !res->charset())))
return 0;
str->copy(res->charset()->name,strlen(res->charset()->name),
- &my_charset_latin1, collation.collation);
+ &my_charset_latin1, collation.collation, &dummy_errors);
return str;
}
@@ -2499,7 +2516,8 @@ void Item_func_export_set::fix_length_and_dec()
uint sep_length=(arg_count > 3 ? args[3]->max_length : 1);
max_length=length*64+sep_length*63;
- if (agg_arg_collations(collation, args+1, min(4,arg_count)-1))
+ if (agg_arg_charsets(collation, args+1, min(4,arg_count)-1),
+ MY_COLL_ALLOW_CONV)
return;
}
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index bafca8acf0f..f426f14a25f 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -190,15 +190,16 @@ bool Item_subselect::fix_fields(THD *thd_param, TABLE_LIST *tables, Item **ref)
bool Item_subselect::exec()
{
int res;
- MEM_ROOT *old_root= my_pthread_getspecific_ptr(MEM_ROOT*, THR_MALLOC);
- if (&thd->mem_root != old_root)
- {
- my_pthread_setspecific_ptr(THR_MALLOC, &thd->mem_root);
- res= engine->exec();
- my_pthread_setspecific_ptr(THR_MALLOC, old_root);
- }
- else
- res= engine->exec();
+ MEM_ROOT *old_root= thd->mem_root;
+
+ /*
+ As this is execution, all objects should be allocated through the main
+ mem root
+ */
+ thd->mem_root= &thd->main_mem_root;
+ res= engine->exec();
+ thd->mem_root= old_root;
+
if (engine_changed)
{
engine_changed= 0;
@@ -661,15 +662,10 @@ Item_in_subselect::single_value_transformer(JOIN *join,
}
SELECT_LEX *select_lex= join->select_lex;
- Item_arena *arena= thd->current_arena, backup;
-
+ Item_arena *arena, backup;
+ arena= thd->change_arena_if_needed(&backup);
thd->where= "scalar IN/ALL/ANY subquery";
- if (arena->is_conventional())
- arena= 0; // For easier test
- else
- thd->set_n_backup_item_arena(arena, &backup);
-
/*
Check that the right part of the subselect contains no more than one
column. E.g. in SELECT 1 IN (SELECT * ..) the right part is (SELECT * ...)
@@ -928,11 +924,8 @@ Item_in_subselect::row_value_transformer(JOIN *join)
}
thd->where= "row IN/ALL/ANY subquery";
- Item_arena *arena= thd->current_arena, backup;
- if (arena->is_conventional())
- arena= 0;
- else
- thd->set_n_backup_item_arena(arena, &backup);
+ Item_arena *arena, backup;
+ arena= thd->change_arena_if_needed(&backup);
if (select_lex->item_list.elements != left_expr->cols())
{
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 743b3eee58c..72c85e2dd40 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -255,7 +255,7 @@ Item_sum_hybrid::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
Item *Item_sum_sum::copy_or_same(THD* thd)
{
- return new (&thd->mem_root) Item_sum_sum(thd, this);
+ return new (thd->mem_root) Item_sum_sum(thd, this);
}
@@ -313,7 +313,7 @@ Item_sum_sum_distinct::~Item_sum_sum_distinct()
Item *
Item_sum_sum_distinct::copy_or_same(THD *thd)
{
- return new (&thd->mem_root) Item_sum_sum_distinct(thd, this);
+ return new (thd->mem_root) Item_sum_sum_distinct(thd, this);
}
C_MODE_START
@@ -399,7 +399,7 @@ double Item_sum_sum_distinct::val()
Item *Item_sum_count::copy_or_same(THD* thd)
{
- return new (&thd->mem_root) Item_sum_count(thd, this);
+ return new (thd->mem_root) Item_sum_count(thd, this);
}
@@ -444,7 +444,7 @@ void Item_sum_count::cleanup()
Item *Item_sum_avg::copy_or_same(THD* thd)
{
- return new (&thd->mem_root) Item_sum_avg(thd, this);
+ return new (thd->mem_root) Item_sum_avg(thd, this);
}
@@ -491,7 +491,7 @@ double Item_sum_std::val()
Item *Item_sum_std::copy_or_same(THD* thd)
{
- return new (&thd->mem_root) Item_sum_std(thd, this);
+ return new (thd->mem_root) Item_sum_std(thd, this);
}
@@ -501,7 +501,7 @@ Item *Item_sum_std::copy_or_same(THD* thd)
Item *Item_sum_variance::copy_or_same(THD* thd)
{
- return new (&thd->mem_root) Item_sum_variance(thd, this);
+ return new (thd->mem_root) Item_sum_variance(thd, this);
}
@@ -663,7 +663,7 @@ void Item_sum_hybrid::cleanup()
Item *Item_sum_min::copy_or_same(THD* thd)
{
- return new (&thd->mem_root) Item_sum_min(thd, this);
+ return new (thd->mem_root) Item_sum_min(thd, this);
}
@@ -716,7 +716,7 @@ bool Item_sum_min::add()
Item *Item_sum_max::copy_or_same(THD* thd)
{
- return new (&thd->mem_root) Item_sum_max(thd, this);
+ return new (thd->mem_root) Item_sum_max(thd, this);
}
@@ -783,7 +783,7 @@ void Item_sum_bit::clear()
Item *Item_sum_or::copy_or_same(THD* thd)
{
- return new (&thd->mem_root) Item_sum_or(thd, this);
+ return new (thd->mem_root) Item_sum_or(thd, this);
}
@@ -797,7 +797,7 @@ bool Item_sum_or::add()
Item *Item_sum_xor::copy_or_same(THD* thd)
{
- return new (&thd->mem_root) Item_sum_xor(thd, this);
+ return new (thd->mem_root) Item_sum_xor(thd, this);
}
@@ -811,7 +811,7 @@ bool Item_sum_xor::add()
Item *Item_sum_and::copy_or_same(THD* thd)
{
- return new (&thd->mem_root) Item_sum_and(thd, this);
+ return new (thd->mem_root) Item_sum_and(thd, this);
}
@@ -1449,7 +1449,7 @@ int Item_sum_count_distinct::tree_to_myisam()
Item *Item_sum_count_distinct::copy_or_same(THD* thd)
{
- return new (&thd->mem_root) Item_sum_count_distinct(thd, this);
+ return new (thd->mem_root) Item_sum_count_distinct(thd, this);
}
@@ -1550,7 +1550,7 @@ bool Item_udf_sum::add()
Item *Item_sum_udf_float::copy_or_same(THD* thd)
{
- return new (&thd->mem_root) Item_sum_udf_float(thd, this);
+ return new (thd->mem_root) Item_sum_udf_float(thd, this);
}
double Item_sum_udf_float::val()
@@ -1575,7 +1575,7 @@ String *Item_sum_udf_float::val_str(String *str)
Item *Item_sum_udf_int::copy_or_same(THD* thd)
{
- return new (&thd->mem_root) Item_sum_udf_int(thd, this);
+ return new (thd->mem_root) Item_sum_udf_int(thd, this);
}
@@ -1613,7 +1613,7 @@ void Item_sum_udf_str::fix_length_and_dec()
Item *Item_sum_udf_str::copy_or_same(THD* thd)
{
- return new (&thd->mem_root) Item_sum_udf_str(thd, this);
+ return new (thd->mem_root) Item_sum_udf_str(thd, this);
}
@@ -1927,7 +1927,7 @@ Item_func_group_concat::~Item_func_group_concat()
Item *Item_func_group_concat::copy_or_same(THD* thd)
{
- return new (&thd->mem_root) Item_func_group_concat(thd, this);
+ return new (thd->mem_root) Item_func_group_concat(thd, this);
}
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 3a25921d84b..566cacca487 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -164,10 +164,10 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
CHARSET_INFO *cs= &my_charset_bin;
int error= 0;
bool usa_time= 0;
- bool sunday_first_n_first_week_non_iso;
+ bool sunday_first_n_first_week_non_iso= -2;
bool strict_week_number;
int strict_week_number_year= -1;
- bool strict_week_number_year_type;
+ bool strict_week_number_year_type= -1;
int frac_part;
const char *val_begin= val;
const char *val_end= val + length;
@@ -175,9 +175,7 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
const char *end= ptr + format->format.length;
DBUG_ENTER("extract_date_time");
- LINT_INIT(sunday_first_n_first_week_non_iso);
LINT_INIT(strict_week_number);
- LINT_INIT(strict_week_number_year_type);
if (!sub_pattern_end)
bzero((char*) l_time, sizeof(*l_time));
@@ -2140,8 +2138,10 @@ String *Item_char_typecast::val_str(String *str)
else
{
// Convert character set if differ
+ uint dummy_errors;
if (!(res1= args[0]->val_str(&tmp_value)) ||
- str->copy(res1->ptr(), res1->length(),res1->charset(), cast_cs))
+ str->copy(res1->ptr(), res1->length(), res1->charset(),
+ cast_cs, &dummy_errors))
{
null_value= 1;
return 0;
diff --git a/sql/log_event.cc b/sql/log_event.cc
index ee5af6ed1c0..c7f6f25e74a 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -1535,7 +1535,7 @@ end:
thd->query_length= thd->db_length =0;
VOID(pthread_mutex_unlock(&LOCK_thread_count));
close_thread_tables(thd);
- free_root(&thd->mem_root,MYF(MY_KEEP_PREALLOC));
+ free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
/*
If there was an error we stop. Otherwise we increment positions. Note that
we will not increment group* positions if we are just after a SET
@@ -2614,10 +2614,10 @@ Slave: load data infile on table '%s' at log position %s in log \
slave_print_error(rli,sql_errno,"\
Error '%s' running LOAD DATA INFILE on table '%s'. Default database: '%s'",
err, (char*)table_name, print_slave_db_safe(db));
- free_root(&thd->mem_root,MYF(MY_KEEP_PREALLOC));
+ free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
return 1;
}
- free_root(&thd->mem_root,MYF(MY_KEEP_PREALLOC));
+ free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
if (thd->is_fatal_error)
{
@@ -3250,7 +3250,7 @@ int User_var_log_event::exec_event(struct st_relay_log_info* rli)
*/
e.fix_fields(thd, 0, 0);
e.update_hash(val, val_len, type, charset, DERIVATION_NONE);
- free_root(&thd->mem_root,0);
+ free_root(thd->mem_root,0);
rli->inc_event_relay_log_pos();
return 0;
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index cd2cacad910..b343beaa4e4 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -997,7 +997,7 @@ extern char *default_tz_name;
extern MYSQL_LOG mysql_log,mysql_slow_log,mysql_bin_log;
extern FILE *bootstrap_file;
-extern pthread_key(MEM_ROOT*,THR_MALLOC);
+extern pthread_key(MEM_ROOT**,THR_MALLOC);
extern pthread_mutex_t LOCK_mysql_create_db,LOCK_Acl,LOCK_open,
LOCK_thread_count,LOCK_mapped_file,LOCK_user_locks, LOCK_status,
LOCK_error_log, LOCK_delayed_insert, LOCK_uuid_generator,
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 3d7ab14f13d..196b7af46b1 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -375,7 +375,7 @@ SHOW_COMP_OPTION have_crypt, have_compress;
/* Thread specific variables */
-pthread_key(MEM_ROOT*,THR_MALLOC);
+pthread_key(MEM_ROOT**,THR_MALLOC);
pthread_key(THD*, THR_THD);
pthread_mutex_t LOCK_mysql_create_db, LOCK_Acl, LOCK_open, LOCK_thread_count,
LOCK_mapped_file, LOCK_status,
@@ -2972,11 +2972,10 @@ we force server id to 2, but this MySQL server will not act as a slave.");
exit(1);
#ifdef __WIN__
-#define MYSQL_ERR_FILE "mysql.err"
if (!opt_console)
{
- freopen(MYSQL_ERR_FILE,"a+",stdout);
- freopen(MYSQL_ERR_FILE,"a+",stderr);
+ freopen(log_error_file,"a+",stdout);
+ freopen(log_error_file,"a+",stderr);
FreeConsole(); // Remove window
}
#endif
@@ -5132,12 +5131,12 @@ The minimum value for this variable is 4096.",
"Persistent buffer for query parsing and execution",
(gptr*) &global_system_variables.query_prealloc_size,
(gptr*) &max_system_variables.query_prealloc_size, 0, GET_ULONG,
- REQUIRED_ARG, QUERY_ALLOC_PREALLOC_SIZE, 1024, ~0L, 0, 1024, 0},
+ REQUIRED_ARG, QUERY_ALLOC_PREALLOC_SIZE, 16384, ~0L, 0, 1024, 0},
{"range_alloc_block_size", OPT_RANGE_ALLOC_BLOCK_SIZE,
"Allocation block size for storing ranges during optimization",
(gptr*) &global_system_variables.range_alloc_block_size,
(gptr*) &max_system_variables.range_alloc_block_size, 0, GET_ULONG,
- REQUIRED_ARG, RANGE_ALLOC_BLOCK_SIZE, 1024, ~0L, 0, 1024, 0},
+ REQUIRED_ARG, RANGE_ALLOC_BLOCK_SIZE, 4096, ~0L, 0, 1024, 0},
{"read_buffer_size", OPT_RECORD_BUFFER,
"Each thread that does a sequential scan allocates a buffer of this size for each table it scans. If you do many sequential scans, you may want to increase this value.",
(gptr*) &global_system_variables.read_buff_size,
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index 27311cb5613..bcb1f8634c0 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -53,19 +53,9 @@
#include <errno.h>
#ifdef EMBEDDED_LIBRARY
-
#undef MYSQL_SERVER
-
-#ifndef MYSQL_CLIENT
+#undef MYSQL_CLIENT
#define MYSQL_CLIENT
-#endif
-
-#undef net_flush
-
-extern "C" {
-my_bool net_flush(NET *net);
-}
-
#endif /*EMBEDDED_LIBRARY */
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 286d0d01842..f036cbc799b 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -724,7 +724,7 @@ QUICK_RANGE_SELECT::QUICK_RANGE_SELECT(THD *thd, TABLE *table, uint key_nr,
{
// Allocates everything through the internal memroot
init_sql_alloc(&alloc, thd->variables.range_alloc_block_size, 0);
- my_pthread_setspecific_ptr(THR_MALLOC,&alloc);
+ thd->mem_root= &alloc;
}
else
bzero((char*) &alloc,sizeof(alloc));
@@ -1041,7 +1041,7 @@ QUICK_ROR_UNION_SELECT::QUICK_ROR_UNION_SELECT(THD *thd_param,
rowid_length= table->file->ref_length;
record= head->record[0];
init_sql_alloc(&alloc, thd->variables.range_alloc_block_size, 0);
- my_pthread_setspecific_ptr(THR_MALLOC,&alloc);
+ thd_param->mem_root= &alloc;
}
@@ -1476,7 +1476,8 @@ public:
KEY_PART_INFO *min_max_arg_part_arg,
uint group_prefix_len_arg, uint used_key_parts_arg,
uint group_key_parts_arg, KEY *index_info_arg,
- uint index_arg, uint key_infix_len_arg, byte *key_infix_arg,
+ uint index_arg, uint key_infix_len_arg,
+ byte *key_infix_arg,
SEL_TREE *tree_arg, SEL_ARG *index_tree_arg,
uint param_idx_arg, ha_rows quick_prefix_records_arg)
: have_min(have_min_arg), have_max(have_max_arg),
@@ -1486,12 +1487,10 @@ public:
index(index_arg), key_infix_len(key_infix_len_arg), range_tree(tree_arg),
index_tree(index_tree_arg), param_idx(param_idx_arg),
quick_prefix_records(quick_prefix_records_arg)
-{
- if (key_infix_len)
- memcpy(this->key_infix, key_infix_arg, key_infix_len);
-}
-
-
+ {
+ if (key_infix_len)
+ memcpy(this->key_infix, key_infix_arg, key_infix_len);
+ }
QUICK_SELECT_I *make_quick(PARAM *param, bool retrieve_full_rows,
MEM_ROOT *parent_alloc);
@@ -1649,8 +1648,8 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
DBUG_RETURN(0); // Can't use range
}
key_parts= param.key_parts;
- old_root=my_pthread_getspecific_ptr(MEM_ROOT*,THR_MALLOC);
- my_pthread_setspecific_ptr(THR_MALLOC,&alloc);
+ old_root= thd->mem_root;
+ thd->mem_root= &alloc;
/*
Make an array with description of all key parts of all table keys.
@@ -1795,7 +1794,7 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
}
}
- my_pthread_setspecific_ptr(THR_MALLOC, old_root);
+ thd->mem_root= old_root;
/* If we got a read plan, create a quick select from it. */
if (best_trp)
@@ -1809,8 +1808,8 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
}
free_mem:
- my_pthread_setspecific_ptr(THR_MALLOC, old_root);
free_root(&alloc,MYF(0)); // Return memory & allocator
+ thd->mem_root= old_root;
thd->no_errors=0;
}
@@ -3566,13 +3565,22 @@ get_mm_leaf(PARAM *param, COND *conf_func, Field *field, KEY_PART *key_part,
}
/*
- We can't use an index when comparing strings of
- different collations
+ 1. Usually we can't use an index if the column collation
+ differ from the operation collation.
+
+ 2. However, we can reuse a case insensitive index for
+ the binary searches:
+
+ WHERE latin1_swedish_ci_column = 'a' COLLATE lati1_bin;
+
+ WHERE latin1_swedish_ci_colimn = BINARY 'a '
+
*/
if (field->result_type() == STRING_RESULT &&
value->result_type() == STRING_RESULT &&
key_part->image_type == Field::itRAW &&
- ((Field_str*)field)->charset() != conf_func->compare_collation())
+ ((Field_str*)field)->charset() != conf_func->compare_collation() &&
+ !(conf_func->compare_collation()->state & MY_CS_BINSORT))
DBUG_RETURN(0);
optimize_range= field->optimize_range(param->real_keynr[key_part->key],
@@ -5220,7 +5228,7 @@ static bool is_key_scan_ror(PARAM *param, uint keynr, uint8 nparts)
NOTES
The caller must call QUICK_SELECT::init for returned quick select
- CAUTION! This function may change THR_MALLOC to a MEM_ROOT which will be
+ CAUTION! This function may change thd->mem_root to a MEM_ROOT which will be
deallocated when the returned quick select is deleted.
RETURN
@@ -5464,7 +5472,8 @@ bool QUICK_ROR_UNION_SELECT::check_if_keys_used(List<Item> *fields)
QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table,
TABLE_REF *ref)
{
- MEM_ROOT *old_root= my_pthread_getspecific_ptr(MEM_ROOT*, THR_MALLOC);
+ MEM_ROOT *old_root= thd->mem_root;
+ /* The following call may change thd->mem_root */
QUICK_RANGE_SELECT *quick= new QUICK_RANGE_SELECT(thd, table, ref->key, 0);
KEY *key_info = &table->key_info[ref->key];
KEY_PART *key_part;
@@ -5525,11 +5534,11 @@ QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table,
}
ok:
- my_pthread_setspecific_ptr(THR_MALLOC, old_root);
+ thd->mem_root= old_root;
return quick;
err:
- my_pthread_setspecific_ptr(THR_MALLOC, old_root);
+ thd->mem_root= old_root;
delete quick;
return 0;
}
@@ -7488,10 +7497,10 @@ QUICK_GROUP_MIN_MAX_SELECT(TABLE *table, JOIN *join_arg, bool have_min_arg,
if (!parent_alloc)
{
init_sql_alloc(&alloc, join->thd->variables.range_alloc_block_size, 0);
- my_pthread_setspecific_ptr(THR_MALLOC,&alloc);
+ join->thd->mem_root= &alloc;
}
else
- bzero(&alloc, sizeof(MEM_ROOT));
+ bzero(&alloc, sizeof(MEM_ROOT)); // ensure that it's not used
}
diff --git a/sql/parse_file.cc b/sql/parse_file.cc
index f548c16d808..c3043ed2c73 100644
--- a/sql/parse_file.cc
+++ b/sql/parse_file.cc
@@ -608,15 +608,13 @@ parse_quoted_escaped_string(char *ptr, char *end,
my_bool
File_parser::parse(gptr base, MEM_ROOT *mem_root,
- struct File_option *parameters, uint required)
+ struct File_option *parameters, uint required)
{
uint first_param= 0, found= 0;
register char *ptr= start;
char *eol;
LEX_STRING *str;
- MEM_ROOT *sql_mem;
List<LEX_STRING> *list;
- bool change_mem;
DBUG_ENTER("File_parser::parse");
while (ptr < end && found < required)
@@ -720,18 +718,7 @@ File_parser::parse(gptr base, MEM_ROOT *mem_root,
}
case FILE_OPTIONS_STRLIST:
{
- /*
- TODO: remove play with mem_root, when List will be able
- to store MEM_ROOT* pointer for list elements allocation
- FIXME: we can't handle empty lists
- */
- sql_mem= my_pthread_getspecific_ptr(MEM_ROOT*, THR_MALLOC);
- list= (List<LEX_STRING>*)(base + parameter->offset);
- if ((change_mem= (sql_mem != mem_root)))
- {
- change_mem= 1;
- my_pthread_setspecific_ptr(THR_MALLOC, mem_root);
- }
+ list= (List<LEX_STRING>*)(base + parameter->offset);
list->empty();
// list parsing
@@ -739,7 +726,7 @@ File_parser::parse(gptr base, MEM_ROOT *mem_root,
{
if (!(str= (LEX_STRING*)alloc_root(mem_root,
sizeof(LEX_STRING))) ||
- list->push_back(str))
+ list->push_back(str, mem_root))
goto list_err;
if(!(ptr= parse_quoted_escaped_string(ptr, end, mem_root, str)))
goto list_err_w_message;
@@ -754,20 +741,15 @@ File_parser::parse(gptr base, MEM_ROOT *mem_root,
goto list_err_w_message;
}
}
- end_of_list:
+ end_of_list:
if (*(ptr++) != '\n')
goto list_err;
-
- if (change_mem)
- my_pthread_setspecific_ptr(THR_MALLOC, sql_mem);
break;
list_err_w_message:
my_error(ER_FPARSER_ERROR_IN_PARAMETER, MYF(0),
parameter->name.str, line);
list_err:
- if (change_mem)
- my_pthread_setspecific_ptr(THR_MALLOC, sql_mem);
DBUG_RETURN(TRUE);
}
default:
diff --git a/sql/protocol.cc b/sql/protocol.cc
index 051eaaf7bda..2b0ae60f944 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -486,6 +486,15 @@ void Protocol::init(THD *thd_arg)
}
+bool Protocol::flush()
+{
+#ifndef EMBEDDED_LIBRARY
+ return net_flush(&thd->net);
+#else
+ return 0;
+#endif
+}
+
/*
Send name and type of result to client.
@@ -731,7 +740,8 @@ bool Protocol::store_string_aux(const char *from, uint length,
fromcs != &my_charset_bin &&
tocs != &my_charset_bin)
{
- return convert->copy(from, length, fromcs, tocs) ||
+ uint dummy_errors;
+ return convert->copy(from, length, fromcs, tocs, &dummy_errors) ||
net_store_data(convert->ptr(), convert->length());
}
return net_store_data(from, length);
diff --git a/sql/protocol.h b/sql/protocol.h
index 7d390242417..d342af3ee9f 100644
--- a/sql/protocol.h
+++ b/sql/protocol.h
@@ -74,6 +74,7 @@ public:
field_count=item_list->elements;
return 0;
}
+ virtual bool flush();
virtual void prepare_for_resend()=0;
virtual bool store_null()=0;
diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc
index dc23b014e31..253b2c96545 100644
--- a/sql/repl_failsafe.cc
+++ b/sql/repl_failsafe.cc
@@ -92,7 +92,7 @@ static int init_failsafe_rpl_thread(THD* thd)
VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals));
#endif
- thd->mem_root.free=thd->mem_root.used=0;
+ thd->mem_root->free= thd->mem_root->used= 0;
if (thd->variables.max_join_size == HA_POS_ERROR)
thd->options|= OPTION_BIG_SELECTS;
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 8ffed33d442..ccac3082d5b 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -1193,7 +1193,7 @@ static void fix_max_connections(THD *thd, enum_var_type type)
static void fix_thd_mem_root(THD *thd, enum_var_type type)
{
if (type != OPT_GLOBAL)
- reset_root_defaults(&thd->mem_root,
+ reset_root_defaults(thd->mem_root,
thd->variables.query_alloc_block_size,
thd->variables.query_prealloc_size);
}
diff --git a/sql/sp.cc b/sql/sp.cc
index a1e52ee1ca7..96bb8a17a49 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -166,7 +166,7 @@ db_find_routine(THD *thd, int type, sp_name *name, sp_head **sphp)
}
bzero((char *)&chistics, sizeof(chistics));
- if ((ptr= get_field(&thd->mem_root,
+ if ((ptr= get_field(thd->mem_root,
table->field[MYSQL_PROC_FIELD_ACCESS])) == NULL)
{
ret= SP_GET_FIELD_FAILED;
@@ -189,7 +189,7 @@ db_find_routine(THD *thd, int type, sp_name *name, sp_head **sphp)
chistics.daccess= SP_CONTAINS_SQL;
}
- if ((ptr= get_field(&thd->mem_root,
+ if ((ptr= get_field(thd->mem_root,
table->field[MYSQL_PROC_FIELD_DETERMINISTIC])) == NULL)
{
ret= SP_GET_FIELD_FAILED;
@@ -197,7 +197,7 @@ db_find_routine(THD *thd, int type, sp_name *name, sp_head **sphp)
}
chistics.detistic= (ptr[0] == 'N' ? FALSE : TRUE);
- if ((ptr= get_field(&thd->mem_root,
+ if ((ptr= get_field(thd->mem_root,
table->field[MYSQL_PROC_FIELD_SECURITY_TYPE])) == NULL)
{
ret= SP_GET_FIELD_FAILED;
@@ -205,7 +205,7 @@ db_find_routine(THD *thd, int type, sp_name *name, sp_head **sphp)
}
chistics.suid= (ptr[0] == 'I' ? SP_IS_NOT_SUID : SP_IS_SUID);
- if ((params= get_field(&thd->mem_root,
+ if ((params= get_field(thd->mem_root,
table->field[MYSQL_PROC_FIELD_PARAM_LIST])) == NULL)
{
params= "";
@@ -213,14 +213,14 @@ db_find_routine(THD *thd, int type, sp_name *name, sp_head **sphp)
if (type == TYPE_ENUM_PROCEDURE)
returns= "";
- else if ((returns= get_field(&thd->mem_root,
+ else if ((returns= get_field(thd->mem_root,
table->field[MYSQL_PROC_FIELD_RETURNS])) == NULL)
{
ret= SP_GET_FIELD_FAILED;
goto done;
}
- if ((body= get_field(&thd->mem_root,
+ if ((body= get_field(thd->mem_root,
table->field[MYSQL_PROC_FIELD_BODY])) == NULL)
{
ret= SP_GET_FIELD_FAILED;
@@ -228,7 +228,7 @@ db_find_routine(THD *thd, int type, sp_name *name, sp_head **sphp)
}
// Get additional information
- if ((definer= get_field(&thd->mem_root,
+ if ((definer= get_field(thd->mem_root,
table->field[MYSQL_PROC_FIELD_DEFINER])) == NULL)
{
ret= SP_GET_FIELD_FAILED;
@@ -511,10 +511,10 @@ print_field_values(THD *thd, TABLE *table,
String name_string;
struct st_used_field *used_field= used_fields;
- if (get_field(&thd->mem_root, used_field->field, &db_string))
+ if (get_field(thd->mem_root, used_field->field, &db_string))
db_string.set_ascii("", 0);
used_field+= 1;
- get_field(&thd->mem_root, used_field->field, &name_string);
+ get_field(thd->mem_root, used_field->field, &name_string);
if (!wild || !wild[0] || !wild_compare(name_string.ptr(), wild, 0))
{
@@ -539,7 +539,7 @@ print_field_values(THD *thd, TABLE *table,
{
String tmp_string;
- get_field(&thd->mem_root, used_field->field, &tmp_string);
+ get_field(thd->mem_root, used_field->field, &tmp_string);
protocol->store(&tmp_string);
}
break;
@@ -982,7 +982,7 @@ sp_cache_functions(THD *thd, LEX *lex)
newlex->proc_table= oldlex->proc_table; // hint if mysql.oper is opened
name.m_name.str= strchr(name.m_qname.str, '.');
name.m_db.length= name.m_name.str - name.m_qname.str;
- name.m_db.str= strmake_root(&thd->mem_root,
+ name.m_db.str= strmake_root(thd->mem_root,
name.m_qname.str, name.m_db.length);
name.m_name.str+= 1;
name.m_name.length= name.m_qname.length - name.m_db.length - 1;
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 8de1b6e906a..47e3952bcdd 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -190,7 +190,7 @@ void
sp_name::init_qname(THD *thd)
{
m_qname.length= m_db.length+m_name.length+1;
- m_qname.str= alloc_root(&thd->mem_root, m_qname.length+1);
+ m_qname.str= thd->alloc(m_qname.length+1);
sprintf(m_qname.str, "%*s.%*s",
m_db.length, (m_db.length ? m_db.str : ""),
m_name.length, m_name.str);
@@ -232,10 +232,9 @@ sp_head::operator new(size_t size)
MEM_ROOT own_root;
sp_head *sp;
- bzero((char *)&own_root, sizeof(own_root));
init_alloc_root(&own_root, MEM_ROOT_BLOCK_SIZE, MEM_ROOT_PREALLOC);
- sp= (sp_head *)alloc_root(&own_root, size);
- sp->mem_root= own_root;
+ sp= (sp_head *) alloc_root(&own_root, size);
+ sp->main_mem_root= own_root;
DBUG_PRINT("info", ("mem_root 0x%lx", (ulong) &sp->mem_root));
DBUG_RETURN(sp);
}
@@ -245,9 +244,10 @@ sp_head::operator delete(void *ptr, size_t size)
{
DBUG_ENTER("sp_head::operator delete");
MEM_ROOT own_root;
- sp_head *sp= (sp_head *)ptr;
+ sp_head *sp= (sp_head *) ptr;
- memcpy(&own_root, (const void *)&sp->mem_root, sizeof(MEM_ROOT));
+ /* Make a copy of main_mem_root as free_root will free the sp */
+ own_root= sp->main_mem_root;
DBUG_PRINT("info", ("mem_root 0x%lx moved to 0x%lx",
(ulong) &sp->mem_root, (ulong) &own_root));
free_root(&own_root, MYF(0));
@@ -291,7 +291,7 @@ sp_head::init_strings(THD *thd, LEX *lex, sp_name *name)
DBUG_ENTER("sp_head::init_strings");
uint n; /* Counter for nul trimming */
/* During parsing, we must use thd->mem_root */
- MEM_ROOT *root= &thd->mem_root;
+ MEM_ROOT *root= thd->mem_root;
/* We have to copy strings to get them into the right memroot */
if (name)
@@ -916,19 +916,19 @@ sp_head::set_info(char *definer, uint definerlen,
if (! p)
p= definer; // Weird...
len= p-definer;
- m_definer_user.str= strmake_root(&mem_root, definer, len);
+ m_definer_user.str= strmake_root(mem_root, definer, len);
m_definer_user.length= len;
len= definerlen-len-1;
- m_definer_host.str= strmake_root(&mem_root, p+1, len);
+ m_definer_host.str= strmake_root(mem_root, p+1, len);
m_definer_host.length= len;
m_created= created;
m_modified= modified;
- m_chistics= (st_sp_chistics *)alloc_root(&mem_root, sizeof(st_sp_chistics));
- memcpy(m_chistics, chistics, sizeof(st_sp_chistics));
+ m_chistics= (st_sp_chistics *) memdup_root(mem_root, (char*) chistics,
+ sizeof(*chistics));
if (m_chistics->comment.length == 0)
m_chistics->comment.str= 0;
else
- m_chistics->comment.str= strmake_root(&mem_root,
+ m_chistics->comment.str= strmake_root(mem_root,
m_chistics->comment.str,
m_chistics->comment.length);
m_sql_mode= sql_mode;
@@ -939,14 +939,14 @@ sp_head::reset_thd_mem_root(THD *thd)
{
DBUG_ENTER("sp_head::reset_thd_mem_root");
m_thd_root= thd->mem_root;
- thd->mem_root= mem_root;
+ thd->mem_root= &main_mem_root;
DBUG_PRINT("info", ("mem_root 0x%lx moved to thd mem root 0x%lx",
(ulong) &mem_root, (ulong) &thd->mem_root));
free_list= thd->free_list; // Keep the old list
thd->free_list= NULL; // Start a new one
/* Copy the db, since substatements will point to it */
m_thd_db= thd->db;
- thd->db= strmake_root(&thd->mem_root, thd->db, thd->db_length);
+ thd->db= thd->strmake(thd->db, thd->db_length);
m_thd= thd;
DBUG_VOID_RETURN;
}
diff --git a/sql/sp_head.h b/sql/sp_head.h
index 6aa05838291..4bfe1076f65 100644
--- a/sql/sp_head.h
+++ b/sql/sp_head.h
@@ -231,7 +231,7 @@ public:
private:
- MEM_ROOT m_thd_root; // Temp. store for thd's mem_root
+ MEM_ROOT *m_thd_root; // Temp. store for thd's mem_root
THD *m_thd; // Set if we have reset mem_root
char *m_thd_db; // Original thd->db pointer
diff --git a/sql/spatial.cc b/sql/spatial.cc
index 0668dd2faab..bcfefd9dde8 100644
--- a/sql/spatial.cc
+++ b/sql/spatial.cc
@@ -828,9 +828,7 @@ int Gis_polygon::centroid_xy(double *x, double *y) const
if (!first_loop)
{
- double d_area= res_area - cur_area;
- if (d_area <= 0)
- return 1;
+ double d_area= fabs(res_area - cur_area);
res_cx= (res_area * res_cx - cur_area * cur_cx) / d_area;
res_cy= (res_area * res_cy - cur_area * cur_cy) / d_area;
}
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index bed3130462d..e7b3e13274f 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -2426,8 +2426,8 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
create_new_users= test_if_create_new_users(thd);
int result=0;
rw_wrlock(&LOCK_grant);
- MEM_ROOT *old_root=my_pthread_getspecific_ptr(MEM_ROOT*,THR_MALLOC);
- my_pthread_setspecific_ptr(THR_MALLOC,&memex);
+ MEM_ROOT *old_root= thd->mem_root;
+ thd->mem_root= &memex;
while ((Str = str_list++))
{
@@ -2535,7 +2535,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
}
}
grant_option=TRUE;
- my_pthread_setspecific_ptr(THR_MALLOC,old_root);
+ thd->mem_root= old_root;
rw_unlock(&LOCK_grant);
if (!result)
send_ok(thd);
@@ -2667,6 +2667,7 @@ my_bool grant_init(THD *org_thd)
THD *thd;
TABLE_LIST tables[2];
MYSQL_LOCK *lock;
+ MEM_ROOT *memex_ptr;
my_bool return_val= 1;
TABLE *t_table, *c_table;
bool check_no_resolve= specialflag & SPECIAL_NO_RESOLVE;
@@ -2714,7 +2715,8 @@ my_bool grant_init(THD *org_thd)
grant_option= TRUE;
/* Will be restored by org_thd->store_globals() */
- my_pthread_setspecific_ptr(THR_MALLOC,&memex);
+ memex_ptr= &memex;
+ my_pthread_setspecific_ptr(THR_MALLOC, &memex_ptr);
do
{
GRANT_TABLE *mem_check;
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 959af0067e7..39604ce4deb 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -509,7 +509,7 @@ void close_temporary_tables(THD *thd)
*/
query_buf_size+= table->key_length+1;
- if ((query = alloc_root(&thd->mem_root, query_buf_size)))
+ if ((query = alloc_root(thd->mem_root, query_buf_size)))
// Better add "if exists", in case a RESET MASTER has been done
end=strmov(query, "DROP /*!40005 TEMPORARY */ TABLE IF EXISTS ");
@@ -816,7 +816,7 @@ TABLE *reopen_name_locked_table(THD* thd, TABLE_LIST* table_list)
pthread_mutex_lock(&LOCK_open);
if (open_unireg_entry(thd, table, db, table_name, table_name, 0,
- &thd->mem_root) ||
+ thd->mem_root) ||
!(table->table_cache_key =memdup_root(&table->mem_root,(char*) key,
key_length)))
{
@@ -1136,7 +1136,7 @@ bool reopen_table(TABLE *table,bool locked)
safe_mutex_assert_owner(&LOCK_open);
if (open_unireg_entry(table->in_use, &tmp, db, table_name,
- table->table_name, 0, &table->in_use->mem_root))
+ table->table_name, 0, table->in_use->mem_root))
goto end;
free_io_cache(table);
@@ -1775,7 +1775,7 @@ TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type lock_type)
thd->current_tablenr= 0;
/* open_ltable can be used only for BASIC TABLEs */
table_list->required_type= FRMTYPE_TABLE;
- while (!(table= open_table(thd, table_list, &thd->mem_root, &refresh)) &&
+ while (!(table= open_table(thd, table_list, thd->mem_root, &refresh)) &&
refresh)
;
@@ -2600,24 +2600,20 @@ int setup_wild(THD *thd, TABLE_LIST *tables, List<Item> &fields,
List<Item> *sum_func_list,
uint wild_num)
{
- Item *item;
- DBUG_ENTER("setup_wild");
-
if (!wild_num)
- DBUG_RETURN(0);
+ return(0);
- Item_arena *arena= thd->current_arena, backup;
+ Item *item;
+ List_iterator<Item> it(fields);
+ Item_arena *arena, backup;
+ DBUG_ENTER("setup_wild");
/*
Don't use arena if we are not in prepared statements or stored procedures
For PS/SP we have to use arena to remember the changes
*/
- if (arena->is_conventional())
- arena= 0; // For easier test later one
- else
- thd->set_n_backup_item_arena(arena, &backup);
+ arena= thd->change_arena_if_needed(&backup);
- List_iterator<Item> it(fields);
while (wild_num && (item= it++))
{
if (item->type() == Item::FIELD_ITEM &&
@@ -3006,7 +3002,8 @@ insert_fields(THD *thd, TABLE_LIST *tables, const char *db_name,
during cleunup() this item will be put in list to replace
expression from VIEW
*/
- thd->nocheck_register_item_tree_change(it->ref(), item, &thd->mem_root);
+ thd->nocheck_register_item_tree_change(it->ref(), item,
+ thd->mem_root);
}
}
/* All fields are used */
@@ -3111,7 +3108,7 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds)
}
if (arena)
- thd->set_n_backup_item_arena(arena, &backup);
+ arena= thd->change_arena_if_needed(&backup);
TABLE *t1=tab1->table;
TABLE *t2=tab2->table;
@@ -3212,7 +3209,7 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds)
embedding->nested_join->join_list.head() == embedded);
}
- if (arena)
+ if (!thd->current_arena->is_conventional())
{
/*
We are in prepared statement preparation code => we should store
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index f5283020b30..15e1cc7e212 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -316,7 +316,7 @@ void THD::init_for_queries()
{
ha_enable_transaction(this,TRUE);
- reset_root_defaults(&mem_root, variables.query_alloc_block_size,
+ reset_root_defaults(mem_root, variables.query_alloc_block_size,
variables.query_prealloc_size);
reset_root_defaults(&transaction.mem_root,
variables.trans_alloc_block_size,
@@ -431,7 +431,7 @@ THD::~THD()
dbug_sentry= THD_SENTRY_GONE;
#endif
/* Reset stmt_backup.mem_root to not double-free memory from thd.mem_root */
- clear_alloc_root(&stmt_backup.mem_root);
+ clear_alloc_root(&stmt_backup.main_mem_root);
DBUG_VOID_RETURN;
}
@@ -567,13 +567,14 @@ bool THD::convert_string(LEX_STRING *to, CHARSET_INFO *to_cs,
{
DBUG_ENTER("convert_string");
size_s new_length= to_cs->mbmaxlen * from_length;
+ uint dummy_errors;
if (!(to->str= alloc(new_length+1)))
{
to->length= 0; // Safety fix
DBUG_RETURN(1); // EOM
}
to->length= copy_and_convert((char*) to->str, new_length, to_cs,
- from, from_length, from_cs);
+ from, from_length, from_cs, &dummy_errors);
to->str[to->length]=0; // Safety
DBUG_RETURN(0);
}
@@ -596,7 +597,8 @@ bool THD::convert_string(LEX_STRING *to, CHARSET_INFO *to_cs,
bool THD::convert_string(String *s, CHARSET_INFO *from_cs, CHARSET_INFO *to_cs)
{
- if (convert_buffer.copy(s->ptr(), s->length(), from_cs, to_cs))
+ uint dummy_errors;
+ if (convert_buffer.copy(s->ptr(), s->length(), from_cs, to_cs, &dummy_errors))
return TRUE;
/* If convert_buffer >> s copying is more efficient long term */
if (convert_buffer.alloced_length() >= convert_buffer.length() * 2 ||
@@ -1463,10 +1465,10 @@ void select_dumpvar::cleanup()
for memory root initialization.
*/
Item_arena::Item_arena(THD* thd)
- :free_list(0),
- state(INITIALIZED)
+ :free_list(0), mem_root(&main_mem_root),
+ state(INITIALIZED)
{
- init_sql_alloc(&mem_root,
+ init_sql_alloc(&main_mem_root,
thd->variables.query_alloc_block_size,
thd->variables.query_prealloc_size);
}
@@ -1489,11 +1491,11 @@ Item_arena::Item_arena(THD* thd)
statements.
*/
Item_arena::Item_arena(bool init_mem_root)
- :free_list(0),
+ :free_list(0), mem_root(&main_mem_root),
state(CONVENTIONAL_EXECUTION)
{
if (init_mem_root)
- init_sql_alloc(&mem_root, ALLOC_ROOT_MIN_BLOCK_SIZE, 0);
+ init_sql_alloc(&main_mem_root, ALLOC_ROOT_MIN_BLOCK_SIZE, 0);
}
@@ -1624,14 +1626,14 @@ void Item_arena::restore_backup_item_arena(Item_arena *set, Item_arena *backup)
void Item_arena::set_item_arena(Item_arena *set)
{
- mem_root= set->mem_root;
+ mem_root= set->mem_root;
free_list= set->free_list;
state= set->state;
}
Statement::~Statement()
{
- free_root(&mem_root, MYF(0));
+ free_root(&main_mem_root, MYF(0));
}
C_MODE_START
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 0da77d5636a..f820f8b9cb9 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -515,7 +515,8 @@ public:
itself to the list on creation (see Item::Item() for details))
*/
Item *free_list;
- MEM_ROOT mem_root;
+ MEM_ROOT main_mem_root;
+ MEM_ROOT *mem_root; // Pointer to current memroot
#ifndef DBUG_OFF
bool backup_arena;
#endif
@@ -557,24 +558,24 @@ public:
{ return state == PREPARED || state == EXECUTED; }
inline bool is_conventional() const
{ return state == CONVENTIONAL_EXECUTION; }
- inline gptr alloc(unsigned int size) { return alloc_root(&mem_root,size); }
+ inline gptr alloc(unsigned int size) { return alloc_root(mem_root,size); }
inline gptr calloc(unsigned int size)
{
gptr ptr;
- if ((ptr=alloc_root(&mem_root,size)))
+ if ((ptr=alloc_root(mem_root,size)))
bzero((char*) ptr,size);
return ptr;
}
inline char *strdup(const char *str)
- { return strdup_root(&mem_root,str); }
+ { return strdup_root(mem_root,str); }
inline char *strmake(const char *str, uint size)
- { return strmake_root(&mem_root,str,size); }
+ { return strmake_root(mem_root,str,size); }
inline char *memdup(const char *str, uint size)
- { return memdup_root(&mem_root,str,size); }
+ { return memdup_root(mem_root,str,size); }
inline char *memdup_w_gap(const char *str, uint size, uint gap)
{
gptr ptr;
- if ((ptr=alloc_root(&mem_root,size+gap)))
+ if ((ptr=alloc_root(mem_root,size+gap)))
memcpy(ptr,str,size);
return ptr;
}
@@ -1171,11 +1172,26 @@ public:
inline CHARSET_INFO *charset() { return variables.character_set_client; }
void update_charset();
+ inline Item_arena *change_arena_if_needed(Item_arena *backup)
+ {
+ /*
+ use new arena if we are in a prepared statements and we have not
+ already changed to use this arena.
+ */
+ if (!current_arena->is_conventional() &&
+ mem_root != &current_arena->main_mem_root)
+ {
+ set_n_backup_item_arena(current_arena, backup);
+ return current_arena;
+ }
+ return 0;
+ }
+
void change_item_tree(Item **place, Item *new_value)
{
/* TODO: check for OOM condition here */
if (!current_arena->is_conventional())
- nocheck_register_item_tree_change(place, *place, &mem_root);
+ nocheck_register_item_tree_change(place, *place, mem_root);
*place= new_value;
}
void nocheck_register_item_tree_change(Item **place, Item *old_value,
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 982ad4a34a9..7a100d05b93 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -724,7 +724,7 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db,
if ((mysql_rm_known_files(thd, new_dirp, NullS, newpath,1)) < 0)
goto err;
if (!(copy_of_path= thd->memdup(newpath, length+1)) ||
- !(dir= new (&thd->mem_root) String(copy_of_path, length,
+ !(dir= new (thd->mem_root) String(copy_of_path, length,
&my_charset_bin)) ||
raid_dirs.push_back(dir))
goto err;
diff --git a/sql/sql_error.cc b/sql/sql_error.cc
index c09bfe0aea8..3fbefdd37ef 100644
--- a/sql/sql_error.cc
+++ b/sql/sql_error.cc
@@ -133,11 +133,11 @@ MYSQL_ERROR *push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level,
The following code is here to change the allocation to not
use the thd->mem_root, which is freed after each query
*/
- MEM_ROOT *old_root=my_pthread_getspecific_ptr(MEM_ROOT*,THR_MALLOC);
- my_pthread_setspecific_ptr(THR_MALLOC, &thd->warn_root);
+ MEM_ROOT *old_root= thd->mem_root;
+ thd->mem_root= &thd->warn_root;
if ((err= new MYSQL_ERROR(thd, code, level, msg)))
thd->warn_list.push_back(err);
- my_pthread_setspecific_ptr(THR_MALLOC, old_root);
+ thd->mem_root= old_root;
}
thd->warn_count[(uint) level]++;
thd->total_warn_count++;
diff --git a/sql/sql_help.cc b/sql/sql_help.cc
index b349a09e49e..b3d7bebe96a 100644
--- a/sql/sql_help.cc
+++ b/sql/sql_help.cc
@@ -126,7 +126,7 @@ void memorize_variant_topic(THD *thd, TABLE *topics, int count,
String *name, String *description, String *example)
{
DBUG_ENTER("memorize_variant_topic");
- MEM_ROOT *mem_root= &thd->mem_root;
+ MEM_ROOT *mem_root= thd->mem_root;
if (count==0)
{
get_field(mem_root,find_fields[help_topic_name].field, name);
@@ -137,7 +137,7 @@ void memorize_variant_topic(THD *thd, TABLE *topics, int count,
{
if (count == 1)
names->push_back(name);
- String *new_name= new (&thd->mem_root) String;
+ String *new_name= new (thd->mem_root) String;
get_field(mem_root,find_fields[help_topic_name].field,new_name);
names->push_back(new_name);
}
@@ -350,8 +350,8 @@ int search_categories(THD *thd, TABLE *categories,
{
if (select && !select->cond->val_int())
continue;
- String *lname= new (&thd->mem_root) String;
- get_field(&thd->mem_root,pfname,lname);
+ String *lname= new (thd->mem_root) String;
+ get_field(thd->mem_root,pfname,lname);
if (++count == 1 && res_id)
*res_id= (int16) pcat_id->val_int();
names->push_back(lname);
@@ -384,8 +384,8 @@ void get_all_items_for_category(THD *thd, TABLE *items, Field *pfname,
{
if (!select->cond->val_int())
continue;
- String *name= new (&thd->mem_root) String();
- get_field(&thd->mem_root,pfname,name);
+ String *name= new (thd->mem_root) String();
+ get_field(thd->mem_root,pfname,name);
res->push_back(name);
}
end_read_record(&read_record_info);
@@ -638,7 +638,7 @@ int mysqld_help(THD *thd, const char *mask)
String name, description, example;
int res, count_topics, count_categories, error;
uint mlen= strlen(mask);
- MEM_ROOT *mem_root= &thd->mem_root;
+ MEM_ROOT *mem_root= thd->mem_root;
if ((res= open_and_lock_tables(thd, tables)))
goto end;
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 63e11822f6e..71b427da8de 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -211,7 +211,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
{
/* it should be allocated before Item::fix_fields() */
table->insert_values=
- (byte *)alloc_root(&thd->mem_root, table->rec_buff_length);
+ (byte *)alloc_root(thd->mem_root, table->rec_buff_length);
if (!table->insert_values)
goto abort;
}
@@ -1124,7 +1124,7 @@ TABLE *delayed_insert::get_local_table(THD* client_thd)
found_next_number_field=table->found_next_number_field;
for (org_field=table->field ; *org_field ; org_field++,field++)
{
- if (!(*field= (*org_field)->new_field(&client_thd->mem_root,copy)))
+ if (!(*field= (*org_field)->new_field(client_thd->mem_root,copy)))
return 0;
(*field)->orig_table= copy; // Remove connection
(*field)->move_field(adjust_ptrs); // Point at copy->record[0]
diff --git a/sql/sql_list.h b/sql/sql_list.h
index d8d3719d39d..141742c3d4a 100644
--- a/sql/sql_list.h
+++ b/sql/sql_list.h
@@ -113,6 +113,16 @@ public:
}
return 1;
}
+ inline bool push_back(void *info, MEM_ROOT *mem_root)
+ {
+ if (((*last)=new (mem_root) list_node(info, &end_of_list)))
+ {
+ last= &(*last)->next;
+ elements++;
+ return 0;
+ }
+ return 1;
+ }
inline bool push_front(void *info)
{
list_node *node=new list_node(info,first);
@@ -284,6 +294,8 @@ public:
inline List() :base_list() {}
inline List(const List<T> &tmp) :base_list(tmp) {}
inline bool push_back(T *a) { return base_list::push_back(a); }
+ inline bool push_back(T *a, MEM_ROOT *mem_root)
+ { return base_list::push_back(a, mem_root); }
inline bool push_front(T *a) { return base_list::push_front(a); }
inline T* head() {return (T*) base_list::head(); }
inline T** head_ref() {return (T**) base_list::head_ref(); }
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 5c83a746f73..4353206064e 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -899,18 +899,20 @@ static int check_connection(THD *thd)
/* Since 4.1 all database names are stored in utf8 */
if (db)
{
+ uint dummy_errors;
db_buff[copy_and_convert(db_buff, sizeof(db_buff)-1,
system_charset_info,
db, strlen(db),
- thd->charset())]= 0;
+ thd->charset(), &dummy_errors)]= 0;
db= db_buff;
}
if (user)
{
+ uint dummy_errors;
user_buff[copy_and_convert(user_buff, sizeof(user_buff)-1,
system_charset_info, user, strlen(user),
- thd->charset())]= '\0';
+ thd->charset(), &dummy_errors)]= '\0';
user= user_buff;
}
@@ -1144,14 +1146,14 @@ extern "C" pthread_handler_decl(handle_bootstrap,arg)
{
thd->net.error = 0;
close_thread_tables(thd); // Free tables
- free_root(&thd->mem_root,MYF(MY_KEEP_PREALLOC));
+ free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
break;
}
mysql_parse(thd,thd->query,length);
close_thread_tables(thd); // Free tables
if (thd->is_fatal_error)
break;
- free_root(&thd->mem_root,MYF(MY_KEEP_PREALLOC));
+ free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
free_root(&thd->transaction.mem_root,MYF(MY_KEEP_PREALLOC));
}
@@ -1412,9 +1414,10 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
}
#endif
/* Convert database name to utf8 */
+ uint dummy_errors;
db_buff[copy_and_convert(db_buff, sizeof(db_buff)-1,
system_charset_info, db, strlen(db),
- thd->charset())]= 0;
+ thd->charset(), &dummy_errors)]= 0;
db= db_buff;
/* Save user and privileges */
@@ -1856,7 +1859,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
VOID(pthread_mutex_unlock(&LOCK_thread_count));
thd->packet.shrink(thd->variables.net_buffer_length); // Reclaim some memory
- free_root(&thd->mem_root,MYF(MY_KEEP_PREALLOC));
+ free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
DBUG_RETURN(error);
}
@@ -2141,15 +2144,19 @@ mysql_execute_command(THD *thd)
query_len= need_conversion? (pstr->length() * to_cs->mbmaxlen) :
pstr->length();
- if (!(query_str= alloc_root(&thd->mem_root, query_len+1)))
+ if (!(query_str= alloc_root(thd->mem_root, query_len+1)))
{
res= -1;
break; // EOM (error should be reported by allocator)
}
if (need_conversion)
- query_len= copy_and_convert(query_str, query_len, to_cs, pstr->ptr(),
- pstr->length(), pstr->charset());
+ {
+ uint dummy_errors;
+ query_len= copy_and_convert(query_str, query_len, to_cs,
+ pstr->ptr(), pstr->length(),
+ pstr->charset(), &dummy_errors);
+ }
else
memcpy(query_str, pstr->ptr(), pstr->length());
query_str[query_len]= 0;
@@ -2716,6 +2723,7 @@ unsent_create_error:
{
if (mysql_bin_log.is_open())
{
+ thd->clear_error(); // No binlog error generated
Query_log_event qinfo(thd, thd->query, thd->query_length, 0);
mysql_bin_log.write(&qinfo);
}
@@ -2745,6 +2753,7 @@ unsent_create_error:
{
if (mysql_bin_log.is_open())
{
+ thd->clear_error(); // No binlog error generated
Query_log_event qinfo(thd, thd->query, thd->query_length, 0);
mysql_bin_log.write(&qinfo);
}
@@ -2767,6 +2776,7 @@ unsent_create_error:
{
if (mysql_bin_log.is_open())
{
+ thd->clear_error(); // No binlog error generated
Query_log_event qinfo(thd, thd->query, thd->query_length, 0);
mysql_bin_log.write(&qinfo);
}
@@ -4479,8 +4489,8 @@ mysql_init_select(LEX *lex)
bool
mysql_new_select(LEX *lex, bool move_down)
{
- SELECT_LEX *select_lex = new(&lex->thd->mem_root) SELECT_LEX();
- if (!select_lex)
+ SELECT_LEX *select_lex;
+ if (!(select_lex= new(lex->thd->mem_root) SELECT_LEX()))
return 1;
select_lex->select_number= ++lex->thd->select_number;
select_lex->init_query();
@@ -4489,9 +4499,10 @@ mysql_new_select(LEX *lex, bool move_down)
if (move_down)
{
/* first select_lex of subselect or derived table */
- SELECT_LEX_UNIT *unit= new(&lex->thd->mem_root) SELECT_LEX_UNIT();
- if (!unit)
+ SELECT_LEX_UNIT *unit;
+ if (!(unit= new(lex->thd->mem_root) SELECT_LEX_UNIT()))
return 1;
+
unit->init_query();
unit->init_select();
unit->thd= lex->thd;
@@ -4518,7 +4529,8 @@ mysql_new_select(LEX *lex, bool move_down)
as far as we included SELECT_LEX for UNION unit should have
fake SELECT_LEX for UNION processing
*/
- fake= unit->fake_select_lex= new(&lex->thd->mem_root) SELECT_LEX();
+ if (!(fake= unit->fake_select_lex= new(lex->thd->mem_root) SELECT_LEX()))
+ return 1;
fake->include_standalone(unit,
(SELECT_LEX_NODE**)&unit->fake_select_lex);
fake->select_number= INT_MAX;
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 3b6aa7594f1..1c23162b212 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -171,8 +171,7 @@ static bool send_prep_stmt(Prepared_statement *stmt, uint columns)
(stmt->param_count &&
stmt->thd->protocol_simple.send_fields((List<Item> *)
&stmt->lex->param_list,
- Protocol::SEND_EOF)) ||
- net_flush(net));
+ Protocol::SEND_EOF)));
}
#else
static bool send_prep_stmt(Prepared_statement *stmt,
@@ -1072,7 +1071,7 @@ static int mysql_test_select(Prepared_statement *stmt,
DBUG_RETURN(1);
#endif
- if (!lex->result && !(lex->result= new (&stmt->mem_root) select_send))
+ if (!lex->result && !(lex->result= new (stmt->mem_root) select_send))
{
send_error(thd);
goto err;
@@ -1098,7 +1097,7 @@ static int mysql_test_select(Prepared_statement *stmt,
{
if (lex->describe)
{
- if (send_prep_stmt(stmt, 0))
+ if (send_prep_stmt(stmt, 0) || thd->protocol->flush())
goto err_prep;
}
else
@@ -1116,11 +1115,8 @@ static int mysql_test_select(Prepared_statement *stmt,
prepared in unit->prepare call above.
*/
if (send_prep_stmt(stmt, lex->result->field_count(fields)) ||
- lex->result->send_fields(fields, Protocol::SEND_EOF)
-#ifndef EMBEDDED_LIBRARY
- || net_flush(&thd->net)
-#endif
- )
+ lex->result->send_fields(fields, Protocol::SEND_EOF) ||
+ thd->protocol->flush())
goto err_prep;
}
}
@@ -1407,7 +1403,6 @@ static int send_prepare_results(Prepared_statement *stmt, bool text_protocol)
enum enum_sql_command sql_command= lex->sql_command;
int res= 0;
DBUG_ENTER("send_prepare_results");
-
DBUG_PRINT("enter",("command: %d, param_count: %ld",
sql_command, stmt->param_count));
@@ -1472,6 +1467,7 @@ static int send_prepare_results(Prepared_statement *stmt, bool text_protocol)
break;
case SQLCOM_INSERT_SELECT:
+ case SQLCOM_REPLACE_SELECT:
res= mysql_test_insert_select(stmt, tables);
break;
@@ -1510,7 +1506,8 @@ static int send_prepare_results(Prepared_statement *stmt, bool text_protocol)
goto error;
}
if (res == 0)
- DBUG_RETURN(text_protocol? 0 : send_prep_stmt(stmt, 0));
+ DBUG_RETURN(text_protocol? 0 : (send_prep_stmt(stmt, 0) ||
+ thd->protocol->flush()));
error:
if (res < 0)
send_error(thd,thd->killed_errno());
@@ -1540,7 +1537,7 @@ static bool init_param_array(Prepared_statement *stmt)
List_iterator<Item_param> param_iterator(lex->param_list);
/* Use thd->mem_root as it points at statement mem_root */
stmt->param_array= (Item_param **)
- alloc_root(&stmt->thd->mem_root,
+ alloc_root(stmt->thd->mem_root,
sizeof(Item_param*) * stmt->param_count);
if (!stmt->param_array)
{
@@ -1606,7 +1603,7 @@ int mysql_stmt_prepare(THD *thd, char *packet, uint packet_length,
if (name)
{
stmt->name.length= name->length;
- if (!(stmt->name.str= memdup_root(&stmt->mem_root, (char*)name->str,
+ if (!(stmt->name.str= memdup_root(stmt->mem_root, (char*)name->str,
name->length)))
{
delete stmt;
@@ -1850,7 +1847,7 @@ void mysql_stmt_execute(THD *thd, char *packet, uint packet_length)
{
DBUG_PRINT("info",("Using READ_ONLY cursor"));
if (!stmt->cursor &&
- !(stmt->cursor= new (&stmt->mem_root) Cursor()))
+ !(stmt->cursor= new (&stmt->main_mem_root) Cursor()))
{
send_error(thd, ER_OUT_OF_RESOURCES);
DBUG_VOID_RETURN;
@@ -2035,7 +2032,12 @@ static void execute_stmt(THD *thd, Prepared_statement *stmt,
/*
COM_FETCH handler: fetches requested amount of rows from cursor
+
SYNOPSIS
+ mysql_stmt_fetch()
+ thd Thread handler
+ packet Packet from client (with stmt_id & num_rows)
+ packet_length Length of packet
*/
void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length)
@@ -2045,7 +2047,6 @@ void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length)
ulong num_rows= uint4korr(packet+=4);
Statement *stmt;
int error;
-
DBUG_ENTER("mysql_stmt_fetch");
thd->current_arena= stmt;
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 18ffb7079c8..83c69ab7727 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1652,9 +1652,13 @@ Cursor::init_from_thd(THD *thd)
/*
We need to save and reset thd->mem_root, otherwise it'll be freed
later in mysql_parse.
+
+ We can't just change the thd->mem_root here as we want to keep the things
+ that is already allocated in thd->mem_root for Cursor::fetch()
*/
- mem_root= thd->mem_root;
- init_sql_alloc(&thd->mem_root,
+ main_mem_root= *thd->mem_root;
+ /* Allocate new memory root for thd */
+ init_sql_alloc(thd->mem_root,
thd->variables.query_alloc_block_size,
thd->variables.query_prealloc_size);
@@ -1668,7 +1672,7 @@ Cursor::init_from_thd(THD *thd)
open_tables= thd->open_tables;
lock= thd->lock;
query_id= thd->query_id;
- free_list= thd->free_list;
+ free_list= thd->free_list;
reset_thd(thd);
/*
XXX: thd->locked_tables is not changed.
@@ -1769,15 +1773,15 @@ int
Cursor::fetch(ulong num_rows)
{
THD *thd= join->thd;
- JOIN_TAB *join_tab= join->join_tab + join->const_tables;;
+ JOIN_TAB *join_tab= join->join_tab + join->const_tables;
COND *on_expr= *join_tab->on_expr_ref;
COND *select_cond= join_tab->select_cond;
READ_RECORD *info= &join_tab->read_record;
-
int error= 0;
/* save references to memory, allocated during fetch */
thd->set_n_backup_item_arena(this, &thd->stmt_backup);
+
join->fetch_limit+= num_rows;
/*
@@ -1841,6 +1845,7 @@ Cursor::fetch(ulong num_rows)
if (thd->net.report_error)
error= -1;
+
if (error == -3) /* LIMIT clause worked */
error= 0;
@@ -1923,7 +1928,7 @@ Cursor::~Cursor()
Must be last, as some memory might be allocated for free purposes,
like in free_tmp_table() (TODO: fix this issue)
*/
- free_root(&mem_root, MYF(0));
+ free_root(&main_mem_root, MYF(0));
}
/*********************************************************************/
@@ -5002,7 +5007,7 @@ add_found_match_trig_cond(JOIN_TAB *tab, COND *cond, JOIN_TAB *root_tab)
{
tmp= new Item_func_trig_cond(tmp, &tab->found);
}
- if (!tmp)
+ if (tmp)
tmp->quick_fix_field();
return tmp;
}
@@ -5276,8 +5281,17 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
/* Join with outer join condition */
COND *orig_cond=sel->cond;
sel->cond= and_conds(sel->cond, *tab->on_expr_ref);
+
+ /*
+ We can't call sel->cond->fix_fields,
+ as it will break tab->on_expr if it's AND condition
+ (fix_fields currently removes extra AND/OR levels).
+ Yet attributes of the just built condition are not needed.
+ Thus we call sel->cond->quick_fix_field for safety.
+ */
if (sel->cond && !sel->cond->fixed)
- sel->cond->fix_fields(join->thd, 0, &sel->cond);
+ sel->cond->quick_fix_field();
+
if (sel->test_quick_select(join->thd, tab->keys,
used_tables & ~ current_map,
(join->select_options &
@@ -7474,7 +7488,7 @@ static Field* create_tmp_field_from_field(THD *thd, Field* org_field,
org_field->field_name, table,
org_field->charset());
else
- new_field= org_field->new_field(&thd->mem_root, table);
+ new_field= org_field->new_field(thd->mem_root, table);
if (new_field)
{
if (modify_item)
@@ -8077,7 +8091,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
if (!using_unique_constraint)
{
group->buff=(char*) group_buff;
- if (!(group->field=field->new_field(&thd->mem_root,table)))
+ if (!(group->field=field->new_field(thd->mem_root,table)))
goto err; /* purecov: inspected */
if (maybe_null)
{
@@ -11675,7 +11689,7 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
saved value
*/
Field *field= item->field;
- item->result_field=field->new_field(&thd->mem_root,field->table);
+ item->result_field=field->new_field(thd->mem_root,field->table);
char *tmp=(char*) sql_alloc(field->pack_length()+1);
if (!tmp)
goto err;
@@ -12122,7 +12136,7 @@ bool JOIN::rollup_init()
return 1;
rollup.ref_pointer_arrays= (Item***) (rollup.fields + send_group_parts);
ref_array= (Item**) (rollup.ref_pointer_arrays+send_group_parts);
- rollup.item_null= new (&thd->mem_root) Item_null();
+ rollup.item_null= new (thd->mem_root) Item_null();
/*
Prepare space for field list for the different levels
diff --git a/sql/sql_select.h b/sql/sql_select.h
index d489e911363..e1bf60f6896 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -426,7 +426,7 @@ class store_key :public Sql_alloc
field_arg->table, field_arg->charset());
else
{
- to_field=field_arg->new_field(&thd->mem_root,field_arg->table);
+ to_field=field_arg->new_field(thd->mem_root,field_arg->table);
if (to_field)
to_field->move_field(ptr, (uchar*) null, 1);
}
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 28e9baa1c36..557ec1bd5d2 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -804,8 +804,9 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild,
String def(tmp1,sizeof(tmp1), system_charset_info);
type.set(tmp, sizeof(tmp), field->charset());
field->val_str(&type);
+ uint dummy_errors;
def.copy(type.ptr(), type.length(), type.charset(),
- system_charset_info);
+ system_charset_info, &dummy_errors);
protocol->store(def.ptr(), def.length(), def.charset());
}
else if (field->unireg_check == Field::NEXT_NUMBER ||
@@ -1177,7 +1178,7 @@ mysqld_list_fields(THD *thd, TABLE_LIST *table_list, const char *wild)
if (thd->protocol->send_fields(&field_list, Protocol::SEND_DEFAULTS |
Protocol::SEND_EOF))
DBUG_VOID_RETURN;
- net_flush(&thd->net);
+ thd->protocol->flush();
DBUG_VOID_RETURN;
}
@@ -1194,13 +1195,11 @@ mysqld_dump_create_info(THD *thd, TABLE *table, int fd)
if (store_create_info(thd, table, packet))
DBUG_RETURN(-1);
- //if (protocol->convert)
- // protocol->convert->convert((char*) packet->ptr(), packet->length());
if (fd < 0)
{
if (protocol->write())
DBUG_RETURN(-1);
- net_flush(&thd->net);
+ protocol->flush();
}
else
{
@@ -1436,9 +1435,10 @@ store_create_info(THD *thd, TABLE *table, String *packet)
if (type.length())
{
String def_val;
+ uint dummy_errors;
/* convert to system_charset_info == utf8 */
def_val.copy(type.ptr(), type.length(), field->charset(),
- system_charset_info);
+ system_charset_info, &dummy_errors);
append_unescaped(packet, def_val.ptr(), def_val.length());
}
else
diff --git a/sql/sql_string.cc b/sql/sql_string.cc
index 7d0dd3ca566..69b530911f4 100644
--- a/sql/sql_string.cc
+++ b/sql/sql_string.cc
@@ -121,12 +121,13 @@ bool String::set(ulonglong num, CHARSET_INFO *cs)
bool String::set(double num,uint decimals, CHARSET_INFO *cs)
{
char buff[331];
+ uint dummy_errors;
str_charset=cs;
if (decimals >= NOT_FIXED_DEC)
{
uint32 len= my_sprintf(buff,(buff, "%.14g",num));// Enough for a DATETIME
- return copy(buff, len, &my_charset_latin1, cs);
+ return copy(buff, len, &my_charset_latin1, cs, &dummy_errors);
}
#ifdef HAVE_FCONVERT
int decpt,sign;
@@ -141,7 +142,8 @@ bool String::set(double num,uint decimals, CHARSET_INFO *cs)
buff[0]='-';
pos=buff;
}
- return copy(pos,(uint32) strlen(pos), &my_charset_latin1, cs);
+ uint dummy_errors;
+ return copy(pos,(uint32) strlen(pos), &my_charset_latin1, cs, &dummy_errors);
}
if (alloc((uint32) ((uint32) decpt+3+decimals)))
return TRUE;
@@ -191,7 +193,8 @@ end:
#else
sprintf(buff,"%.*f",(int) decimals,num);
#endif
- return copy(buff,(uint32) strlen(buff), &my_charset_latin1, cs);
+ return copy(buff,(uint32) strlen(buff), &my_charset_latin1, cs,
+ &dummy_errors);
#endif
}
@@ -336,14 +339,12 @@ bool String::copy(const char *str, uint32 arg_length,
uint32 offset;
if (!needs_conversion(arg_length, from_cs, to_cs, &offset))
{
- if (errors)
- *errors= 0;
+ *errors= 0;
return copy(str, arg_length, to_cs);
}
if ((from_cs == &my_charset_bin) && offset)
{
- if (errors)
- *errors= 0;
+ *errors= 0;
return copy_aligned(str, arg_length, offset, to_cs);
}
uint32 new_length= to_cs->mbmaxlen*arg_length;
@@ -382,7 +383,8 @@ bool String::set_ascii(const char *str, uint32 arg_length)
set(str, arg_length, str_charset);
return 0;
}
- return copy(str, arg_length, &my_charset_latin1, str_charset);
+ uint dummy_errors;
+ return copy(str, arg_length, &my_charset_latin1, str_charset, &dummy_errors);
}
@@ -436,10 +438,12 @@ bool String::append(const char *s,uint32 arg_length)
if (str_charset->mbminlen > 1)
{
uint32 add_length=arg_length * str_charset->mbmaxlen;
+ uint dummy_errors;
if (realloc(str_length+ add_length))
return TRUE;
str_length+= copy_and_convert(Ptr+str_length, add_length, str_charset,
- s, arg_length, &my_charset_latin1);
+ s, arg_length, &my_charset_latin1,
+ &dummy_errors);
return FALSE;
}
@@ -476,10 +480,11 @@ bool String::append(const char *s,uint32 arg_length, CHARSET_INFO *cs)
if (needs_conversion(arg_length, cs, str_charset, &dummy_offset))
{
uint32 add_length= arg_length / cs->mbminlen * str_charset->mbmaxlen;
+ uint dummy_errors;
if (realloc(str_length + add_length))
return TRUE;
str_length+= copy_and_convert(Ptr+str_length, add_length, str_charset,
- s, arg_length, cs);
+ s, arg_length, cs, &dummy_errors);
}
else
{
@@ -829,8 +834,7 @@ outp:
else
break;
}
- if (errors)
- *errors= error_count;
+ *errors= error_count;
return (uint32) (to - to_start);
}
diff --git a/sql/sql_string.h b/sql/sql_string.h
index d6807fa83ad..cb5b1fb25fd 100644
--- a/sql/sql_string.h
+++ b/sql/sql_string.h
@@ -29,7 +29,7 @@ int sortcmp(const String *a,const String *b, CHARSET_INFO *cs);
String *copy_if_not_alloced(String *a,String *b,uint32 arg_length);
uint32 copy_and_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
const char *from, uint32 from_length,
- CHARSET_INFO *from_cs, uint *errors= 0);
+ CHARSET_INFO *from_cs, uint *errors);
class String
{
@@ -199,7 +199,7 @@ public:
CHARSET_INFO *cs);
bool set_or_copy_aligned(const char *s, uint32 arg_length, CHARSET_INFO *cs);
bool copy(const char*s,uint32 arg_length, CHARSET_INFO *csfrom,
- CHARSET_INFO *csto, uint *errors= 0);
+ CHARSET_INFO *csto, uint *errors);
bool append(const String &s);
bool append(const char *s);
bool append(const char *s,uint32 arg_length);
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 26c483a61a8..e73bf81eb74 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1401,7 +1401,7 @@ TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
create_info, *extra_fields, *keys, 0,
select_field_count))
{
- if (!(table= open_table(thd, create_table, &thd->mem_root, (bool*) 0)))
+ if (!(table= open_table(thd, create_table, thd->mem_root, (bool*) 0)))
quick_rm_table(create_info->db_type, create_table->db,
table_case_name(create_info, create_table->real_name));
}
@@ -1740,6 +1740,12 @@ end:
}
+/*
+ RETURN VALUES
+ 0 Message sent to net (admin operation went ok)
+ -1 Message should be sent by caller
+ (admin operation or network communication failed)
+*/
static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
HA_CHECK_OPT* check_opt,
const char *operator_name,
@@ -1787,9 +1793,13 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
if (prepare_func)
{
switch ((*prepare_func)(thd, table, check_opt)) {
- case 1: continue; // error, message written to net
- case -1: goto err; // error, message could be written to net
- default: ; // should be 0 otherwise
+ case 1: // error, message written to net
+ close_thread_tables(thd);
+ continue;
+ case -1: // error, message could be written to net
+ goto err;
+ default: // should be 0 otherwise
+ ;
}
}
@@ -3067,7 +3077,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
bzero((void*) &tbl, sizeof(tbl));
tbl.db= new_db;
tbl.real_name= tbl.alias= tmp_name;
- new_table= open_table(thd, &tbl, &thd->mem_root, 0);
+ new_table= open_table(thd, &tbl, thd->mem_root, 0);
}
else
{
@@ -3506,6 +3516,8 @@ int mysql_recreate_table(THD *thd, TABLE_LIST *table_list,
create_info.db_type=DB_TYPE_DEFAULT;
create_info.row_type=ROW_TYPE_DEFAULT;
create_info.default_table_charset=default_charset_info;
+ /* Force alter table to recreate table */
+ lex->alter_info.flags= ALTER_CHANGE_COLUMN;
DBUG_RETURN(mysql_alter_table(thd, NullS, NullS, &create_info,
table_list, lex->create_list,
lex->key_list, 0, (ORDER *) 0,
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index 17f3bc48678..5d175be74e1 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -134,7 +134,6 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables)
TABLE *table= tables->table;
char dir_buff[FN_REFLEN], file_buff[FN_REFLEN];
LEX_STRING dir, file;
- MEM_ROOT *old_global_root;
LEX_STRING *trg_def, *name;
List_iterator_fast<LEX_STRING> it(names_list);
@@ -168,9 +167,6 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables)
triggers_file_ext, NullS) - file_buff;
file.str= file_buff;
- old_global_root= my_pthread_getspecific_ptr(MEM_ROOT*, THR_MALLOC);
- my_pthread_setspecific_ptr(THR_MALLOC, &table->mem_root);
-
/*
Soon we will invalidate table object and thus Table_triggers_list object
so don't care about place to which trg_def->ptr points and other
@@ -181,17 +177,12 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables)
*/
if (!(trg_def= (LEX_STRING *)alloc_root(&table->mem_root,
sizeof(LEX_STRING))) ||
- definitions_list.push_back(trg_def))
- {
- my_pthread_setspecific_ptr(THR_MALLOC, old_global_root);
+ definitions_list.push_back(trg_def, &table->mem_root))
return 1;
- }
trg_def->str= thd->query;
trg_def->length= thd->query_length;
- my_pthread_setspecific_ptr(THR_MALLOC, old_global_root);
-
return sql_create_definition_file(&dir, &file, &triggers_file_type,
(gptr)this, triggers_file_parameters, 3);
}
@@ -302,7 +293,6 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
char path_buff[FN_REFLEN];
LEX_STRING path;
File_parser *parser;
- MEM_ROOT *old_global_mem_root;
DBUG_ENTER("Table_triggers_list::check_n_load");
@@ -406,14 +396,9 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
trg_name_str->str= trg_name_buff;
trg_name_str->length= lex.name_and_length.length;
- old_global_mem_root= my_pthread_getspecific_ptr(MEM_ROOT*, THR_MALLOC);
- my_pthread_setspecific_ptr(THR_MALLOC, &table->mem_root);
-
- if (triggers->names_list.push_back(trg_name_str))
+ if (triggers->names_list.push_back(trg_name_str, &table->mem_root))
goto err_with_lex_cleanup;
- my_pthread_setspecific_ptr(THR_MALLOC, old_global_mem_root);
-
lex_end(&lex);
}
thd->lex= old_lex;
@@ -431,7 +416,8 @@ err_with_lex_cleanup:
We don't care about this error message much because .TRG files will
be merged into .FRM anyway.
*/
- my_error(ER_WRONG_OBJECT, MYF(0), table_name, triggers_file_ext, "TRIGGER");
+ my_error(ER_WRONG_OBJECT, MYF(0), table_name, triggers_file_ext,
+ "TRIGGER");
DBUG_RETURN(1);
}
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 46f11683e4e..792e2cdf775 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -315,26 +315,23 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
if (!item_list.elements)
{
Field **field;
- Item_arena backup;
- if (arena->is_conventional())
- arena= 0;
- else
- thd->set_n_backup_item_arena(arena, &backup);
+ Item_arena *tmp_arena,backup;
+ tmp_arena= thd->change_arena_if_needed(&backup);
for (field= table->field; *field; field++)
{
Item_field *item= new Item_field(*field);
if (!item || item_list.push_back(item))
{
- if (arena)
- thd->restore_backup_item_arena(arena, &backup);
+ if (tmp_arena)
+ thd->restore_backup_item_arena(tmp_arena, &backup);
DBUG_RETURN(-1);
}
}
- if (arena)
+ if (tmp_arena)
+ thd->restore_backup_item_arena(tmp_arena, &backup);
+ if (arena->is_stmt_prepare())
{
- thd->restore_backup_item_arena(arena, &backup);
-
/* prepare fake select to initialize it correctly */
ulong options_tmp= init_prepare_fake_select_lex(thd);
/*
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index f8994148ffc..a03a7acdf72 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -434,7 +434,7 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
DBUG_RETURN(-1);
}
- if (!(parser= sql_parse_prepare(&path, &thd->mem_root, 0)))
+ if (!(parser= sql_parse_prepare(&path, thd->mem_root, 0)))
DBUG_RETURN(1);
if (!parser->ok() ||
@@ -451,7 +451,7 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
TODO: read dependence list, too, to process cascade/restrict
TODO: special cascade/restrict procedure for alter?
*/
- if (parser->parse((gptr)view, &thd->mem_root,
+ if (parser->parse((gptr)view, thd->mem_root,
view_parameters + revision_number_position, 1))
{
DBUG_RETURN(thd->net.report_error? -1 : 0);
@@ -565,7 +565,7 @@ mysql_make_view(File_parser *parser, TABLE_LIST *table)
TODO: when VIEWs will be stored in cache, table mem_root should
be used here
*/
- if (parser->parse((gptr)table, &thd->mem_root, view_parameters,
+ if (parser->parse((gptr)table, thd->mem_root, view_parameters,
required_view_parameters))
goto err;
@@ -586,7 +586,7 @@ mysql_make_view(File_parser *parser, TABLE_LIST *table)
now Lex placed in statement memory
*/
- table->view= lex= thd->lex= (LEX*) new(&thd->mem_root) st_lex_local;
+ table->view= lex= thd->lex= (LEX*) new(thd->mem_root) st_lex_local;
lex_start(thd, (uchar*)table->query.str, table->query.length);
lex->select_lex.select_number= ++thd->select_number;
old_lex->derived_tables|= DERIVED_VIEW;
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index c658d2ae016..309a9249d0e 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -1848,7 +1848,7 @@ sp_proc_stmt:
i->m_query.length= lex->ptr - sp->m_tmp_query;
else
i->m_query.length= lex->tok_end - sp->m_tmp_query;
- i->m_query.str= strmake_root(&YYTHD->mem_root,
+ i->m_query.str= strmake_root(YYTHD->mem_root,
(char *)sp->m_tmp_query,
i->m_query.length);
i->set_lex(lex);
@@ -4781,7 +4781,7 @@ opt_distinct:
|DISTINCT { $$ = 1; };
opt_gconcat_separator:
- /* empty */ { $$ = new (&YYTHD->mem_root) String(",",1,default_charset_info); }
+ /* empty */ { $$ = new (YYTHD->mem_root) String(",",1,default_charset_info); }
|SEPARATOR_SYM text_string { $$ = $2; };
@@ -5070,15 +5070,15 @@ key_list_or_empty:
key_usage_list2:
key_usage_list2 ',' ident
{ Select->
- interval_list.push_back(new (&YYTHD->mem_root) String((const char*) $3.str, $3.length,
+ interval_list.push_back(new (YYTHD->mem_root) String((const char*) $3.str, $3.length,
system_charset_info)); }
| ident
{ Select->
- interval_list.push_back(new (&YYTHD->mem_root) String((const char*) $1.str, $1.length,
+ interval_list.push_back(new (YYTHD->mem_root) String((const char*) $1.str, $1.length,
system_charset_info)); }
| PRIMARY_SYM
{ Select->
- interval_list.push_back(new (&YYTHD->mem_root) String("PRIMARY", 7,
+ interval_list.push_back(new (YYTHD->mem_root) String("PRIMARY", 7,
system_charset_info)); };
using_list:
@@ -6128,7 +6128,7 @@ opt_db:
wild:
/* empty */
| LIKE TEXT_STRING_sys
- { Lex->wild= new (&YYTHD->mem_root) String($2.str, $2.length,
+ { Lex->wild= new (YYTHD->mem_root) String($2.str, $2.length,
system_charset_info); };
opt_full:
@@ -6182,7 +6182,7 @@ opt_describe_column:
/* empty */ {}
| text_string { Lex->wild= $1; }
| ident
- { Lex->wild= new (&YYTHD->mem_root) String((const char*) $1.str,$1.length,system_charset_info); };
+ { Lex->wild= new (YYTHD->mem_root) String((const char*) $1.str,$1.length,system_charset_info); };
/* flush things */
@@ -6428,7 +6428,7 @@ text_literal:
text_string:
TEXT_STRING_literal
- { $$= new (&YYTHD->mem_root) String($1.str,$1.length,YYTHD->variables.collation_connection); }
+ { $$= new (YYTHD->mem_root) String($1.str,$1.length,YYTHD->variables.collation_connection); }
| HEX_NUM
{
Item *tmp = new Item_varbinary($1.str,$1.length);
@@ -7700,7 +7700,7 @@ column_list:
column_list_id:
ident
{
- String *new_str = new (&YYTHD->mem_root) String((const char*) $1.str,$1.length,system_charset_info);
+ String *new_str = new (YYTHD->mem_root) String((const char*) $1.str,$1.length,system_charset_info);
List_iterator <LEX_COLUMN> iter(Lex->columns);
class LEX_COLUMN *point;
LEX *lex=Lex;
diff --git a/sql/table.cc b/sql/table.cc
index 8c58c5296ad..0e8045abacf 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -83,13 +83,14 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
uchar *null_pos;
uint null_bit, new_frm_ver, field_pack_length;
SQL_CRYPT *crypted=0;
- MEM_ROOT *old_root;
+ MEM_ROOT **root_ptr, *old_root;
DBUG_ENTER("openfrm");
DBUG_PRINT("enter",("name: '%s' form: 0x%lx",name,outparam));
error=1;
disk_buff=NULL;
- old_root= my_pthread_getspecific_ptr(MEM_ROOT*,THR_MALLOC);
+ root_ptr= my_pthread_getspecific_ptr(MEM_ROOT**, THR_MALLOC);
+ old_root= *root_ptr;
if ((file=my_open(fn_format(index_file, name, "", reg_ext,
MY_UNPACK_FILENAME),
@@ -123,7 +124,7 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
outparam->blob_ptr_size=sizeof(char*);
outparam->db_stat = db_stat;
init_sql_alloc(&outparam->mem_root, TABLE_ALLOC_BLOCK_SIZE, 0);
- my_pthread_setspecific_ptr(THR_MALLOC,&outparam->mem_root);
+ *root_ptr= &outparam->mem_root;
outparam->real_name=strdup_root(&outparam->mem_root,
name+dirname_length(name));
@@ -274,9 +275,9 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
#ifdef HAVE_CRYPTED_FRM
else if (*(head+26) == 2)
{
- my_pthread_setspecific_ptr(THR_MALLOC,old_root);
+ *root_ptr= old_root
crypted=get_crypt_for_frm();
- my_pthread_setspecific_ptr(THR_MALLOC,&outparam->mem_root);
+ *root_ptr= &outparam->mem_root;
outparam->crypted=1;
}
#endif
@@ -762,7 +763,7 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
}
outparam->db_low_byte_first=outparam->file->low_byte_first();
- my_pthread_setspecific_ptr(THR_MALLOC,old_root);
+ *root_ptr= old_root;
thd->status_var.opened_tables++;
#ifndef DBUG_OFF
if (use_hash)
@@ -782,7 +783,7 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
err_end: /* Here when no file */
delete crypted;
- my_pthread_setspecific_ptr(THR_MALLOC,old_root);
+ *root_ptr= old_root;
frm_error(error,outparam,name,ME_ERROR+ME_WAITTANG);
delete outparam->file;
outparam->file=0; // For easier errorchecking
diff --git a/sql/thr_malloc.cc b/sql/thr_malloc.cc
index fa678ec7de2..3a9ca397bba 100644
--- a/sql/thr_malloc.cc
+++ b/sql/thr_malloc.cc
@@ -38,7 +38,7 @@ void init_sql_alloc(MEM_ROOT *mem_root, uint block_size, uint pre_alloc)
gptr sql_alloc(uint Size)
{
- MEM_ROOT *root=my_pthread_getspecific_ptr(MEM_ROOT*,THR_MALLOC);
+ MEM_ROOT *root= *my_pthread_getspecific_ptr(MEM_ROOT**,THR_MALLOC);
char *ptr= (char*) alloc_root(root,Size);
return ptr;
}
@@ -108,8 +108,11 @@ char *sql_strmake_with_convert(const char *str, uint32 arg_length,
memcpy(pos, str, new_length);
}
else
+ {
+ uint dummy_errors;
new_length= copy_and_convert((char*) pos, new_length, to_cs, str,
- arg_length, from_cs);
+ arg_length, from_cs, &dummy_errors);
+ }
pos[new_length]= 0;
*result_length= new_length;
return pos;
diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c
index 4176ff2e538..a8b5394f8c5 100644
--- a/strings/ctype-sjis.c
+++ b/strings/ctype-sjis.c
@@ -4581,14 +4581,19 @@ uint my_well_formed_len_sjis(CHARSET_INFO *cs __attribute__((unused)),
*/
if (((int8)b[0]) >= 0)
{
- /* Single byte character */
- b+= 1;
+ /* Single byte ascii character */
+ b++;
}
else if (issjishead((uchar)*b) && (e-b)>1 && issjistail((uchar)b[1]))
{
/* Double byte character */
b+= 2;
}
+ else if (((uchar)*b) >= 0xA1 && ((uchar)*b) <= 0xDF)
+ {
+ /* Half width kana */
+ b++;
+ }
else
{
/* Wrong byte sequence */
diff --git a/tests/client_test.c b/tests/client_test.c
index 0ef8bd1ea66..6ce33789aba 100644
--- a/tests/client_test.c
+++ b/tests/client_test.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 MySQL AB
+/* Copyright (C) 2003-2004 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
@@ -27,6 +27,7 @@
#include <my_getopt.h>
#include <m_string.h>
+#define VER "2.0"
#define MAX_TEST_QUERY_LENGTH 300 /* MAX QUERY BUFFER LENGTH */
#define MAX_KEY 64
@@ -38,7 +39,7 @@ static char *opt_password= 0;
static char *opt_host= 0;
static char *opt_unix_socket= 0;
static unsigned int opt_port;
-static my_bool tty_password= 0;
+static my_bool tty_password= 0, opt_silent= 0;
static MYSQL *mysql= 0;
static char query[MAX_TEST_QUERY_LENGTH];
@@ -53,6 +54,7 @@ static double total_time;
const char *default_dbug_option= "d:t:o,/tmp/client_test.trace";
#define myheader(str) \
+if (opt_silent < 2) \
{ \
fprintf(stdout, "\n\n#####################################\n"); \
fprintf(stdout, "%d of (%d/%d): %s", test_count++, iter_count, \
@@ -60,6 +62,7 @@ const char *default_dbug_option= "d:t:o,/tmp/client_test.trace";
fprintf(stdout, " \n#####################################\n"); \
}
#define myheader_r(str) \
+if (!opt_silent) \
{ \
fprintf(stdout, "\n\n#####################################\n"); \
fprintf(stdout, "%s", str); \
@@ -95,11 +98,12 @@ void die(const char *file, int line, const char *expr)
#define myerror(msg) print_error(msg)
#define mysterror(stmt, msg) print_st_error(stmt, msg)
-#define myquery(r) \
+#define myquery(RES) \
{ \
-if (r) \
- myerror(NULL); \
- DIE_UNLESS(r == 0); \
+ int r= (RES); \
+ if (r) \
+ myerror(NULL); \
+ DIE_UNLESS(r == 0); \
}
#define myquery_r(r) \
@@ -145,32 +149,39 @@ DIE_UNLESS(stmt == 0);\
static void print_error(const char *msg)
{
- if (mysql && mysql_errno(mysql))
+ if (!opt_silent)
{
- if (mysql->server_version)
- fprintf(stdout, "\n [MySQL-%s]", mysql->server_version);
- else
- fprintf(stdout, "\n [MySQL]");
- fprintf(stdout, "[%d] %s\n", mysql_errno(mysql), mysql_error(mysql));
+ if (mysql && mysql_errno(mysql))
+ {
+ if (mysql->server_version)
+ fprintf(stdout, "\n [MySQL-%s]", mysql->server_version);
+ else
+ fprintf(stdout, "\n [MySQL]");
+ fprintf(stdout, "[%d] %s\n", mysql_errno(mysql), mysql_error(mysql));
+ }
+ else if (msg)
+ fprintf(stderr, " [MySQL] %s\n", msg);
}
- else if (msg) fprintf(stderr, " [MySQL] %s\n", msg);
}
static void print_st_error(MYSQL_STMT *stmt, const char *msg)
{
- if (stmt && mysql_stmt_errno(stmt))
+ if (!opt_silent)
{
- if (stmt->mysql && stmt->mysql->server_version)
- fprintf(stdout, "\n [MySQL-%s]", stmt->mysql->server_version);
- else
- fprintf(stdout, "\n [MySQL]");
+ if (stmt && mysql_stmt_errno(stmt))
+ {
+ if (stmt->mysql && stmt->mysql->server_version)
+ fprintf(stdout, "\n [MySQL-%s]", stmt->mysql->server_version);
+ else
+ fprintf(stdout, "\n [MySQL]");
- fprintf(stdout, "[%d] %s\n", mysql_stmt_errno(stmt),
- mysql_stmt_error(stmt));
+ fprintf(stdout, "[%d] %s\n", mysql_stmt_errno(stmt),
+ mysql_stmt_error(stmt));
+ }
+ else if (msg)
+ fprintf(stderr, " [MySQL] %s\n", msg);
}
- else if (msg)
- fprintf(stderr, " [MySQL] %s\n", msg);
}
@@ -199,8 +210,9 @@ static void client_connect()
int rc;
myheader_r("client_connect");
- fprintf(stdout, "\n Establishing a connection to '%s' ...",
- opt_host ? opt_host : "");
+ if (!opt_silent)
+ fprintf(stdout, "\n Establishing a connection to '%s' ...",
+ opt_host ? opt_host : "");
if (!(mysql= mysql_init(NULL)))
{
@@ -218,12 +230,14 @@ static void client_connect()
exit(1);
}
- fprintf(stdout, " OK");
+ if (!opt_silent)
+ fprintf(stdout, " OK");
/* set AUTOCOMMIT to ON*/
mysql_autocommit(mysql, TRUE);
- fprintf(stdout, "\n Creating a test database '%s' ...", current_db);
+ if (!opt_silent)
+ fprintf(stdout, "\n Creating a test database '%s' ...", current_db);
strxmov(query, "CREATE DATABASE IF NOT EXISTS ", current_db, NullS);
rc= mysql_query(mysql, query);
@@ -233,7 +247,8 @@ static void client_connect()
rc= mysql_query(mysql, query);
myquery(rc);
- fprintf(stdout, " OK");
+ if (!opt_silent)
+ fprintf(stdout, " OK");
}
@@ -245,13 +260,16 @@ static void client_disconnect()
if (mysql)
{
- fprintf(stdout, "\n dropping the test database '%s' ...", current_db);
+ if (!opt_silent)
+ fprintf(stdout, "\n dropping the test database '%s' ...", current_db);
strxmov(query, "DROP DATABASE IF EXISTS ", current_db, NullS);
mysql_query(mysql, query);
- fprintf(stdout, " OK");
+ if (!opt_silent)
+ fprintf(stdout, " OK");
- fprintf(stdout, "\n closing the connection ...");
+ if (!opt_silent)
+ fprintf(stdout, "\n closing the connection ...");
mysql_close(mysql);
fprintf(stdout, " OK\n");
}
@@ -266,38 +284,40 @@ static void client_query()
myheader("client_query");
- rc= mysql_query(mysql, "DROP TABLE IF EXISTS myclient_test");
+ rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
myquery(rc);
- rc= mysql_query(mysql, "CREATE TABLE myclient_test("
+ rc= mysql_query(mysql, "CREATE TABLE t1("
"id int primary key auto_increment, "
"name varchar(20))");
myquery(rc);
- rc= mysql_query(mysql, "CREATE TABLE myclient_test(id int, name varchar(20))");
+ rc= mysql_query(mysql, "CREATE TABLE t1(id int, name varchar(20))");
myquery_r(rc);
- rc= mysql_query(mysql, "INSERT INTO myclient_test(name) VALUES('mysql')");
+ rc= mysql_query(mysql, "INSERT INTO t1(name) VALUES('mysql')");
myquery(rc);
- rc= mysql_query(mysql, "INSERT INTO myclient_test(name) VALUES('monty')");
+ rc= mysql_query(mysql, "INSERT INTO t1(name) VALUES('monty')");
myquery(rc);
- rc= mysql_query(mysql, "INSERT INTO myclient_test(name) VALUES('venu')");
+ rc= mysql_query(mysql, "INSERT INTO t1(name) VALUES('venu')");
myquery(rc);
- rc= mysql_query(mysql, "INSERT INTO myclient_test(name) VALUES('deleted')");
+ rc= mysql_query(mysql, "INSERT INTO t1(name) VALUES('deleted')");
myquery(rc);
- rc= mysql_query(mysql, "INSERT INTO myclient_test(name) VALUES('deleted')");
+ rc= mysql_query(mysql, "INSERT INTO t1(name) VALUES('deleted')");
myquery(rc);
- rc= mysql_query(mysql, "UPDATE myclient_test SET name= 'updated' "
+ rc= mysql_query(mysql, "UPDATE t1 SET name= 'updated' "
"WHERE name= 'deleted'");
myquery(rc);
- rc= mysql_query(mysql, "UPDATE myclient_test SET id= 3 WHERE name= 'updated'");
+ rc= mysql_query(mysql, "UPDATE t1 SET id= 3 WHERE name= 'updated'");
myquery_r(rc);
+
+ myquery(mysql_query(mysql, "drop table t1"));
}
@@ -332,8 +352,11 @@ static void my_print_result_metadata(MYSQL_RES *result)
unsigned int field_count;
mysql_field_seek(result, 0);
- fputc('\n', stdout);
- fputc('\n', stdout);
+ if (!opt_silent)
+ {
+ fputc('\n', stdout);
+ fputc('\n', stdout);
+ }
field_count= mysql_num_fields(result);
for(i= 0; i< field_count; i++)
@@ -346,18 +369,25 @@ static void my_print_result_metadata(MYSQL_RES *result)
j= 4;
field->max_length= j;
}
- my_print_dashes(result);
- fputc('\t', stdout);
- fputc('|', stdout);
+ if (!opt_silent)
+ {
+ my_print_dashes(result);
+ fputc('\t', stdout);
+ fputc('|', stdout);
+ }
mysql_field_seek(result, 0);
for(i= 0; i< field_count; i++)
{
field= mysql_fetch_field(result);
- fprintf(stdout, " %-*s |", (int) field->max_length, field->name);
+ if (!opt_silent)
+ fprintf(stdout, " %-*s |", (int) field->max_length, field->name);
+ }
+ if (!opt_silent)
+ {
+ fputc('\n', stdout);
+ my_print_dashes(result);
}
- fputc('\n', stdout);
- my_print_dashes(result);
}
@@ -378,31 +408,43 @@ int my_process_result_set(MYSQL_RES *result)
while ((row= mysql_fetch_row(result)) != NULL)
{
mysql_field_seek(result, 0);
- fputc('\t', stdout);
- fputc('|', stdout);
+ if (!opt_silent)
+ {
+ fputc('\t', stdout);
+ fputc('|', stdout);
+ }
for(i= 0; i< mysql_num_fields(result); i++)
{
field= mysql_fetch_field(result);
- if (row[i] == NULL)
- fprintf(stdout, " %-*s |", (int) field->max_length, "NULL");
- else if (IS_NUM(field->type))
- fprintf(stdout, " %*s |", (int) field->max_length, row[i]);
- else
- fprintf(stdout, " %-*s |", (int) field->max_length, row[i]);
+ if (!opt_silent)
+ {
+ if (row[i] == NULL)
+ fprintf(stdout, " %-*s |", (int) field->max_length, "NULL");
+ else if (IS_NUM(field->type))
+ fprintf(stdout, " %*s |", (int) field->max_length, row[i]);
+ else
+ fprintf(stdout, " %-*s |", (int) field->max_length, row[i]);
+ }
+ }
+ if (!opt_silent)
+ {
+ fputc('\t', stdout);
+ fputc('\n', stdout);
}
- fputc('\t', stdout);
- fputc('\n', stdout);
row_count++;
}
- if (row_count)
- my_print_dashes(result);
+ if (!opt_silent)
+ {
+ if (row_count)
+ my_print_dashes(result);
- if (mysql_errno(mysql) != 0)
- fprintf(stderr, "\n\tmysql_fetch_row() failed\n");
- else
- fprintf(stdout, "\n\t%d %s returned\n", row_count,
- row_count == 1 ? "row" : "rows");
+ if (mysql_errno(mysql) != 0)
+ fprintf(stderr, "\n\tmysql_fetch_row() failed\n");
+ else
+ fprintf(stdout, "\n\t%d %s returned\n", row_count,
+ row_count == 1 ? "row" : "rows");
+ }
return row_count;
}
@@ -471,34 +513,44 @@ int my_process_stmt_result(MYSQL_STMT *stmt)
mysql_field_seek(result, 0);
while (mysql_stmt_fetch(stmt) == 0)
{
- fputc('\t', stdout);
- fputc('|', stdout);
-
+ if (!opt_silent)
+ {
+ fputc('\t', stdout);
+ fputc('|', stdout);
+ }
mysql_field_seek(result, 0);
for (i= 0; i < field_count; i++)
{
field= mysql_fetch_field(result);
- if (is_null[i])
- fprintf(stdout, " %-*s |", (int) field->max_length, "NULL");
- else if (length[i] == 0)
+ if (!opt_silent)
{
- data[i][0]= '\0'; /* unmodified buffer */
- fprintf(stdout, " %*s |", (int) field->max_length, data[i]);
+ if (is_null[i])
+ fprintf(stdout, " %-*s |", (int) field->max_length, "NULL");
+ else if (length[i] == 0)
+ {
+ data[i][0]= '\0'; /* unmodified buffer */
+ fprintf(stdout, " %*s |", (int) field->max_length, data[i]);
+ }
+ else if (IS_NUM(field->type))
+ fprintf(stdout, " %*s |", (int) field->max_length, data[i]);
+ else
+ fprintf(stdout, " %-*s |", (int) field->max_length, data[i]);
}
- else if (IS_NUM(field->type))
- fprintf(stdout, " %*s |", (int) field->max_length, data[i]);
- else
- fprintf(stdout, " %-*s |", (int) field->max_length, data[i]);
}
- fputc('\t', stdout);
- fputc('\n', stdout);
+ if (!opt_silent)
+ {
+ fputc('\t', stdout);
+ fputc('\n', stdout);
+ }
row_count++;
}
- if (row_count)
- my_print_dashes(result);
-
- fprintf(stdout, "\n\t%d %s returned\n", row_count,
- row_count == 1 ? "row" : "rows");
+ if (!opt_silent)
+ {
+ if (row_count)
+ my_print_dashes(result);
+ fprintf(stdout, "\n\t%d %s returned\n", row_count,
+ row_count == 1 ? "row" : "rows");
+ }
mysql_free_result(result);
return row_count;
}
@@ -512,7 +564,8 @@ int my_stmt_result(const char *buff)
int row_count;
int rc;
- fprintf(stdout, "\n\n %s", buff);
+ if (!opt_silent)
+ fprintf(stdout, "\n\n %s", buff);
stmt= mysql_simple_prepare(mysql, buff);
check_stmt(stmt);
@@ -538,7 +591,8 @@ static void verify_col_data(const char *table, const char *col,
if (table && col)
{
strxmov(query, "SELECT ", col, " FROM ", table, " LIMIT 1", NullS);
- fprintf(stdout, "\n %s", query);
+ if (!opt_silent)
+ fprintf(stdout, "\n %s", query);
rc= mysql_query(mysql, query);
myquery(rc);
@@ -566,10 +620,12 @@ static void verify_col_data(const char *table, const char *col,
/* Utility function to verify the field members */
static void verify_prepare_field(MYSQL_RES *result,
- unsigned int no, const char *name, const char *org_name,
- enum enum_field_types type, const char *table,
- const char *org_table, const char *db,
- unsigned long length, const char *def)
+ unsigned int no, const char *name,
+ const char *org_name,
+ enum enum_field_types type,
+ const char *table,
+ const char *org_table, const char *db,
+ unsigned long length, const char *def)
{
MYSQL_FIELD *field;
@@ -578,23 +634,26 @@ static void verify_prepare_field(MYSQL_RES *result,
fprintf(stdout, "\n *** ERROR: FAILED TO GET THE RESULT ***");
exit(1);
}
- fprintf(stdout, "\n field[%d]:", no);
- fprintf(stdout, "\n name :`%s`\t(expected: `%s`)", field->name, name);
- fprintf(stdout, "\n org_name :`%s`\t(expected: `%s`)",
- field->org_name, org_name);
- fprintf(stdout, "\n type :`%d`\t(expected: `%d`)", field->type, type);
- fprintf(stdout, "\n table :`%s`\t(expected: `%s`)",
- field->table, table);
- fprintf(stdout, "\n org_table:`%s`\t(expected: `%s`)",
- field->org_table, org_table);
- fprintf(stdout, "\n database :`%s`\t(expected: `%s`)", field->db, db);
- fprintf(stdout, "\n length :`%ld`\t(expected: `%ld`)",
- field->length, length);
- fprintf(stdout, "\n maxlength:`%ld`", field->max_length);
- fprintf(stdout, "\n charsetnr:`%d`", field->charsetnr);
- fprintf(stdout, "\n default :`%s`\t(expected: `%s`)",
- field->def ? field->def : "(null)", def ? def: "(null)");
- fprintf(stdout, "\n");
+ if (!opt_silent)
+ {
+ fprintf(stdout, "\n field[%d]:", no);
+ fprintf(stdout, "\n name :`%s`\t(expected: `%s`)", field->name, name);
+ fprintf(stdout, "\n org_name :`%s`\t(expected: `%s`)",
+ field->org_name, org_name);
+ fprintf(stdout, "\n type :`%d`\t(expected: `%d`)", field->type, type);
+ fprintf(stdout, "\n table :`%s`\t(expected: `%s`)",
+ field->table, table);
+ fprintf(stdout, "\n org_table:`%s`\t(expected: `%s`)",
+ field->org_table, org_table);
+ fprintf(stdout, "\n database :`%s`\t(expected: `%s`)", field->db, db);
+ fprintf(stdout, "\n length :`%ld`\t(expected: `%ld`)",
+ field->length, length);
+ fprintf(stdout, "\n maxlength:`%ld`", field->max_length);
+ fprintf(stdout, "\n charsetnr:`%d`", field->charsetnr);
+ fprintf(stdout, "\n default :`%s`\t(expected: `%s`)",
+ field->def ? field->def : "(null)", def ? def: "(null)");
+ fprintf(stdout, "\n");
+ }
DIE_UNLESS(strcmp(field->name, name) == 0);
DIE_UNLESS(strcmp(field->org_name, org_name) == 0);
DIE_UNLESS(field->type == type);
@@ -612,8 +671,9 @@ static void verify_prepare_field(MYSQL_RES *result,
static void verify_param_count(MYSQL_STMT *stmt, long exp_count)
{
long param_count= mysql_stmt_param_count(stmt);
- fprintf(stdout, "\n total parameters in stmt: `%ld` (expected: `%ld`)",
- param_count, exp_count);
+ if (!opt_silent)
+ fprintf(stdout, "\n total parameters in stmt: `%ld` (expected: `%ld`)",
+ param_count, exp_count);
DIE_UNLESS(param_count == exp_count);
}
@@ -623,8 +683,9 @@ static void verify_param_count(MYSQL_STMT *stmt, long exp_count)
static void verify_st_affected_rows(MYSQL_STMT *stmt, ulonglong exp_count)
{
ulonglong affected_rows= mysql_stmt_affected_rows(stmt);
- fprintf(stdout, "\n total affected rows: `%lld` (expected: `%lld`)",
- affected_rows, exp_count);
+ if (!opt_silent)
+ fprintf(stdout, "\n total affected rows: `%lld` (expected: `%lld`)",
+ affected_rows, exp_count);
DIE_UNLESS(affected_rows == exp_count);
}
@@ -634,7 +695,8 @@ static void verify_st_affected_rows(MYSQL_STMT *stmt, ulonglong exp_count)
static void verify_affected_rows(ulonglong exp_count)
{
ulonglong affected_rows= mysql_affected_rows(mysql);
- fprintf(stdout, "\n total affected rows: `%lld` (expected: `%lld`)",
+ if (!opt_silent)
+ fprintf(stdout, "\n total affected rows: `%lld` (expected: `%lld`)",
affected_rows, exp_count);
DIE_UNLESS(affected_rows == exp_count);
}
@@ -645,8 +707,9 @@ static void verify_affected_rows(ulonglong exp_count)
static void verify_field_count(MYSQL_RES *result, uint exp_count)
{
uint field_count= mysql_num_fields(result);
- fprintf(stdout, "\n total fields in the result set: `%d` (expected: `%d`)",
- field_count, exp_count);
+ if (!opt_silent)
+ fprintf(stdout, "\n total fields in the result set: `%d` (expected: `%d`)",
+ field_count, exp_count);
DIE_UNLESS(field_count == exp_count);
}
@@ -666,8 +729,9 @@ static void execute_prepare_query(const char *query, ulonglong exp_count)
myquery(rc);
affected_rows= mysql_stmt_affected_rows(stmt);
- fprintf(stdout, "\n total affected rows: `%lld` (expected: `%lld`)",
- affected_rows, exp_count);
+ if (!opt_silent)
+ fprintf(stdout, "\n total affected rows: `%lld` (expected: `%lld`)",
+ affected_rows, exp_count);
DIE_UNLESS(affected_rows == exp_count);
mysql_stmt_close(stmt);
@@ -683,7 +747,7 @@ static void client_store_result()
myheader("client_store_result");
- rc= mysql_query(mysql, "SELECT * FROM myclient_test");
+ rc= mysql_query(mysql, "SELECT * FROM t1");
myquery(rc);
/* get the result */
@@ -703,7 +767,7 @@ static void client_use_result()
int rc;
myheader("client_use_result");
- rc= mysql_query(mysql, "SELECT * FROM myclient_test");
+ rc= mysql_query(mysql, "SELECT * FROM t1");
myquery(rc);
/* get the result */
@@ -722,6 +786,7 @@ static void client_use_result()
void fill_tables(const char **query_list, unsigned query_count)
{
+ DBUG_ENTER("fill_tables");
int rc;
const char **query;
for (query= query_list; query < query_list + query_count;
@@ -730,6 +795,7 @@ void fill_tables(const char **query_list, unsigned query_count)
rc= mysql_query(mysql, *query);
myquery(rc);
}
+ DBUG_VOID_RETURN;
}
/*
@@ -766,6 +832,7 @@ void stmt_fetch_init(Stmt_fetch *fetch, unsigned stmt_no_arg,
int rc;
unsigned i;
MYSQL_RES *metadata;
+ DBUG_ENTER("stmt_fetch_init");
/* Save query and statement number for error messages */
fetch->stmt_no= stmt_no_arg;
@@ -817,6 +884,7 @@ void stmt_fetch_init(Stmt_fetch *fetch, unsigned stmt_no_arg,
fetch->is_open= TRUE;
/* Ready for reading rows */
+ DBUG_VOID_RETURN;
}
@@ -826,26 +894,30 @@ int stmt_fetch_fetch_row(Stmt_fetch *fetch)
{
int rc;
unsigned i;
+ DBUG_ENTER("stmt_fetch_fetch_row");
if ((rc= mysql_stmt_fetch(fetch->handle)) == 0)
{
++fetch->row_count;
- printf("Stmt %d fetched row %d:\n", fetch->stmt_no, fetch->row_count);
+ if (!opt_silent)
+ printf("Stmt %d fetched row %d:\n", fetch->stmt_no, fetch->row_count);
for (i= 0; i < fetch->column_count; ++i)
{
fetch->out_data[i][fetch->out_data_length[i]]= '\0';
- printf("column %d: %s\n", i+1, fetch->out_data[i]);
+ if (!opt_silent)
+ printf("column %d: %s\n", i+1, fetch->out_data[i]);
}
}
else
fetch->is_open= FALSE;
- return rc;
+ DBUG_RETURN(rc);
}
void stmt_fetch_close(Stmt_fetch *fetch)
{
unsigned i;
+ DBUG_ENTER("stmt_fetch_close");
for (i= 0; i < fetch->column_count; ++i)
free(fetch->out_data[i]);
@@ -853,6 +925,7 @@ void stmt_fetch_close(Stmt_fetch *fetch)
free(fetch->out_data_length);
free(fetch->bind_array);
mysql_stmt_close(fetch->handle);
+ DBUG_VOID_RETURN;
}
/*
@@ -862,13 +935,14 @@ void stmt_fetch_close(Stmt_fetch *fetch)
reading from the rest.
*/
-bool fetch_n(const char **query_list, unsigned query_count)
+my_bool fetch_n(const char **query_list, unsigned query_count)
{
unsigned open_statements= query_count;
int rc, error_count= 0;
Stmt_fetch *fetch_array= (Stmt_fetch*) calloc(1, sizeof(Stmt_fetch) *
query_count);
Stmt_fetch *fetch;
+ DBUG_ENTER("fetch_n");
for (fetch= fetch_array; fetch < fetch_array + query_count; ++fetch)
{
@@ -883,7 +957,7 @@ bool fetch_n(const char **query_list, unsigned query_count)
{
if (fetch->is_open && (rc= stmt_fetch_fetch_row(fetch)))
{
- --open_statements;
+ open_statements--;
/*
We try to fetch from the rest of the statements in case of
error
@@ -895,7 +969,7 @@ bool fetch_n(const char **query_list, unsigned query_count)
"query is: %s,\n"
"error message: %s", fetch - fetch_array, fetch->query,
mysql_stmt_error(fetch->handle));
- ++error_count;
+ error_count++;
}
}
}
@@ -907,12 +981,13 @@ bool fetch_n(const char **query_list, unsigned query_count)
unsigned total_row_count= 0;
for (fetch= fetch_array; fetch < fetch_array + query_count; ++fetch)
total_row_count+= fetch->row_count;
- printf("Success, total rows fetched: %d\n", total_row_count);
+ if (!opt_silent)
+ printf("Success, total rows fetched: %d\n", total_row_count);
}
for (fetch= fetch_array; fetch < fetch_array + query_count; ++fetch)
stmt_fetch_close(fetch);
free(fetch_array);
- return error_count != 0;
+ DBUG_RETURN(error_count != 0);
}
/* Separate thread query to test some cases */
@@ -923,7 +998,8 @@ static my_bool thread_query(char *query)
my_bool error;
error= 0;
- fprintf(stdout, "\n in thread_query(%s)", query);
+ if (!opt_silent)
+ fprintf(stdout, "\n in thread_query(%s)", query);
if (!(l_mysql= mysql_init(NULL)))
{
myerror("mysql_init() failed");
@@ -1234,7 +1310,8 @@ static void test_prepare_field_result()
my_print_result_metadata(result);
- fprintf(stdout, "\n\n field attributes:\n");
+ if (!opt_silent)
+ fprintf(stdout, "\n\n field attributes:\n");
verify_prepare_field(result, 0, "int_c", "int_c", MYSQL_TYPE_LONG,
"t1", "test_prepare_field_result", current_db, 11, 0);
verify_prepare_field(result, 1, "var_c", "var_c", MYSQL_TYPE_VAR_STRING,
@@ -1408,17 +1485,19 @@ static void test_prepare()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n");
-
- fprintf(stdout, "\n\t tiny : %d (%lu)", tiny_data, length[0]);
- fprintf(stdout, "\n\t short : %d (%lu)", small_data, length[3]);
- fprintf(stdout, "\n\t int : %d (%lu)", int_data, length[2]);
- fprintf(stdout, "\n\t big : %lld (%lu)", big_data, length[4]);
+ if (!opt_silent)
+ {
+ fprintf(stdout, "\n");
+ fprintf(stdout, "\n\t tiny : %d (%lu)", tiny_data, length[0]);
+ fprintf(stdout, "\n\t short : %d (%lu)", small_data, length[3]);
+ fprintf(stdout, "\n\t int : %d (%lu)", int_data, length[2]);
+ fprintf(stdout, "\n\t big : %lld (%lu)", big_data, length[4]);
- fprintf(stdout, "\n\t float : %f (%lu)", real_data, length[5]);
- fprintf(stdout, "\n\t double : %f (%lu)", double_data, length[6]);
+ fprintf(stdout, "\n\t float : %f (%lu)", real_data, length[5]);
+ fprintf(stdout, "\n\t double : %f (%lu)", double_data, length[6]);
- fprintf(stdout, "\n\t str : %s (%lu)", str_data, length[1]);
+ fprintf(stdout, "\n\t str : %s (%lu)", str_data, length[1]);
+ }
DIE_UNLESS(tiny_data == o_tiny_data);
DIE_UNLESS(is_null[0] == 0);
@@ -1779,11 +1858,13 @@ static void test_fetch_null()
rc++;
for (i= 0; i < 10; i++)
{
- fprintf(stdout, "\n data[%d] : %s", i,
- is_null[i] ? "NULL" : "NOT NULL");
+ if (!opt_silent)
+ fprintf(stdout, "\n data[%d] : %s", i,
+ is_null[i] ? "NULL" : "NOT NULL");
DIE_UNLESS(is_null[i]);
}
- fprintf(stdout, "\n data[%d]: %d", i, nData);
+ if (!opt_silent)
+ fprintf(stdout, "\n data[%d]: %d", i, nData);
DIE_UNLESS(nData == 1000 || nData == 88 || nData == 389789);
DIE_UNLESS(is_null[i] == 0);
DIE_UNLESS(length[i] == 4);
@@ -2568,7 +2649,8 @@ static void test_long_data()
/* execute */
rc= mysql_stmt_execute(stmt);
- fprintf(stdout, " mysql_stmt_execute() returned %d\n", rc);
+ if (!opt_silent)
+ fprintf(stdout, " mysql_stmt_execute() returned %d\n", rc);
check_execute(stmt, rc);
rc= mysql_commit(mysql);
@@ -2651,7 +2733,8 @@ static void test_long_data_str()
}
/* execute */
rc= mysql_stmt_execute(stmt);
- fprintf(stdout, " mysql_stmt_execute() returned %d\n", rc);
+ if (!opt_silent)
+ fprintf(stdout, " mysql_stmt_execute() returned %d\n", rc);
check_execute(stmt, rc);
mysql_stmt_close(stmt);
@@ -2742,7 +2825,8 @@ static void test_long_data_str1()
/* execute */
rc= mysql_stmt_execute(stmt);
- fprintf(stdout, " mysql_stmt_execute() returned %d\n", rc);
+ if (!opt_silent)
+ fprintf(stdout, " mysql_stmt_execute() returned %d\n", rc);
check_execute(stmt, rc);
mysql_stmt_close(stmt);
@@ -2893,7 +2977,8 @@ static void test_long_data_bin()
}
/* execute */
rc= mysql_stmt_execute(stmt);
- fprintf(stdout, " mysql_stmt_execute() returned %d\n", rc);
+ if (!opt_silent)
+ fprintf(stdout, " mysql_stmt_execute() returned %d\n", rc);
check_execute(stmt, rc);
mysql_stmt_close(stmt);
@@ -3200,7 +3285,8 @@ static void test_bind_result()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n row 1: %d, %s(%lu)", nData, szData, length1);
+ if (!opt_silent)
+ fprintf(stdout, "\n row 1: %d, %s(%lu)", nData, szData, length1);
DIE_UNLESS(nData == 10);
DIE_UNLESS(strcmp(szData, "venu") == 0);
DIE_UNLESS(length1 == 4);
@@ -3208,7 +3294,8 @@ static void test_bind_result()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n row 2: %d, %s(%lu)", nData, szData, length1);
+ if (!opt_silent)
+ fprintf(stdout, "\n row 2: %d, %s(%lu)", nData, szData, length1);
DIE_UNLESS(nData == 20);
DIE_UNLESS(strcmp(szData, "MySQL") == 0);
DIE_UNLESS(length1 == 5);
@@ -3217,7 +3304,7 @@ static void test_bind_result()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- if (is_null[0])
+ if (!opt_silent && is_null[0])
fprintf(stdout, "\n row 3: NULL, %s(%lu)", szData, length1);
DIE_UNLESS(is_null[0]);
DIE_UNLESS(strcmp(szData, "monty") == 0);
@@ -3315,19 +3402,21 @@ static void test_bind_result_ext()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n data (tiny) : %d", t_data);
- fprintf(stdout, "\n data (short) : %d", s_data);
- fprintf(stdout, "\n data (int) : %d", i_data);
- fprintf(stdout, "\n data (big) : %lld", b_data);
-
- fprintf(stdout, "\n data (float) : %f", f_data);
- fprintf(stdout, "\n data (double) : %f", d_data);
+ if (!opt_silent)
+ {
+ fprintf(stdout, "\n data (tiny) : %d", t_data);
+ fprintf(stdout, "\n data (short) : %d", s_data);
+ fprintf(stdout, "\n data (int) : %d", i_data);
+ fprintf(stdout, "\n data (big) : %lld", b_data);
- fprintf(stdout, "\n data (str) : %s(%lu)", szData, szLength);
+ fprintf(stdout, "\n data (float) : %f", f_data);
+ fprintf(stdout, "\n data (double) : %f", d_data);
- bData[bLength]= '\0'; /* bData is binary */
- fprintf(stdout, "\n data (bin) : %s(%lu)", bData, bLength);
+ fprintf(stdout, "\n data (str) : %s(%lu)", szData, szLength);
+ bData[bLength]= '\0'; /* bData is binary */
+ fprintf(stdout, "\n data (bin) : %s(%lu)", bData, bLength);
+ }
DIE_UNLESS(t_data == 19);
DIE_UNLESS(s_data == 2999);
@@ -3435,16 +3524,19 @@ static void test_bind_result_ext1()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n data (tiny) : %s(%lu)", t_data, length[0]);
- fprintf(stdout, "\n data (short) : %f(%lu)", s_data, length[1]);
- fprintf(stdout, "\n data (int) : %d(%lu)", i_data, length[2]);
- fprintf(stdout, "\n data (big) : %d(%lu)", b_data, length[3]);
+ if (!opt_silent)
+ {
+ fprintf(stdout, "\n data (tiny) : %s(%lu)", t_data, length[0]);
+ fprintf(stdout, "\n data (short) : %f(%lu)", s_data, length[1]);
+ fprintf(stdout, "\n data (int) : %d(%lu)", i_data, length[2]);
+ fprintf(stdout, "\n data (big) : %d(%lu)", b_data, length[3]);
- fprintf(stdout, "\n data (float) : %d(%lu)", f_data, length[4]);
- fprintf(stdout, "\n data (double) : %s(%lu)", d_data, length[5]);
+ fprintf(stdout, "\n data (float) : %d(%lu)", f_data, length[4]);
+ fprintf(stdout, "\n data (double) : %s(%lu)", d_data, length[5]);
- fprintf(stdout, "\n data (bin) : %ld(%lu)", bData, length[6]);
- fprintf(stdout, "\n data (str) : %g(%lu)", szData, length[7]);
+ fprintf(stdout, "\n data (bin) : %ld(%lu)", bData, length[6]);
+ fprintf(stdout, "\n data (str) : %g(%lu)", szData, length[7]);
+ }
DIE_UNLESS(strcmp(t_data, "120") == 0);
DIE_UNLESS(i_data == 3999);
@@ -3569,15 +3661,17 @@ static void bind_fetch(int row_count)
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n");
- fprintf(stdout, "\n tiny : %ld(%lu)", (ulong) i8_data, length[0]);
- fprintf(stdout, "\n short : %ld(%lu)", (ulong) i16_data, length[1]);
- fprintf(stdout, "\n int : %ld(%lu)", (ulong) i32_data, length[2]);
- fprintf(stdout, "\n longlong : %ld(%lu)", (ulong) i64_data, length[3]);
- fprintf(stdout, "\n float : %f(%lu)", f_data, length[4]);
- fprintf(stdout, "\n double : %g(%lu)", d_data, length[5]);
- fprintf(stdout, "\n char : %s(%lu)", s_data, length[6]);
-
+ if (!opt_silent)
+ {
+ fprintf(stdout, "\n");
+ fprintf(stdout, "\n tiny : %ld(%lu)", (ulong) i8_data, length[0]);
+ fprintf(stdout, "\n short : %ld(%lu)", (ulong) i16_data, length[1]);
+ fprintf(stdout, "\n int : %ld(%lu)", (ulong) i32_data, length[2]);
+ fprintf(stdout, "\n longlong : %ld(%lu)", (ulong) i64_data, length[3]);
+ fprintf(stdout, "\n float : %f(%lu)", f_data, length[4]);
+ fprintf(stdout, "\n double : %g(%lu)", d_data, length[5]);
+ fprintf(stdout, "\n char : %s(%lu)", s_data, length[6]);
+ }
rc= 10+row_count;
/* TINY */
@@ -3719,13 +3813,16 @@ static void test_fetch_date()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n date : %s(%lu)", date, d_length);
- fprintf(stdout, "\n time : %s(%lu)", time, t_length);
- fprintf(stdout, "\n ts : %s(%lu)", ts, ts_length);
- fprintf(stdout, "\n year : %d(%lu)", year, y_length);
- fprintf(stdout, "\n dt : %s(%lu)", dt, dt_length);
- fprintf(stdout, "\n ts(4) : %s(%lu)", ts_4, ts4_length);
- fprintf(stdout, "\n ts(6) : %s(%lu)", ts_6, ts6_length);
+ if (!opt_silent)
+ {
+ fprintf(stdout, "\n date : %s(%lu)", date, d_length);
+ fprintf(stdout, "\n time : %s(%lu)", time, t_length);
+ fprintf(stdout, "\n ts : %s(%lu)", ts, ts_length);
+ fprintf(stdout, "\n year : %d(%lu)", year, y_length);
+ fprintf(stdout, "\n dt : %s(%lu)", dt, dt_length);
+ fprintf(stdout, "\n ts(4) : %s(%lu)", ts_4, ts4_length);
+ fprintf(stdout, "\n ts(6) : %s(%lu)", ts_6, ts6_length);
+ }
DIE_UNLESS(strcmp(date, "2002-01-02") == 0);
DIE_UNLESS(d_length == 10);
@@ -4052,7 +4149,8 @@ static void test_field_names()
myheader("test_field_names");
- fprintf(stdout, "\n %d, %d, %d", MYSQL_TYPE_DECIMAL, MYSQL_TYPE_NEWDATE, MYSQL_TYPE_ENUM);
+ if (!opt_silent)
+ fprintf(stdout, "\n %d, %d, %d", MYSQL_TYPE_DECIMAL, MYSQL_TYPE_NEWDATE, MYSQL_TYPE_ENUM);
rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_field_names1");
myquery(rc);
@@ -4103,7 +4201,8 @@ static void test_warnings()
rc= mysql_query(mysql, "DROP TABLE if exists test_non_exists");
myquery(rc);
- fprintf(stdout, "\n total warnings: %d", mysql_warning_count(mysql));
+ if (!opt_silent)
+ fprintf(stdout, "\n total warnings: %d", mysql_warning_count(mysql));
rc= mysql_query(mysql, "SHOW WARNINGS");
myquery(rc);
@@ -4285,23 +4384,27 @@ static void test_field_flags()
mytest(result);
mysql_field_seek(result, 0);
- fputc('\n', stdout);
+ if (!opt_silent)
+ fputc('\n', stdout);
for(i= 0; i< mysql_num_fields(result); i++)
{
field= mysql_fetch_field(result);
- fprintf(stdout, "\n field:%d", i);
- if (field->flags & NOT_NULL_FLAG)
- fprintf(stdout, "\n NOT_NULL_FLAG");
- if (field->flags & PRI_KEY_FLAG)
- fprintf(stdout, "\n PRI_KEY_FLAG");
- if (field->flags & UNIQUE_KEY_FLAG)
- fprintf(stdout, "\n UNIQUE_KEY_FLAG");
- if (field->flags & MULTIPLE_KEY_FLAG)
- fprintf(stdout, "\n MULTIPLE_KEY_FLAG");
- if (field->flags & AUTO_INCREMENT_FLAG)
- fprintf(stdout, "\n AUTO_INCREMENT_FLAG");
+ if (!opt_silent)
+ {
+ fprintf(stdout, "\n field:%d", i);
+ if (field->flags & NOT_NULL_FLAG)
+ fprintf(stdout, "\n NOT_NULL_FLAG");
+ if (field->flags & PRI_KEY_FLAG)
+ fprintf(stdout, "\n PRI_KEY_FLAG");
+ if (field->flags & UNIQUE_KEY_FLAG)
+ fprintf(stdout, "\n UNIQUE_KEY_FLAG");
+ if (field->flags & MULTIPLE_KEY_FLAG)
+ fprintf(stdout, "\n MULTIPLE_KEY_FLAG");
+ if (field->flags & AUTO_INCREMENT_FLAG)
+ fprintf(stdout, "\n AUTO_INCREMENT_FLAG");
+ }
}
mysql_free_result(result);
}
@@ -4320,7 +4423,8 @@ static void test_stmt_close()
myheader("test_stmt_close");
- fprintf(stdout, "\n Establishing a test connection ...");
+ if (!opt_silent)
+ fprintf(stdout, "\n Establishing a test connection ...");
if (!(lmysql= mysql_init(NULL)))
{
myerror("mysql_init() failed");
@@ -4333,7 +4437,8 @@ static void test_stmt_close()
myerror("connection failed");
exit(1);
}
- fprintf(stdout, " OK");
+ if (!opt_silent)
+ fprintf(stdout, " OK");
/* set AUTOCOMMIT to ON*/
@@ -4370,7 +4475,8 @@ static void test_stmt_close()
verify_param_count(stmt2, 1);
rc= mysql_stmt_close(stmt1);
- fprintf(stdout, "\n mysql_close_stmt(1) returned: %d", rc);
+ if (!opt_silent)
+ fprintf(stdout, "\n mysql_close_stmt(1) returned: %d", rc);
DIE_UNLESS(rc == 0);
/*
@@ -4404,7 +4510,8 @@ static void test_stmt_close()
verify_st_affected_rows(stmt_x, 1);
rc= mysql_stmt_close(stmt_x);
- fprintf(stdout, "\n mysql_close_stmt(x) returned: %d", rc);
+ if (!opt_silent)
+ fprintf(stdout, "\n mysql_close_stmt(x) returned: %d", rc);
DIE_UNLESS( rc == 0);
rc= mysql_query(mysql, "SELECT id FROM test_stmt_close");
@@ -4463,7 +4570,8 @@ static void test_set_variable()
rc= mysql_stmt_fetch(stmt1);
check_execute(stmt1, rc);
- fprintf(stdout, "\n max_error_count(default): %d", get_count);
+ if (!opt_silent)
+ fprintf(stdout, "\n max_error_count(default): %d", get_count);
def_count= get_count;
DIE_UNLESS(strcmp(var, "max_error_count") == 0);
@@ -4493,7 +4601,8 @@ static void test_set_variable()
rc= mysql_stmt_fetch(stmt1);
check_execute(stmt1, rc);
- fprintf(stdout, "\n max_error_count : %d", get_count);
+ if (!opt_silent)
+ fprintf(stdout, "\n max_error_count : %d", get_count);
DIE_UNLESS(get_count == set_count);
rc= mysql_stmt_fetch(stmt1);
@@ -4510,7 +4619,8 @@ static void test_set_variable()
rc= mysql_stmt_fetch(stmt1);
check_execute(stmt1, rc);
- fprintf(stdout, "\n max_error_count(default): %d", get_count);
+ if (!opt_silent)
+ fprintf(stdout, "\n max_error_count(default): %d", get_count);
DIE_UNLESS(get_count == set_count);
rc= mysql_stmt_fetch(stmt1);
@@ -4568,12 +4678,14 @@ static void test_insert_meta()
mysql_field_seek(result, 0);
field= mysql_fetch_field(result);
mytest(field);
- fprintf(stdout, "\n obtained: `%s` (expected: `%s`)", field->name, "col1");
+ if (!opt_silent)
+ fprintf(stdout, "\n obtained: `%s` (expected: `%s`)", field->name, "col1");
DIE_UNLESS(strcmp(field->name, "col1") == 0);
field= mysql_fetch_field(result);
mytest(field);
- fprintf(stdout, "\n obtained: `%s` (expected: `%s`)", field->name, "col3");
+ if (!opt_silent)
+ fprintf(stdout, "\n obtained: `%s` (expected: `%s`)", field->name, "col3");
DIE_UNLESS(strcmp(field->name, "col3") == 0);
field= mysql_fetch_field(result);
@@ -4630,15 +4742,21 @@ static void test_update_meta()
mysql_field_seek(result, 0);
field= mysql_fetch_field(result);
mytest(field);
- fprintf(stdout, "\n col obtained: `%s` (expected: `%s`)", field->name, "col1");
- fprintf(stdout, "\n tab obtained: `%s` (expected: `%s`)", field->table, "test_prep_update");
+ if (!opt_silent)
+ {
+ fprintf(stdout, "\n col obtained: `%s` (expected: `%s`)", field->name, "col1");
+ fprintf(stdout, "\n tab obtained: `%s` (expected: `%s`)", field->table, "test_prep_update");
+ }
DIE_UNLESS(strcmp(field->name, "col1") == 0);
DIE_UNLESS(strcmp(field->table, "test_prep_update") == 0);
field= mysql_fetch_field(result);
mytest(field);
- fprintf(stdout, "\n col obtained: `%s` (expected: `%s`)", field->name, "col3");
- fprintf(stdout, "\n tab obtained: `%s` (expected: `%s`)", field->table, "test_prep_update");
+ if (!opt_silent)
+ {
+ fprintf(stdout, "\n col obtained: `%s` (expected: `%s`)", field->name, "col3");
+ fprintf(stdout, "\n tab obtained: `%s` (expected: `%s`)", field->table, "test_prep_update");
+ }
DIE_UNLESS(strcmp(field->name, "col3") == 0);
DIE_UNLESS(strcmp(field->table, "test_prep_update") == 0);
@@ -4694,15 +4812,21 @@ static void test_select_meta()
mysql_field_seek(result, 0);
field= mysql_fetch_field(result);
mytest(field);
- fprintf(stdout, "\n col obtained: `%s` (expected: `%s`)", field->name, "col1");
- fprintf(stdout, "\n tab obtained: `%s` (expected: `%s`)", field->table, "test_prep_select");
+ if (!opt_silent)
+ {
+ fprintf(stdout, "\n col obtained: `%s` (expected: `%s`)", field->name, "col1");
+ fprintf(stdout, "\n tab obtained: `%s` (expected: `%s`)", field->table, "test_prep_select");
+ }
DIE_UNLESS(strcmp(field->name, "col1") == 0);
DIE_UNLESS(strcmp(field->table, "test_prep_select") == 0);
field= mysql_fetch_field(result);
mytest(field);
- fprintf(stdout, "\n col obtained: `%s` (expected: `%s`)", field->name, "col2");
- fprintf(stdout, "\n tab obtained: `%s` (expected: `%s`)", field->table, "test_prep_select");
+ if (!opt_silent)
+ {
+ fprintf(stdout, "\n col obtained: `%s` (expected: `%s`)", field->name, "col2");
+ fprintf(stdout, "\n tab obtained: `%s` (expected: `%s`)", field->table, "test_prep_select");
+ }
DIE_UNLESS(strcmp(field->name, "col2") == 0);
DIE_UNLESS(strcmp(field->table, "test_prep_select") == 0);
@@ -4746,8 +4870,9 @@ static void test_func_fields()
field= mysql_fetch_field(result);
mytest(field);
- fprintf(stdout, "\n table name: `%s` (expected: `%s`)", field->table,
- "test_dateformat");
+ if (!opt_silent)
+ fprintf(stdout, "\n table name: `%s` (expected: `%s`)", field->table,
+ "test_dateformat");
DIE_UNLESS(strcmp(field->table, "test_dateformat") == 0);
field= mysql_fetch_field(result);
@@ -4764,7 +4889,8 @@ static void test_func_fields()
field= mysql_fetch_field(result);
mytest(field);
- fprintf(stdout, "\n table name: `%s` (expected: `%s`)", field->table, "");
+ if (!opt_silent)
+ fprintf(stdout, "\n table name: `%s` (expected: `%s`)", field->table, "");
DIE_UNLESS(field->table[0] == '\0');
field= mysql_fetch_field(result);
@@ -4781,8 +4907,11 @@ static void test_func_fields()
field= mysql_fetch_field(result);
mytest(field);
- fprintf(stdout, "\n field name: `%s` (expected: `%s`)", field->name, "YEAR");
- fprintf(stdout, "\n field org name: `%s` (expected: `%s`)", field->org_name, "");
+ if (!opt_silent)
+ {
+ printf("\n field name: `%s` (expected: `%s`)", field->name, "YEAR");
+ printf("\n field org name: `%s` (expected: `%s`)", field->org_name, "");
+ }
DIE_UNLESS(strcmp(field->name, "YEAR") == 0);
DIE_UNLESS(field->org_name[0] == '\0');
@@ -4859,8 +4988,11 @@ static void test_multi_stmt()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n int_data: %lu(%lu)", (ulong) id, length[0]);
- fprintf(stdout, "\n str_data: %s(%lu)", name, length[1]);
+ if (!opt_silent)
+ {
+ fprintf(stdout, "\n int_data: %lu(%lu)", (ulong) id, length[0]);
+ fprintf(stdout, "\n str_data: %s(%lu)", name, length[1]);
+ }
DIE_UNLESS(id == 10);
DIE_UNLESS(strcmp(name, "mysql") == 0);
@@ -4888,8 +5020,11 @@ static void test_multi_stmt()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n int_data: %lu(%lu)", (ulong) id, length[0]);
- fprintf(stdout, "\n str_data: %s(%lu)", name, length[1]);
+ if (!opt_silent)
+ {
+ fprintf(stdout, "\n int_data: %lu(%lu)", (ulong) id, length[0]);
+ fprintf(stdout, "\n str_data: %s(%lu)", name, length[1]);
+ }
DIE_UNLESS(id == 10);
DIE_UNLESS(strcmp(name, "updated") == 0);
@@ -4963,12 +5098,14 @@ static void test_manual_sample()
fprintf(stderr, "\n %s", mysql_error(mysql));
exit(1);
}
- fprintf(stdout, "\n prepare, insert successful");
+ if (!opt_silent)
+ fprintf(stdout, "\n prepare, insert successful");
/* Get the parameter count from the statement */
param_count= mysql_stmt_param_count(stmt);
- fprintf(stdout, "\n total parameters in insert: %d", param_count);
+ if (!opt_silent)
+ fprintf(stdout, "\n total parameters in insert: %d", param_count);
if (param_count != 3) /* validate parameter count */
{
fprintf(stderr, "\n invalid parameter count returned by MySQL");
@@ -5024,7 +5161,8 @@ static void test_manual_sample()
/* Get the total rows affected */
affected_rows= mysql_stmt_affected_rows(stmt);
- fprintf(stdout, "\n total affected rows: %lld", affected_rows);
+ if (!opt_silent)
+ fprintf(stdout, "\n total affected rows: %lld", affected_rows);
if (affected_rows != 1) /* validate affected rows */
{
fprintf(stderr, "\n invalid affected rows by MySQL");
@@ -5048,7 +5186,8 @@ static void test_manual_sample()
/* Get the total rows affected */
affected_rows= mysql_stmt_affected_rows(stmt);
- fprintf(stdout, "\n total affected rows: %lld", affected_rows);
+ if (!opt_silent)
+ fprintf(stdout, "\n total affected rows: %lld", affected_rows);
if (affected_rows != 1) /* validate affected rows */
{
fprintf(stderr, "\n invalid affected rows by MySQL");
@@ -5072,7 +5211,8 @@ static void test_manual_sample()
fprintf(stderr, "\n %s", mysql_error(mysql));
exit(1);
}
- fprintf(stdout, "Success !!!");
+ if (!opt_silent)
+ fprintf(stdout, "Success !!!");
}
@@ -5194,13 +5334,14 @@ DROP TABLE IF EXISTS test_multi_tab";
for (count= 0 ; count < array_elements(rows) ; count++)
{
- fprintf(stdout, "\n Query %d: ", count);
+ if (!opt_silent)
+ fprintf(stdout, "\n Query %d: ", count);
if ((result= mysql_store_result(mysql_local)))
{
(void) my_process_result_set(result);
mysql_free_result(result);
}
- else
+ else if (!opt_silent)
fprintf(stdout, "OK, %lld row(s) affected, %d warning(s)\n",
mysql_affected_rows(mysql_local),
mysql_warning_count(mysql_local));
@@ -5208,7 +5349,7 @@ DROP TABLE IF EXISTS test_multi_tab";
exp_value= (uint) mysql_affected_rows(mysql_local);
if (rows[count] != exp_value)
{
- fprintf(stdout, "row %d had affected rows: %d, should be %d\n",
+ fprintf(stderr, "row %d had affected rows: %d, should be %d\n",
count, exp_value, rows[count]);
exit(1);
}
@@ -5284,7 +5425,7 @@ static void test_prepare_multi_statements()
if (!(mysql_local= mysql_init(NULL)))
{
- fprintf(stdout, "\n mysql_init() failed");
+ fprintf(stderr, "\n mysql_init() failed");
exit(1);
}
@@ -5292,7 +5433,7 @@ static void test_prepare_multi_statements()
opt_password, current_db, opt_port,
opt_unix_socket, CLIENT_MULTI_STATEMENTS)))
{
- fprintf(stdout, "\n connection failed(%s)", mysql_error(mysql_local));
+ fprintf(stderr, "\n connection failed(%s)", mysql_error(mysql_local));
exit(1);
}
strmov(query, "select 1; select 'another value'");
@@ -5360,7 +5501,8 @@ static void test_store_result()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n row 1: %ld, %s(%lu)", (long) nData, szData, length1);
+ if (!opt_silent)
+ fprintf(stdout, "\n row 1: %ld, %s(%lu)", (long) nData, szData, length1);
DIE_UNLESS(nData == 10);
DIE_UNLESS(strcmp(szData, "venu") == 0);
DIE_UNLESS(length1 == 4);
@@ -5368,7 +5510,8 @@ static void test_store_result()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n row 2: %ld, %s(%lu)", (long) nData, szData, length1);
+ if (!opt_silent)
+ fprintf(stdout, "\n row 2: %ld, %s(%lu)", (long) nData, szData, length1);
DIE_UNLESS(nData == 20);
DIE_UNLESS(strcmp(szData, "mysql") == 0);
DIE_UNLESS(length1 == 5);
@@ -5377,7 +5520,7 @@ static void test_store_result()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- if (is_null[0])
+ if (!opt_silent && is_null[0])
fprintf(stdout, "\n row 3: NULL, %s(%lu)", szData, length1);
DIE_UNLESS(is_null[0]);
DIE_UNLESS(strcmp(szData, "monty") == 0);
@@ -5395,7 +5538,8 @@ static void test_store_result()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n row 1: %ld, %s(%lu)", (long) nData, szData, length1);
+ if (!opt_silent)
+ fprintf(stdout, "\n row 1: %ld, %s(%lu)", (long) nData, szData, length1);
DIE_UNLESS(nData == 10);
DIE_UNLESS(strcmp(szData, "venu") == 0);
DIE_UNLESS(length1 == 4);
@@ -5403,7 +5547,8 @@ static void test_store_result()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n row 2: %ld, %s(%lu)", (long) nData, szData, length1);
+ if (!opt_silent)
+ fprintf(stdout, "\n row 2: %ld, %s(%lu)", (long) nData, szData, length1);
DIE_UNLESS(nData == 20);
DIE_UNLESS(strcmp(szData, "mysql") == 0);
DIE_UNLESS(length1 == 5);
@@ -5412,7 +5557,7 @@ static void test_store_result()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- if (is_null[0])
+ if (!opt_silent && is_null[0])
fprintf(stdout, "\n row 3: NULL, %s(%lu)", szData, length1);
DIE_UNLESS(is_null[0]);
DIE_UNLESS(strcmp(szData, "monty") == 0);
@@ -5461,7 +5606,8 @@ static void test_store_result1()
rc= 0;
while (mysql_stmt_fetch(stmt) != MYSQL_NO_DATA)
rc++;
- fprintf(stdout, "\n total rows: %d", rc);
+ if (!opt_silent)
+ fprintf(stdout, "\n total rows: %d", rc);
DIE_UNLESS(rc == 3);
rc= mysql_stmt_execute(stmt);
@@ -5473,7 +5619,8 @@ static void test_store_result1()
rc= 0;
while (mysql_stmt_fetch(stmt) != MYSQL_NO_DATA)
rc++;
- fprintf(stdout, "\n total rows: %d", rc);
+ if (!opt_silent)
+ fprintf(stdout, "\n total rows: %d", rc);
DIE_UNLESS(rc == 3);
mysql_stmt_close(stmt);
@@ -5539,7 +5686,8 @@ static void test_store_result2()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n row 1: %d", nData);
+ if (!opt_silent)
+ fprintf(stdout, "\n row 1: %d", nData);
DIE_UNLESS(nData == 10);
rc= mysql_stmt_fetch(stmt);
@@ -5556,7 +5704,8 @@ static void test_store_result2()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n row 1: %d", nData);
+ if (!opt_silent)
+ fprintf(stdout, "\n row 1: %d", nData);
DIE_UNLESS(nData == 20);
rc= mysql_stmt_fetch(stmt);
@@ -5660,7 +5809,8 @@ static void test_subselect()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n row 1: %d", id);
+ if (!opt_silent)
+ fprintf(stdout, "\n row 1: %d", id);
DIE_UNLESS(id == 1);
rc= mysql_stmt_fetch(stmt);
@@ -5673,7 +5823,8 @@ static void test_subselect()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n row 1: %d", id);
+ if (!opt_silent)
+ fprintf(stdout, "\n row 1: %d", id);
DIE_UNLESS(id == 0);
rc= mysql_stmt_fetch(stmt);
@@ -5790,21 +5941,21 @@ static void test_bind_date_conv(uint row_count)
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n");
+ if (!opt_silent)
+ fprintf(stdout, "\n");
for (i= 0; i < array_elements(bind); i++)
{
- fprintf(stdout, "\n");
- fprintf(stdout, " time[%d]: %02d-%02d-%02d %02d:%02d:%02d.%02lu",
- i, tm[i].year, tm[i].month, tm[i].day,
- tm[i].hour, tm[i].minute, tm[i].second,
- tm[i].second_part);
-
+ if (!opt_silent)
+ fprintf(stdout, "\ntime[%d]: %02d-%02d-%02d %02d:%02d:%02d.%02lu",
+ i, tm[i].year, tm[i].month, tm[i].day,
+ tm[i].hour, tm[i].minute, tm[i].second,
+ tm[i].second_part);
DIE_UNLESS(tm[i].year == 0 || tm[i].year == year+count);
DIE_UNLESS(tm[i].month == 0 || tm[i].month == month+count);
DIE_UNLESS(tm[i].day == 0 || tm[i].day == day+count);
DIE_UNLESS(tm[i].hour == 0 || tm[i].hour == hour+count);
-#if 0
+#ifdef NOT_USED
/*
minute causes problems from date<->time, don't assert, instead
validate separatly in another routine
@@ -6059,7 +6210,8 @@ static void test_buffers()
buffer[1]= 'X';
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n data: %s (%lu)", buffer, length);
+ if (!opt_silent)
+ fprintf(stdout, "\n data: %s (%lu)", buffer, length);
DIE_UNLESS(buffer[0] == 'M');
DIE_UNLESS(buffer[1] == 'X');
DIE_UNLESS(length == 5);
@@ -6070,7 +6222,8 @@ static void test_buffers()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n data: %s (%lu)", buffer, length);
+ if (!opt_silent)
+ fprintf(stdout, "\n data: %s (%lu)", buffer, length);
DIE_UNLESS(strncmp(buffer, "Database", 8) == 0);
DIE_UNLESS(length == 8);
@@ -6080,7 +6233,8 @@ static void test_buffers()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n data: %s (%lu)", buffer, length);
+ if (!opt_silent)
+ fprintf(stdout, "\n data: %s (%lu)", buffer, length);
DIE_UNLESS(strcmp(buffer, "Open-Source") == 0);
DIE_UNLESS(length == 11);
@@ -6090,7 +6244,8 @@ static void test_buffers()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n data: %s (%lu)", buffer, length);
+ if (!opt_silent)
+ fprintf(stdout, "\n data: %s (%lu)", buffer, length);
DIE_UNLESS(strncmp(buffer, "Popula", 6) == 0);
DIE_UNLESS(length == 7);
@@ -6221,7 +6376,8 @@ static void test_fetch_nobuffs()
while (mysql_stmt_fetch(stmt) != MYSQL_NO_DATA)
rc++;
- fprintf(stdout, "\n total rows : %d", rc);
+ if (!opt_silent)
+ fprintf(stdout, "\n total rows : %d", rc);
DIE_UNLESS(rc == 1);
bind[0].buffer_type= MYSQL_TYPE_STRING;
@@ -6244,12 +6400,16 @@ static void test_fetch_nobuffs()
while (mysql_stmt_fetch(stmt) != MYSQL_NO_DATA)
{
rc++;
- fprintf(stdout, "\n CURRENT_DATABASE(): %s", str[0]);
- fprintf(stdout, "\n CURRENT_USER() : %s", str[1]);
- fprintf(stdout, "\n CURRENT_DATE() : %s", str[2]);
- fprintf(stdout, "\n CURRENT_TIME() : %s", str[3]);
+ if (!opt_silent)
+ {
+ fprintf(stdout, "\n CURRENT_DATABASE(): %s", str[0]);
+ fprintf(stdout, "\n CURRENT_USER() : %s", str[1]);
+ fprintf(stdout, "\n CURRENT_DATE() : %s", str[2]);
+ fprintf(stdout, "\n CURRENT_TIME() : %s", str[3]);
+ }
}
- fprintf(stdout, "\n total rows : %d", rc);
+ if (!opt_silent)
+ fprintf(stdout, "\n total rows : %d", rc);
DIE_UNLESS(rc == 1);
mysql_stmt_close(stmt);
@@ -6316,10 +6476,13 @@ static void test_ushort_bug()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n ushort : %d (%ld)", short_value, s_length);
- fprintf(stdout, "\n ulong : %lu (%ld)", (ulong) long_value, l_length);
- fprintf(stdout, "\n longlong : %lld (%ld)", longlong_value, ll_length);
- fprintf(stdout, "\n tinyint : %d (%ld)", tiny_value, t_length);
+ if (!opt_silent)
+ {
+ fprintf(stdout, "\n ushort : %d (%ld)", short_value, s_length);
+ fprintf(stdout, "\n ulong : %lu (%ld)", (ulong) long_value, l_length);
+ fprintf(stdout, "\n longlong : %lld (%ld)", longlong_value, ll_length);
+ fprintf(stdout, "\n tinyint : %d (%ld)", tiny_value, t_length);
+ }
DIE_UNLESS(short_value == 35999);
DIE_UNLESS(s_length == 2);
@@ -6400,10 +6563,13 @@ static void test_sshort_bug()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n sshort : %d (%ld)", short_value, s_length);
- fprintf(stdout, "\n slong : %ld (%ld)", (long) long_value, l_length);
- fprintf(stdout, "\n longlong : %lld (%ld)", longlong_value, ll_length);
- fprintf(stdout, "\n tinyint : %d (%ld)", tiny_value, t_length);
+ if (!opt_silent)
+ {
+ fprintf(stdout, "\n sshort : %d (%ld)", short_value, s_length);
+ fprintf(stdout, "\n slong : %ld (%ld)", (long) long_value, l_length);
+ fprintf(stdout, "\n longlong : %lld (%ld)", longlong_value, ll_length);
+ fprintf(stdout, "\n tinyint : %d (%ld)", tiny_value, t_length);
+ }
DIE_UNLESS(short_value == -5999);
DIE_UNLESS(s_length == 2);
@@ -6484,10 +6650,13 @@ static void test_stiny_bug()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n sshort : %d (%ld)", short_value, s_length);
- fprintf(stdout, "\n slong : %ld (%ld)", (long) long_value, l_length);
- fprintf(stdout, "\n longlong : %lld (%ld)", longlong_value, ll_length);
- fprintf(stdout, "\n tinyint : %d (%ld)", tiny_value, t_length);
+ if (!opt_silent)
+ {
+ fprintf(stdout, "\n sshort : %d (%ld)", short_value, s_length);
+ fprintf(stdout, "\n slong : %ld (%ld)", (long) long_value, l_length);
+ fprintf(stdout, "\n longlong : %lld (%ld)", longlong_value, ll_length);
+ fprintf(stdout, "\n tinyint : %d (%ld)", tiny_value, t_length);
+ }
DIE_UNLESS(short_value == -128);
DIE_UNLESS(s_length == 2);
@@ -6576,7 +6745,8 @@ static void test_field_misc()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n default table type: %s(%ld)", table_type, type_length);
+ if (!opt_silent)
+ fprintf(stdout, "\n default table type: %s(%ld)", table_type, type_length);
rc= mysql_stmt_fetch(stmt);
DIE_UNLESS(rc == MYSQL_NO_DATA);
@@ -6696,7 +6866,8 @@ static void test_set_option()
rc= mysql_query(mysql, "INSERT INTO test_limit VALUES(10), (20), (30), (40)");
myquery(rc);
- fprintf(stdout, "\n with SQL_SELECT_LIMIT= 2 (direct)");
+ if (!opt_silent)
+ fprintf(stdout, "\n with SQL_SELECT_LIMIT= 2 (direct)");
rc= mysql_query(mysql, "SELECT * FROM test_limit");
myquery(rc);
@@ -6708,7 +6879,8 @@ static void test_set_option()
mysql_free_result(result);
- fprintf(stdout, "\n with SQL_SELECT_LIMIT=2 (prepare)");
+ if (!opt_silent)
+ fprintf(stdout, "\n with SQL_SELECT_LIMIT=2 (prepare)");
stmt= mysql_simple_prepare(mysql, "SELECT * FROM test_limit");
check_stmt(stmt);
@@ -6721,7 +6893,8 @@ static void test_set_option()
mysql_stmt_close(stmt);
/* RESET the LIMIT the rows count to 0 */
- fprintf(stdout, "\n with SQL_SELECT_LIMIT=DEFAULT (prepare)");
+ if (!opt_silent)
+ fprintf(stdout, "\n with SQL_SELECT_LIMIT=DEFAULT (prepare)");
rc= mysql_query(mysql, "SET OPTION SQL_SELECT_LIMIT=DEFAULT");
myquery(rc);
@@ -6779,7 +6952,8 @@ static void test_prepare_grant()
MYSQL *org_mysql= mysql, *lmysql;
MYSQL_STMT *stmt;
- fprintf(stdout, "\n Establishing a test connection ...");
+ if (!opt_silent)
+ fprintf(stdout, "\n Establishing a test connection ...");
if (!(lmysql= mysql_init(NULL)))
{
myerror("mysql_init() failed");
@@ -6793,7 +6967,8 @@ static void test_prepare_grant()
mysql_close(lmysql);
exit(1);
}
- fprintf(stdout, " OK");
+ if (!opt_silent)
+ fprintf(stdout, " OK");
mysql= lmysql;
rc= mysql_query(mysql, "INSERT INTO test_grant VALUES(NULL)");
@@ -6880,14 +7055,16 @@ static void test_frm_bug()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n data directory: %s", data_dir);
+ if (!opt_silent)
+ fprintf(stdout, "\n data directory: %s", data_dir);
rc= mysql_stmt_fetch(stmt);
DIE_UNLESS(rc == MYSQL_NO_DATA);
strxmov(test_frm, data_dir, "/", current_db, "/", "test_frm_bug.frm", NullS);
- fprintf(stdout, "\n test_frm: %s", test_frm);
+ if (!opt_silent)
+ fprintf(stdout, "\n test_frm: %s", test_frm);
if (!(test_file= my_fopen(test_frm, (int) (O_RDWR | O_CREAT), MYF(MY_WME))))
{
@@ -6895,7 +7072,8 @@ static void test_frm_bug()
fprintf(stdout, "\n test cancelled");
exit(1);
}
- fprintf(test_file, "this is a junk file for test");
+ if (!opt_silent)
+ fprintf(test_file, "this is a junk file for test");
rc= mysql_query(mysql, "SHOW TABLE STATUS like 'test_frm_bug'");
myquery(rc);
@@ -6911,7 +7089,8 @@ static void test_frm_bug()
row= mysql_fetch_row(result);
mytest(row);
- fprintf(stdout, "\n Comment: %s", row[17]);
+ if (!opt_silent)
+ fprintf(stdout, "\n Comment: %s", row[17]);
DIE_UNLESS(row[17] != 0);
mysql_free_result(result);
@@ -6974,7 +7153,8 @@ static void test_decimal_bug()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n data: %s", data);
+ if (!opt_silent)
+ fprintf(stdout, "\n data: %s", data);
DIE_UNLESS(strcmp(data, "8.00") == 0);
rc= mysql_stmt_fetch(stmt);
@@ -6991,7 +7171,8 @@ static void test_decimal_bug()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n data: %s", data);
+ if (!opt_silent)
+ fprintf(stdout, "\n data: %s", data);
DIE_UNLESS(strcmp(data, "5.61") == 0);
rc= mysql_stmt_fetch(stmt);
@@ -7015,7 +7196,8 @@ static void test_decimal_bug()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n data: %s", data);
+ if (!opt_silent)
+ fprintf(stdout, "\n data: %s", data);
DIE_UNLESS(strcmp(data, "10.22") == 0);
rc= mysql_stmt_fetch(stmt);
@@ -7055,8 +7237,9 @@ static void test_explain_bug()
result= mysql_stmt_result_metadata(stmt);
mytest(result);
- fprintf(stdout, "\n total fields in the result: %d",
- mysql_num_fields(result));
+ if (!opt_silent)
+ fprintf(stdout, "\n total fields in the result: %d",
+ mysql_num_fields(result));
DIE_UNLESS(6 == mysql_num_fields(result));
verify_prepare_field(result, 0, "Field", "", MYSQL_TYPE_VAR_STRING,
@@ -7092,8 +7275,9 @@ static void test_explain_bug()
result= mysql_stmt_result_metadata(stmt);
mytest(result);
- fprintf(stdout, "\n total fields in the result: %d",
- mysql_num_fields(result));
+ if (!opt_silent)
+ fprintf(stdout, "\n total fields in the result: %d",
+ mysql_num_fields(result));
DIE_UNLESS(10 == mysql_num_fields(result));
verify_prepare_field(result, 0, "id", "", MYSQL_TYPE_LONGLONG,
@@ -7114,8 +7298,12 @@ static void test_explain_bug()
verify_prepare_field(result, 5, "key", "", MYSQL_TYPE_VAR_STRING,
"", "", "", NAME_LEN, 0);
- verify_prepare_field(result, 6, "key_len", "", MYSQL_TYPE_VAR_STRING,
- "", "", "", NAME_LEN*MAX_KEY, 0);
+ verify_prepare_field(result, 6, "key_len", "",
+ (mysql_get_server_version(mysql) <= 50000 ?
+ MYSQL_TYPE_LONGLONG : MYSQL_TYPE_VAR_STRING),
+ "", "", "",
+ (mysql_get_server_version(mysql) <= 50000 ? 3 : 4096),
+ 0);
verify_prepare_field(result, 7, "ref", "", MYSQL_TYPE_VAR_STRING,
"", "", "", NAME_LEN*16, 0);
@@ -7141,11 +7329,14 @@ static void test_explain_bug()
static void check_errcode(const unsigned int err)
{
- if (mysql->server_version)
- fprintf(stdout, "\n [MySQL-%s]", mysql->server_version);
- else
- fprintf(stdout, "\n [MySQL]");
- fprintf(stdout, "[%d] %s\n", mysql_errno(mysql), mysql_error(mysql));
+ if (!opt_silent || mysql_errno(mysql) != err)
+ {
+ if (mysql->server_version)
+ fprintf(stdout, "\n [MySQL-%s]", mysql->server_version);
+ else
+ fprintf(stdout, "\n [MySQL]");
+ fprintf(stdout, "[%d] %s\n", mysql_errno(mysql), mysql_error(mysql));
+ }
DIE_UNLESS(mysql_errno(mysql) == err);
}
@@ -7191,7 +7382,8 @@ static void test_drop_temp()
{
MYSQL *org_mysql= mysql, *lmysql;
- fprintf(stdout, "\n Establishing a test connection ...");
+ if (!opt_silent)
+ fprintf(stdout, "\n Establishing a test connection ...");
if (!(lmysql= mysql_init(NULL)))
{
myerror("mysql_init() failed");
@@ -7210,7 +7402,8 @@ static void test_drop_temp()
mysql_close(lmysql);
exit(1);
}
- fprintf(stdout, " OK");
+ if (!opt_silent)
+ fprintf(stdout, " OK");
mysql= lmysql;
rc= mysql_query(mysql, "INSERT INTO t1 VALUES(10, 'C')");
@@ -7279,14 +7472,16 @@ static void test_cuted_rows()
myquery(rc);
count= mysql_warning_count(mysql);
- fprintf(stdout, "\n total warnings: %d", count);
+ if (!opt_silent)
+ fprintf(stdout, "\n total warnings: %d", count);
DIE_UNLESS(count == 0);
rc= mysql_query(mysql, "INSERT INTO t2 SELECT * FROM t1");
myquery(rc);
count= mysql_warning_count(mysql);
- fprintf(stdout, "\n total warnings: %d", count);
+ if (!opt_silent)
+ fprintf(stdout, "\n total warnings: %d", count);
DIE_UNLESS(count == 2);
rc= mysql_query(mysql, "SHOW WARNINGS");
@@ -7303,7 +7498,8 @@ static void test_cuted_rows()
myquery(rc);
count= mysql_warning_count(mysql);
- fprintf(stdout, "\n total warnings: %d", count);
+ if (!opt_silent)
+ fprintf(stdout, "\n total warnings: %d", count);
DIE_UNLESS(count == 2);
rc= mysql_query(mysql, "SHOW WARNINGS");
@@ -7416,8 +7612,11 @@ static void test_logs()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n id : %d", id);
- fprintf(stdout, "\n name : %s(%ld)", data, length);
+ if (!opt_silent)
+ {
+ fprintf(stdout, "\n id : %d", id);
+ fprintf(stdout, "\n name : %s(%ld)", data, length);
+ }
DIE_UNLESS(id == 9876);
DIE_UNLESS(length == 19); /* Due to VARCHAR(20) */
@@ -7426,7 +7625,8 @@ static void test_logs()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n name : %s(%ld)", data, length);
+ if (!opt_silent)
+ fprintf(stdout, "\n name : %s(%ld)", data, length);
DIE_UNLESS(length == 1);
DIE_UNLESS(strcmp(data, "'") == 0);
@@ -7434,7 +7634,8 @@ static void test_logs()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n name : %s(%ld)", data, length);
+ if (!opt_silent)
+ fprintf(stdout, "\n name : %s(%ld)", data, length);
DIE_UNLESS(length == 1);
DIE_UNLESS(strcmp(data, "\"") == 0);
@@ -7442,7 +7643,8 @@ static void test_logs()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n name : %s(%ld)", data, length);
+ if (!opt_silent)
+ fprintf(stdout, "\n name : %s(%ld)", data, length);
DIE_UNLESS(length == 7);
DIE_UNLESS(strcmp(data, "my\'sql\'") == 0);
@@ -7450,7 +7652,8 @@ static void test_logs()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n name : %s(%ld)", data, length);
+ if (!opt_silent)
+ fprintf(stdout, "\n name : %s(%ld)", data, length);
DIE_UNLESS(length == 7);
/*DIE_UNLESS(strcmp(data, "my\"sql\"") == 0); */
@@ -7496,7 +7699,8 @@ static void test_nstmts()
for (i= 0; i < total_stmts; i++)
{
- fprintf(stdout, "\r stmt: %d", i);
+ if (!opt_silent)
+ fprintf(stdout, "\r stmt: %d", i);
strmov(query, "insert into test_nstmts values(?)");
stmt= mysql_simple_prepare(mysql, query);
@@ -7523,7 +7727,8 @@ static void test_nstmts()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n total rows: %d", i);
+ if (!opt_silent)
+ fprintf(stdout, "\n total rows: %d", i);
DIE_UNLESS( i == total_stmts);
rc= mysql_stmt_fetch(stmt);
@@ -7548,17 +7753,17 @@ static void test_fetch_seek()
char c2[11], c3[20];
myheader("test_fetch_seek");
+ rc= mysql_query(mysql, "drop table if exists t1");
- rc= mysql_query(mysql, "drop table if exists test_seek");
myquery(rc);
- rc= mysql_query(mysql, "create table test_seek(c1 int primary key auto_increment, c2 char(10), c3 timestamp(14))");
+ rc= mysql_query(mysql, "create table t1(c1 int primary key auto_increment, c2 char(10), c3 timestamp(14))");
myquery(rc);
- rc= mysql_query(mysql, "insert into test_seek(c2) values('venu'), ('mysql'), ('open'), ('source')");
+ rc= mysql_query(mysql, "insert into t1(c2) values('venu'), ('mysql'), ('open'), ('source')");
myquery(rc);
- stmt= mysql_simple_prepare(mysql, "select * from test_seek");
+ stmt= mysql_simple_prepare(mysql, "select * from t1");
check_stmt(stmt);
bind[0].buffer_type= MYSQL_TYPE_LONG;
@@ -7589,7 +7794,8 @@ static void test_fetch_seek()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n row 0: %ld, %s, %s", (long) c1, c2, c3);
+ if (!opt_silent)
+ fprintf(stdout, "\n row 0: %ld, %s, %s", (long) c1, c2, c3);
row= mysql_stmt_row_tell(stmt);
@@ -7598,21 +7804,24 @@ static void test_fetch_seek()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n row 2: %ld, %s, %s", (long) c1, c2, c3);
+ if (!opt_silent)
+ fprintf(stdout, "\n row 2: %ld, %s, %s", (long) c1, c2, c3);
row= mysql_stmt_row_seek(stmt, row);
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n row 2: %ld, %s, %s", (long) c1, c2, c3);
+ if (!opt_silent)
+ fprintf(stdout, "\n row 2: %ld, %s, %s", (long) c1, c2, c3);
mysql_stmt_data_seek(stmt, 0);
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n row 0: %ld, %s, %s", (long) c1, c2, c3);
+ if (!opt_silent)
+ fprintf(stdout, "\n row 0: %ld, %s, %s", (long) c1, c2, c3);
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
@@ -7627,6 +7836,7 @@ static void test_fetch_seek()
DIE_UNLESS(rc == MYSQL_NO_DATA);
mysql_stmt_close(stmt);
+ myquery(mysql_query(mysql, "drop table t1"));
}
@@ -7644,16 +7854,16 @@ static void test_fetch_offset()
myheader("test_fetch_offset");
- rc= mysql_query(mysql, "drop table if exists test_column");
+ rc= mysql_query(mysql, "drop table if exists t1");
myquery(rc);
- rc= mysql_query(mysql, "create table test_column(a char(10))");
+ rc= mysql_query(mysql, "create table t1(a char(10))");
myquery(rc);
- rc= mysql_query(mysql, "insert into test_column values('abcdefghij'), (null)");
+ rc= mysql_query(mysql, "insert into t1 values('abcdefghij'), (null)");
myquery(rc);
- stmt= mysql_simple_prepare(mysql, "select * from test_column");
+ stmt= mysql_simple_prepare(mysql, "select * from t1");
check_stmt(stmt);
bind[0].buffer_type= MYSQL_TYPE_STRING;
@@ -7680,17 +7890,20 @@ static void test_fetch_offset()
data[0]= '\0';
rc= mysql_stmt_fetch_column(stmt, bind, 0, 0);
check_execute(stmt, rc);
- fprintf(stdout, "\n col 1: %s (%ld)", data, length);
+ if (!opt_silent)
+ fprintf(stdout, "\n col 1: %s (%ld)", data, length);
DIE_UNLESS(strncmp(data, "abcd", 4) == 0 && length == 10);
rc= mysql_stmt_fetch_column(stmt, bind, 0, 5);
check_execute(stmt, rc);
- fprintf(stdout, "\n col 1: %s (%ld)", data, length);
+ if (!opt_silent)
+ fprintf(stdout, "\n col 1: %s (%ld)", data, length);
DIE_UNLESS(strncmp(data, "fg", 2) == 0 && length == 10);
rc= mysql_stmt_fetch_column(stmt, bind, 0, 9);
check_execute(stmt, rc);
- fprintf(stdout, "\n col 0: %s (%ld)", data, length);
+ if (!opt_silent)
+ fprintf(stdout, "\n col 0: %s (%ld)", data, length);
DIE_UNLESS(strncmp(data, "j", 1) == 0 && length == 10);
rc= mysql_stmt_fetch(stmt);
@@ -7710,6 +7923,8 @@ static void test_fetch_offset()
check_execute_r(stmt, rc);
mysql_stmt_close(stmt);
+
+ myquery(mysql_query(mysql, "drop table t1"));
}
@@ -7725,16 +7940,16 @@ static void test_fetch_column()
myheader("test_fetch_column");
- rc= mysql_query(mysql, "drop table if exists test_column");
+ rc= mysql_query(mysql, "drop table if exists t1");
myquery(rc);
- rc= mysql_query(mysql, "create table test_column(c1 int primary key auto_increment, c2 char(10))");
+ rc= mysql_query(mysql, "create table t1(c1 int primary key auto_increment, c2 char(10))");
myquery(rc);
- rc= mysql_query(mysql, "insert into test_column(c2) values('venu'), ('mysql')");
+ rc= mysql_query(mysql, "insert into t1(c2) values('venu'), ('mysql')");
myquery(rc);
- stmt= mysql_simple_prepare(mysql, "select * from test_column order by c2 desc");
+ stmt= mysql_simple_prepare(mysql, "select * from t1 order by c2 desc");
check_stmt(stmt);
bind[0].buffer_type= MYSQL_TYPE_LONG;
@@ -7763,7 +7978,8 @@ static void test_fetch_column()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n row 0: %d, %s", bc1, bc2);
+ if (!opt_silent)
+ fprintf(stdout, "\n row 0: %d, %s", bc1, bc2);
c2[0]= '\0'; l2= 0;
bind[0].buffer_type= MYSQL_TYPE_STRING;
@@ -7774,13 +7990,15 @@ static void test_fetch_column()
rc= mysql_stmt_fetch_column(stmt, bind, 1, 0);
check_execute(stmt, rc);
- fprintf(stdout, "\n col 1: %s(%ld)", c2, l2);
+ if (!opt_silent)
+ fprintf(stdout, "\n col 1: %s(%ld)", c2, l2);
DIE_UNLESS(strncmp(c2, "venu", 4) == 0 && l2 == 4);
c2[0]= '\0'; l2= 0;
rc= mysql_stmt_fetch_column(stmt, bind, 1, 0);
check_execute(stmt, rc);
- fprintf(stdout, "\n col 1: %s(%ld)", c2, l2);
+ if (!opt_silent)
+ fprintf(stdout, "\n col 1: %s(%ld)", c2, l2);
DIE_UNLESS(strcmp(c2, "venu") == 0 && l2 == 4);
c1= 0;
@@ -7792,13 +8010,15 @@ static void test_fetch_column()
rc= mysql_stmt_fetch_column(stmt, bind, 0, 0);
check_execute(stmt, rc);
- fprintf(stdout, "\n col 0: %d(%ld)", c1, l1);
+ if (!opt_silent)
+ fprintf(stdout, "\n col 0: %d(%ld)", c1, l1);
DIE_UNLESS(c1 == 1 && l1 == 4);
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "\n row 1: %d, %s", bc1, bc2);
+ if (!opt_silent)
+ fprintf(stdout, "\n row 1: %d, %s", bc1, bc2);
c2[0]= '\0'; l2= 0;
bind[0].buffer_type= MYSQL_TYPE_STRING;
@@ -7809,13 +8029,15 @@ static void test_fetch_column()
rc= mysql_stmt_fetch_column(stmt, bind, 1, 0);
check_execute(stmt, rc);
- fprintf(stdout, "\n col 1: %s(%ld)", c2, l2);
+ if (!opt_silent)
+ fprintf(stdout, "\n col 1: %s(%ld)", c2, l2);
DIE_UNLESS(strncmp(c2, "mysq", 4) == 0 && l2 == 5);
c2[0]= '\0'; l2= 0;
rc= mysql_stmt_fetch_column(stmt, bind, 1, 0);
check_execute(stmt, rc);
- fprintf(stdout, "\n col 1: %si(%ld)", c2, l2);
+ if (!opt_silent)
+ fprintf(stdout, "\n col 1: %si(%ld)", c2, l2);
DIE_UNLESS(strcmp(c2, "mysql") == 0 && l2 == 5);
c1= 0;
@@ -7827,7 +8049,8 @@ static void test_fetch_column()
rc= mysql_stmt_fetch_column(stmt, bind, 0, 0);
check_execute(stmt, rc);
- fprintf(stdout, "\n col 0: %d(%ld)", c1, l1);
+ if (!opt_silent)
+ fprintf(stdout, "\n col 0: %d(%ld)", c1, l1);
DIE_UNLESS(c1 == 2 && l1 == 4);
rc= mysql_stmt_fetch(stmt);
@@ -7837,6 +8060,7 @@ static void test_fetch_column()
check_execute_r(stmt, rc);
mysql_stmt_close(stmt);
+ myquery(mysql_query(mysql, "drop table t1"));
}
@@ -7848,27 +8072,28 @@ static void test_list_fields()
int rc;
myheader("test_list_fields");
- rc= mysql_query(mysql, "drop table if exists test_list_fields");
+ rc= mysql_query(mysql, "drop table if exists t1");
myquery(rc);
- rc= mysql_query(mysql, "create table test_list_fields(c1 int primary key auto_increment, c2 char(10) default 'mysql')");
+ rc= mysql_query(mysql, "create table t1(c1 int primary key auto_increment, c2 char(10) default 'mysql')");
myquery(rc);
- result= mysql_list_fields(mysql, "test_list_fields", NULL);
+ result= mysql_list_fields(mysql, "t1", NULL);
mytest(result);
rc= my_process_result_set(result);
DIE_UNLESS(rc == 0);
verify_prepare_field(result, 0, "c1", "c1", MYSQL_TYPE_LONG,
- "test_list_fields", "test_list_fields",
+ "t1", "t1",
current_db, 11, "0");
verify_prepare_field(result, 1, "c2", "c2", MYSQL_TYPE_STRING,
- "test_list_fields", "test_list_fields",
+ "t1", "t1",
current_db, 10, "mysql");
mysql_free_result(result);
+ myquery(mysql_query(mysql, "drop table t1"));
}
@@ -7881,7 +8106,6 @@ static void test_mem_overun()
MYSQL_RES *field_res;
int rc, i, length;
-
myheader("test_mem_overun");
/*
@@ -7931,7 +8155,8 @@ static void test_mem_overun()
field_res= mysql_stmt_result_metadata(stmt);
mytest(field_res);
- fprintf(stdout, "\n total fields : %d", mysql_num_fields(field_res));
+ if (!opt_silent)
+ fprintf(stdout, "\n total fields : %d", mysql_num_fields(field_res));
DIE_UNLESS( 1000 == mysql_num_fields(field_res));
rc= mysql_stmt_store_result(stmt);
@@ -7998,7 +8223,8 @@ static void test_free_result()
rc= mysql_stmt_fetch_column(stmt, bind, 0, 0);
check_execute(stmt, rc);
- fprintf(stdout, "\n col 0: %s(%ld)", c2, l2);
+ if (!opt_silent)
+ fprintf(stdout, "\n col 0: %s(%ld)", c2, l2);
DIE_UNLESS(strncmp(c2, "1", 1) == 0 && l2 == 1);
rc= mysql_stmt_fetch(stmt);
@@ -8013,7 +8239,8 @@ static void test_free_result()
rc= mysql_stmt_fetch_column(stmt, bind, 0, 0);
check_execute(stmt, rc);
- fprintf(stdout, "\n col 0: %d(%ld)", c1, l2);
+ if (!opt_silent)
+ fprintf(stdout, "\n col 0: %d(%ld)", c1, l2);
DIE_UNLESS(c1 == 2 && l2 == 4);
rc= mysql_query(mysql, "drop table test_free_result");
@@ -8080,7 +8307,8 @@ static void test_free_store_result()
rc= mysql_stmt_fetch_column(stmt, bind, 0, 0);
check_execute(stmt, rc);
- fprintf(stdout, "\n col 1: %s(%ld)", c2, l2);
+ if (!opt_silent)
+ fprintf(stdout, "\n col 1: %s(%ld)", c2, l2);
DIE_UNLESS(strncmp(c2, "1", 1) == 0 && l2 == 1);
rc= mysql_stmt_fetch(stmt);
@@ -8095,7 +8323,8 @@ static void test_free_store_result()
rc= mysql_stmt_fetch_column(stmt, bind, 0, 0);
check_execute(stmt, rc);
- fprintf(stdout, "\n col 0: %d(%ld)", c1, l2);
+ if (!opt_silent)
+ fprintf(stdout, "\n col 0: %d(%ld)", c1, l2);
DIE_UNLESS(c1 == 2 && l2 == 4);
rc= mysql_stmt_free_result(stmt);
@@ -8127,16 +8356,19 @@ static void test_sqlmode()
/* PIPES_AS_CONCAT */
strcpy(query, "SET SQL_MODE= \"PIPES_AS_CONCAT\"");
- fprintf(stdout, "\n With %s", query);
+ if (!opt_silent)
+ fprintf(stdout, "\n With %s", query);
rc= mysql_query(mysql, query);
myquery(rc);
strcpy(query, "INSERT INTO test_piping VALUES(?||?)");
- fprintf(stdout, "\n query: %s", query);
+ if (!opt_silent)
+ fprintf(stdout, "\n query: %s", query);
stmt= mysql_simple_prepare(mysql, query);
check_stmt(stmt);
- fprintf(stdout, "\n total parameters: %ld", mysql_stmt_param_count(stmt));
+ if (!opt_silent)
+ fprintf(stdout, "\n total parameters: %ld", mysql_stmt_param_count(stmt));
/*
We need to bzero bind structure because mysql_stmt_bind_param checks all
@@ -8166,21 +8398,25 @@ static void test_sqlmode()
myquery(rc);
strcpy(query, "SELECT connection_id ()");
- fprintf(stdout, "\n query: %s", query);
+ if (!opt_silent)
+ fprintf(stdout, "\n query: %s", query);
stmt= mysql_simple_prepare(mysql, query);
check_stmt_r(stmt);
/* ANSI */
strcpy(query, "SET SQL_MODE= \"ANSI\"");
- fprintf(stdout, "\n With %s", query);
+ if (!opt_silent)
+ fprintf(stdout, "\n With %s", query);
rc= mysql_query(mysql, query);
myquery(rc);
strcpy(query, "INSERT INTO test_piping VALUES(?||?)");
- fprintf(stdout, "\n query: %s", query);
+ if (!opt_silent)
+ fprintf(stdout, "\n query: %s", query);
stmt= mysql_simple_prepare(mysql, query);
check_stmt(stmt);
- fprintf(stdout, "\n total parameters: %ld", mysql_stmt_param_count(stmt));
+ if (!opt_silent)
+ fprintf(stdout, "\n total parameters: %ld", mysql_stmt_param_count(stmt));
rc= mysql_stmt_bind_param(stmt, bind);
check_execute(stmt, rc);
@@ -8194,7 +8430,8 @@ static void test_sqlmode()
/* ANSI mode spaces ... */
strcpy(query, "SELECT connection_id ()");
- fprintf(stdout, "\n query: %s", query);
+ if (!opt_silent)
+ fprintf(stdout, "\n query: %s", query);
stmt= mysql_simple_prepare(mysql, query);
check_stmt(stmt);
@@ -8206,18 +8443,21 @@ static void test_sqlmode()
rc= mysql_stmt_fetch(stmt);
DIE_UNLESS(rc == MYSQL_NO_DATA);
- fprintf(stdout, "\n returned 1 row\n");
+ if (!opt_silent)
+ fprintf(stdout, "\n returned 1 row\n");
mysql_stmt_close(stmt);
/* IGNORE SPACE MODE */
strcpy(query, "SET SQL_MODE= \"IGNORE_SPACE\"");
- fprintf(stdout, "\n With %s", query);
+ if (!opt_silent)
+ fprintf(stdout, "\n With %s", query);
rc= mysql_query(mysql, query);
myquery(rc);
strcpy(query, "SELECT connection_id ()");
- fprintf(stdout, "\n query: %s", query);
+ if (!opt_silent)
+ fprintf(stdout, "\n query: %s", query);
stmt= mysql_simple_prepare(mysql, query);
check_stmt(stmt);
@@ -8229,7 +8469,8 @@ static void test_sqlmode()
rc= mysql_stmt_fetch(stmt);
DIE_UNLESS(rc == MYSQL_NO_DATA);
- fprintf(stdout, "\n returned 1 row");
+ if (!opt_silent)
+ fprintf(stdout, "\n returned 1 row");
mysql_stmt_close(stmt);
}
@@ -8321,7 +8562,8 @@ static void test_ts()
sprintf(query, "SELECT a, b, c FROM test_ts WHERE %c=?", name);
- fprintf(stdout, "\n %s", query);
+ if (!opt_silent)
+ fprintf(stdout, "\n %s", query);
stmt= mysql_simple_prepare(mysql, query);
check_stmt(stmt);
@@ -8334,7 +8576,8 @@ static void test_ts()
while (mysql_stmt_fetch(stmt) == 0)
row_count++;
- fprintf(stdout, "\n returned '%d' rows", row_count);
+ if (!opt_silent)
+ fprintf(stdout, "\n returned '%d' rows", row_count);
DIE_UNLESS(row_count == 2);
mysql_stmt_close(stmt);
}
@@ -8476,7 +8719,8 @@ static void test_bug1946()
check_stmt(stmt);
rc= mysql_real_query(mysql, query, strlen(query));
DIE_UNLESS(rc != 0);
- fprintf(stdout, "Got error (as expected):\n");
+ if (!opt_silent)
+ fprintf(stdout, "Got error (as expected):\n");
myerror(NULL);
mysql_stmt_close(stmt);
@@ -8494,19 +8738,23 @@ static void test_parse_error_and_bad_length()
rc= mysql_query(mysql, "SHOW DATABAAAA");
DIE_UNLESS(rc);
- fprintf(stdout, "Got error (as expected): '%s'\n", mysql_error(mysql));
+ if (!opt_silent)
+ fprintf(stdout, "Got error (as expected): '%s'\n", mysql_error(mysql));
rc= mysql_real_query(mysql, "SHOW DATABASES", 100);
DIE_UNLESS(rc);
- fprintf(stdout, "Got error (as expected): '%s'\n", mysql_error(mysql));
+ if (!opt_silent)
+ fprintf(stdout, "Got error (as expected): '%s'\n", mysql_error(mysql));
stmt= mysql_simple_prepare(mysql, "SHOW DATABAAAA");
DIE_UNLESS(!stmt);
- fprintf(stdout, "Got error (as expected): '%s'\n", mysql_error(mysql));
+ if (!opt_silent)
+ fprintf(stdout, "Got error (as expected): '%s'\n", mysql_error(mysql));
stmt= mysql_stmt_init(mysql);
DIE_UNLESS(stmt);
rc= mysql_stmt_prepare(stmt, "SHOW DATABASES", 100);
DIE_UNLESS(rc != 0);
- fprintf(stdout, "Got error (as expected): '%s'\n", mysql_stmt_error(stmt));
+ if (!opt_silent)
+ fprintf(stdout, "Got error (as expected): '%s'\n", mysql_stmt_error(stmt));
mysql_stmt_close(stmt);
}
@@ -8527,7 +8775,8 @@ static void test_bug2247()
myheader("test_bug2247");
- fprintf(stdout, "\nChecking if stmt_affected_rows is not affected by\n"
+ if (!opt_silent)
+ fprintf(stdout, "\nChecking if stmt_affected_rows is not affected by\n"
"mysql_query ... ");
/* create table and insert few rows */
rc= mysql_query(mysql, drop);
@@ -8584,7 +8833,8 @@ static void test_bug2247()
DIE_UNLESS(mysql_stmt_affected_rows(stmt) == exp_count);
mysql_stmt_close(stmt);
- fprintf(stdout, "OK");
+ if (!opt_silent)
+ fprintf(stdout, "OK");
}
@@ -8862,7 +9112,8 @@ static void test_bug3117()
check_execute(stmt, rc);
DIE_UNLESS(is_null == 0 && lii == 1);
- fprintf(stdout, "\n\tLAST_INSERT_ID()= 1 ok\n");
+ if (!opt_silent)
+ fprintf(stdout, "\n\tLAST_INSERT_ID()= 1 ok\n");
rc= mysql_query(mysql, "INSERT INTO t1 VALUES (NULL)");
myquery(rc);
@@ -8874,7 +9125,8 @@ static void test_bug3117()
check_execute(stmt, rc);
DIE_UNLESS(is_null == 0 && lii == 2);
- fprintf(stdout, "\tLAST_INSERT_ID()= 2 ok\n");
+ if (!opt_silent)
+ fprintf(stdout, "\tLAST_INSERT_ID()= 2 ok\n");
mysql_stmt_close(stmt);
@@ -9024,7 +9276,8 @@ static void test_create_drop()
{
rc= mysql_stmt_execute(stmt_create);
check_execute(stmt_create, rc);
- fprintf(stdout, "created %i\n", i);
+ if (!opt_silent)
+ fprintf(stdout, "created %i\n", i);
rc= mysql_stmt_execute(stmt_select);
check_execute(stmt_select, rc);
@@ -9033,11 +9286,13 @@ static void test_create_drop()
rc= mysql_stmt_execute(stmt_drop);
check_execute(stmt_drop, rc);
- fprintf(stdout, "droped %i\n", i);
+ if (!opt_silent)
+ fprintf(stdout, "droped %i\n", i);
rc= mysql_stmt_execute(stmt_create_select);
check_execute(stmt_create, rc);
- fprintf(stdout, "created select %i\n", i);
+ if (!opt_silent)
+ fprintf(stdout, "created select %i\n", i);
rc= mysql_stmt_execute(stmt_select);
check_execute(stmt_select, rc);
@@ -9046,7 +9301,8 @@ static void test_create_drop()
rc= mysql_stmt_execute(stmt_drop);
check_execute(stmt_drop, rc);
- fprintf(stdout, "droped %i\n", i);
+ if (!opt_silent)
+ fprintf(stdout, "droped %i\n", i);
}
mysql_stmt_close(stmt_create);
@@ -9077,25 +9333,29 @@ static void test_rename()
rc= mysql_stmt_execute(stmt);
check_execute_r(stmt, rc);
- fprintf(stdout, "rename without t3\n");
+ if (!opt_silent)
+ fprintf(stdout, "rename without t3\n");
rc= mysql_query(mysql, "create table t3 (a int)");
myquery(rc);
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "rename with t3\n");
+ if (!opt_silent)
+ fprintf(stdout, "rename with t3\n");
rc= mysql_stmt_execute(stmt);
check_execute_r(stmt, rc);
- fprintf(stdout, "rename renamed\n");
+ if (!opt_silent)
+ fprintf(stdout, "rename renamed\n");
rc= mysql_query(mysql, "rename table t2 to t1, t4 to t3");
myquery(rc);
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
- fprintf(stdout, "rename reverted\n");
+ if (!opt_silent)
+ fprintf(stdout, "rename reverted\n");
mysql_stmt_close(stmt);
@@ -9129,10 +9389,12 @@ static void test_do_set()
{
rc= mysql_stmt_execute(stmt_do);
check_execute(stmt_do, rc);
- fprintf(stdout, "do %i\n", i);
+ if (!opt_silent)
+ fprintf(stdout, "do %i\n", i);
rc= mysql_stmt_execute(stmt_set);
check_execute(stmt_set, rc);
- fprintf(stdout, "set %i\n", i);
+ if (!opt_silent)
+ fprintf(stdout, "set %i\n", i);
}
mysql_stmt_close(stmt_do);
@@ -9198,11 +9460,13 @@ static void test_multi()
rc= mysql_stmt_execute(stmt_update);
check_execute(stmt_update, rc);
- fprintf(stdout, "update %ld\n", (long) param);
+ if (!opt_silent)
+ fprintf(stdout, "update %ld\n", (long) param);
rc= mysql_stmt_execute(stmt_delete);
check_execute(stmt_delete, rc);
- fprintf(stdout, "delete %ld\n", (long) param);
+ if (!opt_silent)
+ fprintf(stdout, "delete %ld\n", (long) param);
rc= mysql_stmt_execute(stmt_select1);
check_execute(stmt_select1, rc);
@@ -9258,7 +9522,8 @@ static void test_insert_select()
{
rc= mysql_stmt_execute(stmt_insert);
check_execute(stmt_insert, rc);
- fprintf(stdout, "insert %u\n", i);
+ if (!opt_silent)
+ fprintf(stdout, "insert %u\n", i);
rc= mysql_stmt_execute(stmt_select);
check_execute(stmt_select, rc);
@@ -10118,7 +10383,8 @@ static void test_bug3796()
mysql_stmt_bind_result(stmt, bind);
rc= mysql_stmt_fetch(stmt);
- printf("Concat result: '%s'\n", out_buff);
+ if (!opt_silent)
+ printf("Concat result: '%s'\n", out_buff);
check_execute(stmt, rc);
strcpy(canonical_buff, concat_arg0);
strcat(canonical_buff, "ONE");
@@ -10130,7 +10396,8 @@ static void test_bug3796()
strcpy(canonical_buff + strlen(concat_arg0), "TWO");
DIE_UNLESS(strlen(canonical_buff) == out_length &&
strncmp(out_buff, canonical_buff, out_length) == 0);
- printf("Concat result: '%s'\n", out_buff);
+ if (!opt_silent)
+ printf("Concat result: '%s'\n", out_buff);
rc= mysql_stmt_fetch(stmt);
DIE_UNLESS(rc == MYSQL_NO_DATA);
@@ -10204,12 +10471,15 @@ static void test_bug4026()
rc= mysql_stmt_fetch(stmt);
DIE_UNLESS(rc == 0);
- printf("%d:%d:%d.%lu\n", time_out.hour, time_out.minute, time_out.second,
- time_out.second_part);
- printf("%d-%d-%d %d:%d:%d.%lu\n", datetime_out.year, datetime_out.month,
- datetime_out.day, datetime_out.hour,
- datetime_out.minute, datetime_out.second,
- datetime_out.second_part);
+ if (!opt_silent)
+ {
+ printf("%d:%d:%d.%lu\n", time_out.hour, time_out.minute, time_out.second,
+ time_out.second_part);
+ printf("%d-%d-%d %d:%d:%d.%lu\n", datetime_out.year, datetime_out.month,
+ datetime_out.day, datetime_out.hour,
+ datetime_out.minute, datetime_out.second,
+ datetime_out.second_part);
+ }
DIE_UNLESS(memcmp(&time_in, &time_out, sizeof(time_in)) == 0);
DIE_UNLESS(memcmp(&datetime_in, &datetime_out, sizeof(datetime_in)) == 0);
mysql_stmt_close(stmt);
@@ -10252,8 +10522,9 @@ static void test_bug4079()
rc= mysql_stmt_fetch(stmt);
DIE_UNLESS(rc != 0 && rc != MYSQL_NO_DATA);
- printf("Got error from mysql_stmt_fetch (as expected):\n%s\n",
- mysql_stmt_error(stmt));
+ if (!opt_silent)
+ printf("Got error from mysql_stmt_fetch (as expected):\n%s\n",
+ mysql_stmt_error(stmt));
/* buggy version of libmysql hanged up here */
mysql_stmt_close(stmt);
}
@@ -10347,13 +10618,16 @@ static void test_bug4030()
rc= mysql_stmt_fetch(stmt);
DIE_UNLESS(rc == 0);
- printf("%d:%d:%d.%lu\n", time_out.hour, time_out.minute, time_out.second,
- time_out.second_part);
- printf("%d-%d-%d\n", date_out.year, date_out.month, date_out.day);
- printf("%d-%d-%d %d:%d:%d.%lu\n", datetime_out.year, datetime_out.month,
- datetime_out.day, datetime_out.hour,
- datetime_out.minute, datetime_out.second,
- datetime_out.second_part);
+ if (!opt_silent)
+ {
+ printf("%d:%d:%d.%lu\n", time_out.hour, time_out.minute, time_out.second,
+ time_out.second_part);
+ printf("%d-%d-%d\n", date_out.year, date_out.month, date_out.day);
+ printf("%d-%d-%d %d:%d:%d.%lu\n", datetime_out.year, datetime_out.month,
+ datetime_out.day, datetime_out.hour,
+ datetime_out.minute, datetime_out.second,
+ datetime_out.second_part);
+ }
DIE_UNLESS(memcmp(&time_canonical, &time_out, sizeof(time_out)) == 0);
DIE_UNLESS(memcmp(&date_canonical, &date_out, sizeof(date_out)) == 0);
DIE_UNLESS(memcmp(&datetime_canonical, &datetime_out, sizeof(datetime_out)) == 0);
@@ -10755,7 +11029,8 @@ static void test_bug5126()
rc= mysql_stmt_fetch(stmt);
DIE_UNLESS(rc == 0);
DIE_UNLESS(c1 == 8386608 && c2 == 1);
- printf("%ld, %ld\n", (long) c1, (long) c2);
+ if (!opt_silent)
+ printf("%ld, %ld\n", (long) c1, (long) c2);
mysql_stmt_close(stmt);
}
@@ -10861,7 +11136,8 @@ static void test_bug5399()
check_execute(*stmt, rc);
mysql_stmt_bind_result(*stmt, bind);
}
- printf("%d statements prepared.\n", NUM_OF_USED_STMT);
+ if (!opt_silent)
+ printf("%d statements prepared.\n", NUM_OF_USED_STMT);
for (stmt= stmt_list; stmt != stmt_list + NUM_OF_USED_STMT; ++stmt)
{
@@ -11033,15 +11309,17 @@ static void test_bug5194()
rc= mysql_stmt_prepare(stmt, query, query_ptr - query);
if (rc && nrows * COLUMN_COUNT > uint16_max)
{
- printf("Failed to prepare a statement with %d placeholders "
- "(as expected).\n", nrows * COLUMN_COUNT);
+ if (!opt_silent)
+ printf("Failed to prepare a statement with %d placeholders "
+ "(as expected).\n", nrows * COLUMN_COUNT);
break;
}
else
check_execute(stmt, rc);
- printf("Insert: query length= %d, row count= %d, param count= %lu\n",
- strlen(query), nrows, mysql_stmt_param_count(stmt));
+ if (!opt_silent)
+ printf("Insert: query length= %d, row count= %d, param count= %lu\n",
+ strlen(query), nrows, mysql_stmt_param_count(stmt));
/* bind the parameter array and execute the query */
rc= mysql_stmt_bind_param(stmt, bind);
@@ -11077,7 +11355,10 @@ static void test_bug5315()
rc= mysql_stmt_execute(stmt);
DIE_UNLESS(rc != 0);
if (rc)
- printf("Got error (as expected):\n%s", mysql_stmt_error(stmt));
+ {
+ if (!opt_silent)
+ printf("Got error (as expected):\n%s", mysql_stmt_error(stmt));
+ }
/* check that connection is OK */
mysql_stmt_close(stmt);
stmt= mysql_stmt_init(mysql);
@@ -11125,8 +11406,11 @@ static void test_bug6049()
rc= mysql_stmt_fetch(stmt);
DIE_UNLESS(rc == 0);
- printf("Result from query: %s\n", row[0]);
- printf("Result from prepared statement: %s\n", (char*) buffer);
+ if (!opt_silent)
+ {
+ printf("Result from query: %s\n", row[0]);
+ printf("Result from prepared statement: %s\n", (char*) buffer);
+ }
DIE_UNLESS(strcmp(row[0], (char*) buffer) == 0);
@@ -11171,8 +11455,11 @@ static void test_bug6058()
rc= mysql_stmt_fetch(stmt);
DIE_UNLESS(rc == 0);
- printf("Result from query: %s\n", row[0]);
- printf("Result from prepared statement: %s\n", buffer);
+ if (!opt_silent)
+ {
+ printf("Result from query: %s\n", row[0]);
+ printf("Result from prepared statement: %s\n", buffer);
+ }
DIE_UNLESS(strcmp(row[0], buffer) == 0);
@@ -11211,17 +11498,17 @@ static void test_bug6046()
stmt_text= "DROP TABLE IF EXISTS t1";
rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
myquery(rc);
- stmt_text= "CREATE TABLE a1 (a int, b int)";
+ stmt_text= "CREATE TABLE t1 (a int, b int)";
rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
myquery(rc);
- stmt_text= "INSERT INTO a1 VALUES (1,1),(2,2),(3,1),(4,2)";
+ stmt_text= "INSERT INTO t1 VALUES (1,1),(2,2),(3,1),(4,2)";
rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
myquery(rc);
stmt= mysql_stmt_init(mysql);
- stmt_text= "SELECT a1.a FROM a1 NATURAL JOIN a1 as X1 "
- "WHERE a1.b > ? ORDER BY a1.a";
+ stmt_text= "SELECT t1.a FROM t1 NATURAL JOIN t1 as X1 "
+ "WHERE t1.b > ? ORDER BY t1.a";
rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
check_execute(stmt, rc);
@@ -11247,6 +11534,7 @@ static void test_bug6046()
static void test_basic_cursors()
{
+ DBUG_ENTER("test_basic_cursors");
const char *basic_tables[]=
{
"DROP TABLE IF EXISTS t1, t2",
@@ -11284,6 +11572,7 @@ static void test_basic_cursors()
fill_tables(basic_tables, sizeof(basic_tables)/sizeof(*basic_tables));
fetch_n(queries, sizeof(queries)/sizeof(*queries));
+ DBUG_VOID_RETURN;
}
@@ -11381,22 +11670,25 @@ static void test_bug6096()
/* Print out and check the metadata */
- printf(" ---------------------------------------------------------------\n");
- printf(" | Metadata \n");
- printf(" ---------------------------------------------------------------\n");
- printf(" | Query | Prepared statement \n");
- printf(" ---------------------------------------------------------------\n");
- printf(" field name | length | max_length | length | max_length \n");
- printf(" ---------------------------------------------------------------\n");
-
- for (i= 0; i < query_field_count; ++i)
+ if (!opt_silent)
{
- MYSQL_FIELD *f1= &query_field_list[i], *f2= &stmt_field_list[i];
- printf(" %-11s | %9lu | %10lu | %9lu | %10lu \n",
- f1->name, f1->length, f1->max_length, f2->length, f2->max_length);
- DIE_UNLESS(f1->length == f2->length);
+ printf(" ------------------------------------------------------------\n");
+ printf(" | Metadata \n");
+ printf(" ------------------------------------------------------------\n");
+ printf(" | Query | Prepared statement \n");
+ printf(" ------------------------------------------------------------\n");
+ printf(" field name | length | max_length | length | max_length\n");
+ printf(" ------------------------------------------------------------\n");
+
+ for (i= 0; i < query_field_count; ++i)
+ {
+ MYSQL_FIELD *f1= &query_field_list[i], *f2= &stmt_field_list[i];
+ printf(" %-11s | %9lu | %10lu | %9lu | %10lu \n",
+ f1->name, f1->length, f1->max_length, f2->length, f2->max_length);
+ DIE_UNLESS(f1->length == f2->length);
+ }
+ printf(" ---------------------------------------------------------------\n");
}
- printf(" ---------------------------------------------------------------\n");
/* Bind and fetch the data */
@@ -11419,12 +11711,146 @@ static void test_bug6096()
free(bind[i].buffer);
mysql_stmt_close(stmt);
mysql_free_result(query_result);
+ mysql_free_result(stmt_metadata);
stmt_text= "drop table t1";
rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
myquery(rc);
}
+static void test_bug4172()
+{
+ MYSQL_STMT *stmt;
+ MYSQL_BIND bind[3];
+ const char *stmt_text;
+ MYSQL_RES *res;
+ MYSQL_ROW row;
+ int rc;
+ char f[100], d[100], e[100];
+ long f_len, d_len, e_len;
+
+ myheader("test_bug4172");
+
+ mysql_query(mysql, "DROP TABLE IF EXISTS t1");
+ mysql_query(mysql, "CREATE TABLE t1 (f float, d double, e decimal(10,4))");
+ mysql_query(mysql, "INSERT INTO t1 VALUES (12345.1234, 123456.123456, "
+ "123456.1234)");
+
+ stmt= mysql_stmt_init(mysql);
+ stmt_text= "SELECT f, d, e FROM t1";
+
+ rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ check_execute(stmt, rc);
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+
+ bzero(bind, sizeof(bind));
+ bind[0].buffer_type= MYSQL_TYPE_STRING;
+ bind[0].buffer= f;
+ bind[0].buffer_length= sizeof(f);
+ bind[0].length= &f_len;
+ bind[1].buffer_type= MYSQL_TYPE_STRING;
+ bind[1].buffer= d;
+ bind[1].buffer_length= sizeof(d);
+ bind[1].length= &d_len;
+ bind[2].buffer_type= MYSQL_TYPE_STRING;
+ bind[2].buffer= e;
+ bind[2].buffer_length= sizeof(e);
+ bind[2].length= &e_len;
+
+ mysql_stmt_bind_result(stmt, bind);
+
+ mysql_stmt_store_result(stmt);
+ rc= mysql_stmt_fetch(stmt);
+ check_execute(stmt, rc);
+
+ rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ myquery(rc);
+ res= mysql_store_result(mysql);
+ row= mysql_fetch_row(res);
+
+ if (!opt_silent)
+ {
+ printf("Binary protocol: float=%s, double=%s, decimal(10,4)=%s\n",
+ f, d, e);
+ printf("Text protocol: float=%s, double=%s, decimal(10,4)=%s\n",
+ row[0], row[1], row[2]);
+ }
+ DIE_UNLESS(!strcmp(f, row[0]) && !strcmp(d, row[1]) && !strcmp(e, row[2]));
+
+ mysql_free_result(res);
+ mysql_stmt_close(stmt);
+}
+
+
+static void test_conversion()
+{
+ MYSQL_STMT *stmt;
+ const char *stmt_text;
+ int rc;
+ MYSQL_BIND bind[1];
+ char buff[4];
+ ulong length;
+
+ myheader("test_conversion");
+
+ stmt_text= "DROP TABLE IF EXISTS t1";
+ rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ myquery(rc);
+ stmt_text= "CREATE TABLE t1 (a TEXT) DEFAULT CHARSET latin1";
+ rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ myquery(rc);
+ stmt_text= "SET character_set_connection=utf8, character_set_client=utf8, "
+ " character_set_results=latin1";
+ rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ myquery(rc);
+
+ stmt= mysql_stmt_init(mysql);
+
+ stmt_text= "INSERT INTO t1 (a) VALUES (?)";
+ rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ check_execute(stmt, rc);
+
+ bzero(bind, sizeof(bind));
+ bind[0].buffer= buff;
+ bind[0].length= &length;
+ bind[0].buffer_type= MYSQL_TYPE_STRING;
+
+ mysql_stmt_bind_param(stmt, bind);
+
+ buff[0]= 0xC3;
+ buff[1]= 0xA0;
+ length= 2;
+
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+
+ stmt_text= "SELECT a FROM t1";
+ rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ check_execute(stmt, rc);
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+
+ bind[0].buffer_length= sizeof(buff);
+ mysql_stmt_bind_result(stmt, bind);
+
+ rc= mysql_stmt_fetch(stmt);
+ DIE_UNLESS(rc == 0);
+ DIE_UNLESS(length == 1);
+ DIE_UNLESS((uchar) buff[0] == 0xE0);
+ rc= mysql_stmt_fetch(stmt);
+ DIE_UNLESS(rc == MYSQL_NO_DATA);
+
+ mysql_stmt_close(stmt);
+ stmt_text= "DROP TABLE t1";
+ rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ myquery(rc);
+ stmt_text= "SET NAMES DEFAULT";
+ rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ myquery(rc);
+}
+
+
/*
Read and parse arguments and MySQL options from my.cnf
*/
@@ -11451,6 +11877,8 @@ static struct my_option client_test_long_options[] =
#endif
{"port", 'P', "Port number to use for connection", (char **) &opt_port,
(char **) &opt_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"silent", 's', "Be more silent", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0,
+ 0},
{"socket", 'S', "Socket file to use for connection", (char **) &opt_unix_socket,
(char **) &opt_unix_socket, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"testcase", 'c', "May disable some code when runs as mysql-test-run testcase.",
@@ -11460,36 +11888,25 @@ static struct my_option client_test_long_options[] =
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
-static void client_test_print_version(void)
-{
- fprintf(stdout, "%s Distrib %s, for %s (%s)\n\n",
- my_progname, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
-}
-
static void usage(void)
{
- /*
- * show the usage string when the user asks for this
- */
+ /* show the usage string when the user asks for this */
putc('\n', stdout);
- puts("***********************************************************************\n");
- puts(" Test for client-server protocol 4.1");
- puts(" By Monty & Venu \n");
- puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software, ");
- puts("and you are welcome to modify and redistribute it under the GPL license\n");
- puts(" Copyright (C) 1995-2003 MySQL AB ");
- puts("-----------------------------------------------------------------------\n");
- client_test_print_version();
- fprintf(stdout, "Usage: %s [OPTIONS]\n\n", my_progname);
-
+ printf("%s Ver %s Distrib %s, for %s (%s)\n",
+ my_progname, VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
+ puts("By Monty, Venu, Kent and others\n");
+ printf("\
+Copyright (C) 2002-2004 MySQL AB\n\
+This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n\
+and you are welcome to modify and redistribute it under the GPL license\n");
+ printf("Usage: %s [OPTIONS]\n", my_progname);
my_print_help(client_test_long_options);
print_defaults("my", client_test_load_default_groups);
my_print_variables(client_test_long_options);
-
- puts("***********************************************************************\n");
}
+
static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
@@ -11514,6 +11931,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
else
tty_password= 1;
break;
+ case 's':
+ if (argument == disabled_my_option)
+ opt_silent= 0;
+ else
+ opt_silent++;
+ break;
case '?':
case 'I': /* Info */
usage();
@@ -11542,14 +11965,17 @@ static void get_options(int argc, char **argv)
static void print_test_output()
{
- fprintf(stdout, "\n\n");
- fprintf(stdout, "All '%d' tests were successful (in '%d' iterations)",
- test_count-1, opt_count);
- fprintf(stdout, "\n Total execution time: %g SECS", total_time);
- if (opt_count > 1)
- fprintf(stdout, " (Avg: %g SECS)", total_time/opt_count);
-
- fprintf(stdout, "\n\n!!! SUCCESS !!!\n");
+ if (opt_silent < 3)
+ {
+ fprintf(stdout, "\n\n");
+ fprintf(stdout, "All '%d' tests were successful (in '%d' iterations)",
+ test_count-1, opt_count);
+ fprintf(stdout, "\n Total execution time: %g SECS", total_time);
+ if (opt_count > 1)
+ fprintf(stdout, " (Avg: %g SECS)", total_time/opt_count);
+
+ fprintf(stdout, "\n\n!!! SUCCESS !!!\n");
+ }
}
@@ -11741,6 +12167,12 @@ int main(int argc, char **argv)
test_bug6046(); /* NATURAL JOIN transformation works in PS */
test_bug6081(); /* test of mysql_create_db()/mysql_rm_db() */
test_bug6096(); /* max_length for numeric columns */
+ test_bug4172(); /* floating point conversions in libmysql */
+
+ test_conversion(); /* placeholder value is not converted to
+ character set of column if character set
+ of connection equals to character set of
+ client */
test_view(); /* Test of VIEWS with prepared statements */
test_view_where(); /* VIEW with WHERE clause & merge algorithm */
test_view_2where(); /* VIEW with WHERE * SELECt with WHERE */