diff options
560 files changed, 19559 insertions, 8454 deletions
diff --git a/.bzrignore b/.bzrignore index 2c115322cc5..17fee4a6fc1 100644 --- a/.bzrignore +++ b/.bzrignore @@ -580,3 +580,5 @@ vio/test-sslclient vio/test-sslserver vio/viotest-ssl libmysqld/protocol.cc +test_xml +extra/mysql_waitpid diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh index 859150c3954..9a092b84a8f 100644 --- a/BUILD/SETUP.sh +++ b/BUILD/SETUP.sh @@ -48,7 +48,7 @@ fast_cflags="-O3 -fno-omit-frame-pointer" # this is one is for someone who thinks 1% speedup is worth not being # able to backtrace reckless_cflags="-O3 -fomit-frame-pointer " -debug_cflags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC -DSAFE_MUTEX -O1" +debug_cflags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC -DSAFE_MUTEX -O1 -Wuninitialized" base_cxxflags="-felide-constructors -fno-exceptions -fno-rtti" diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 00952150b8c..562191618ad 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -26,6 +26,7 @@ hf@bisonxp.(none) hf@deer.mysql.r18.ru hf@genie.(none) jani@dsl-jkl1657.dial.inet.fi +jani@dsl-kpogw4gb5.dial.inet.fi jani@hynda.(none) jani@hynda.mysql.fi jani@janikt.pp.saunalahti.fi @@ -69,7 +70,9 @@ peter@mysql.com ram@gw.udmsearch.izhnet.ru ram@mysql.r18.ru ram@ram.(none) +ranger@regul.home.lan root@x3.internalnet +salle@banica.(none) salle@geopard.(none) salle@geopard.online.bg sasha@mysql.sashanet.com @@ -95,6 +98,7 @@ venu@myvenu.com venu@work.mysql.com vva@eagle.mysql.r18.ru vva@genie.(none) +walrus@kishkin.ru walrus@mysql.com wax@mysql.com worm@altair.is.lan diff --git a/Build-tools/Do-compile b/Build-tools/Do-compile index 52c1951f48f..8695c72b913 100755 --- a/Build-tools/Do-compile +++ b/Build-tools/Do-compile @@ -8,7 +8,7 @@ use Getopt::Long; $opt_distribution=$opt_user=$opt_config_env=""; $opt_dbd_options=$opt_perl_options=$opt_config_options=$opt_make_options=$opt_suffix=""; $opt_tmp=$opt_version_suffix=""; -$opt_help=$opt_delete=$opt_debug=$opt_stage=$opt_no_test=$opt_no_perl=$opt_with_low_memory=$opt_fast_benchmark=$opt_static_client=$opt_static_server=$opt_static_perl=$opt_sur=$opt_with_small_disk=$opt_local_perl=$opt_tcpip=$opt_build_thread=$opt_use_old_distribution=$opt_enable_shared=$opt_no_crash_me=$opt_no_strip=$opt_with_debug=0; +$opt_help=$opt_delete=$opt_debug=$opt_stage=$opt_no_test=$opt_no_perl=$opt_with_low_memory=$opt_fast_benchmark=$opt_static_client=$opt_static_server=$opt_static_perl=$opt_sur=$opt_with_small_disk=$opt_local_perl=$opt_tcpip=$opt_build_thread=$opt_use_old_distribution=$opt_enable_shared=$opt_no_crash_me=$opt_no_strip=$opt_with_debug=$opt_no_benchmark=$opt_no_mysqltest=0; $opt_innodb=$opt_bdb=$opt_raid=$opt_libwrap=0; GetOptions( @@ -30,7 +30,9 @@ GetOptions( "no-crash-me", "no-perl", "no-strip", - "no-test|no-mysqltest", + "no-test", + "no-mysqltest", + "no-benchmark", "perl-files=s", "perl-options=s", "raid", @@ -133,6 +135,7 @@ $ENV{'MYSQL_UNIX_PORT'}=$mysql_unix_port="$opt_tmp/mysql$opt_suffix.build"; $ENV{"PERL5LIB"}="$pwd/$host/perl5:$pwd/$host/perl5/site_perl"; $slave_port=$mysql_tcp_port+16; $manager_port=$mysql_tcp_port+1; +$mysqladmin_args="--no-defaults -u root --connect_timeout=5 --shutdown_timeout=20"; if ($opt_stage == 0) { @@ -148,19 +151,26 @@ select STDOUT; $|=1; info("Compiling MySQL$opt_version_suffix at $host$opt_suffix, stage: $opt_stage\n"); +log_timestamp(); if (-x "$host/bin/mysqladmin") { - log_system("$host/bin/mysqladmin --no-defaults -u root -S $mysql_unix_port -s shutdown"); - log_system("$host/bin/mysqladmin --no-defaults -u root -P $mysql_tcp_port -h $host -s shutdown"); - log_system("$host/bin/mysqladmin --no-defaults -u root -P $slave_port -h $host -s shutdown"); - log_system("$host/bin/mysqladmin --no-defaults -u root -P 9306 -h $host -s shutdown"); - log_system("$host/bin/mysqladmin --no-defaults -u root -P 9307 -h $host -s shutdown"); + log_system("$host/bin/mysqladmin $mysqladmin_args -S $mysql_unix_port -s shutdown"); + log_system("$host/bin/mysqladmin $mysqladmin_args -P $mysql_tcp_port -h $host -s shutdown"); + log_system("$host/bin/mysqladmin $mysqladmin_args -P $slave_port -h $host -s shutdown"); + log_system("$host/bin/mysqladmin $mysqladmin_args -P 9306 -h $host -s shutdown"); + log_system("$host/bin/mysqladmin $mysqladmin_args -P 9307 -h $host -s shutdown"); } kill_all("mysqlmanager"); +# +# Kill all old processes that are in the build directories +# This is to find any old mysqld servers left from previous builds +kill_all("$pwd/host/mysql"); +kill_all("$pwd/host/test"); if ($opt_stage == 0) { + log_timestamp(); print "$host: Removing old distribution\n" if ($opt_debug); if (!$opt_use_old_distribution) { @@ -209,6 +219,7 @@ safe_cd("$pwd/$host/$ver"); if ($opt_stage <= 1) { # Fix files if this is in another timezone than the build host + log_timestamp(); unlink("config.cache"); unlink("bdb/build_unix/config.cache"); unlink("innobase/config.cache"); @@ -252,6 +263,7 @@ if ($opt_stage <= 1) if ($opt_stage <= 2) { my ($command); + log_timestamp(); unlink($opt_distribution) if ($opt_delete && !$opt_use_old_distribution); $command=$make; $command.= " $opt_make_options" if (defined($opt_make_options) && $opt_make_options ne ""); @@ -264,6 +276,7 @@ if ($opt_stage <= 2) if ($opt_stage <= 3) { my $flags= ""; + log_timestamp(); log_system("rm -fr mysql-3* mysql-4* $pwd/$host/*.tar.gz"); log_system("nm -n sql/mysqld | gzip -9 -v 2>&1 > sql/mysqld.sym.gz | cat"); @@ -292,6 +305,7 @@ if (!defined($tar_file)) # if ($opt_stage <= 4 && !$opt_no_test) { + log_timestamp(); rm_all(<$pwd/$host/test/*>); safe_cd("$pwd/$host/test"); safe_system("gunzip < $tar_file | $tar xf -"); @@ -300,13 +314,15 @@ if ($opt_stage <= 4 && !$opt_no_test) $tar_file =~ /(mysql[^\/]*)\.tar/; $ver=$1; $test_dir="$pwd/$host/test/$ver"; -$ENV{"LD_LIBRARY_PATH"}= "$test_dir/lib:" . $ENV{"LD_LIBRARY_PATH"}; - +$ENV{"LD_LIBRARY_PATH"}= ("$test_dir/lib" . + (defined($ENV{"LD_LIBRARY_PATH"}) ? + ":" . $ENV{"LD_LIBRARY_PATH"} : "")); # # Run the test suite # -if ($opt_stage <= 5 && !$opt_no_test) +if ($opt_stage <= 5 && !$opt_no_test && !$opt_no_mysqltest) { + log_timestamp(); system("mkdir $bench_tmpdir") if (! -d $bench_tmpdir); safe_cd("${test_dir}/mysql-test"); check_system("./mysql-test-run --warnings --tmpdir=$bench_tmpdir --master_port=$mysql_tcp_port --slave_port=$slave_port --manager-port=$manager_port --no-manager --sleep=10", "tests were successful"); @@ -315,11 +331,11 @@ if ($opt_stage <= 5 && !$opt_no_test) # # Start the server if we are going to run any of the benchmarks # -if (!$opt_no_test) +if (!$opt_no_test && !$opt_no_benchmark) { my $extra; safe_cd($test_dir); - log_system("./bin/mysqladmin --no-defaults -u root -S $mysql_unix_port -s shutdown") || info("There was no mysqld running\n"); + log_system("./bin/mysqladmin $mysqladmin_args -S $mysql_unix_port -s shutdown") || info("There was no mysqld running\n"); sleep(2); log_system("rm -f ./data/mysql/*"); check_system("scripts/mysql_install_db --no-defaults --skip-locking","https://order"); @@ -339,8 +355,10 @@ if (!$opt_no_test) # # Compile and install the required Perl modules # -if ($opt_stage <= 7 && $opt_perl_files && !$opt_no_perl && !$opt_no_test) +if ($opt_stage <= 7 && $opt_perl_files && !$opt_no_perl && !$opt_no_test && + !$opt_no_benchmark) { + log_timestamp(); safe_cd($test_dir); rm_all("perl"); safe_system("mkdir perl"); @@ -376,6 +394,7 @@ if ($opt_stage <= 7 && $opt_perl_files && !$opt_no_perl && !$opt_no_test) # if ($opt_stage <= 8 && !$opt_no_test && !$opt_no_crash_me) { + log_timestamp(); safe_cd("$test_dir/sql-bench"); log_system("rm -f limits/mysql.cfg"); safe_system("perl ./crash-me --force --batch-mode $connect_option"); @@ -384,8 +403,9 @@ if ($opt_stage <= 8 && !$opt_no_test && !$opt_no_crash_me) # # Run sql-bench Benchmarks # -if ($opt_stage <= 9 && !$opt_no_test) +if ($opt_stage <= 9 && !$opt_no_test && !$opt_no_benchmark) { + log_timestamp(); safe_cd("$test_dir/sql-bench"); log_system("rm -f output/*"); $tmp= $opt_fast_benchmark ? "--fast --user root --small-test" : ""; @@ -405,7 +425,7 @@ if ($opt_stage <= 9 && !$opt_no_test) rm_all($bench_tmpdir); rm_all("$opt_tmp") if ($new_opt_tmp); -log_system("$pwd/$host/bin/mysqladmin --no-defaults -S $mysql_unix_port -u root shutdown"); +log_system("$pwd/$host/bin/mysqladmin $mysqladmin_args -S $mysql_unix_port -u root shutdown"); print LOG "ok\n"; close LOG; print "$host: ok\n"; @@ -416,7 +436,7 @@ exit 0; sub usage { print <<EOF; -$0 version 1.4 +$0 version 1.5 $0 takes the following options: @@ -469,7 +489,13 @@ Do not run the "crash-me" test Do not strip the binaries included in the binary distribution --no-test -Do not run any tests +Do not run any tests. + +--no-benchmark +Do not run the benchmark test (written in perl) + +--no-mysqltest +Do not run the the mysql-test-run test (Same as 'make test') --perl-files=list of files Compile and install the given perl modules. @@ -532,6 +558,7 @@ sub abort my($mail_header_file); print LOG "\n$message\n"; print "$host: $message\n" if ($opt_debug); + print LOG "Aborting\n"; close LOG; if ($opt_user) @@ -547,7 +574,6 @@ sub abort unlink($mail_header_file); unlink("$log.mail"); } - print LOG "Aborting\n"; exit 1; } @@ -689,9 +715,10 @@ sub rm_all sub kill_all { my ($pattern) = @_; - my ($USER,$BSD,$LINUX, $pscmd, $user, $pid); + my ($USER,$BSD,$LINUX, $pscmd, $user, $os, $pid); $user=$ENV{'USER'}; - $BSD = -f '/vmunix' || $ENV{"OS"} eq "SunOS4" || $^O eq 'darwin'; + $os=defined($ENV{'OS'}) ? $ENV{'OS'} : "unknown"; + $BSD = -f '/vmunix' || $os eq "SunOS4" || $^O eq 'darwin'; $LINUX = $^O eq 'linux'; $pscmd = $BSD ? "/bin/ps -auxww" : $LINUX ? "/bin/ps axuw" : "/bin/ps -ef"; @@ -707,7 +734,7 @@ sub kill_all { chop($cand); ($pid_user, $pid) = split(' ', $cand); - next if $pid == $$; + next if $pid eq $$; next process if (! ($cand =~ $pattern) || $pid_user ne $user); print LOG "Killing $_\n"; &killpid($pid); @@ -730,3 +757,14 @@ sub killpid } print LOG "$pid will not die!\n"; } + +# +# return the current date as a string (YYYY-MM-DD HH:MM:SS) +# +sub log_timestamp +{ + my @ta=localtime(time()); + print LOG sprintf("%4d-%02d-%02d %02d:%02d:%02d\n", + $ta[5]+1900, $ta[4]+1, $ta[3], $ta[2], $ta[1], $ta[0]); + +} diff --git a/Docs/gis.txt b/Docs/gis.txt new file mode 100644 index 00000000000..d80a200d5a6 --- /dev/null +++ b/Docs/gis.txt @@ -0,0 +1,861 @@ + + OpenGIS <http://www.opengis.org> support in MySQL + +------------------------------------------------------------------------ +Note: Blue colored lines among the text is features not implemented yet. +They are: + + * Spatial Reference Systems and their IDs (SRIDs) related things: + o Functions like Length() and Area() assume planar coordinate + system. + o All objects are currently considered to be in the same + planar coordinate system. + * Function Length() on LineString and MultiLineString currently + should be called as GLength(). +* No binary constructors like GeomFromWKB(). + +We also have to add "PostGIS compatibility" sections. + + + 1 Introduction + +MySQL implements a subset of *SQL2 with Geometry Types* environment +proposed by OpenGIS consortium's *Simple Features Specification For +SQL*. In this environment a geometry-valued column is implemented as a +column whose SQL type is drawn from the set of Geometry Types. SQL +server supports both textual and binary access to geometry. + + + 2 OpenGIS Geometry Model in MySQL + +MySQL supports the Open GIS Geometry Model based hierarcy of spatial +objects classes, which consists of: + + * Geometry + o *Point* + o Curve + + *LineString* + o Surface + + *Polygon* + o *GeometryCollection* + + *MultiPoint* + + MultiCurve + # *MultiLineString* + + MultiSurface + # *MultiPolygon* + +The base *Geometry* class has subclasses for Point, Curve, Surface and +GeometryCollection. + +Geometry, Curve, Surface, MultiCurve and MultiSurface are defined to be +non-instantiable classes, it is not possible to create an object of +these classes. + +Point, LineString, Polygon, GeometryCollection, MultiPoint, +MultiLineString, MultiPolygon are instantiable classes (bolded on the +hierarcy tree). MySQL provides a number of functions to construct +instances of these classes. + +TODO: Each spatial object is associated with a Spatial Reference System, +which describes the coordinate space in which the geometric object is +defined. + + + 2.1 Geometry + +Geometry is the root class of the hierarchy. Geometry is an abstract +(non-instantiable) class. The instantiable subclasses of Geometry +defined in this specification are restricted to 0, 1 and two-dimensional +geometric objects that exist in two-dimensional coordinate space. All +instantiable geometry classes are defined so that valid instances of a +geometry class are topologically closed (i.e. all defined geometries +include their boundary). + + + 2.2 Point + +A *Point* is a 0-dimensional geometry and represents a single location +in coordinate space. A Point in the case of 2D has a x-coordinate value +and a y-coordinate value. In the case of more dimensions, a Point has a +coordinate value for each dimension. The boundary of a Point is the +empty set. + + + 2.3 Curve + +A *Curve* is a one-dimensional geometric object usually stored as a +sequence of points, with the subclass of Curve specifying the form of +the interpolation between points. MySQL implementation defines only one +subclass of Curve, LineString, which uses linear interpolation between +points. + +A Curve is simple if it does not pass through the same point twice. A +Curve is closed if its start point is equal to its end point. The +boundary of a closed Curve is empty. A Curve that is simple and closed +is a Ring. The boundary of a non-closed Curve consists of its two end +points. A Curve is defined as topologically closed. + + + 2.4 LineString, Line, LinearRing + +A LineString is a Curve with linear interpolation between points. Each +consecutive pair of points defines a line segment. A Line is a +LineString with exactly 2 points. A LinearRing is a LineString that is +both closed and simple. + + + 2.5 Surface + +A *Surface* is a two-dimensional geometric object. The OpenGIS Abstract +Specification defines a simple Surface as consisting of a single 'patch' +that is associated with one 'exterior boundary' and 0 or more 'interior' +boundaries. Simple surfaces in three-dimensional space are isomorphic to +planar surfaces. Polyhedral surfaces are formed by 'stitching' together +simple surfaces along their boundaries, polyhedral surfaces in +three-dimensional space may not be planar as a whole. + +The boundary of a simple Surface is the set of closed curves +corresponding to its exterior and interior boundaries. + +The only instantiable subclass of Surface defined in this specification, +Polygon, is a simple Surface that is planar. + + + 2.6 Polygon + +A Polygon is a planar Surface, defined by 1 exterior boundary and 0 or +more interior boundaries. Each interior boundary defines a hole in the +Polygon. The assertions for polygons (the rules that define valid +polygons) are: + + * Polygons are topologically closed. + * The boundary of a Polygon consists of a set of LinearRings (i.e. + LineStrings which are both simple and closed) that make up its + exterior and interior boundaries. + * No two rings in the boundary cross, the rings in the boundary of a + Polygon may intersect at a Point but only as a tangent. + * A Polygon may not have cut lines, spikes or punctures. + * The Interior of every Polygon is a connected point set. + * The Exterior of a Polygon with 1 or more holes is not connected. +Each hole defines a connected component of the Exterior. + +In the above assertions, Interior, Closure and Exterior have the +standard topological definitions. The combination of 1 and 3 make a +Polygon a Regular Closed point set. Polygons are simple geometries. + + + 2.6 GeometryCollection + +A *GeometryCollection* is a geometry that is a collection of 1 or more +geometries of any class. All the elements in a GeometryCollection must +be in the same Spatial Reference (i.e. in the same coordinate system). +GeometryCollection places no other constraints on its elements. However +subclasses of GeometryCollection described below may restrict membership +based on dimension and may also place other constraints on the degree of +spatial overlap between elements. + + + 2.7 MultiPoint + +A *MultiPoint* is a 0 dimensional geometric collection. The elements of +a MultiPoint are restricted to Points. The points are not connected or +ordered. A MultiPoint is simple if no two Points in the MultiPoint are +equal (have identical coordinate values). The boundary of a MultiPoint +is the empty set. + + + 2.8 MultiCurve + +A MultiCurve is a one-dimensional geometry collection whose elements are +Curves. MultiCurve is a non-instantiable class, it defines a set of +methods for its subclasses and is included for reasons of extensibility. + +A MultiCurve is simple if and only if all of its elements are simple, +the only intersections between any two elements occur at points that are +on the boundaries of both elements. + +The boundary of a MultiCurve is obtained by applying the "mod 2 union +rule": A point is in the boundary of a MultiCurve if it is in the +boundaries of an odd number of elements of the MultiCurve. + +A MultiCurve is closed if all of its elements are closed. The boundary +of a closed MultiCurve is always empty. A MultiCurve is defined as +topologically closed. + + + 2.9 MultiLineString + +A *MultiLineString* is a MultiCurve whose elements are LineStrings. + + + 2.10 MultiSurface + +A MultiSurface is a two-dimensional geometric collection whose elements +are surfaces. The interiors of any two surfaces in a MultiSurface may +not intersect. The boundaries of any two elements in a MultiSurface may +intersect at most at a finite number of points. + +MultiSurface is a non-instantiable class in this specification, it +defines a set of methods for its subclasses and is included for reasons +of extensibility. The instantiable subclass of MultiSurface is +MultiPolygon, corresponding to a collection of Polygons. + + + 2.11 MultiPolygon + +A MultiPolygon is a MultiSurface whose elements are Polygons. + +The assertions for MultiPolygons are : + + * The interiors of 2 Polygons that are elements of a MultiPolygon + may not intersect. + * The Boundaries of any 2 Polygons that are elements of a + MultiPolygon may not cross and may touch at only a finite number + of points. (Note that crossing is prevented by assertion 1 above). + * A MultiPolygon is defined as topologically closed. + * A MultiPolygon may not have cut lines, spikes or punctures, a + MultiPolygon is a Regular, Closed point set. + * The interior of a MultiPolygon with more than 1 Polygon is not + connected, the number of connected components of the interior of a +MultiPolygon is equal to the number of Polygons in the MultiPolygon. + +The boundary of a MultiPolygon is a set of closed curves (LineStrings) +corresponding to the boundaries of its element Polygons. Each Curve in +the boundary of the MultiPolygon is in the boundary of exactly 1 element +Polygon, and every Curve in the boundary of an element Polygon is in the +boundary of the MultiPolygon. + + + 3 Exchange of spatial data + +MySQL provides binary and textual mechanismes to exchange spatial data. +Exchange is provided via so called Well Known Binary (WKB) and Well +Known Textual (WKT) representations of spatial data proposed by OpenGIS +specifications. + + + 3.1 Well-known Text representation (WKT) + +The Well-known Text (WKT) representation of Geometry is designed to +exchange geometry data in textual format. + +WKT is defined below in Bechus-Naur forms: + + * the notation {}* denotes 0 or more repetitions of the tokens + within the braces; +* the braces do not appear in the output token list. + +The text representation of the implemented instantiable geometric types +conforms to this grammar: + +<Geometry Tagged Text> := + <Point Tagged Text> + | <LineString Tagged Text> + | <Polygon Tagged Text> + | <MultiPoint Tagged Text> + | <MultiLineString Tagged Text> + | <MultiPolygon Tagged Text> + | <GeometryCollection Tagged Text> + +<Point Tagged Text> := + + POINT <Point Text> + +<LineString Tagged Text> := + + LINESTRING <LineString Text> + +<Polygon Tagged Text> := + + POLYGON <Polygon Text> + +<MultiPoint Tagged Text> := + + MULTIPOINT <Multipoint Text> + +<MultiLineString Tagged Text> := + + MULTILINESTRING <MultiLineString Text> + +<MultiPolygon Tagged Text> := + + MULTIPOLYGON <MultiPolygon Text> + +<GeometryCollection Tagged Text> := + + GEOMETRYCOLLECTION <GeometryCollection Text> + +<Point Text> := EMPTY | ( <Point> ) + +<Point> := <x> <y> + +<x> := double precision literal + +<y> := double precision literal + +<LineString Text> := EMPTY + + | ( <Point > {, <Point > }* ) + +<Polygon Text> := EMPTY + + | ( <LineString Text > {, < LineString Text > }*) + +<Multipoint Text> := EMPTY + + | ( <Point Text > {, <Point Text > }* ) + +<MultiLineString Text> := EMPTY + + | ( <LineString Text > {, < LineString Text > }* ) + +<MultiPolygon Text> := EMPTY + + | ( < Polygon Text > {, < Polygon Text > }* ) + +<GeometryCollection Text> := EMPTY + + | ( <Geometry Tagged Text> {, <Geometry Tagged Text> }* ) + + + WKT examples + +Examples of textual representations of Geometry objects are shown below: + + * |POINT(10 10)| - a Point + * |LINESTRING( 10 10, 20 20, 30 40)| - a LineString with three points + * |POLYGON((10 10, 10 20, 20 20,20 15, 10 10))| - a Polygon with one + exterior ring and 0 interior rings + * |MULTIPOINT(10 10, 20 20)| - a MultiPoint with two Points + * |MULTILINESTRING((10 10, 20 20), (15 15, 30 15))| - a + MultiLineString with two LineStrings + * |MULTIPOLYGON(((10 10, 10 20, 20 20, 20 15, 10 10)), ((60 60, 70 + 70, 80 60, 60 60 ) ))| - a MultiPolygon with two Polygons + * |GEOMETRYCOLLECTION( POINT (10 10),POINT (30 30), LINESTRING (15 + 15, 20 20))| - a GeometryCollection consisting of two Points and +one LineString + + + 3.2 Well-known Binary representation (WKB) + +Well Known Binary Representations is proposed by OpenGIS specifications +to exchange geometry data in binary format. This is WKB description: + +// Basic Type definitions +// byte : 1 byte +// uint32 : 32 bit unsigned integer (4 bytes) +// double : double precision number (8 bytes) +// Building Blocks : Point, LinearRing + +Point { + double [numDimentions]; +}; + +LinearRing { + uint32 numPoints; + Point points[numPoints]; +} + +enum wkbGeometryType { + wkbPoint = 1, + wkbLineString = 2, + wkbPolygon = 3, + wkbMultiPoint = 4, + wkbMultiLineString = 5, + wkbMultiPolygon = 6, + wkbGeometryCollection = 7 +}; + +enum wkbByteOrder { + wkbXDR = 0, // Big Endian + wkbNDR = 1 // Little Endian +}; + +WKBPoint { + byte byteOrder; + uint32 wkbType; // 1 + Point point; +} + +WKBLineString { + byte byteOrder; + uint32 wkbType; // 2 + uint32 numPoints; + Point points[numPoints]; +} + +WKBPolygon { + byte byteOrder; + uint32 wkbType; // 3 + uint32 numRings; + LinearRing rings[numRings]; +} + +WKBMultiPoint { + byte byteOrder; + uint32 wkbType; // 4 + uint32 num_wkbPoints; + WKBPoint WKBPoints[num_wkbPoints]; +} + +WKBMultiLineString { + byte byteOrder; + uint32 wkbType; // 5 + uint32 num_wkbLineStrings; + WKBLineString WKBLineStrings[num_wkbLineStrings]; +} + +wkbMultiPolygon { + byte byteOrder; + uint32 wkbType; // 6 + uint32 num_wkbPolygons; + WKBPolygon wkbPolygons[num_wkbPolygons]; +} + +WKBGeometry { + union { + WKBPoint point; + WKBLineString linestring; + WKBPolygon polygon; + WKBGeometryCollection collection; + WKBMultiPoint mpoint; + WKBMultiLineString mlinestring; + WKBMultiPolygon mpolygon; + } + +}; + +WKBGeometryCollection { + byte byte_order; + uint32 wkbType; // 7 + uint32 num_wkbGeometries; + WKBGeometry wkbGeometries[num_wkbGeometries]; +} + + + 3.3 MySQL data types for spatial objects + +MySQL implementation of OpenGIS provides the *GEOMETRY* data type to be +used in CREATE TABLE statements. For example, this statement creates a +table *geom* with spatial field *g*: + +CREATE TABLE geom ( + g Geometry; +); + +A field of *GEOMETRY* type can store a spatial objects of any OpenGIS +geometry class described above. + + + 3.4 Internal spatial data representation + +Internally (in *.MYD* files) spatial objects are stored in *WKB*, +combined with object's *SRID* (a numeric ID of Spatial Reference System +object associated with). During spatial analysis, for example, +calculating the fact that one object crosses another one, only those +with the same *SRID* are accepted. + +*SRID* may affect a way in which various spatial characteristics are +calculated. For example, in different coordinate systems distance +between two objects may differ even objects have the same coordinates, +like distance on plane coordinate system and distance on geocentric +(coordinates on Earth surface) systems are different things. + +There is a plan to provide a number of commonly used coordinate systems +in MySQL OpenGIS implementation. + + + 3.5 INSERTing spatial objects + +Spatial data can be INSERTed using a spatial constructor. The term +*spatial constructor* is used in this manual to refer to any function +which can construct a value of GEOMETRY type, i.e. an internal MySQL +representation of spatial data. + + + 3.5.1 Textual spatial constructors + +Textual spatial constructors take a gemometry description in WKT and +built GEOMETRY value. + + * |*GeomFromText(geometryTaggedText String [, SRID + Integer]):Geometry *| - constructs a Geometry value from its + well-known textual representation. + + |*GeomFromText()*| function accepts a WKT of any Geometry class as + it's first argument. + + For construction of Geometry values restricted to a particular + subclass, an implementation also provides a class-specific + construction function for each instantiable subtype as described + in the list below: + + * |*PointFromText(pointTaggedText String [,SRID Integer]):Point *| - + constructs a Point + + * |*LineFromText(lineStringTaggedText String [,SRID + Integer]):LineString *| - constructs a LineString + + * |*PolyFromText(polygonTaggedText String [,SRID Integer]):Polygon + *|- constructs a Polygon + + * |*MPointFromText(multiPointTaggedText String [,SRID + Integer]):MultiPoint *| - constructs a MultiPoint + + * |*MLineFromText(multiLineStringTaggedText String [,SRID + Integer]):MultiLineString *| - constructs a MultiLineString + + * |*MPolyFromText(multiPolygonTaggedText String [,SRID + Integer]):MultiPolygon *| - constructs a MultiPolygon + + * |*GeomCollFromText(geometryCollectionTaggedText String [,SRID + Integer]):GeomCollection *| - constructs a GeometryCollection + +Usage examples: + +INSERT INTO geom VALUES (GeomFromText('POINT(1 1)')) +INSERT INTO geom VALUES (GeomFromText('LINESTRING(0 0,1 1,2 2)')) +INSERT INTO geom VALUES (GeomFromText('POLYGON((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5))')) +INSERT INTO geom VALUES (GeomFromText('GEOMETRYCOLLECTION(POINT(1 1),LINESTRING(0 0,1 1,2 2,3 3,4 4))')) + +The second argument of spatial constructirs, described above, is +currently ignored, It will be used to specify SRID in the future. +Nowdays, it is added for reasons of compatibility with OpenGIS +specifications and PostGIS implementation. + +As an optional feature, an implementation may also support building of +Polygon or MultiPolygon values given an arbitrary collection of possibly +intersecting rings or closed LineString values. Implementations that +support this feature should include the following functions: + + * |*BdPolyFromText(multiLineStringTaggedText String, SRID + Integer):Polygon *| - constructs a Polygon given an arbitrary + collection of closed linestrings as a MultiLineString text + representation. + * |*BdMPolyFromText(multiLineStringTaggedText String, SRID + Integer):MultiPolygon *| - constructs a MultiPolygon given an + arbitrary collection of closed linestrings as a MultiLineString +text representation. + + + 3.5.2 Binary spatial constructors + + * |*GeomFromWKB(WKBGeometry Binary, SRID Integer):Geometry *| - + constructs a Geometry value given its well-known binary + representation. + + |*GeomFromWKB()*| function can accept in it's first argument a WKB + of Geometry of any class. For construction of Geometry values + restricted to a particular subclass, an implementation also + provides a class-specific construction function for each + instantiable subclass as described in the list below: + + * |*PointFromWKB(WKBPoint Binary, SRID Integer):Point - *|constructs + a Point + * |* LineFromWKB(WKBLineString Binary, SRID Integer):LineString *| - + constructs a LineString + * |* PolyFromWKB(WKBPolygon Binary, SRID Integer):Polygon *| - + constructs a Polygon + * |* MPointFromWKB(WKBMultiPoint Binary, SRID Integer):MultiPoint *| + - constructs a MultiPoint + * |* MLineFromWKB(WKBMultiLineString Binary, SRID + Integer):MultiLineString *| - constructs a MultiLineString + * |* MPolyFromWKB(WKBMultiPolygon Binary, SRID Integer): + MultiPolygon *| - constructs a MultiPolygon + * |* GeomCollFromWKB(WKBGeometryCollection Binary, SRID Integer): +GeomCollection *| - constructs a GeometryCollection + +As an optional feature, an implementation may also support the uilding' +of Polygon or MultiPolygon values given an arbitrary collection of +possibly intersecting rings or closed LineString values. Implementations +that support this feature should include the following functions: + + * |* BdPolyFromWKB (WKBMultiLineString Binary,SRID Integer): Polygon + *| - constructs a Polygon given an arbitrary collection of closed + linestrings as a MultiLineString binary representation. + * |*BdMPolyFromWKB(WKBMultiLineString Binary, SRID + Integer):MultiPolygon *| - constructs a MultiPolygon given an + arbitrary collection of closed linestrings as a MultiLineString +binary representation. + +Inserting in *WKB* assumes that |GeomFromWKB()| function argument +contains a buffer with a correctly formed spatial object in WKB. In ODBC +applications it can be done using binding of argument. One also can +insert object in *WKB* using |mysql_escape_string()| in |libmysqlclient| +applications. + +For example: + +INSERT INTO geom VALUES (GeomFromWKB(buf,SRID)); + +where |buf| is a binary buffer with a spatial object in *WKB* +representation. + + + 3.5 SELECTing spatial objects + +Spatial objects are selected either in *WKT* or *WKB* representation by +use of AsText() and AsBinary() functions correspondently. + + +mysql> select AsText(g) as g from geom; ++-------------------------+ +| g | ++-------------------------+ +| POINT(1 1) | +| LINESTRING(0 0,1 1,2 2) | ++-------------------------+ +2 rows in set (0.00 sec) + +mysql> + +The query: + +SELECT AsBinary(g) FROM geom + +returns a BLOB which contains *WKB* representation of object. + + + 4 Functions for spatial analysis + + + 4.1 Basic functions on Geometry + + * |*AsText(g:Geometry):String*| - Exports this Geometry to a + specific well-known text representation of Geometry. + * |*AsBinary(g:Geometry):Binary*| - Exports this Geometry to a + specific well-known binary representation of Geometry. + * |*GeometryType(g:Geometry):String*| - Returns the name of the + instantiable subtype of Geometry of which this Geometry instance + is a member. The name of the instantiable subtype of Geometry is + returned as a string. + * |*Dimension(g:Geometry):Integer*| - The inherent dimension of this + Geometry object, which must be less than or equal to the + coordinate dimension. This specification is restricted to + geometries in two-dimensional coordinate space. + * |*IsEmpty(g:Geometry):Integer*| - Returns 1 (TRUE) if this + Geometry is the empty geometry . If true, then this Geometry + represents the empty point set, , for the coordinate space. + * |*IsSimple(g:Geometry):Integer *| - Returns 1 (TRUE) if this + Geometry has no anomalous geometric points, such as self + intersection or self tangency. The description of each + instantiable geometric class includes the specific conditions that + cause an instance of that class to be classified as not simple. + * |*SRID(g:Geometry):Integer*| - Returns the Spatial Reference + System ID for this Geometry. + * |*Distance(g1:Geometry,g2:Geometry):Double*| - the shortest +distance between any two points in the two geometries. + + + 4.2 Functions for specific geometry type + + + GeometryCollection functions + + * *NumGeometries(g:GeometryCollection ):Integer * -Returns the + number of geometries in this GeometryCollection. + * *GeometryN(g:GeometryCollection,N:integer):Geometry * -Returns the +Nth geometry in this GeometryCollection. + + + Point functions + + * *X(p:Point):Double* -The x-coordinate value for this Point. +* *Y(p:Point):Double* -The y-coordinate value for this Point. + + + LineString functions + + * *StartPoint(l:LineString):Point* The start point of this LineString. + * *EndPoint(l:LineString):Point* The end point of this LineString. + * *PointN(l:LineString,N:Integer):Point* Returns the specified point + N in this Linestring. + * *Length(l:LineString):Double* The length of this LineString in its + associated spatial reference. + * *IsRing(l:LineString):Integer* Returns 1 (TRUE) if this LineString + is closed (StartPoint ( ) = EndPoint ( )) and this LineString is + simple (does not pass through the same point more than once). + * *IsClosed(l:LineString):Integer* Returns 1 (TRUE) if this + LineString is closed (StartPoint ( ) = EndPoint ( )). + * *NumPoints(l:LineString):Integer* The number of points in this +LineString. + + + MultiLineString functions + + * *Length(m:MultiLineString):Double* The Length of this + MultiLineString which is equal to the sum of the lengths of the + elements. + * *IsClosed(m:MultiLineString):Integer* Returns 1 (TRUE) if this + MultiLineString is closed (StartPoint() = EndPoint() for each +LineString in this MultiLineString) + + + Polygon functions + + * *Area(p:Polygon):Double* The area of this Polygon, as measured in + the spatial reference system of this Polygon. + * *Centroid(p:Polygon):Point* The mathematical centroid for this + Polygon as a Point. The result is not guaranteed to be on this + Polygon. + * *PointOnSurface(p:Polygon):Point* A point guaranteed to be on this + Polygon. + * *NumInteriorRing(p:Polygon):Integer* Returns the number of + interior rings in this Polygon. + * *ExteriorRing(p:Polygon):LineString* Returns the exterior ring of + this Polygon as a LineString. + * *InteriorRingN(p:Polygon,N:Integer):LineString* Returns the Nth +interior ring for this Polygon as a LineString. + + + MultiPolygon functions + + * *Area(m:MultuSurface):Double* The area of this MultiPolygon, as + measured in the spatial reference system of this MultiPolygon. + * *Centroid(m:MultyPolygon):Point* The mathematical centroid for + this MultiPolygon as a Point. The result is not guaranteed to be + on this MultiPolygon. + * *PointOnSurface(m:MultuPolygon):Point* A Point guaranteed to be on +this MultiPolygon. + +Notes: /functions for specific geometry type retrun NULL if passed +object type is incorrect. For example Area() returns NULL if object type +is neither Polygon nor MultiPolygon/ + + + 4.3 Spatial operations (compound spatial constructors) + + * |*Envelope(g:Geometry):Geometry*|The minimum bounding box for this + Geometry, returned as a Geometry. The polygon is defined by the + corner points of the bounding box + |POLYGON((MINX,MINY),(MAXX,MINY),(MAXX,MAXY),(MINX,MAXY),(MINX,MINY))|. + + * |*Boundary(g:Geometry):Geometry*| - returns the closure of the + combinatorial boundary of this Geometry. + * |*Intersection(g1,g2:Geometry):Geometry*| - a geometry that + represents the point set intersection of g1 with g2. + * |*Union(g1,g2:Geometry):Geometry*| - a geometry that represents + the point set union of g1 with g2. + * |*Difference(g1,g2:Geometry):Geometry*| - a geometry that + represents the point set difference of g1 with g2. + * |*SymDifference(g1,g2:Geometry):Geometry*| - a geometry that + represents the point set symmetric difference of g1 with g2. + * |*Buffer(g:Geometry,distance:Double):Geometry*| - a geometry that + represents all points whose distance from g is less than or equal + to distance. + * |*ConvexHull(g:Geometry):Geometry*| - a geometry that represents +the convex hull of g. + + + 4.4 Functions for testing Spatial Relations between geometric objects + + * |*Equals(g1,g2)*| - Returns 1 if g1 is spatially equal to g2. + * |*Disjoint(g1,g2)*| - Returns 1 if g1 is spatially disjoint from g2. + * |*Intersects(g1,g2)*| - Returns 1 if g1 spatially intersects g2. + * |*Touches(g1,g2)*| - Returns 1 if g1 spatially touches g2. + * |*Crosses(g1,g2)*| - Returns 1 if g1 spatially crosses g2. + * |*Within(g1,g2)*| - Returns 1 if g1 is spatially within g2. + * |*Contains(g1,g2)*| - Returns 1 if g1 spatially contains g2. +* |*Overlaps(g1,g2)*| - Returns 1 if g1 spatially overlaps g2. + + + 5 Optimizing spatial analysis + + + 5.1 MBR + +MBR is a minimal bounding rectangle (box) for spatial object. It can be +represented as a set of min and max values of each dimension. + +For example: + +(Xmin,Xmax,Ymin,Ymax) + + + 5.2 Using SPATIAL indexes + +To optimize spatial object relationships analysis it is possible to +create a spatial index on geometry field using R-tree algorythm. R-tree +based spatial indexes store MBRs of spatial objects as a key values. + +CREATE SPATIAL INDEX gind ON geom (g); + +Or together with table definition: + +CREATE TABLE geom ( + g GEOMETRY, + SPATIAL INDEX(g) +); + +Optimizer attaches R-tree based SPATIAL index when a query with spatial +objects relationship functions is executed in WHERE clause. + +For example: + +SELECT geom.name FROM geom + WHERE Within(geom.g,GeomFromText('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))',SRID)); + + + 8 OpenGIS extensions implemented in MySQL + +MySQL provides it's own constructors to build geometry objects: + + * |*Point(double,double,SRID)*| - constructs a geometry of Point + class using it's coordinates and SRID. + * |*MultiPoint(Point,Point,...,Point)*| - constructs a MultiPoint + using Points. When any argument is not a geometry of Point class + the return value is NULL. + * |*LineString(Point,Point,...,Point)*| - constructs a LineString + from a number of Points. When any argument is not a geometry of + Point class the return value is NULL. When the number of Points is + less than two the return value is NULL. + * |*MultiLineString(LineString,LineString,...,LineString)*| - + constructs a MultiLineString using using LineStrings. When any + argument is not a geometry of LineStringClass return value is NULL. + * |*Polygon(LineString,LineString,...,LineString)*| - constructs a + Polygon from a number of LineStrings. When any argument is not a + LinearRing (i.e. not closed and simple geometry of class + LineString) the return value is NULL. + * |*MultiPolygon(Polygon,Polygon,...,Polygon)*| - constructs a + MultiPolygon from a set of Polygons. When any argument is not a + Polygon, the rerurn value is NULL. + * |*GeometryCollection(Geometry,Geometry,..,Geometry)*| - constucts + a GeometryCollection. When any argument is not a valid geometry +object of any instantiable class, the return value is NULL. + +The above functions (except Point()) return NULL if arguments are not in +the same spatial reference system (i.e. have different SRIDs). + + + Examples: + +INSERT INTO geom SELECT Point(x,y,SRID) FROM coords; +SELECT AsText(g) FROM geom WHERE + Contains(Polygon(LineString(Point(0,0),Point(0,1),Point(1,1),Point(1,0),Point(0,0)),SRID),geom.g); + + + 9 Things that differ in MySQL implemention and OpenGIS specifications + + + 9.1 Single GEOMETRY type + +Besides a GEOMETRY type, OpenGIS consortium specifications suggest the +implementation of several spatial field types correspondent to every +instansiable object subclass. For example a *Point* type is proposed to +restrict data stored in a field of this type to only Point OpenGIS +subclass. MySQL provides an implementation of single GEOMETRY type which +doesn't restrict objects to certain OpenGIS subclass. + + + 9.2 No additional Metadata Views + +OpenGIS specifications propose several additional metadata views. For +example, a system view named GEOMETRY_COLUMNS contains a description of +geometry columns, one row for each geometry column in the database. + + + 9.3 No functions to add/drop spatial columns + +OpenGIS assumes that columns can be added/dropped using +AddGeometryColumn() and DropGeometryColumn() functions correspondently. +In MySQL implementation one should use ALTER TABLE instead. diff --git a/Docs/internals.texi b/Docs/internals.texi index 7e364774e39..a94158f84f8 100644 --- a/Docs/internals.texi +++ b/Docs/internals.texi @@ -96,13 +96,84 @@ cached for each user/database combination. Many use of @code{GROUP BY} or @code{DISTINCT} caches all found rows in a @code{HEAP} table. (This is a very quick in-memory table with hash index.) -@item Join Row Cache +@item Join buffer Cache For every full join in a @code{SELECT} statement (a full join here means there were no keys that one could use to find the next table in a list), the found rows are cached in a join cache. One @code{SELECT} query can use many join caches in the worst case. @end table +@node join_buffer_size, flush tables, caching, Top +@subchapter How MySQL uses the join_buffer cache + +Basic information about @code{join_buffer_size}: + +@itemize @bullet +@item +It's only used in the case when join type is of type @code{ALL} or +@code{index}; In other words: no possible keys can be used. +@item +A join buffer is never allocated for the first not-const table, +even it it would be of type @code{ALL}/@code{index}. +@item +The buffer is allocated when we need to do a each full join between two +tables and freed after the query is done. +@item +Accepted row combinations of tables before the @code{ALL}/@code{index} +able is stored in the cache and is used to compare against each read +row in the @code{ALL} table. +@item +We only store the used fields in the join_buffer cache, not the +whole rows. +@end itemize + +Assume you have the following join: + +@example +Table name Type +t1 range +t2 ref +t3 @code{ALL} +@end example + +The join is then done as follows: + +@example +- While rows in t1 matching range + - Read through all rows in t2 according to reference key + - Store used fields form t1,t2 in cache + - If cache is full + - Read through all rows in t3 + - Compare t3 row against all t1,t2 combination in cache + - If rows satisfying join condition, send it to client + - Empty cache + +- Read through all rows in t3 + - Compare t3 row against all stored t1,t2 combinations in cache + - If rows satisfying join condition, send it to client +@end example + +The above means that table t3 is scanned + +@example +(size-of-stored-row(t1,t2) * accepted-row-cominations(t1,t2))/ +join_buffer_size+1 +@end example +times. + +Some conclusions: + +@itemize @bullet +@item +The larger the join_buff_size, the fewer scans of t3. +If @code{join_buff_size} is already large enough to hold all previous row +combinations then there is no speed to gain by making it bigger. +@item +If there is several tables of @code{ALL}/@code{index} then the we +allocate one @code{join_buffer_size buffer} for each of them and use the +same algorithm described above to handle it. (In other words, we store +the same row combination several times into different buffers) +@end itemize @node flush tables, filesort, caching, Top @chapter How MySQL Handles @code{FLUSH TABLES} @@ -1585,7 +1656,7 @@ fe 00 . . @node 4.1 protocol changes,,, @section Changes to 4.0 protocol in 4.1 -All basic package handling is identical to 4.0. When communication +All basic packet handling is identical to 4.0. When communication with an old 4.0 or 3.x client we will use the old protocol. The new things that we support with 4.1 are: @@ -1596,7 +1667,7 @@ Warnings @item Prepared statements @item -Binary protocol (will be much faster than the current protocol that +Binary protocol (will be faster than the current protocol that converts everything to strings) @end itemize @@ -1617,15 +1688,15 @@ results will sent as binary (low-byte-first). @end itemize -@node 4.1 field package,,, -@section 4.1 field description package +@node 4.1 field packet,,, +@section 4.1 field description packet -The field description package is sent as a response to a query that -contains a result set. It can be distinguished from a ok package by -the fact that the first byte can't be 0 for a field package. -@xref {4.1 ok package}. +The field description packet is sent as a response to a query that +contains a result set. It can be distinguished from a ok packet by +the fact that the first byte can't be 0 for a field packet. +@xref {4.1 ok packet}. -The header package has the following structure: +The header packet has the following structure: @multitable @columnfractions .10 .90 @item Size @tab Comment @@ -1634,7 +1705,7 @@ The header package has the following structure: uses this to send the number of rows in the table) @end multitable -This package is always followed by a field description set. +This packet is always followed by a field description set. @xref{4.1 field desc}. @node 4.1 field desc,,, @@ -1655,17 +1726,17 @@ The field description result set contains the meta info for a result set. @end multitable -@node 4.1 ok package,,, -@section 4.1 ok package +@node 4.1 ok packet,,, +@section 4.1 ok packet -The ok package is the first that is sent as an response for a query +The ok packet is the first that is sent as an response for a query that didn't return a result set. -The ok package has the following structure: +The ok packet has the following structure: @multitable @columnfractions .10 .90 @item Size @tab Comment -@item 1 @tab 0 ; Marker for ok package +@item 1 @tab 0 ; Marker for ok packet @item 1-9 @tab Affected rows @item 1-9 @tab Last insert id (0 if one wasn't used) @item 2 @tab Server status; Can be used by client to check if we are inside an transaction @@ -1681,10 +1752,10 @@ The message is optional. For example for multi line INSERT it contains a string for how many rows was inserted / deleted. -@node 4.1 end package,,, -@section 4.1 end package +@node 4.1 end packet,,, +@section 4.1 end packet -The end package is sent as the last package for +The end packet is sent as the last packet for @itemize @bullet @item @@ -1695,41 +1766,42 @@ End of parameter type information End of result set @end itemize -The end package has the following structure: +The end packet has the following structure: @multitable @columnfractions .10 .90 @item Size @tab Comment -@item 1 @tab 254 ; Marker for EOF package +@item 1 @tab 254 ; Marker for EOF packet @item 2 @tab Warning count @item 2 @tab Status flags (For flags like SERVER_STATUS_MORE_RESULTS) @end multitable -Note that a normal package may start with byte 254, which means +Note that a normal packet may start with byte 254, which means 'length stored in 9 bytes'. One can different between these cases by checking the packet length < 9 bytes (in which case it's and end packet). -@node 4.1 error package -@section 4.1 error package. +@node 4.1 error packet +@section 4.1 error packet. -The error package is sent when something goes wrong. -The error package has the following structure: +The error packet is sent when something goes wrong. +The error packet has the following structure: @multitable @columnfractions .10 .90 @item Size @tab Comment -@item 1 @tab 255 Error package marker +@item 1 @tab 255 Error packet marker +@item 2 @tab Error code @item 1-255 @tab Null terminated error message @end multitable -The client/server protocol is designed in such a way that a package -can only start with 255 if it's an error package. +The client/server protocol is designed in such a way that a packet +can only start with 255 if it's an error packet. @node 4.1 prep init,,, -@section 4.1 prepared statement init package +@section 4.1 prepared statement init packet -This is the return package when one sends a query with the COM_PREPARE +This is the return packet when one sends a query with the COM_PREPARE command. @multitable @columnfractions .10 .90 @@ -1755,8 +1827,8 @@ Note that the above is not yet in 4.1 but will be added this month. As MySQL can have a parameter 'anywhere' it will in many cases not be able to provide the optimal information for all parameters. -If number of columns, in the header package, is not 0 then the -prepared statement will contain a result set. In this case the package +If number of columns, in the header packet, is not 0 then the +prepared statement will contain a result set. In this case the packet is followed by a field description result set. @xref{4.1 field descr}. @@ -1768,22 +1840,22 @@ value. One can call mysql_send_long_data() multiple times for the same parameter; The server will concatenate the results to a one big string. -The server will not require an end package for the string. +The server will not require an end packet for the string. mysql_send_long_data() is responsible updating a flag that all data has been sent. (Ie; That the last call to mysql_send_long_data() has the 'last_data' flag set). -This package is sent from client -> server: +This packet is sent from client -> server: @multitable @columnfractions .10 .90 @item Size @tab Comment @item 4 @tab Statement handler @item 2 @tab Parameter number @item 2 @tab Type of parameter (not used at this point) -@item # @tab data (Rest of package) +@item # @tab data (Rest of packet) @end itemize -The server will NOT send an @code{ok} or @code{error} package in +The server will NOT send an @code{ok} or @code{error} packet in responce for this. If there is any errors (like to big string), one will get the error when calling execute. @@ -1791,13 +1863,13 @@ will get the error when calling execute. @section 4.1 execute On execute we send all parameters to the server in a COM_EXECUTE -package. +packet. -The package contains the following information: +The packet contains the following information: @multitable @columnfractions .30 .70 @item Size @tab Comment -@item (param_count+7)/8 @tab Null bit map +@item (param_count+9)/8 @tab Null bit map (2 bits reserved for protocol) @item 1 @tab new_parameter_bound flag. Is set to 1 for first execute or if one has rebound the parameters. @item 2*param_count @tab Type of parameters (only given if new_parameter_bound flag is 1) @@ -1813,7 +1885,7 @@ The parameters are stored the following ways: @multitable @columnfractions .20 .10 .70 @item Type @tab Size @tab Comment -@item tynyint @tab 1 @tab One byte integer +@item tinyint @tab 1 @tab One byte integer @item short @tab 2 @tab @item int @tab 4 @tab @item longlong @tab 8 @tab @@ -1822,7 +1894,7 @@ The parameters are stored the following ways: @item string @tab 1-9 + # @tab Packed string length + string @end multitable -The result for this will be either an ok package or a binary result +The result for this will be either an ok packet or a binary result set. @node 4.1 binary result,,, @@ -1836,11 +1908,11 @@ For each result row: @item null bit map with first two bits set to 01 (bit 0,1 value 1) @item -parameter data, repeated for each not null parameter. +parameter data, repeated for each not null result column. @end itemize The idea with the reserving two bits in the null map is that we can -use standard error (first byte 255) and ok packages (first byte 0) +use standard error (first byte 255) and ok packets (first byte 0) to end a result sets. Except that the null-bit-map is shifted two steps, the server is @@ -1849,6 +1921,18 @@ bound parameters to the client. The server is always sending the data as type given for 'column type' for respective column. It's up to the client to convert the parameter to the requested type. +DATETIME, DATE and TIME are sent to the server in a binary format as follows: + +@multitable @columnfractions .20 .10 .70 +@item Type @tab Size @tab Comment +@item date @tab 1 + 0-11 @tab Length + 2 byte year, 1 byte MMDDHHMMSS, 4 byte billionth of a second +@item datetime @tab 1 + 0-11 @tab Length + 2 byte year, 1 byte MMDDHHMMSS, 4 byte billionth of a second +@item time @tab 1 + 0-14 @tab Length + sign (0 = pos, 1= neg), 4 byte days, 1 byte HHMMDD, 4 byte billionth of a second +@end multitable + +The first byte is a length byte and then comes all parameters that are +not 0. (Always counted from the beginning). + @node Fulltext Search, , protocol, Top @chapter Fulltext Search in MySQL diff --git a/Docs/mysqld_error.txt b/Docs/mysqld_error.txt index db663e3d1f5..aeb3a12c263 100644 --- a/Docs/mysqld_error.txt +++ b/Docs/mysqld_error.txt @@ -300,7 +300,7 @@ #define ER_NOT_ALLOWED_COMMAND 1148 "The used command is not allowed with this MySQL version", #define ER_SYNTAX_ERROR 1149 -"You have an error in your SQL syntax", +"You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use", #define ER_DELAYED_CANT_CHANGE_LOCK 1150 "Delayed insert thread couldn't get requested lock for table %-.64s", #define ER_TOO_MANY_DELAYED_THREADS 1151 @@ -358,7 +358,7 @@ #define ER_CHECK_NO_SUCH_TABLE 1177 "Can't open table", #define ER_CHECK_NOT_IMPLEMENTED 1178 -"The handler for the table doesn't support check/repair", +"The handler for the table doesn't support %s", #define ER_CANT_DO_THIS_DURING_AN_TRANSACTION 1179 "You are not allowed to execute this command in a transaction", #define ER_ERROR_DURING_COMMIT 1180 @@ -454,4 +454,24 @@ #define ER_DUP_ARGUMENT 1225 "Option '%s' used twice in statement", #define ER_USER_LIMIT_REACHED 1226 -"User '%-64s' has exceeded the '%s' resource (current value: %ld)", +"User '%-.64s' has exceeded the '%s' resource (current value: %ld)", +#define ER_SPECIFIC_ACCESS_DENIED_ERROR 1227 +"Access denied. You need the %-.128s privilege for this operation", +#define ER_LOCAL_VARIABLE 1228 +"Variable '%-.64s' is a LOCAL variable and can't be used with SET GLOBAL", +#define ER_GLOBAL_VARIABLE 1229 +"Variable '%-.64s' is a GLOBAL variable and should be set with SET GLOBAL", +#define ER_NO_DEFAULT 1230 +"Variable '%-.64s' doesn't have a default value", +#define ER_WRONG_VALUE_FOR_VAR 1231 +"Variable '%-.64s' can't be set to the value of '%-.64s'", +#define ER_WRONG_TYPE_FOR_VAR 1232 +"Wrong argument type to variable '%-.64s'", +#define ER_VAR_CANT_BE_READ 1233 +"Variable '%-.64s' can only be set, not read", +#define ER_CANT_USE_OPTION_HERE 1234 +"Wrong usage/placement of '%s'", +#define 1235 +"This version of MySQL doesn't yet support '%s'", +#define ER_MASTER_FATAL_ERROR_READING_BINLOG 1236 +"Got fatal error %d: '%-.128s' from master when reading data from binary log", diff --git a/Docs/prepare.texi b/Docs/prepare.texi new file mode 100755 index 00000000000..7a526800213 --- /dev/null +++ b/Docs/prepare.texi @@ -0,0 +1,1422 @@ +\input texinfo @c -*-texinfo-*-
+@c Copyright 1997-2002 TcX AB, Detron HB and MySQL Finland AB
+@c
+@c This manual is NOT distributed under a GPL style license.
+@c Use of the manual is subject to the following terms:
+@c - Conversion to other formats is allowed, but the actual
+@c content may not be altered or edited in any way.
+@c - You may create a printed copy for your own personal use.
+@c - For all other uses, such as selling printed copies or
+@c using (parts of) the manual in another publication,
+@c prior written agreement from MySQL AB is required.
+@c
+@c Please e-mail docs@mysql.com for more information or if
+@c you are interested in doing a translation.
+@c
+@c *********************************************************
+@c Note that @node names are used on our web site.
+@c So do not change node names without checking
+@c Makefile.am and SitePages first.
+@c *********************************************************
+@c
+@c %**start of header
+
+@c there's a better way to do this... i just don't know it yet
+@c sed will remove the "@c ifnusphere " to make this valid
+@c ifnusphere @set nusphere 1
+
+@setfilename prepare.info
+
+@c We want the types in the same index
+@c @syncodeindex tp fn
+
+@c Get version information. This file is generated by the Makefile!!
+@include include.texi
+
+@ifclear tex-debug
+@c This removes the black squares in the right margin
+@finalout
+@end ifclear
+
+@c Set background for HTML
+@set _body_tags BGCOLOR=#FFFFFF TEXT=#000000 LINK=#101090 VLINK=#7030B0
+@c Set some style elements for the manual in HTML form. 'suggested'
+@c natural language colors: aqua, black, blue, fuchsia, gray, green,
+@c lime, maroon, navy, olive, purple, red, silver, teal, white, and
+@c yellow. From Steeve Buehler <ahr@YogElements.com>
+@set _extra_head <style> code {color:purple} tt {color:green} samp {color:navy} pre {color:maroon} </style>
+
+@settitle MySQL Prepared Statements
+
+@c We want single-sided heading format, with chapters on new pages. To
+@c get double-sided format change 'on' below to 'odd'
+@ifclear nusphere
+@setchapternewpage on
+@end ifclear
+
+@ifset nusphere
+@setchapternewpage odd
+@end ifset
+
+@c @paragraphindent 0
+
+@ifset nusphere
+@smallbook
+@end ifset
+
+@c @titlepage
+@c @sp 10
+@c @center @titlefont{MySQL Prepared Statements}
+@c @sp 10
+@c @right Copyright @copyright{} 1995-2003 MySQL AB
+@c blank page after title page makes page 1 be a page front.
+@c also makes the back of the title page blank.
+@c @page
+@c @end titlepage
+
+@c Short contents, blank page, long contents.
+@c until i can figure out the blank page, no short contents.
+@c @shortcontents
+@c @page
+@c @page
+@contents
+
+@c This should be added. The HTML conversion also needs a MySQL version
+@c number somewhere.
+
+@iftex
+@c change this to double if you want formatting for double-sided
+@c printing
+@headings single
+@end iftex
+
+@c @node Top, MySQL C API, (dir), (dir)
+
+@c @menu
+@c * MySQL C API::
+@c @end menu
+
+@c @node MySQL C API, , Top, Top
+@c @chapter MySQL C API
+
+@c @menu
+@c * Prepared statements::
+@c @end menu
+
+@node Top, MySQL prepared statements, (dir), (dir)
+
+@menu
+* MySQL prepared statements::
+@end menu
+
+@node MySQL prepared statements, , Top, Top
+@chapter MySQL Prepared Statements
+
+@menu
+* C Prepared statements::
+* C Prepared statement datatypes::
+* C Prepared statements function overview::
+* C Prepared statement functions::
+@end menu
+
+@node C Prepared statements, C Prepared statement datatypes, MySQL prepared statements, MySQL prepared statements
+@subsection C Prepared Statements
+
+@sp 1
+
+From MySQL 4.1 and above, you can also make use of the prepared
+statements using the statement handler 'MYSQL_STMT', which supports
+simultanious query executions along with input and output binding.
+
+@sp 1
+
+Prepared execution is an efficient way to execute a statement more than
+once. The statement is first parsed, or prepared. This is executed one
+or more times at a later time using the statement handle that is
+returned during the prepare.
+
+@sp 1
+
+Another advantage of prepared statements is that, it uses a binary protocol
+which makes the data tranfer between client and server in a more efficient
+way than the old MySQL protocol.
+
+@sp 1
+
+Prepared execution is faster than direct execution for statements
+executed more than once, primarly becuase the query is parsed only
+once; In the case of direct execution, the query is parsed every
+time. Prepared execution also can provide a reduction in the network
+traffic becuase during the execute call, it only sends the data for the
+parameters.
+
+
+
+@node C Prepared statement datatypes, C Prepared statements function overview, C Prepared statements, MySQL prepared statements
+@subsection C Prepared Statements DataTypes
+
+Prepared statements mainly uses the following two @code{MYSQL_STMT} and
+@code{MYSQL_BIND} structures:
+@sp 1
+
+@table @code
+@tindex MYSQL C type
+@item MYSQL_STMT
+This structure represents a statement handle to prepared statements.It
+is used for all statement related functions.
+
+@sp 1
+
+The statement is initialized when the query is prepared using
+@code{mysql_prepare()}.
+
+@sp 1
+
+One connection can have 'n' statement handles, and the limit depends up on
+the system resources.
+
+@sp 1
+
+@tindex MYSQL_BIND C type
+@item MYSQL_BIND
+This structure is used in order to bind parameter buffers inorder to
+send the parameters data to @code{mysql_execute()} call; as well as to
+bind row buffers to fetch the result set data using @code{mysql_fetch()}.
+@end table
+
+@sp 1
+
+@noindent
+The @code{MYSQL_BIND} structure contains the members listed here:
+
+
+@table @code
+@item enum enum_field_types buffer_type [input]
+The type of the buffer. The @code{type} value must be one of the following:
+
+
+@itemize @bullet
+@item @code{MYSQL_TYPE_TINY}
+@item @code{MYSQL_TYPE_SHORT}
+@item @code{MYSQL_TYPE_LONG}
+@item @code{MYSQL_TYPE_LONGLONG}
+@item @code{MYSQL_TYPE_FLOAT}
+@item @code{MYSQL_TYPE_DOUBLE}
+@item @code{MYSQL_TYPE_STRING}
+@item @code{MYSQL_TYPE_VAR_STRING}
+@item @code{MYSQL_TYPE_TINY_BLOB}
+@item @code{MYSQL_TYPE_MEDIUM_BLOB}
+@item @code{MYSQL_TYPE_LONG_BLOB}
+@item @code{MYSQL_TYPE_BLOB}
+@end itemize
+@sp 1
+
+@item void *buffer [input/output]
+A pointer to a buffer for the parameters data in case if it is used to
+supply parameters data or pointer to a buffer in which to return the
+data when the structure is used for result set bind.
+
+@sp 1
+
+@item long *length [input/output]
+Pointer to the buffer for the parameter's length. When the structure is
+used as a input parameter data binding, then this argument points to a
+buffer that, when @code{mysql_execute()} is called, contains one of the
+following:
+
+@itemize @bullet
+@item
+The length of the parameter value stored in *buffer. This is ignored
+except for character or binary C data.
+@item
+MYSQL_NULL_DATA. The parameter value is NULL.
+@item
+MYSQL_LONG_DATA. The parameter value is a long data and is supplied in
+chunks through @code{mysql_send_long_data()}.
+@end itemize
+
+If the length is a null pointer, then the protocol assumes that all
+input parameter values are non-NULL and that character and binary data
+are null terminated.
+
+
+When this structure is used in output binding, then @code{mysql_fetch()}
+return the following values in the length buffer:
+
+@itemize @bullet
+@item
+The length of the data that is returned
+@item
+MYSQL_NULL_DATA, indicating the data returned is a NULL data.
+@end itemize
+
+
+@c @item bool is_null [input]
+@c To indicate the parameter data is NULL. This is same as supplying
+@c MYSQL_NULL_DATA, -1 as the length in length pointer.
+
+
+@c @item bool is_long_data [input]
+@c To indicate the parameter data is a long data, and the data will be
+@c supplied in chunks through @code{mysql_send_long_data()}.This is also
+@c same as supplying MYSQL_LONG_DATA, -2 as the length in length pointer.
+@c @end table
+@end table
+
+
+@node C Prepared statements function overview, C Prepared statement functions, C Prepared statement datatypes, MySQL prepared statements
+@subsection C Prepared Statements Function Overview
+
+@cindex C Prepared statements API, functions
+@cindex functions, C Prepared statements API
+
+The functions available in the prepared statements are listed here and
+are described in greater detail in the later section.
+@xref{C Prepared statement functions}.
+
+@multitable @columnfractions .32 .68
+@item @strong{Function} @tab @strong{Description}
+
+@item @strong{mysql_prepare()} @tab Prepares an SQL string for execution.
+
+@item @strong{mysql_param_count()} @tab Returns the number of parameters in a prepared SQL statement.
+
+@item @strong{mysql_prepare_result()} @tab Returns prepared statement meta information in the form of resultset.
+
+@item @strong{mysql_bind_param()} @tab Binds a buffer to parameter markers in a prepared SQL statement.
+
+@item @strong{mysql_execute()} @tab Executes the prepared statement.
+
+@item @strong{mysql_stmt_affected_rows()} @tab Returns the number of rows changes/deleted/inserted by the last UPDATE,DELETE,or INSERT query
+
+@item @strong{mysql_bind_result()} @tab Binds application data buffers to columns in the resultset.
+
+@item @strong{mysql_fetch()} @tab Fetches the next rowset of data from the result set and returns data for all bound columns.
+
+@item @strong{mysql_stmt_close()} @tab Frees memory used by prepared statement.
+
+@item @strong{mysql_stmt_errno()} @tab Returns the error number for the last statement execution.
+
+@item @strong{mysql_stmt_error()} @tab Returns the error message for the last statement execution.
+
+@item @strong{mysql_send_long_data()} @tab Sends long data in chunks to server.
+
+@c TO BE MOVED TO MAIN C API FUCTIONS
+@item @strong{mysql_commit()} @tab Commits the transaction.
+
+@item @strong{mysql_rollback()} @tab Rollbacks the transaction.
+
+@item @strong{mysql_autocommit()} @tab Toggles the autocommit mode to on/off.
+
+@item @strong{mysql_more_results()} @tab Returns if there are any more results exists
+
+@item @strong{mysql_next_result()} @tab Returns/Initiates the next result in the multi-query executions
+
+@end multitable
+
+@sp 1
+Call @code{mysql_prepare()} to prepare and initialize the statement
+handle, then call @code{mysql_bind_param()} to supply the parameters
+data, and then call @code{mysql_execute()} to execute the query. You can
+repeat the @code{mysql_execute()} by changing parameter values from the
+respective buffer supplied through @code{mysql_bind_param()}.
+
+@sp 1
+
+
+In case if the query is a SELECT statement or any other query which
+results in a resultset, then mysql_prepare() will also return the result
+set meta data information in the form of @code{MYSQL_RES } result set
+through @code{mysql_prepare_result()}.
+
+@sp 1
+
+You can supply the result buffers using @code{mysql_bind_result()}, so
+that the @code{mysql_fetch()} will automatically returns data to this
+buffers. This is row by row fetching.
+
+@sp 1
+
+You can also send the text or binary data in chunks to server using
+@code{mysql_send_long_data()}, by specifying the option is_long_data=1
+or length=MYSQL_LONG_DATA or -2 in the MYSQL_BIND structure supplied
+with @code{mysql_bind_param()}.
+
+@sp 1
+
+Once the statement execution is over, it must be freed using
+@code{mysql_stmt_close} so that it frees all the alloced resources for
+the statement handle.
+
+
+@subsubheading Execution Steps:
+
+To prepare and execute a statement, the application:
+
+@itemize @bullet
+@item
+Calls @strong{mysql_prepare()} and passes it a string containing the SQL
+statement. On a successful prepare, mysql_prepare returns the valid statement
+handle back to the application
+@item
+If the query results in a resultset, then @strong{mysql_prepare_result}
+returns the result set meta info..
+@item
+Sets the values of any parameters using @strong{mysql_bind_param}. All
+parameters must be set; else it will return an error or produce
+un-expected results
+@item
+Calls @strong{mysql_execute} to execute the statement.
+@item
+Repeat steps 2 and 3 as necessary, by changing the parameter values and
+re-executing the statement.
+@item
+Bind the data buffers to return the row values, if it is a result set
+query; using @strong{mysql_bind_result()}.
+@item
+Fetch the data to buffers row by row by calling @strong{mysql_fetch()}
+repetedely until no more rows found.
+@item
+When @strong{mysql_prepare()} is called, in the MySQL client/server protocol:
+@itemize @minus
+@item
+Server parses the query and sends the ok status back to client by
+assinging a statement id. It also sends total number of parameters,
+columns count and its meta information if it is a result set oriented
+query. All syntax and symantecs of the query is checked during this call
+by the server.
+@item
+Client uses this statement id for the further executions, so that server
+identifies the statement back from the pool of statements. Now, client
+allocates a statement handle with this id and returns back to
+application.
+@end itemize
+@item
+When @strong{mysql_execute()} is called, in the MySQL client/server protocol:
+@itemize @minus
+@item
+Client uses the statement handle and sends the parameters data to
+server.
+@item
+Server identifies the statement using the id provided by the client, and
+replaces the parameter markers with the newly supplied data and executes
+the query. If it results in a result set, then sends the data back to
+client, else sends an OK status with total number of rows
+changes/deleted/inserted.
+@end itemize
+@item
+When @strong{mysql_fetch()} is called, in the MySQL client/server protocol:
+@itemize @minus
+@item
+Client reads the data from the packet row by row and places it to
+application data buffers by doing the necessary conversions. If the
+application buffer type is same as that of field type, then the
+conversions are stright forward.
+@end itemize
+@end itemize
+
+
+
+You can get the statement error code and message using
+@code{mysql_stmt_errno()} and @code{mysql_stmt_error()} respectively.
+
+
+@node C Prepared statement functions, , C Prepared statements function overview, MySQL prepared statements
+@subsection C Prepared Statement Function Descriptions
+
+You need to use the following functions when you want to prepare and
+execute the queries.
+
+
+@menu
+* mysql_prepare::
+* mysql_param_count::
+* mysql_prepare_result::
+* mysql_bind_param::
+* mysql_execute::
+* mysql_stmt_affected_rows::
+* mysql_bind_result::
+* mysql_fetch::
+* mysql_send_long_data::
+* mysql_stmt_close::
+* mysql_stmt_errno::
+* mysql_stmt_error::
+* mysql_commit::
+* mysql_rollback::
+* mysql_autocommit::
+@end menu
+
+@node mysql_prepare, mysql_param_count, C Prepared statement functions, C Prepared statement functions
+@subsubsection @code{mysql_prepare()}
+
+@findex @code{mysql_prepare()}
+
+@code{MYSQL_STMT * mysql_prepare(MYSQL *mysql, const char *query, unsigned
+long length)}
+
+@subsubheading Description
+
+Prepares the SQL query pointed to by the null-terminated string
+'query'. The query must consist of a single SQL statement. You should
+not add a terminating semicolon (`;`) or \g to the statement.
+
+@sp 1
+The application can include one or more parameter markers in the SQL
+statement. To include a parameter marker, the appication embeds a
+question mark (@code{?}) into the SQL string at the appropriate
+position.
+
+@sp 1
+The markers are legal only in certain places in SQL statements. For
+example, they are not allowed in the select list(the list of columns to
+be returned by a SELECT statement), nor are they allowed as both
+operands of a binary operator such as the equal sign (=), becuase it
+would be impossible to determine the parameter type. In general,
+parameters are legal only in Data Manipulation Languange(DML)
+statements, and not in Data Defination Language(DDL) statements.
+
+@sp 1
+The parameter markers are then bound to application variables using
+@code{mysql_bind_param()}.
+
+
+
+@subsubheading Return Values
+
+@code{MYSQL_STMT} if the prepare was successful. NULL if an error
+occured.
+
+@subsubheading Errors
+
+If the prepare is not successful, i.e. when @code{mysql_prepare()} returned a
+NULL statement, errors can be obtained by calling @code{mysql_error()}.
+
+
+@subsubheading Example
+
+For the usage of @code{mysql_prepare()} refer to the Example from
+@ref{mysql_execute,mysql_execute()}.
+
+
+
+
+@node mysql_param_count, mysql_prepare_result, mysql_prepare, C Prepared statement functions
+@subsubsection @code{mysql_param_count()}
+
+@findex @code{mysql_param_count()}
+
+@code{unsigned int mysql_param_count(MYSQL_STMT *stmt)}
+
+@subsubheading Description
+
+Returns the number of parameter markers present from the prepared query.
+
+@subsubheading Return Values
+
+An unsigned integer representing the number of parameters in a
+statement.
+
+@subsubheading Errors
+
+None
+
+@subsubheading Example
+
+For the usage of @code{mysql_param_count()} refer to the Example from
+@ref{mysql_execute,mysql_execute()}.
+
+
+
+@node mysql_prepare_result, mysql_bind_param, mysql_param_count, C Prepared statement functions
+@subsubsection @code{mysql_prepare_result()}
+
+
+@findex @code{mysql_prepare_result}.
+
+@code{MYSQL_RES *mysql_prepare_result(MYSQL_STMT *stmt)}
+
+@subsubheading Description
+
+If the @code{mysql_prepare()} resulted in a result set query, then
+@code{mysql_prepare_result()} returns the result set meta data in the form of
+@code{MYSQL_RES} structure; which can further be used to process the
+meta information such as total number of fields and individual field
+information. This resulted result set can be passed as an argument to
+any of the field based APIs in order to process the result set meta data
+information such as:
+
+@itemize @minus
+@item
+mysql_num_fields()
+@item
+mysql_fetch_field()
+@item
+mysql_fetch_field_direct()
+@item
+mysql_fetch_fields()
+@item
+mysql_field_count()
+@item
+mysql_field_seek()
+@item
+mysql_field_tell() and
+@item
+mysql_free_result()
+@end itemize
+
+
+@subsubheading Return Values
+
+A @code{MYSQL_RES} result structure. NULL if no meta information exists from
+the prepared query.
+
+
+@subsubheading Errors
+
+None
+
+
+@subsubheading Example
+
+For the usage of @code{mysql_prepare_result()} refer to the Example from
+@ref{mysql_fetch,mysql_fetch()}
+
+
+
+@node mysql_bind_param, mysql_execute, mysql_prepare_result, C Prepared statement functions
+@subsubsection @code{mysql_bind_param()}
+
+@findex @code{mysql_bind_param()}
+
+@code{int mysql_bind_param(MYSQL_STMT *stmt, MYSQL_BIND *bind)}
+
+@subsubheading Description
+
+@code{mysql_bind_param} is used to bind data for the parameter markers
+in the SQL statement from @code{mysql_prepare}. It uses the structure
+MYSQL_BIND to supply the data.
+
+The supported buffer types are:
+
+@itemize @bullet
+@item
+MYSQL_TYPE_TINY
+@item
+MYSQL_TYPE_SHORT
+@item
+MYSQL_TYPE_LONG
+@item
+MYSQL_TYPE_LONGLONG
+@item
+MYSQL_TYPE_FLOAT
+@item
+MYSQL_TYPE_DOUBLE
+@item
+MYSQL_TYPE_STRING
+@item
+MYSQL_TYPE_VAR_STRING
+@item
+MYSQL_TYPE_TINY_BLOB
+@item
+MYSQL_TYPE_MEDIUM_BLOB
+@item
+MYSQL_TYPE_LONG_BLOB
+@end itemize
+
+@subsubheading Return Values
+
+Zero if the bind was successful. Non-zero if an error occured.
+
+@subsubheading Errors
+@table @code
+@item CR_NO_PREPARE_STMT
+No prepared statement exists
+@item CR_NO_PARAMETERS_EXISTS
+No parameters exists to bind
+@item CR_INVALID_BUFFER_USE
+Indicates if the bind is to supply the long data in chunks and if the
+buffer type is non string or binary
+@item CR_UNSUPPORTED_PARAM_TYPE
+The conversion is not supported, possibly the buffer_type is illegal or
+its not from the above list of supported types.
+@end table
+
+@subsubheading Example
+
+For the usage of @code{mysql_bind_param()} refer to the Example from
+@ref{mysql_execute,mysql_execute()}.
+
+
+
+@node mysql_execute, mysql_stmt_affected_rows, mysql_bind_param, C Prepared statement functions
+@subsubsection @code{mysql_execute()}
+
+@findex @code{mysql_execute()}
+
+@code{int mysql_execute(MYSQL_STMT *stmt}.
+
+@subsubheading Description
+
+@code{mysql_execute()} executes the prepared query associated with the
+statement handle. The parameter marker values will be sent to server
+during this call, so that server replaces markers with this newly
+supplied data.
+
+@sp 1
+
+If the statement is UPDATE,DELETE,or INSERT, the total number of
+changed/deletd/inserted values can be found by calling
+@code{mysql_stmt_affected_rows}. If this is a result set query, then one
+must call @code{mysql_fetch()} to fetch the data prior to calling any
+other calls which results in query processing. For more information on
+how to fetch the statement binary data, refer to @ref{mysql_fetch}.
+
+
+@subsubheading Return Values
+
+@code{mysql_execute()} returns the following return values:
+
+@multitable @columnfractions .30 .65
+@item @strong{Return Value} @tab @strong{Description}
+@item MYSQL_SUCCESS, 0 @tab Successful
+@item MYSQL_STATUS_ERROR, 1 @tab Error occured. Error code and
+message can be obtained by calling @code{mysql_stmt_errno()} and @code{mysql_stmt_error()}.
+@item MYSQL_NEED_DATA, 99 @tab One of the parameter buffer is
+indicating the data suppy in chunks, and the supply is not yet complete.
+@end multitable
+
+
+@subsubheading Errors
+
+@table @code
+@item CR_NO_PREPARE_QUERY
+No query prepared prior to execution
+@item CR_ALL_PARAMS_NOT_BOUND
+Not all parameters data is supplied
+@item CR_SERVER_GONE_ERROR
+The MySQL server has gone away
+@item CR_UNKNOWN_ERROR
+An unkown error occured
+@end table
+
+
+@subsubheading Example
+
+The following example explains the uasage of @code{mysql_prepare},
+@code{mysql_param_count}, @code{mysql_bind_param}, @code{mysql_execute}
+and @code{mysql_stmt_affected_rows()}.
+
+@example
+
+MYSQL_BIND bind[3];
+MYSQL_STMT *stmt;
+ulonglong affected_rows;
+long length;
+unsigned int param_count;
+int int_data;
+char str_data[50], query[255];
+
+ /* Set autocommit mode to true */
+ mysql_autocommit(mysql, 1);
+
+ if (mysql_query(mysql,"DROP TABLE IF EXISTS test_table"))
+ @{
+ fprintf(stderr, "\n drop table failed");
+ fprintf(stderr, "\n %s", mysql_error(mysql));
+ exit(0);
+ @}
+ if (mysql_query(mysql,"CREATE TABLE test_table(col1 int, col2 varchar(50), \
+ col3 smallint,\
+ col4 timestamp(14))"))
+ @{
+ fprintf(stderr, "\n create table failed");
+ fprintf(stderr, "\n %s", mysql_error(mysql));
+ exit(0);
+ @}
+
+ /* Prepare a insert query with 3 parameters */
+ strcpy(query, "INSERT INTO test_table(col1,col2,col3) values(?,?,?)");
+ if(!(stmt = mysql_prepare(mysql,query,strlen(query))))
+ @{
+ fprintf(stderr, "\n prepare, insert failed");
+ fprintf(stderr, "\n %s", mysql_error(mysql));
+ exit(0);
+ @}
+ fprintf(stdout, "\n prepare, insert successful");
+
+ /* Get the parameter count from the statement */
+ param_count= mysql_param_count(stmt);
+
+ 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");
+ exit(0);
+ @}
+
+ /* Bind the data for the parameters */
+
+ /* INTEGER PART */
+ memset(bind,0,sizeof(bind));
+ bind[0].buffer_type= MYSQL_TYPE_LONG;
+ bind[0].buffer= (void *)&int_data;
+
+ /* STRING PART */
+ bind[1].buffer_type= MYSQL_TYPE_VAR_STRING;
+ bind[1].buffer= (void *)str_data;
+ bind[1].buffer_length= sizeof(str_data);
+
+ /* SMALLINT PART */
+ bind[2].buffer_type= MYSQL_TYPE_SHORT;
+ bind[2].buffer= (void *)&small_data;
+ bind[2].length= (long *)&length;
+
+ /* Bind the buffers */
+ if (mysql_bind_param(stmt, bind))
+ @{
+ fprintf(stderr, "\n param bind failed");
+ fprintf(stderr, "\n %s", mysql_stmt_error(stmt));
+ exit(0);
+ @}
+
+ /* Specify the data */
+ int_data= 10; /* integer */
+ strcpy(str_data,"MySQL"); /* string */
+ /* INSERT SMALLINT data as NULL */
+ length= MYSQL_NULL_DATA;
+
+ /* Execute the insert statement - 1*/
+ if (mysql_execute(stmt))
+ @{
+ fprintf(stderr, "\n execute 1 failed");
+ fprintf(stderr, "\n %s", mysql_stmt_error(stmt));
+ fprintf(stderr, "\n send a bug report to bugs@@lists.mysql.com, by asking why this is not working ?");
+ exit(0);
+ @}
+
+ /* Get the total rows affected */
+ affected_rows= mysql_stmt_affected_rows(stmt);
+
+ fprintf(stdout, "\n total affected rows: %lld", affected_rows);
+ if (affected_rows != 1) /* validate affected rows */
+ @{
+ fprintf(stderr, "\n invalid affected rows by MySQL");
+ exit(0);
+ @}
+
+ /* Re-execute the insert, by changing the values */
+ int_data= 1000;
+ strcpy(str_data,"The most popular open source database");
+ small_data= 1000; /* smallint */
+ length= 0;
+
+ /* Execute the insert statement - 2*/
+ if (mysql_execute(stmt))
+ @{
+ fprintf(stderr, "\n execute 2 failed");
+ fprintf(stderr, "\n %s", mysql_stmt_error(stmt));
+ exit(0);
+ @}
+
+ /* Get the total rows affected */
+ affected_rows= mysql_stmt_affected_rows(stmt);
+
+ fprintf(stdout, "\n total affected rows: %lld", affected_rows);
+ if (affected_rows != 1) /* validate affected rows */
+ @{
+ fprintf(stderr, "\n invalid affected rows by MySQL");
+ exit(0);
+ @}
+
+ /* Close the statement */
+ if (mysql_stmt_close(stmt))
+ @{
+ fprintf(stderr, "\n failed while closing the statement");
+ fprintf(stderr, "\n %s", mysql_stmt_error(stmt));
+ exit(0);
+ @}
+
+ /* DROP THE TABLE */
+ if (mysql_query(mysql,"DROP TABLE test_table"))
+ @{
+ fprintf(stderr, "\n drop table failed");
+ fprintf(stderr, "\n %s", mysql_error(mysql));
+ exit(0);
+ @}
+ fprintf(stdout, "Success, MySQL prepared statements are working great !!!");
+@end example
+
+
+
+
+@node mysql_stmt_affected_rows, mysql_bind_result, mysql_execute, C Prepared statement functions
+@subsubsection @code{mysql_stmt_affected_rows()}
+
+@findex @code{mysql_stmt_affected_rows()}
+
+@code{ulonglong mysql_stmt_affected_rows(MYSQL_STMT *stmt)}
+
+@subsubheading Description
+
+Returns total number of rows changed by the last execute statement. May
+be called immediatlely after mysql_execute() for UPDATE,DELETE,or INSERT
+statements.For SELECT statements, mysql_stmt_affected rows works like
+mysql_num_rows().
+
+@subsubheading Return Values
+
+An integer greater than zero indicates the number of rows affected or
+retrieved. Zero indicates that no records where updated for an UPDATE
+statement, no rows matched the WHERE clause in the query or that no
+query has yet been executed. -1 indicates that the query returned an
+error or that, for a SELECT query, mysql_stmt_affected_rows() was called
+prior to calling mysql_fetch().
+
+@subsubheading Errors
+
+None.
+
+@subsubheading Example
+
+For the usage of @code{mysql_stmt_affected_rows()} refer to the Example
+from @ref{mysql_execute,mysql_execute()}.
+
+
+
+
+
+@node mysql_bind_result, mysql_fetch, mysql_stmt_affected_rows, C Prepared statement functions
+@subsubsection @code{mysql_bind_result()}
+
+@findex @code{mysql_bind_result()}
+
+@code{my_bool mysql_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind)}
+
+@subsubheading Description
+
+@code{mysql_bind_result()} is ised to associate, or bind, columns in the
+resultset to data buffers and length buffers. When @code{mysql_fetch()} is
+called to fetch data, the MySQL client protocol returns the data for the
+bound columns in the specified buffers.
+
+@sp 1
+
+Note that all columns must be bound prior to calling @code{mysql_fetch()}
+in case of fetching the data to buffers; else @code{mysql_fetch()} simply ignores
+the data fetch; also the buffers should be sufficient enough to hold the
+data as the ptotocol doesn't return the data in chunks.
+
+@sp 1
+
+A column can be bound or rebound at any time, even after data has been
+fetched from the result set. The new binding takes effect the next time
+@code{mysql_fetch()} is called. For example, suppose an application binds
+the columns in a result set and calls @code{mysql_fetch()}. The mysql
+protocol returns data in the bound buffers. Now suppose the application
+binds the columns to a different set of buffers, then the protocol does
+not place the data for the just fetched row in the newly bound
+buffers. Instead, it does when the next @code{mysql_fetch()} is called.
+
+@sp 1
+
+To bind a column, an application calls @code{mysql_bind_result()} and
+passes the type, address, and the address of the length buffer.
+
+The supported buffer types are:
+
+@itemize @bullet
+@item
+MYSQL_TYPE_TINY
+@item
+MYSQL_TYPE_SHORT
+@item
+MYSQL_TYPE_LONG
+@item
+MYSQL_TYPE_LONGLONG
+@item
+MYSQL_TYPE_FLOAT
+@item
+MYSQL_TYPE_DOUBLE
+@item
+MYSQL_TYPE_STRING
+@item
+MYSQL_TYPE_VAR_STRING
+@item
+MYSQL_TYPE_BLOB
+@item
+MYSQL_TYPE_TINY_BLOB
+@item
+MYSQL_TYPE_MEDIUM_BLOB
+@item
+MYSQL_TYPE_LONG_BLOB
+@end itemize
+
+@subsubheading Return Values
+
+Zero if the bind was successful. Non-zero if an error occured.
+
+@subsubheading Errors
+@table @code
+@item CR_NO_PREPARE_STMT
+No prepared statement exists
+@item CR_UNSUPPORTED_PARAM_TYPE
+The conversion is not supported, possibly the buffer_type is illegal or
+its not from the list of supported types.
+@end table
+
+@subsubheading Example
+
+For the usage of @code{mysql_bind_result()} refer to the Example from
+@ref{mysql_fetch,mysql_fetch()}
+
+
+
+@node mysql_fetch, mysql_send_long_data, mysql_bind_result, C Prepared statement functions
+@subsubsection @code{mysql_fetch()}
+
+@findex code{mysql_fetch()}
+
+@code{int mysql_fetch(MYSQL_STMT *stmt)}
+
+@subsubheading Description
+
+@code{mysql_fetch()} returns the next rowset in the result set. It can
+be called only while the result set exists i.e. after a call to
+@code{mysql_execute()} that creates a result set.
+
+@sp 1
+
+If row buffers are bound using @code{mysql_bind_result()}, it returns
+the data in those buffers for all the columns in the current row
+set and the lengths are returned to the length pointer.
+
+@sp 1
+Note that, all columns must be bound by the application.
+
+@sp 1
+If the data fetched is a NULL data, then the length buffer will have a
+value of @strong{MYSQL_NULL_DATA}, -1, else it will have the length of
+the data being fetched based on the buffer type specified by the
+application. All numeric, float and double types have the
+fixed length(in bytes) as listed below:
+
+@multitable @columnfractions .10 .30
+@item @strong{Type} @tab @strong{Length}
+@item MYSQL_TYPE_TINY @tab 1
+@item MYSQL_TYPE_SHORT @tab 2
+@item MYSQL_TYPE_LONG @tab 4
+@item MYSQL_TYPE_FLOAT @tab 4
+@item MYSQL_TYPE_LONGLONG @tab 8
+@item MYSQL_TYPE_DOUBLE @tab 8
+@item MYSQL_TYPE_STRING @tab data length
+@item MYSQL_TYPE_VAR_STRING @tab data_length
+@item MYSQL_TYPE_BLOB @tab data_length
+@item MYSQL_TYPE_TINY_BLOB @tab data_length
+@item MYSQL_TYPE_MEDIUM_BLOB @tab data_length
+@item MYSQL_TYPE_LONG_BLOB @tab data_length
+@end multitable
+
+@*
+where @code{*data_length} is nothing but the 'Actual length of the data'.
+
+@subsubheading Return Values
+
+@multitable @columnfractions .30 .65
+@item @strong{Return Value} @tab @strong{Description}
+@item MYSQL_SUCCESS, 0 @tab Successful, the data has been
+fetched to application data buffers.
+@item MYSQL_STATUS_ERROR, 1 @tab Error occured. Error code and
+message can be obtained by calling @code{mysql_stmt_errno()} and @code{mysql_stmt_error()}.
+@item MYSQL_NO_DATA, 100 @tab No more rows/data exists
+@end multitable
+
+
+@subsubheading Errors
+@table @code
+@item CR_UNSUPPORTED_PARAM_TYPE
+If the field type is DATE,DATETIME,TIME,or TIMESTAMP; and the
+application buffer type is non string based.
+@item
+All other un-supported conversions are returned from
+@code{mysql_bind_result()}.
+@end table
+
+@subsubheading Example
+
+The following example explains the usage of @code{mysql_prepare_result},
+@code{mysql_bind_result()}, and @code{mysql_fetch()}
+
+@example
+
+MYSQL_STMT *stmt;
+MYSQL_BIND bind[2];
+MYSQL_RES *result;
+int int_data;
+long int_length, str_length;
+char str_data[50];
+
+ query= "SELECT col1, col2 FROM test_table WHERE col1= 10)");
+ if (!(stmt= mysql_prepare(&mysql, query, strlen(query)))
+ @{
+ fprintf(stderr, "\n prepare failed");
+ fprintf(stderr, "\n %s", mysql_error(&stmt));
+ exit(0);
+ @}
+
+ /* Get the fields meta information */
+ if (!(result= mysql_prepare_result(stmt)))
+ @{
+ fprintf(stderr, "\n prepare_result failed");
+ fprintf(stderr, "\n %s", mysql_stmt_error(stmt));
+ exit(0);
+ @}
+
+ fprintf(stdout, "Total fields: %ld", mysql_num_fields(result));
+
+ if (mysql_num_fields(result) != 2)
+ @{
+ fprintf(stderr, "\n prepare returned invalid field count");
+ exit(0);
+ @}
+
+ /* Execute the SELECT query */
+ if (mysql_execute(stmt))
+ @{
+ fprintf(stderr, "\n execute didn't retuned expected return code, MYSQL_NEED_DATA");
+ exit(0);
+ @}
+
+ /* Bind the result data buffers */
+ bzero(bind, 0, sizeof(bind));
+
+ bind[0].buffer_type= MYSQL_TYPE_LONG;
+ bind[0].buffer= (void *)&int_data;
+ bind[0].length= &int_length;
+
+ bind[1].buffer_type= MYSQL_TYPE_VAR_STRING;
+ bind[1].buffer= (void *)str_data;
+ bind[1].length= &str_length;
+
+ if (mysql_bind_result(stmt, bind))
+ @{
+ fprintf(stderr, "\n bind_result failed");
+ fprintf(stderr, "\n %s", mysql_stmt_error(stmt));
+ exit(0);
+ @}
+
+ /* Now fetch data to buffers */
+ if (mysql_fetch(stmt))
+ @{
+ fprintf(stderr, "\n fetch failed");
+ fprintf(stderr, "\n %s", mysql_stmt_error(stmt));
+ exit(0);
+ @}
+
+ fprintf(stdout, "\n int_data: %d, length: %ld", int_data, int_length);
+ fprintf(stdout, "\n str_data: %s, length: %ld", str_data, str_length);
+
+ /* call mysql_fetch again */
+ if (mysql_fetch(stmt) |= MYSQL_NO_DATA)
+ @{
+ fprintf(stderr, "\n fetch return more than one row);
+ exit(0);
+ @}
+
+ /* Free the prepare result */
+ mysql_free_result(result);
+
+ /* Free the statement handle */
+ if (mysql_stmt_free(stmt))
+ @{
+ fprintf(stderr, "\n failed to free the statement handle);
+ fprintf(stderr, "\n %s", mysql_stmt_error(stmt));
+ exit(0);
+ @}
+
+@end example
+
+
+
+@node mysql_send_long_data, mysql_stmt_close, mysql_fetch, C Prepared statement functions
+@subsubsection @code{mysql_send_long_data()}
+
+
+@findex @code{mysql_send_long_data()}.
+
+@code{int mysql_send_long_data(MYSQL_STMT *stmt, unsigned int
+parameter_number, const char *data, ulong length, my_bool is_last_data)}
+
+@subsubheading Description
+
+Allows an application to send the data in pieces or chunks to
+server. This function can be used to send character or binary data
+values in parts to a column(it must be a text or blob) with a character or
+binary data type.
+
+@sp 1
+The @code{data} is a pointer to buffer containing the actual data for
+the parameter represendted by @code{parameter_number}. The @code{length}
+indicates the amount of data to be sent in bytes, and @code{is_last_data} is a
+boolean flag to indicate the end of the data. If it is != 0, then the
+current call will be the end of the data, else it waits for the
+application to send all data. If the application doesn't ended the data
+supply from @code{mysql_send_long_data()}, then the
+@code{mysql_execute()} will return @strong{MYSQL_NEED_DATA}.
+
+
+
+@subsubheading Return Values
+
+Zero if the data is sent successfully to server. Non-zero if an error
+occured.
+
+
+@subsubheading Errors
+
+@table @code
+@item CR_INVALID_PARAMETER_NO
+Invalid parameter number
+@item CR_SERVER_GONE_ERROR
+The MySQL server has gone away
+@item CR_UNKNOWN_ERROR
+An unkown error occured
+@end table
+
+@subsubheading Example
+The following example explains how to send the data in chunks to text
+column:
+@example
+
+MYSQL_BIND bind[1];
+long length;
+
+ query= "INSERT INTO test_long_data(text_column) VALUES(?)");
+ if (!mysql_prepare(&mysql, query, strlen(query))
+ @{
+ fprintf(stderr, "\n prepare failed");
+ fprintf(stderr, "\n %s", mysql_error(&stmt));
+ exit(0);
+ @}
+ memset(bind, 0, sizeof(bind));
+ bind[0].buffer_type= MYSQL_TYPE_STRING;
+ bind[0].length= &length;
+
+ /* Indicate that the data supply is in CHUNKS */
+ length= MYSQL_LONG_DATA;
+
+ /* Bind the buffers */
+ if (mysql_bind_param(stmt, bind))
+ @{
+ fprintf(stderr, "\n param bind failed");
+ fprintf(stderr, "\n %s", mysql_stmt_error(stmt));
+ exit(0);
+ @}
+
+ /* Execute the insert statement - It should return MYSQL_NEED_DATA */
+ if (mysql_execute(stmt) != MYSQL_NEED_DATA)
+ @{
+ fprintf(stderr, "\n execute didn't retuned expected return code, MYSQL_NEED_DATA");
+ exit(0);
+ @}
+
+ /* Supply data in chunks to server */
+ if (!mysql_send_long_data(stmt,1,"MySQL",5,0))
+ @{
+ fprintf(stderr, "\n send_long_data failed");
+ fprintf(stderr, "\n %s", mysql_stmt_error(stmt));
+ exit(0);
+ @}
+ /* Supply the last piece of data */
+ if (mysql_send_long_data(stmt,1," - The most popular open source database",40,1))
+ @{
+ fprintf(stderr, "\n send_long_data failed");
+ fprintf(stderr, "\n %s", mysql_stmt_error(stmt));
+ exit(0);
+ @}
+
+ /* Now, execute the query */
+ if (mysql_execute(stmt))
+ @{
+ fprintf(stderr, "\n mysql_execute failed");
+ fprintf(stderr, "\n %s", mysql_stmt_error(stmt));
+ exit(0);
+ @}
+
+ This inserts the data, "MySQL - The most popular open source database"
+ to the field 'text_column'.
+@end example
+
+
+
+@node mysql_stmt_close, mysql_stmt_errno, mysql_send_long_data, C Prepared statement functions
+@subsubsection @code{mysql_stmt_close()}
+
+@findex @code{mysql_stmt_close()}
+
+@code{my_bool mysql_stmt_close(MYSQL_STMT *)}
+
+@subsubheading Description
+
+Closes the prepared statement. @code{mysql_stmt_close()} also
+deallocates the statement handle pointed to by @code{stmt}.
+
+@subsubheading Return Values
+
+Zero if the statement was freed successfully. Non-zero if an error occured.
+
+
+@subsubheading Errors
+
+@table @code
+@item CR_SERVER_GONE_ERROR
+The MySQL server has gone away
+@item CR_UNKNOWN_ERROR
+An unkown error occured
+@end table
+
+@subsubheading Example
+
+For the usage of @code{mysql_stmt_close()} refer to the Example from
+@ref{mysql_execute,mysql_execute()}.
+
+
+
+@node mysql_stmt_errno, mysql_stmt_error, mysql_stmt_close, C Prepared statement functions
+@subsubsection @code{mysql_stmt_errno()}
+
+
+@findex @code{mysql_stmt_errno()}
+
+@code{unsigned int mysql_stmt_errno(MYSQL_STMT *stmt)}
+
+@subsubheading Description
+
+For the statement specified by @code{stmt}, @code{mysql_stmt_errno()}
+returns the error code for the most recently invoked statement API
+function that can succeed or fail. A return value of zero means that no
+error occured. Client error message numbers are listed in the MySQL
+errmsg.h header file. Server error message numbers are listed in
+mysqld_error.h. In the MySQL source distribution you can find a complete
+list of error messages and error numbers in the file Docs/mysqld_error.txt
+
+@subsubheading Return Values
+
+An error code value. Zero if no error occured.
+
+@subsubheading Errors
+
+None
+
+
+@node mysql_stmt_error, mysql_commit, mysql_stmt_errno, C Prepared statement functions
+@subsubsection @code{mysql_stmt_error()}
+
+
+@findex @code{mysql_stmt_error()}.
+
+@code{char *mysql_stmt_error(MYSQL_STMT *stmt)}
+
+@subsubheading Description
+
+For the statement specified by @code{stmt}, @code{mysql_stmt_error()}
+returns the error message for the most recently invoked statement API
+that can succeed or fail. An empty string ("") is returned if no error
+occured. This means the following two sets are equivalent:
+
+@example
+
+if (mysql_stmt_errno(stmt))
+@{
+ // an error occured
+@}
+
+if (mysql_stmt_error(stmt))
+@{
+ // an error occured
+@}
+@end example
+
+The language of the client error messages many be changed by recompiling
+the MySQL client library. Currently you can choose error messages in
+several different languages.
+
+
+@subsubheading Return Values
+
+A character string that describes the error. An empry string if no error
+occured.
+
+@subsubheading Errors
+
+None
+
+
+
+@node mysql_commit, mysql_rollback, mysql_stmt_error, C Prepared statement functions
+@subsubsection @code{mysql_commit()}
+
+
+@findex @code{mysql_commit()}.
+
+@code{my_bool mysql_commit(MYSQL *mysql)}
+
+@subsubheading Description
+
+Commits the current transaction
+
+@subsubheading Return Values
+
+Zero if successful. Non-zero if an error occured.
+
+@subsubheading Errors
+
+None
+
+
+
+@node mysql_rollback, mysql_autocommit, mysql_commit, C Prepared statement functions
+@subsubsection @code{mysql_rollback()}
+
+
+@findex @code{mysql_rollback()}.
+
+@code{my_bool mysql_rollback(MYSQL *mysql)}
+
+@subsubheading Description
+
+Rollbacks the current transaction.
+
+
+@subsubheading Return Values
+
+Zero if successful. Non-zero if an error occured.
+
+@subsubheading Errors
+
+None.
+
+
+
+
+@node mysql_autocommit, , mysql_rollback, C Prepared statement functions
+@subsubsection @code{mysql_autocommit()}
+
+
+@findex @code{mysql_autocommit()}.
+
+@code{my_bool mysql_autocommit(MYSQL *mysql, my_bool mode)}
+
+@subsubheading Description
+
+Sets the autocommit mode to on or off. If the @code{mode} is '1', then it
+sets the autocommit mode to on, else to off in case of '0'.
+
+@subsubheading Return Values
+
+Zero if successful. Non-zero if an error occured
+
+@subsubheading Errors
+
+None.
+
+@bye
diff --git a/VC++Files/innobase/innobase.dsp b/VC++Files/innobase/innobase.dsp index a9dd33217be..0c2b656f043 100644 --- a/VC++Files/innobase/innobase.dsp +++ b/VC++Files/innobase/innobase.dsp @@ -43,7 +43,8 @@ RSC=rc.exe # PROP Intermediate_Dir "debug" # PROP Target_Dir "" # ADD BASE CPP /nologo /G6 /MT /W3 /GX /O2 /I "../innobase/include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "__NT__" /D "WIN32" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /G6 /MTd /W3 /GX /Z7 /O2 /I "../innobase/include" /I "../include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "__NT__" /D "WIN32" /D "_MBCS" /D "MYSQL_SERVER" /YX /FD /c +# ADD CPP /nologo /G6 /MTd /W3 /GX /Z7 /O2 /I "../innobase/include" /I "../include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "__NT__" /D "WIN32" /D "_MBCS" /D "MYSQL_SERVER" /FD /c +# SUBTRACT CPP /YX # ADD BASE RSC /l 0x416 /d "NDEBUG" # ADD RSC /l 0x416 /d "NDEBUG" BSC32=bscmake.exe @@ -66,7 +67,8 @@ LIB32=link.exe -lib # PROP Intermediate_Dir "release" # PROP Target_Dir "" # ADD BASE CPP /nologo /G6 /MT /W3 /GX /O2 /I "../innobase/include" /I "../include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "WIN32" /D "_MBCS" /D "MYSQL_SERVER" /YX /FD /c -# ADD CPP /nologo /G6 /MT /W3 /GX /O2 /I "../innobase/include" /I "../include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "WIN32" /D "_MBCS" /D "MYSQL_SERVER" /YX /FD /c +# ADD CPP /nologo /G6 /MT /W3 /GX /O2 /I "../innobase/include" /I "../include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "WIN32" /D "_MBCS" /D "MYSQL_SERVER" /FD /c +# SUBTRACT CPP /YX # ADD BASE RSC /l 0x416 /d "NDEBUG" # ADD RSC /l 0x416 /d "NDEBUG" BSC32=bscmake.exe @@ -89,7 +91,8 @@ LIB32=link.exe -lib # PROP Intermediate_Dir "innobase___Win32_nt" # PROP Target_Dir "" # ADD BASE CPP /nologo /G6 /MT /W3 /GX /O2 /I "../innobase/include" /I "../include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "WIN32" /D "_MBCS" /D "MYSQL_SERVER" /YX /FD /c -# ADD CPP /nologo /G6 /MT /W3 /GX /O2 /I "../innobase/include" /I "../include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "WIN32" /D "_MBCS" /D "MYSQL_SERVER" /YX /FD /c +# ADD CPP /nologo /G6 /MT /W3 /GX /O2 /I "../innobase/include" /I "../include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "WIN32" /D "_MBCS" /D "MYSQL_SERVER" /FD /c +# SUBTRACT CPP /YX # ADD BASE RSC /l 0x416 /d "NDEBUG" # ADD RSC /l 0x416 /d "NDEBUG" BSC32=bscmake.exe @@ -112,7 +115,8 @@ LIB32=link.exe -lib # PROP Intermediate_Dir "innobase___Win32_Max_nt" # PROP Target_Dir "" # ADD BASE CPP /nologo /G6 /MT /W3 /GX /O2 /I "../innobase/include" /I "../include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "WIN32" /D "_MBCS" /D "MYSQL_SERVER" /YX /FD /c -# ADD CPP /nologo /G6 /MT /W3 /GX /O2 /I "../innobase/include" /I "../include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "WIN32" /D "_MBCS" /D "MYSQL_SERVER" /YX /FD /c +# ADD CPP /nologo /G6 /MT /W3 /GX /O2 /I "../innobase/include" /I "../include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "WIN32" /D "_MBCS" /D "MYSQL_SERVER" /FD /c +# SUBTRACT CPP /YX # ADD BASE RSC /l 0x416 /d "NDEBUG" # ADD RSC /l 0x416 /d "NDEBUG" BSC32=bscmake.exe diff --git a/VC++Files/myisammrg/myisammrg.dsp b/VC++Files/myisammrg/myisammrg.dsp index e91d1f4e696..e8f86dac0e8 100644 --- a/VC++Files/myisammrg/myisammrg.dsp +++ b/VC++Files/myisammrg/myisammrg.dsp @@ -122,6 +122,10 @@ SOURCE=.\myrg_queue.c # End Source File # Begin Source File +SOURCE=.\myrg_range.c +# End Source File +# Begin Source File + SOURCE=.\myrg_rfirst.c # End Source File # Begin Source File diff --git a/VC++Files/mysqlbinlog/mysqlbinlog.dsp b/VC++Files/mysqlbinlog/mysqlbinlog.dsp index 5d3ff2bb090..94723b0a127 100644 --- a/VC++Files/mysqlbinlog/mysqlbinlog.dsp +++ b/VC++Files/mysqlbinlog/mysqlbinlog.dsp @@ -42,7 +42,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../" /I "../client" /D "NDEBUG" /D "DBUG_OFF" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "MYSQL_SERVER" /FD /c +# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../" /I "../sql" /D "NDEBUG" /D "DBUG_OFF" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "MYSQL_SERVER" /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe @@ -67,7 +67,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /I "../" /I "../client" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "MYSQL_SERVER" /FD /c +# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /I "../" /I "../sql" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "MYSQL_SERVER" /FD /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe @@ -88,7 +88,7 @@ LINK32=link.exe # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File -SOURCE=.\mysqlbinlog.cpp +SOURCE=..\client\mysqlbinlog.cpp # End Source File # End Group # Begin Group "Header Files" diff --git a/VC++Files/mysqldemb/mysqldemb.dsp b/VC++Files/mysqldemb/mysqldemb.dsp index 7b844a68511..25dc1f6fee1 100644 --- a/VC++Files/mysqldemb/mysqldemb.dsp +++ b/VC++Files/mysqldemb/mysqldemb.dsp @@ -41,7 +41,8 @@ RSC=rc.exe # PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /O2 /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "MYSQL_SERVER" /D "HAVE_INNOBASE_DB" /D "DBUG_OFF" /D "USE_TLS" /D "__WIN__" /YX /FD /c +# ADD CPP /nologo /MT /W3 /O2 /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "MYSQL_SERVER" /D "HAVE_INNOBASE_DB" /D "DBUG_OFF" /D "USE_TLS" /D "__WIN__" /FD /c +# SUBTRACT CPP /YX # ADD BASE RSC /l 0x416 /d "NDEBUG"
# ADD RSC /l 0x416 /d "NDEBUG"
BSC32=bscmake.exe
@@ -64,7 +65,8 @@ LIB32=link.exe -lib # PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /Zi /Od /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "MYSQL_SERVER" /D "HAVE_INNOBASE_DB" /D "USE_TLS" /D "__WIN__" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /Zi /Od /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "MYSQL_SERVER" /D "HAVE_INNOBASE_DB" /D "USE_TLS" /D "__WIN__" /FD /GZ /c +# SUBTRACT CPP /YX # ADD BASE RSC /l 0x416 /d "_DEBUG"
# ADD RSC /l 0x416 /d "_DEBUG"
BSC32=bscmake.exe
diff --git a/VC++Files/mysqlserver/mysqlserver.dsp b/VC++Files/mysqlserver/mysqlserver.dsp index 7991131c3a8..84c547ef453 100644 --- a/VC++Files/mysqlserver/mysqlserver.dsp +++ b/VC++Files/mysqlserver/mysqlserver.dsp @@ -41,7 +41,7 @@ RSC=rc.exe # PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /O2 /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "HAVE_INNOBASE_DB" /D "DBUG_OFF" /D "USE_TLS" /D "MYSQL_SERVER" /D "__WIN__" /YX /FD /c +# ADD CPP /nologo /MT /W3 /O2 /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "HAVE_BERKELEY_DB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "HAVE_INNOBASE_DB" /D "DBUG_OFF" /D "USE_TLS" /YX /FD /c # ADD BASE RSC /l 0x416 /d "NDEBUG"
# ADD RSC /l 0x416 /d "NDEBUG"
BSC32=bscmake.exe
@@ -64,7 +64,7 @@ LIB32=link.exe -lib # PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /Zi /Od /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "HAVE_INNOBASE_DB" /D "USE_TLS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /Zi /Od /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "HAVE_BERKELEY_DB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "HAVE_INNOBASE_DB" /D "USE_TLS" /YX /FD /GZ /c # ADD BASE RSC /l 0x416 /d "_DEBUG"
# ADD RSC /l 0x416 /d "_DEBUG"
BSC32=bscmake.exe
@@ -80,13 +80,5 @@ LIB32=link.exe -lib # Name "mysqlserver - Win32 Release"
# Name "mysqlserver - Win32 Debug"
-# Begin Source File - -SOURCE=..\sql\set_var.cpp -# End Source File -# Begin Source File - -SOURCE=..\sql\sql_load.cpp -# End Source File # End Target
# End Project
diff --git a/VC++Files/sql/mysqld.dsp b/VC++Files/sql/mysqld.dsp index 47b61fb9c37..acb1df0c343 100644 --- a/VC++Files/sql/mysqld.dsp +++ b/VC++Files/sql/mysqld.dsp @@ -218,7 +218,7 @@ SOURCE=.\derror.cpp # End Source File # Begin Source File -SOURCE=..\client\errmsg.c +SOURCE=..\libmysql\errmsg.c # End Source File # Begin Source File diff --git a/acinclude.m4 b/acinclude.m4 index 44436bf0b6d..15f08e44c27 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -623,7 +623,7 @@ main() FILE *file=fopen("conftestval", "w"); f = (float) ll; fprintf(file,"%g\n",f); - close(file); + fclose(file); exit (0); }], ac_cv_conv_longlong_to_float=`cat conftestval`, ac_cv_conv_longlong_to_float=0, ifelse([$2], , , ac_cv_conv_longlong_to_float=$2))])dnl if test "$ac_cv_conv_longlong_to_float" = "1" -o "$ac_cv_conv_longlong_to_float" = "yes" @@ -1215,7 +1215,9 @@ changequote(, )dnl hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*) changequote([, ])dnl if test "$GCC" = yes; then - ac_cv_sys_largefile_CFLAGS=-D__STDC_EXT__ + case `$CC --version 2>/dev/null` in + 2.95.*) ac_cv_sys_largefile_CFLAGS=-D__STDC_EXT__ ;; + esac fi ;; # IRIX 6.2 and later require cc -n32. @@ -1330,7 +1332,7 @@ AC_DEFUN(MYSQL_SYS_LARGEFILE, # Local version of _AC_PROG_CXX_EXIT_DECLARATION that does not -# include #stdlib.h as this breaks things on Solaris +# include #stdlib.h as default as this breaks things on Solaris # (Conflicts with pthreads and big file handling) m4_define([_AC_PROG_CXX_EXIT_DECLARATION], @@ -1340,7 +1342,8 @@ m4_define([_AC_PROG_CXX_EXIT_DECLARATION], 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ - 'void exit (int);' + 'void exit (int);' \ + '#include <stdlib.h>' do _AC_COMPILE_IFELSE([AC_LANG_PROGRAM([@%:@include <stdlib.h> $ac_declaration], diff --git a/bdb/db/db_open.c b/bdb/db/db_open.c index f6f96cda547..8352525361f 100644 --- a/bdb/db/db_open.c +++ b/bdb/db/db_open.c @@ -536,11 +536,9 @@ swap_retry: * and even a checksum error isn't a reason to panic the environment. */ if ((ret = __db_chk_meta(dbenv, dbp, meta, do_metachk)) != 0) { - if (ret == -1) { + if (ret == -1) __db_err(dbenv, "%s: metadata page checksum error", name); - ret = EINVAL; - } goto bad_format; } @@ -577,7 +575,7 @@ swap_retry: bad_format: __db_err(dbenv, "%s: unexpected file type or format", name); - return (ret); + return (ret == 0 ? EINVAL : ret); } /* diff --git a/bdb/log/log_put.c b/bdb/log/log_put.c index bf6de2b0f7b..64276fa8315 100644 --- a/bdb/log/log_put.c +++ b/bdb/log/log_put.c @@ -268,6 +268,8 @@ __log_txn_lsn(dbenv, lsnp, mbytesp, bytesp) if (mbytesp != NULL) { *mbytesp = lp->stat.st_wc_mbytes; *bytesp = (u_int32_t)(lp->stat.st_wc_bytes + lp->b_off); + + lp->stat.st_wc_mbytes = lp->stat.st_wc_bytes = 0; } R_UNLOCK(dbenv, &dblp->reginfo); diff --git a/bdb/mp/mp_fopen.c b/bdb/mp/mp_fopen.c index a91bf264652..8fdefb0f5e9 100644 --- a/bdb/mp/mp_fopen.c +++ b/bdb/mp/mp_fopen.c @@ -345,6 +345,23 @@ __memp_fopen_int(dbmfp, mfp, path, flags, mode, pagesize) } /* + * Figure out the file's size. + * + * !!! + * We can't use off_t's here, or in any code in the mainline library + * for that matter. (We have to use them in the os stubs, of course, + * as there are system calls that take them as arguments.) The reason + * is some customers build in environments where an off_t is 32-bits, + * but still run where offsets are 64-bits, and they pay us a lot of + * money. + */ + if ((ret = __os_ioinfo( + dbenv, rpath, dbmfp->fhp, &mbytes, &bytes, NULL)) != 0) { + __db_err(dbenv, "%s: %s", rpath, db_strerror(ret)); + goto err; + } + + /* * Get the file id if we weren't given one. Generated file id's * don't use timestamps, otherwise there'd be no chance of any * other process joining the party. @@ -470,6 +487,7 @@ alloc: /* Allocate and initialize a new MPOOLFILE. */ F_SET(mfp, MP_DIRECT); if (LF_ISSET(DB_EXTENT)) F_SET(mfp, MP_EXTENT); + F_SET(mfp, MP_CAN_MMAP); if (path == NULL) F_SET(mfp, MP_TEMP); @@ -479,21 +497,6 @@ alloc: /* Allocate and initialize a new MPOOLFILE. */ * and find the number of the last page in the file, all the * time being careful not to overflow 32 bits. * - * !!! - * We can't use off_t's here, or in any code in the mainline - * library for that matter. (We have to use them in the os - * stubs, of course, as there are system calls that take them - * as arguments.) The reason is that some customers build in - * environments where an off_t is 32-bits, but still run where - * offsets are 64-bits, and they pay us a lot of money. - */ - if ((ret = __os_ioinfo( - dbenv, rpath, dbmfp->fhp, &mbytes, &bytes, NULL)) != 0) { - __db_err(dbenv, "%s: %s", rpath, db_strerror(ret)); - goto err; - } - - /* * During verify or recovery, we might have to cope with a * truncated file; if the file size is not a multiple of the * page size, round down to a page, we'll take care of the @@ -582,7 +585,7 @@ check_map: * compiler will perpetrate, doing the comparison in a portable way is * flatly impossible. Hope that mmap fails if the file is too large. */ -#define DB_MAXMMAPSIZE (10 * 1024 * 1024) /* 10 Mb. */ +#define DB_MAXMMAPSIZE (10 * 1024 * 1024) /* 10 MB. */ if (F_ISSET(mfp, MP_CAN_MMAP)) { if (path == NULL) F_CLR(mfp, MP_CAN_MMAP); diff --git a/bdb/rep/rep_record.c b/bdb/rep/rep_record.c index e725008786c..d3619f509b4 100644 --- a/bdb/rep/rep_record.c +++ b/bdb/rep/rep_record.c @@ -1198,6 +1198,9 @@ gap_check: lp->wait_recs = 0; * replica get flushed now and again. */ ret = dbenv->log_flush(dbenv, &ckp_lsn); + /* Update the last_ckp in the txn region. */ + if (ret == 0) + __txn_updateckp(dbenv, &rp->lsn); break; case DB___txn_regop: if (!F_ISSET(dbenv, DB_ENV_REP_LOGSONLY)) diff --git a/bdb/txn/txn.c b/bdb/txn/txn.c index 06fc8264afd..78c54791d06 100644 --- a/bdb/txn/txn.c +++ b/bdb/txn/txn.c @@ -1209,18 +1209,7 @@ do_ckp: /* Look through the active transactions for the lowest begin LSN. */ return (ret); } - /* - * We want to make sure last_ckp only moves forward; since - * we drop locks above and in log_put, it's possible - * for two calls to __txn_ckp_log to finish in a different - * order from how they were called. - */ - R_LOCK(dbenv, &mgr->reginfo); - if (log_compare(®ion->last_ckp, &ckp_lsn) < 0) { - region->last_ckp = ckp_lsn; - (void)time(®ion->time_ckp); - } - R_UNLOCK(dbenv, &mgr->reginfo); + __txn_updateckp(dbenv, &ckp_lsn); } return (0); } @@ -1404,3 +1393,36 @@ __txn_reset(dbenv) return (__txn_recycle_log(dbenv, NULL, &scrap, 0, TXN_MINIMUM, TXN_MAXIMUM)); } + +/* + * __txn_updateckp -- + * Update the last_ckp field in the transaction region. This happens + * at the end of a normal checkpoint and also when a replication client + * receives a checkpoint record. + * + * PUBLIC: void __txn_updateckp __P((DB_ENV *, DB_LSN *)); + */ +void +__txn_updateckp(dbenv, lsnp) + DB_ENV *dbenv; + DB_LSN *lsnp; +{ + DB_TXNMGR *mgr; + DB_TXNREGION *region; + + mgr = dbenv->tx_handle; + region = mgr->reginfo.primary; + + /* + * We want to make sure last_ckp only moves forward; since + * we drop locks above and in log_put, it's possible + * for two calls to __txn_ckp_log to finish in a different + * order from how they were called. + */ + R_LOCK(dbenv, &mgr->reginfo); + if (log_compare(®ion->last_ckp, lsnp) < 0) { + region->last_ckp = *lsnp; + (void)time(®ion->time_ckp); + } + R_UNLOCK(dbenv, &mgr->reginfo); +} diff --git a/client/mysql.cc b/client/mysql.cc index 3ddd845c338..f13d601ee42 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -40,7 +40,7 @@ #include <signal.h> #include <violite.h> -const char *VER= "13.1"; +const char *VER= "13.3"; /* Don't try to make a nice table if the data is too big */ #define MAX_COLUMN_LENGTH 1024 @@ -195,7 +195,7 @@ static void end_pager(); static int init_tee(char *); static void end_tee(); static const char* construct_prompt(); -static char *get_arg(char *line); +static char *get_arg(char *line, my_bool get_next_arg); static void init_username(); static void add_int_to_prompt(int toadd); @@ -280,7 +280,8 @@ static void initialize_readline (char *name); #endif static COMMANDS *find_command (char *name,char cmd_name); -static bool add_line(String &buffer,char *line,char *in_string); +static bool add_line(String &buffer,char *line,char *in_string, + bool *ml_comment); static void remove_cntrl(String &buffer); static void print_table_data(MYSQL_RES *result); static void print_table_data_html(MYSQL_RES *result); @@ -388,9 +389,11 @@ int main(int argc,char *argv[]) } } #endif - sprintf(buff, "%s%s", - "Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n", + sprintf(buff, "%s", + "Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n"); +#ifdef NOT_YET "Type 'help [[%]function name[%]]' to get help on usage of function.\n"); +#endif put_info(buff,INFO_INFO); status.exit_status=read_lines(1); // read lines and execute them if (opt_outfile) @@ -662,7 +665,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), opt_nopager= 1; case OPT_MYSQL_PROTOCOL: { - if ((opt_protocol = find_type(argument, &sql_protocol_typelib,0)) == ~(ulong) 0) + if ((opt_protocol = find_type(argument, &sql_protocol_typelib,0)) == + ~(ulong) 0) { fprintf(stderr, "Unknown option to protocol: %s\n", argument); exit(1); @@ -805,9 +809,10 @@ static int read_lines(bool execute_commands) char *line; char in_string=0; ulong line_number=0; + bool ml_comment= 0; COMMANDS *com; status.exit_status=1; - + for (;;) { if (status.batch || !execute_commands) @@ -873,7 +878,7 @@ static int read_lines(bool execute_commands) #endif continue; } - if (add_line(glob_buffer,line,&in_string)) + if (add_line(glob_buffer,line,&in_string,&ml_comment)) break; } /* if in batch mode, send last query even if it doesn't end with \g or go */ @@ -934,7 +939,8 @@ static COMMANDS *find_command (char *name,char cmd_char) } -static bool add_line(String &buffer,char *line,char *in_string) +static bool add_line(String &buffer,char *line,char *in_string, + bool *ml_comment) { uchar inchar; char buff[80],*pos,*out; @@ -965,7 +971,7 @@ static bool add_line(String &buffer,char *line,char *in_string) continue; } #endif - if (inchar == '\\') + if (!*ml_comment && inchar == '\\') { // mSQL or postgreSQL style command ? if (!(inchar = (uchar) *++pos)) break; // readline adds one '\' @@ -999,7 +1005,7 @@ static bool add_line(String &buffer,char *line,char *in_string) continue; } } - else if (inchar == ';' && !*in_string) + else if (!*ml_comment && inchar == ';' && !*in_string) { // ';' is end of command if (out != line) buffer.append(line,(uint) (out-line)); // Add this line @@ -1019,17 +1025,33 @@ static bool add_line(String &buffer,char *line,char *in_string) buffer.length(0); out=line; } - else if (!*in_string && (inchar == '#' || - inchar == '-' && pos[1] == '-' && - my_isspace(system_charset_info,pos[2]))) + else if (!*ml_comment && (!*in_string && (inchar == '#' || + inchar == '-' && pos[1] == '-' && + my_isspace(system_charset_info,pos[2])))) break; // comment to end of line + else if (!*in_string && inchar == '/' && *(pos+1) == '*') + { + pos++; + *ml_comment= 1; + if (out != line) + { + buffer.append(line,(uint) (out-line)); + out=line; + } + } + else if (*ml_comment && !*in_string && inchar == '*' && *(pos+1) == '/') + { + pos++; + *ml_comment= 0; + } else { // Add found char to buffer if (inchar == *in_string) *in_string=0; else if (!*in_string && (inchar == '\'' || inchar == '"')) *in_string=(char) inchar; - *out++ = (char) inchar; + if (!(*ml_comment)) + *out++ = (char) inchar; } } if (out != line || !buffer.is_empty()) @@ -1038,7 +1060,7 @@ static bool add_line(String &buffer,char *line,char *in_string) uint length=(uint) (out-line); if (buffer.length() + length >= buffer.alloced_length()) buffer.realloc(buffer.length()+length+IO_SIZE); - if (buffer.append(line,length)) + if (!(*ml_comment) && buffer.append(line,length)) return 1; } return 0; @@ -1280,7 +1302,7 @@ You can turn off this feature to get a quicker startup with -A\n\n"); sizeof(char *) * (num_fields*2+1)))) break; - field_names[i][num_fields*2]='\0'; + field_names[i][num_fields*2]= '\0'; j=0; while ((sql_field=mysql_fetch_field(fields))) { @@ -1300,7 +1322,7 @@ You can turn off this feature to get a quicker startup with -A\n\n"); { tee_fprintf(stdout, "Didn't find any fields in table '%s'\n",table_row[0]); - field_names[i]=0; + field_names[i]= 0; } i++; } @@ -1388,18 +1410,15 @@ static int com_server_help(String *buffer __attribute__((unused)), MYSQL_ROW cur; const char *server_cmd= buffer->ptr(); char cmd_buf[100]; + MYSQL_RES *result; + int error; - if (help_arg[0]!='\'') + if (help_arg[0] != '\'') { - (void*)sprintf(cmd_buf,"help \'%s\';",help_arg); + (void) strxnmov(cmd_buf, sizeof(cmd_buf), "help '", help_arg, "'", NullS); server_cmd= cmd_buf; } - char buff[16], time_buf[32]; - MYSQL_RES *result; - ulong timer; - uint error= 0; - if (!status.batch) { old_buffer= *buffer; @@ -1409,26 +1428,24 @@ static int com_server_help(String *buffer __attribute__((unused)), if (!connected && reconnect()) return 1; - timer= start_timer(); - - error= mysql_real_query_for_lazy(server_cmd,strlen(server_cmd)); - if (error) + if ((error= mysql_real_query_for_lazy(server_cmd,strlen(server_cmd)))) return error; - - error= mysql_store_result_for_lazy(&result); - if (error) + if ((error= mysql_store_result_for_lazy(&result))) return error; if (result) { int num_rows= mysql_num_rows(result); - if (num_rows==1) + if (num_rows == 1) { if (!(cur= mysql_fetch_row(result))) - return -1; + { + error= -1; + goto err; + } init_pager(); - if (cur[1][0]=='Y') + if (cur[1][0] == 'Y') { tee_fprintf(PAGER, "\nHelp topic \'%s\'\n", cur[0]); tee_fprintf(PAGER, "%s\n", cur[2]); @@ -1442,17 +1459,19 @@ static int com_server_help(String *buffer __attribute__((unused)), } end_pager(); } - else if (num_rows>1) + else if (num_rows > 1) { put_info("\nMany help items for your request exist", INFO_INFO); put_info("For more specific request please type 'help <item>' where item is one of next :", INFO_INFO); init_pager(); char last_char= '_'; - while ((cur= mysql_fetch_row(result))){ - if (cur[1][0]!=last_char){ + while ((cur= mysql_fetch_row(result))) + { + if (cur[1][0]!=last_char) + { put_info("-------------------------------------------", INFO_INFO); - put_info(cur[1][0]=='Y' ? + put_info(cur[1][0] == 'Y' ? "categories:" : "functions:", INFO_INFO); put_info("-------------------------------------------", INFO_INFO); } @@ -1468,6 +1487,7 @@ static int com_server_help(String *buffer __attribute__((unused)), } } +err: mysql_free_result(result); return error; } @@ -2212,23 +2232,21 @@ com_print(String *buffer,char *line __attribute__((unused))) static int com_connect(String *buffer, char *line) { - char *tmp,buff[256]; + char *tmp, buff[256]; bool save_rehash= rehash; int error; + bzero(buff, sizeof(buff)); if (buffer) { - while (my_isspace(system_charset_info,*line)) - line++; - strnmov(buff,line,sizeof(buff)-1); // Don't destroy history - if (buff[0] == '\\') // Short command - buff[1]=' '; - tmp=(char *) strtok(buff," \t"); // Skip connect command - if (tmp && (tmp=(char *) strtok(NullS," \t;"))) + strmov(buff, line); + tmp= get_arg(buff, 0); + if (tmp && *tmp) { - my_free(current_db,MYF(MY_ALLOW_ZERO_PTR)); - current_db=my_strdup(tmp,MYF(MY_WME)); - if ((tmp=(char *) strtok(NullS," \t;"))) + my_free(current_db, MYF(MY_ALLOW_ZERO_PTR)); + current_db= my_strdup(tmp, MYF(MY_WME)); + tmp= get_arg(buff, 1); + if (tmp) { my_free(current_host,MYF(MY_ALLOW_ZERO_PTR)); current_host=my_strdup(tmp,MYF(MY_WME)); @@ -2314,8 +2332,9 @@ com_use(String *buffer __attribute__((unused)), char *line) char *tmp; char buff[256]; + bzero(buff, sizeof(buff)); strmov(buff, line); - tmp= get_arg(buff); + tmp= get_arg(buff, 0); if (!tmp || !*tmp) { put_info("USE must be followed by a database name", INFO_ERROR); @@ -2357,9 +2376,20 @@ com_use(String *buffer __attribute__((unused)), char *line) } + +/* + Gets argument from a command on the command line. If get_next_arg is + not defined, skips the command and returns the first argument. The + line is modified by adding zero to the end of the argument. If + get_next_arg is defined, then the function searches for end of string + first, after found, returns the next argument and adds zero to the + end. If you ever wish to use this feature, remember to initialize all + items in the array to zero first. +*/ + enum quote_type { NO_QUOTE, SQUOTE, DQUOTE, BTICK }; -char *get_arg(char *line) +char *get_arg(char *line, my_bool get_next_arg) { char *ptr; my_bool quoted= 0, valid_arg= 0; @@ -2367,13 +2397,22 @@ char *get_arg(char *line) enum quote_type qtype= NO_QUOTE; ptr= line; - /* skip leading white spaces */ - while (my_isspace(system_charset_info, *ptr)) - ptr++; - if (*ptr == '\\') // short command was used - ptr+= 2; - while (!my_isspace(system_charset_info, *ptr)) // skip command - ptr++; + if (get_next_arg) + { + for (; ptr && *ptr; ptr++); + if ((ptr + 1) && *(ptr + 1)) + ptr++; + } + else + { + /* skip leading white spaces */ + while (my_isspace(system_charset_info, *ptr)) + ptr++; + if (*ptr == '\\') // short command was used + ptr+= 2; + while (!my_isspace(system_charset_info, *ptr)) // skip command + ptr++; + } while (my_isspace(system_charset_info, *ptr)) ptr++; if ((*ptr == '\'' && (qtype= SQUOTE)) || @@ -2396,9 +2435,8 @@ char *get_arg(char *line) ptr= line; ptr+= count; } - else if (!quoted && *ptr == ' ') - *(ptr + 1) = 0; - else if ((*ptr == '\'' && qtype == SQUOTE) || + else if ((!quoted && *ptr == ' ') || + (*ptr == '\'' && qtype == SQUOTE) || (*ptr == '\"' && qtype == DQUOTE) || (*ptr == '`' && qtype == BTICK)) { diff --git a/client/mysqladmin.c b/client/mysqladmin.c index 2c8314d83ca..2fc77552d5f 100644 --- a/client/mysqladmin.c +++ b/client/mysqladmin.c @@ -25,7 +25,7 @@ #include <sys/stat.h> #include <mysql.h> -#define ADMIN_VERSION "8.38" +#define ADMIN_VERSION "8.39" #define MAX_MYSQL_VAR 128 #define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */ #define MAX_TRUNC_LENGTH 3 @@ -76,8 +76,8 @@ static void print_relative_header(); static void print_relative_line(); static void truncate_names(); static my_bool get_pidfile(MYSQL *mysql, char *pidfile); -static void wait_pidfile(char *pidfile, time_t last_modified, - struct stat *pidfile_status); +static my_bool wait_pidfile(char *pidfile, time_t last_modified, + struct stat *pidfile_status); static void store_values(MYSQL_RES *result); /* @@ -513,7 +513,8 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) printf("Shutdown signal sent to server; Waiting for pid file to disappear\n"); /* Wait until pid file is gone */ - wait_pidfile(pidfile, last_modified, &pidfile_status); + if (wait_pidfile(pidfile, last_modified, &pidfile_status)) + return -1; } break; } @@ -1150,34 +1151,51 @@ static my_bool get_pidfile(MYSQL *mysql, char *pidfile) return 1; /* Error */ } +/* + Return 1 if pid file didn't disappear or change +*/ -static void wait_pidfile(char *pidfile, time_t last_modified, - struct stat *pidfile_status) +static my_bool wait_pidfile(char *pidfile, time_t last_modified, + struct stat *pidfile_status) { char buff[FN_REFLEN]; - int fd = -1; - uint count=0; + int error= 1; + uint count= 0; + DBUG_ENTER("wait_pidfile"); system_filename(buff, pidfile); - while (count++ <= opt_shutdown_timeout && !interrupted && - (!last_modified || (last_modified == pidfile_status->st_mtime)) && - (fd= my_open(buff, O_RDONLY, MYF(0))) >= 0) + do { - if (!my_close(fd,MYF(0))) - fd= -1; + int fd; + if ((fd= my_open(buff, O_RDONLY, MYF(0))) < 0) + { + error= 0; + break; + } + (void) my_close(fd,MYF(0)); + if (last_modified && !stat(pidfile, pidfile_status)) + { + if (last_modified != pidfile_status->st_mtime) + { + /* File changed; Let's assume that mysqld did restart */ + if (opt_verbose) + printf("pid file '%s' changed while waiting for it to disappear!\nmysqld did probably restart\n", + buff); + error= 0; + break; + } + } + if (count++ == opt_shutdown_timeout) + break; sleep(1); - if (last_modified && stat(pidfile, pidfile_status)) - last_modified= 0; - } - if (opt_verbose && last_modified && - last_modified != pidfile_status->st_mtime) - printf("Warning; pid file '%s' changed while waiting for it to disappear!\n", - buff); - if (fd >= 0) + } while (!interrupted); + + if (error) { - my_close(fd,MYF(0)); + DBUG_PRINT("warning",("Pid file didn't disappear")); fprintf(stderr, "Warning; Aborted waiting on pid file: '%s' after %d seconds\n", buff, count-1); } + DBUG_RETURN(error); } diff --git a/client/mysqlimport.c b/client/mysqlimport.c index 2de4a9b81b5..408a5873589 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -117,7 +117,7 @@ static struct my_option my_long_options[] = {"port", 'P', "Port number to use for connection.", (gptr*) &opt_mysql_port, (gptr*) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0, 0}, - {"protocol", OPT_MYSQL_PROTOCOL,
"The protocol of connection (tcp,socket,pipe,memory)", + {"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory)", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"replace", 'r', "If duplicate unique key was found, replace old row.", (gptr*) &replace, (gptr*) &replace, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, diff --git a/client/mysqlshow.c b/client/mysqlshow.c index df624a02c55..e6e21f177ef 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -179,7 +179,7 @@ static struct my_option my_long_options[] = {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"protocol", OPT_MYSQL_PROTOCOL,
"The protocol of connection (tcp,socket,pipe,memory)", + {"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory)", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #ifdef HAVE_SMEM {"shared_memory_base_name", OPT_SHARED_MEMORY_BASE_NAME, diff --git a/client/mysqltest.c b/client/mysqltest.c index 14bacddc7e3..4fd7ad9759d 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -42,7 +42,7 @@ **********************************************************************/ -#define MTEST_VERSION "1.25" +#define MTEST_VERSION "1.26" #include <my_global.h> #include <mysql_embed.h> @@ -166,7 +166,8 @@ typedef struct VAR var_reg[10]; /*Perl/shell-like variable registers */ HASH var_hash; -int disable_query_log=0, disable_result_log=0; +my_bool disable_query_log=0, disable_result_log=0, disable_warnings=0; +my_bool disable_info= 1; /* By default off */ struct connection cons[MAX_CONS]; struct connection* cur_con, *next_con, *cons_end; @@ -195,6 +196,8 @@ Q_ENABLE_RESULT_LOG, Q_DISABLE_RESULT_LOG, Q_SERVER_START, Q_SERVER_STOP,Q_REQUIRE_MANAGER, Q_WAIT_FOR_SLAVE_TO_STOP, Q_REQUIRE_VERSION, +Q_ENABLE_WARNINGS, Q_DISABLE_WARNINGS, +Q_ENABLE_INFO, Q_DISABLE_INFO, Q_UNKNOWN, /* Unknown command. */ Q_COMMENT, /* Comments, ignored. */ Q_COMMENT_WITH_COMMAND @@ -253,6 +256,10 @@ const char *command_names[]= "require_manager", "wait_for_slave_to_stop", "require_version", + "enable_warnings", + "disable_warnings", + "enable_info", + "diable_info", 0 }; @@ -1803,10 +1810,8 @@ int read_query(struct st_query** q_ptr) static struct my_option my_long_options[] = { -#ifndef DBUG_OFF {"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 {"database", 'D', "Database to use.", (gptr*) &db, (gptr*) &db, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"basedir", 'b', "Basedir for tests", (gptr*) &opt_basedir, @@ -1899,7 +1904,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), { switch(optid) { case '#': +#ifndef DBUG_OFF DBUG_PUSH(argument ? argument : "d:t:S:i:O,/tmp/mysqltest.trace"); +#endif break; case 'r': record = 1; @@ -1977,7 +1984,7 @@ int parse_args(int argc, char **argv) default_argv= argv; if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) - exit(ho_error); + exit(1); if (argc > 1) { @@ -2170,17 +2177,17 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags) verbose_msg("query '%s' failed: %d: %s", q->query, mysql_errno(mysql), mysql_error(mysql)); /* - if we do not abort on error, failure to run the query does - not fail the whole test case + if we do not abort on error, failure to run the query does + not fail the whole test case */ goto end; } /*{ verbose_msg("failed in mysql_store_result for query '%s' (%d)", query, - mysql_errno(mysql)); + mysql_errno(mysql)); error = 1; goto end; - }*/ + }*/ } if (q->expected_errno[0]) @@ -2191,34 +2198,49 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags) goto end; } - if (!disable_result_log && res) + if (!disable_result_log) { - int num_fields= mysql_num_fields(res); - MYSQL_FIELD *fields= mysql_fetch_fields(res); - for (i = 0; i < num_fields; i++) + if (res) { - if (i) - dynstr_append_mem(ds, "\t", 1); - dynstr_append(ds, fields[i].name); + int num_fields= mysql_num_fields(res); + MYSQL_FIELD *fields= mysql_fetch_fields(res); + for (i = 0; i < num_fields; i++) + { + if (i) + dynstr_append_mem(ds, "\t", 1); + dynstr_append(ds, fields[i].name); + } + dynstr_append_mem(ds, "\n", 1); + append_result(ds, res); } - dynstr_append_mem(ds, "\n", 1); - append_result(ds, res); - } - /* Add all warnings to the result */ - if (!disable_result_log && mysql_warning_count(mysql)) - { - MYSQL_RES *warn_res= mysql_warnings(mysql); - if (!warn_res) - verbose_msg("Warning count is %d but didn't get any warnings\n", - mysql_warning_count(mysql)); - else + /* Add all warnings to the result */ + if (!disable_warnings && mysql_warning_count(mysql)) { - dynstr_append_mem(ds, "Warnings:\n", 10); - append_result(ds, warn_res); - mysql_free_result(warn_res); + MYSQL_RES *warn_res=0; + uint count= mysql_warning_count(mysql); + if (!mysql_real_query(mysql, "SHOW WARNINGS", 13)) + { + warn_res=mysql_store_result(mysql); + } + if (!warn_res) + verbose_msg("Warning count is %u but didn't get any warnings\n", + count); + else + { + dynstr_append_mem(ds, "Warnings:\n", 10); + append_result(ds, warn_res); + mysql_free_result(warn_res); + } + } + if (!disable_info && mysql_info(mysql)) + { + dynstr_append(ds, "info: "); + dynstr_append(ds, mysql_info(mysql)); + dynstr_append_mem(ds, "\n", 1); } } + if (glob_replace) free_replace(); @@ -2427,6 +2449,10 @@ int main(int argc, char** argv) case Q_DISABLE_QUERY_LOG: disable_query_log=1; 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; + case Q_DISABLE_WARNINGS: disable_warnings=1; break; + case Q_ENABLE_INFO: disable_info=0; break; + case Q_DISABLE_INFO: disable_info=1; break; case Q_SOURCE: do_source(q); break; case Q_SLEEP: do_sleep(q, 0); break; case Q_REAL_SLEEP: do_sleep(q, 1); break; diff --git a/configure.in b/configure.in index d25041dea7a..f2e64ddffe4 100644 --- a/configure.in +++ b/configure.in @@ -10,7 +10,7 @@ AM_CONFIG_HEADER(config.h) PROTOCOL_VERSION=10 DOT_FRM_VERSION=6 # See the libtool docs for information on how to do shared lib versions. -SHARED_LIB_VERSION=12:0:0 +SHARED_LIB_VERSION=14:0:0 # Set all version vars based on $VERSION. How do we do this more elegant ? # Remember that regexps needs to quote [ and ] since this is run through m4 @@ -130,18 +130,24 @@ AC_PROG_CXX AC_PROG_CPP # Print version of CC and CXX compiler (if they support --version) -CC_VERSION=`$CC --version` +CC_VERSION=`$CC --version | sed 1q` if test $? -eq "0" then AC_MSG_CHECKING("C Compiler version"); AC_MSG_RESULT("$CC $CC_VERSION") +else +CC_VERSION="" fi -CXX_VERSION=`$CXX --version` +CXX_VERSION=`$CXX --version | sed 1q` if test $? -eq "0" then AC_MSG_CHECKING("C++ compiler version"); AC_MSG_RESULT("$CXX $CXX_VERSION") +else +CXX_VERSION="" fi +AC_SUBST(CXX_VERSION) +AC_SUBST(CC_VERSION) # Fix for sgi gcc / sgiCC which tries to emulate gcc if test "$CC" = "sgicc" @@ -876,6 +882,7 @@ int main() # MAX_C_OPTIMIZE="-O3" +MAX_CXX_OPTIMIZE="-O3" case $SYSTEM_TYPE in *solaris2.7*) @@ -943,6 +950,8 @@ case $SYSTEM_TYPE in then CFLAGS="$CFLAGS +DD64 -DHAVE_BROKEN_INLINE" CXXFLAGS="$CXXFLAGS +DD64 +O2" + MAX_C_OPTIMIZE="" + MAX_CXX_OPTIMIZE="" fi ;; *rhapsody*) @@ -960,8 +969,8 @@ case $SYSTEM_TYPE in *darwin5*) if test "$ac_cv_prog_gcc" = "yes" then - CFLAGS="$CFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH" - CXXFLAGS="$CXXFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ" + CFLAGS="$CFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH -DFN_NO_CASE_SENCE" + CXXFLAGS="$CXXFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DFN_NO_CASE_SENCE" MAX_C_OPTIMIZE="-O" with_named_curses="" fi @@ -969,8 +978,8 @@ case $SYSTEM_TYPE in *darwin6*) if test "$ac_cv_prog_gcc" = "yes" then - CFLAGS="$CFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH" - CXXFLAGS="$CXXFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ" + CFLAGS="$CFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH -DFN_NO_CASE_SENCE" + CXXFLAGS="$CXXFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DFN_NO_CASE_SENCE" MAX_C_OPTIMIZE="-O" fi ;; @@ -1231,7 +1240,7 @@ then # CC="$CC -Kthread -DOpenUNIX8"; # CXX="$CXX -Kthread -DOpenUNIX8"; CC="$CC -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK"; - CXX="$CXX -Kthread -DUNIXWARE_7"; + CXX="$CXX -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK" fi AC_MSG_RESULT("yes") else @@ -1401,7 +1410,7 @@ if test "$ac_cv_prog_cxx_g" = "yes" then DEBUG_CXXFLAGS="-g" DEBUG_OPTIMIZE_CXX="-O" - OPTIMIZE_CXXFLAGS="-O3" + OPTIMIZE_CXXFLAGS="$MAX_CXX_OPTIMIZE" else DEBUG_CXXFLAGS="-g" DEBUG_OPTIMIZE_CXX="" diff --git a/extra/Makefile.am b/extra/Makefile.am index 6895d7a09f8..8107beb2657 100644 --- a/extra/Makefile.am +++ b/extra/Makefile.am @@ -18,7 +18,7 @@ INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include LDADD = @CLIENT_EXTRA_LDFLAGS@ ../mysys/libmysys.a \ ../dbug/libdbug.a ../strings/libmystrings.a bin_PROGRAMS = replace comp_err perror resolveip my_print_defaults \ - resolve_stack_dump mysql_install + resolve_stack_dump mysql_install mysql_waitpid # Don't update the files from bitkeeper %::SCCS/s.% diff --git a/extra/mysql_waitpid.c b/extra/mysql_waitpid.c new file mode 100644 index 00000000000..14d3f893c60 --- /dev/null +++ b/extra/mysql_waitpid.c @@ -0,0 +1,86 @@ +#include <sys/types.h> +#include <signal.h> +#include <errno.h> +#include <string.h> +#include <my_global.h> +#include <my_getopt.h> + +static const char *VER= "1.1"; +static char *progname; +static my_bool verbose; + +void usage(void); + +static struct my_option my_long_options[] = +{ + {"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, + 0, 0, 0, 0, 0}, + {"help", 'I', "Synonym for -?.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, + 0, 0, 0, 0, 0}, + {"verbose", 'v', + "Be more verbose. Give a warning, if kill can't handle signal 0.", + (gptr*) &verbose, (gptr*) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"version", 'V', "Print version information and exit.", 0, 0, 0, + GET_NO_ARG, 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 my_bool +get_one_option(int optid, const struct my_option *opt __attribute__((unused)), + char *argument __attribute__((unused))) +{ + switch(optid) { + case 'V': + printf("%s version %s by Jani Tolonen\n", progname, VER); + exit(-1); + case 'I': + case '?': + usage(); + } + return 0; +} + + +int main(int argc, char *argv[]) +{ + int pid= 0, t= 0, sig= 0; + + progname= argv[0]; + + if (handle_options(&argc, &argv, my_long_options, get_one_option)) + exit(-1); + if (!argv[0] || !argv[1] || (pid= atoi(argv[0])) <= 0 || + (t= atoi(argv[1])) <= 0) + usage(); + for (; t > 0; t--) + { + if (kill((pid_t) pid, sig)) + { + if (errno == EINVAL) + { + if (verbose) + printf("WARNING: kill couldn't handle signal 0, using signal 1.\n"); + sig= 1; + t++; + continue; + } + return 0; + } + sleep(1); + } + return 1; +} + +void usage(void) +{ + printf("%s version %s by Jani Tolonen\n\n", progname, VER); + printf("usage: %s [options] #pid #time\n\n", progname); + printf("Description: Waits for a program, which program id is #pid, to\n"); + printf("terminate within #time seconds. If the program terminates within\n"); + printf("this time, or if the #pid no longer exists, value 0 is returned.\n"); + printf("Otherwise 1 is returned. Both #pid and #time must be positive\n"); + printf("integer arguments.\n\n"); + printf("Options:\n"); + my_print_help(my_long_options); + exit(-1); +} diff --git a/extra/perror.c b/extra/perror.c index 4d05adf29aa..e22ce467949 100644 --- a/extra/perror.c +++ b/extra/perror.c @@ -80,6 +80,7 @@ static HA_ERRORS ha_errlist[]= { 147,"Lock table is full; Restart program with a larger locktable"}, { 148,"Updates are not allowed under a read only transactions"}, { 149,"Lock deadlock; Retry transaction"}, + { 150,"Foreign key constraint is incorrectly formed"}, { -30999, "DB_INCOMPLETE: Sync didn't finish"}, { -30998, "DB_KEYEMPTY: Key/data deleted or never created"}, { -30997, "DB_KEYEXIST: The key/data pair already exists"}, diff --git a/include/Makefile.am b/include/Makefile.am index c88e1ee1e40..652278e8a80 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -16,7 +16,7 @@ # MA 02111-1307, USA BUILT_SOURCES = mysql_version.h m_ctype.h my_config.h -pkginclude_HEADERS = dbug.h m_string.h my_sys.h my_list.h \ +pkginclude_HEADERS = dbug.h m_string.h my_sys.h my_list.h my_xml.h \ mysql.h mysql_com.h mysqld_error.h mysql_embed.h \ my_semaphore.h my_pthread.h my_no_pthread.h raid.h \ errmsg.h my_global.h my_net.h my_alloc.h \ diff --git a/include/m_ctype.h b/include/m_ctype.h index 09a24201588..d99fda8d2b9 100644 --- a/include/m_ctype.h +++ b/include/m_ctype.h @@ -27,6 +27,13 @@ extern "C" { #endif +#define MY_CS_NAME_SIZE 32 +#define MY_CS_CTYPE_TABLE_SIZE 257 +#define MY_CS_TO_LOWER_TABLE_SIZE 256 +#define MY_CS_TO_UPPER_TABLE_SIZE 256 +#define MY_CS_SORT_ORDER_TABLE_SIZE 256 +#define MY_CS_TO_UNI_TABLE_SIZE 256 + #define CHARSET_DIR "charsets/" #define my_wc_t ulong @@ -49,6 +56,7 @@ typedef struct unicase_info_st { #define MY_CS_INDEX 4 /* sets listed in the Index file */ #define MY_CS_LOADED 8 /* sets that are currently loaded */ #define MY_CS_BINSORT 16 /* if binary sort order */ +#define MY_CS_PRIMARY 32 /* if primary collation */ #define MY_CHARSET_UNDEFINED 0 #define MY_CHARSET_CURRENT (default_charset_info->number) @@ -65,6 +73,7 @@ typedef struct charset_info_st { uint number; uint state; + const char *csname; const char *name; const char *comment; uchar *ctype; @@ -127,11 +136,12 @@ typedef struct charset_info_st int (*l10tostr)(struct charset_info_st *, char *to, uint n, int radix, long int val); int (*ll10tostr)(struct charset_info_st *, char *to, uint n, int radix, longlong val); + /* String-to-number convertion routines */ long (*strntol)(struct charset_info_st *, const char *s, uint l,char **e, int base); ulong (*strntoul)(struct charset_info_st *, const char *s, uint l, char **e, int base); longlong (*strntoll)(struct charset_info_st *, const char *s, uint l, char **e, int base); ulonglong (*strntoull)(struct charset_info_st *, const char *s, uint l, char **e, int base); - double (*strntod)(struct charset_info_st *, const char *s, uint l, char **e); + double (*strntod)(struct charset_info_st *, char *s, uint l, char **e); } CHARSET_INFO; @@ -142,7 +152,8 @@ extern CHARSET_INFO *default_charset_info; extern CHARSET_INFO *system_charset_info; extern CHARSET_INFO *all_charsets[256]; extern my_bool init_compiled_charsets(myf flags); - +extern my_bool my_parse_charset_xml(const char *bug, uint len, + int (*add)(CHARSET_INFO *cs)); /* declarations for simple charsets */ extern int my_strnxfrm_simple(CHARSET_INFO *, uchar *, uint, const uchar *, uint); @@ -175,7 +186,7 @@ long my_strntol_8bit(CHARSET_INFO *, const char *s, uint l,char **e, int ulong my_strntoul_8bit(CHARSET_INFO *, const char *s, uint l,char **e, int base); longlong my_strntoll_8bit(CHARSET_INFO *, const char *s, uint l,char **e, int base); ulonglong my_strntoull_8bit(CHARSET_INFO *, const char *s, uint l,char **e, int base); -double my_strntod_8bit(CHARSET_INFO *, const char *s, uint l,char **e); +double my_strntod_8bit(CHARSET_INFO *, char *s, uint l,char **e); int my_l10tostr_8bit(CHARSET_INFO *, char *to, uint l, int radix, long int val); int my_ll10tostr_8bit(CHARSET_INFO *, char *to, uint l, int radix, longlong val); diff --git a/include/m_string.h b/include/m_string.h index c6943613b1a..15a488fe72a 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -31,6 +31,9 @@ #include <string.h> #endif +/* need by my_vsnprintf */ +#include <stdarg.h> + /* Correct some things for UNIXWARE7 */ #ifdef HAVE_UNIXWARE7_THREADS #undef HAVE_STRINGS_H @@ -238,6 +241,12 @@ extern ulonglong strtoull(const char *str, char **ptr, int base); #endif #endif +/* my_vsnprintf.c */ + +extern int my_vsnprintf( char *str, size_t n, + const char *format, va_list ap ); +extern int my_snprintf(char* to, size_t n, const char* fmt, ...); + #if defined(__cplusplus) && !defined(OS2) } #endif diff --git a/include/my_base.h b/include/my_base.h index ccca3f74ec4..b16a545b937 100644 --- a/include/my_base.h +++ b/include/my_base.h @@ -107,9 +107,6 @@ enum ha_extra_function { HA_EXTRA_IGNORE_DUP_KEY, /* Dup keys don't rollback everything*/ HA_EXTRA_NO_IGNORE_DUP_KEY, HA_EXTRA_DONT_USE_CURSOR_TO_UPDATE, /* Cursor will not be used for update */ - HA_EXTRA_BULK_INSERT_BEGIN, - HA_EXTRA_BULK_INSERT_FLUSH, /* Flush one index */ - HA_EXTRA_BULK_INSERT_END, HA_EXTRA_PREPARE_FOR_DELETE, HA_EXTRA_PREPARE_FOR_UPDATE /* Remove read cache if problems */ }; @@ -267,6 +264,7 @@ enum ha_base_keytype { #define MBR_EQUAL 8192 #define MBR_DATA 16384 #define SEARCH_NULL_ARE_EQUAL 32768 /* NULL in keys are equal */ +#define SEARCH_NULL_ARE_NOT_EQUAL 65536 /* NULL in keys are not equal */ /* bits in opt_flag */ #define QUICK_USED 1 diff --git a/include/my_sys.h b/include/my_sys.h index ab5dedc0ba1..3d81a9e9219 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -206,6 +206,7 @@ extern const char *get_charset_name(uint cs_number); extern CHARSET_INFO *get_charset(uint cs_number, myf flags); extern my_bool set_default_charset(uint cs, myf flags); extern CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags); +extern CHARSET_INFO *get_charset_by_csname(const char *cs_name, myf flags); extern my_bool set_default_charset_by_name(const char *cs_name, myf flags); extern void free_charsets(void); extern char *list_charsets(myf want_flags); /* my_free() this string... */ @@ -505,6 +506,8 @@ extern int my_setwd(const char *dir,myf MyFlags); extern int my_lock(File fd,int op,my_off_t start, my_off_t length,myf MyFlags); extern gptr my_once_alloc(uint Size,myf MyFlags); extern void my_once_free(void); +extern char *my_once_strdup(const char *src,myf myflags); +extern char *my_once_memdup(const char *src, uint len, myf myflags); extern my_string my_tempnam(const char *dir,const char *pfx,myf MyFlags); extern File my_open(const char *FileName,int Flags,myf MyFlags); extern File my_register_filename(File fd, const char *FileName, @@ -566,9 +569,6 @@ extern int my_error _VARARGS((int nr,myf MyFlags, ...)); extern int my_printf_error _VARARGS((uint my_err, const char *format, myf MyFlags, ...) __attribute__ ((format (printf, 2, 4)))); -extern int my_vsnprintf( char *str, size_t n, - const char *format, va_list ap ); -extern int my_snprintf(char* to, size_t n, const char* fmt, ...); extern int my_message(uint my_err, const char *str,myf MyFlags); extern int my_message_no_curses(uint my_err, const char *str,myf MyFlags); extern int my_message_curses(uint my_err, const char *str,myf MyFlags); diff --git a/include/my_xml.h b/include/my_xml.h new file mode 100644 index 00000000000..0d968ab38c7 --- /dev/null +++ b/include/my_xml.h @@ -0,0 +1,61 @@ +/* Copyright (C) 2000 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + +#ifndef _my_xml_h +#define _my_xml_h + +#ifdef __cplusplus +extern "C" { +#endif + + +#define MY_XML_OK 0 +#define MY_XML_ERROR 1 + +typedef struct xml_stack_st +{ + char errstr[128]; + char attr[128]; + char *attrend; + const char *beg; + const char *cur; + const char *end; + void *user_data; + int (*enter)(struct xml_stack_st *st,const char *val, uint len); + int (*value)(struct xml_stack_st *st,const char *val, uint len); + int (*leave)(struct xml_stack_st *st,const char *val, uint len); +} MY_XML_PARSER; + +void my_xml_parser_create(MY_XML_PARSER *st); +void my_xml_parser_free(MY_XML_PARSER *st); +int my_xml_parse(MY_XML_PARSER *st,const char *str, uint len); + +void my_xml_set_value_handler(MY_XML_PARSER *st, int (*)(MY_XML_PARSER *, const char *, uint len)); +void my_xml_set_enter_handler(MY_XML_PARSER *st, int (*)(MY_XML_PARSER *, const char *, uint len)); +void my_xml_set_leave_handler(MY_XML_PARSER *st, int (*)(MY_XML_PARSER *, const char *, uint len)); +void my_xml_set_user_data(MY_XML_PARSER *st, void *); + +uint my_xml_error_pos(MY_XML_PARSER *st); +uint my_xml_error_lineno(MY_XML_PARSER *st); + +const char *my_xml_error_string(MY_XML_PARSER *st); + +#ifdef __cplusplus +} +#endif + +#endif /* _my_xml_h */ diff --git a/include/myisam.h b/include/myisam.h index 4f8fc149ba1..5c4a5345d37 100644 --- a/include/myisam.h +++ b/include/myisam.h @@ -397,6 +397,10 @@ void mi_disable_non_unique_index(MI_INFO *info, ha_rows rows); my_bool mi_test_if_sort_rep(MI_INFO *info, ha_rows rows, ulonglong key_map, my_bool force); +int mi_init_bulk_insert(MI_INFO *info, ulong cache_size, ha_rows rows); +void mi_flush_bulk_insert(MI_INFO *info, uint inx); +void mi_end_bulk_insert(MI_INFO *info); + #ifdef __cplusplus } #endif diff --git a/include/myisammrg.h b/include/myisammrg.h index 16d3528717b..8b09e1a9231 100644 --- a/include/myisammrg.h +++ b/include/myisammrg.h @@ -51,6 +51,7 @@ typedef struct st_mymerge_info /* Struct from h_info */ uint reclength; /* Recordlength */ int errkey; /* With key was dupplicated on err */ uint options; /* HA_OPTION_... used */ + ulong *rec_per_key; /* for sql optimizing */ } MYMERGE_INFO; typedef struct st_myrg_table_info @@ -71,6 +72,7 @@ typedef struct st_myrg_info my_bool cache_in_use; LIST open_list; QUEUE by_key; + ulong *rec_per_key_part; /* for sql optimizing */ } MYRG_INFO; diff --git a/include/mysql.h b/include/mysql.h index cb82e1988f6..acf0618c8e8 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -130,6 +130,7 @@ struct st_mysql_options { char *ssl_ca; /* PEM CA file */ char *ssl_capath; /* PEM directory of CA-s? */ char *ssl_cipher; /* cipher to use */ + unsigned long max_allowed_packet; my_bool use_ssl; /* if to use SSL or not */ my_bool compress,named_pipe; /* @@ -415,7 +416,6 @@ MYSQL_RES * STDCALL mysql_list_fields(MYSQL *mysql, const char *table, MYSQL_RES * STDCALL mysql_list_processes(MYSQL *mysql); MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql); MYSQL_RES * STDCALL mysql_use_result(MYSQL *mysql); -MYSQL_RES * STDCALL mysql_warnings(MYSQL *mysql); int STDCALL mysql_options(MYSQL *mysql,enum mysql_option option, const char *arg); void STDCALL mysql_free_result(MYSQL_RES *result); @@ -473,13 +473,12 @@ typedef struct st_mysql_bind { long *length; /* output length pointer */ gptr buffer; /* buffer */ - unsigned long buffer_length; /* buffer length */ enum enum_field_types buffer_type; /* buffer type */ - enum enum_field_types field_type; /* field type */ my_bool is_null; /* NULL indicator */ my_bool is_long_data; /* long data indicator */ /* The following are for internal use. Set by mysql_bind_param */ + unsigned long buffer_length; /* buffer length */ long bind_length; /* Default length of data */ my_bool long_ended; /* All data supplied for long */ unsigned int param_number; /* For null count and error messages */ @@ -536,15 +535,16 @@ int STDCALL mysql_multi_query(MYSQL *mysql,const char *query, unsigned long len); MYSQL_RES *STDCALL mysql_next_result(MYSQL *mysql); MYSQL_RES *STDCALL mysql_prepare_result(MYSQL_STMT *stmt); +my_ulonglong STDCALL mysql_stmt_affected_rows(MYSQL_STMT *stmt); /* new status messages */ -#define MYSQL_SUCCESS 0 -#define MYSQL_WARNING 1 -#define MYSQL_STATUS_ERROR 2 -#define MYSQL_NO_DATA 100 -#define MYSQL_NEED_DATA 99 -#define MYSQL_LONG_DATA_END 0xFF +#define MYSQL_SUCCESS 0 +#define MYSQL_STATUS_ERROR 1 +#define MYSQL_NO_DATA 100 +#define MYSQL_NEED_DATA 99 +#define MYSQL_NULL_DATA (-1) +#define MYSQL_LONG_DATA (-2) #define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT) diff --git a/include/mysql_com.h b/include/mysql_com.h index 49bf2ba017e..3d68b876596 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -42,7 +42,8 @@ enum enum_server_command COM_PROCESS_INFO, COM_CONNECT, COM_PROCESS_KILL, COM_DEBUG, COM_PING, COM_TIME, COM_DELAYED_INSERT, COM_CHANGE_USER, COM_BINLOG_DUMP, COM_TABLE_DUMP, COM_CONNECT_OUT, COM_REGISTER_SLAVE, - COM_PREPARE, COM_EXECUTE, COM_LONG_DATA, COM_CLOSE_STMT + COM_PREPARE, COM_EXECUTE, COM_LONG_DATA, COM_CLOSE_STMT, + COM_END /* Must be last */ }; @@ -297,11 +298,11 @@ int get_password_length(my_bool force_old_scramble); char get_password_version(const char* password); void create_random_string(int length,struct rand_struct *rand_st,char* target); my_bool validate_password(const char* password, const char* message, - ulong* salt); + unsigned long* salt); void password_hash_stage1(char *to, const char *password); void password_hash_stage2(char *to,const char *salt); void password_crypt(const char* from,char* to, const char* password,int length); -void get_hash_and_password(ulong* salt, unsigned char pversion,char* hash, +void get_hash_and_password(unsigned long* salt, unsigned char pversion,char* hash, unsigned char* bin_password); void get_salt_from_password(unsigned long *res,const char *password); void create_key_from_old_password(const char* password,char* key); diff --git a/include/mysqld_error.h b/include/mysqld_error.h index 81a24e89164..377f714bfff 100644 --- a/include/mysqld_error.h +++ b/include/mysqld_error.h @@ -265,4 +265,5 @@ #define ER_DERIVED_MUST_HAVE_ALIAS 1246 #define ER_SELECT_REDUCED 1247 #define ER_TABLENAME_NOT_ALLOWED_HERE 1248 -#define ER_ERROR_MESSAGES 249 +#define ER_NOT_SUPPORTED_AUTH_MODE 1249 +#define ER_ERROR_MESSAGES 250 diff --git a/innobase/btr/btr0cur.c b/innobase/btr/btr0cur.c index 24f0447d55d..e1d12c9adc4 100644 --- a/innobase/btr/btr0cur.c +++ b/innobase/btr/btr0cur.c @@ -291,6 +291,7 @@ btr_cur_search_to_nth_level( && latch_mode <= BTR_MODIFY_LEAF && info->last_hash_succ && !estimate && mode != PAGE_CUR_LE_OR_EXTENDS + && srv_use_adaptive_hash_indexes && btr_search_guess_on_hash(index, info, tuple, mode, latch_mode, cursor, has_search_latch, mtr)) { @@ -495,9 +496,11 @@ retry_page_get: cursor->up_bytes = up_bytes; #ifdef BTR_CUR_ADAPT - btr_search_info_update(index, cursor); -#endif + if (srv_use_adaptive_hash_indexes) { + btr_search_info_update(index, cursor); + } +#endif ut_ad(cursor->up_match != ULINT_UNDEFINED || mode != PAGE_CUR_GE); ut_ad(cursor->up_match != ULINT_UNDEFINED diff --git a/innobase/btr/btr0pcur.c b/innobase/btr/btr0pcur.c index b2115dfdd6c..13efacb9da3 100644 --- a/innobase/btr/btr0pcur.c +++ b/innobase/btr/btr0pcur.c @@ -95,7 +95,9 @@ btr_pcur_store_position( ut_a(cursor->latch_mode != BTR_NO_LATCHES); if (page_get_n_recs(page) == 0) { - /* It must be an empty index tree */ + /* It must be an empty index tree; NOTE that in this case + we do not store the modify_clock, but always do a search + if we restore the cursor position */ ut_a(btr_page_get_next(page, mtr) == FIL_NULL && btr_page_get_prev(page, mtr) == FIL_NULL); @@ -128,12 +130,13 @@ btr_pcur_store_position( } else { cursor->rel_pos = BTR_PCUR_ON; } - + cursor->old_stored = BTR_PCUR_OLD_STORED; cursor->old_rec = dict_tree_copy_rec_order_prefix(tree, rec, &(cursor->old_rec_buf), &(cursor->buf_size)); + cursor->block_when_stored = buf_block_align(page); cursor->modify_clock = buf_frame_get_modify_clock(page); } @@ -205,6 +208,9 @@ btr_pcur_restore_position( if (cursor->rel_pos == BTR_PCUR_AFTER_LAST_IN_TREE || cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE) { + /* In these cases we do not try an optimistic restoration, + but always do a search */ + if (cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE) { from_left = TRUE; } else { @@ -214,6 +220,10 @@ btr_pcur_restore_position( btr_cur_open_at_index_side(from_left, btr_pcur_get_btr_cur(cursor)->index, latch_mode, btr_pcur_get_btr_cur(cursor), mtr); + + cursor->block_when_stored = + buf_block_align(btr_pcur_get_page(cursor)); + return(FALSE); } @@ -224,8 +234,9 @@ btr_pcur_restore_position( if (latch_mode == BTR_SEARCH_LEAF || latch_mode == BTR_MODIFY_LEAF) { /* Try optimistic restoration */ - if (buf_page_optimistic_get(latch_mode, page, - cursor->modify_clock, mtr)) { + if (buf_page_optimistic_get(latch_mode, + cursor->block_when_stored, page, + cursor->modify_clock, mtr)) { cursor->pos_state = BTR_PCUR_IS_POSITIONED; buf_page_dbg_add_level(page, SYNC_TREE_NODE); @@ -270,8 +281,6 @@ btr_pcur_restore_position( btr_pcur_open_with_no_init(btr_pcur_get_btr_cur(cursor)->index, tuple, mode, latch_mode, cursor, 0, mtr); - - cursor->old_stored = BTR_PCUR_OLD_STORED; /* Restore the old search mode */ cursor->search_mode = old_mode; @@ -280,11 +289,18 @@ btr_pcur_restore_position( && btr_pcur_is_on_user_rec(cursor, mtr) && 0 == cmp_dtuple_rec(tuple, btr_pcur_get_rec(cursor))) { - /* We have to store the NEW value for the modify clock, since - the cursor can now be on a different page! */ + /* We have to store the NEW value for the modify clock, since + the cursor can now be on a different page! But we can retain + the value of old_rec */ + + cursor->modify_clock = + buf_frame_get_modify_clock(btr_pcur_get_page(cursor)); + + cursor->block_when_stored = + buf_block_align(btr_pcur_get_page(cursor)); + + cursor->old_stored = BTR_PCUR_OLD_STORED; - cursor->modify_clock = buf_frame_get_modify_clock( - buf_frame_align(btr_pcur_get_rec(cursor))); mem_heap_free(heap); return(TRUE); @@ -292,6 +308,12 @@ btr_pcur_restore_position( mem_heap_free(heap); + /* We have to store new position information, modify_clock etc., + to the cursor because it can now be on a different page, the record + under it may have been removed, etc. */ + + btr_pcur_store_position(cursor, mtr); + return(FALSE); } diff --git a/innobase/btr/btr0sea.c b/innobase/btr/btr0sea.c index cef3a4e4b38..de3fe6e196e 100644 --- a/innobase/btr/btr0sea.c +++ b/innobase/btr/btr0sea.c @@ -19,6 +19,9 @@ Created 2/17/1996 Heikki Tuuri #include "btr0btr.h" #include "ha0ha.h" +ulint btr_search_this_is_zero = 0; /* A dummy variable to fool the + compiler */ + ulint btr_search_n_succ = 0; ulint btr_search_n_hash_fail = 0; @@ -56,16 +59,20 @@ before hash index building is started */ /************************************************************************ Builds a hash index on a page with the given parameters. If the page already -has a hash index with different parameters, the old hash index is removed. */ +has a hash index with different parameters, the old hash index is removed. +If index is non-NULL, this function checks if n_fields and n_bytes are +sensible values, and does not build a hash index if not. */ static void btr_search_build_page_hash_index( /*=============================*/ - page_t* page, /* in: index page, s- or x-latched */ - ulint n_fields, /* in: hash this many full fields */ - ulint n_bytes, /* in: hash this many bytes from the next + dict_index_t* index, /* in: index for which to build, or NULL if + not known */ + page_t* page, /* in: index page, s- or x-latched */ + ulint n_fields,/* in: hash this many full fields */ + ulint n_bytes,/* in: hash this many bytes from the next field */ - ulint side); /* in: hash for searches from this side */ + ulint side); /* in: hash for searches from this side */ /********************************************************************* This function should be called before reserving any btr search mutex, if @@ -173,7 +180,9 @@ btr_search_info_create( } /************************************************************************* -Updates the search info of an index about hash successes. */ +Updates the search info of an index about hash successes. NOTE that info +is NOT protected by any semaphore, to save CPU time! Do not assume its fields +are consistent. */ static void btr_search_info_update_hash( @@ -295,7 +304,9 @@ set_new_recomm: } /************************************************************************* -Updates the block search info on hash successes. */ +Updates the block search info on hash successes. NOTE that info and +block->n_hash_helps, n_fields, n_bytes, side are NOT protected by any +semaphore, to save CPU time! Do not assume the fields are consistent. */ static ibool btr_search_update_block_hash_info( @@ -425,12 +436,19 @@ btr_search_info_update_slow( { buf_block_t* block; ibool build_index; - + ulint* params; + ulint* params2; + ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED) && !rw_lock_own(&btr_search_latch, RW_LOCK_EX)); block = buf_block_align(btr_cur_get_rec(cursor)); + /* NOTE that the following two function calls do NOT protect + info or block->n_fields etc. with any semaphore, to save CPU time! + We cannot assume the fields are consistent when we return from + those functions! */ + btr_search_info_update_hash(info, cursor); build_index = btr_search_update_block_hash_info(info, block, cursor); @@ -439,7 +457,7 @@ btr_search_info_update_slow( btr_search_check_free_space_in_heap(); } - + if (cursor->flag == BTR_CUR_HASH_FAIL) { /* Update the hash node reference, if appropriate */ @@ -453,12 +471,30 @@ btr_search_info_update_slow( } if (build_index) { - ut_a(block->n_fields + block->n_bytes > 0); - - btr_search_build_page_hash_index(block->frame, - block->n_fields, - block->n_bytes, - block->side); + /* Note that since we did not protect block->n_fields etc. + with any semaphore, the values can be inconsistent. We have + to check inside the function call that they make sense. We + also malloc an array and store the values there to make sure + the compiler does not let the function call parameters change + inside the called function. It might be that the compiler + would optimize the call just to pass pointers to block. */ + + params = mem_alloc(3 * sizeof(ulint)); + params[0] = block->n_fields; + params[1] = block->n_bytes; + params[2] = block->side; + + /* Make sure the compiler cannot deduce the values and do + optimizations */ + + params2 = params + btr_search_this_is_zero; + + btr_search_build_page_hash_index(cursor->index, + block->frame, + params2[0], + params2[1], + params2[2]); + mem_free(params); } } @@ -976,16 +1012,20 @@ btr_search_drop_page_hash_when_freed( /************************************************************************ Builds a hash index on a page with the given parameters. If the page already -has a hash index with different parameters, the old hash index is removed. */ +has a hash index with different parameters, the old hash index is removed. +If index is non-NULL, this function checks if n_fields and n_bytes are +sensible values, and does not build a hash index if not. */ static void btr_search_build_page_hash_index( /*=============================*/ - page_t* page, /* in: index page, s- or x-latched */ - ulint n_fields, /* in: hash this many full fields */ - ulint n_bytes, /* in: hash this many bytes from the next + dict_index_t* index, /* in: index for which to build, or NULL if + not known */ + page_t* page, /* in: index page, s- or x-latched */ + ulint n_fields,/* in: hash this many full fields */ + ulint n_bytes,/* in: hash this many bytes from the next field */ - ulint side) /* in: hash for searches from this side */ + ulint side) /* in: hash for searches from this side */ { hash_table_t* table; buf_block_t* block; @@ -1028,7 +1068,18 @@ btr_search_build_page_hash_index( return; } - ut_a(n_fields + n_bytes > 0); + /* Check that the values for hash index build are sensible */ + + if (n_fields + n_bytes == 0) { + + return; + } + + if (index && (dict_index_get_n_unique_in_tree(index) < n_fields + || (dict_index_get_n_unique_in_tree(index) == n_fields + && n_bytes > 0))) { + return; + } /* Calculate and cache fold values and corresponding records into an array for fast insertion to the hash index */ @@ -1186,8 +1237,8 @@ btr_search_move_or_delete_hash_entries( ut_a(n_fields + n_bytes > 0); - btr_search_build_page_hash_index(new_page, n_fields, n_bytes, - side); + btr_search_build_page_hash_index(NULL, new_page, n_fields, + n_bytes, side); ut_a(n_fields == block->curr_n_fields); ut_a(n_bytes == block->curr_n_bytes); ut_a(side == block->curr_side); diff --git a/innobase/buf/buf0buf.c b/innobase/buf/buf0buf.c index c9a5ec5307f..3c6ec424434 100644 --- a/innobase/buf/buf0buf.c +++ b/innobase/buf/buf0buf.c @@ -196,7 +196,29 @@ If a new page is referenced in the buf_pool, and several pages of its random access area (for instance, 32 consecutive pages in a tablespace) have recently been referenced, we may predict that the whole area may be needed in the near future, and issue -the read requests for the whole area. */ +the read requests for the whole area. + + AWE implementation + ------------------ + +By a 'block' we mean the buffer header of type buf_block_t. By a 'page' +we mean the physical 16 kB memory area allocated from RAM for that block. +By a 'frame' we mean a 16 kB area in the virtual address space of the +process, in the frame_mem of buf_pool. + +We can map pages to the frames of the buffer pool. + +1) A buffer block allocated to use as a non-data page, e.g., to the lock +table, is always mapped to a frame. +2) A bufferfixed or io-fixed data page is always mapped to a frame. +3) When we need to map a block to frame, we look from the list +awe_LRU_free_mapped and try to unmap its last block, but note that +bufferfixed or io-fixed pages cannot be unmapped. +4) For every frame in the buffer pool there is always a block whose page is +mapped to it. When we create the buffer pool, we map the first elements +in the free list to the frames. +5) When we have AWE enabled, we disable adaptive hash indexes. +*/ buf_pool_t* buf_pool = NULL; /* The buffer buf_pool of the database */ @@ -346,12 +368,15 @@ void buf_block_init( /*===========*/ buf_block_t* block, /* in: pointer to control block */ - byte* frame) /* in: pointer to buffer frame */ + byte* frame) /* in: pointer to buffer frame, or NULL if in + the case of AWE there is no frame */ { block->state = BUF_BLOCK_NOT_USED; block->frame = frame; + block->awe_info = NULL; + block->modify_clock = ut_dulint_zero; block->file_page_was_freed = FALSE; @@ -360,34 +385,48 @@ buf_block_init( rw_lock_create(&(block->lock)); ut_ad(rw_lock_validate(&(block->lock))); - - rw_lock_create(&(block->read_lock)); - rw_lock_set_level(&(block->read_lock), SYNC_NO_ORDER_CHECK); +#ifdef UNIV_SYNC_DEBUG rw_lock_create(&(block->debug_latch)); rw_lock_set_level(&(block->debug_latch), SYNC_NO_ORDER_CHECK); +#endif } /************************************************************************ -Creates a buffer buf_pool object. */ -static +Creates the buffer pool. */ + buf_pool_t* -buf_pool_create( -/*============*/ +buf_pool_init( +/*==========*/ /* out, own: buf_pool object, NULL if not - enough memory */ + enough memory or error */ ulint max_size, /* in: maximum size of the buf_pool in blocks */ - ulint curr_size) /* in: current size to use, must be <= + ulint curr_size, /* in: current size to use, must be <= max_size, currently must be equal to max_size */ + ulint n_frames) /* in: number of frames; if AWE is used, + this is the size of the address space window + where physical memory pages are mapped; if + AWE is not used then this must be the same + as max_size */ { byte* frame; ulint i; buf_block_t* block; ut_a(max_size == curr_size); + ut_a(srv_use_awe || n_frames == max_size); + if (n_frames > curr_size) { + fprintf(stderr, +"InnoDB: AWE: Error: you must specify in my.cnf .._awe_mem_mb larger\n" +"InnoDB: than .._buffer_pool_size. Now the former is %lu pages,\n" +"InnoDB: the latter %lu pages.\n", curr_size, n_frames); + + return(NULL); + } + buf_pool = mem_alloc(sizeof(buf_pool_t)); /* 1. Initialize general fields @@ -396,8 +435,38 @@ buf_pool_create( mutex_set_level(&(buf_pool->mutex), SYNC_BUF_POOL); mutex_enter(&(buf_pool->mutex)); - - buf_pool->frame_mem = ut_malloc(UNIV_PAGE_SIZE * (max_size + 1)); + + if (srv_use_awe) { + /*----------------------------------------*/ + /* Allocate the virtual address space window, i.e., the + buffer pool frames */ + + buf_pool->frame_mem = os_awe_allocate_virtual_mem_window( + UNIV_PAGE_SIZE * (n_frames + 1)); + + /* Allocate the physical memory for AWE and the AWE info array + for buf_pool */ + + if ((curr_size % ((1024 * 1024) / UNIV_PAGE_SIZE)) != 0) { + + fprintf(stderr, +"InnoDB: AWE: Error: physical memory must be allocated in full megabytes.\n" +"InnoDB: Trying to allocate %lu database pages.\n", + curr_size); + + return(NULL); + } + + if (!os_awe_allocate_physical_mem(&(buf_pool->awe_info), + curr_size / ((1024 * 1024) / UNIV_PAGE_SIZE))) { + + return(NULL); + } + /*----------------------------------------*/ + } else { + buf_pool->frame_mem = ut_malloc( + UNIV_PAGE_SIZE * (n_frames + 1)); + } if (buf_pool->frame_mem == NULL) { @@ -414,21 +483,60 @@ buf_pool_create( buf_pool->max_size = max_size; buf_pool->curr_size = curr_size; + buf_pool->n_frames = n_frames; + /* Align pointer to the first frame */ frame = ut_align(buf_pool->frame_mem, UNIV_PAGE_SIZE); + buf_pool->frame_zero = frame; + buf_pool->high_end = frame + UNIV_PAGE_SIZE * n_frames; + + if (srv_use_awe) { + /*----------------------------------------*/ + /* Map an initial part of the allocated physical memory to + the window */ + + os_awe_map_physical_mem_to_window(buf_pool->frame_zero, + n_frames * + (UNIV_PAGE_SIZE / OS_AWE_X86_PAGE_SIZE), + buf_pool->awe_info); + /*----------------------------------------*/ + } + + buf_pool->blocks_of_frames = ut_malloc(sizeof(void*) * n_frames); + + if (buf_pool->blocks_of_frames == NULL) { + + return(NULL); + } - buf_pool->high_end = frame + UNIV_PAGE_SIZE * curr_size; + /* Init block structs and assign frames for them; in the case of + AWE there are less frames than blocks. Then we assign the frames + to the first blocks (we already mapped the memory above). We also + init the awe_info for every block. */ - /* Init block structs and assign frames for them */ for (i = 0; i < max_size; i++) { block = buf_pool_get_nth_block(buf_pool, i); + + if (i < n_frames) { + frame = buf_pool->frame_zero + i * UNIV_PAGE_SIZE; + *(buf_pool->blocks_of_frames + i) = block; + } else { + frame = NULL; + } + buf_block_init(block, frame); - frame = frame + UNIV_PAGE_SIZE; + + if (srv_use_awe) { + /*----------------------------------------*/ + block->awe_info = buf_pool->awe_info + + i * (UNIV_PAGE_SIZE / OS_AWE_X86_PAGE_SIZE); + /*----------------------------------------*/ + } } - + buf_pool->page_hash = hash_create(2 * max_size); buf_pool->n_pend_reads = 0; @@ -438,12 +546,14 @@ buf_pool_create( buf_pool->n_pages_read = 0; buf_pool->n_pages_written = 0; buf_pool->n_pages_created = 0; - + buf_pool->n_pages_awe_remapped = 0; + buf_pool->n_page_gets = 0; buf_pool->n_page_gets_old = 0; buf_pool->n_pages_read_old = 0; buf_pool->n_pages_written_old = 0; buf_pool->n_pages_created_old = 0; + buf_pool->n_pages_awe_remapped_old = 0; /* 2. Initialize flushing fields ---------------------------- */ @@ -466,40 +576,120 @@ buf_pool_create( buf_pool->LRU_old = NULL; + UT_LIST_INIT(buf_pool->awe_LRU_free_mapped); + /* Add control blocks to the free list */ UT_LIST_INIT(buf_pool->free); + for (i = 0; i < curr_size; i++) { block = buf_pool_get_nth_block(buf_pool, i); - /* Wipe contents of page to eliminate a Purify warning */ - memset(block->frame, '\0', UNIV_PAGE_SIZE); + if (block->frame) { + /* Wipe contents of frame to eliminate a Purify + warning */ + + memset(block->frame, '\0', UNIV_PAGE_SIZE); - UT_LIST_ADD_FIRST(free, buf_pool->free, block); + if (srv_use_awe) { + /* Add to the list of blocks mapped to + frames */ + + UT_LIST_ADD_LAST(awe_LRU_free_mapped, + buf_pool->awe_LRU_free_mapped, block); + } + } + + UT_LIST_ADD_LAST(free, buf_pool->free, block); } mutex_exit(&(buf_pool->mutex)); - btr_search_sys_create(curr_size * UNIV_PAGE_SIZE / sizeof(void*) / 64); + if (srv_use_adaptive_hash_indexes) { + btr_search_sys_create( + curr_size * UNIV_PAGE_SIZE / sizeof(void*) / 64); + } else { + /* Create only a small dummy system */ + btr_search_sys_create(1000); + } return(buf_pool); } /************************************************************************ -Initializes the buffer buf_pool of the database. */ +Maps the page of block to a frame, if not mapped yet. Unmaps some page +from the end of the awe_LRU_free_mapped. */ void -buf_pool_init( -/*==========*/ - ulint max_size, /* in: maximum size of the buf_pool in blocks */ - ulint curr_size) /* in: current size to use, must be <= - max_size */ +buf_awe_map_page_to_frame( +/*======================*/ + buf_block_t* block, /* in: block whose page should be + mapped to a frame */ + ibool add_to_mapped_list) /* in: TRUE if we in the case + we need to map the page should also + add the block to the + awe_LRU_free_mapped list */ { - ut_a(buf_pool == NULL); + buf_block_t* bck; - buf_pool_create(max_size, curr_size); + ut_ad(mutex_own(&(buf_pool->mutex))); + ut_ad(block); + + if (block->frame) { + + return; + } + + /* Scan awe_LRU_free_mapped from the end and try to find a block + which is not bufferfixed or io-fixed */ + + bck = UT_LIST_GET_LAST(buf_pool->awe_LRU_free_mapped); + + while (bck) { + if (bck->state == BUF_BLOCK_FILE_PAGE + && (bck->buf_fix_count != 0 || bck->io_fix != 0)) { + + /* We have to skip this */ + bck = UT_LIST_GET_PREV(awe_LRU_free_mapped, bck); + } else { + /* We can map block to the frame of bck */ + + os_awe_map_physical_mem_to_window( + bck->frame, + UNIV_PAGE_SIZE / OS_AWE_X86_PAGE_SIZE, + block->awe_info); + + block->frame = bck->frame; + + *(buf_pool->blocks_of_frames + + (((ulint)(block->frame + - buf_pool->frame_zero)) + >> UNIV_PAGE_SIZE_SHIFT)) + = block; + + bck->frame = NULL; + UT_LIST_REMOVE(awe_LRU_free_mapped, + buf_pool->awe_LRU_free_mapped, + bck); + + if (add_to_mapped_list) { + UT_LIST_ADD_FIRST(awe_LRU_free_mapped, + buf_pool->awe_LRU_free_mapped, + block); + } + + buf_pool->n_pages_awe_remapped++; + + return; + } + } + + fprintf(stderr, +"InnoDB: AWE: Fatal error: cannot find a page to unmap\n" +"InnoDB: awe_LRU_free_mapped list length %lu\n", + UT_LIST_GET_LEN(buf_pool->awe_LRU_free_mapped)); - ut_ad(buf_validate()); + ut_a(0); } /************************************************************************ @@ -508,7 +698,9 @@ UNIV_INLINE buf_block_t* buf_block_alloc(void) /*=================*/ - /* out, own: the allocated block */ + /* out, own: the allocated block; also if AWE + is used it is guaranteed that the page is + mapped to a frame */ { buf_block_t* block; @@ -846,6 +1038,19 @@ loop: } } + /* If AWE is enabled and the page is not mapped to a frame, then + map it */ + + if (block->frame == NULL) { + ut_a(srv_use_awe); + + /* We set second parameter TRUE because the block is in the + LRU list and we must put it to awe_LRU_free_mapped list once + mapped to a frame */ + + buf_awe_map_page_to_frame(block, TRUE); + } + #ifdef UNIV_SYNC_DEBUG buf_block_buf_fix_inc_debug(block, file, line); #else @@ -900,8 +1105,26 @@ loop: } else if (rw_latch == RW_NO_LATCH) { if (must_read) { - rw_lock_x_lock(&(block->read_lock)); - rw_lock_x_unlock(&(block->read_lock)); + /* Let us wait until the read operation + completes */ + + for (;;) { + mutex_enter(&(buf_pool->mutex)); + + if (block->io_fix == BUF_IO_READ) { + + mutex_exit(&(buf_pool->mutex)); + + /* Sleep 20 milliseconds */ + + os_thread_sleep(20000); + } else { + + mutex_exit(&(buf_pool->mutex)); + + break; + } + } } fix_type = MTR_MEMO_BUF_FIX; @@ -940,28 +1163,27 @@ buf_page_optimistic_get_func( /*=========================*/ /* out: TRUE if success */ ulint rw_latch,/* in: RW_S_LATCH, RW_X_LATCH */ - buf_frame_t* guess, /* in: guessed frame */ + buf_block_t* block, /* in: guessed buffer block */ + buf_frame_t* guess, /* in: guessed frame; note that AWE may move + frames */ dulint modify_clock,/* in: modify clock value if mode is ..._GUESS_ON_CLOCK */ char* file, /* in: file name */ ulint line, /* in: line where called */ mtr_t* mtr) /* in: mini-transaction */ { - buf_block_t* block; ibool accessed; ibool success; ulint fix_type; - ut_ad(mtr && guess); + ut_ad(mtr && block); ut_ad((rw_latch == RW_S_LATCH) || (rw_latch == RW_X_LATCH)); - - buf_pool->n_page_gets++; - - block = buf_block_align(guess); mutex_enter(&(buf_pool->mutex)); - if (block->state != BUF_BLOCK_FILE_PAGE) { + /* If AWE is used, block may have a different frame now, e.g., NULL */ + + if (block->state != BUF_BLOCK_FILE_PAGE || block->frame != guess) { mutex_exit(&(buf_pool->mutex)); @@ -1054,12 +1276,15 @@ buf_page_optimistic_get_func( #ifdef UNIV_IBUF_DEBUG ut_a(ibuf_count_get(block->space, block->offset) == 0); #endif + buf_pool->n_page_gets++; + return(TRUE); } /************************************************************************ This is used to get access to a known database page, when no waiting can be -done. */ +done. For example, if a search in an adaptive hash index leads us to this +frame. */ ibool buf_page_get_known_nowait( @@ -1078,13 +1303,11 @@ buf_page_get_known_nowait( ut_ad(mtr); ut_ad((rw_latch == RW_S_LATCH) || (rw_latch == RW_X_LATCH)); - - buf_pool->n_page_gets++; - - block = buf_block_align(guess); mutex_enter(&(buf_pool->mutex)); + block = buf_block_align(guess); + if (block->state == BUF_BLOCK_REMOVE_HASH) { /* Another thread is just freeing the block from the LRU list of the buffer pool: do not try to access this page; this @@ -1152,6 +1375,8 @@ buf_page_get_known_nowait( ut_a((mode == BUF_KEEP_OLD) || (ibuf_count_get(block->space, block->offset) == 0)); #endif + buf_pool->n_page_gets++; + return(TRUE); } @@ -1322,8 +1547,6 @@ buf_page_init_for_read( is completed. The x-lock is cleared by the io-handler thread. */ rw_lock_x_lock_gen(&(block->lock), BUF_IO_READ); - - rw_lock_x_lock_gen(&(block->read_lock), BUF_IO_READ); mutex_exit(&(buf_pool->mutex)); @@ -1546,9 +1769,7 @@ buf_page_io_complete( buf_pool->n_pend_reads--; buf_pool->n_pages_read++; - rw_lock_x_unlock_gen(&(block->lock), BUF_IO_READ); - rw_lock_x_unlock_gen(&(block->read_lock), BUF_IO_READ); if (buf_debug_prints) { printf("Has read "); @@ -1732,7 +1953,7 @@ buf_print(void) ut_ad(buf_pool); - size = buf_pool_get_curr_size() / UNIV_PAGE_SIZE; + size = buf_pool->curr_size; index_ids = mem_alloc(sizeof(dulint) * size); counts = mem_alloc(sizeof(ulint) * size); @@ -1847,7 +2068,7 @@ buf_print_io( return; } - size = buf_pool_get_curr_size() / UNIV_PAGE_SIZE; + size = buf_pool->curr_size; mutex_enter(&(buf_pool->mutex)); @@ -1866,6 +2087,15 @@ buf_print_io( buf += sprintf(buf, "Modified db pages %lu\n", UT_LIST_GET_LEN(buf_pool->flush_list)); + if (srv_use_awe) { + buf += sprintf(buf, + "AWE: Buffer pool memory frames %lu\n", + buf_pool->n_frames); + + buf += sprintf(buf, + "AWE: Database pages and free buffers mapped in frames %lu\n", + UT_LIST_GET_LEN(buf_pool->awe_LRU_free_mapped)); + } buf += sprintf(buf, "Pending reads %lu \n", buf_pool->n_pend_reads); @@ -1891,6 +2121,13 @@ buf_print_io( (buf_pool->n_pages_written - buf_pool->n_pages_written_old) / time_elapsed); + if (srv_use_awe) { + buf += sprintf(buf, "AWE: %.2f page remaps/s\n", + (buf_pool->n_pages_awe_remapped + - buf_pool->n_pages_awe_remapped_old) + / time_elapsed); + } + if (buf_pool->n_page_gets > buf_pool->n_page_gets_old) { buf += sprintf(buf, "Buffer pool hit rate %lu / 1000\n", 1000 @@ -1906,6 +2143,7 @@ buf_print_io( buf_pool->n_pages_read_old = buf_pool->n_pages_read; buf_pool->n_pages_created_old = buf_pool->n_pages_created; buf_pool->n_pages_written_old = buf_pool->n_pages_written; + buf_pool->n_pages_awe_remapped_old = buf_pool->n_pages_awe_remapped; mutex_exit(&(buf_pool->mutex)); } @@ -1922,6 +2160,7 @@ buf_refresh_io_stats(void) buf_pool->n_pages_read_old = buf_pool->n_pages_read; buf_pool->n_pages_created_old = buf_pool->n_pages_created; buf_pool->n_pages_written_old = buf_pool->n_pages_written; + buf_pool->n_pages_awe_remapped_old = buf_pool->n_pages_awe_remapped; } /************************************************************************* diff --git a/innobase/buf/buf0flu.c b/innobase/buf/buf0flu.c index 78bde60c9b2..02587487a92 100644 --- a/innobase/buf/buf0flu.c +++ b/innobase/buf/buf0flu.c @@ -24,6 +24,7 @@ Created 11/11/1995 Heikki Tuuri #include "log0log.h" #include "os0file.h" #include "trx0sys.h" +#include "srv0srv.h" /* When flushed, dirty blocks are searched in neigborhoods of this size, and flushed along with the original page. */ @@ -103,7 +104,7 @@ buf_flush_ready_for_replace( /*========================*/ /* out: TRUE if can replace immediately */ buf_block_t* block) /* in: buffer control block, must be in state - BUF_BLOCK_FILE_PAGE and in the LRU list*/ + BUF_BLOCK_FILE_PAGE and in the LRU list */ { ut_ad(mutex_own(&(buf_pool->mutex))); ut_ad(block->state == BUF_BLOCK_FILE_PAGE); @@ -134,7 +135,6 @@ buf_flush_ready_for_flush( if ((ut_dulint_cmp(block->oldest_modification, ut_dulint_zero) > 0) && (block->io_fix == 0)) { - if (flush_type != BUF_FLUSH_LRU) { return(TRUE); @@ -436,6 +436,20 @@ buf_flush_try_page( && block && buf_flush_ready_for_flush(block, flush_type)) { block->io_fix = BUF_IO_WRITE; + + /* If AWE is enabled and the page is not mapped to a frame, + then map it */ + + if (block->frame == NULL) { + ut_a(srv_use_awe); + + /* We set second parameter TRUE because the block is + in the LRU list and we must put it to + awe_LRU_free_mapped list once mapped to a frame */ + + buf_awe_map_page_to_frame(block, TRUE); + } + block->flush_type = flush_type; if (buf_pool->n_flush[flush_type] == 0) { @@ -486,6 +500,20 @@ buf_flush_try_page( ..._ready_for_flush). */ block->io_fix = BUF_IO_WRITE; + + /* If AWE is enabled and the page is not mapped to a frame, + then map it */ + + if (block->frame == NULL) { + ut_a(srv_use_awe); + + /* We set second parameter TRUE because the block is + in the LRU list and we must put it to + awe_LRU_free_mapped list once mapped to a frame */ + + buf_awe_map_page_to_frame(block, TRUE); + } + block->flush_type = flush_type; if (buf_pool->n_flush[flush_type] == 0) { @@ -511,6 +539,20 @@ buf_flush_try_page( && buf_flush_ready_for_flush(block, flush_type)) { block->io_fix = BUF_IO_WRITE; + + /* If AWE is enabled and the page is not mapped to a frame, + then map it */ + + if (block->frame == NULL) { + ut_a(srv_use_awe); + + /* We set second parameter TRUE because the block is + in the LRU list and we must put it to + awe_LRU_free_mapped list once mapped to a frame */ + + buf_awe_map_page_to_frame(block, TRUE); + } + block->flush_type = flush_type; if (buf_pool->n_flush[block->flush_type] == 0) { diff --git a/innobase/buf/buf0lru.c b/innobase/buf/buf0lru.c index 2ec1506c522..051aa0191f6 100644 --- a/innobase/buf/buf0lru.c +++ b/innobase/buf/buf0lru.c @@ -132,7 +132,13 @@ buf_LRU_search_and_free_block( mutex_exit(&(buf_pool->mutex)); - btr_search_drop_page_hash_index(block->frame); + /* Remove possible adaptive hash index built on the + page; in the case of AWE the block may not have a + frame at all */ + + if (block->frame) { + btr_search_drop_page_hash_index(block->frame); + } mutex_enter(&(buf_pool->mutex)); @@ -196,7 +202,9 @@ list. */ buf_block_t* buf_LRU_get_free_block(void) /*========================*/ - /* out: the free control block */ + /* out: the free control block; also if AWE is + used, it is guaranteed that the block has its + page mapped to a frame when we return */ { buf_block_t* block = NULL; ibool freed; @@ -257,6 +265,22 @@ loop: block = UT_LIST_GET_FIRST(buf_pool->free); UT_LIST_REMOVE(free, buf_pool->free, block); + + if (srv_use_awe) { + if (block->frame) { + /* Remove from the list of mapped pages */ + + UT_LIST_REMOVE(awe_LRU_free_mapped, + buf_pool->awe_LRU_free_mapped, block); + } else { + /* We map the page to a frame; second param + FALSE below because we do not want it to be + added to the awe_LRU_free_mapped list */ + + buf_awe_map_page_to_frame(block, FALSE); + } + } + block->state = BUF_BLOCK_READY_FOR_USE; mutex_exit(&(buf_pool->mutex)); @@ -429,6 +453,13 @@ buf_LRU_remove_block( /* Remove the block from the LRU list */ UT_LIST_REMOVE(LRU, buf_pool->LRU, block); + if (srv_use_awe && block->frame) { + /* Remove from the list of mapped pages */ + + UT_LIST_REMOVE(awe_LRU_free_mapped, + buf_pool->awe_LRU_free_mapped, block); + } + /* If the LRU list is so short that LRU_old not defined, return */ if (UT_LIST_GET_LEN(buf_pool->LRU) < BUF_LRU_OLD_MIN_LEN) { @@ -475,6 +506,13 @@ buf_LRU_add_block_to_end_low( UT_LIST_ADD_LAST(LRU, buf_pool->LRU, block); + if (srv_use_awe && block->frame) { + /* Add to the list of mapped pages */ + + UT_LIST_ADD_LAST(awe_LRU_free_mapped, + buf_pool->awe_LRU_free_mapped, block); + } + if (UT_LIST_GET_LEN(buf_pool->LRU) >= BUF_LRU_OLD_MIN_LEN) { buf_pool->LRU_old_len++; @@ -518,6 +556,15 @@ buf_LRU_add_block_low( block->old = old; cl = buf_pool_clock_tic(); + if (srv_use_awe && block->frame) { + /* Add to the list of mapped pages; for simplicity we always + add to the start, even if the user would have set 'old' + TRUE */ + + UT_LIST_ADD_FIRST(awe_LRU_free_mapped, + buf_pool->awe_LRU_free_mapped, block); + } + if (!old || (UT_LIST_GET_LEN(buf_pool->LRU) < BUF_LRU_OLD_MIN_LEN)) { UT_LIST_ADD_FIRST(LRU, buf_pool->LRU, block); @@ -613,6 +660,13 @@ buf_LRU_block_free_non_file_page( memset(block->frame, '\0', UNIV_PAGE_SIZE); #endif UT_LIST_ADD_FIRST(free, buf_pool->free, block); + + if (srv_use_awe && block->frame) { + /* Add to the list of mapped pages */ + + UT_LIST_ADD_FIRST(awe_LRU_free_mapped, + buf_pool->awe_LRU_free_mapped, block); + } } /********************************************************************** @@ -639,7 +693,9 @@ buf_LRU_block_remove_hashed_page( buf_pool->freed_page_clock += 1; - buf_frame_modify_clock_inc(block->frame); + /* Note that if AWE is enabled the block may not have a frame at all */ + + buf_block_modify_clock_inc(block); HASH_DELETE(buf_block_t, hash, buf_pool->page_hash, buf_page_address_fold(block->space, block->offset), diff --git a/innobase/buf/buf0rea.c b/innobase/buf/buf0rea.c index 475a5bd9cbd..bb6670296b9 100644 --- a/innobase/buf/buf0rea.c +++ b/innobase/buf/buf0rea.c @@ -576,7 +576,7 @@ buf_read_recv_pages( os_aio_print_debug = FALSE; - while (buf_pool->n_pend_reads >= RECV_POOL_N_FREE_BLOCKS / 2) { + while (buf_pool->n_pend_reads >= recv_n_pool_free_frames / 2) { os_aio_simulated_wake_handler_threads(); os_thread_sleep(500000); diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c index 18f27602cf0..c70e848c5c8 100644 --- a/innobase/dict/dict0dict.c +++ b/innobase/dict/dict0dict.c @@ -1113,6 +1113,7 @@ dict_index_add_to_cache( ulint n_ord; ibool success; ulint i; + ulint j; ut_ad(index); ut_ad(mutex_own(&(dict_sys->mutex))); @@ -1143,6 +1144,28 @@ dict_index_add_to_cache( return(FALSE); } + /* Check that the same column does not appear twice in the index. + InnoDB assumes this in its algorithms, e.g., update of an index + entry */ + + for (i = 0; i < dict_index_get_n_fields(index); i++) { + + for (j = 0; j < i; j++) { + if (dict_index_get_nth_field(index, j)->col + == dict_index_get_nth_field(index, i)->col) { + + ut_print_timestamp(stderr); + + fprintf(stderr, +" InnoDB: Error: column %s appears twice in index %s of table %s\n" +"InnoDB: This is not allowed in InnoDB.\n" +"InnoDB: UPDATE can cause such an index to become corrupt in InnoDB.\n", + dict_index_get_nth_field(index, i)->col->name, + index->name, table->name); + } + } + } + /* Build the cache internal representation of the index, containing also the added system fields */ @@ -2212,6 +2235,9 @@ dict_create_foreign_constraints( ulint error; ulint i; ulint j; + ibool is_on_delete; + ulint n_on_deletes; + ulint n_on_updates; dict_col_t* columns[500]; char* column_names[500]; ulint column_name_lens[500]; @@ -2371,6 +2397,12 @@ col_loop2: return(DB_CANNOT_ADD_CONSTRAINT); } + n_on_deletes = 0; + n_on_updates = 0; + +scan_on_conditions: + /* Loop here as long as we can find ON ... conditions */ + ptr = dict_accept(ptr, "ON", &success); if (!success) { @@ -2381,23 +2413,58 @@ col_loop2: ptr = dict_accept(ptr, "DELETE", &success); if (!success) { - dict_foreign_free(foreign); + ptr = dict_accept(ptr, "UPDATE", &success); + + if (!success) { + + dict_foreign_free(foreign); - return(DB_CANNOT_ADD_CONSTRAINT); + return(DB_CANNOT_ADD_CONSTRAINT); + } + + is_on_delete = FALSE; + n_on_updates++; + } else { + is_on_delete = TRUE; + n_on_deletes++; } ptr = dict_accept(ptr, "RESTRICT", &success); if (success) { - goto try_find_index; + goto scan_on_conditions; } ptr = dict_accept(ptr, "CASCADE", &success); if (success) { - foreign->type = DICT_FOREIGN_ON_DELETE_CASCADE; + if (is_on_delete) { + foreign->type |= DICT_FOREIGN_ON_DELETE_CASCADE; + } else { + foreign->type |= DICT_FOREIGN_ON_UPDATE_CASCADE; + } - goto try_find_index; + goto scan_on_conditions; + } + + ptr = dict_accept(ptr, "NO", &success); + + if (success) { + ptr = dict_accept(ptr, "ACTION", &success); + + if (!success) { + dict_foreign_free(foreign); + + return(DB_CANNOT_ADD_CONSTRAINT); + } + + if (is_on_delete) { + foreign->type |= DICT_FOREIGN_ON_DELETE_NO_ACTION; + } else { + foreign->type |= DICT_FOREIGN_ON_UPDATE_NO_ACTION; + } + + goto scan_on_conditions; } ptr = dict_accept(ptr, "SET", &success); @@ -2430,20 +2497,23 @@ col_loop2: } } - foreign->type = DICT_FOREIGN_ON_DELETE_SET_NULL; + if (is_on_delete) { + foreign->type |= DICT_FOREIGN_ON_DELETE_SET_NULL; + } else { + foreign->type |= DICT_FOREIGN_ON_UPDATE_SET_NULL; + } -try_find_index: - /* We check that there are no superfluous words like 'ON UPDATE ...' - which we do not support yet. */ + goto scan_on_conditions; - ptr = dict_accept(ptr, (char *) "ON", &success); - - if (success) { +try_find_index: + if (n_on_deletes > 1 || n_on_updates > 1) { + /* It is an error to define more than 1 action */ + dict_foreign_free(foreign); return(DB_CANNOT_ADD_CONSTRAINT); } - + /* Try to find an index which contains the columns as the first fields and in the right order, and the types are the same as in foreign->foreign_index */ @@ -3265,7 +3335,8 @@ dict_print_info_on_foreign_keys_in_create_format( /*=============================================*/ char* buf, /* in: auxiliary buffer */ char* str, /* in/out: pointer to a string */ - ulint len, /* in: space in str available for info */ + ulint len, /* in: str has to be a buffer at least + len + 5000 bytes */ dict_table_t* table) /* in: table */ { @@ -3335,14 +3406,30 @@ dict_print_info_on_foreign_keys_in_create_format( buf2 += sprintf(buf2, ")"); - if (foreign->type == DICT_FOREIGN_ON_DELETE_CASCADE) { + if (foreign->type & DICT_FOREIGN_ON_DELETE_CASCADE) { buf2 += sprintf(buf2, " ON DELETE CASCADE"); } - if (foreign->type == DICT_FOREIGN_ON_DELETE_SET_NULL) { + if (foreign->type & DICT_FOREIGN_ON_DELETE_SET_NULL) { buf2 += sprintf(buf2, " ON DELETE SET NULL"); } + if (foreign->type & DICT_FOREIGN_ON_DELETE_NO_ACTION) { + buf2 += sprintf(buf2, " ON DELETE NO ACTION"); + } + + if (foreign->type & DICT_FOREIGN_ON_UPDATE_CASCADE) { + buf2 += sprintf(buf2, " ON UPDATE CASCADE"); + } + + if (foreign->type & DICT_FOREIGN_ON_UPDATE_SET_NULL) { + buf2 += sprintf(buf2, " ON UPDATE SET NULL"); + } + + if (foreign->type & DICT_FOREIGN_ON_UPDATE_NO_ACTION) { + buf2 += sprintf(buf2, " ON UPDATE NO ACTION"); + } + foreign = UT_LIST_GET_NEXT(foreign_list, foreign); } no_space: @@ -3434,6 +3521,22 @@ dict_print_info_on_foreign_keys( buf2 += sprintf(buf2, " ON DELETE SET NULL"); } + if (foreign->type & DICT_FOREIGN_ON_DELETE_NO_ACTION) { + buf2 += sprintf(buf2, " ON DELETE NO ACTION"); + } + + if (foreign->type & DICT_FOREIGN_ON_UPDATE_CASCADE) { + buf2 += sprintf(buf2, " ON UPDATE CASCADE"); + } + + if (foreign->type & DICT_FOREIGN_ON_UPDATE_SET_NULL) { + buf2 += sprintf(buf2, " ON UPDATE SET NULL"); + } + + if (foreign->type & DICT_FOREIGN_ON_UPDATE_NO_ACTION) { + buf2 += sprintf(buf2, " ON UPDATE NO ACTION"); + } + foreign = UT_LIST_GET_NEXT(foreign_list, foreign); } no_space: diff --git a/innobase/fsp/fsp0fsp.c b/innobase/fsp/fsp0fsp.c index ff586819d4a..ee48288b875 100644 --- a/innobase/fsp/fsp0fsp.c +++ b/innobase/fsp/fsp0fsp.c @@ -2479,20 +2479,20 @@ try_again: n_free = n_free_list_ext + n_free_up; if (alloc_type == FSP_NORMAL) { - /* We reserve 1 extent + 4 % of the space size to undo logs - and 1 extent + 1 % to cleaning operations; NOTE: this source + /* We reserve 1 extent + 0.5 % of the space size to undo logs + and 1 extent + 0.5 % to cleaning operations; NOTE: this source code is duplicated in the function below! */ - reserve = 2 + ((size / FSP_EXTENT_SIZE) * 5) / 100; + reserve = 2 + ((size / FSP_EXTENT_SIZE) * 2) / 200; if (n_free <= reserve + n_ext) { goto try_to_extend; } } else if (alloc_type == FSP_UNDO) { - /* We reserve 1 % of the space size to cleaning operations */ + /* We reserve 0.5 % of the space size to cleaning operations */ - reserve = 1 + ((size / FSP_EXTENT_SIZE) * 1) / 100; + reserve = 1 + ((size / FSP_EXTENT_SIZE) * 1) / 200; if (n_free <= reserve + n_ext) { @@ -2572,11 +2572,11 @@ fsp_get_available_space_in_free_extents( n_free = n_free_list_ext + n_free_up; - /* We reserve 1 extent + 4 % of the space size to undo logs - and 1 extent + 1 % to cleaning operations; NOTE: this source + /* We reserve 1 extent + 0.5 % of the space size to undo logs + and 1 extent + 0.5 % to cleaning operations; NOTE: this source code is duplicated in the function above! */ - reserve = 2 + ((size / FSP_EXTENT_SIZE) * 5) / 100; + reserve = 2 + ((size / FSP_EXTENT_SIZE) * 2) / 200; if (reserve > n_free) { return(0); diff --git a/innobase/ibuf/ibuf0ibuf.c b/innobase/ibuf/ibuf0ibuf.c index 143b3bfa584..668e9419c24 100644 --- a/innobase/ibuf/ibuf0ibuf.c +++ b/innobase/ibuf/ibuf0ibuf.c @@ -2657,10 +2657,7 @@ reset_bit: new_bits, &mtr); } } - - ibuf_data->n_merges++; - ibuf_data->n_merged_recs += n_inserts; - + #ifdef UNIV_IBUF_DEBUG /* printf("Ibuf merge %lu records volume %lu to page no %lu\n", n_inserts, volume, page_no); */ @@ -2670,6 +2667,14 @@ reset_bit: mem_heap_free(heap); + /* Protect our statistics keeping from race conditions */ + mutex_enter(&ibuf_mutex); + + ibuf_data->n_merges++; + ibuf_data->n_merged_recs += n_inserts; + + mutex_exit(&ibuf_mutex); + ibuf_exit(); #ifdef UNIV_IBUF_DEBUG ut_a(ibuf_count_get(space, page_no) == 0); diff --git a/innobase/include/btr0pcur.h b/innobase/include/btr0pcur.h index 9d07dd0de18..81f19af4d40 100644 --- a/innobase/include/btr0pcur.h +++ b/innobase/include/btr0pcur.h @@ -466,6 +466,9 @@ struct btr_pcur_struct{ BTR_PCUR_AFTER, depending on whether cursor was on, before, or after the old_rec record */ + buf_block_t* block_when_stored;/* buffer block when the position was + stored; note that if AWE is on, frames + may move */ dulint modify_clock; /* the modify clock value of the buffer block when the cursor position was stored */ diff --git a/innobase/include/buf0buf.h b/innobase/include/buf0buf.h index f76c437bd1d..81eeb7fced8 100644 --- a/innobase/include/buf0buf.h +++ b/innobase/include/buf0buf.h @@ -30,6 +30,7 @@ Created 11/5/1995 Heikki Tuuri #include "sync0rw.h" #include "hash0hash.h" #include "ut0byte.h" +#include "os0proc.h" /* Flags for flush types */ #define BUF_FLUSH_LRU 1 @@ -58,23 +59,34 @@ extern ibool buf_debug_prints;/* If this is set TRUE, the program occurs */ /************************************************************************ -Initializes the buffer pool of the database. */ +Creates the buffer pool. */ -void +buf_pool_t* buf_pool_init( /*==========*/ - ulint max_size, /* in: maximum size of the pool in blocks */ - ulint curr_size); /* in: current size to use, must be <= + /* out, own: buf_pool object, NULL if not + enough memory or error */ + ulint max_size, /* in: maximum size of the buf_pool in + blocks */ + ulint curr_size, /* in: current size to use, must be <= + max_size, currently must be equal to max_size */ + ulint n_frames); /* in: number of frames; if AWE is used, + this is the size of the address space window + where physical memory pages are mapped; if + AWE is not used then this must be the same + as max_size */ /************************************************************************* -Gets the current size of buffer pool in bytes. */ +Gets the current size of buffer buf_pool in bytes. In the case of AWE, the +size of AWE window (= the frames). */ UNIV_INLINE ulint buf_pool_get_curr_size(void); /*========================*/ /* out: size in bytes */ /************************************************************************* -Gets the maximum size of buffer pool in bytes. */ +Gets the maximum size of buffer pool in bytes. In the case of AWE, the +size of AWE window (= the frames). */ UNIV_INLINE ulint buf_pool_get_max_size(void); @@ -138,8 +150,8 @@ improve debugging. Only values RW_S_LATCH and RW_X_LATCH are allowed as LA! */ NOTE! The following macros should be used instead of buf_page_optimistic_get_func, to improve debugging. Only values RW_S_LATCH and RW_X_LATCH are allowed as LA! */ -#define buf_page_optimistic_get(LA, G, MC, MTR) buf_page_optimistic_get_func(\ - LA, G, MC, IB__FILE__, __LINE__, MTR) +#define buf_page_optimistic_get(LA, BL, G, MC, MTR) buf_page_optimistic_get_func(\ + LA, BL, G, MC, IB__FILE__, __LINE__, MTR) /************************************************************************ This is the general function used to get optimistic access to a database page. */ @@ -149,7 +161,9 @@ buf_page_optimistic_get_func( /*=========================*/ /* out: TRUE if success */ ulint rw_latch,/* in: RW_S_LATCH, RW_X_LATCH */ - buf_frame_t* guess, /* in: guessed frame */ + buf_block_t* block, /* in: guessed block */ + buf_frame_t* guess, /* in: guessed frame; note that AWE may move + frames */ dulint modify_clock,/* in: modify clock value if mode is ..._GUESS_ON_CLOCK */ char* file, /* in: file name */ @@ -350,6 +364,16 @@ buf_frame_modify_clock_inc( /* out: new value */ buf_frame_t* frame); /* in: pointer to a frame */ /************************************************************************ +Increments the modify clock of a frame by 1. The caller must (1) own the +buf_pool mutex and block bufferfix count has to be zero, (2) or own an x-lock +on the block. */ +UNIV_INLINE +dulint +buf_block_modify_clock_inc( +/*=======================*/ + /* out: new value */ + buf_block_t* block); /* in: block */ +/************************************************************************ Returns the value of the modify clock. The caller must have an s-lock or x-lock on the block. */ UNIV_INLINE @@ -428,7 +452,7 @@ UNIV_INLINE buf_frame_t* buf_frame_align( /*============*/ - /* out: pointer to block */ + /* out: pointer to frame */ byte* ptr); /* in: pointer to a frame */ /*********************************************************************** Checks if a pointer points to the block array of the buffer pool (blocks, not @@ -505,6 +529,19 @@ buf_pool_invalidate(void); --------------------------- LOWER LEVEL ROUTINES ------------------------- =========================================================================*/ +/************************************************************************ +Maps the page of block to a frame, if not mapped yet. Unmaps some page +from the end of the awe_LRU_free_mapped. */ + +void +buf_awe_map_page_to_frame( +/*======================*/ + buf_block_t* block, /* in: block whose page should be + mapped to a frame */ + ibool add_to_mapped_list);/* in: TRUE if we in the case + we need to map the page should also + add the block to the + awe_LRU_free_mapped list */ /************************************************************************* Adds latch level info for the rw-lock protecting the buffer frame. This should be called in the debug version after a successful latching of a @@ -638,7 +675,16 @@ struct buf_block_struct{ byte* frame; /* pointer to buffer frame which is of size UNIV_PAGE_SIZE, and aligned to an address divisible by - UNIV_PAGE_SIZE */ + UNIV_PAGE_SIZE; if AWE is used, this + will be NULL for the pages which are + currently not mapped into the virtual + address space window of the buffer + pool */ + os_awe_t* awe_info; /* if AWE is used, then an array of + awe page infos for + UNIV_PAGE_SIZE / OS_AWE_X86_PAGE_SIZE + (normally = 4) physical memory + pages; otherwise NULL */ ulint space; /* space id of the page */ ulint offset; /* page number within the space */ ulint lock_hash_val; /* hashed value of the page address @@ -647,14 +693,6 @@ struct buf_block_struct{ record lock hash table */ rw_lock_t lock; /* read-write lock of the buffer frame */ - rw_lock_t read_lock; /* rw-lock reserved when a page read - to the frame is requested; a thread - can wait for this rw-lock if it wants - to wait for the read to complete; - the usual way is to wait for lock, - but if the thread just wants a - bufferfix and no latch on the page, - then it can wait for this rw-lock */ buf_block_t* hash; /* node used in chaining to the page hash table */ ibool check_index_page_at_flush; @@ -691,6 +729,10 @@ struct buf_block_struct{ /* node of the free block list */ UT_LIST_NODE_T(buf_block_t) LRU; /* node of the LRU list */ + UT_LIST_NODE_T(buf_block_t) awe_LRU_free_mapped; + /* in the AWE version node in the + list of free and LRU blocks which are + mapped to a frame */ ulint LRU_position; /* value which monotonically decreases (or may stay constant if the block is in the old blocks) toward @@ -728,8 +770,8 @@ struct buf_block_struct{ bufferfixed, or (2) the thread has an x-latch on the block */ - /* 5. Hash search fields: NOTE that these fields are protected by - btr_search_mutex */ + /* 5. Hash search fields: NOTE that the first 4 fields are NOT + protected by any semaphore! */ ulint n_hash_helps; /* counter which controls building of a new hash index for the page */ @@ -742,6 +784,9 @@ struct buf_block_struct{ whether the leftmost record of several records with the same prefix should be indexed in the hash index */ + + /* The following 4 fields are protected by btr_search_latch: */ + ibool is_hashed; /* TRUE if hash index has already been built on this page; note that it does not guarantee that the index is @@ -755,11 +800,12 @@ struct buf_block_struct{ BTR_SEARCH_RIGHT_SIDE in hash indexing */ /* 6. Debug fields */ - +#ifdef UNIV_SYNC_DEBUG rw_lock_t debug_latch; /* in the debug version, each thread which bufferfixes the block acquires an s-latch here; so we can use the debug utilities in sync0rw */ +#endif ibool file_page_was_freed; /* this is set to TRUE when fsp frees a page in buffer pool */ @@ -778,16 +824,36 @@ struct buf_pool_struct{ struct and control blocks, except the read-write lock in them */ byte* frame_mem; /* pointer to the memory area which - was allocated for the frames */ + was allocated for the frames; in AWE + this is the virtual address space + window where we map pages stored + in physical memory */ byte* frame_zero; /* pointer to the first buffer frame: this may differ from frame_mem, because this is aligned by the frame size */ - byte* high_end; /* pointer to the end of the - buffer pool */ + byte* high_end; /* pointer to the end of the buffer + frames */ + ulint n_frames; /* number of frames */ buf_block_t* blocks; /* array of buffer control blocks */ + buf_block_t** blocks_of_frames;/* inverse mapping which can be used + to retrieve the buffer control block + of a frame; this is an array which + lists the blocks of frames in the + order frame_zero, + frame_zero + UNIV_PAGE_SIZE, ... + a control block is always assigned + for each frame, even if the frame does + not contain any data; note that in AWE + there are more control blocks than + buffer frames */ + os_awe_t* awe_info; /* if AWE is used, AWE info for the + physical 4 kB memory pages associated + with buffer frames */ ulint max_size; /* number of control blocks == maximum pool size in pages */ - ulint curr_size; /* current pool size in pages */ + ulint curr_size; /* current pool size in pages; + currently always the same as + max_size */ hash_table_t* page_hash; /* hash table of the file pages */ ulint n_pend_reads; /* number of pending read operations */ @@ -799,11 +865,14 @@ struct buf_pool_struct{ ulint n_pages_created;/* number of pages created in the pool with no read */ ulint n_page_gets; /* number of page gets performed; - also successful seraches through + also successful searches through the adaptive hash index are counted as page gets; this field is NOT protected by the buffer pool mutex */ + ulint n_pages_awe_remapped; /* if AWE is enabled, the + number of remaps of blocks to + buffer frames */ ulint n_page_gets_old;/* n_page_gets when buf_print was last time called: used to calculate hit rate */ @@ -812,6 +881,7 @@ struct buf_pool_struct{ ulint n_pages_written_old;/* number write operations */ ulint n_pages_created_old;/* number of pages created in the pool with no read */ + ulint n_pages_awe_remapped_old; /* 2. Page flushing algorithm fields */ UT_LIST_BASE_NODE_T(buf_block_t) flush_list; @@ -844,7 +914,10 @@ struct buf_pool_struct{ /* 3. LRU replacement algorithm fields */ UT_LIST_BASE_NODE_T(buf_block_t) free; - /* base node of the free block list */ + /* base node of the free block list; + in the case of AWE, at the start are + always free blocks for which the + physical memory is mapped to a frame */ UT_LIST_BASE_NODE_T(buf_block_t) LRU; /* base node of the LRU list */ buf_block_t* LRU_old; /* pointer to the about 3/8 oldest @@ -856,6 +929,12 @@ struct buf_pool_struct{ see buf0lru.c for the restrictions on this value; not defined if LRU_old == NULL */ + UT_LIST_BASE_NODE_T(buf_block_t) awe_LRU_free_mapped; + /* list of those blocks which are + in the LRU list or the free list, and + where the page is mapped to a frame; + thus, frames allocated, e.g., to the + locki table, are not in this list */ }; /* States of a control block */ diff --git a/innobase/include/buf0buf.ic b/innobase/include/buf0buf.ic index 7227c79dc6a..d4e7122f3f9 100644 --- a/innobase/include/buf0buf.ic +++ b/innobase/include/buf0buf.ic @@ -36,25 +36,27 @@ buf_block_peek_if_too_old( } /************************************************************************* -Gets the current size of buffer buf_pool in bytes. */ +Gets the current size of buffer buf_pool in bytes. In the case of AWE, the +size of AWE window (= the frames). */ UNIV_INLINE ulint buf_pool_get_curr_size(void) /*========================*/ /* out: size in bytes */ { - return((buf_pool->curr_size) * UNIV_PAGE_SIZE); + return((buf_pool->n_frames) * UNIV_PAGE_SIZE); } /************************************************************************* -Gets the maximum size of buffer buf_pool in bytes. */ +Gets the maximum size of buffer buf_pool in bytes. In the case of AWE, the +size of AWE window (= the frames). */ UNIV_INLINE ulint buf_pool_get_max_size(void) /*=======================*/ /* out: size in bytes */ { - return((buf_pool->max_size) * UNIV_PAGE_SIZE); + return((buf_pool->n_frames) * UNIV_PAGE_SIZE); } /*********************************************************************** @@ -207,54 +209,24 @@ buf_block_align( frame_zero = buf_pool->frame_zero; - ut_ad((ulint)ptr >= (ulint)frame_zero); - - block = buf_pool_get_nth_block(buf_pool, ((ulint)(ptr - frame_zero)) - >> UNIV_PAGE_SIZE_SHIFT); - if (block < buf_pool->blocks - || block >= buf_pool->blocks + buf_pool->max_size) { + if ((ulint)ptr < (ulint)frame_zero + || (ulint)ptr > (ulint)(buf_pool->high_end)) { + ut_print_timestamp(stderr); fprintf(stderr, -"InnoDB: Error: trying to access a stray pointer %lx\n" -"InnoDB: buf pool start is at %lx, number of pages %lu\n", (ulint)ptr, - (ulint)frame_zero, buf_pool->max_size); +" InnoDB: Error: trying to access a stray pointer %lx\n" +"InnoDB: buf pool start is at %lx, end at %lx\n" +"InnoDB: Probable reason is database corruption or memory\n" +"InnoDB: corruption. If this happens in an InnoDB database recovery,\n" +"InnoDB: you can look from section 6.1 at http://www.innodb.com/ibman.html\n" +"InnoDB: how to force recovery.\n", + (ulint)ptr, (ulint)frame_zero, + (ulint)(buf_pool->high_end)); ut_a(0); } - - return(block); -} - -/*********************************************************************** -Gets the block to whose frame the pointer is pointing to. Does not -require a file page to be bufferfixed. */ -UNIV_INLINE -buf_block_t* -buf_block_align_low( -/*================*/ - /* out: pointer to block */ - byte* ptr) /* in: pointer to a frame */ -{ - buf_block_t* block; - buf_frame_t* frame_zero; - - ut_ad(ptr); - - frame_zero = buf_pool->frame_zero; - - ut_ad((ulint)ptr >= (ulint)frame_zero); - - block = buf_pool_get_nth_block(buf_pool, ((ulint)(ptr - frame_zero)) - >> UNIV_PAGE_SIZE_SHIFT); - if (block < buf_pool->blocks - || block >= buf_pool->blocks + buf_pool->max_size) { - - fprintf(stderr, -"InnoDB: Error: trying to access a stray pointer %lx\n" -"InnoDB: buf pool start is at %lx, number of pages %lu\n", (ulint)ptr, - (ulint)frame_zero, buf_pool->max_size); - ut_a(0); - } - + + block = *(buf_pool->blocks_of_frames + (((ulint)(ptr - frame_zero)) + >> UNIV_PAGE_SIZE_SHIFT)); return(block); } @@ -264,7 +236,7 @@ UNIV_INLINE buf_frame_t* buf_frame_align( /*============*/ - /* out: pointer to block */ + /* out: pointer to frame */ byte* ptr) /* in: pointer to a frame */ { buf_frame_t* frame; @@ -273,14 +245,19 @@ buf_frame_align( frame = ut_align_down(ptr, UNIV_PAGE_SIZE); - if (((ulint)frame - < (ulint)(buf_pool->frame_zero)) - || ((ulint)frame > (ulint)(buf_pool_get_nth_block(buf_pool, - buf_pool->max_size - 1)->frame))) { + if (((ulint)frame < (ulint)(buf_pool->frame_zero)) + || (ulint)frame >= (ulint)(buf_pool->high_end)) { + + ut_print_timestamp(stderr); fprintf(stderr, -"InnoDB: Error: trying to access a stray pointer %lx\n" -"InnoDB: buf pool start is at %lx, number of pages %lu\n", (ulint)ptr, - (ulint)(buf_pool->frame_zero), buf_pool->max_size); +" InnoDB: Error: trying to access a stray pointer %lx\n" +"InnoDB: buf pool start is at %lx, end at %lx\n" +"InnoDB: Probable reason is database corruption or memory\n" +"InnoDB: corruption. If this happens in an InnoDB database recovery,\n" +"InnoDB: you can look from section 6.1 at http://www.innodb.com/ibman.html\n" +"InnoDB: how to force recovery.\n", + (ulint)ptr, (ulint)(buf_pool->frame_zero), + (ulint)(buf_pool->high_end)); ut_a(0); } @@ -469,7 +446,7 @@ buf_frame_modify_clock_inc( ut_ad(frame); - block = buf_block_align_low(frame); + block = buf_block_align(frame); ut_ad((mutex_own(&(buf_pool->mutex)) && (block->buf_fix_count == 0)) || rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE)); @@ -480,6 +457,25 @@ buf_frame_modify_clock_inc( } /************************************************************************ +Increments the modify clock of a frame by 1. The caller must (1) own the +buf_pool mutex and block bufferfix count has to be zero, (2) or own an x-lock +on the block. */ +UNIV_INLINE +dulint +buf_block_modify_clock_inc( +/*=======================*/ + /* out: new value */ + buf_block_t* block) /* in: block */ +{ + ut_ad((mutex_own(&(buf_pool->mutex)) && (block->buf_fix_count == 0)) + || rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE)); + + UT_DULINT_INC(block->modify_clock); + + return(block->modify_clock); +} + +/************************************************************************ Returns the value of the modify clock. The caller must have an s-lock or x-lock on the block. */ UNIV_INLINE @@ -508,15 +504,16 @@ void buf_block_buf_fix_inc_debug( /*========================*/ buf_block_t* block, /* in: block to bufferfix */ - char* file, /* in: file name */ - ulint line) /* in: line */ + char* file __attribute__ ((unused)), /* in: file name */ + ulint line __attribute__ ((unused))) /* in: line */ { +#ifdef UNIV_SYNC_DEBUG ibool ret; - + ret = rw_lock_s_lock_func_nowait(&(block->debug_latch), file, line); ut_ad(ret == TRUE); - +#endif block->buf_fix_count++; } diff --git a/innobase/include/buf0lru.h b/innobase/include/buf0lru.h index 946b6c4e31d..6a3c948507d 100644 --- a/innobase/include/buf0lru.h +++ b/innobase/include/buf0lru.h @@ -53,7 +53,9 @@ LRU list to the free list. */ buf_block_t* buf_LRU_get_free_block(void); /*=========================*/ - /* out: the free control block */ + /* out: the free control block; also if AWE is + used, it is guaranteed that the block has its + page mapped to a frame when we return */ /********************************************************************** Puts a block back to the free list. */ diff --git a/innobase/include/db0err.h b/innobase/include/db0err.h index 86b79b65bf2..c67c09bad27 100644 --- a/innobase/include/db0err.h +++ b/innobase/include/db0err.h @@ -42,6 +42,8 @@ Created 5/24/1996 Heikki Tuuri #define DB_CANNOT_ADD_CONSTRAINT 38 /* adding a foreign key constraint to a table failed */ #define DB_CORRUPTION 39 /* data structure corruption noticed */ +#define DB_COL_APPEARS_TWICE_IN_INDEX 40 /* InnoDB cannot handle an index + where same column appears twice */ /* The following are partial failure codes */ #define DB_FAIL 1000 diff --git a/innobase/include/dict0mem.h b/innobase/include/dict0mem.h index 22293389bae..0798541cfe0 100644 --- a/innobase/include/dict0mem.h +++ b/innobase/include/dict0mem.h @@ -280,8 +280,15 @@ struct dict_foreign_struct{ table */ }; +/* The flags for ON_UPDATE and ON_DELETE can be ORed; the default is that +a foreign key constraint is enforced, therefore RESTRICT just means no flag */ #define DICT_FOREIGN_ON_DELETE_CASCADE 1 #define DICT_FOREIGN_ON_DELETE_SET_NULL 2 +#define DICT_FOREIGN_ON_UPDATE_CASCADE 4 +#define DICT_FOREIGN_ON_UPDATE_SET_NULL 8 +#define DICT_FOREIGN_ON_DELETE_NO_ACTION 16 +#define DICT_FOREIGN_ON_UPDATE_NO_ACTION 32 + #define DICT_INDEX_MAGIC_N 76789786 diff --git a/innobase/include/log0recv.h b/innobase/include/log0recv.h index 7418e4abf1b..bef42cfec1c 100644 --- a/innobase/include/log0recv.h +++ b/innobase/include/log0recv.h @@ -355,12 +355,7 @@ in the debug version: spaces with an odd number as the id are replicate spaces */ #define RECV_REPLICA_SPACE_ADD 1 -/* This many blocks must be left free in the buffer pool when we scan -the log and store the scanned log records in the buffer pool: we will -use these free blocks to read in pages when we start applying the -log records to the database. */ - -#define RECV_POOL_N_FREE_BLOCKS (ut_min(256, buf_pool_get_curr_size() / 8)) +extern ulint recv_n_pool_free_frames; #ifndef UNIV_NONINL #include "log0recv.ic" diff --git a/innobase/include/mem0mem.h b/innobase/include/mem0mem.h index bfd25f5bdbe..9ab3b2cd754 100644 --- a/innobase/include/mem0mem.h +++ b/innobase/include/mem0mem.h @@ -127,16 +127,18 @@ mem_heap_create_func( ulint line /* in: line where created */ ); /********************************************************************* -NOTE: Use the corresponding macro instead of this function. -Frees the space occupied by a memory heap. */ +NOTE: Use the corresponding macro instead of this function. Frees the space +occupied by a memory heap. In the debug version erases the heap memory +blocks. */ UNIV_INLINE void mem_heap_free_func( /*===============*/ - mem_heap_t* heap, /* in, own: heap to be freed */ - char* file_name, /* in: file name where freed */ - ulint line /* in: line where freed */ -); + mem_heap_t* heap, /* in, own: heap to be freed */ + char* file_name __attribute__((unused)), + /* in: file name where freed */ + ulint line __attribute__((unused))); + /* in: line where freed */ /******************************************************************* Allocates n bytes of memory from a memory heap. */ UNIV_INLINE diff --git a/innobase/include/mem0mem.ic b/innobase/include/mem0mem.ic index a7abb93d91d..1ff8c66e80a 100644 --- a/innobase/include/mem0mem.ic +++ b/innobase/include/mem0mem.ic @@ -440,9 +440,10 @@ void mem_heap_free_func( /*===============*/ mem_heap_t* heap, /* in, own: heap to be freed */ - char* file_name, /* in: file name where freed */ - ulint line /* in: line where freed */ - ) + char* file_name __attribute__((unused)), + /* in: file name where freed */ + ulint line __attribute__((unused))) + /* in: line where freed */ { mem_block_t* block; mem_block_t* prev_block; diff --git a/innobase/include/mem0pool.h b/innobase/include/mem0pool.h index 43707bd5f61..51c53afe788 100644 --- a/innobase/include/mem0pool.h +++ b/innobase/include/mem0pool.h @@ -19,6 +19,8 @@ typedef struct mem_pool_struct mem_pool_t; /* The common memory pool */ extern mem_pool_t* mem_comm_pool; +extern ulint mem_out_of_mem_err_msg_count; + /* Memory area header */ struct mem_area_struct{ diff --git a/innobase/include/os0proc.h b/innobase/include/os0proc.h index 79750e5c1f7..08510db4366 100644 --- a/innobase/include/os0proc.h +++ b/innobase/include/os0proc.h @@ -15,6 +15,76 @@ Created 9/30/1995 Heikki Tuuri typedef void* os_process_t; typedef unsigned long int os_process_id_t; +/* The cell type in os_awe_allocate_mem page info */ +#ifdef __NT__ +typedef ULONG_PTR os_awe_t; +#else +typedef ulint os_awe_t; +#endif + +/* Physical page size when Windows AWE is used. This is the normal +page size of an Intel x86 processor. We cannot use AWE with 2 MB or 4 MB +pages. */ +#define OS_AWE_X86_PAGE_SIZE 4096 + +/******************************************************************** +Windows AWE support. Tries to enable the "lock pages in memory" privilege for +the current process so that the current process can allocate memory-locked +virtual address space to act as the window where AWE maps physical memory. */ + +ibool +os_awe_enable_lock_pages_in_mem(void); +/*=================================*/ + /* out: TRUE if success, FALSE if error; + prints error info to stderr if no success */ +/******************************************************************** +Allocates physical RAM memory up to 64 GB in an Intel 32-bit x86 +processor. */ + +ibool +os_awe_allocate_physical_mem( +/*=========================*/ + /* out: TRUE if success */ + os_awe_t** page_info, /* out, own: array of opaque data containing + the info for allocated physical memory pages; + each allocated 4 kB physical memory page has + one slot of type os_awe_t in the array */ + ulint n_megabytes); /* in: number of megabytes to allocate */ +/******************************************************************** +Allocates a window in the virtual address space where we can map then +pages of physical memory. */ + +byte* +os_awe_allocate_virtual_mem_window( +/*===============================*/ + /* out, own: allocated memory, or NULL if did not + succeed */ + ulint size); /* in: virtual memory allocation size in bytes, must + be < 2 GB */ +/******************************************************************** +With this function you can map parts of physical memory allocated with +the ..._allocate_physical_mem to the virtual address space allocated with +the previous function. Intel implements this so that the process page +tables are updated accordingly. A test on a 1.5 GHz AMD processor and XP +showed that this takes < 1 microsecond, much better than the estimated 80 us +for copying a 16 kB page memory to memory. But, the operation will at least +partially invalidate the translation lookaside buffer (TLB) of all +processors. Under a real-world load the performance hit may be bigger. */ + +ibool +os_awe_map_physical_mem_to_window( +/*==============================*/ + /* out: TRUE if success; the function + calls exit(1) in case of an error */ + byte* ptr, /* in: a page-aligned pointer to + somewhere in the virtual address + space window; we map the physical mem + pages here */ + ulint n_mem_pages, /* in: number of 4 kB mem pages to + map */ + os_awe_t* page_info); /* in: array of page infos for those + pages; each page has one slot in the + array */ /******************************************************************** Converts the current process id to a number. It is not guaranteed that the number is unique. In Linux returns the 'process number' of the current diff --git a/innobase/include/row0mysql.h b/innobase/include/row0mysql.h index 44b470fe7ea..972fabc74cf 100644 --- a/innobase/include/row0mysql.h +++ b/innobase/include/row0mysql.h @@ -52,6 +52,14 @@ row_mysql_read_var_ref_noninline( ulint* len, /* out: variable-length field length */ byte* field); /* in: field */ /*********************************************************************** +Frees the blob heap in prebuilt when no longer needed. */ + +void +row_mysql_prebuilt_free_blob_heap( +/*==============================*/ + row_prebuilt_t* prebuilt); /* in: prebuilt struct of a + ha_innobase:: table handle */ +/*********************************************************************** Stores a reference to a BLOB in the MySQL format. */ void @@ -492,7 +500,11 @@ struct row_prebuilt_struct { fetch many rows from the same cursor: it saves CPU time to fetch them in a batch; we reserve mysql_row_len - bytes for each such row */ + bytes for each such row; these + pointers point 4 bytes past the + allocated mem buf start, because + there is a 4 byte magic number at the + start and at the end */ ulint fetch_cache_first;/* position of the first not yet fetched row in fetch_cache */ ulint n_fetch_cached; /* number of not yet fetched rows @@ -501,8 +513,12 @@ struct row_prebuilt_struct { to this heap */ mem_heap_t* old_vers_heap; /* memory heap where a previous version is built in consistent read */ + ulint magic_n2; /* this should be the same as + magic_n */ }; +#define ROW_PREBUILT_FETCH_MAGIC_N 465765687 + #define ROW_MYSQL_WHOLE_ROW 0 #define ROW_MYSQL_REC_FIELDS 1 #define ROW_MYSQL_NO_TEMPLATE 2 diff --git a/innobase/include/row0sel.h b/innobase/include/row0sel.h index aa2da6fe5f6..cfc30852b87 100644 --- a/innobase/include/row0sel.h +++ b/innobase/include/row0sel.h @@ -115,7 +115,8 @@ row_search_for_mysql( /*=================*/ /* out: DB_SUCCESS, DB_RECORD_NOT_FOUND, - DB_END_OF_INDEX, or DB_DEADLOCK */ + DB_END_OF_INDEX, DB_DEADLOCK, + or DB_TOO_BIG_RECORD */ byte* buf, /* in/out: buffer for the fetched row in the MySQL format */ ulint mode, /* in: search mode PAGE_CUR_L, ... */ diff --git a/innobase/include/row0upd.h b/innobase/include/row0upd.h index 9a3e2463267..273ec6074eb 100644 --- a/innobase/include/row0upd.h +++ b/innobase/include/row0upd.h @@ -312,8 +312,11 @@ struct upd_node_struct{ ibool in_mysql_interface; /* TRUE if the update node was created for the MySQL interface */ + dict_foreign_t* foreign;/* NULL or pointer to a foreign key + constraint if this update node is used in + doing an ON DELETE or ON UPDATE operation */ upd_node_t* cascade_node;/* NULL or an update node template which - is used to implement ON DELETE CASCADE + is used to implement ON DELETE/UPDATE CASCADE or ... SET NULL for foreign keys */ mem_heap_t* cascade_heap;/* NULL or a mem heap where the cascade node is created */ diff --git a/innobase/include/srv0srv.h b/innobase/include/srv0srv.h index ad6f71f7a3a..bc0960ae023 100644 --- a/innobase/include/srv0srv.h +++ b/innobase/include/srv0srv.h @@ -61,6 +61,7 @@ extern ulint srv_flush_log_at_trx_commit; extern byte srv_latin1_ordering[256];/* The sort order table of the latin1 character set */ extern ulint srv_pool_size; +extern ulint srv_awe_window_size; extern ulint srv_mem_pool_size; extern ulint srv_lock_table_size; @@ -86,6 +87,8 @@ extern ibool srv_use_doublewrite_buf; extern ibool srv_set_thread_priorities; extern int srv_query_thread_priority; +extern ibool srv_use_awe; +extern ibool srv_use_adaptive_hash_indexes; /*-------------------------------------------*/ extern ulint srv_n_rows_inserted; diff --git a/innobase/include/univ.i b/innobase/include/univ.i index f32161fed20..bf606efcf64 100644 --- a/innobase/include/univ.i +++ b/innobase/include/univ.i @@ -9,7 +9,8 @@ Created 1/20/1994 Heikki Tuuri #ifndef univ_i #define univ_i -#if (defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)) && !defined(MYSQL_SERVER) +#if (defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)) && !defined(MYSQL_SERVER) && !defined(__WIN__) +#undef __WIN__ #define __WIN__ #include <windows.h> @@ -56,6 +57,7 @@ of the 32-bit x86 assembler in mutex operations. */ Microsoft Visual C++ */ #if !defined(__GNUC__) && !defined(__WIN__) +#undef UNIV_MUST_NOT_INLINE /* Remove compiler warning */ #define UNIV_MUST_NOT_INLINE #endif diff --git a/innobase/include/ut0mem.h b/innobase/include/ut0mem.h index 09e0d800685..d3d04d58596 100644 --- a/innobase/include/ut0mem.h +++ b/innobase/include/ut0mem.h @@ -50,6 +50,16 @@ ut_malloc( /* out, own: allocated memory */ ulint n); /* in: number of bytes to allocate */ /************************************************************************** +Tests if malloc of n bytes would succeed. ut_malloc() asserts if memory runs +out. It cannot be used if we want to return an error message. Prints to +stderr a message if fails. */ + +ibool +ut_test_malloc( +/*===========*/ + /* out: TRUE if succeeded */ + ulint n); /* in: try to allocate this many bytes */ +/************************************************************************** Frees a memory bloock allocated with ut_malloc. */ void diff --git a/innobase/log/log0log.c b/innobase/log/log0log.c index f9b785ccbd5..bdfce783a43 100644 --- a/innobase/log/log0log.c +++ b/innobase/log/log0log.c @@ -437,25 +437,29 @@ log_group_calc_lsn_offset( dulint lsn, /* in: lsn, must be within 4 GB of group->lsn */ log_group_t* group) /* in: log group */ { - dulint gr_lsn; - ulint gr_lsn_size_offset; - ulint difference; - ulint group_size; - ulint offset; + dulint gr_lsn; + ib_longlong gr_lsn_size_offset; + ib_longlong difference; + ib_longlong group_size; + ib_longlong offset; ut_ad(mutex_own(&(log_sys->mutex))); + /* If total log file size is > 2 GB we can easily get overflows + with 32-bit integers. Use 64-bit integers instead. */ + gr_lsn = group->lsn; - gr_lsn_size_offset = log_group_calc_size_offset(group->lsn_offset, - group); - group_size = log_group_get_capacity(group); + gr_lsn_size_offset = (ib_longlong) + log_group_calc_size_offset(group->lsn_offset, group); + + group_size = (ib_longlong) log_group_get_capacity(group); if (ut_dulint_cmp(lsn, gr_lsn) >= 0) { - difference = ut_dulint_minus(lsn, gr_lsn); + difference = (ib_longlong) ut_dulint_minus(lsn, gr_lsn); } else { - difference = ut_dulint_minus(gr_lsn, lsn); + difference = (ib_longlong) ut_dulint_minus(gr_lsn, lsn); difference = difference % group_size; @@ -464,7 +468,13 @@ log_group_calc_lsn_offset( offset = (gr_lsn_size_offset + difference) % group_size; - return(log_group_calc_real_offset(offset, group)); + ut_a(offset <= 0xFFFFFFFF); + + /* printf("Offset is %lu gr_lsn_offset is %lu difference is %lu\n", + (ulint)offset,(ulint)gr_lsn_size_offset, (ulint)difference); + */ + + return(log_group_calc_real_offset((ulint)offset, group)); } /*********************************************************************** @@ -3054,8 +3064,8 @@ log_check_log_recs( ut_memcpy(scan_buf, start, end - start); recv_scan_log_recs(TRUE, - buf_pool_get_curr_size() - - RECV_POOL_N_FREE_BLOCKS * UNIV_PAGE_SIZE, + (buf_pool->n_frames - + recv_n_pool_free_frames) * UNIV_PAGE_SIZE, FALSE, scan_buf, end - start, ut_dulint_align_down(buf_start_lsn, OS_FILE_LOG_BLOCK_SIZE), diff --git a/innobase/log/log0recv.c b/innobase/log/log0recv.c index dfe67c444b4..3945b47933d 100644 --- a/innobase/log/log0recv.c +++ b/innobase/log/log0recv.c @@ -71,6 +71,14 @@ ulint recv_previous_parsed_rec_is_multi = 0; ulint recv_max_parsed_page_no = 0; +/* This many frames must be left free in the buffer pool when we scan +the log and store the scanned log records in the buffer pool: we will +use these free frames to read in pages when we start applying the +log records to the database. */ + +ulint recv_n_pool_free_frames = 256; + + /************************************************************ Creates the recovery system. */ @@ -1018,10 +1026,10 @@ recv_recover_page( block = buf_block_align(page); if (just_read_in) { - /* Move the ownership of the x-latch on the page to this OS - thread, so that we can acquire a second x-latch on it. This - is needed for the operations to the page to pass the debug - checks. */ + /* Move the ownership of the x-latch on the page to + this OS thread, so that we can acquire a second + x-latch on it. This is needed for the operations to + the page to pass the debug checks. */ rw_lock_x_lock_move_ownership(&(block->lock)); } @@ -2362,8 +2370,8 @@ recv_group_scan_log_recs( group, start_lsn, end_lsn); finished = recv_scan_log_recs(TRUE, - buf_pool_get_curr_size() - - RECV_POOL_N_FREE_BLOCKS * UNIV_PAGE_SIZE, + (buf_pool->n_frames + - recv_n_pool_free_frames) * UNIV_PAGE_SIZE, TRUE, log_sys->buf, RECV_SCAN_SIZE, start_lsn, contiguous_lsn, group_scanned_lsn); @@ -3001,8 +3009,8 @@ ask_again: read_offset % UNIV_PAGE_SIZE, len, buf, NULL); ret = recv_scan_log_recs(TRUE, - buf_pool_get_curr_size() - - RECV_POOL_N_FREE_BLOCKS * UNIV_PAGE_SIZE, + (buf_pool->n_frames - + recv_n_pool_free_frames) * UNIV_PAGE_SIZE, TRUE, buf, len, start_lsn, &dummy_lsn, &scanned_lsn); diff --git a/innobase/mem/mem0pool.c b/innobase/mem/mem0pool.c index 61cf1e50ce9..382e505b63f 100644 --- a/innobase/mem/mem0pool.c +++ b/innobase/mem/mem0pool.c @@ -15,6 +15,7 @@ Created 5/12/1997 Heikki Tuuri #include "ut0mem.h" #include "ut0lst.h" #include "ut0byte.h" +#include "mem0mem.h" /* We would like to use also the buffer frames to allocate memory. This would be desirable, because then the memory consumption of the database @@ -251,7 +252,6 @@ mem_pool_fill_free_list( mem_area_t* area; mem_area_t* area2; ibool ret; - char err_buf[500]; ut_ad(mutex_own(&(pool->mutex))); @@ -259,19 +259,6 @@ mem_pool_fill_free_list( /* We come here when we have run out of space in the memory pool: */ - if (mem_out_of_mem_err_msg_count % 1000000000 == 0) { - /* We do not print the message every time: */ - - ut_print_timestamp(stderr); - - fprintf(stderr, - " InnoDB: Out of memory in additional memory pool.\n" - "InnoDB: InnoDB will start allocating memory from the OS.\n" - "InnoDB: You may get better performance if you configure a bigger\n" - "InnoDB: value in the MySQL my.cnf file for\n" - "InnoDB: innodb_additional_mem_pool_size.\n"); - } - mem_out_of_mem_err_msg_count++; return(FALSE); @@ -300,11 +287,8 @@ mem_pool_fill_free_list( } if (UT_LIST_GET_LEN(pool->free_list[i + 1]) == 0) { - ut_sprintf_buf(err_buf, ((byte*)area) - 50, 100); - fprintf(stderr, -"InnoDB: Error: Removing element from mem pool free list %lu\n" -"InnoDB: though the list length is 0! Dump of 100 bytes around element:\n%s\n", - i + 1, err_buf); + mem_analyze_corruption((byte*)area); + ut_a(0); } @@ -340,7 +324,6 @@ mem_area_alloc( mem_area_t* area; ulint n; ibool ret; - char err_buf[500]; n = ut_2_log(ut_max(size + MEM_AREA_EXTRA_SIZE, MEM_AREA_MIN_SIZE)); @@ -364,20 +347,22 @@ mem_area_alloc( } if (!mem_area_get_free(area)) { - ut_sprintf_buf(err_buf, ((byte*)area) - 50, 100); fprintf(stderr, "InnoDB: Error: Removing element from mem pool free list %lu though the\n" -"InnoDB: element is not marked free! Dump of 100 bytes around element:\n%s\n", - n, err_buf); +"InnoDB: element is not marked free!\n", + n); + + mem_analyze_corruption((byte*)area); ut_a(0); } if (UT_LIST_GET_LEN(pool->free_list[n]) == 0) { - ut_sprintf_buf(err_buf, ((byte*)area) - 50, 100); fprintf(stderr, "InnoDB: Error: Removing element from mem pool free list %lu\n" -"InnoDB: though the list length is 0! Dump of 100 bytes around element:\n%s\n", - n, err_buf); +"InnoDB: though the list length is 0!\n", + n); + mem_analyze_corruption((byte*)area); + ut_a(0); } @@ -451,7 +436,6 @@ mem_area_free( void* new_ptr; ulint size; ulint n; - char err_buf[500]; if (mem_out_of_mem_err_msg_count > 0) { /* It may be that the area was really allocated from the @@ -468,18 +452,25 @@ mem_area_free( area = (mem_area_t*) (((byte*)ptr) - MEM_AREA_EXTRA_SIZE); - if (mem_area_get_free(area)) { - ut_sprintf_buf(err_buf, ((byte*)area) - 50, 100); + if (mem_area_get_free(area)) { fprintf(stderr, "InnoDB: Error: Freeing element to mem pool free list though the\n" -"InnoDB: element is marked free! Dump of 100 bytes around element:\n%s\n", - err_buf); +"InnoDB: element is marked free!\n"); + + mem_analyze_corruption((byte*)area); ut_a(0); } size = mem_area_get_size(area); - ut_ad(size != 0); + if (size == 0) { + fprintf(stderr, +"InnoDB: Error: Mem area size is 0. Possibly a memory overrun of the\n" +"InnoDB: previous allocated area!\n"); + + mem_analyze_corruption((byte*)area); + ut_a(0); + } #ifdef UNIV_LIGHT_MEM_DEBUG if (((byte*)area) + size < pool->buf + pool->size) { @@ -488,7 +479,15 @@ mem_area_free( next_size = mem_area_get_size( (mem_area_t*)(((byte*)area) + size)); - ut_a(ut_2_power_up(next_size) == next_size); + if (ut_2_power_up(next_size) != next_size) { + fprintf(stderr, +"InnoDB: Error: Memory area size %lu, next area size %lu not a power of 2!\n" +"InnoDB: Possibly a memory overrun of the buffer being freed here.\n", + size, next_size); + mem_analyze_corruption((byte*)area); + + ut_a(0); + } } #endif buddy = mem_area_get_buddy(area, size, pool); diff --git a/innobase/os/os0proc.c b/innobase/os/os0proc.c index 1ee448a4a44..635c89c10a3 100644 --- a/innobase/os/os0proc.c +++ b/innobase/os/os0proc.c @@ -12,11 +12,469 @@ Created 9/30/1995 Heikki Tuuri #include "os0proc.ic" #endif +#include "ut0mem.h" +#include "ut0byte.h" + + +/* +How to get AWE to compile on Windows? +------------------------------------- + +the Visual C++ has to be relatively recent and _WIN32_WINNT has to be +defined to a value >= 0x0500 when windows.h is included. An easy way +to accomplish that is to put + +#define _WIN32_WINNT 0x0500 + +to the start of file \mysql\include\config-win.h + +Where does AWE work? +------------------- + +See the error message in os_awe_allocate_physical_mem(). + +How to assign privileges for mysqld to use AWE? +----------------------------------------------- + +See the error message in os_awe_enable_lock_pages_in_mem(). + +Use Windows AWE functions in this order +--------------------------------------- + +(1) os_awe_enable_lock_pages_in_mem(); +(2) os_awe_allocate_physical_mem(); +(3) os_awe_allocate_virtual_mem_window(); +(4) os_awe_map_physical_mem_to_window(). + +To test 'AWE' in a computer which does not have the AWE API, +you can compile with UNIV_SIMULATE_AWE defined in this file. +*/ + +#ifdef UNIV_SIMULATE_AWE +/* If we simulate AWE, we allocate the 'physical memory' here */ +byte* os_awe_simulate_mem; +ulint os_awe_simulate_mem_size; +os_awe_t* os_awe_simulate_page_info; +byte* os_awe_simulate_window; +ulint os_awe_simulate_window_size; +/* In simulated AWE the following contains a NULL pointer or a pointer +to a mapped 'physical page' for each 4 kB page in the AWE window */ +byte** os_awe_simulate_map; +#endif + +#ifdef __NT__ +os_awe_t* os_awe_page_info; +ulint os_awe_n_pages; +byte* os_awe_window; +ulint os_awe_window_size; +#endif + +/******************************************************************** +Windows AWE support. Tries to enable the "lock pages in memory" privilege for +the current process so that the current process can allocate memory-locked +virtual address space to act as the window where AWE maps physical memory. */ + +ibool +os_awe_enable_lock_pages_in_mem(void) +/*=================================*/ + /* out: TRUE if success, FALSE if error; + prints error info to stderr if no success */ +{ +#ifdef UNIV_SIMULATE_AWE + + return(TRUE); + +#elif defined(__NT__) + struct { + DWORD Count; + LUID_AND_ATTRIBUTES Privilege[1]; + } Info; + HANDLE hProcess; + HANDLE Token; + BOOL Result; + + hProcess = GetCurrentProcess(); + + /* Open the token of the current process */ + + Result = OpenProcessToken(hProcess, + TOKEN_ADJUST_PRIVILEGES, + &Token); + if (Result != TRUE) { + fprintf(stderr, + "InnoDB: AWE: Cannot open process token, error %lu\n", + (ulint)GetLastError()); + return(FALSE); + } + + Info.Count = 1; + + Info.Privilege[0].Attributes = SE_PRIVILEGE_ENABLED; + + /* Get the local unique identifier (LUID) of the SE_LOCK_MEMORY + privilege */ + + Result = LookupPrivilegeValue(NULL, SE_LOCK_MEMORY_NAME, + &(Info.Privilege[0].Luid)); + if (Result != TRUE) { + fprintf(stderr, + "InnoDB: AWE: Cannot get local privilege value for %s, error %lu.\n", + SE_LOCK_MEMORY_NAME, (ulint)GetLastError()); + + return(FALSE); + } + + /* Try to adjust the privilege */ + + Result = AdjustTokenPrivileges(Token, FALSE, + (PTOKEN_PRIVILEGES)&Info, + 0, NULL, NULL); + /* Check the result */ + + if (Result != TRUE) { + fprintf(stderr, + "InnoDB: AWE: Cannot adjust process token privileges, error %u.\n", + GetLastError()); + return(FALSE); + } else if (GetLastError() != ERROR_SUCCESS) { + fprintf(stderr, +"InnoDB: AWE: Cannot enable SE_LOCK_MEMORY privilege, error %lu.\n" +"InnoDB: In Windows XP Home you cannot use AWE. In Windows 2000 and XP\n" +"InnoDB: Professional you must go to the Control Panel, to\n" +"InnoDB: Security Settings, to Local Policies, and enable\n" +"InnoDB: the 'lock pages in memory' privilege for the user who runs\n" +"InnoDB: the MySQL server.\n", GetLastError()); + + return(FALSE); + } + + CloseHandle(Token); + + return(TRUE); +#else #ifdef __WIN__ -#include <windows.h> + fprintf(stderr, +"InnoDB: AWE: Error: to use AWE you must use a ...-nt MySQL executable.\n"); +#endif + return(FALSE); #endif +} -#include "ut0mem.h" +/******************************************************************** +Allocates physical RAM memory up to 64 GB in an Intel 32-bit x86 +processor. */ + +ibool +os_awe_allocate_physical_mem( +/*=========================*/ + /* out: TRUE if success */ + os_awe_t** page_info, /* out, own: array of opaque data containing + the info for allocated physical memory pages; + each allocated 4 kB physical memory page has + one slot of type os_awe_t in the array */ + ulint n_megabytes) /* in: number of megabytes to allocate */ +{ +#ifdef UNIV_SIMULATE_AWE + os_awe_simulate_page_info = ut_malloc(sizeof(os_awe_t) * + n_megabytes * ((1024 * 1024) / OS_AWE_X86_PAGE_SIZE)); + + os_awe_simulate_mem = ut_align(ut_malloc( + 4096 + 1024 * 1024 * n_megabytes), + 4096); + os_awe_simulate_mem_size = n_megabytes * 1024 * 1024; + + *page_info = os_awe_simulate_page_info; + + return(TRUE); + +#elif defined(__NT__) + BOOL bResult; + ULONG_PTR NumberOfPages; /* Question: why does Windows + use the name ULONG_PTR for + a scalar integer type? Maybe + because we may also refer to + &NumberOfPages? */ + ULONG_PTR NumberOfPagesInitial; + SYSTEM_INFO sSysInfo; + int PFNArraySize; + + if (n_megabytes > 64 * 1024) { + + fprintf(stderr, +"InnoDB: AWE: Error: tried to allocate %lu MB.\n" +"InnoDB: AWE cannot allocate more than 64 GB in any computer.\n", n_megabytes); + + return(FALSE); + } + + GetSystemInfo(&sSysInfo); /* fill the system information structure */ + + if ((ulint)OS_AWE_X86_PAGE_SIZE != (ulint)sSysInfo.dwPageSize) { + fprintf(stderr, +"InnoDB: AWE: Error: this computer has a page size of %lu.\n" +"InnoDB: Should be 4096 bytes for InnoDB AWE support to work.\n", + (ulint)sSysInfo.dwPageSize); + + return(FALSE); + } + + /* Calculate the number of pages of memory to request */ + + NumberOfPages = n_megabytes * ((1024 * 1024) / OS_AWE_X86_PAGE_SIZE); + + /* Calculate the size of page_info for allocated physical pages */ + + PFNArraySize = NumberOfPages * sizeof(ULONG_PTR); + + *page_info = (ULONG_PTR*)HeapAlloc(GetProcessHeap(), 0, PFNArraySize); + + if (*page_info == NULL) { + fprintf(stderr, +"InnoDB: AWE: Failed to allocate page info array from process heap, error %lu\n", + (ulint)GetLastError()); + + return(FALSE); + } + + ut_total_allocated_memory += PFNArraySize; + + /* Enable this process' privilege to lock pages to physical memory */ + + if (!os_awe_enable_lock_pages_in_mem()) { + + return(FALSE); + } + + /* Allocate the physical memory */ + + NumberOfPagesInitial = NumberOfPages; + + os_awe_page_info = *page_info; + os_awe_n_pages = (ulint)NumberOfPages; + + /* Compilation note: if the compiler complains the function is not + defined, see the note at the start of this file */ + + bResult = AllocateUserPhysicalPages(GetCurrentProcess(), + &NumberOfPages, + *page_info); + if (bResult != TRUE) { + fprintf(stderr, +"InnoDB: AWE: Cannot allocate physical pages, error %lu.\n", + (ulint)GetLastError()); + + return(FALSE); + } + + if (NumberOfPagesInitial != NumberOfPages) { + fprintf(stderr, +"InnoDB: AWE: Error: allocated only %lu pages of %lu requested.\n" +"InnoDB: Check that you have enough free RAM.\n" +"InnoDB: In Windows XP Professional and 2000 Professional\n" +"InnoDB: Windows PAE size is max 4 GB. In 2000 and .NET\n" +"InnoDB: Advanced Servers and 2000 Datacenter Server it is 32 GB,\n" +"InnoDB: and in .NET Datacenter Server it is 64 GB.\n" +"InnoDB: A Microsoft web page said that the processor must be an Intel\n" +"InnoDB: processor.\n", + (ulint)NumberOfPages, + (ulint)NumberOfPagesInitial); + + return(FALSE); + } + + fprintf(stderr, +"InnoDB: Using Address Windowing Extensions (AWE); allocated %lu MB\n", + n_megabytes); + + return(TRUE); +#else + return(FALSE); +#endif +} + +/******************************************************************** +Allocates a window in the virtual address space where we can map then +pages of physical memory. */ + +byte* +os_awe_allocate_virtual_mem_window( +/*===============================*/ + /* out, own: allocated memory, or NULL if did not + succeed */ + ulint size) /* in: virtual memory allocation size in bytes, must + be < 2 GB */ +{ +#ifdef UNIV_SIMULATE_AWE + ulint i; + + os_awe_simulate_window = ut_align(ut_malloc(4096 + size), 4096); + os_awe_simulate_window_size = size; + + os_awe_simulate_map = ut_malloc(sizeof(byte*) * (size / 4096)); + + for (i = 0; i < (size / 4096); i++) { + *(os_awe_simulate_map + i) = NULL; + } + + return(os_awe_simulate_window); + +#elif defined(__NT__) + byte* ptr; + + if (size > 0x7FFFFFFFFF) { + fprintf(stderr, +"InnoDB: AWE: Cannot allocate %lu bytes of virtual memory\n", size); + + return(NULL); + } + + ptr = VirtualAlloc(NULL, (SIZE_T)size, MEM_RESERVE | MEM_PHYSICAL, + PAGE_READWRITE); + if (ptr == NULL) { + fprintf(stderr, +"InnoDB: AWE: Cannot allocate %lu bytes of virtual memory, error %lu\n", + size, (ulint)GetLastError()); + + return(NULL); + } + + os_awe_window = ptr; + os_awe_window_size = size; + + ut_total_allocated_memory += size; + + return(ptr); +#else + return(NULL); +#endif +} + +/******************************************************************** +With this function you can map parts of physical memory allocated with +the ..._allocate_physical_mem to the virtual address space allocated with +the previous function. Intel implements this so that the process page +tables are updated accordingly. A test on a 1.5 GHz AMD processor and XP +showed that this takes < 1 microsecond, much better than the estimated 80 us +for copying a 16 kB page memory to memory. But, the operation will at least +partially invalidate the translation lookaside buffer (TLB) of all +processors. Under a real-world load the performance hit may be bigger. */ + +ibool +os_awe_map_physical_mem_to_window( +/*==============================*/ + /* out: TRUE if success; the function + calls exit(1) in case of an error */ + byte* ptr, /* in: a page-aligned pointer to + somewhere in the virtual address + space window; we map the physical mem + pages here */ + ulint n_mem_pages, /* in: number of 4 kB mem pages to + map */ + os_awe_t* page_info) /* in: array of page infos for those + pages; each page has one slot in the + array */ +{ +#ifdef UNIV_SIMULATE_AWE + ulint i; + byte** map; + byte* page; + byte* phys_page; + + ut_a(ptr >= os_awe_simulate_window); + ut_a(ptr < os_awe_simulate_window + os_awe_simulate_window_size); + ut_a(page_info >= os_awe_simulate_page_info); + ut_a(page_info < os_awe_simulate_page_info + + (os_awe_simulate_mem_size / 4096)); + + /* First look if some other 'physical pages' are mapped at ptr, + and copy them back to where they were if yes */ + + map = os_awe_simulate_map + + ((ulint)(ptr - os_awe_simulate_window)) / 4096; + page = ptr; + + for (i = 0; i < n_mem_pages; i++) { + if (*map != NULL) { + ut_memcpy(*map, page, 4096); + } + map++; + page += 4096; + } + + /* Then copy to ptr the 'physical pages' determined by page_info; we + assume page_info is a segment of the array we created at the start */ + + phys_page = os_awe_simulate_mem + + (ulint)(page_info - os_awe_simulate_page_info) + * 4096; + + ut_memcpy(ptr, phys_page, n_mem_pages * 4096); + + /* Update the map */ + + map = os_awe_simulate_map + + ((ulint)(ptr - os_awe_simulate_window)) / 4096; + + for (i = 0; i < n_mem_pages; i++) { + *map = phys_page; + + map++; + phys_page += 4096; + } + + return(TRUE); + +#elif defined(__NT__) + BOOL bResult; + ULONG_PTR n_pages; + + n_pages = (ULONG_PTR)n_mem_pages; + + if (!(ptr >= os_awe_window)) { + fprintf(stderr, +"InnoDB: AWE: Error: trying to map to address %lx but AWE window start %lx\n", + (ulint)ptr, (ulint)os_awe_window); + ut_a(0); + } + + if (!(ptr <= os_awe_window + os_awe_window_size - UNIV_PAGE_SIZE)) { + fprintf(stderr, +"InnoDB: AWE: Error: trying to map to address %lx but AWE window end %lx\n", + (ulint)ptr, (ulint)os_awe_window + os_awe_window_size); + ut_a(0); + } + + if (!(page_info >= os_awe_page_info)) { + fprintf(stderr, +"InnoDB: AWE: Error: trying to map page info at %lx but array start %lx\n", + (ulint)page_info, (ulint)os_awe_page_info); + ut_a(0); + } + + if (!(page_info <= os_awe_page_info + (os_awe_n_pages - 4))) { + fprintf(stderr, +"InnoDB: AWE: Error: trying to map page info at %lx but array end %lx\n", + (ulint)page_info, (ulint)(os_awe_page_info + os_awe_n_pages)); + ut_a(0); + } + + bResult = MapUserPhysicalPages((PVOID)ptr, n_pages, page_info); + + if (bResult != TRUE) { + ut_print_timestamp(stderr); + fprintf(stderr, +" InnoDB: AWE: Mapping of %lu physical pages to address %lx failed,\n" +"InnoDB: error %lu.\n" +"InnoDB: Cannot continue operation.\n", + n_mem_pages, (ulint)ptr, (ulint)GetLastError()); + exit(1); + } + + return(TRUE); +#else + return(FALSE); +#endif +} /******************************************************************** Converts the current process id to a number. It is not guaranteed that the diff --git a/innobase/row/row0ins.c b/innobase/row/row0ins.c index d0a5cfec604..990ef99b2a4 100644 --- a/innobase/row/row0ins.c +++ b/innobase/row/row0ins.c @@ -322,13 +322,129 @@ row_ins_clust_index_entry_by_modify( } /************************************************************************* -Either deletes or sets the referencing columns SQL NULL in a child row. -Used in ON DELETE ... clause for foreign keys when a parent row is -deleted. */ +Returns TRUE if in a cascaded update/delete an ancestor node of node +updates table. */ +static +ibool +row_ins_cascade_ancestor_updates_table( +/*===================================*/ + /* out: TRUE if an ancestor updates table */ + que_node_t* node, /* in: node in a query graph */ + dict_table_t* table) /* in: table */ +{ + que_node_t* parent; + upd_node_t* upd_node; + + parent = que_node_get_parent(node); + + while (que_node_get_type(parent) == QUE_NODE_UPDATE) { + + upd_node = parent; + + if (upd_node->table == table) { + + return(TRUE); + } + + parent = que_node_get_parent(parent); + + ut_a(parent); + } + + return(FALSE); +} + +/********************************************************************** +Calculates the update vector node->cascade->update for a child table in +a cascaded update. */ +static +ulint +row_ins_cascade_calc_update_vec( +/*============================*/ + /* out: number of fields in the + calculated update vector; the value + can also be 0 if no foreign key + fields changed */ + upd_node_t* node, /* in: update node of the parent + table */ + dict_foreign_t* foreign) /* in: foreign key constraint whose + type is != 0 */ +{ + upd_node_t* cascade = node->cascade_node; + dict_table_t* table = foreign->foreign_table; + dict_index_t* index = foreign->foreign_index; + upd_t* update; + upd_field_t* ufield; + dict_table_t* parent_table; + dict_index_t* parent_index; + upd_t* parent_update; + upd_field_t* parent_ufield; + ulint n_fields_updated; + ulint parent_field_no; + ulint i; + ulint j; + + ut_a(node && foreign && cascade && table && index); + + /* Calculate the appropriate update vector which will set the fields + in the child index record to the same value as the referenced index + record will get in the update. */ + + parent_table = node->table; + ut_a(parent_table == foreign->referenced_table); + parent_index = foreign->referenced_index; + parent_update = node->update; + + update = cascade->update; + + update->info_bits = 0; + update->n_fields = foreign->n_fields; + + n_fields_updated = 0; + + for (i = 0; i < foreign->n_fields; i++) { + + parent_field_no = dict_table_get_nth_col_pos( + parent_table, + dict_index_get_nth_col_no( + parent_index, i)); + + for (j = 0; j < parent_update->n_fields; j++) { + parent_ufield = parent_update->fields + j; + + if (parent_ufield->field_no == parent_field_no) { + + /* A field in the parent index record is + updated. Let us make the update vector + field for the child table. */ + + ufield = update->fields + n_fields_updated; + + ufield->field_no = + dict_table_get_nth_col_pos(table, + dict_index_get_nth_col_no(index, i)); + ufield->exp = NULL; + ufield->new_val = parent_ufield->new_val; + ufield->extern_storage = FALSE; + + n_fields_updated++; + } + } + } + + update->n_fields = n_fields_updated; + + return(n_fields_updated); +} + +/************************************************************************* +Perform referential actions or checks when a parent row is deleted or updated +and the constraint had an ON DELETE or ON UPDATE condition which was not +RESTRICT. */ static ulint -row_ins_foreign_delete_or_set_null( -/*===============================*/ +row_ins_foreign_check_on_constraint( +/*================================*/ /* out: DB_SUCCESS, DB_LOCK_WAIT, or error code */ que_thr_t* thr, /* in: query thread whose run_node @@ -378,15 +494,34 @@ row_ins_foreign_delete_or_set_null( ut_strlen(table->name) + 1); node = thr->run_node; - ut_a(que_node_get_type(node) == QUE_NODE_UPDATE); + if (node->is_delete && 0 == (foreign->type & + (DICT_FOREIGN_ON_DELETE_CASCADE + | DICT_FOREIGN_ON_DELETE_SET_NULL))) { - if (!node->is_delete) { - /* According to SQL-92 an UPDATE with respect to FOREIGN - KEY constraints is not semantically equivalent to a - DELETE + INSERT. Therefore we do not perform any action - here and consequently the child rows would be left - orphaned if we would let the UPDATE happen. Thus we return - an error. */ + /* No action is defined: return a foreign key error if + NO ACTION is not specified */ + + if (foreign->type & DICT_FOREIGN_ON_DELETE_NO_ACTION) { + + return(DB_SUCCESS); + } + + return(DB_ROW_IS_REFERENCED); + } + + if (!node->is_delete && 0 == (foreign->type & + (DICT_FOREIGN_ON_UPDATE_CASCADE + | DICT_FOREIGN_ON_UPDATE_SET_NULL))) { + + /* This is an UPDATE */ + + /* No action is defined: return a foreign key error if + NO ACTION is not specified */ + + if (foreign->type & DICT_FOREIGN_ON_UPDATE_NO_ACTION) { + + return(DB_SUCCESS); + } return(DB_ROW_IS_REFERENCED); } @@ -411,7 +546,10 @@ row_ins_foreign_delete_or_set_null( cascade->table = table; - if (foreign->type == DICT_FOREIGN_ON_DELETE_CASCADE ) { + cascade->foreign = foreign; + + if (node->is_delete + && (foreign->type & DICT_FOREIGN_ON_DELETE_CASCADE)) { cascade->is_delete = TRUE; } else { cascade->is_delete = FALSE; @@ -425,8 +563,30 @@ row_ins_foreign_delete_or_set_null( } } + /* We do not allow cyclic cascaded updating of the same + table. Check that we are not updating the same table which + is already being modified in this cascade chain. We have to + check this because the modification of the indexes of a + 'parent' table may still be incomplete, and we must avoid + seeing the indexes of the parent table in an inconsistent + state! In this way we also prevent possible infinite + update loops caused by cyclic cascaded updates. */ + + if (!cascade->is_delete + && row_ins_cascade_ancestor_updates_table(cascade, table)) { + + /* We do not know if this would break foreign key + constraints, but play safe and return an error */ + + err = DB_ROW_IS_REFERENCED; + + goto nonstandard_exit_func; + } + index = btr_pcur_get_btr_cur(pcur)->index; + ut_a(index == foreign->foreign_index); + rec = btr_pcur_get_rec(pcur); if (index->type & DICT_CLUSTERED) { @@ -520,7 +680,11 @@ row_ins_foreign_delete_or_set_null( goto nonstandard_exit_func; } - if (foreign->type == DICT_FOREIGN_ON_DELETE_SET_NULL) { + if ((node->is_delete + && (foreign->type & DICT_FOREIGN_ON_DELETE_SET_NULL)) + || (!node->is_delete + && (foreign->type & DICT_FOREIGN_ON_UPDATE_SET_NULL))) { + /* Build the appropriate update vector which sets foreign->n_fields first fields in rec to SQL NULL */ @@ -540,6 +704,26 @@ row_ins_foreign_delete_or_set_null( } } + if (!node->is_delete + && (foreign->type & DICT_FOREIGN_ON_UPDATE_CASCADE)) { + + /* Build the appropriate update vector which sets changing + foreign->n_fields first fields in rec to new values */ + + row_ins_cascade_calc_update_vec(node, foreign); + + if (cascade->update->n_fields == 0) { + + /* The update does not change any columns referred + to in this foreign key constraint: no need to do + anything */ + + err = DB_SUCCESS; + + goto nonstandard_exit_func; + } + } + /* Store pcur position and initialize or store the cascade node pcur stored position */ @@ -629,6 +813,7 @@ row_ins_check_foreign_constraint( dtuple_t* entry, /* in: index entry for index */ que_thr_t* thr) /* in: query thread */ { + upd_node_t* upd_node; dict_table_t* check_table; dict_index_t* check_index; ulint n_fields_cmp; @@ -665,6 +850,30 @@ run_again: } } + if (que_node_get_type(thr->run_node) == QUE_NODE_UPDATE) { + upd_node = thr->run_node; + + if (!(upd_node->is_delete) && upd_node->foreign == foreign) { + /* If a cascaded update is done as defined by a + foreign key constraint, do not check that + constraint for the child row. In ON UPDATE CASCADE + the update of the parent row is only half done when + we come here: if we would check the constraint here + for the child row it would fail. + + A QUESTION remains: if in the child table there are + several constraints which refer to the same parent + table, we should merge all updates to the child as + one update? And the updates can be contradictory! + Currently we just perform the update associated + with each foreign key constraint, one after + another, and the user has problems predicting in + which order they are performed. */ + + return(DB_SUCCESS); + } + } + if (check_ref) { check_table = foreign->referenced_table; check_index = foreign->referenced_index; @@ -774,8 +983,12 @@ run_again: break; } else if (foreign->type != 0) { + /* There is an ON UPDATE or ON DELETE + condition: check them in a separate + function */ + err = - row_ins_foreign_delete_or_set_null( + row_ins_foreign_check_on_constraint( thr, foreign, &pcur, &mtr); if (err != DB_SUCCESS) { diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c index 9ce86b5d487..7cef63d1337 100644 --- a/innobase/row/row0mysql.c +++ b/innobase/row/row0mysql.c @@ -59,6 +59,19 @@ row_mysql_read_var_ref_noninline( } /*********************************************************************** +Frees the blob heap in prebuilt when no longer needed. */ + +void +row_mysql_prebuilt_free_blob_heap( +/*==============================*/ + row_prebuilt_t* prebuilt) /* in: prebuilt struct of a + ha_innobase:: table handle */ +{ + mem_heap_free(prebuilt->blob_heap); + prebuilt->blob_heap = NULL; +} + +/*********************************************************************** Stores a reference to a BLOB in the MySQL format. */ void @@ -313,6 +326,7 @@ row_create_prebuilt( prebuilt = mem_heap_alloc(heap, sizeof(row_prebuilt_t)); prebuilt->magic_n = ROW_PREBUILT_ALLOCATED; + prebuilt->magic_n2 = ROW_PREBUILT_ALLOCATED; prebuilt->table = table; @@ -378,11 +392,12 @@ row_prebuilt_free( { ulint i; - if (prebuilt->magic_n != ROW_PREBUILT_ALLOCATED) { + if (prebuilt->magic_n != ROW_PREBUILT_ALLOCATED + || prebuilt->magic_n2 != ROW_PREBUILT_ALLOCATED) { fprintf(stderr, - "InnoDB: Error: trying to free a corrupt\n" - "InnoDB: table handle. Magic n %lu, table name %s\n", - prebuilt->magic_n, prebuilt->table->name); +"InnoDB: Error: trying to free a corrupt\n" +"InnoDB: table handle. Magic n %lu, magic n2 %lu, table name %s\n", + prebuilt->magic_n, prebuilt->magic_n2, prebuilt->table->name); mem_analyze_corruption((byte*)prebuilt); @@ -390,6 +405,7 @@ row_prebuilt_free( } prebuilt->magic_n = ROW_PREBUILT_FREED; + prebuilt->magic_n2 = ROW_PREBUILT_FREED; btr_pcur_free_for_mysql(prebuilt->pcur); btr_pcur_free_for_mysql(prebuilt->clust_pcur); @@ -420,7 +436,23 @@ row_prebuilt_free( for (i = 0; i < MYSQL_FETCH_CACHE_SIZE; i++) { if (prebuilt->fetch_cache[i] != NULL) { - mem_free(prebuilt->fetch_cache[i]); + + if ((ROW_PREBUILT_FETCH_MAGIC_N != + mach_read_from_4((prebuilt->fetch_cache[i]) - 4)) + || (ROW_PREBUILT_FETCH_MAGIC_N != + mach_read_from_4((prebuilt->fetch_cache[i]) + + prebuilt->mysql_row_len))) { + fprintf(stderr, + "InnoDB: Error: trying to free a corrupt\n" + "InnoDB: fetch buffer.\n"); + + mem_analyze_corruption( + prebuilt->fetch_cache[i]); + + ut_a(0); + } + + mem_free((prebuilt->fetch_cache[i]) - 4); } } @@ -1435,7 +1467,7 @@ int row_create_index_for_mysql( /*=======================*/ /* out: error number or DB_SUCCESS */ - dict_index_t* index, /* in: index defintion */ + dict_index_t* index, /* in: index definition */ trx_t* trx) /* in: transaction handle */ { ind_node_t* node; @@ -1444,7 +1476,9 @@ row_create_index_for_mysql( ulint namelen; ulint keywordlen; ulint err; - + ulint i; + ulint j; + ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_EX)); ut_ad(mutex_own(&(dict_sys->mutex))); ut_ad(trx->mysql_thread_id == os_thread_get_curr_id()); @@ -1465,6 +1499,31 @@ row_create_index_for_mysql( return(DB_SUCCESS); } + /* Check that the same column does not appear twice in the index. + InnoDB assumes this in its algorithms, e.g., update of an index + entry */ + + for (i = 0; i < dict_index_get_n_fields(index); i++) { + for (j = 0; j < i; j++) { + if (0 == ut_strcmp( + dict_index_get_nth_field(index, j)->name, + dict_index_get_nth_field(index, i)->name)) { + + ut_print_timestamp(stderr); + + fprintf(stderr, +" InnoDB: Error: column %s appears twice in index %s of table %s\n" +"InnoDB: This is not allowed in InnoDB.\n", + dict_index_get_nth_field(index, i)->name, + index->name, index->table_name); + + err = DB_COL_APPEARS_TWICE_IN_INDEX; + + goto error_handling; + } + } + } + heap = mem_heap_create(512); trx->dict_operation = TRUE; @@ -1477,11 +1536,13 @@ row_create_index_for_mysql( SESS_COMM_EXECUTE, 0)); que_run_threads(thr); - err = trx->error_state; + err = trx->error_state; + que_graph_free((que_t*) que_node_get_parent(thr)); + +error_handling: if (err != DB_SUCCESS) { /* We have special error handling here */ - ut_a(err == DB_OUT_OF_FILE_SPACE); trx->error_state = DB_SUCCESS; @@ -1491,8 +1552,6 @@ row_create_index_for_mysql( trx->error_state = DB_SUCCESS; } - - que_graph_free((que_t*) que_node_get_parent(thr)); trx->op_info = (char *) ""; diff --git a/innobase/row/row0sel.c b/innobase/row/row0sel.c index a3744089258..34f951b0c8a 100644 --- a/innobase/row/row0sel.c +++ b/innobase/row/row0sel.c @@ -2039,9 +2039,12 @@ Note that the template in prebuilt may advise us to copy only a few columns to mysql_rec, other columns are left blank. All columns may not be needed in the query. */ static -void +ibool row_sel_store_mysql_rec( /*====================*/ + /* out: TRUE if success, FALSE + if could not allocate memory for a + BLOB */ byte* mysql_rec, /* out: row in the MySQL format */ row_prebuilt_t* prebuilt, /* in: prebuilt struct */ rec_t* rec) /* in: Innobase record in the index @@ -2092,7 +2095,19 @@ row_sel_store_mysql_rec( if (templ->type == DATA_BLOB) { ut_a(prebuilt->templ_contains_blob); - + + /* A heuristic test that we can allocate + the memory for a big BLOB. We have a safety + margin of 1000000 bytes. Since the test + takes some CPU time, we do not use for small + BLOBs. */ + + if (len > 2000000 + && !ut_test_malloc(len + 1000000)) { + + return(FALSE); + } + /* Copy the BLOB data to the BLOB heap of prebuilt */ @@ -2142,6 +2157,8 @@ row_sel_store_mysql_rec( } } } + + return(TRUE); } /************************************************************************* @@ -2415,6 +2432,7 @@ row_sel_push_cache_row_for_mysql( row_prebuilt_t* prebuilt, /* in: prebuilt struct */ rec_t* rec) /* in: record to push */ { + byte* buf; ulint i; ut_ad(prebuilt->n_fetch_cached < MYSQL_FETCH_CACHE_SIZE); @@ -2424,8 +2442,18 @@ row_sel_push_cache_row_for_mysql( /* Allocate memory for the fetch cache */ for (i = 0; i < MYSQL_FETCH_CACHE_SIZE; i++) { - prebuilt->fetch_cache[i] = mem_alloc( - prebuilt->mysql_row_len); + + /* A user has reported memory corruption in these + buffers in Linux. Put magic numbers there to help + to track a possible bug. */ + + buf = mem_alloc(prebuilt->mysql_row_len + 8); + + prebuilt->fetch_cache[i] = buf + 4; + + mach_write_to_4(buf, ROW_PREBUILT_FETCH_MAGIC_N); + mach_write_to_4(buf + 4 + prebuilt->mysql_row_len, + ROW_PREBUILT_FETCH_MAGIC_N); } } @@ -2437,7 +2465,7 @@ row_sel_push_cache_row_for_mysql( prebuilt->n_fetch_cached++; } - + /************************************************************************* Tries to do a shortcut to fetch a clustered index record with a unique key, using the hash index if possible (not always). We assume that the search @@ -2515,7 +2543,8 @@ row_search_for_mysql( /*=================*/ /* out: DB_SUCCESS, DB_RECORD_NOT_FOUND, - DB_END_OF_INDEX, or DB_DEADLOCK */ + DB_END_OF_INDEX, DB_DEADLOCK, + or DB_TOO_BIG_RECORD */ byte* buf, /* in/out: buffer for the fetched row in the MySQL format */ ulint mode, /* in: search mode PAGE_CUR_L, ... */ @@ -2747,7 +2776,12 @@ row_search_for_mysql( #ifdef UNIV_SEARCH_DEBUG ut_a(0 == cmp_dtuple_rec(search_tuple, rec)); #endif - row_sel_store_mysql_rec(buf, prebuilt, rec); + if (!row_sel_store_mysql_rec(buf, prebuilt, + rec)) { + err = DB_TOO_BIG_RECORD; + + goto lock_wait_or_error; + } mtr_commit(&mtr); @@ -3189,7 +3223,11 @@ rec_loop: rec_get_size(rec)); mach_write_to_4(buf, rec_get_extra_size(rec) + 4); } else { - row_sel_store_mysql_rec(buf, prebuilt, rec); + if (!row_sel_store_mysql_rec(buf, prebuilt, rec)) { + err = DB_TOO_BIG_RECORD; + + goto lock_wait_or_error; + } } if (prebuilt->clust_index_was_generated) { diff --git a/innobase/row/row0upd.c b/innobase/row/row0upd.c index 1231c94da63..64569bf3f96 100644 --- a/innobase/row/row0upd.c +++ b/innobase/row/row0upd.c @@ -71,6 +71,20 @@ the x-latch freed? The most efficient way for performing a searched delete is obviously to keep the x-latch for several steps of query graph execution. */ +/*************************************************************** +Checks if an update vector changes some of the first fields of an index +record. */ +static +ibool +row_upd_changes_first_fields( +/*=========================*/ + /* out: TRUE if changes */ + dtuple_t* entry, /* in: old value of index entry */ + dict_index_t* index, /* in: index of entry */ + upd_t* update, /* in: update vector for the row */ + ulint n); /* in: how many first fields to check */ + + /************************************************************************* Checks if index currently is mentioned as a referenced index in a foreign key constraint. */ @@ -132,6 +146,7 @@ ulint row_upd_check_references_constraints( /*=================================*/ /* out: DB_SUCCESS or an error code */ + upd_node_t* node, /* in: row update node */ btr_pcur_t* pcur, /* in: cursor positioned on a record; NOTE: the cursor position is lost in this function! */ dict_table_t* table, /* in: table in question */ @@ -173,7 +188,16 @@ row_upd_check_references_constraints( foreign = UT_LIST_GET_FIRST(table->referenced_list); while (foreign) { - if (foreign->referenced_index == index) { + /* Note that we may have an update which updates the index + record, but does NOT update the first fields which are + referenced in a foreign key constraint. Then the update does + NOT break the constraint. */ + + if (foreign->referenced_index == index + && (node->is_delete + || row_upd_changes_first_fields(entry, index, + node->update, foreign->n_fields))) { + if (foreign->foreign_table == NULL) { dict_table_get(foreign->foreign_table_name, trx); @@ -189,10 +213,9 @@ row_upd_check_references_constraints( } /* NOTE that if the thread ends up waiting for a lock - we will release dict_operation_lock - temporarily! But the counter on the table - protects 'foreign' from being dropped while the check - is running. */ + we will release dict_operation_lock temporarily! + But the counter on the table protects 'foreign' from + being dropped while the check is running. */ err = row_ins_check_foreign_constraint(FALSE, foreign, table, index, entry, thr); @@ -255,6 +278,7 @@ upd_node_create( node->index = NULL; node->update = NULL; + node->foreign = NULL; node->cascade_heap = NULL; node->cascade_node = NULL; @@ -953,6 +977,53 @@ row_upd_changes_some_index_ord_field_binary( return(FALSE); } +/*************************************************************** +Checks if an update vector changes some of the first fields of an index +record. */ +static +ibool +row_upd_changes_first_fields( +/*=========================*/ + /* out: TRUE if changes */ + dtuple_t* entry, /* in: index entry */ + dict_index_t* index, /* in: index of entry */ + upd_t* update, /* in: update vector for the row */ + ulint n) /* in: how many first fields to check */ +{ + upd_field_t* upd_field; + dict_field_t* ind_field; + dict_col_t* col; + ulint n_upd_fields; + ulint col_pos; + ulint i, j; + + ut_a(update && index); + ut_a(n <= dict_index_get_n_fields(index)); + + n_upd_fields = upd_get_n_fields(update); + + for (i = 0; i < n; i++) { + + ind_field = dict_index_get_nth_field(index, i); + col = dict_field_get_col(ind_field); + col_pos = dict_col_get_clust_pos(col); + + for (j = 0; j < n_upd_fields; j++) { + + upd_field = upd_get_nth_field(update, j); + + if (col_pos == upd_field->field_no + && cmp_dfield_dfield( + dtuple_get_nth_field(entry, i), + &(upd_field->new_val))) { + return(TRUE); + } + } + } + + return(FALSE); +} + /************************************************************************* Copies the column values from a record. */ UNIV_INLINE @@ -1106,9 +1177,11 @@ row_upd_sec_index_entry( err = btr_cur_del_mark_set_sec_rec(0, btr_cur, TRUE, thr, &mtr); if (err == DB_SUCCESS && check_ref) { + /* NOTE that the following call loses the position of pcur ! */ err = row_upd_check_references_constraints( + node, &pcur, index->table, index, thr, &mtr); if (err != DB_SUCCESS) { @@ -1224,7 +1297,7 @@ row_upd_clust_rec_by_insert( if (check_ref) { /* NOTE that the following call loses the position of pcur ! */ - err = row_upd_check_references_constraints( + err = row_upd_check_references_constraints(node, pcur, table, index, thr, mtr); if (err != DB_SUCCESS) { @@ -1392,7 +1465,8 @@ row_upd_del_mark_clust_rec( if (err == DB_SUCCESS && check_ref) { /* NOTE that the following call loses the position of pcur ! */ - err = row_upd_check_references_constraints(pcur, index->table, + err = row_upd_check_references_constraints(node, + pcur, index->table, index, thr, mtr); if (err != DB_SUCCESS) { mtr_commit(mtr); diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c index f9eba721cbc..6612b2006eb 100644 --- a/innobase/srv/srv0srv.c +++ b/innobase/srv/srv0srv.c @@ -140,9 +140,14 @@ byte srv_latin1_ordering[256] /* The sort order table of the latin1 , 0xD8, 0x55, 0x55, 0x55, 0x59, 0x59, 0xDE, 0xFF }; -ulint srv_pool_size = ULINT_MAX; /* size in database pages; - MySQL originally sets this - value in megabytes */ +ulint srv_pool_size = ULINT_MAX; /* size in pages; MySQL inits + this to size in kilobytes but + we normalize this to pages in + srv_boot() */ +ulint srv_awe_window_size = 0; /* size in pages; MySQL inits + this to bytes, but we + normalize it to pages in + srv_boot() */ ulint srv_mem_pool_size = ULINT_MAX; /* size in bytes */ ulint srv_lock_table_size = ULINT_MAX; @@ -218,6 +223,13 @@ ibool srv_use_doublewrite_buf = TRUE; ibool srv_set_thread_priorities = TRUE; int srv_query_thread_priority = 0; + +/* TRUE if the Address Windowing Extensions of Windows are used; then we must +disable adaptive hash indexes */ +ibool srv_use_awe = FALSE; +ibool srv_use_adaptive_hash_indexes = TRUE; + + /*-------------------------------------------*/ ulint srv_n_spin_wait_rounds = 20; ulint srv_spin_wait_delay = 5; @@ -1956,9 +1968,19 @@ srv_normalize_init_values(void) srv_log_buffer_size = srv_log_buffer_size / UNIV_PAGE_SIZE; - srv_pool_size = srv_pool_size / UNIV_PAGE_SIZE; + srv_pool_size = srv_pool_size / (UNIV_PAGE_SIZE / 1024); + + srv_awe_window_size = srv_awe_window_size / UNIV_PAGE_SIZE; - srv_lock_table_size = 20 * srv_pool_size; + if (srv_use_awe) { + /* If we are using AWE we must save memory in the 32-bit + address space of the process, and cannot bind the lock + table size to the real buffer pool size. */ + + srv_lock_table_size = 20 * srv_awe_window_size; + } else { + srv_lock_table_size = 5 * srv_pool_size; + } return(DB_SUCCESS); } @@ -2323,6 +2345,18 @@ srv_sprintf_innodb_monitor( "Total memory allocated %lu; in additional pool allocated %lu\n", ut_total_allocated_memory, mem_pool_get_reserved(mem_comm_pool)); + + if (mem_out_of_mem_err_msg_count > 0) { + buf += sprintf(buf, + "Mem allocation has spilled out of additional mem pool %lu times\n"); + } + + if (srv_use_awe) { + buf += sprintf(buf, + "In addition to that %lu MB of AWE memory allocated\n", + srv_pool_size / ((1024 * 1024) / UNIV_PAGE_SIZE)); + } + buf_print_io(buf, buf_end); buf = buf + strlen(buf); ut_a(buf < buf_end + 1500); diff --git a/innobase/srv/srv0start.c b/innobase/srv/srv0start.c index d6e8a8dcb4a..e1d436a879c 100644 --- a/innobase/srv/srv0start.c +++ b/innobase/srv/srv0start.c @@ -529,6 +529,9 @@ open_or_create_log_file( new database */ ibool* log_file_created, /* out: TRUE if new log file created */ + ibool log_file_has_been_opened,/* in: TRUE if a log file has been + opened before: then it is an error + to try to create another log file */ ulint k, /* in: log group number */ ulint i) /* in: log file number in group */ { @@ -581,12 +584,17 @@ open_or_create_log_file( } } else { *log_file_created = TRUE; - + ut_print_timestamp(stderr); fprintf(stderr, " InnoDB: Log file %s did not exist: new to be created\n", name); + if (log_file_has_been_opened) { + + return(DB_ERROR); + } + fprintf(stderr, "InnoDB: Setting log file %s size to %lu MB\n", name, srv_log_file_size >> (20 - UNIV_PAGE_SIZE_SHIFT)); @@ -927,6 +935,7 @@ innobase_start_or_create_for_mysql(void) /*====================================*/ /* out: DB_SUCCESS or error code */ { + buf_pool_t* ret; ibool create_new_db; ibool log_file_created; ibool log_created = FALSE; @@ -964,6 +973,11 @@ innobase_start_or_create_for_mysql(void) "InnoDB: !!!!!!!!!!!!!! UNIV_MEM_DEBUG switched on !!!!!!!!!!!!!!!\n"); #endif +#ifdef UNIV_SIMULATE_AWE + fprintf(stderr, +"InnoDB: !!!!!!!!!!!!!! UNIV_SIMULATE_AWE switched on !!!!!!!!!!!!!!!!!\n"); +#endif + if (srv_sizeof_trx_t_in_ha_innodb_cc != (ulint)sizeof(trx_t)) { fprintf(stderr, "InnoDB: Error: trx_t size is %lu in ha_innodb.cc but %lu in srv0start.c\n" @@ -994,6 +1008,17 @@ innobase_start_or_create_for_mysql(void) srv_startup_is_before_trx_rollback_phase = TRUE; os_aio_use_native_aio = FALSE; +#if !defined(__NT__) && !defined(UNIV_SIMULATE_AWE) + if (srv_use_awe) { + + fprintf(stderr, +"InnoDB: Error: You have specified innodb_buffer_pool_awe_mem_mb\n" +"InnoDB: in my.cnf, but AWE can only be used in Windows 2000 and later.\n"); + + return(DB_ERROR); + } +#endif + #ifdef __WIN__ if (os_get_os_version() == OS_WIN95 || os_get_os_version() == OS_WIN31 @@ -1049,6 +1074,9 @@ innobase_start_or_create_for_mysql(void) return(DB_ERROR); } + /* Note that the call srv_boot() also changes the values of + srv_pool_size etc. to the units used by InnoDB internally */ + err = srv_boot(); if (err != DB_SUCCESS) { @@ -1080,7 +1108,26 @@ innobase_start_or_create_for_mysql(void) fil_init(SRV_MAX_N_OPEN_FILES); - buf_pool_init(srv_pool_size, srv_pool_size); + if (srv_use_awe) { + fprintf(stderr, +"InnoDB: Using AWE: Memory window is %lu MB and AWE memory is %lu MB\n", + srv_awe_window_size / ((1024 * 1024) / UNIV_PAGE_SIZE), + srv_pool_size / ((1024 * 1024) / UNIV_PAGE_SIZE)); + + /* We must disable adaptive hash indexes because they do not + tolerate remapping of pages in AWE */ + + srv_use_adaptive_hash_indexes = FALSE; + ret = buf_pool_init(srv_pool_size, srv_pool_size, + srv_awe_window_size); + } else { + ret = buf_pool_init(srv_pool_size, srv_pool_size, + srv_pool_size); + } + + if (ret == NULL) { + return(DB_ERROR); + } fsp_init(); log_init(); @@ -1160,7 +1207,8 @@ innobase_start_or_create_for_mysql(void) for (i = 0; i < srv_n_log_files; i++) { err = open_or_create_log_file(create_new_db, - &log_file_created, k, i); + &log_file_created, + log_opened, k, i); if (err != DB_SUCCESS) { return((int) err); diff --git a/innobase/ut/ut0mem.c b/innobase/ut/ut0mem.c index 03f15031fdf..a5991d5683d 100644 --- a/innobase/ut/ut0mem.c +++ b/innobase/ut/ut0mem.c @@ -77,8 +77,9 @@ ut_malloc_low( ret = malloc(n + sizeof(ut_mem_block_t)); if (ret == NULL) { + ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: Fatal error: cannot allocate %lu bytes of\n" + " InnoDB: Fatal error: cannot allocate %lu bytes of\n" "InnoDB: memory with malloc! Total allocated memory\n" "InnoDB: by InnoDB %lu bytes. Operating system errno: %d\n" "InnoDB: Cannot continue operation!\n" @@ -135,6 +136,40 @@ ut_malloc( } /************************************************************************** +Tests if malloc of n bytes would succeed. ut_malloc() asserts if memory runs +out. It cannot be used if we want to return an error message. Prints to +stderr a message if fails. */ + +ibool +ut_test_malloc( +/*===========*/ + /* out: TRUE if succeeded */ + ulint n) /* in: try to allocate this many bytes */ +{ + void* ret; + + ret = malloc(n); + + if (ret == NULL) { + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: Error: cannot allocate %lu bytes of memory for\n" + "InnoDB: a BLOB with malloc! Total allocated memory\n" + "InnoDB: by InnoDB %lu bytes. Operating system errno: %d\n" + "InnoDB: Check if you should increase the swap file or\n" + "InnoDB: ulimits of your operating system.\n" + "InnoDB: On FreeBSD check you have compiled the OS with\n" + "InnoDB: a big enough maximum process size.\n", + n, ut_total_allocated_memory, errno); + return(FALSE); + } + + free(ret); + + return(TRUE); +} + +/************************************************************************** Frees a memory block allocated with ut_malloc. */ void diff --git a/innobase/ut/ut0ut.c b/innobase/ut/ut0ut.c index c77cbe9cdcf..ff5d11d84ed 100644 --- a/innobase/ut/ut0ut.c +++ b/innobase/ut/ut0ut.c @@ -262,7 +262,7 @@ ut_print_buf( data = buf; for (i = 0; i < len; i++) { - if (isprint((char)(*data))) { + if (isprint((int)(*data))) { printf("%c", (char)*data); } data++; @@ -302,7 +302,7 @@ ut_sprintf_buf( data = buf; for (i = 0; i < len; i++) { - if (isprint((char)(*data))) { + if (isprint((int)(*data))) { n += sprintf(str + n, "%c", (char)*data); } else { n += sprintf(str + n, "."); diff --git a/libmysql/Makefile.shared b/libmysql/Makefile.shared index a2e6fddff0f..47b582bc78e 100644 --- a/libmysql/Makefile.shared +++ b/libmysql/Makefile.shared @@ -37,12 +37,12 @@ mystringsobjects = strmov.lo strxmov.lo strxnmov.lo strnmov.lo \ int2str.lo str2int.lo strinstr.lo strcont.lo \ strcend.lo bcmp.lo \ bchange.lo bmove.lo bmove_upp.lo longlong2str.lo \ - strtoull.lo strtoll.lo llstr.lo \ + strtoull.lo strtoll.lo llstr.lo my_vsnprintf.lo \ ctype.lo ctype-simple.lo ctype-bin.lo ctype-mb.lo \ ctype-big5.lo ctype-czech.lo ctype-euc_kr.lo \ ctype-win1250ch.lo ctype-utf8.lo \ ctype-gb2312.lo ctype-gbk.lo ctype-latin1_de.lo \ - ctype-sjis.lo ctype-tis620.lo ctype-ujis.lo + ctype-sjis.lo ctype-tis620.lo ctype-ujis.lo xml.lo mystringsextra= strto.c dbugobjects = dbug.lo # IT IS IN SAFEMALLOC.C sanity.lo @@ -60,7 +60,7 @@ mysysobjects1 = my_init.lo my_static.lo my_malloc.lo my_realloc.lo \ my_compress.lo array.lo my_once.lo list.lo my_net.lo \ charset.lo hash.lo mf_iocache.lo \ mf_iocache2.lo my_seek.lo \ - my_pread.lo mf_cache.lo my_vsnprintf.lo md5.lo sha1.lo\ + my_pread.lo mf_cache.lo md5.lo sha1.lo\ my_getopt.lo my_gethostbyname.lo my_port.lo sqlobjects = net.lo diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 87093059d92..7757050aad7 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -61,7 +61,7 @@ static my_bool mysql_client_init=0; uint mysql_port=0; my_string mysql_unix_port=0; ulong net_buffer_length=8192; -ulong max_allowed_packet=16*1024*1024L; +ulong max_allowed_packet= 1024L*1024L*1024L; ulong net_read_timeout= NET_READ_TIMEOUT; ulong net_write_timeout= NET_WRITE_TIMEOUT; @@ -928,7 +928,8 @@ static const char *default_options[]= "character-sets-dir", "default-character-set", "interactive-timeout", "connect-timeout", "local-infile", "disable-local-infile", "replication-probe", "enable-reads-from-master", "repl-parse-query", - "ssl-cipher","protocol", "shared_memory_base_name", + "ssl-cipher", "max-allowed-packet", + "protocol", "shared-memory-base-name", NullS }; @@ -947,7 +948,7 @@ static int add_init_command(struct st_mysql_options *options, const char *cmd) } if (!(tmp= my_strdup(cmd,MYF(MY_WME))) || - insert_dynamic(options->init_commands, (byte*)&tmp)) + insert_dynamic(options->init_commands, (gptr)&tmp)) { my_free(tmp, MYF(MY_ALLOW_ZERO_PTR)); return 1; @@ -1099,14 +1100,17 @@ static void mysql_read_default_options(struct st_mysql_options *options, case 25: /* repl-parse-query */ options->rpl_parse= 1; break; - case 27:/* protocol */ + case 27: + options->max_allowed_packet= atoi(opt_arg); + break; + case 28: /* protocol */ if ((options->protocol = find_type(opt_arg, &sql_protocol_typelib,0)) == ~(ulong) 0) { fprintf(stderr, "Unknown option to protocol: %s\n", opt_arg); exit(1); } break; - case 28: /*shared_memory_base_name*/ + case 29: /* shared_memory_base_name */ #ifdef HAVE_SMEM if (options->shared_memory_base_name != def_shared_memory_base_name) my_free(options->shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR)); @@ -1269,7 +1273,7 @@ static MYSQL_DATA *read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields, else { cur->data[field] = to; - if (to+len > end_to) + if (len > (ulong) (end_to - to)) { free_rows(result); net->last_errno=CR_MALFORMED_PACKET; @@ -1315,7 +1319,7 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths) { uint field; ulong pkt_len,len; - uchar *pos,*prev_pos; + uchar *pos,*prev_pos, *end_pos; if ((pkt_len=net_safe_read(mysql)) == packet_error) return -1; @@ -1327,6 +1331,7 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths) } prev_pos= 0; /* allowed to write at packet[-1] */ pos=mysql->net.read_pos; + end_pos=pos+pkt_len; for (field=0 ; field < fields ; field++) { if ((len=(ulong) net_field_length(&pos)) == NULL_LENGTH) @@ -1336,6 +1341,12 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths) } else { + if (len > (ulong) (end_pos - pos)) + { + mysql->net.last_errno=CR_UNKNOWN_ERROR; + strmov(mysql->net.last_error,ER(mysql->net.last_errno)); + return -1; + } row[field] = (char*) pos; pos+=len; *lengths++=len; @@ -1753,7 +1764,7 @@ mysql_ssl_set(MYSQL *mysql __attribute__((unused)) , mysql->options.ssl_ca= strdup_if_not_null(ca); mysql->options.ssl_capath= strdup_if_not_null(capath); mysql->options.ssl_cipher= strdup_if_not_null(cipher); -#endif +#endif /* HAVE_OPENSSL */ return 0; } @@ -1763,10 +1774,10 @@ mysql_ssl_set(MYSQL *mysql __attribute__((unused)) , NB! Errors are not reported until you do mysql_real_connect. **************************************************************************/ +#ifdef HAVE_OPENSSL static void mysql_ssl_free(MYSQL *mysql __attribute__((unused))) { -#ifdef HAVE_OPENSLL my_free(mysql->options.ssl_key, MYF(MY_ALLOW_ZERO_PTR)); my_free(mysql->options.ssl_cert, MYF(MY_ALLOW_ZERO_PTR)); my_free(mysql->options.ssl_ca, MYF(MY_ALLOW_ZERO_PTR)); @@ -1780,8 +1791,8 @@ mysql_ssl_free(MYSQL *mysql __attribute__((unused))) mysql->options.ssl_cipher= 0; mysql->options.use_ssl = FALSE; mysql->connector_fd = 0; -#endif /* HAVE_OPENSLL */ } +#endif /* HAVE_OPENSSL */ /************************************************************************** Connect to sql server @@ -2235,6 +2246,7 @@ Try also with PIPE or TCP/IP DBUG_PRINT("info",("Server version = '%s' capabilites: %ld status: %d client_flag: %d", mysql->server_version,mysql->server_capabilities, mysql->server_status, client_flag)); + /* This needs to be changed as it's not useful with big packets */ int3store(buff+2,max_allowed_packet); if (user && user[0]) strmake(buff+5,user,32); /* Max user name */ @@ -2343,6 +2355,8 @@ Try also with PIPE or TCP/IP if (client_flag & CLIENT_COMPRESS) /* We will use compression */ net->compress=1; + if (mysql->options.max_allowed_packet) + net->max_packet_size= mysql->options.max_allowed_packet; if (db && mysql_select_db(mysql,db)) goto error; @@ -2623,8 +2637,13 @@ mysql_close(MYSQL *mysql) my_free(mysql->options.charset_name,MYF(MY_ALLOW_ZERO_PTR)); if (mysql->options.init_commands) { - delete_dynamic(mysql->options.init_commands); - my_free((char*)mysql->options.init_commands,MYF(MY_WME)); + DYNAMIC_ARRAY *init_commands= mysql->options.init_commands; + char **ptr= (char**)init_commands->buffer; + char **end= ptr + init_commands->elements; + for (; ptr<end; ptr++) + my_free(*ptr,MYF(MY_WME)); + delete_dynamic(init_commands); + my_free((char*)init_commands,MYF(MY_WME)); } #ifdef HAVE_OPENSSL mysql_ssl_free(mysql); @@ -2841,7 +2860,7 @@ mysql_real_query(MYSQL *mysql, const char *query, ulong length) { DBUG_ENTER("mysql_real_query"); DBUG_PRINT("enter",("handle: %lx",mysql)); - DBUG_PRINT("query",("Query = \"%s\"",query)); + DBUG_PRINT("query",("Query = '%-.4096s'",query)); if (mysql_send_query(mysql,query,length)) DBUG_RETURN(1); @@ -3503,18 +3522,6 @@ uint STDCALL mysql_thread_safe(void) #endif } -MYSQL_RES *STDCALL mysql_warnings(MYSQL *mysql) -{ - uint warning_count; - DBUG_ENTER("mysql_warnings"); - /* Save warning count as mysql_real_query may change this */ - warning_count= mysql->warning_count; - if (mysql_real_query(mysql, "SHOW WARNINGS", 13)) - DBUG_RETURN(0); - mysql->warning_count= warning_count; - DBUG_RETURN(mysql_store_result(mysql)); -} - /**************************************************************************** Some support functions ****************************************************************************/ @@ -3819,12 +3826,13 @@ static my_bool my_realloc_str(NET *net, ulong length) 1 error */ -static my_bool read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt) +static my_bool read_prepare_result(MYSQL_STMT *stmt) { uchar *pos; uint field_count; + ulong length, param_count; MYSQL_DATA *fields_data; - ulong length; + MYSQL *mysql= stmt->mysql; DBUG_ENTER("read_prepare_result"); mysql= mysql->last_used_con; @@ -3832,9 +3840,9 @@ static my_bool read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt) DBUG_RETURN(1); pos=(uchar*) mysql->net.read_pos; - stmt->stmt_id= uint4korr(pos); pos+=4; - field_count= uint2korr(pos); pos+=2; - stmt->param_count=uint2korr(pos); pos+=2; + stmt->stmt_id= uint4korr(pos); pos+=4; + field_count= uint2korr(pos); pos+=2; + param_count= uint2korr(pos); pos+=2; if (field_count != 0) { @@ -3857,9 +3865,10 @@ static my_bool read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt) set_stmt_error(stmt, CR_OUT_OF_MEMORY); DBUG_RETURN(0); } - stmt->bind= (stmt->params + stmt->param_count); - stmt->field_count= (uint) field_count; - mysql->status= MYSQL_STATUS_READY; + stmt->bind= (stmt->params + stmt->param_count); + stmt->field_count= (uint) field_count; + stmt->param_count= (ulong) param_count; + stmt->mysql->status= MYSQL_STATUS_READY; DBUG_RETURN(0); } @@ -3903,13 +3912,13 @@ mysql_prepare(MYSQL *mysql, const char *query, ulong length) } init_alloc_root(&stmt->mem_root,8192,0); - if (read_prepare_result(mysql, stmt)) + stmt->mysql= mysql; + if (read_prepare_result(stmt)) { stmt_close(stmt, 1); DBUG_RETURN(0); } stmt->state= MY_ST_PREPARE; - stmt->mysql= mysql; mysql->stmts= list_add(mysql->stmts, &stmt->list); stmt->list.data= stmt; DBUG_PRINT("info", ("Parameter count: %ld", stmt->param_count)); @@ -3927,11 +3936,15 @@ mysql_prepare_result(MYSQL_STMT *stmt) { MYSQL_RES *result; DBUG_ENTER("mysql_prepare_result"); - - if (!stmt->fields) + + if (!stmt->field_count || !stmt->fields) DBUG_RETURN(0); - result= &stmt->tmp_result; - bzero((char*) result, sizeof(MYSQL_RES)); + + if (!(result=(MYSQL_RES*) my_malloc(sizeof(*result)+ + sizeof(ulong)*stmt->field_count, + MYF(MY_WME | MY_ZEROFILL)))) + return 0; + result->eof=1; /* Marker for buffered */ result->fields= stmt->fields; result->field_count= stmt->field_count; @@ -4083,12 +4096,13 @@ static my_bool store_param(MYSQL_STMT *stmt, MYSQL_BIND *param) DBUG_ENTER("store_param"); DBUG_PRINT("enter",("type: %d, buffer:%lx, length: %d", param->buffer_type, param->buffer ? param->buffer : "0", *param->length)); - - if (param->is_null || param->buffer_type == MYSQL_TYPE_NULL) + + if (param->buffer_type == MYSQL_TYPE_NULL || + *param->length == MYSQL_NULL_DATA) store_param_null(net, param); else { - /* Allocate for worst case (long string) */ + /* Allocate for worst case (long string) */ if ((my_realloc_str(net, 9 + *param->length))) DBUG_RETURN(1); (*param->store_param_func)(net, param); @@ -4096,7 +4110,6 @@ static my_bool store_param(MYSQL_STMT *stmt, MYSQL_BIND *param) DBUG_RETURN(0); } - /* Send the prepare query to server for execution */ @@ -4120,13 +4133,6 @@ static my_bool execute(MYSQL_STMT * stmt, char *packet, ulong length) } stmt->state= MY_ST_EXECUTE; mysql_free_result(stmt->result); -#if USED_IN_FETCH - if (stmt->res_buffers) /* Result buffers exists, cache results */ - { - mysql_free_result(stmt->result); - stmt->result= mysql_store_result(mysql); - } - #endif DBUG_RETURN(0); } @@ -4184,7 +4190,7 @@ int STDCALL mysql_execute(MYSQL_STMT *stmt) for (param= stmt->params; param < param_end; param++) { /* Check for long data which has not been propery given/terminated */ - if (param->is_long_data) + if (*param->length == MYSQL_LONG_DATA) { if (!param->long_ended) DBUG_RETURN(MYSQL_NEED_DATA); @@ -4219,6 +4225,14 @@ ulong STDCALL mysql_param_count(MYSQL_STMT * stmt) DBUG_RETURN(stmt->param_count); } +/* + Return total affected rows from the last statement +*/ + +my_ulonglong STDCALL mysql_stmt_affected_rows(MYSQL_STMT *stmt) +{ + return stmt->mysql->last_used_con->affected_rows; +} /* Setup the parameter data buffers from application @@ -4252,7 +4266,7 @@ my_bool STDCALL mysql_bind_param(MYSQL_STMT *stmt, MYSQL_BIND * bind) param++) { param->param_number= count++; - if (param->is_long_data && + if (param->length && *param->length == MYSQL_LONG_DATA && (param->buffer_type < MYSQL_TYPE_TINY_BLOB || param->buffer_type > MYSQL_TYPE_STRING)) { @@ -4275,7 +4289,7 @@ my_bool STDCALL mysql_bind_param(MYSQL_STMT *stmt, MYSQL_BIND * bind) /* Setup data copy functions for the different supported types */ switch (param->buffer_type) { case MYSQL_TYPE_NULL: - param->is_null=1; + param->bind_length= MYSQL_NULL_DATA; break; case MYSQL_TYPE_TINY: param->bind_length= 1; @@ -4406,6 +4420,318 @@ mysql_send_long_data(MYSQL_STMT *stmt, uint param_number, 1 Error (Can't alloc net->buffer) ****************************************************************************/ +/* Return the default binary data length for the common types */ +static unsigned int get_binary_length(uint type) +{ + switch(type) { + case MYSQL_TYPE_TINY: + return 1; + case MYSQL_TYPE_SHORT: + case MYSQL_TYPE_YEAR: + return 2; + case MYSQL_TYPE_LONG: + case MYSQL_TYPE_FLOAT: + return 4; + case MYSQL_TYPE_LONGLONG: + case MYSQL_TYPE_DOUBLE: + return 8; + default: + return 0; + } +} + +/* Convert Numeric to buffer types */ +static void send_data_long(MYSQL_BIND *param, longlong value) +{ + char *buffer= param->buffer; + + switch(param->buffer_type) { + case MYSQL_TYPE_TINY: + *param->buffer= (uchar) value; + break; + case MYSQL_TYPE_SHORT: + int2store(buffer, (short)value); + break; + case MYSQL_TYPE_LONG: + int4store(buffer, (int32)value); + break; + case MYSQL_TYPE_LONGLONG: + int8store(buffer, (longlong)value); + break; + case MYSQL_TYPE_FLOAT: + { + float data= (float)value; + float4store(buffer, data); + break; + } + case MYSQL_TYPE_DOUBLE: + { + double data= (double)value; + float8store(buffer, data); + break; + } + default: + { + uint length= sprintf(buffer,"%lld",value); + *param->length= length; + buffer[length]='\0'; + } + } +} + +/* Convert Double to buffer types */ +static void send_data_double(MYSQL_BIND *param, double value) +{ + char *buffer= param->buffer; + + switch(param->buffer_type) { + case MYSQL_TYPE_TINY: + *buffer= (uchar)value; + break; + case MYSQL_TYPE_SHORT: + int2store(buffer, (short)value); + break; + case MYSQL_TYPE_LONG: + int4store(buffer, (int32)value); + break; + case MYSQL_TYPE_LONGLONG: + int8store(buffer, (longlong)value); + break; + case MYSQL_TYPE_FLOAT: + { + float data= (float)value; + float4store(buffer, data); + break; + } + case MYSQL_TYPE_DOUBLE: + { + double data= (double)value; + float8store(buffer, data); + break; + } + default: + { + uint length= sprintf(buffer,"%g",value); + *param->length= length; + buffer[length]='\0'; + } + } +} + +/* Convert string to buffer types */ +static void send_data_str(MYSQL_BIND *param, char *value, uint length) +{ + char *buffer= param->buffer; + + switch(param->buffer_type) { + case MYSQL_TYPE_TINY: + { + uchar data= (uchar)my_strntol(system_charset_info,value,length,NULL,10); + *buffer= data; + break; + } + case MYSQL_TYPE_SHORT: + { + short data= (short)my_strntol(system_charset_info,value,length,NULL,10); + int2store(buffer, data); + break; + } + case MYSQL_TYPE_LONG: + { + int32 data= (int32)my_strntol(system_charset_info,value,length,NULL,10); + int4store(buffer, data); + break; + } + case MYSQL_TYPE_LONGLONG: + { + longlong data= my_strntoll(system_charset_info,value,length,NULL,10); + int8store(buffer, data); + break; + } + case MYSQL_TYPE_FLOAT: + { + float data = (float)my_strntod(system_charset_info,value,length,NULL); + float4store(buffer, data); + break; + } + case MYSQL_TYPE_DOUBLE: + { + double data= my_strntod(system_charset_info,value,length,NULL); + float8store(buffer, data); + break; + } + default: + *param->length= length; + memcpy(buffer, value, length); + buffer[length]='\0'; + } +} + +/* Fetch data to buffers */ +static my_bool fetch_results(MYSQL_STMT *stmt, MYSQL_BIND *param, + uint field_type, uchar **row) +{ + ulong length; + + length= (ulong)get_binary_length(field_type); + + switch (field_type) { + case MYSQL_TYPE_TINY: + { + uchar value= (uchar) **row; + send_data_long(param,(longlong)value); + break; + } + case MYSQL_TYPE_SHORT: + case MYSQL_TYPE_YEAR: + { + short value= (short)sint2korr(*row); + send_data_long(param,(longlong)value); + break; + } + case MYSQL_TYPE_LONG: + { + int32 value= (int32)sint4korr(*row); + send_data_long(param,(int32)value); + break; + } + case MYSQL_TYPE_LONGLONG: + { + longlong value= (longlong)sint8korr(*row); + send_data_long(param,value); + break; + } + case MYSQL_TYPE_FLOAT: + { + float value; + float4get(value,*row); + send_data_double(param,(double)value); + break; + } + case MYSQL_TYPE_DOUBLE: + { + double value; + float8get(value,*row); + send_data_double(param,(double)value); + break; + } + case MYSQL_TYPE_DATE: + case MYSQL_TYPE_DATETIME: + case MYSQL_TYPE_TIMESTAMP: + { + uchar month,day; + short year; + int arg_length; + char ts[50],frac[10],time[20],date[20]; + + if (!(length= net_field_length(row))) + { + *param->length= 0; + break; + } + if (param->buffer_type < MYSQL_TYPE_VAR_STRING || + param->buffer_type > MYSQL_TYPE_STRING) + { + /* + Don't allow fetching of date/time/ts to non-string types + TODO: Allow fetching of date or time to long types. + */ + sprintf(stmt->last_error, + ER(stmt->last_errno= CR_UNSUPPORTED_PARAM_TYPE), + param->buffer_type, param->param_number); + return 1; + } + + arg_length= 0; + if (length > 7) + { + int sec_part= sint4korr(*row+7); + sprintf(frac,".%04d", sec_part); + arg_length+= 5; + } + if (length == 7) + { + uchar hour, minute, sec; + hour= *(*row+4); + minute= *(*row+5); + sec= *(*row+6); + sprintf((char *)time," %02d:%02d:%02d",hour,minute,sec); + arg_length+= 9; + } + + year= sint2korr(*row); + month= *(*row+2); + day= *(*row+3); + sprintf((char*) date,"%04d-%02d-%02d",year,month,day); + arg_length+= 10; + + if (arg_length != 19) + time[0]='\0'; + if (arg_length != 24) + frac[0]='\0'; + + strxmov(ts,date,time,frac,NullS); + send_data_str(param,ts,arg_length); + break; + } + case MYSQL_TYPE_TIME: + { + int day, arg_length; + uchar hour, minute, sec; + char ts[255], frac[20], time[20]; + const char *sign= ""; + + if (!(length= net_field_length(row))) + { + *param->length= 0; + break; + } + if (param->buffer_type < MYSQL_TYPE_VAR_STRING || + param->buffer_type > MYSQL_TYPE_STRING) + { + /* + Don't allow fetching of date/time/ts to non-string types + + TODO: Allow fetching of time to long types without + any conversion. + */ + sprintf(stmt->last_error, + ER(stmt->last_errno= CR_UNSUPPORTED_PARAM_TYPE), + param->buffer_type, param->param_number); + return 1; + } + arg_length= 0; + if (length > 8) + { + int sec_part= sint4korr(*row+8); + sprintf(frac,".%04d", sec_part); + arg_length+= 5; + } + + if (**row) + sign="-"; + + day= sint4korr(*row); /* TODO: how to handle this case */ + hour= *(*row+5); + minute= *(*row+6); + sec= *(*row+7); + arg_length+= sprintf((char *)time,"%s%02d:%02d:%02d",sign,hour,minute,sec); + + if (arg_length <= 9) + frac[0]='\0'; + + strxmov(ts,time,frac,NullS); + send_data_str(param,ts,arg_length); + break; + } + default: + length= net_field_length(row); + send_data_str(param,*row,length); + break; + } + *row+= length; + return 0; +} static void fetch_result_tinyint(MYSQL_BIND *param, uchar **row) { @@ -4415,31 +4741,31 @@ static void fetch_result_tinyint(MYSQL_BIND *param, uchar **row) static void fetch_result_short(MYSQL_BIND *param, uchar **row) { - short value= *(short *)row; + short value = (short)sint2korr(*row); int2store(param->buffer, value); - *row+=2; + *row+= 2; } static void fetch_result_int32(MYSQL_BIND *param, uchar **row) { - int32 value= *(int32 *)row; + int32 value= (int32)sint4korr(*row); int4store(param->buffer, value); - *row+=4; + *row+= 4; } static void fetch_result_int64(MYSQL_BIND *param, uchar **row) -{ - longlong value= *(longlong *)row; +{ + longlong value= (longlong)sint8korr(*row); int8store(param->buffer, value); - *row+=8; + *row+= 8; } static void fetch_result_float(MYSQL_BIND *param, uchar **row) { float value; float4get(value,*row); - float4store(param->buffer, *row); - *row+=4; + float4store(param->buffer, value); + *row+= 4; } static void fetch_result_double(MYSQL_BIND *param, uchar **row) @@ -4447,15 +4773,16 @@ static void fetch_result_double(MYSQL_BIND *param, uchar **row) double value; float8get(value,*row); float8store(param->buffer, value); - *row+=8; + *row+= 8; } static void fetch_result_str(MYSQL_BIND *param, uchar **row) { ulong length= net_field_length(row); memcpy(param->buffer, (char *)*row, length); + *(param->buffer+length)= '\0'; *param->length= length; - *row+=length; + *row+= length; } /* @@ -4470,6 +4797,11 @@ my_bool STDCALL mysql_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind) DBUG_ASSERT(stmt != 0); #ifdef CHECK_EXTRA_ARGUMENTS + if (stmt->state == MY_ST_UNKNOWN) + { + set_stmt_error(stmt, CR_NO_PREPARE_STMT); + DBUG_RETURN(1); + } if (!bind) { set_stmt_error(stmt, CR_NULL_POINTER); @@ -4485,35 +4817,29 @@ my_bool STDCALL mysql_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind) /* Setup data copy functions for the different supported types */ switch (param->buffer_type) { case MYSQL_TYPE_TINY: - param->bind_length= 1; param->fetch_result= fetch_result_tinyint; break; case MYSQL_TYPE_SHORT: - param->bind_length= 2; param->fetch_result= fetch_result_short; break; case MYSQL_TYPE_LONG: - param->bind_length= 4; param->fetch_result= fetch_result_int32; break; case MYSQL_TYPE_LONGLONG: - param->bind_length= 8; param->fetch_result= fetch_result_int64; break; case MYSQL_TYPE_FLOAT: - param->bind_length= 4; param->fetch_result= fetch_result_float; break; case MYSQL_TYPE_DOUBLE: - param->bind_length= 8; param->fetch_result= fetch_result_double; break; case MYSQL_TYPE_TINY_BLOB: case MYSQL_TYPE_MEDIUM_BLOB: case MYSQL_TYPE_LONG_BLOB: + case MYSQL_TYPE_BLOB: case MYSQL_TYPE_VAR_STRING: case MYSQL_TYPE_STRING: - param->length= ¶m->buffer_length; param->fetch_result= fetch_result_str; break; default: @@ -4523,6 +4849,7 @@ my_bool STDCALL mysql_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind) } if (!param->length) param->length= ¶m->bind_length; + *param->length= (long)get_binary_length(param->buffer_type); } stmt->res_buffers= 1; DBUG_RETURN(0); @@ -4532,41 +4859,51 @@ my_bool STDCALL mysql_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind) Fetch row data to bind buffers */ -static my_bool -stmt_fetch_row(MYSQL_STMT *stmt, uchar **row) +static void +stmt_fetch_row(MYSQL_STMT *stmt, uchar *row) { MYSQL_BIND *bind, *end; - uchar *null_ptr= (uchar*) *row, bit; - - row+= (stmt->field_count+9)/8; - bit= 4; /* First 2 bits are reserved */ - + MYSQL_FIELD *field, *field_end; + uchar *null_ptr, bit; + + null_ptr= row; + row+= (stmt->field_count+9)/8; /* skip null bits */ + bit= 4; /* first 2 bits are reserved */ + /* Copy complete row to application buffers */ - for (bind= stmt->bind, end= (MYSQL_BIND *) bind + stmt->field_count; - bind < end; - bind++) - { + for (bind= stmt->bind, end= (MYSQL_BIND *) bind + stmt->field_count, + field= stmt->fields, + field_end= (MYSQL_FIELD *)stmt->fields+stmt->field_count; + bind < end && field < field_end; + bind++, field++) + { if (*null_ptr & bit) - bind->is_null= 1; + *bind->length= MYSQL_NULL_DATA; else - { - bind->is_null= 0; - (*bind->fetch_result)(bind, row); + { + if (field->type == bind->buffer_type) + (*bind->fetch_result)(bind, &row); + else if (fetch_results(stmt, bind, field->type, &row)) + break; } if (! (bit<<=1) & 255) { - bit=1; /* To next byte */ + bit= 1; /* To next byte */ null_ptr++; } } - return 0; } static int read_binary_data(MYSQL *mysql) -{ +{ + /* TODO : Changes needed based on logic of use_result/store_result + Currently by default it is use_result. In case of + store_result, the data packet must point to already + read data. + */ if (packet_error == net_safe_read(mysql)) return -1; - if (mysql->net.read_pos[0]) + if (mysql->net.read_pos[0] == 254) return 1; /* End of data */ return 0; } @@ -4579,29 +4916,24 @@ static int read_binary_data(MYSQL *mysql) int STDCALL mysql_fetch(MYSQL_STMT *stmt) { MYSQL *mysql= stmt->mysql; + int res; DBUG_ENTER("mysql_fetch"); - if (stmt->res_buffers) + if (!(res= read_binary_data(mysql))) { - int res; - if (!(res= read_binary_data(mysql))) - { - if (stmt->res_buffers) - DBUG_RETURN((int) stmt_fetch_row(stmt,(uchar **) &mysql->net.read_pos+1)); - DBUG_RETURN(0); - } - DBUG_PRINT("info", ("end of data")); - mysql->status= MYSQL_STATUS_READY; - - if (res < 0) /* Network error */ - { - set_stmt_errmsg(stmt,(char *)mysql->net.last_error, - mysql->net.last_errno); - DBUG_RETURN(MYSQL_STATUS_ERROR); - } - DBUG_RETURN(MYSQL_NO_DATA); /* no more data */ + if (stmt->res_buffers) + stmt_fetch_row(stmt, mysql->net.read_pos+1); + DBUG_RETURN(0); + } + mysql->status= MYSQL_STATUS_READY; + if (res < 0) /* Network error */ + { + set_stmt_errmsg(stmt,(char *)mysql->net.last_error, + mysql->net.last_errno); + DBUG_RETURN(1); } - DBUG_RETURN(0); //?? do we need to set MYSQL_STATUS_READY ? + DBUG_PRINT("info", ("end of data")); + DBUG_RETURN(MYSQL_NO_DATA); /* no more data */ } diff --git a/libmysqld/libmysqld.c b/libmysqld/libmysqld.c index 181b77130be..30dccb85e88 100644 --- a/libmysqld/libmysqld.c +++ b/libmysqld/libmysqld.c @@ -231,7 +231,7 @@ static int add_init_command(struct st_mysql_options *options, const char *cmd) } if (!(tmp= my_strdup(cmd,MYF(MY_WME))) || - insert_dynamic(options->init_commands, (byte*)&tmp)) + insert_dynamic(options->init_commands, (gptr)&tmp)) { my_free(tmp, MYF(MY_ALLOW_ZERO_PTR)); return 1; @@ -630,8 +630,13 @@ mysql_close(MYSQL *mysql) my_free(mysql->options.charset_name,MYF(MY_ALLOW_ZERO_PTR)); if (mysql->options.init_commands) { - delete_dynamic(mysql->options.init_commands); - my_free((char*)mysql->options.init_commands,MYF(MY_WME)); + DYNAMIC_ARRAY *init_commands= mysql->options.init_commands; + char **ptr= (char**)init_commands->buffer; + char **end= ptr + init_commands->elements; + for (; ptr<end; ptr++) + my_free(*ptr,MYF(MY_WME)); + delete_dynamic(init_commands); + my_free((char*)init_commands,MYF(MY_WME)); } /* Clear pointers for better safety */ bzero((char*) &mysql->options,sizeof(mysql->options)); diff --git a/myisam/ft_nlq_search.c b/myisam/ft_nlq_search.c index f9c276de32f..858a8dcbe06 100644 --- a/myisam/ft_nlq_search.c +++ b/myisam/ft_nlq_search.c @@ -97,6 +97,7 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio) r=_mi_search(aio->info, aio->keyinfo, aio->keybuff, keylen, SEARCH_FIND | SEARCH_PREFIX, aio->key_root); + aio->info->update|= HA_STATE_AKTIV; /* for _mi_test_if_changed() */ while (!r) { diff --git a/myisam/mi_check.c b/myisam/mi_check.c index 34222a5703b..28c28e628ea 100644 --- a/myisam/mi_check.c +++ b/myisam/mi_check.c @@ -368,8 +368,8 @@ int chk_key(MI_CHECK *param, register MI_INFO *info) { /* Remember old statistics for key */ memcpy((char*) rec_per_key_part, - (char*) share->state.rec_per_key_part+ - (uint) (rec_per_key_part - param->rec_per_key_part), + (char*) (share->state.rec_per_key_part + + (uint) (rec_per_key_part - param->rec_per_key_part)), keyinfo->keysegs*sizeof(*rec_per_key_part)); continue; } @@ -601,7 +601,8 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, if (*keys != 1L) /* not first_key */ { uint diff; - ha_key_cmp(keyinfo->seg,info->lastkey,key,USE_WHOLE_KEY,SEARCH_FIND, + ha_key_cmp(keyinfo->seg,info->lastkey,key,USE_WHOLE_KEY, + SEARCH_FIND | SEARCH_NULL_ARE_NOT_EQUAL, &diff); param->unique_count[diff-1]++; } @@ -1912,8 +1913,8 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info, { /* Remember old statistics for key */ memcpy((char*) rec_per_key_part, - (char*) share->state.rec_per_key_part+ - (uint) (rec_per_key_part - param->rec_per_key_part), + (char*) (share->state.rec_per_key_part + + (uint) (rec_per_key_part - param->rec_per_key_part)), sort_param.keyinfo->keysegs*sizeof(*rec_per_key_part)); continue; } @@ -2272,8 +2273,8 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info, { /* Remember old statistics for key */ memcpy((char*) rec_per_key_part, - (char*) share->state.rec_per_key_part+ - (uint) (rec_per_key_part - param->rec_per_key_part), + (char*) (share->state.rec_per_key_part+ + (uint) (rec_per_key_part - param->rec_per_key_part)), sort_param[i].keyinfo->keysegs*sizeof(*rec_per_key_part)); i--; continue; @@ -2435,7 +2436,7 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info, got_error=0; if (&share->state.state != info->state) - memcpy( &share->state.state, info->state, sizeof(*info->state)); + memcpy(&share->state.state, info->state, sizeof(*info->state)); err: got_error|= flush_blocks(param,share->kfile); @@ -3656,7 +3657,7 @@ void update_key_parts(MI_KEYDEF *keyinfo, ulong *rec_per_key_part, } -ha_checksum mi_byte_checksum(const byte *buf, uint length) +static ha_checksum mi_byte_checksum(const byte *buf, uint length) { ha_checksum crc; const byte *end=buf+length; diff --git a/myisam/mi_extra.c b/myisam/mi_extra.c index d7a3aea516d..75057dd4e6a 100644 --- a/myisam/mi_extra.c +++ b/myisam/mi_extra.c @@ -55,12 +55,17 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg) /* Free buffers and reset the following flags: EXTRA_CACHE, EXTRA_WRITE_CACHE, EXTRA_KEYREAD, EXTRA_QUICK + + If the row buffer cache is large (for dynamic tables), reduce it + to save memory. */ if (info->opt_flag & (READ_CACHE_USED | WRITE_CACHE_USED)) { info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED); error=end_io_cache(&info->rec_cache); } + if (share->base.blobs) + mi_alloc_rec_buff(info, -1, &info->rec_buff); #if defined(HAVE_MMAP) && defined(HAVE_MADVICE) if (info->opt_flag & MEMMAP_USED) madvise(share->file_map,share->state.state.data_file_length,MADV_RANDOM); @@ -358,33 +363,6 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg) case HA_EXTRA_QUICK: info->quick_mode=1; break; - case HA_EXTRA_BULK_INSERT_BEGIN: - error=_mi_init_bulk_insert(info, (extra_arg ? *(ulong*) extra_arg : - myisam_bulk_insert_tree_size)); - break; - case HA_EXTRA_BULK_INSERT_FLUSH: - if (info->bulk_insert) - { - uint index_to_flush= *(uint*) extra_arg; - if (is_tree_inited(&info->bulk_insert[index_to_flush])) - reset_tree(&info->bulk_insert[index_to_flush]); - } - break; - case HA_EXTRA_BULK_INSERT_END: - if (info->bulk_insert) - { - uint i; - for (i=0 ; i < share->base.keys ; i++) - { - if (is_tree_inited(& info->bulk_insert[i])) - { - delete_tree(& info->bulk_insert[i]); - } - } - my_free((void *)info->bulk_insert, MYF(0)); - info->bulk_insert=0; - } - break; case HA_EXTRA_NO_ROWS: if (!share->state.header.uniques) info->opt_flag|= OPT_NO_ROWS; diff --git a/myisam/mi_open.c b/myisam/mi_open.c index 8f0da612c3a..ef1906e0c00 100644 --- a/myisam/mi_open.c +++ b/myisam/mi_open.c @@ -573,28 +573,36 @@ err: DBUG_RETURN (NULL); } /* mi_open */ + byte *mi_alloc_rec_buff(MI_INFO *info, ulong length, byte **buf) { uint extra; + uint32 old_length; + LINT_INIT(old_length); - if (! *buf || length > mi_get_rec_buff_len(info, *buf)) + if (! *buf || length > (old_length=mi_get_rec_buff_len(info, *buf))) { byte *newptr = *buf; /* to simplify initial init of info->rec_buf in mi_open and mi_extra */ if (length == (ulong) -1) + { length= max(info->s->base.pack_reclength+info->s->base.pack_bits, info->s->base.max_key_length); + /* Avoid unnecessary realloc */ + if (newptr && length == old_length) + return newptr; + } extra= ((info->s->options & HA_OPTION_PACK_RECORD) ? ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER)+MI_SPLIT_LENGTH+ MI_REC_BUFF_OFFSET : 0); if (extra && newptr) - newptr-=MI_REC_BUFF_OFFSET; + newptr-= MI_REC_BUFF_OFFSET; if (!(newptr=(byte*) my_realloc((gptr)newptr, length+extra+8, MYF(MY_ALLOW_ZERO_PTR)))) return newptr; - *((uint *)newptr)=length; + *((uint32 *) newptr)= (uint32) length; *buf= newptr+(extra ? MI_REC_BUFF_OFFSET : 0); } return *buf; diff --git a/myisam/mi_search.c b/myisam/mi_search.c index 8aeccbbf559..04803d7a901 100644 --- a/myisam/mi_search.c +++ b/myisam/mi_search.c @@ -260,9 +260,11 @@ int _mi_prefix_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page, uchar *key, uint key_len, uint nextflag, uchar **ret_pos, uchar *buff, my_bool *last_key) { - /* my_flag is raw comparison result to be changed according to - SEARCH_NO_FIND,SEARCH_LAST and HA_REVERSE_SORT flags. - flag is the value returned by ha_key_cmp and as treated as final */ + /* + my_flag is raw comparison result to be changed according to + SEARCH_NO_FIND,SEARCH_LAST and HA_REVERSE_SORT flags. + flag is the value returned by ha_key_cmp and as treated as final + */ int flag=0, my_flag=-1; uint nod_flag, length, len, matched, cmplen, kseg_len; uint prefix_len,suffix_len; diff --git a/myisam/mi_test1.c b/myisam/mi_test1.c index 1c2b3f13baa..6aa4b9cf9f1 100644 --- a/myisam/mi_test1.c +++ b/myisam/mi_test1.c @@ -57,7 +57,7 @@ int main(int argc,char *argv[]) } -int run_test(const char *filename) +static int run_test(const char *filename) { MI_INFO *file; int i,j,error,deleted,rec_length,uniques=0; diff --git a/myisam/mi_write.c b/myisam/mi_write.c index 58f9ebdb735..81941e41010 100644 --- a/myisam/mi_write.c +++ b/myisam/mi_write.c @@ -804,26 +804,27 @@ static int keys_free(uchar *key, TREE_FREE mode, bulk_insert_param *param) } -int _mi_init_bulk_insert(MI_INFO *info, ulong cache_size) +int mi_init_bulk_insert(MI_INFO *info, ulong cache_size, ha_rows rows) { MYISAM_SHARE *share=info->s; MI_KEYDEF *key=share->keyinfo; bulk_insert_param *params; - uint i, num_keys; + uint i, num_keys, total_keylength; ulonglong key_map=0; DBUG_ENTER("_mi_init_bulk_insert"); DBUG_PRINT("enter",("cache_size: %lu", cache_size)); - if (info->bulk_insert) + if (info->bulk_insert || (rows && rows < MI_MIN_ROWS_TO_USE_BULK_INSERT)) DBUG_RETURN(0); - for (i=num_keys=0 ; i < share->base.keys ; i++) + for (i=total_keylength=num_keys=0 ; i < share->base.keys ; i++) { if (!(key[i].flag & HA_NOSAME) && share->base.auto_key != i+1 && test(share->state.key_map & ((ulonglong) 1 << i))) { num_keys++; key_map |=((ulonglong) 1 << i); + total_keylength+=key[i].maxlength+TREE_ELEMENT_EXTRA_SIZE; } } @@ -831,6 +832,11 @@ int _mi_init_bulk_insert(MI_INFO *info, ulong cache_size) num_keys * MI_MIN_SIZE_BULK_INSERT_TREE > cache_size) DBUG_RETURN(0); + if (rows && rows*total_keylength < cache_size) + cache_size=rows; + else + cache_size/=total_keylength*16; + info->bulk_insert=(TREE *) my_malloc((sizeof(TREE)*share->base.keys+ sizeof(bulk_insert_param)*num_keys),MYF(0)); @@ -839,7 +845,7 @@ int _mi_init_bulk_insert(MI_INFO *info, ulong cache_size) DBUG_RETURN(HA_ERR_OUT_OF_MEM); params=(bulk_insert_param *)(info->bulk_insert+share->base.keys); - for (i=0 ; i < share->base.keys ; i++,key++) + for (i=0 ; i < share->base.keys ; i++) { if (test(key_map & ((ulonglong) 1 << i))) { @@ -847,8 +853,8 @@ int _mi_init_bulk_insert(MI_INFO *info, ulong cache_size) params->keynr=i; /* Only allocate a 16'th of the buffer at a time */ init_tree(&info->bulk_insert[i], - cache_size / num_keys / 16 + 10, - cache_size / num_keys, 0, + cache_size * key[i].maxlength, + cache_size * key[i].maxlength, 0, (qsort_cmp2)keys_compare, 0, (tree_element_free) keys_free, (void *)params++); } @@ -858,3 +864,30 @@ int _mi_init_bulk_insert(MI_INFO *info, ulong cache_size) DBUG_RETURN(0); } + +void mi_flush_bulk_insert(MI_INFO *info, uint inx) +{ + if (info->bulk_insert) + { + if (is_tree_inited(&info->bulk_insert[inx])) + reset_tree(&info->bulk_insert[inx]); + } +} + +void mi_end_bulk_insert(MI_INFO *info) +{ + if (info->bulk_insert) + { + uint i; + for (i=0 ; i < info->s->base.keys ; i++) + { + if (is_tree_inited(& info->bulk_insert[i])) + { + delete_tree(& info->bulk_insert[i]); + } + } + my_free((void *)info->bulk_insert, MYF(0)); + info->bulk_insert=0; + } +} + diff --git a/myisam/myisamdef.h b/myisam/myisamdef.h index 90aaff46919..005c36271bf 100644 --- a/myisam/myisamdef.h +++ b/myisam/myisamdef.h @@ -385,7 +385,7 @@ typedef struct st_mi_sort_param #define MI_DYN_ALIGN_SIZE 4 /* Align blocks on this */ #define MI_MAX_DYN_HEADER_BYTE 13 /* max header byte for dynamic rows */ #define MI_MAX_BLOCK_LENGTH ((((ulong) 1 << 24)-1) & (~ (ulong) (MI_DYN_ALIGN_SIZE-1))) -#define MI_REC_BUFF_OFFSET ALIGN_SIZE(MI_DYN_DELETE_BLOCK_HEADER+sizeof(uint)) +#define MI_REC_BUFF_OFFSET ALIGN_SIZE(MI_DYN_DELETE_BLOCK_HEADER+sizeof(uint32)) #define MEMMAP_EXTRA_MARGIN 7 /* Write this as a suffix for file */ @@ -400,6 +400,7 @@ typedef struct st_mi_sort_param #define MI_MIN_KEYBLOCK_LENGTH 50 /* When to split delete blocks */ #define MI_MIN_SIZE_BULK_INSERT_TREE 16384 /* this is per key */ +#define MI_MIN_ROWS_TO_USE_BULK_INSERT 100 /* The UNIQUE check is done with a hashed long key */ @@ -553,7 +554,7 @@ extern byte *mi_alloc_rec_buff(MI_INFO *,ulong, byte**); ((((info)->s->options & HA_OPTION_PACK_RECORD) && (buf)) ? \ (buf) - MI_REC_BUFF_OFFSET : (buf)) #define mi_get_rec_buff_len(info,buf) \ - (*((uint *)(mi_get_rec_buff_ptr(info,buf)))) + (*((uint32 *)(mi_get_rec_buff_ptr(info,buf)))) extern ulong _mi_rec_unpack(MI_INFO *info,byte *to,byte *from, ulong reclength); @@ -683,8 +684,6 @@ int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share, File file_to_dup); int mi_open_keyfile(MYISAM_SHARE *share); void mi_setup_functions(register MYISAM_SHARE *share); -int _mi_init_bulk_insert(MI_INFO *info, ulong cache_size); - /* Functions needed by mi_check */ volatile bool *killed_ptr(MI_CHECK *param); void mi_check_print_error _VARARGS((MI_CHECK *param, const char *fmt,...)); diff --git a/myisammrg/myrg_info.c b/myisammrg/myrg_info.c index 14bc228cc1f..ba840ac444b 100644 --- a/myisammrg/myrg_info.c +++ b/myisammrg/myrg_info.c @@ -28,8 +28,6 @@ ulonglong myrg_position(MYRG_INFO *info) ~(ulonglong) 0; } - /* If flag != 0 one only gets pos of last record */ - int myrg_status(MYRG_INFO *info,register MYMERGE_INFO *x,int flag) { MYRG_TABLE *current_table; @@ -55,15 +53,16 @@ int myrg_status(MYRG_INFO *info,register MYMERGE_INFO *x,int flag) DBUG_PRINT("info2",("table: %s, offset: %lu", file->table->filename,(ulong) file->file_offset)); } - x->records = info->records; - x->deleted = info->del; - x->data_file_length = info->data_file_length; - x->reclength = info->reclength; - x->options = info->options; + x->records= info->records; + x->deleted= info->del; + x->data_file_length= info->data_file_length; + x->reclength= info->reclength; + x->options= info->options; if (current_table) - x->errkey = current_table->table->errkey; + x->errkey= current_table->table->errkey; else - x->errkey=0; + x->errkey= 0; + x->rec_per_key = info->rec_per_key_part; } DBUG_RETURN(0); } diff --git a/myisammrg/myrg_open.c b/myisammrg/myrg_open.c index 9360f582958..f996277d287 100644 --- a/myisammrg/myrg_open.c +++ b/myisammrg/myrg_open.c @@ -33,7 +33,7 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) { int save_errno,i,errpos; - uint files,dir_length,length,options; + uint files,dir_length,length,options, key_parts; ulonglong file_offset; char name_buff[FN_REFLEN*2],buff[FN_REFLEN],*end; MYRG_INFO info,*m_info; @@ -89,24 +89,39 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) } info.reclength=isam->s->base.reclength; } + key_parts=(isam ? isam->s->base.key_parts : 0); if (!(m_info= (MYRG_INFO*) my_malloc(sizeof(MYRG_INFO)+ - files*sizeof(MYRG_TABLE), + files*sizeof(MYRG_TABLE)+ + sizeof(long)*key_parts, MYF(MY_WME)))) goto err; *m_info=info; - m_info->open_tables=(files) ? (MYRG_TABLE *) (m_info+1) : 0; m_info->tables=files; + if (files) + { + m_info->open_tables=(MYRG_TABLE *) (m_info+1); + m_info->rec_per_key_part=(ulong *) (m_info->open_tables+files); + bzero((char*) m_info->rec_per_key_part,sizeof(long)*key_parts); + } + else + { + m_info->open_tables=0; + m_info->rec_per_key_part=0; + } errpos=2; options= (uint) ~0; for (i=files ; i-- > 0 ; ) { + uint j; m_info->open_tables[i].table=isam; m_info->options|=isam->s->options; options&=isam->s->options; m_info->records+=isam->state->records; m_info->del+=isam->state->del; m_info->data_file_length+=isam->state->data_file_length; + for (j=0; j < key_parts; j++) + m_info->rec_per_key_part[j]+=isam->s->state.rec_per_key_part[j] / files; if (i) isam=(MI_INFO*) (isam->open_list.next->data); } diff --git a/mysql-test/include/master-slave.inc b/mysql-test/include/master-slave.inc index 1013cd2cd52..008466c426f 100644 --- a/mysql-test/include/master-slave.inc +++ b/mysql-test/include/master-slave.inc @@ -7,12 +7,16 @@ connection slave; !stop slave; @r/slave-stopped.result show status like 'Slave_running'; connection master; +--disable_warnings drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +--enable_warnings reset master; connection slave; reset slave; # Clean up old test tables +--disable_warnings drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +--enable_warnings start slave; @r/slave-running.result show status like 'Slave_running'; diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index edfff5c4d46..edd573f50a3 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -88,6 +88,7 @@ sleep_until_file_created () wait_for_pid() { pid=$1 + #$WAIT_PID pid $SLEEP_TIME_FOR_DELETE } # No paths below as we can't be sure where the program is! @@ -347,9 +348,9 @@ while test $# -gt 0; do ;; --debug) EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT \ - --debug=d:t:i:O,$MYSQL_TEST_DIR/var/log/master.trace" + --debug=d:t:i:A,$MYSQL_TEST_DIR/var/log/master.trace" EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT \ - --debug=d:t:i:O,$MYSQL_TEST_DIR/var/log/slave.trace" + --debug=d:t:i:A,$MYSQL_TEST_DIR/var/log/slave.trace" EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT --debug" ;; --fast) @@ -423,6 +424,7 @@ if [ x$SOURCE_DIST = x1 ] ; then fi MYSQLADMIN="$BASEDIR/client/mysqladmin" + WAIT_PID="$BASEDIR/extra/mysql_waitpid" MYSQL_MANAGER_CLIENT="$BASEDIR/client/mysqlmanagerc" MYSQL_MANAGER="$BASEDIR/tools/mysqlmanager" MYSQL_MANAGER_PWGEN="$BASEDIR/client/mysqlmanager-pwgen" @@ -439,6 +441,7 @@ else fi MYSQL_TEST="$BASEDIR/bin/mysqltest" MYSQLADMIN="$BASEDIR/bin/mysqladmin" + WAIT_PID="$BASEDIR/bin/mysql_waitpid" MYSQL_MANAGER="$BASEDIR/bin/mysqlmanager" MYSQL_MANAGER_CLIENT="$BASEDIR/bin/mysqlmanagerc" MYSQL_MANAGER_PWGEN="$BASEDIR/bin/mysqlmanager-pwgen" @@ -753,9 +756,9 @@ manager_term() { pid=$1 ident=$2 - shift if [ $USE_MANAGER = 0 ] ; then - $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock --connect_timeout=5 --shutdown_timeout=20 shutdown >> $MYSQL_MANAGER_LOG 2>&1 + # Shutdown time must be high as slave may be in reconnect + $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock --connect_timeout=5 --shutdown_timeout=70 shutdown >> $MYSQL_MANAGER_LOG 2>&1 res=$? # Some systems require an extra connect $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock --connect_timeout=1 ping >> $MYSQL_MANAGER_LOG 2>&1 @@ -778,8 +781,6 @@ start_master() if [ x$MASTER_RUNNING = x1 ] || [ x$LOCAL_MASTER = x1 ] ; then return fi - # Remove old berkeley db log files that can confuse the server - $RM -f $MASTER_MYDDIR/log.* # Remove stale binary logs $RM -f $MYSQL_TEST_DIR/var/log/master-bin.* # Remove old master.info files @@ -877,8 +878,8 @@ start_slave() [ x$SKIP_SLAVE = x1 ] && return eval "this_slave_running=\$SLAVE$1_RUNNING" [ x$this_slave_running = 1 ] && return - #when testing fail-safe replication, we will have more than one slave - #in this case, we start secondary slaves with an argument + # When testing fail-safe replication, we will have more than one slave + # in this case, we start secondary slaves with an argument slave_ident="slave$1" if [ -n "$1" ] ; then @@ -986,9 +987,12 @@ EOF mysql_start () { - $ECHO "Starting MySQL daemon" - start_master - start_slave +# We should not start the deamon here as we don't know the argumens +# for the test. Better to let the test start the deamon + +# $ECHO "Starting MySQL daemon" +# start_master +# start_slave cd $MYSQL_TEST_DIR return 1 } @@ -1089,8 +1093,6 @@ run_testcase () slave_init_script=$TESTDIR/$tname-slave.sh slave_master_info_file=$TESTDIR/$tname-slave-master-info.opt echo $tname > $CURRENT_TEST - echo "CURRENT_TEST: $tname" >> $SLAVE_MYERR - echo "CURRENT_TEST: $tname" >> $MASTER_MYERR SKIP_SLAVE=`$EXPR \( $tname : rpl \) = 0` if [ $USE_MANAGER = 1 ] ; then many_slaves=`$EXPR \( $tname : rpl_failsafe \) != 0` @@ -1127,13 +1129,17 @@ run_testcase () then EXTRA_MASTER_OPT=`$CAT $master_opt_file | $SED -e "s;\\$MYSQL_TEST_DIR;$MYSQL_TEST_DIR;"` stop_master + echo "CURRENT_TEST: $tname" >> $MASTER_MYERR start_master else if [ ! -z "$EXTRA_MASTER_OPT" ] || [ x$MASTER_RUNNING != x1 ] ; then EXTRA_MASTER_OPT="" stop_master + echo "CURRENT_TEST: $tname" >> $MASTER_MYERR start_master + else + echo "CURRENT_TEST: $tname" >> $MASTER_MYERR fi fi @@ -1163,7 +1169,10 @@ run_testcase () if [ x$do_slave_restart = x1 ] ; then stop_slave + echo "CURRENT_TEST: $tname" >> $SLAVE_MYERR start_slave + else + echo "CURRENT_TEST: $tname" >> $SLAVE_MYERR fi if [ x$many_slaves = x1 ]; then start_slave 1 @@ -1286,6 +1295,9 @@ then # Remove files that can cause problems $RM -f $MYSQL_TEST_DIR/var/run/* $MYSQL_TEST_DIR/var/tmp/* + # Remove old berkeley db log files that can confuse the server + $RM -f $MASTER_MYDDIR/log.* + wait_for_master=$SLEEP_TIME_FOR_FIRST_MASTER wait_for_slave=$SLEEP_TIME_FOR_FIRST_SLAVE $ECHO "Installing Test Databases" diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result index cba486109ac..456dfa860df 100644 --- a/mysql-test/r/alter_table.result +++ b/mysql-test/r/alter_table.result @@ -50,10 +50,10 @@ PRIMARY KEY (GROUP_ID,LANG_ID), KEY NAME (NAME)); ALTER TABLE t1 CHANGE NAME NAME CHAR(80) not null; SHOW FULL COLUMNS FROM t1; -Field Type Null Key Default Extra Privileges Comment -GROUP_ID int(10) unsigned PRI 0 select,insert,update,references -LANG_ID smallint(5) unsigned PRI 0 select,insert,update,references -NAME char(80) character set latin1 MUL select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +GROUP_ID int(10) unsigned binary PRI 0 select,insert,update,references +LANG_ID smallint(5) unsigned binary PRI 0 select,insert,update,references +NAME char(80) latin1 MUL select,insert,update,references DROP TABLE t1; create table t1 (n int); insert into t1 values(9),(3),(12),(10); @@ -118,7 +118,7 @@ create table t1 (i int unsigned not null auto_increment primary key); alter table t1 rename t2; alter table t2 rename t1, add c char(10) comment "no comment"; show columns from t1; -Field Type Null Key Default Extra -i int(10) unsigned PRI NULL auto_increment -c char(10) character set latin1 YES NULL +Field Type Collation Null Key Default Extra +i int(10) unsigned binary PRI NULL auto_increment +c char(10) latin1 YES NULL drop table t1; diff --git a/mysql-test/r/backup.result b/mysql-test/r/backup.result index 43d57d2d4f7..e4f41517f94 100644 --- a/mysql-test/r/backup.result +++ b/mysql-test/r/backup.result @@ -1,5 +1,5 @@ set SQL_LOG_BIN=0; -drop table if exists t1; +drop table if exists t1, t2, t3; create table t1(n int); backup table t1 to '../bogus'; Table Op Msg_type Msg_text diff --git a/mysql-test/r/bdb.result b/mysql-test/r/bdb.result index ef4dfc307bf..2c7d3136369 100644 --- a/mysql-test/r/bdb.result +++ b/mysql-test/r/bdb.result @@ -797,7 +797,6 @@ select * from t1 where i=1 and j=2; i j 1 2 drop table t1; -drop table if exists t1, t2, t3, t4, t5, t6, t7; create table t1 ( branch_id int auto_increment primary key, @@ -806,7 +805,6 @@ branch_active int not null default 1, unique branch_name(branch_name), index branch_active(branch_active) ) type=bdb; -drop table if exists t2 ; create table t2 ( target_id int auto_increment primary key, @@ -815,7 +813,6 @@ target_active int not null default 1, unique target_name(target_name), index target_active(target_active) ) type=bdb; -drop table if exists t3 ; create table t3 ( platform_id int auto_increment primary key, @@ -824,7 +821,6 @@ platform_active int not null default 1, unique platform_name(platform_name), index platform_active(platform_active) ) type=bdb; -drop table if exists t4 ; create table t4 ( product_id int auto_increment primary key, @@ -834,7 +830,6 @@ product_active int not null default 1, unique product_name(product_name), index product_active(product_active) ) type=bdb; -drop table if exists t5 ; create table t5 ( product_file_id int auto_increment primary key, @@ -847,7 +842,6 @@ file_included int not null default 1, unique product_file(product_id,file_name), index file_included(file_included) ) type=bdb; -drop table if exists t6 ; create table t6 ( file_platform_id int auto_increment primary key, @@ -860,7 +854,6 @@ build_filename varchar(255) not null, archive_filename varchar(255) not null, unique file_platform(product_file_id,platform_id,branch_id) ) type=bdb; -drop table if exists t8 ; create table t8 ( archive_id int auto_increment primary key, @@ -872,7 +865,6 @@ status_id int not null default 1, unique archive(branch_id,target_id,platform_id,product_id), index status_id(status_id) ) type=bdb; -drop table if exists t7 ; create table t7 ( build_id int auto_increment primary key, @@ -1057,7 +1049,6 @@ KINMU_DATE select T1.KINMU_DATE from t1 T1 ,t2 T2 where T1.SYAIN_NO = '12345' and T1.KINMU_DATE = '200106' and T2.SYAIN_NO = T1.SYAIN_NO; KINMU_DATE DROP TABLE t1,t2; -drop table if exists t1; create table t1 (a int(11) not null, b int(11) not null, unique (a,b)) type=bdb; insert into t1 values (1,1), (1,2); select * from t1 where a = 1; diff --git a/mysql-test/r/bigint.result b/mysql-test/r/bigint.result index 6afa74d20e2..8bc383c6f4c 100644 --- a/mysql-test/r/bigint.result +++ b/mysql-test/r/bigint.result @@ -1,3 +1,4 @@ +drop table if exists t1; select 0,256,00000000000000065536,2147483647,-2147483648,2147483648,+4294967296; 0 256 00000000000000065536 2147483647 -2147483648 2147483648 +4294967296 0 256 65536 2147483647 -2147483648 2147483648 4294967296 @@ -7,7 +8,6 @@ select 9223372036854775807,-009223372036854775808; select +9999999999999999999,-9999999999999999999; +9999999999999999999 -9999999999999999999 10000000000000000000 -10000000000000000000 -drop table if exists t1; create table t1 (a bigint unsigned not null, primary key(a)); insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE); select * from t1; diff --git a/mysql-test/r/bool.result b/mysql-test/r/bool.result index cb82c6baa0f..890c85dc946 100644 --- a/mysql-test/r/bool.result +++ b/mysql-test/r/bool.result @@ -46,10 +46,9 @@ SELECT @a, @b; @a @b 0 6 DROP TABLE t1; -drop table if exists t; -create table t(a int, b int); -insert into t values(null, null), (0, null), (1, null), (null, 0), (null, 1), (0, 0), (0, 1), (1, 0), (1, 1); -select ifnull(A, 'N') as A, ifnull(B, 'N') as B, ifnull(not A, 'N') as nA, ifnull(not B, 'N') as nB, ifnull(A and B, 'N') as AB, ifnull(not (A and B), 'N') as `n(AB)`, ifnull((not A or not B), 'N') as nAonB, ifnull(A or B, 'N') as AoB, ifnull(not(A or B), 'N') as `n(AoB)`, ifnull(not A and not B, 'N') as nAnB from t; +create table t1 (a int, b int); +insert into t1 values(null, null), (0, null), (1, null), (null, 0), (null, 1), (0, 0), (0, 1), (1, 0), (1, 1); +select ifnull(A, 'N') as A, ifnull(B, 'N') as B, ifnull(not A, 'N') as nA, ifnull(not B, 'N') as nB, ifnull(A and B, 'N') as AB, ifnull(not (A and B), 'N') as `n(AB)`, ifnull((not A or not B), 'N') as nAonB, ifnull(A or B, 'N') as AoB, ifnull(not(A or B), 'N') as `n(AoB)`, ifnull(not A and not B, 'N') as nAnB from t1; A B nA nB AB n(AB) nAonB AoB n(AoB) nAnB N N N N N N N N N N 0 N 1 N 0 1 1 N N N @@ -60,7 +59,7 @@ N 1 N 0 N N N 1 0 0 0 1 1 0 0 1 1 1 0 0 1 0 0 1 0 1 1 1 0 0 1 1 0 0 1 0 0 1 0 0 -select ifnull(A=1, 'N') as A, ifnull(B=1, 'N') as B, ifnull(not (A=1), 'N') as nA, ifnull(not (B=1), 'N') as nB, ifnull((A=1) and (B=1), 'N') as AB, ifnull(not ((A=1) and (B=1)), 'N') as `n(AB)`, ifnull((not (A=1) or not (B=1)), 'N') as nAonB, ifnull((A=1) or (B=1), 'N') as AoB, ifnull(not((A=1) or (B=1)), 'N') as `n(AoB)`, ifnull(not (A=1) and not (B=1), 'N') as nAnB from t; +select ifnull(A=1, 'N') as A, ifnull(B=1, 'N') as B, ifnull(not (A=1), 'N') as nA, ifnull(not (B=1), 'N') as nB, ifnull((A=1) and (B=1), 'N') as AB, ifnull(not ((A=1) and (B=1)), 'N') as `n(AB)`, ifnull((not (A=1) or not (B=1)), 'N') as nAonB, ifnull((A=1) or (B=1), 'N') as AoB, ifnull(not((A=1) or (B=1)), 'N') as `n(AoB)`, ifnull(not (A=1) and not (B=1), 'N') as nAnB from t1; A B nA nB AB n(AB) nAonB AoB n(AoB) nAnB N N N N N N N N N N 0 N 1 N 0 1 1 N N N @@ -71,4 +70,4 @@ N 1 N 0 N N N 1 0 0 0 1 1 0 0 1 1 1 0 0 1 0 0 1 0 1 1 1 0 0 1 1 0 0 1 0 0 1 0 0 -drop table t; +drop table t1; diff --git a/mysql-test/r/case.result b/mysql-test/r/case.result index 18241a8fcc1..914e05efa7a 100644 --- a/mysql-test/r/case.result +++ b/mysql-test/r/case.result @@ -63,3 +63,11 @@ nothing 2 one 1 two 1 drop table t1; +create table t1 (row int not null, col int not null, val varchar(255) not null); +insert into t1 values (1,1,'orange'),(1,2,'large'),(2,1,'yellow'),(2,2,'medium'),(3,1,'green'),(3,2,'small'); +select max(case col when 1 then val else null end) as color from t1 group by row; +color +orange +yellow +green +drop table t1; diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 0be0d624fca..5228ae50a83 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -1,4 +1,4 @@ -drop table if exists t1,t2; +drop table if exists t1,t2,t3; create table t1 (b char(0)); insert into t1 values (""),(null); select * from t1; @@ -13,12 +13,15 @@ select * from t1; b -drop table if exists t1; +drop table t1; create table t2 type=heap select * from t1; Table 'test.t1' doesn't exist create table t2 select auto+1 from t1; Table 'test.t1' doesn't exist drop table if exists t1,t2; +Warnings: +Note 1051 Unknown table 't1' +Note 1051 Unknown table 't2' create table t1 (b char(0) not null, index(b)); The used table handler can't index column 'b' create table t1 (a int not null auto_increment,primary key (a)) type=heap; @@ -48,6 +51,8 @@ drop table 1ea10; create table t1 (t1.index int); drop table t1; drop database if exists test_$1; +Warnings: +Note 1008 Can't drop database 'test_$1'. Database doesn't exist create database test_$1; create table test_$1.$test1 (a$1 int, $b int, c$ int); insert into test_$1.$test1 values (1,2,3); @@ -70,47 +75,53 @@ drop table t1,t2; create table t1(x varchar(50) ); create table t2 select x from t1 where 1=2; describe t1; -Field Type Null Key Default Extra -x varchar(50) character set latin1 YES NULL +Field Type Collation Null Key Default Extra +x varchar(50) latin1 YES NULL describe t2; -Field Type Null Key Default Extra -x char(50) character set latin1 YES NULL +Field Type Collation Null Key Default Extra +x char(50) latin1 YES NULL drop table t2; create table t2 select now() as a , curtime() as b, curdate() as c , 1+1 as d , 1.0 + 1 as e , 33333333333333333 + 3 as f; describe t2; -Field Type Null Key Default Extra -a datetime 0000-00-00 00:00:00 -b time 00:00:00 -c date 0000-00-00 -d bigint(17) 0 -e double(18,1) 0.0 -f bigint(17) 0 +Field Type Collation Null Key Default Extra +a datetime latin1 0000-00-00 00:00:00 +b time latin1 00:00:00 +c date latin1 0000-00-00 +d bigint(17) binary 0 +e double(18,1) binary 0.0 +f bigint(17) binary 0 drop table t2; create table t2 select CAST("2001-12-29" AS DATE) as d, CAST("20:45:11" AS TIME) as t, CAST("2001-12-29 20:45:11" AS DATETIME) as dt; describe t2; -Field Type Null Key Default Extra -d date 0000-00-00 -t time 00:00:00 -dt datetime 0000-00-00 00:00:00 +Field Type Collation Null Key Default Extra +d date latin1 0000-00-00 +t time latin1 00:00:00 +dt datetime latin1 0000-00-00 00:00:00 drop table t1,t2; create table t1 (a tinyint); create table t2 (a int) select * from t1; describe t1; -Field Type Null Key Default Extra -a tinyint(4) YES NULL +Field Type Collation Null Key Default Extra +a tinyint(4) binary YES NULL describe t2; -Field Type Null Key Default Extra -a int(11) YES NULL +Field Type Collation Null Key Default Extra +a int(11) binary YES NULL drop table if exists t2; create table t2 (a int, a float) select * from t1; Duplicate column name 'a' drop table if exists t2; +Warnings: +Note 1051 Unknown table 't2' create table t2 (a int) select a as b, a+1 as b from t1; Duplicate column name 'b' drop table if exists t2; +Warnings: +Note 1051 Unknown table 't2' create table t2 (b int) select a as b, a+1 as b from t1; Duplicate column name 'b' drop table if exists t1,t2; +Warnings: +Note 1051 Unknown table 't2' create table t1 (a int not null, b int, primary key(a), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b)); show create table t1; Table Create Table @@ -161,3 +172,75 @@ drop table if exists t1; create table t1 (a int, key(a)); create table t2 (b int, foreign key(b) references t1(a), key(b)); drop table if exists t1,t2; +create table t1(id int not null, name char(20)); +insert into t1 values(10,'mysql'),(20,'monty- the creator'); +create table t2(id int not null); +insert into t2 values(10),(20); +create table t3 like t1; +show create table t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `id` int(11) NOT NULL default '0', + `name` char(20) default NULL +) TYPE=MyISAM CHARSET=latin1 +select * from t3; +id name +create table if not exists t3 like t1; +Warnings: +Warning 1050 Table 't3' already exists +select @@warning_count; +@@warning_count +1 +create temporary table t3 like t2; +show create table t3; +Table Create Table +t3 CREATE TEMPORARY TABLE `t3` ( + `id` int(11) NOT NULL default '0' +) TYPE=MyISAM CHARSET=latin1 +select * from t3; +id +drop table t3; +show create table t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `id` int(11) NOT NULL default '0', + `name` char(20) default NULL +) TYPE=MyISAM CHARSET=latin1 +select * from t3; +id name +drop table t2, t3; +drop database if exists test_$1; +Warnings: +Note 1008 Can't drop database 'test_$1'. Database doesn't exist +create database test_$1; +create table test_$1.t3 like t1; +create temporary table t3 like test_$1.t3; +show create table t3; +Table Create Table +t3 CREATE TEMPORARY TABLE `t3` ( + `id` int(11) NOT NULL default '0', + `name` char(20) default NULL +) TYPE=MyISAM CHARSET=latin1 +create table t2 like t3; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL default '0', + `name` char(20) default NULL +) TYPE=MyISAM CHARSET=latin1 +select * from t2; +id name +create table t3 like t1; +create table t3 like test_$1.t3; +Table 't3' already exists +create table non_existing_database.t1 like t1; +Got one of the listed errors +create table t3 like non_existing_table; +Unknown table 'non_existing_table' +create temporary table t3 like t1; +Table 't3' already exists +create table t3 like `a/a`; +Incorrect table name 'a/a' +drop table t1, t2, t3; +drop table t3; +drop database test_$1; diff --git a/mysql-test/r/ctype_many.result b/mysql-test/r/ctype_many.result index 45fe91c096d..91a43634bcb 100644 --- a/mysql-test/r/ctype_many.result +++ b/mysql-test/r/ctype_many.result @@ -1,45 +1,45 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1 ( comment CHAR(32) ASCII NOT NULL, -koi8_ru_f CHAR(32) CHARACTER SET koi8_ru NOT NULL +koi8_ru_f CHAR(32) CHARACTER SET koi8r NOT NULL ) CHARSET=latin5; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `comment` char(32) character set latin1 NOT NULL default '', - `koi8_ru_f` char(32) character set koi8_ru NOT NULL default '' + `koi8_ru_f` char(32) character set koi8r NOT NULL default '' ) TYPE=MyISAM CHARSET=latin5 ALTER TABLE t1 CHANGE comment comment CHAR(32) CHARACTER SET latin2 NOT NULL; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `comment` char(32) character set latin2 NOT NULL default '', - `koi8_ru_f` char(32) character set koi8_ru NOT NULL default '' + `koi8_ru_f` char(32) character set koi8r NOT NULL default '' ) TYPE=MyISAM CHARSET=latin5 ALTER TABLE t1 ADD latin5_f CHAR(32) NOT NULL; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `comment` char(32) character set latin2 NOT NULL default '', - `koi8_ru_f` char(32) character set koi8_ru NOT NULL default '', - `latin5_f` char(32) character set latin5 NOT NULL default '' + `koi8_ru_f` char(32) character set koi8r NOT NULL default '', + `latin5_f` char(32) NOT NULL default '' ) TYPE=MyISAM CHARSET=latin5 ALTER TABLE t1 CHARSET=latin2; ALTER TABLE t1 ADD latin2_f CHAR(32) NOT NULL; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `comment` char(32) character set latin2 NOT NULL default '', - `koi8_ru_f` char(32) character set koi8_ru NOT NULL default '', + `comment` char(32) NOT NULL default '', + `koi8_ru_f` char(32) character set koi8r NOT NULL default '', `latin5_f` char(32) character set latin5 NOT NULL default '', - `latin2_f` char(32) character set latin2 NOT NULL default '' + `latin2_f` char(32) NOT NULL default '' ) TYPE=MyISAM CHARSET=latin2 ALTER TABLE t1 DROP latin2_f, DROP latin5_f; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `comment` char(32) character set latin2 NOT NULL default '', - `koi8_ru_f` char(32) character set koi8_ru NOT NULL default '' + `comment` char(32) NOT NULL default '', + `koi8_ru_f` char(32) character set koi8r NOT NULL default '' ) TYPE=MyISAM CHARSET=latin2 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('a','LAT SMALL A'); INSERT INTO t1 (koi8_ru_f,comment) VALUES ('b','LAT SMALL B'); @@ -336,6 +336,11 @@ CYR CAPIT SOFT SIGN ø Ь CYR CAPIT E ü Ð CYR CAPIT YU à Ю CYR CAPIT YA ñ Я +ALTER TABLE t1 ADD bin_f CHAR(32) BYTE NOT NULL; +UPDATE t1 SET bin_f=koi8_ru_f; +SELECT COUNT(DISTINCT bin_f),COUNT(DISTINCT koi8_ru_f),COUNT(DISTINCT utf8_f) FROM t1; +COUNT(DISTINCT bin_f) COUNT(DISTINCT koi8_ru_f) COUNT(DISTINCT utf8_f) +116 58 57 SELECT koi8_ru_f,MIN(comment) FROM t1 GROUP BY 1; koi8_ru_f MIN(comment) a LAT CAPIT A @@ -1056,7 +1061,7 @@ CYR SMALL YA CYR CAPIT YA CYR SMALL YA CYR SMALL YA SELECT t11.comment,t12.comment FROM t1 t11,t1 t12 -WHERE t11.koi8_ru_f=CONVERT(t12.utf8_f USING koi8_ru) +WHERE t11.koi8_ru_f=CONVERT(t12.utf8_f USING koi8r) ORDER BY t12.utf8_f,t11.comment,t12.comment; comment comment LAT CAPIT A LAT CAPIT A diff --git a/mysql-test/r/delete.result b/mysql-test/r/delete.result index 351798b0509..4fa85ea9cbc 100644 --- a/mysql-test/r/delete.result +++ b/mysql-test/r/delete.result @@ -24,7 +24,6 @@ create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a)); insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27); delete from t1 where a=27; drop table t1; -drop table if exists t; CREATE TABLE `t` ( `i` int(10) NOT NULL default '0', `i2` int(10) NOT NULL default '0', diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result index 03e00b206b2..4f16e239e15 100644 --- a/mysql-test/r/derived.result +++ b/mysql-test/r/derived.result @@ -1,4 +1,11 @@ drop table if exists t1,t2,t3; +select * from (select 2 from DUAL) b; +2 +2 +SELECT 1 as a FROM (SELECT 1 UNION SELECT a) b; +Unknown column 'a' in 'field list' +SELECT 1 as a FROM (SELECT a UNION SELECT 1) b; +Unknown column 'a' in 'field list' CREATE TABLE t1 (a int not null, b char (10) not null); insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c'); CREATE TABLE t2 (a int not null, b char (10) not null); @@ -53,7 +60,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY x1 ALL NULL NULL NULL NULL 4 1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 2 DERIVED x1 ALL NULL NULL NULL NULL 4 -drop table if exists t1.t2,t3; +drop table if exists t2,t3; select * from (select 1) as a; 1 1 @@ -116,10 +123,16 @@ explain select count(*) from t1 as tt1, (select * from t1) as tt2; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away 2 DERIVED tt1 index NULL a 4 NULL 10000 Using index -drop table if exists t1; +drop table t1; SELECT * FROM (SELECT (SELECT * FROM (SELECT 1 as a) as a )) as b; (SELECT * FROM (SELECT 1 as a) as a ) 1 select * from (select 1 as a) b left join (select 2 as a) c using(a); a a 1 NULL +SELECT * FROM (SELECT 1 UNION SELECT a) b; +Unknown column 'a' in 'field list' +SELECT 1 as a FROM (SELECT a UNION SELECT 1) b; +Unknown column 'a' in 'field list' +SELECT 1 as a FROM (SELECT 1 UNION SELECT a) b; +Unknown column 'a' in 'field list' diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result index aefcba9ed9d..ae1d9588bc7 100644 --- a/mysql-test/r/distinct.result +++ b/mysql-test/r/distinct.result @@ -326,7 +326,6 @@ AND ((t1.id=j_lj_t3.id AND t3_lj.id IS NULL) OR (t1.id=t3.id AND t3.idx=2)); id 2 drop table t1,t2,t3; -drop table if exists t1; create table t1 (a int not null, b int not null, t time); insert into t1 values (1,1,"00:06:15"),(1,2,"00:06:15"),(1,2,"00:30:15"),(1,3,"00:06:15"),(1,3,"00:30:15"); select a,sec_to_time(sum(time_to_sec(t))) from t1 group by a,b; @@ -410,7 +409,7 @@ INSERT INTO t2 VALUES (33,6,'Kevin','0','kevin@stileproject.com',1,'',0,'http:// SELECT DISTINCT t1.*, t2.* FROM t1 LEFT JOIN t2 ON (t2.userid = t1.touserid); privatemessageid folderid userid touserid fromuserid title message dateline showsignature iconid messageread readtime receipt deleteprompt multiplerecipients userid usergroupid username password email styleid parentemail coppauser homepage icq aim yahoo signature adminemail showemail invisible usertitle customtitle joindate cookieuser daysprune lastvisit lastactivity lastpost posts timezoneoffset emailnotification buddylist ignorelist pmfolders receivepm emailonpm pmpopup avatarid avatarrevision options birthday maxposts startofweek ipaddress referrerid nosessionhash autorefresh messagepopup inforum ratenum ratetotal allowrate 128 0 33 33 8 :D 996121863 1 0 2 996122850 2 0 0 33 6 Kevin 0 kevin@stileproject.com 1 0 http://www.stileproject.com 1 1 0 Administrator 0 996120694 1 -1 1030996168 1031027028 1030599436 36 -6 0 1 0 1 0 0 15 0000-00-00 -1 1 64.0.0.0 0 1 -1 0 0 4 19 1 -DROP TABLE IF EXISTS t1,t2; +DROP TABLE t1,t2; CREATE TABLE t1 (a int primary key, b int, c int); INSERT t1 VALUES (1,2,3); CREATE TABLE t2 (a int primary key, b int, c int); @@ -418,4 +417,4 @@ INSERT t2 VALUES (3,4,5); SELECT DISTINCT t1.a, t2.b FROM t1, t2 WHERE t1.a=1 ORDER BY t2.c; a b 1 4 -DROP TABLE IF EXISTS t1,t2; +DROP TABLE t1,t2; diff --git a/mysql-test/r/drop.result b/mysql-test/r/drop.result index 178c3a8cb4f..a9048b65d51 100644 --- a/mysql-test/r/drop.result +++ b/mysql-test/r/drop.result @@ -1,5 +1,4 @@ drop table if exists t1; -drop table if exists t1; drop table t1; Unknown table 't1' create table t1(n int); @@ -13,6 +12,8 @@ select * from t1; n 1 drop database if exists mysqltest; +Warnings: +Note 1008 Can't drop database 'mysqltest'. Database doesn't exist create database mysqltest; drop database if exists mysqltest; create database mysqltest; @@ -25,6 +26,8 @@ drop database if exists mysqltest; create database mysqltest; drop database mysqltest; drop database if exists mysqltest; +Warnings: +Note 1008 Can't drop database 'mysqltest'. Database doesn't exist flush tables with read lock; create database mysqltest; Got one of the listed errors diff --git a/mysql-test/r/flush.result b/mysql-test/r/flush.result index 7080f2b6145..4e7e4769f1b 100644 --- a/mysql-test/r/flush.result +++ b/mysql-test/r/flush.result @@ -1,6 +1,6 @@ -drop table if exists t1; +drop table if exists t1,t2; +drop database if exists mysqltest; create temporary table t1(n int not null primary key); -drop table if exists t2; create table t2(n int); insert into t2 values(3); select * from t1; @@ -11,7 +11,6 @@ drop table t2; Table 't2' was locked with a READ lock and can't be updated drop table t2; unlock tables; -drop database if exists mysqltest; create database mysqltest; create table mysqltest.t1(n int); insert into mysqltest.t1 values (23); diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result index a991981bf21..1382c31d145 100644 --- a/mysql-test/r/fulltext.result +++ b/mysql-test/r/fulltext.result @@ -141,7 +141,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `ticket` int(11) default NULL, - `inhalt` text character set latin1, + `inhalt` text, KEY `tig` (`ticket`), FULLTEXT KEY `tix` (`inhalt`) ) TYPE=MyISAM CHARSET=latin1 @@ -206,7 +206,6 @@ select 8 from t1; 8 8 drop table t1; -drop table if exists t1; create table t1 (a text, fulltext key (a)); insert into t1 values ('aaaa'); repair table t1; diff --git a/mysql-test/r/fulltext_multi.result b/mysql-test/r/fulltext_multi.result index 72b7102fd3f..968b00020e2 100644 --- a/mysql-test/r/fulltext_multi.result +++ b/mysql-test/r/fulltext_multi.result @@ -1,4 +1,3 @@ -use test; DROP TABLE IF EXISTS t1; CREATE TABLE t1 ( a int(11) NOT NULL auto_increment, diff --git a/mysql-test/r/fulltext_order_by.result b/mysql-test/r/fulltext_order_by.result index c0e72ff789f..bfee9eba280 100644 --- a/mysql-test/r/fulltext_order_by.result +++ b/mysql-test/r/fulltext_order_by.result @@ -1,4 +1,3 @@ -use test; DROP TABLE IF EXISTS t1; CREATE TABLE t1 ( a INT AUTO_INCREMENT PRIMARY KEY, diff --git a/mysql-test/r/func_crypt.result b/mysql-test/r/func_crypt.result index ad3a64ccd1d..461ae1e7e09 100644 --- a/mysql-test/r/func_crypt.result +++ b/mysql-test/r/func_crypt.result @@ -1,6 +1,15 @@ select length(encrypt('foo', 'ff')) <> 0; length(encrypt('foo', 'ff')) <> 0 1 -select old_password('test'),length(password("1")),length(encrypt('test')),encrypt('test','aa'); +select password("a",""), password("a",NULL), password("","a"), password(NULL,"a"); +password("a","") password("a",NULL) password("","a") password(NULL,"a") +*2517f7235d68d4ba2e5019c93420523101157a792c01 NULL NULL +select password("aaaaaaaaaaaaaaaa","a"), password("a","aaaaaaaaaaaaaaaa"); +password("aaaaaaaaaaaaaaaa","a") password("a","aaaaaaaaaaaaaaaa") +*2cd3b9a44e9a9994789a30f935c92f45a96c5472f381 *37c7c5c794ff144819f2531bf03c57772cd84e40db09 +select old_password('test'), length(password("1")), length(encrypt('test')), encrypt('test','aa'); old_password('test') length(password("1")) length(encrypt('test')) encrypt('test','aa') 378b243e220ca493 45 13 aaqPiZY5xR5l. +select old_password(""), old_password(NULL), password(""), password(NULL); +old_password("") old_password(NULL) password("") password(NULL) + NULL NULL diff --git a/mysql-test/r/func_equal.result b/mysql-test/r/func_equal.result index 32a911eedf8..352b76f2744 100644 --- a/mysql-test/r/func_equal.result +++ b/mysql-test/r/func_equal.result @@ -1,3 +1,4 @@ +drop table if exists t1,t2; select 0<=>0,0.0<=>0.0,"A"<=>"A",NULL<=>NULL; 0<=>0 0.0<=>0.0 "A"<=>"A" NULL<=>NULL 1 1 1 1 @@ -10,7 +11,6 @@ select 1.0<=>0.0,0.0<=>NULL,NULL<=>0.0; select "A"<=>"B","A"<=>NULL,NULL<=>"A"; "A"<=>"B" "A"<=>NULL NULL<=>"A" 0 0 0 -drop table if exists t1,t2; create table t1 (id int, value int); create table t2 (id int, value int); insert into t1 values (1,null); diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result index 01d70c7c4c6..006dc8abef0 100644 --- a/mysql-test/r/func_in.result +++ b/mysql-test/r/func_in.result @@ -1,3 +1,4 @@ +drop table if exists t1; select 1 in (1,2,3); 1 in (1,2,3) 1 @@ -34,7 +35,6 @@ select 3.5 in (1.5,NULL,3.5); select 10.5 in (1.5,NULL,3.5); 10.5 in (1.5,NULL,3.5) NULL -drop table if exists t1; CREATE TABLE t1 (a int, b int, c int); insert into t1 values (1,2,3), (1,NULL,3); select 1 in (a,b,c) from t1; diff --git a/mysql-test/r/func_set.result b/mysql-test/r/func_set.result index 5305c16c5d9..ab72e42eca9 100644 --- a/mysql-test/r/func_set.result +++ b/mysql-test/r/func_set.result @@ -25,3 +25,20 @@ find_in_set("","a,b,c") find_in_set("","a,b,c,") find_in_set("",",a,b,c") select find_in_set("abc","abc"),find_in_set("ab","abc"),find_in_set("abcd","abc"); find_in_set("abc","abc") find_in_set("ab","abc") find_in_set("abcd","abc") 1 0 0 +drop table if exists t1,t2; +create table t1 (id int(10) not null unique); +create table t2 (id int(10) not null primary key, +val int(10) not null); +insert into t1 values (1),(2),(4); +insert into t2 values (1,1),(2,1),(3,1),(4,2); +select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id; +id elt(two.val,'one','two') +1 one +2 one +4 two +select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id order by one.id; +id elt(two.val,'one','two') +1 one +2 one +4 two +drop table t1,t2; diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index d0358aad6ba..b3468586f32 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -170,6 +170,9 @@ quote(concat('abc\'', '\\cba')) select quote(1/0), quote('\0\Z'); quote(1/0) quote('\0\Z') NULL '\0\Z' +select length(quote(concat(char(0),"test"))); +length(quote(concat(char(0),"test"))) +8 select reverse(""); reverse("") diff --git a/mysql-test/r/gcc296.result b/mysql-test/r/gcc296.result index 8f78f70cc1f..628bbbf3f93 100644 --- a/mysql-test/r/gcc296.result +++ b/mysql-test/r/gcc296.result @@ -1,5 +1,5 @@ -drop table if exists obory; -CREATE TABLE obory ( +drop table if exists t1; +CREATE TABLE t1 ( kodoboru varchar(10) default NULL, obor tinytext, aobor tinytext, @@ -7,14 +7,14 @@ UNIQUE INDEX kodoboru (kodoboru), FULLTEXT KEY obor (obor), FULLTEXT KEY aobor (aobor) ); -INSERT INTO obory VALUES ('0101000000','aaa','AAA'); -INSERT INTO obory VALUES ('0102000000','bbb','BBB'); -INSERT INTO obory VALUES ('0103000000','ccc','CCC'); -INSERT INTO obory VALUES ('0104000000','xxx','XXX'); -select * from obory; +INSERT INTO t1 VALUES ('0101000000','aaa','AAA'); +INSERT INTO t1 VALUES ('0102000000','bbb','BBB'); +INSERT INTO t1 VALUES ('0103000000','ccc','CCC'); +INSERT INTO t1 VALUES ('0104000000','xxx','XXX'); +select * from t1; kodoboru obor aobor 0101000000 aaa AAA 0102000000 bbb BBB 0103000000 ccc CCC 0104000000 xxx XXX -drop table obory; +drop table t1; diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index 696d8200b70..aa3de48c09e 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -1,6 +1,6 @@ +drop table if exists t1,t2,t3; SELECT 1 FROM (SELECT 1) as a GROUP BY SUM(1); Invalid use of group function -drop table if exists t1,t2,t3; CREATE TABLE t1 ( spID int(10) unsigned, userID int(10) unsigned, @@ -42,7 +42,7 @@ SELECT t2.userid, MIN(t1.score+0.0) FROM t1, t2 WHERE t1.userID=t2.userID AND t1 userid MIN(t1.score+0.0) 1 1.0 2 2.0 -drop table test.t1,test.t2; +drop table t1,t2; CREATE TABLE t1 ( PID int(10) unsigned DEFAULT '0' NOT NULL auto_increment, payDate date DEFAULT '0000-00-00' NOT NULL, @@ -390,7 +390,6 @@ CONCAT(a, b) count(*) abcdef 1 hijklm 2 DROP TABLE t1; -drop table if exists t1; create table t1 (One int unsigned, Two int unsigned, Three int unsigned, Four int unsigned); insert into t1 values (1,2,1,4),(1,2,2,4),(1,2,3,4),(1,2,4,4),(1,1,1,4),(1,1,2,4),(1,1,3,4),(1,1,4,4),(1,3,1,4),(1,3,2,4),(1,3,3,4),(1,3,4,4); select One, Two, sum(Four) from t1 group by One,Two; diff --git a/mysql-test/r/innodb-deadlock.result b/mysql-test/r/innodb-deadlock.result index db7155f14fb..e1b3e38b243 100644 --- a/mysql-test/r/innodb-deadlock.result +++ b/mysql-test/r/innodb-deadlock.result @@ -1,4 +1,4 @@ -drop table if exists t1; +drop table if exists t1,t2; create table t1 (id integer, x integer) type=INNODB; insert into t1 values(0, 0); set autocommit=0; @@ -18,7 +18,6 @@ id x 0 2 commit; drop table t1; -drop table if exists t1, t2; create table t1 (id integer, x integer) type=INNODB; create table t2 (b integer, a integer) type=INNODB; insert into t1 values(0, 0), (300, 300); diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index 82e678416ad..f5bbf082730 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -805,7 +805,7 @@ create table t1 (a char(20), index (a(5))) type=innodb; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` char(20) character set latin1 default NULL, + `a` char(20) default NULL, KEY `a` (`a`) ) TYPE=InnoDB CHARSET=latin1 drop table t1; @@ -918,8 +918,8 @@ id select_type table type possible_keys key key_len ref rows Extra drop table t1; create table t1 (t int not null default 1, key (t)) type=innodb; desc t1; -Field Type Null Key Default Extra -t int(11) MUL 1 +Field Type Collation Null Key Default Extra +t int(11) binary MUL 1 drop table t1; CREATE TABLE t1 ( number bigint(20) NOT NULL default '0', @@ -1021,7 +1021,6 @@ id code name 7 4 Matt COMMIT; DROP TABLE t1; -drop table if exists t1,t2; create table t1 (n int(10), d int(10)) type=innodb; create table t2 (n int(10), d int(10)) type=innodb; insert into t1 values(1,1),(1,2); diff --git a/mysql-test/r/innodb_cache.result b/mysql-test/r/innodb_cache.result index 47abcb45fe5..7d351a13e16 100644 --- a/mysql-test/r/innodb_cache.result +++ b/mysql-test/r/innodb_cache.result @@ -1,4 +1,4 @@ -drop table if exists t1, t2, t3; +drop table if exists t1,t2,t3; flush status; set autocommit=0; create table t1 (a int not null) type=innodb; diff --git a/mysql-test/r/innodb_handler.result b/mysql-test/r/innodb_handler.result index a55114a0e3d..dc6a265fb29 100644 --- a/mysql-test/r/innodb_handler.result +++ b/mysql-test/r/innodb_handler.result @@ -1,4 +1,4 @@ -drop table if exists t1; +drop table if exists t1,t2; create table t1 (a int, b char(10), key a(a), key b(a,b)) type=innodb; insert into t1 values (17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"), diff --git a/mysql-test/r/insert.result b/mysql-test/r/insert.result index 2ffa9d88618..ebd34dd7668 100644 --- a/mysql-test/r/insert.result +++ b/mysql-test/r/insert.result @@ -48,10 +48,19 @@ sid id skr 1 skr 2 test 1 +insert into t1 values ('rts',NULL),('rts',NULL),('test',NULL); +select * from t1; +sid id +rts 1 +rts 2 +skr 1 +skr 2 +test 1 +test 2 drop table t1; -drop database if exists foo; -create database foo; -use foo; +drop database if exists test_$1; +create database test_$1; +use test_$1; create table t1 (c int); -insert into foo.t1 set foo.t1.c = '1'; -drop database foo; +insert into test_$1.t1 set test_$1.t1.c = '1'; +drop database test_$1; diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result index e24c3179a0c..9a65eaee573 100644 --- a/mysql-test/r/insert_select.result +++ b/mysql-test/r/insert_select.result @@ -21,8 +21,7 @@ payoutID 20 22 drop table t1,t2; -DROP TABLE IF EXISTS crash1,crash2; -CREATE TABLE `crash1` ( +CREATE TABLE `t1` ( `numeropost` bigint(20) unsigned NOT NULL default '0', `icone` tinyint(4) unsigned NOT NULL default '0', `numreponse` bigint(20) unsigned NOT NULL auto_increment, @@ -37,7 +36,7 @@ KEY `date` (`date`), KEY `pseudo` (`pseudo`), KEY `numreponse` (`numreponse`) ) TYPE=MyISAM; -CREATE TABLE `crash2` ( +CREATE TABLE `t2` ( `numeropost` bigint(20) unsigned NOT NULL default '0', `icone` tinyint(4) unsigned NOT NULL default '0', `numreponse` bigint(20) unsigned NOT NULL auto_increment, @@ -52,17 +51,17 @@ KEY `date` (`date`), KEY `pseudo` (`pseudo`), KEY `numreponse` (`numreponse`) ) TYPE=MyISAM; -INSERT INTO crash2 +INSERT INTO t2 (numeropost,icone,numreponse,contenu,pseudo,date,ip,signature) VALUES (9,1,56,'test','joce','2001-07-25 13:50:53' ,3649052399,0); -INSERT INTO crash1 (numeropost,icone,contenu,pseudo,date,signature,ip) -SELECT 1618,icone,contenu,pseudo,date,signature,ip FROM crash2 +INSERT INTO t1 (numeropost,icone,contenu,pseudo,date,signature,ip) +SELECT 1618,icone,contenu,pseudo,date,signature,ip FROM t2 WHERE numeropost=9 ORDER BY numreponse ASC; show variables like '%bulk%'; Variable_name Value bulk_insert_buffer_size 8388608 -INSERT INTO crash1 (numeropost,icone,contenu,pseudo,date,signature,ip) -SELECT 1718,icone,contenu,pseudo,date,signature,ip FROM crash2 +INSERT INTO t1 (numeropost,icone,contenu,pseudo,date,signature,ip) +SELECT 1718,icone,contenu,pseudo,date,signature,ip FROM t2 WHERE numeropost=9 ORDER BY numreponse ASC; -DROP TABLE IF EXISTS crash1,crash2; +DROP TABLE IF EXISTS t1,t2; diff --git a/mysql-test/r/isam.result b/mysql-test/r/isam.result index e8f7898f1eb..7871e899773 100644 --- a/mysql-test/r/isam.result +++ b/mysql-test/r/isam.result @@ -38,6 +38,8 @@ Incorrect table definition; There can only be one auto column and it must be def create table t1 (ordid int(8), unique (ordid)) type=isam; Column 'ordid' is used with UNIQUE or INDEX but is not defined as NOT NULL drop table if exists t1; +Warnings: +Note 1051 Unknown table 't1' create table t1 (a int not null primary key, b int not null,c int not null, key(b,c)); insert into t1 values (1,2,2),(2,2,3),(3,2,4),(4,2,4); create table t2 type=isam select * from t1; @@ -62,15 +64,15 @@ Table Op Msg_type Msg_text test.t2 check error Table 't2' was not locked with LOCK TABLES test.t1 check status OK show columns from t1; -Field Type Null Key Default Extra -a int(11) PRI 0 -b int(11) MUL 0 -c int(11) 0 +Field Type Collation Null Key Default Extra +a int(11) binary PRI 0 +b int(11) binary MUL 0 +c int(11) binary 0 show full columns from t1; -Field Type Null Key Default Extra Privileges Comment -a int(11) PRI 0 select,insert,update,references -b int(11) MUL 0 select,insert,update,references -c int(11) 0 select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +a int(11) binary PRI 0 select,insert,update,references +b int(11) binary MUL 0 select,insert,update,references +c int(11) binary 0 select,insert,update,references show index from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t1 0 PRIMARY 1 a A 4 NULL NULL BTREE diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result index b89a6696727..8abe6d517ee 100644 --- a/mysql-test/r/join_outer.result +++ b/mysql-test/r/join_outer.result @@ -181,7 +181,6 @@ SELECT t1.usr_id,t1.uniq_id,t1.increment,t2.usr2_id,t2.c_amount,t2.max FROM t1 L usr_id uniq_id increment usr2_id c_amount max 3 4 84676 NULL NULL NULL drop table t1,t2; -drop table if exists t1,t2,t3,t4; CREATE TABLE t1 ( cod_asig int(11) DEFAULT '0' NOT NULL, desc_larga_cat varchar(80) DEFAULT '' NOT NULL, diff --git a/mysql-test/r/key.result b/mysql-test/r/key.result index 1cd9c9dfe79..9e1f743d132 100644 --- a/mysql-test/r/key.result +++ b/mysql-test/r/key.result @@ -147,7 +147,6 @@ t1 0 e 1 e A 0 NULL NULL BTREE t1 0 b 1 b A NULL NULL NULL YES BTREE t1 1 c 1 c A NULL NULL NULL YES BTREE drop table t1; -DROP TABLE IF EXISTS t1; CREATE TABLE t1 (c CHAR(10) NOT NULL,i INT NOT NULL AUTO_INCREMENT, UNIQUE (c,i)); INSERT INTO t1 (c) VALUES (NULL),(NULL); diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result index d0e595d6551..9199f291c08 100644 --- a/mysql-test/r/merge.result +++ b/mysql-test/r/merge.result @@ -172,7 +172,7 @@ show create table t3; Table Create Table t3 CREATE TABLE `t3` ( `a` int(11) NOT NULL default '0', - `b` char(20) character set latin1 default NULL, + `b` char(20) default NULL, KEY `a` (`a`) ) TYPE=MRG_MyISAM CHARSET=latin1 UNION=(t1,t2) create table t4 (a int not null, b char(10), key(a)) type=MERGE UNION=(t1,t2); @@ -181,6 +181,8 @@ Can't open file: 't4.MRG'. (errno: 143) create table t5 (a int not null, b char(10), key(a)) type=MERGE UNION=(test.t1,test_2.t2); Incorrect table definition; All MERGE tables must be in the same database drop table if exists t5,t4,t3,t1,t2; +Warnings: +Note 1051 Unknown table 't5' create table t1 (c char(10)) type=myisam; create table t2 (c char(10)) type=myisam; create table t3 (c char(10)) union=(t1,t2) type=merge; @@ -262,7 +264,6 @@ create table t1 (a int not null) type=merge; select * from t1; a drop table t1; -drop table if exists t3, t2, t1; create table t1 (a int not null, b int not null, key(a,b)); create table t2 (a int not null, b int not null, key(a,b)); create table t3 (a int not null, b int not null, key(a,b)) TYPE=MERGE UNION=(t1,t2); @@ -274,7 +275,6 @@ a b 1 1 1 2 drop table t3,t1,t2; -drop table if exists t6, t5, t4, t3, t2, t1; create table t1 (a int not null, b int not null auto_increment, primary key(a,b)); create table t2 (a int not null, b int not null auto_increment, primary key(a,b)); create table t3 (a int not null, b int not null, key(a,b)) UNION=(t1,t2) INSERT_METHOD=NO; @@ -533,15 +533,14 @@ CREATE TABLE t1 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default ' INSERT INTO t1 VALUES (1,1), (2,1); CREATE TABLE t2 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', PRIMARY KEY (a,b)) TYPE=MyISAM; INSERT INTO t2 VALUES (1,2), (2,2); -CREATE TABLE t ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', KEY a (a,b)) TYPE=MRG_MyISAM UNION=(t1,t2); -select max(b) from t where a = 2; +CREATE TABLE t3 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', KEY a (a,b)) TYPE=MRG_MyISAM UNION=(t1,t2); +select max(b) from t3 where a = 2; max(b) NULL select max(b) from t1 where a = 2; max(b) 1 -drop table if exists t,t1,t2; -drop table if exists t1, t2, t3, t4, t5, t6; +drop table if exists t3,t1,t2; create table t1 (a int not null); create table t2 (a int not null); insert into t1 values (1); @@ -561,7 +560,6 @@ a 1 2 drop table if exists t6, t3, t1, t2, t4, t5; -DROP TABLE IF EXISTS t1, t2; CREATE TABLE t1 ( fileset_id tinyint(3) unsigned NOT NULL default '0', file_code varchar(32) NOT NULL default '', @@ -595,4 +593,4 @@ EXPLAIN SELECT * FROM t2 WHERE fileset_id = 2 AND file_code = '0000000115' LIMIT 1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 const PRIMARY,files PRIMARY 33 const,const 1 -DROP TABLE IF EXISTS t2, t1; +DROP TABLE t2, t1; diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result index 8cf035343b1..4dbb3c8adb1 100644 --- a/mysql-test/r/multi_update.result +++ b/mysql-test/r/multi_update.result @@ -96,7 +96,7 @@ id mydate 5 2002-05-12 00:00:00 6 2002-06-22 00:00:00 7 2002-07-22 00:00:00 -DROP TABLE IF EXISTS t1,t2,t3; +DROP TABLE t1,t2,t3; CREATE TABLE IF NOT EXISTS `t1` ( `id` int(11) NOT NULL auto_increment, `tst` text, @@ -125,7 +125,7 @@ ID ParId tst tst1 1 1 MySQL MySQL AB 2 2 MSSQL Microsoft 3 3 ORACLE ORACLE -drop table if exists t1, t2 ; +drop table t1, t2 ; create table t1 (n numeric(10)); create table t2 (n numeric(10)); insert into t2 values (1),(2),(4),(8),(16),(32); @@ -235,4 +235,28 @@ select * from t2; n d 1 30 1 30 +UPDATE t1 a ,t2 b SET a.d=b.d,b.d=30 WHERE a.n=b.n; +select * from t1; +n d +1 30 +3 2 +select * from t2; +n d +1 30 +1 30 +DELETE t1, t2 FROM t1 a,t2 b where a.n=b.n; +select * from t1; +n d +3 2 +select * from t2; +n d drop table t1,t2; +CREATE TABLE t1 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM; +INSERT INTO t1 VALUES (1,'jedan'),(2,'dva'),(3,'tri'),(4,'xxxxxxxxxx'),(5,'a'),(10,''),(11,''),(12,''),(13,''); +CREATE TABLE t2 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM; +INSERT INTO t2 VALUES (1,'jedan'),(2,'dva'),(3,'tri'),(4,'xxxxxxxxxx'),(5,'a'); +CREATE TABLE t3 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM; +INSERT INTO t3 VALUES (1,'jedan'),(2,'dva'); +update t1,t2 set t1.naziv="aaaa" where t1.broj=t2.broj; +update t1,t2,t3 set t1.naziv="bbbb", t2.naziv="aaaa" where t1.broj=t2.broj and t2.broj=t3.broj; +drop table t1,t2,t3; diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index 6b9c3a53305..23610be36c4 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -1,4 +1,4 @@ -drop table if exists t1; +drop table if exists t1,t2; CREATE TABLE t1 ( STRING_DATA char(255) default NULL, KEY string_data (STRING_DATA) @@ -83,7 +83,6 @@ OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK DROP TABLE t1; -drop table if exists t1; create table t1 ( t1 char(255), key(t1(250))); insert t1 values ('137513751375137513751375137513751375137569516951695169516951695169516951695169'); insert t1 values ('178417841784178417841784178417841784178403420342034203420342034203420342034203'); @@ -121,7 +120,6 @@ check table t1; Table Op Msg_type Msg_text test.t1 check status OK drop table t1; -drop table if exists t1; create table t1 (i1 int, i2 int, i3 int, i4 int, i5 int, i6 int, i7 int, i8 int, i9 int, i10 int, i11 int, i12 int, i13 int, i14 int, i15 int, i16 int, i17 int, i18 int, i19 int, i20 int, i21 int, i22 int, i23 int, i24 int, i25 int, @@ -286,7 +284,7 @@ insert into t1 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); -drop table if exists t1; +drop table t1; CREATE TABLE `t1` ( `post_id` mediumint(8) unsigned NOT NULL auto_increment, `topic_id` mediumint(8) unsigned NOT NULL default '0', @@ -318,3 +316,51 @@ CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255)); ALTER TABLE t1 ADD INDEX t1 (a, b, c); Specified key was too long. Max key length is 500 DROP TABLE t1; +CREATE TABLE t1 (a int not null, b int, c int, key(b), key(c), key(a,b), key(c,a)); +INSERT into t1 values (0, null, 0), (0, null, 1), (0, null, 2), (0, null,3), (1,1,4); +create table t2 (a int not null, b int, c int, key(b), key(c), key(a)); +INSERT into t2 values (1,1,1), (2,2,2); +optimize table t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +show index from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 1 b 1 b A 5 NULL NULL YES BTREE +t1 1 c 1 c A 5 NULL NULL YES BTREE +t1 1 a 1 a A 1 NULL NULL BTREE +t1 1 a 2 b A 5 NULL NULL YES BTREE +t1 1 c_2 1 c A 5 NULL NULL YES BTREE +t1 1 c_2 2 a A 5 NULL NULL BTREE +explain select * from t1,t2 where t1.a=t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL a NULL NULL NULL 5 +1 SIMPLE t2 ALL a NULL NULL NULL 2 Using where +explain select * from t1,t2 force index(a) where t1.a=t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL a NULL NULL NULL 2 +1 SIMPLE t1 ALL a NULL NULL NULL 5 Using where +explain select * from t1 force index(a),t2 force index(a) where t1.a=t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL a NULL NULL NULL 2 +1 SIMPLE t1 ref a a 4 t2.a 3 +explain select * from t1,t2 where t1.b=t2.b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL b NULL NULL NULL 2 +1 SIMPLE t1 ref b b 5 t2.b 1 Using where +explain select * from t1,t2 force index(c) where t1.a=t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL a NULL NULL NULL 5 +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where +explain select * from t1 where a=0 or a=2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL a NULL NULL NULL 5 Using where +explain select * from t1 force index (a) where a=0 or a=2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 4 NULL 4 Using where +explain select * from t1 where c=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref c,c_2 c 5 const 1 Using where +explain select * from t1 use index() where c=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +drop table t1,t2; diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result index cdea66cbf58..91af34b6681 100644 --- a/mysql-test/r/null.result +++ b/mysql-test/r/null.result @@ -1,3 +1,4 @@ +drop table if exists t1; select null,\N,isnull(null),isnull(1/0),isnull(1/0 = null),ifnull(null,1),ifnull(null,"TRUE"),ifnull("TRUE","ERROR"),1/0 is null,1 is not null; NULL NULL isnull(null) isnull(1/0) isnull(1/0 = null) ifnull(null,1) ifnull(null,"TRUE") ifnull("TRUE","ERROR") 1/0 is null 1 is not null NULL NULL 1 1 1 1 TRUE TRUE 1 1 @@ -34,7 +35,6 @@ NULL AND 0 0 and NULL select inet_ntoa(null),inet_aton(null),inet_aton("122.256"),inet_aton("122.226."),inet_aton(""); inet_ntoa(null) inet_aton(null) inet_aton("122.256") inet_aton("122.226.") inet_aton("") NULL NULL NULL NULL NULL -drop table if exists t1; create table t1 (x int); insert into t1 values (null); select * from t1 where x != 0; diff --git a/mysql-test/r/null_key.result b/mysql-test/r/null_key.result index 484437959a0..ce3af6c37cd 100644 --- a/mysql-test/r/null_key.result +++ b/mysql-test/r/null_key.result @@ -1,4 +1,4 @@ -drop table if exists t1; +drop table if exists t1,t2; create table t1 (a int, b int not null,unique key (a,b),index(b)) type=myisam; insert ignore into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(null,7),(9,9),(8,8),(7,7),(null,9),(null,9),(6,6); explain select * from t1 where a is null; @@ -136,7 +136,6 @@ select * from t1 where b like "6%"; a b c 6 6 0 drop table t1; -DROP TABLE IF EXISTS t1,t2; CREATE TABLE t1 ( id int(10) unsigned NOT NULL auto_increment, uniq_id int(10) unsigned default NULL, diff --git a/mysql-test/r/odbc.result b/mysql-test/r/odbc.result index 30366762cd0..c0b2ada0053 100644 --- a/mysql-test/r/odbc.result +++ b/mysql-test/r/odbc.result @@ -1,7 +1,7 @@ +drop table if exists t1; select {fn length("hello")}, { date "1997-10-20" }; {fn length("hello")} 1997-10-20 5 1997-10-20 -drop table if exists t1; create table t1 (a int not null auto_increment,b int not null,primary key (a,b)); insert into t1 SET A=NULL,B=1; insert into t1 SET a=null,b=2; diff --git a/mysql-test/r/olap.result b/mysql-test/r/olap.result index 52bd83df5ed..428d1052d19 100644 --- a/mysql-test/r/olap.result +++ b/mysql-test/r/olap.result @@ -1,6 +1,6 @@ -drop table if exists sales; -create table sales ( product varchar(32), country varchar(32), year int, profit int); -insert into sales values ( 'Computer', 'India',2000, 1200), +drop table if exists t1; +create table t1 ( product varchar(32), country varchar(32), year int, profit int); +insert into t1 values ( 'Computer', 'India',2000, 1200), ( 'TV', 'United States', 1999, 150), ( 'Calculator', 'United States', 1999,50), ( 'Computer', 'United States', 1999,1500), @@ -14,14 +14,14 @@ insert into sales values ( 'Computer', 'India',2000, 1200), ( 'Computer', 'India', 1999,1200), ( 'Computer', 'United States', 2000,1500), ( 'Calculator', 'United States', 2000,75); -select product, country , year, sum(profit) from sales group by product, country, year with cube; +select product, country , year, sum(profit) from t1 group by product, country, year with cube; This version of MySQL doesn't yet support 'CUBE' -explain select product, country , year, sum(profit) from sales group by product, country, year with cube; +explain select product, country , year, sum(profit) from t1 group by product, country, year with cube; This version of MySQL doesn't yet support 'CUBE' -select product, country , year, sum(profit) from sales group by product, country, year with rollup; +select product, country , year, sum(profit) from t1 group by product, country, year with rollup; This version of MySQL doesn't yet support 'ROLLUP' -explain select product, country , year, sum(profit) from sales group by product, country, year with rollup; +explain select product, country , year, sum(profit) from t1 group by product, country, year with rollup; This version of MySQL doesn't yet support 'ROLLUP' -select product, country , year, sum(profit) from sales group by product, country, year with cube union all select product, country , year, sum(profit) from sales group by product, country, year with rollup; +select product, country , year, sum(profit) from t1 group by product, country, year with cube union all select product, country , year, sum(profit) from t1 group by product, country, year with rollup; This version of MySQL doesn't yet support 'CUBE' -drop table sales; +drop table t1; diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result index 5645961a178..9bacae92945 100644 --- a/mysql-test/r/order_by.result +++ b/mysql-test/r/order_by.result @@ -222,7 +222,6 @@ DateOfAction TransactionID 1999-07-27 834 1999-07-27 840 drop table t1,t2,t3; -drop table if exists t1; CREATE TABLE t1 ( member_id int(11) NOT NULL auto_increment, inschrijf_datum varchar(20) NOT NULL default '', @@ -506,3 +505,37 @@ SELECT titre,t1.numeropost,auteur,icone,nbrep,'0',date,vue,ouvert,lastauteur,des titre numeropost auteur icone nbrep 0 date vue ouvert lastauteur dest test 1 joce 0 0 0 0000-00-00 00:00:00 0 1 bug drop table t1,t2; +CREATE TABLE t1 ( +FieldKey varchar(36) NOT NULL default '', +LongVal bigint(20) default NULL, +StringVal mediumtext, +KEY FieldKey (FieldKey), +KEY LongField (FieldKey,LongVal), +KEY StringField (FieldKey,StringVal(32)) +); +INSERT INTO t1 VALUES ('0',3,'0'),('0',2,'1'),('0',1,'2'),('1',2,'1'),('1',1,'3'), ('1',0,'2'),('2',3,'0'),('2',2,'1'),('2',1,'2'),('3',2,'1'),('3',1,'2'),('3','3','3'); +EXPLAIN SELECT * FROM t1 WHERE FieldKey = '1' ORDER BY LongVal; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref FieldKey,LongField,StringField LongField 36 const 2 Using where +SELECT * FROM t1 WHERE FieldKey = '1' ORDER BY LongVal; +FieldKey LongVal StringVal +1 0 2 +1 1 3 +1 2 1 +EXPLAIN SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY LongVal; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range FieldKey,LongField,StringField FieldKey 36 NULL 4 Using where; Using filesort +SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY LongVal; +FieldKey LongVal StringVal +3 1 2 +3 2 1 +3 3 3 +EXPLAIN SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY FieldKey, LongVal; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range FieldKey,LongField,StringField LongField 36 NULL 4 Using where +SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY FieldKey, LongVal; +FieldKey LongVal StringVal +3 1 2 +3 2 1 +3 3 3 +DROP TABLE t1; diff --git a/mysql-test/r/packet.result b/mysql-test/r/packet.result new file mode 100644 index 00000000000..e994e4d63da --- /dev/null +++ b/mysql-test/r/packet.result @@ -0,0 +1,25 @@ +set global max_allowed_packet=100; +set max_allowed_packet=100; +set global net_buffer_length=100; +set net_buffer_length=100; +SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len; +len +1024 +select repeat('a',200); +repeat('a',200) +NULL +select @@net_buffer_length, @@max_allowed_packet; +@@net_buffer_length @@max_allowed_packet +1024 80 +SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len; +Got a packet bigger than 'max_allowed_packet' +set global max_allowed_packet=default; +set max_allowed_packet=default; +set global net_buffer_length=default; +set net_buffer_length=default; +SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len; +len +100 +select length(repeat('a',200)); +length(repeat('a',200)) +200 diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result index a37313a150a..17c9c8edbd2 100644 --- a/mysql-test/r/query_cache.result +++ b/mysql-test/r/query_cache.result @@ -2,6 +2,7 @@ flush query cache; flush query cache; reset query cache; flush status; +drop database if exists mysqltest; drop table if exists t1,t2,t3,t11,t21, mysqltest.t1; create table t1 (a int not null); insert into t1 values (1),(2),(3); @@ -531,6 +532,7 @@ i show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 2 +update t1 set i=(select distinct 1 from (select * from t2) a); drop table t1, t2, t3; use mysql; select * from db; diff --git a/mysql-test/r/rename.result b/mysql-test/r/rename.result index b2bb659502a..e422fbe49c1 100644 --- a/mysql-test/r/rename.result +++ b/mysql-test/r/rename.result @@ -37,3 +37,5 @@ select * from t3; 3 table 3 3 table 3 drop table if exists t1,t2,t3,t4; +Warnings: +Note 1051 Unknown table 't4' diff --git a/mysql-test/r/row.result b/mysql-test/r/row.result index 1d606fc370c..f3522e05380 100644 --- a/mysql-test/r/row.result +++ b/mysql-test/r/row.result @@ -1,3 +1,4 @@ +drop table if exists t1; select row(1,2,3) IN (row(3,2,3), row(1,2,3), row(1,3,3)); row(1,2,3) IN (row(3,2,3), row(1,2,3), row(1,3,3)) 1 @@ -88,7 +89,6 @@ ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,NULL)) NULL SELECT ROW('test',2,ROW(3,33))=ROW('test',2,4); Cardinality error (more/less than 2 columns) -drop table if exists t1; create table t1 ( a int, b int, c int); insert into t1 values (1,2,3), (2,3,1), (3,2,1), (1,2,NULL); select * from t1 where ROW(1,2,3)=ROW(a,b,c); @@ -127,7 +127,6 @@ ROW(1,2,3) IN(row(a,b,c), row(1,2,3)) drop table t1; select ROW(1,1); Cardinality error (more/less than 1 columns) -drop table if exists t1; create table t1 (i int); select 1 from t1 where ROW(1,1); Cardinality error (more/less than 1 columns) diff --git a/mysql-test/r/rpl000001.result b/mysql-test/r/rpl000001.result index 5cee2e6deff..dd569944f0e 100644 --- a/mysql-test/r/rpl000001.result +++ b/mysql-test/r/rpl000001.result @@ -4,7 +4,6 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -drop table if exists t1,t2,t3; create table t1 (word char(20) not null); load data infile '../../std_data/words.dat' into table t1; load data local infile 'MYSQL_TEST_DIR/std_data/words.dat' into table t1; diff --git a/mysql-test/r/rpl000002.result b/mysql-test/r/rpl000002.result index 819f43da103..56e34b4874f 100644 --- a/mysql-test/r/rpl000002.result +++ b/mysql-test/r/rpl000002.result @@ -4,7 +4,6 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -drop table if exists t1; create table t1 (n int auto_increment primary key); set insert_id = 2000; insert into t1 values (NULL),(NULL),(NULL); @@ -18,7 +17,6 @@ Server_id Host Port Rpl_recovery_rank Master_id 2 127.0.0.1 9999 2 1 drop table t1; stop slave; -drop table if exists t2; create table t2(id int auto_increment primary key, created datetime); set timestamp=12345; insert into t2 set created=now(); diff --git a/mysql-test/r/rpl000003.result b/mysql-test/r/rpl000003.result deleted file mode 100644 index 7c63ada9cdf..00000000000 --- a/mysql-test/r/rpl000003.result +++ /dev/null @@ -1,17 +0,0 @@ -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; -drop table if exists t1; -create table t1(n int primary key); -insert into t1 values (1),(2),(2); -Duplicate entry '2' for key 1 -insert into t1 values (3); -select * from t1; -n -1 -2 -3 -drop table t1; diff --git a/mysql-test/r/rpl000004.result b/mysql-test/r/rpl000004.result index a677eac36d4..067696345e4 100644 --- a/mysql-test/r/rpl000004.result +++ b/mysql-test/r/rpl000004.result @@ -5,18 +5,13 @@ reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; set SQL_LOG_BIN=0; -drop table if exists t1; create table t1 (word char(20) not null, index(word)); load data infile '../../std_data/words.dat' into table t1; -drop table if exists t2; create table t2 (word char(20) not null); load data infile '../../std_data/words.dat' into table t2; create table t3 (word char(20) not null primary key); -drop table if exists t1; load table t1 from master; -drop table if exists t2; load table t2 from master; -drop table if exists t3; load table t3 from master; check table t1; Table Op Msg_type Msg_text diff --git a/mysql-test/r/rpl000005.result b/mysql-test/r/rpl000005.result index 228bb00a1a3..0202e43dcb2 100644 --- a/mysql-test/r/rpl000005.result +++ b/mysql-test/r/rpl000005.result @@ -4,7 +4,6 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -drop table if exists t1; CREATE TABLE t1 (name varchar(64), age smallint(3)); INSERT INTO t1 SET name='Andy', age=31; INSERT t1 SET name='Jacob', age=2; diff --git a/mysql-test/r/rpl000006.result b/mysql-test/r/rpl000006.result index e256e0f0136..7209ec3c3d1 100644 --- a/mysql-test/r/rpl000006.result +++ b/mysql-test/r/rpl000006.result @@ -5,13 +5,11 @@ reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; set SQL_LOG_BIN=0,timestamp=200006; -drop table if exists t1; create table t1(t timestamp not null,a char(1)); insert into t1 ( a) values ('F'); select unix_timestamp(t) from t1; unix_timestamp(t) 200006 -drop table if exists t1; load table t1 from master; select unix_timestamp(t) from t1; unix_timestamp(t) diff --git a/mysql-test/r/rpl000008.result b/mysql-test/r/rpl000008.result index eb0089da9d6..a88a3c690ed 100644 --- a/mysql-test/r/rpl000008.result +++ b/mysql-test/r/rpl000008.result @@ -5,21 +5,19 @@ reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; use test; -drop table if exists foo; -create table foo (n int); -insert into foo values(4); +drop table if exists mysqltest_foo; +drop table if exists mysqltest_bar; +create table mysqltest_foo (n int); +insert into mysqltest_foo values(4); use test; -drop table if exists foo; -create table foo (n int); -insert into foo values(5); -drop table if exists bar; -create table bar (m int); -insert into bar values(15); -drop table if exists choo; -create table choo (k int); -insert into choo values(55); -select foo.n,bar.m,choo.k from foo,bar,choo; +create table mysqltest_foo (n int); +insert into mysqltest_foo values(5); +create table mysqltest_bar (m int); +insert into mysqltest_bar values(15); +create table t1 (k int); +insert into t1 values(55); +select mysqltest_foo.n,mysqltest_bar.m,t1.k from mysqltest_foo,mysqltest_bar,t1; n m k 4 15 55 -drop table if exists foo,bar,choo; -drop table if exists foo,bar,choo; +drop table mysqltest_foo,mysqltest_bar,t1; +drop table mysqltest_foo,mysqltest_bar,t1; diff --git a/mysql-test/r/rpl000009.result b/mysql-test/r/rpl000009.result index 1a1ea309ae9..e67993b53f6 100644 --- a/mysql-test/r/rpl000009.result +++ b/mysql-test/r/rpl000009.result @@ -4,80 +4,78 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -drop database if exists foo; -create database foo; -drop database if exists bar; -create database bar; -drop table if exists foo.foo; -create table foo.foo (n int); -insert into foo.foo values(4); -drop table if exists foo.foo; -create table foo.foo (n int); -insert into foo.foo values(5); -drop table if exists bar.bar; -create table bar.bar (m int); -insert into bar.bar values(15); -select foo.foo.n,bar.bar.m from foo.foo,bar.bar; +drop database if exists mysqltest2; +create database mysqltest2; +drop database if exists mysqltest; +create database mysqltest; +create table mysqltest2.foo (n int); +insert into mysqltest2.foo values(4); +create table mysqltest2.foo (n int); +insert into mysqltest2.foo values(5); +create table mysqltest.bar (m int); +insert into mysqltest.bar values(15); +select mysqltest2.foo.n,mysqltest.bar.m from mysqltest2.foo,mysqltest.bar; n m 4 15 -drop database if exists bar; -drop database if exists foo; -drop database if exists bar; -drop database if exists foo; +drop database mysqltest; +drop database mysqltest2; set sql_log_bin = 0; -create database foo; -create database bar; +create database mysqltest2; +create database mysqltest; show databases; Database -bar -foo mysql +mysqltest +mysqltest2 test -create table foo.t1(n int, s char(20)); -create table foo.t2(n int, s text); -insert into foo.t1 values (1, 'one'), (2, 'two'), (3, 'three'); -insert into foo.t2 values (11, 'eleven'), (12, 'twelve'), (13, 'thirteen'); -create table bar.t1(n int, s char(20)); -create table bar.t2(n int, s text); -insert into bar.t1 values (1, 'one bar'), (2, 'two bar'), (3, 'three bar'); -insert into bar.t2 values (11, 'eleven bar'), (12, 'twelve bar'), -(13, 'thirteen bar'); +create table mysqltest2.t1(n int, s char(20)); +create table mysqltest2.t2(n int, s text); +insert into mysqltest2.t1 values (1, 'one'), (2, 'two'), (3, 'three'); +insert into mysqltest2.t2 values (11, 'eleven'), (12, 'twelve'), (13, 'thirteen'); +create table mysqltest.t1(n int, s char(20)); +create table mysqltest.t2(n int, s text); +insert into mysqltest.t1 values (1, 'one test'), (2, 'two test'), (3, 'three test'); +insert into mysqltest.t2 values (11, 'eleven test'), (12, 'twelve test'), +(13, 'thirteen test'); set sql_log_bin = 1; show databases; Database mysql test load data from master; +Warnings: +Note 1008 Can't drop database 'mysqltest'. Database doesn't exist +Note 1008 Can't drop database 'mysqltest2'. Database doesn't exist show databases; Database -bar -foo mysql +mysqltest +mysqltest2 test -use foo; +use mysqltest2; show tables; -Tables_in_foo -use bar; +Tables_in_mysqltest2 +use mysqltest; show tables; -Tables_in_bar +Tables_in_mysqltest t1 t2 -select * from bar.t1; +select * from mysqltest.t1; n s -1 one bar -2 two bar -3 three bar -select * from bar.t2; +1 one test +2 two test +3 three test +select * from mysqltest.t2; n s -11 eleven bar -12 twelve bar -13 thirteen bar -insert into bar.t1 values (4, 'four bar'); -select * from bar.t1; +11 eleven test +12 twelve test +13 thirteen test +insert into mysqltest.t1 values (4, 'four test'); +select * from mysqltest.t1; n s -1 one bar -2 two bar -3 three bar -4 four bar -drop database bar; -drop database foo; +1 one test +2 two test +3 three test +4 four test +drop database mysqltest; +drop database mysqltest2; diff --git a/mysql-test/r/rpl000010.result b/mysql-test/r/rpl000010.result index 6b6b89d1547..65191ea411f 100644 --- a/mysql-test/r/rpl000010.result +++ b/mysql-test/r/rpl000010.result @@ -4,8 +4,6 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -drop table if exists t1; -drop table if exists t1; create table t1 (n int not null auto_increment primary key); insert into t1 values(NULL); insert into t1 values(2); diff --git a/mysql-test/r/rpl000011.result b/mysql-test/r/rpl000011.result index bb017076822..dd0fa2fbe74 100644 --- a/mysql-test/r/rpl000011.result +++ b/mysql-test/r/rpl000011.result @@ -4,7 +4,6 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -drop table if exists t1; create table t1 (n int); insert into t1 values(1); stop slave; diff --git a/mysql-test/r/rpl000012.result b/mysql-test/r/rpl000012.result index f809fa7fe74..17fb53010ab 100644 --- a/mysql-test/r/rpl000012.result +++ b/mysql-test/r/rpl000012.result @@ -4,18 +4,16 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -drop table if exists t1,t2,t3; create table t2 (n int); create temporary table t1 (n int); insert into t1 values(1),(2),(3); insert into t2 select * from t1; -drop table if exists test.t3; -create temporary table test.t3 (n int not null); -alter table test.t3 add primary key(n); +create temporary table t3 (n int not null); +alter table t3 add primary key(n); flush logs; insert into t3 values (100); insert into t2 select * from t3; -drop table if exists test.t3; +drop table if exists t3; insert into t2 values (101); create temporary table t1 (n int); insert into t1 values (4),(5); @@ -35,3 +33,5 @@ show status like 'Slave_open_temp_tables'; Variable_name Value Slave_open_temp_tables 0 drop table if exists t1,t2; +Warnings: +Note 1051 Unknown table 't1' diff --git a/mysql-test/r/rpl000013.result b/mysql-test/r/rpl000013.result index 333d769baff..37838bb88e0 100644 --- a/mysql-test/r/rpl000013.result +++ b/mysql-test/r/rpl000013.result @@ -4,7 +4,6 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -drop table if exists t2; create table t2(n int); create temporary table t1 (n int); insert into t1 values(1),(2),(3); @@ -25,3 +24,5 @@ show status like 'Slave_open_temp_tables'; Variable_name Value Slave_open_temp_tables 0 drop table if exists t1,t2; +Warnings: +Note 1051 Unknown table 't1' diff --git a/mysql-test/r/rpl_alter.result b/mysql-test/r/rpl_alter.result index 0b947c0bb70..e7abc3b3b48 100644 --- a/mysql-test/r/rpl_alter.result +++ b/mysql-test/r/rpl_alter.result @@ -4,18 +4,18 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -drop database if exists d1; -create database d1; -create table d1.t1 ( n int); -alter table d1.t1 add m int; -insert into d1.t1 values (1,2); -create table d1.t2 (n int); -insert into d1.t2 values (45); -rename table d1.t2 to d1.t3, d1.t1 to d1.t2; -select * from d1.t2; +drop database if exists test_$1; +create database test_$1; +create table test_$1.t1 ( n int); +alter table test_$1.t1 add m int; +insert into test_$1.t1 values (1,2); +create table test_$1.t2 (n int); +insert into test_$1.t2 values (45); +rename table test_$1.t2 to test_$1.t3, test_$1.t1 to test_$1.t2; +select * from test_$1.t2; n m 1 2 -select * from d1.t3; +select * from test_$1.t3; n 45 -drop database d1; +drop database test_$1; diff --git a/mysql-test/r/rpl_empty_master_crash.result b/mysql-test/r/rpl_empty_master_crash.result index 267806feb2e..8818029ab99 100644 --- a/mysql-test/r/rpl_empty_master_crash.result +++ b/mysql-test/r/rpl_empty_master_crash.result @@ -4,7 +4,6 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -drop table if exists t1; show slave status; Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space load table t1 from master; diff --git a/mysql-test/r/rpl_failsafe.result b/mysql-test/r/rpl_failsafe.result index d122b13adc2..956555f9318 100644 --- a/mysql-test/r/rpl_failsafe.result +++ b/mysql-test/r/rpl_failsafe.result @@ -1,4 +1,5 @@ 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; diff --git a/mysql-test/r/rpl_log_pos.result b/mysql-test/r/rpl_log_pos.result index b4dc132e046..fa38e42ae73 100644 --- a/mysql-test/r/rpl_log_pos.result +++ b/mysql-test/r/rpl_log_pos.result @@ -10,7 +10,9 @@ master-bin.000001 79 show slave status; Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space 127.0.0.1 root MASTER_PORT 1 master-bin.000001 79 slave-relay-bin.000002 123 master-bin.000001 Yes Yes 0 0 79 127 +stop slave; change master to master_log_pos=73; +start slave; stop slave; change master to master_log_pos=73; show slave status; @@ -20,6 +22,7 @@ start slave; show slave status; Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space 127.0.0.1 root MASTER_PORT 1 master-bin.000001 73 slave-relay-bin.000001 4 master-bin.000001 No Yes 0 0 73 4 +stop slave; change master to master_log_pos=173; start slave; show slave status; @@ -32,6 +35,7 @@ create table if not exists t1 (n int); drop table if exists t1; create table t1 (n int); insert into t1 values (1),(2),(3); +stop slave; change master to master_log_pos=79; start slave; select * from t1; diff --git a/mysql-test/r/rpl_redirect.result b/mysql-test/r/rpl_redirect.result index 66c94a00b5f..3807479fb54 100644 --- a/mysql-test/r/rpl_redirect.result +++ b/mysql-test/r/rpl_redirect.result @@ -9,7 +9,6 @@ Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Lo SHOW SLAVE HOSTS; Server_id Host Port Rpl_recovery_rank Master_id 2 127.0.0.1 SLAVE_PORT 2 1 -drop table if exists t1; create table t1 ( n int); insert into t1 values (1),(2),(3),(4); insert into t1 values(5); diff --git a/mysql-test/r/rpl_replicate_do.result b/mysql-test/r/rpl_replicate_do.result index aabda54640c..9ae292c2709 100644 --- a/mysql-test/r/rpl_replicate_do.result +++ b/mysql-test/r/rpl_replicate_do.result @@ -25,4 +25,4 @@ n 4 select * from t11; Table 'test.t11' doesn't exist -drop table if exists t1,t2,t3,t11; +drop table if exists t1,t2,t11; diff --git a/mysql-test/r/rpl_rotate_logs.result b/mysql-test/r/rpl_rotate_logs.result index 2582b875daa..5275ef26b5c 100644 --- a/mysql-test/r/rpl_rotate_logs.result +++ b/mysql-test/r/rpl_rotate_logs.result @@ -22,7 +22,6 @@ s Could not break slave Tried hard flush logs; -drop table if exists t2; create table t2(m int not null auto_increment primary key); insert into t2 values (34),(67),(123); flush logs; @@ -58,7 +57,6 @@ m 1234 create temporary table temp_table (a char(80) not null); insert into temp_table values ("testing temporary tables part 2"); -drop table if exists t3; create table t3 (n int); create table t4 select * from temp_table; show binary logs; diff --git a/mysql-test/r/rpl_skip_error.result b/mysql-test/r/rpl_skip_error.result index 91aae09001f..e52426c381c 100644 --- a/mysql-test/r/rpl_skip_error.result +++ b/mysql-test/r/rpl_skip_error.result @@ -4,7 +4,6 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -drop table if exists t1; create table t1 (n int not null primary key); insert into t1 values (1); insert into t1 values (1); diff --git a/mysql-test/r/rpl_temporary.result b/mysql-test/r/rpl_temporary.result new file mode 100644 index 00000000000..470a6302a2b --- /dev/null +++ b/mysql-test/r/rpl_temporary.result @@ -0,0 +1,73 @@ +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; +drop table if exists t1,t2; +create table t1(f int); +create table t2(f int); +insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); +create temporary table t3(f int); +insert into t3 select * from t1 where f<6; +create temporary table t3(f int); +insert into t2 select count(*) from t3; +insert into t3 select * from t1 where f>=4; +drop temporary table t3; +insert into t2 select count(*) from t3; +drop temporary table t3; +select * from t2; +f +5 +7 +show binlog events; +Log_name Pos Event_type Server_id Orig_log_pos Info +master-bin.000001 4 Start 1 4 Server ver: 4.1.0-alpha-debug-log, Binlog ver: 3 +master-bin.000001 79 Query 1 79 use `test`; create table t1(f int) +master-bin.000001 136 Query 1 136 use `test`; create table t2(f int) +master-bin.000001 193 Query 1 193 use `test`; insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10) +master-bin.000001 290 Query 1 290 use `test`; create temporary table t3(f int) +master-bin.000001 357 Query 1 357 use `test`; insert into t3 select * from t1 where f<6 +master-bin.000001 433 Query 1 433 use `test`; create temporary table t3(f int) +master-bin.000001 500 Query 1 500 use `test`; insert into t2 select count(*) from t3 +master-bin.000001 573 Query 1 573 use `test`; insert into t3 select * from t1 where f>=4 +master-bin.000001 650 Query 1 650 use `test`; drop temporary table t3 +master-bin.000001 708 Query 1 708 use `test`; insert into t2 select count(*) from t3 +master-bin.000001 781 Query 1 781 use `test`; drop temporary table t3 +drop table t1, t2; +use test; +SET TIMESTAMP=1040323920; +create table t1(f int); +SET TIMESTAMP=1040323931; +create table t2(f int); +SET TIMESTAMP=1040323938; +insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); +SET TIMESTAMP=1040323945; +SET @@session.pseudo_thread_id=1; +create temporary table t3(f int); +SET TIMESTAMP=1040323952; +SET @@session.pseudo_thread_id=1; +insert into t3 select * from t1 where f<6; +SET TIMESTAMP=1040324145; +SET @@session.pseudo_thread_id=2; +create temporary table t3(f int); +SET TIMESTAMP=1040324186; +SET @@session.pseudo_thread_id=1; +insert into t2 select count(*) from t3; +SET TIMESTAMP=1040324200; +SET @@session.pseudo_thread_id=2; +insert into t3 select * from t1 where f>=4; +SET TIMESTAMP=1040324211; +SET @@session.pseudo_thread_id=1; +drop temporary table t3; +SET TIMESTAMP=1040324219; +SET @@session.pseudo_thread_id=2; +insert into t2 select count(*) from t3; +SET TIMESTAMP=1040324224; +SET @@session.pseudo_thread_id=2; +drop temporary table t3; +select * from t2; +f +5 +7 +drop table t1,t2; diff --git a/mysql-test/r/sel000001.result b/mysql-test/r/sel000001.result deleted file mode 100644 index 28f6d3d1d5a..00000000000 --- a/mysql-test/r/sel000001.result +++ /dev/null @@ -1,7 +0,0 @@ -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (s CHAR(20) PRIMARY KEY, id INT); -INSERT INTO t1 VALUES ('cat', 1), ('mouse', 3), ('dog', 2), ('snake', 77); -SELECT s, id FROM t1 WHERE s = 'mouse'; -s id -mouse 3 -drop table t1; diff --git a/mysql-test/r/sel000002.result b/mysql-test/r/sel000002.result deleted file mode 100644 index b824de8de4a..00000000000 --- a/mysql-test/r/sel000002.result +++ /dev/null @@ -1,9 +0,0 @@ -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (n INT); -INSERT INTO t1 VALUES (1), (2), (3); -SELECT * FROM t1; -n -1 -2 -3 -drop table t1; diff --git a/mysql-test/r/sel000003.result b/mysql-test/r/sel000003.result deleted file mode 100644 index c3853832f87..00000000000 --- a/mysql-test/r/sel000003.result +++ /dev/null @@ -1,8 +0,0 @@ -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (name CHAR(20) NOT NULL PRIMARY KEY, score SMALLINT NOT NULL, KEY(score)); -INSERT INTO t1 VALUES ('Sasha', 20), ('Matt', 20), ('Monty', 10), ('David', 10), ('Tim', 10), ('Jeremy', 10); -SELECT COUNT(*) as n, score FROM t1 GROUP BY score; -n score -4 10 -2 20 -drop table t1; diff --git a/mysql-test/r/sel000031.result b/mysql-test/r/sel000031.result deleted file mode 100644 index d3f01ab687f..00000000000 --- a/mysql-test/r/sel000031.result +++ /dev/null @@ -1,12 +0,0 @@ -drop table if exists t1,t2; -create table t1 (id int(10) not null unique); -create table t2 (id int(10) not null primary key, -val int(10) not null); -insert into t1 values (1),(2),(4); -insert into t2 values (1,1),(2,1),(3,1),(4,2); -select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id order by one.id; -id elt(two.val,'one','two') -1 one -2 one -4 two -drop table t1,t2; diff --git a/mysql-test/r/sel000032.result b/mysql-test/r/sel000032.result deleted file mode 100644 index 4cca245d75b..00000000000 --- a/mysql-test/r/sel000032.result +++ /dev/null @@ -1,12 +0,0 @@ -drop table if exists t1,t2; -create table t1 (id int(10) not null unique); -create table t2 (id int(10) not null primary key, -val int(10) not null); -insert into t1 values (1),(2),(4); -insert into t2 values (1,1),(2,1),(3,1),(4,2); -select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id; -id elt(two.val,'one','two') -1 one -2 one -4 two -drop table t1,t2; diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 80aa6046e8d..9ed54f7c253 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -1,4 +1,3 @@ -use test; drop table if exists t1,t2,t3,t4; CREATE TABLE t1 ( Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL, @@ -2493,7 +2492,6 @@ fld1 fld3 period price price2 018601 vacuuming 1001 5987435 234724 018801 inch 1001 5987435 234724 018811 repetitions 1001 5987435 234724 -drop table if exists company; create table t4 ( companynr tinyint(2) unsigned zerofill NOT NULL default '00', companyname char(30) NOT NULL default '', @@ -3219,23 +3217,23 @@ Tables_in_test (s%) show tables from test like "t?"; Tables_in_test (t?) show full columns from t2; -Field Type Null Key Default Extra Privileges Comment -auto int(11) PRI NULL auto_increment select,insert,update,references -fld1 int(6) unsigned zerofill UNI 000000 select,insert,update,references -companynr tinyint(2) unsigned zerofill 00 select,insert,update,references -fld3 char(30) character set latin1 MUL select,insert,update,references -fld4 char(35) character set latin1 select,insert,update,references -fld5 char(35) character set latin1 select,insert,update,references -fld6 char(4) character set latin1 select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +auto int(11) binary PRI NULL auto_increment select,insert,update,references +fld1 int(6) unsigned zerofill binary UNI 000000 select,insert,update,references +companynr tinyint(2) unsigned zerofill binary 00 select,insert,update,references +fld3 char(30) latin1 MUL select,insert,update,references +fld4 char(35) latin1 select,insert,update,references +fld5 char(35) latin1 select,insert,update,references +fld6 char(4) latin1 select,insert,update,references show full columns from t2 from test like 'f%'; -Field Type Null Key Default Extra Privileges Comment -fld1 int(6) unsigned zerofill UNI 000000 select,insert,update,references -fld3 char(30) character set latin1 MUL select,insert,update,references -fld4 char(35) character set latin1 select,insert,update,references -fld5 char(35) character set latin1 select,insert,update,references -fld6 char(4) character set latin1 select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +fld1 int(6) unsigned zerofill binary UNI 000000 select,insert,update,references +fld3 char(30) latin1 MUL select,insert,update,references +fld4 char(35) latin1 select,insert,update,references +fld5 char(35) latin1 select,insert,update,references +fld6 char(4) latin1 select,insert,update,references show full columns from t2 from test like 's%'; -Field Type Null Key Default Extra Privileges Comment +Field Type Collation Null Key Default Extra Privileges Comment show keys from t2; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t2 0 PRIMARY 1 auto A 1199 NULL NULL BTREE @@ -3478,7 +3476,6 @@ a a a 2 2 2 3 3 3 drop table t1; -drop table if exists t1,t2; CREATE TABLE t1 ( aa char(2), id int(11) NOT NULL auto_increment, t2_id int(11) NOT NULL default '0', PRIMARY KEY (id), KEY replace_id (t2_id)) TYPE=MyISAM; INSERT INTO t1 VALUES ("1",8264,2506),("2",8299,2517),("3",8301,2518),("4",8302,2519),("5",8303,2520),("6",8304,2521),("7",8305,2522); CREATE TABLE t2 ( id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) TYPE=MyISAM; @@ -3490,4 +3487,4 @@ aa id t2_id id 4 8302 2519 2519 5 8303 2520 2520 6 8304 2521 2521 -drop table if exists t1,t2; +drop table t1,t2; diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index 2e8d7d19465..d2bdc4f9401 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -93,15 +93,15 @@ c int not null comment 'int column' show create table t1 ; Table Create Table t1 CREATE TABLE `t1` ( - `test_set` set('val1','val2','val3') character set latin1 NOT NULL default '', - `name` char(20) character set latin1 default 'O''Brien' COMMENT 'O''Brien as default', + `test_set` set('val1','val2','val3') NOT NULL default '', + `name` char(20) default 'O''Brien' COMMENT 'O''Brien as default', `c` int(11) NOT NULL default '0' COMMENT 'int column' ) TYPE=MyISAM CHARSET=latin1 COMMENT='it''s a table' show full columns from t1; -Field Type Null Key Default Extra Privileges Comment -test_set set('val1','val2','val3') character set latin1 select,insert,update,references -name char(20) character set latin1 YES O'Brien select,insert,update,references O'Brien as default -c int(11) 0 select,insert,update,references int column +Field Type Collation Null Key Default Extra Privileges Comment +test_set set('val1','val2','val3') latin1 select,insert,update,references +name char(20) latin1 YES O'Brien select,insert,update,references O'Brien as default +c int(11) binary 0 select,insert,update,references int column drop table t1; create table t1 (a int not null, unique aa (a)); show create table t1; @@ -133,7 +133,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL default '0', - `b` char(10) character set latin1 default NULL, + `b` char(10) default NULL, KEY `b` (`b`) ) TYPE=MyISAM CHARSET=latin1 MIN_ROWS=10 MAX_ROWS=100 AVG_ROW_LENGTH=10 PACK_KEYS=1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED COMMENT='test' alter table t1 MAX_ROWS=200 ROW_FORMAT=dynamic PACK_KEYS=0; @@ -141,7 +141,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL default '0', - `b` varchar(10) character set latin1 default NULL, + `b` varchar(10) default NULL, KEY `b` (`b`) ) TYPE=MyISAM CHARSET=latin1 MIN_ROWS=10 MAX_ROWS=200 AVG_ROW_LENGTH=10 PACK_KEYS=0 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC COMMENT='test' ALTER TABLE t1 AVG_ROW_LENGTH=0 CHECKSUM=0 COMMENT="" MIN_ROWS=0 MAX_ROWS=0 PACK_KEYS=DEFAULT DELAY_KEY_WRITE=0 ROW_FORMAT=default; @@ -149,40 +149,40 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL default '0', - `b` varchar(10) character set latin1 default NULL, + `b` varchar(10) default NULL, KEY `b` (`b`) ) TYPE=MyISAM CHARSET=latin1 drop table t1; create table t1 (a decimal(9,2), b decimal (9,0), e double(9,2), f double(5,0), h float(3,2), i float(3,0)); show columns from t1; -Field Type Null Key Default Extra -a decimal(9,2) YES NULL -b decimal(9,0) YES NULL -e double(9,2) YES NULL -f double(5,0) YES NULL -h float(3,2) YES NULL -i float(3,0) YES NULL +Field Type Collation Null Key Default Extra +a decimal(9,2) binary YES NULL +b decimal(9,0) binary YES NULL +e double(9,2) binary YES NULL +f double(5,0) binary YES NULL +h float(3,2) binary YES NULL +i float(3,0) binary YES NULL show full columns from t1; -Field Type Null Key Default Extra Privileges Comment -a decimal(9,2) YES NULL select,insert,update,references -b decimal(9,0) YES NULL select,insert,update,references -e double(9,2) YES NULL select,insert,update,references -f double(5,0) YES NULL select,insert,update,references -h float(3,2) YES NULL select,insert,update,references -i float(3,0) YES NULL select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +a decimal(9,2) binary YES NULL select,insert,update,references +b decimal(9,0) binary YES NULL select,insert,update,references +e double(9,2) binary YES NULL select,insert,update,references +f double(5,0) binary YES NULL select,insert,update,references +h float(3,2) binary YES NULL select,insert,update,references +i float(3,0) binary YES NULL select,insert,update,references drop table t1; create table t1 (c decimal, d double, f float, r real); show columns from t1; -Field Type Null Key Default Extra -c decimal(10,0) YES NULL -d double YES NULL -f float YES NULL -r double YES NULL +Field Type Collation Null Key Default Extra +c decimal(10,0) binary YES NULL +d double binary YES NULL +f float binary YES NULL +r double binary YES NULL drop table t1; create table t1 (c decimal(3,3), d double(3,3), f float(3,3)); show columns from t1; -Field Type Null Key Default Extra -c decimal(4,3) YES NULL -d double(4,3) YES NULL -f float(4,3) YES NULL +Field Type Collation Null Key Default Extra +c decimal(4,3) binary YES NULL +d double(4,3) binary YES NULL +f float(4,3) binary YES NULL drop table t1; diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 493768ece4a..04bf0575db3 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -1,13 +1,33 @@ +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t11,t12; select (select 2); (select 2) 2 +explain select (select 2); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1247 Select 2 was reduced during optimisation SELECT (SELECT 1) UNION SELECT (SELECT 2); (SELECT 1) 1 2 +explain SELECT (SELECT 1) UNION SELECT (SELECT 2); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1247 Select 2 was reduced during optimisation +Note 1247 Select 4 was reduced during optimisation SELECT (SELECT (SELECT 0 UNION SELECT 0)); (SELECT (SELECT 0 UNION SELECT 0)) 0 +explain SELECT (SELECT (SELECT 0 UNION SELECT 0)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used +3 SUBSELECT NULL NULL NULL NULL NULL NULL NULL No tables used +4 UNION NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1247 Select 2 was reduced during optimisation SELECT (SELECT 1 FROM (SELECT 1) as b HAVING a=1) as a; Reference 'a' not supported (forward reference in item list) SELECT (SELECT 1 FROM (SELECT 1) as b HAVING b=1) as a,(SELECT 1 FROM (SELECT 1) as c HAVING a=1) as b; @@ -32,7 +52,7 @@ a 1 SELECT 1 FROM (SELECT (SELECT a) b) c; Unknown column 'a' in 'field list' -SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id LIMIT 1); +SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id); id 1 SELECT * FROM (SELECT 1) a WHERE 1 IN (SELECT 1,1); @@ -52,7 +72,54 @@ a SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL; a 1 -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8; +SELECT (SELECT 1,2,3) = ROW(1,2,3); +(SELECT 1,2,3) = ROW(1,2,3) +1 +SELECT (SELECT 1,2,3) = ROW(1,2,1); +(SELECT 1,2,3) = ROW(1,2,1) +0 +SELECT (SELECT 1,2,3) < ROW(1,2,1); +(SELECT 1,2,3) < ROW(1,2,1) +0 +SELECT (SELECT 1,2,3) > ROW(1,2,1); +(SELECT 1,2,3) > ROW(1,2,1) +1 +SELECT (SELECT 1,2,3) = ROW(1,2,NULL); +(SELECT 1,2,3) = ROW(1,2,NULL) +NULL +SELECT ROW(1,2,3) = (SELECT 1,2,3); +ROW(1,2,3) = (SELECT 1,2,3) +1 +SELECT ROW(1,2,3) = (SELECT 1,2,1); +ROW(1,2,3) = (SELECT 1,2,1) +0 +SELECT ROW(1,2,3) < (SELECT 1,2,1); +ROW(1,2,3) < (SELECT 1,2,1) +0 +SELECT ROW(1,2,3) > (SELECT 1,2,1); +ROW(1,2,3) > (SELECT 1,2,1) +1 +SELECT ROW(1,2,3) = (SELECT 1,2,NULL); +ROW(1,2,3) = (SELECT 1,2,NULL) +NULL +SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a'); +(SELECT 1.5,2,'a') = ROW(1.5,2,'a') +1 +SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b'); +(SELECT 1.5,2,'a') = ROW(1.5,2,'b') +0 +SELECT (SELECT 1.5,2,'a') = ROW('b',2,'b'); +(SELECT 1.5,2,'a') = ROW('b',2,'b') +0 +SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a'); +(SELECT 'b',2,'a') = ROW(1.5,2,'a') +0 +SELECT (SELECT 1.5,2,'a') = ROW(1.5,'c','a'); +(SELECT 1.5,2,'a') = ROW(1.5,'c','a') +0 +SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a'); +(SELECT 1.5,'c','a') = ROW(1.5,2,'a') +0 create table t1 (a int); create table t2 (a int, b int); create table t3 (a int); @@ -86,20 +153,20 @@ select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1); a b 1 7 2 7 -select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1) +(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 order by a limit 2) limit 3; a b 1 7 2 7 3 8 -select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1) +(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a); a b 1 7 2 7 3 8 4 8 -explain select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1) +explain (select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where @@ -243,7 +310,6 @@ W 1 SELECT * FROM t3 WHERE b = (SELECT MIN(b) FROM t3); a b W a -drop table if exists t8; CREATE TABLE `t8` ( `pseudo` varchar(35) character set latin1 NOT NULL default '', `email` varchar(60) character set latin1 NOT NULL default '', @@ -453,7 +519,6 @@ a b 0 10 1 11 drop table t1, t2; -drop table if exists t11, t12, t2; create table t11 (a int NOT NULL, b int, primary key (a)); create table t12 (a int NOT NULL, b int, primary key (a)); create table t2 (a int NOT NULL, b int, primary key (a)); @@ -559,7 +624,6 @@ x y drop table t1, t2, t3; SELECT * FROM (SELECT 1) b WHERE 1 IN (SELECT *); No tables used -drop table if exists t; CREATE TABLE t (id int(11) default NULL, KEY id (id)) TYPE=MyISAM CHARSET=latin1; INSERT INTO t VALUES (1),(2); SELECT * FROM t WHERE id IN (SELECT 1); @@ -581,12 +645,13 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t ref id id 5 const 1 Using where; Using index 3 SUBSELECT NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: +Note 1247 Select 3 was reduced during optimisation Note 1247 Select 2 was reduced during optimisation EXPLAIN SELECT * FROM t WHERE id IN (SELECT 1 UNION SELECT 3); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t index NULL id 5 NULL 2 Using where; Using index 2 DEPENDENT SUBSELECT NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used +3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used SELECT * FROM t WHERE id IN (SELECT 5 UNION SELECT 3); id SELECT * FROM t WHERE id IN (SELECT 5 UNION SELECT 2); @@ -602,7 +667,7 @@ CREATE TABLE t1 (id int(11) default NULL, KEY id (id)) TYPE=MyISAM CHARSET=latin INSERT INTO t1 values (1),(1); UPDATE t SET id=(SELECT * FROM t1); Subselect returns more than 1 record -drop table t; +drop table t, t1; create table t (a int); insert into t values (1),(2),(3); select 1 IN (SELECT * from t); @@ -704,4 +769,88 @@ NULL select 10.5 > ANY (SELECT * from t); 10.5 > ANY (SELECT * from t) 1 +explain select (select a+1) from t; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t ALL NULL NULL NULL NULL 3 +Warnings: +Note 1247 Select 2 was reduced during optimisation +select (select a+1) from t; +(select a+1) +2.5 +NULL +4.5 +drop table t; +create table t (a float); +select 10.5 IN (SELECT * from t LIMIT 1); +This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' +select 10.5 IN (SELECT * from t LIMIT 1 UNION SELECT 1.5); +This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' drop table t; +create table t1 (a int, b int, c varchar(10)); +create table t2 (a int); +insert into t1 values (1,2,'a'),(2,3,'b'),(3,4,'c'); +insert into t2 values (1),(2),(NULL); +select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a'),(select c from t1 where a=t2.a) from t2; +a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a') (select c from t1 where a=t2.a) +1 1 a +2 0 b +NULL NULL NULL +select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b'),(select c from t1 where a=t2.a) from t2; +a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b') (select c from t1 where a=t2.a) +1 0 a +2 1 b +NULL NULL NULL +select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c'),(select c from t1 where a=t2.a) from t2; +a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c') (select c from t1 where a=t2.a) +1 0 a +2 0 b +NULL NULL NULL +drop table t1,t2; +create table t1 (a int, b real, c varchar(10)); +insert into t1 values (1, 1, 'a'), (2,2,'b'), (NULL, 2, 'b'); +select ROW(1, 1, 'a') IN (select a,b,c from t1); +ROW(1, 1, 'a') IN (select a,b,c from t1) +1 +select ROW(1, 2, 'a') IN (select a,b,c from t1); +ROW(1, 2, 'a') IN (select a,b,c from t1) +NULL +select ROW(1, 1, 'a') IN (select b,a,c from t1); +ROW(1, 1, 'a') IN (select b,a,c from t1) +1 +select ROW(1, 1, 'a') IN (select a,b,c from t1 where a is not null); +ROW(1, 1, 'a') IN (select a,b,c from t1 where a is not null) +1 +select ROW(1, 2, 'a') IN (select a,b,c from t1 where a is not null); +ROW(1, 2, 'a') IN (select a,b,c from t1 where a is not null) +0 +select ROW(1, 1, 'a') IN (select b,a,c from t1 where a is not null); +ROW(1, 1, 'a') IN (select b,a,c from t1 where a is not null) +1 +select ROW(1, 1, 'a') IN (select a,b,c from t1 where c='b' or c='a'); +ROW(1, 1, 'a') IN (select a,b,c from t1 where c='b' or c='a') +1 +select ROW(1, 2, 'a') IN (select a,b,c from t1 where c='b' or c='a'); +ROW(1, 2, 'a') IN (select a,b,c from t1 where c='b' or c='a') +NULL +select ROW(1, 1, 'a') IN (select b,a,c from t1 where c='b' or c='a'); +ROW(1, 1, 'a') IN (select b,a,c from t1 where c='b' or c='a') +1 +select ROW(1, 1, 'a') IN (select b,a,c from t1 limit 2); +This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' +drop table t1; +create table t1 (a int); +insert into t1 values (1); +do @a:=(SELECT a from t1); +select @a; +@a +1 +set @a:=2; +set @a:=(SELECT a from t1); +select @a; +@a +1 +drop table t1; +do (SELECT a from t1); +Table 'test.t1' doesn't exist +set @a:=(SELECT a from t1); +Table 'test.t1' doesn't exist diff --git a/mysql-test/r/temp_table.result b/mysql-test/r/temp_table.result index 7c8d10cf0a6..5568e5b25d8 100644 --- a/mysql-test/r/temp_table.result +++ b/mysql-test/r/temp_table.result @@ -48,7 +48,6 @@ c d e 3 b 2 drop table t1; drop table t1; -drop table if exists t1; CREATE TABLE t1 (pkCrash INTEGER PRIMARY KEY,strCrash VARCHAR(255)); INSERT INTO t1 ( pkCrash, strCrash ) VALUES ( 1, '1'); SELECT CONCAT_WS(pkCrash, strCrash) FROM t1; @@ -77,7 +76,6 @@ insert into t1 values (1),(1); alter table t1 add primary key (a); Duplicate entry '1' for key 1 drop table t1; -drop table if exists t1; CREATE TABLE t1 ( d datetime default NULL ) TYPE=MyISAM; diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result index ba8d4f770f6..ba8e01d6319 100644 --- a/mysql-test/r/type_blob.result +++ b/mysql-test/r/type_blob.result @@ -1,27 +1,27 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7; CREATE TABLE t1 (a blob, b text, c blob(250), d text(70000), e text(70000000)); show columns from t1; -Field Type Null Key Default Extra -a blob YES NULL -b text character set latin1 YES NULL -c blob YES NULL -d mediumtext character set latin1 YES NULL -e longtext character set latin1 YES NULL +Field Type Collation Null Key Default Extra +a blob binary YES NULL +b text latin1 YES NULL +c blob binary YES NULL +d mediumtext latin1 YES NULL +e longtext latin1 YES NULL CREATE TABLE t2 (a char(257), b varchar(70000) binary, c varchar(70000000)); Warnings: Warning 1244 Converting column 'a' from CHAR to TEXT Warning 1244 Converting column 'b' from CHAR to BLOB Warning 1244 Converting column 'c' from CHAR to TEXT show columns from t2; -Field Type Null Key Default Extra -a text character set latin1 YES NULL -b mediumblob YES NULL -c longtext character set latin1 YES NULL +Field Type Collation Null Key Default Extra +a text latin1 YES NULL +b mediumblob binary YES NULL +c longtext latin1 YES NULL create table t3 (a long, b long byte); show create TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( - `a` mediumtext character set latin1, + `a` mediumtext, `b` mediumblob ) TYPE=MyISAM CHARSET=latin1 drop table t1,t2,t3 @@ -69,18 +69,18 @@ insert into t1 values (NULL,NULL,NULL,NULL); update t1 set c="",b=null where c="1"; lock tables t1 READ; show full fields from t1; -Field Type Null Key Default Extra Privileges Comment -t text character set latin1 YES NULL select,insert,update,references -c varchar(10) character set latin1 YES NULL select,insert,update,references -b blob YES NULL select,insert,update,references -d varchar(10) binary YES NULL select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +t text latin1 YES NULL select,insert,update,references +c varchar(10) latin1 YES NULL select,insert,update,references +b blob binary YES NULL select,insert,update,references +d varchar(10) binary binary YES NULL select,insert,update,references lock tables t1 WRITE; show full fields from t1; -Field Type Null Key Default Extra Privileges Comment -t text character set latin1 YES NULL select,insert,update,references -c varchar(10) character set latin1 YES NULL select,insert,update,references -b blob YES NULL select,insert,update,references -d varchar(10) binary YES NULL select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +t text latin1 YES NULL select,insert,update,references +c varchar(10) latin1 YES NULL select,insert,update,references +b blob binary YES NULL select,insert,update,references +d varchar(10) binary binary YES NULL select,insert,update,references unlock tables; select t from t1 where t like "hello"; t diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result index 214328eab47..cf6533eef67 100644 --- a/mysql-test/r/type_date.result +++ b/mysql-test/r/type_date.result @@ -1,3 +1,4 @@ +drop table if exists t1,t2; create table t1 (a char(16), b date, c datetime); insert into t1 SET a='test 2000-01-01', b='2000-01-01', c='2000-01-01'; select * from t1 where c = '2000-01-01'; @@ -7,7 +8,6 @@ select * from t1 where b = '2000-01-01'; a b c test 2000-01-01 2000-01-01 2000-01-01 00:00:00 drop table t1; -drop table if exists t1,t2; CREATE TABLE t1 (name char(6),cdate date); INSERT INTO t1 VALUES ('name1','1998-01-01'); INSERT INTO t1 VALUES ('name2','1998-01-01'); diff --git a/mysql-test/r/type_enum.result b/mysql-test/r/type_enum.result index 51e11d259eb..c0f0be246c9 100644 --- a/mysql-test/r/type_enum.result +++ b/mysql-test/r/type_enum.result @@ -1626,13 +1626,13 @@ create table t1 (a enum (' ','a','b') not null); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` enum('','a','b') character set latin1 NOT NULL default '' + `a` enum('','a','b') NOT NULL default '' ) TYPE=MyISAM CHARSET=latin1 drop table t1; create table t1 (a enum (' ','a','b ') not null default 'b '); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` enum('','a','b') character set latin1 NOT NULL default 'b' + `a` enum('','a','b') NOT NULL default 'b' ) TYPE=MyISAM CHARSET=latin1 drop table t1; diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result index c6eca3abe8b..3914114d92c 100644 --- a/mysql-test/r/type_float.result +++ b/mysql-test/r/type_float.result @@ -1,3 +1,4 @@ +drop table if exists t1; SELECT 10,10.0,10.,.1e+2,100.0e-1; 10 10.0 10. .1e+2 100.0e-1 10 10.0 10 10 10 @@ -7,12 +8,11 @@ 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; 1e1 1.e1 1.0e1 1e+1 1.e+1 1.0e+1 1e-1 1.e-1 1.0e-1 10 10 10 10 10 10 0.1 0.1 0.1 -drop table if exists t1; create table t1 (f1 float(24),f2 float(52)); show full columns from t1; -Field Type Null Key Default Extra Privileges Comment -f1 float YES NULL select,insert,update,references -f2 double YES NULL select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +f1 float binary YES NULL select,insert,update,references +f2 double binary YES NULL select,insert,update,references 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); select * from t1; @@ -69,19 +69,19 @@ min(a) drop table t1; create table t1 (f float, f2 float(24), f3 float(6,2), d double, d2 float(53), d3 double(10,3), de decimal, de2 decimal(6), de3 decimal(5,2), n numeric, n2 numeric(8), n3 numeric(5,6)); show full columns from t1; -Field Type Null Key Default Extra Privileges Comment -f float YES NULL select,insert,update,references -f2 float YES NULL select,insert,update,references -f3 float(6,2) YES NULL select,insert,update,references -d double YES NULL select,insert,update,references -d2 double YES NULL select,insert,update,references -d3 double(10,3) YES NULL select,insert,update,references -de decimal(10,0) YES NULL select,insert,update,references -de2 decimal(6,0) YES NULL select,insert,update,references -de3 decimal(5,2) YES NULL select,insert,update,references -n decimal(10,0) YES NULL select,insert,update,references -n2 decimal(8,0) YES NULL select,insert,update,references -n3 decimal(7,6) YES NULL select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +f float binary YES NULL select,insert,update,references +f2 float binary YES NULL select,insert,update,references +f3 float(6,2) binary YES NULL select,insert,update,references +d double binary YES NULL select,insert,update,references +d2 double binary YES NULL select,insert,update,references +d3 double(10,3) binary YES NULL select,insert,update,references +de decimal(10,0) binary YES NULL select,insert,update,references +de2 decimal(6,0) binary YES NULL select,insert,update,references +de3 decimal(5,2) binary YES NULL select,insert,update,references +n decimal(10,0) binary YES NULL select,insert,update,references +n2 decimal(8,0) binary YES NULL select,insert,update,references +n3 decimal(7,6) binary YES NULL select,insert,update,references drop table t1; create table t1 (a decimal(7,3) not null, key (a)); insert into t1 values ("0"),("-0.00"),("-0.01"),("-0.002"),("1"); diff --git a/mysql-test/r/type_ranges.result b/mysql-test/r/type_ranges.result index ea2863aefce..19f1ac2b4d7 100644 --- a/mysql-test/r/type_ranges.result +++ b/mysql-test/r/type_ranges.result @@ -38,31 +38,31 @@ KEY (ulonglong,ulong), KEY (options,flags) ); show full fields from t1; -Field Type Null Key Default Extra Privileges Comment -auto int(5) unsigned PRI NULL auto_increment select,insert,update,references -string varchar(10) character set latin1 YES hello select,insert,update,references -tiny tinyint(4) MUL 0 select,insert,update,references -short smallint(6) MUL 1 select,insert,update,references -medium mediumint(8) MUL 0 select,insert,update,references -long_int int(11) 0 select,insert,update,references -longlong bigint(13) MUL 0 select,insert,update,references -real_float float(13,1) MUL 0.0 select,insert,update,references -real_double double(16,4) YES NULL select,insert,update,references -utiny tinyint(3) unsigned MUL 0 select,insert,update,references -ushort smallint(5) unsigned zerofill MUL 00000 select,insert,update,references -umedium mediumint(8) unsigned MUL 0 select,insert,update,references -ulong int(11) unsigned MUL 0 select,insert,update,references -ulonglong bigint(13) unsigned MUL 0 select,insert,update,references -time_stamp timestamp YES NULL select,insert,update,references -date_field date YES NULL select,insert,update,references -time_field time YES NULL select,insert,update,references -date_time datetime YES NULL select,insert,update,references -blob_col blob YES NULL select,insert,update,references -tinyblob_col tinyblob YES NULL select,insert,update,references -mediumblob_col mediumblob select,insert,update,references -longblob_col longblob select,insert,update,references -options enum('one','two','tree') character set latin1 MUL one select,insert,update,references -flags set('one','two','tree') character set latin1 select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +auto int(5) unsigned binary PRI NULL auto_increment select,insert,update,references +string varchar(10) latin1 YES hello select,insert,update,references +tiny tinyint(4) binary MUL 0 select,insert,update,references +short smallint(6) binary MUL 1 select,insert,update,references +medium mediumint(8) binary MUL 0 select,insert,update,references +long_int int(11) binary 0 select,insert,update,references +longlong bigint(13) binary MUL 0 select,insert,update,references +real_float float(13,1) binary MUL 0.0 select,insert,update,references +real_double double(16,4) binary YES NULL select,insert,update,references +utiny tinyint(3) unsigned binary MUL 0 select,insert,update,references +ushort smallint(5) unsigned zerofill binary MUL 00000 select,insert,update,references +umedium mediumint(8) unsigned binary MUL 0 select,insert,update,references +ulong int(11) unsigned binary MUL 0 select,insert,update,references +ulonglong bigint(13) unsigned binary MUL 0 select,insert,update,references +time_stamp timestamp latin1 YES NULL select,insert,update,references +date_field date latin1 YES NULL select,insert,update,references +time_field time latin1 YES NULL select,insert,update,references +date_time datetime latin1 YES NULL select,insert,update,references +blob_col blob binary YES NULL select,insert,update,references +tinyblob_col tinyblob binary YES NULL select,insert,update,references +mediumblob_col mediumblob binary select,insert,update,references +longblob_col longblob binary select,insert,update,references +options enum('one','two','tree') latin1 MUL one select,insert,update,references +flags set('one','two','tree') latin1 select,insert,update,references show keys from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t1 0 PRIMARY 1 auto A 0 NULL NULL BTREE @@ -168,57 +168,57 @@ drop table t2; create table t2 select * from t1; update t2 set string="changed" where auto=16; show full columns from t1; -Field Type Null Key Default Extra Privileges Comment -auto int(5) unsigned MUL NULL auto_increment select,insert,update,references -string varchar(10) character set latin1 YES new defaul select,insert,update,references -tiny tinyint(4) MUL 0 select,insert,update,references -short smallint(6) MUL 0 select,insert,update,references -medium mediumint(8) MUL 0 select,insert,update,references -long_int int(11) 0 select,insert,update,references -longlong bigint(13) MUL 0 select,insert,update,references -real_float float(13,1) MUL 0.0 select,insert,update,references -real_double double(16,4) YES NULL select,insert,update,references -utiny tinyint(3) unsigned 0 select,insert,update,references -ushort smallint(5) unsigned zerofill 00000 select,insert,update,references -umedium mediumint(8) unsigned MUL 0 select,insert,update,references -ulong int(11) unsigned MUL 0 select,insert,update,references -ulonglong bigint(13) unsigned MUL 0 select,insert,update,references -time_stamp timestamp YES NULL select,insert,update,references -date_field varchar(10) character set latin1 YES NULL select,insert,update,references -time_field time YES NULL select,insert,update,references -date_time datetime YES NULL select,insert,update,references -new_blob_col varchar(20) character set latin1 YES NULL select,insert,update,references -tinyblob_col tinyblob YES NULL select,insert,update,references -mediumblob_col mediumblob select,insert,update,references -options enum('one','two','tree') character set latin1 MUL one select,insert,update,references -flags set('one','two','tree') character set latin1 select,insert,update,references -new_field varchar(10) character set latin1 new select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +auto int(5) unsigned binary MUL NULL auto_increment select,insert,update,references +string varchar(10) latin1 YES new defaul select,insert,update,references +tiny tinyint(4) binary MUL 0 select,insert,update,references +short smallint(6) binary MUL 0 select,insert,update,references +medium mediumint(8) binary MUL 0 select,insert,update,references +long_int int(11) binary 0 select,insert,update,references +longlong bigint(13) binary MUL 0 select,insert,update,references +real_float float(13,1) binary MUL 0.0 select,insert,update,references +real_double double(16,4) binary YES NULL select,insert,update,references +utiny tinyint(3) unsigned binary 0 select,insert,update,references +ushort smallint(5) unsigned zerofill binary 00000 select,insert,update,references +umedium mediumint(8) unsigned binary MUL 0 select,insert,update,references +ulong int(11) unsigned binary MUL 0 select,insert,update,references +ulonglong bigint(13) unsigned binary MUL 0 select,insert,update,references +time_stamp timestamp latin1 YES NULL select,insert,update,references +date_field varchar(10) latin1 YES NULL select,insert,update,references +time_field time latin1 YES NULL select,insert,update,references +date_time datetime latin1 YES NULL select,insert,update,references +new_blob_col varchar(20) latin1 YES NULL select,insert,update,references +tinyblob_col tinyblob binary YES NULL select,insert,update,references +mediumblob_col mediumblob binary select,insert,update,references +options enum('one','two','tree') latin1 MUL one select,insert,update,references +flags set('one','two','tree') latin1 select,insert,update,references +new_field varchar(10) latin1 new select,insert,update,references show full columns from t2; -Field Type Null Key Default Extra Privileges Comment -auto int(5) unsigned 0 select,insert,update,references -string varchar(10) character set latin1 YES new defaul select,insert,update,references -tiny tinyint(4) 0 select,insert,update,references -short smallint(6) 0 select,insert,update,references -medium mediumint(8) 0 select,insert,update,references -long_int int(11) 0 select,insert,update,references -longlong bigint(13) 0 select,insert,update,references -real_float float(13,1) 0.0 select,insert,update,references -real_double double(16,4) YES NULL select,insert,update,references -utiny tinyint(3) unsigned 0 select,insert,update,references -ushort smallint(5) unsigned zerofill 00000 select,insert,update,references -umedium mediumint(8) unsigned 0 select,insert,update,references -ulong int(11) unsigned 0 select,insert,update,references -ulonglong bigint(13) unsigned 0 select,insert,update,references -time_stamp timestamp YES NULL select,insert,update,references -date_field varchar(10) character set latin1 YES NULL select,insert,update,references -time_field time YES NULL select,insert,update,references -date_time datetime YES NULL select,insert,update,references -new_blob_col varchar(20) character set latin1 YES NULL select,insert,update,references -tinyblob_col tinyblob YES NULL select,insert,update,references -mediumblob_col mediumblob select,insert,update,references -options enum('one','two','tree') character set latin1 one select,insert,update,references -flags set('one','two','tree') character set latin1 select,insert,update,references -new_field varchar(10) character set latin1 new select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +auto int(5) unsigned binary 0 select,insert,update,references +string varchar(10) latin1 YES new defaul select,insert,update,references +tiny tinyint(4) binary 0 select,insert,update,references +short smallint(6) binary 0 select,insert,update,references +medium mediumint(8) binary 0 select,insert,update,references +long_int int(11) binary 0 select,insert,update,references +longlong bigint(13) binary 0 select,insert,update,references +real_float float(13,1) binary 0.0 select,insert,update,references +real_double double(16,4) binary YES NULL select,insert,update,references +utiny tinyint(3) unsigned binary 0 select,insert,update,references +ushort smallint(5) unsigned zerofill binary 00000 select,insert,update,references +umedium mediumint(8) unsigned binary 0 select,insert,update,references +ulong int(11) unsigned binary 0 select,insert,update,references +ulonglong bigint(13) unsigned binary 0 select,insert,update,references +time_stamp timestamp latin1 YES NULL select,insert,update,references +date_field varchar(10) latin1 YES NULL select,insert,update,references +time_field time latin1 YES NULL select,insert,update,references +date_time datetime latin1 YES NULL select,insert,update,references +new_blob_col varchar(20) latin1 YES NULL select,insert,update,references +tinyblob_col tinyblob binary YES NULL select,insert,update,references +mediumblob_col mediumblob binary select,insert,update,references +options enum('one','two','tree') latin1 one select,insert,update,references +flags set('one','two','tree') latin1 select,insert,update,references +new_field varchar(10) latin1 new select,insert,update,references select t1.auto,t2.auto from t1,t2 where t1.auto=t2.auto and ((t1.string<>t2.string and (t1.string is not null or t2.string is not null)) or (t1.tiny<>t2.tiny and (t1.tiny is not null or t2.tiny is not null)) or (t1.short<>t2.short and (t1.short is not null or t2.short is not null)) or (t1.medium<>t2.medium and (t1.medium is not null or t2.medium is not null)) or (t1.long_int<>t2.long_int and (t1.long_int is not null or t2.long_int is not null)) or (t1.longlong<>t2.longlong and (t1.longlong is not null or t2.longlong is not null)) or (t1.real_float<>t2.real_float and (t1.real_float is not null or t2.real_float is not null)) or (t1.real_double<>t2.real_double and (t1.real_double is not null or t2.real_double is not null)) or (t1.utiny<>t2.utiny and (t1.utiny is not null or t2.utiny is not null)) or (t1.ushort<>t2.ushort and (t1.ushort is not null or t2.ushort is not null)) or (t1.umedium<>t2.umedium and (t1.umedium is not null or t2.umedium is not null)) or (t1.ulong<>t2.ulong and (t1.ulong is not null or t2.ulong is not null)) or (t1.ulonglong<>t2.ulonglong and (t1.ulonglong is not null or t2.ulonglong is not null)) or (t1.time_stamp<>t2.time_stamp and (t1.time_stamp is not null or t2.time_stamp is not null)) or (t1.date_field<>t2.date_field and (t1.date_field is not null or t2.date_field is not null)) or (t1.time_field<>t2.time_field and (t1.time_field is not null or t2.time_field is not null)) or (t1.date_time<>t2.date_time and (t1.date_time is not null or t2.date_time is not null)) or (t1.new_blob_col<>t2.new_blob_col and (t1.new_blob_col is not null or t2.new_blob_col is not null)) or (t1.tinyblob_col<>t2.tinyblob_col and (t1.tinyblob_col is not null or t2.tinyblob_col is not null)) or (t1.mediumblob_col<>t2.mediumblob_col and (t1.mediumblob_col is not null or t2.mediumblob_col is not null)) or (t1.options<>t2.options and (t1.options is not null or t2.options is not null)) or (t1.flags<>t2.flags and (t1.flags is not null or t2.flags is not null)) or (t1.new_field<>t2.new_field and (t1.new_field is not null or t2.new_field is not null))); auto auto 16 16 @@ -228,12 +228,12 @@ auto auto drop table t2; create table t2 (primary key (auto)) select auto+1 as auto,1 as t1, "a" as t2, repeat("a",256) as t3, binary repeat("b",256) as t4 from t1; show full columns from t2; -Field Type Null Key Default Extra Privileges Comment -auto bigint(17) unsigned PRI 0 select,insert,update,references -t1 bigint(1) 0 select,insert,update,references -t2 char(1) character set latin1 select,insert,update,references -t3 mediumtext character set latin1 select,insert,update,references -t4 mediumblob select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +auto bigint(17) unsigned binary PRI 0 select,insert,update,references +t1 bigint(1) binary 0 select,insert,update,references +t2 char(1) latin1 select,insert,update,references +t3 mediumtext latin1 select,insert,update,references +t4 mediumblob binary select,insert,update,references select * from t2; auto t1 t2 t3 t4 11 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb @@ -251,10 +251,10 @@ create table t3 select * from t1, t2; Duplicate column name 'c' create table t3 select t1.c AS c1, t2.c AS c2,1 as "const" from t1, t2; show full columns from t3; -Field Type Null Key Default Extra Privileges Comment -c1 int(11) YES NULL select,insert,update,references -c2 int(11) YES NULL select,insert,update,references -const bigint(1) 0 select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +c1 int(11) binary YES NULL select,insert,update,references +c2 int(11) binary YES NULL select,insert,update,references +const bigint(1) binary 0 select,insert,update,references drop table t1,t2,t3; create table t1 ( myfield INT NOT NULL, UNIQUE INDEX (myfield), unique (myfield), index(myfield)); drop table t1; diff --git a/mysql-test/r/type_set.result b/mysql-test/r/type_set.result index 256937c586a..b0ea1b69e59 100644 --- a/mysql-test/r/type_set.result +++ b/mysql-test/r/type_set.result @@ -3,13 +3,13 @@ create table t1 (a set (' ','a','b') not null); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` set('','a','b') character set latin1 NOT NULL default '' + `a` set('','a','b') NOT NULL default '' ) TYPE=MyISAM CHARSET=latin1 drop table t1; create table t1 (a set (' ','a','b ') not null default 'b '); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` set('','a','b') character set latin1 NOT NULL default 'b' + `a` set('','a','b') NOT NULL default 'b' ) TYPE=MyISAM CHARSET=latin1 drop table t1; diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index 3930e5e25c1..e546a8c8284 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -85,7 +85,7 @@ a b 2 b 1 a (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by t1.b; -Table 't1' from one of SELECT's can not be used in order clause +Table 't1' from one of SELECT's can not be used in global ORDER clause explain (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 4 @@ -170,7 +170,6 @@ testtt tsestset 1 drop table t1; -drop table if exists t1,t2; create table t1 (a int); create table t2 (a int); insert into t1 values (1),(2),(3),(4),(5); diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result index ba5c1c6e28f..159b971440b 100644 --- a/mysql-test/r/update.result +++ b/mysql-test/r/update.result @@ -1,4 +1,4 @@ -drop table if exists t1; +drop table if exists t1,t2; create table t1 (a int auto_increment , primary key (a)); insert into t1 values (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL); update t1 set a=a+10 where a > 34; @@ -106,9 +106,12 @@ create table t1 (a int not null, b int not null); insert into t1 values (1,1),(1,2),(1,3); update t1 set b=4 where a=1 order by b asc limit 1; update t1 set b=4 where a=1 order by b desc limit 1; +create table t2 (a int not null, b int not null); +insert into t2 values (1,1),(1,2),(1,3); select * from t1; a b 1 4 1 2 1 4 -drop table t1; +update t1 set b=(select distinct 1 from (select * from t2) a); +drop table t1,t2; diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result index 1b0b359c533..6e3b9309351 100644 --- a/mysql-test/r/user_var.result +++ b/mysql-test/r/user_var.result @@ -1,10 +1,10 @@ +drop table if exists t1,t2; set @a := foo; Unknown column 'foo' in 'field list' set @a := connection_id() + 3; select @a - connection_id(); @a - connection_id() 3 -drop table if exists t1,t2; CREATE TABLE t1 ( i int not null, v int not null,index (i)); insert into t1 values (1,1),(1,3),(2,1); create table t2 (i int not null, unique (i)); diff --git a/mysql-test/r/varbinary.result b/mysql-test/r/varbinary.result index 7ce0f78da76..2d04da31caa 100644 --- a/mysql-test/r/varbinary.result +++ b/mysql-test/r/varbinary.result @@ -1,3 +1,4 @@ +drop table if exists t1; select 0x41,0x41+0,0x41 | 0x7fffffffffffffff | 0,0xffffffffffffffff | 0 ; 0x41 0x41+0 0x41 | 0x7fffffffffffffff | 0 0xffffffffffffffff | 0 A 65 9223372036854775807 18446744073709551615 @@ -7,7 +8,6 @@ select 0x31+1,concat(0x31)+1,-0xf; select x'31',X'ffff'+0; x'31' X'ffff'+0 1 65535 -drop table if exists t1; create table t1 (ID int(8) unsigned zerofill not null auto_increment,UNIQ bigint(21) unsigned zerofill not null,primary key (ID),unique (UNIQ) ); insert into t1 set UNIQ=0x38afba1d73e6a18a; insert into t1 set UNIQ=123; diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index fbbf7fcb8f4..b66d75e2b3a 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -1,4 +1,4 @@ -drop table if exists t1; +drop table if exists t1,t2; set @`test`=1,@TEST=3,@select=2,@t5=1.23456; select @test,@`select`,@TEST,@not_used; @test @`select` @TEST @not_used @@ -48,6 +48,9 @@ set max_join_size=100; show variables like 'max_join_size'; Variable_name Value max_join_size 100 +show global variables like 'max_join_size'; +Variable_name Value +max_join_size HA_POS_ERROR set GLOBAL max_join_size=2000; show global variables like 'max_join_size'; Variable_name Value @@ -59,7 +62,7 @@ max_join_size 2000 set GLOBAL max_join_size=DEFAULT; show global variables like 'max_join_size'; Variable_name Value -max_join_size 18446744073709551615 +max_join_size HA_POS_ERROR set @@max_join_size=1000, @@global.max_join_size=2000; select @@local.max_join_size, @@global.max_join_size; @@session.max_join_size @@global.max_join_size @@ -312,7 +315,6 @@ set tmp_table_size=100; set tx_isolation="READ-COMMITTED"; set wait_timeout=100; set log_warnings=1; -DROP TABLE IF EXISTS t1,t2; create table t1 (a int not null auto_increment, primary key(a)); create table t2 (a int not null auto_increment, primary key(a)); insert into t1 values(null),(null),(null); diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result index e5713718db0..f2a105827da 100644 --- a/mysql-test/r/warnings.result +++ b/mysql-test/r/warnings.result @@ -1,4 +1,6 @@ drop table if exists t1; +Warnings: +Note 1051 Unknown table 't1' create table t1 (a int); insert into t1 values (1); insert into t1 values ("hej"); @@ -8,3 +10,23 @@ insert into t1 values ("hej"); insert into t1 values ("hej"),("då"); drop table t1; set SQL_WARNINGS=0; +drop temporary table if exists not_exists; +Warnings: +Note 1051 Unknown table 'not_exists' +drop table if exists not_exists_table; +Warnings: +Note 1051 Unknown table 'not_exists_table' +show warnings limit 1; +Level Code Message +Note 1051 Unknown table 'not_exists_table' +drop database if exists not_exists_db; +Warnings: +Note 1008 Can't drop database 'not_exists_db'. Database doesn't exist +show count(*) warnings; +@@session.warning_count +1 +create table t1(id int); +create table if not exists t1(id int); +select @@warning_count; +@@warning_count +0 diff --git a/mysql-test/t/alias.test b/mysql-test/t/alias.test index 5c6813d93aa..64dd481d37d 100644 --- a/mysql-test/t/alias.test +++ b/mysql-test/t/alias.test @@ -1,4 +1,7 @@ +--disable_warnings DROP TABLE IF EXISTS t1; +--enable_warnings + CREATE TABLE t1 ( cont_nr int(11) NOT NULL auto_increment, ver_nr int(11) NOT NULL default '0', diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test index 1c3987e2a31..64b657f1146 100644 --- a/mysql-test/t/alter_table.test +++ b/mysql-test/t/alter_table.test @@ -1,8 +1,10 @@ # # Test of alter table # - +--disable_warnings drop table if exists t1,t2; +--enable_warnings + create table t1 ( col1 int not null auto_increment primary key, col2 varchar(30) not null, diff --git a/mysql-test/t/analyse.test b/mysql-test/t/analyse.test index 68b038c089f..ccbfb56a801 100644 --- a/mysql-test/t/analyse.test +++ b/mysql-test/t/analyse.test @@ -2,7 +2,9 @@ # Test of procedure analyse # +--disable_warnings drop table if exists t1,t2; +--enable_warnings create table t1 (i int, j int); insert into t1 values (1,2), (3,4), (5,6), (7,8); select * from t1 procedure analyse(); @@ -10,4 +12,4 @@ create table t2 select * from t1 procedure analyse(); select * from t2; drop table t1,t2; -EXPLAIN SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE();
\ No newline at end of file +EXPLAIN SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(); diff --git a/mysql-test/t/auto_increment.test b/mysql-test/t/auto_increment.test index d86466572d8..30979202bd7 100644 --- a/mysql-test/t/auto_increment.test +++ b/mysql-test/t/auto_increment.test @@ -1,8 +1,10 @@ # # Test of auto_increment; The test for BDB tables is in bdb.test # - +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (a int not null auto_increment,b int, primary key (a)) type=myisam auto_increment=3; insert into t1 values (1,1),(NULL,3),(NULL,4); delete from t1 where a=4; diff --git a/mysql-test/t/backup.test b/mysql-test/t/backup.test index ad332cde646..8939d281eda 100644 --- a/mysql-test/t/backup.test +++ b/mysql-test/t/backup.test @@ -2,7 +2,9 @@ connect (con1,localhost,root,,); connect (con2,localhost,root,,); connection con1; set SQL_LOG_BIN=0; -drop table if exists t1; +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings create table t1(n int); --replace_result "errno = 2" "errno = X" "errno = 22" "errno = X" "errno = 23" "errno = X" backup table t1 to '../bogus'; diff --git a/mysql-test/t/bdb-alter-table-1.test b/mysql-test/t/bdb-alter-table-1.test index 5861c2fe0bf..7537cc358e8 100644 --- a/mysql-test/t/bdb-alter-table-1.test +++ b/mysql-test/t/bdb-alter-table-1.test @@ -2,7 +2,10 @@ # Test of problem when shutting down mysqld at once after ALTER TABLE # -- source include/have_bdb.inc +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1(objid BIGINT not null, tablename varchar(64), oid BIGINT not null, test BIGINT, PRIMARY KEY (objid), UNIQUE(tablename)) type=BDB; insert into t1 values(1, 't1',4,9); insert into t1 values(2, 'metatable',1,9); diff --git a/mysql-test/t/bdb-crash.test b/mysql-test/t/bdb-crash.test index 0005b631a46..956645b1188 100644 --- a/mysql-test/t/bdb-crash.test +++ b/mysql-test/t/bdb-crash.test @@ -2,7 +2,9 @@ # test for bug reported by Mark Steele +--disable_warnings drop table if exists t1; +--enable_warnings CREATE TABLE t1 ( ChargeID int(10) unsigned DEFAULT '0' NOT NULL auto_increment, ServiceID int(10) unsigned DEFAULT '0' NOT NULL, diff --git a/mysql-test/t/bdb-deadlock.test b/mysql-test/t/bdb-deadlock.test index 5ecfe592ce4..2453c42e49a 100644 --- a/mysql-test/t/bdb-deadlock.test +++ b/mysql-test/t/bdb-deadlock.test @@ -11,7 +11,9 @@ connect (con1,localhost,root,,); connect (con2,localhost,root,,); +--disable_warnings drop table if exists t1,t2; +--enable_warnings connection con1; create table t1 (id integer, x integer) type=BDB; create table t2 (id integer, x integer) type=BDB; diff --git a/mysql-test/t/bdb.test b/mysql-test/t/bdb.test index 608d4bf5042..27755e51b7f 100644 --- a/mysql-test/t/bdb.test +++ b/mysql-test/t/bdb.test @@ -4,7 +4,9 @@ # Small basic test with ignore # +--disable_warnings drop table if exists t1,t2,t3,t4,t5,t6,t7,t8; +--enable_warnings create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) type=bdb; insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt'); @@ -441,7 +443,6 @@ drop table t1; # This gave a wrong result because the row information was freed too early # -drop table if exists t1, t2, t3, t4, t5, t6, t7; create table t1 ( branch_id int auto_increment primary key, @@ -451,7 +452,6 @@ create table t1 unique branch_name(branch_name), index branch_active(branch_active) ) type=bdb; -drop table if exists t2 ; create table t2 ( target_id int auto_increment primary key, @@ -461,7 +461,6 @@ create table t2 unique target_name(target_name), index target_active(target_active) ) type=bdb; -drop table if exists t3 ; create table t3 ( platform_id int auto_increment primary key, @@ -471,7 +470,6 @@ create table t3 unique platform_name(platform_name), index platform_active(platform_active) ) type=bdb; -drop table if exists t4 ; create table t4 ( product_id int auto_increment primary key, @@ -482,7 +480,6 @@ create table t4 unique product_name(product_name), index product_active(product_active) ) type=bdb; -drop table if exists t5 ; create table t5 ( product_file_id int auto_increment primary key, @@ -496,7 +493,6 @@ create table t5 unique product_file(product_id,file_name), index file_included(file_included) ) type=bdb; -drop table if exists t6 ; create table t6 ( file_platform_id int auto_increment primary key, @@ -510,7 +506,6 @@ create table t6 unique file_platform(product_file_id,platform_id,branch_id) ) type=bdb; -drop table if exists t8 ; create table t8 ( archive_id int auto_increment primary key, @@ -523,7 +518,6 @@ create table t8 unique archive(branch_id,target_id,platform_id,product_id), index status_id(status_id) ) type=bdb; -drop table if exists t7 ; create table t7 ( build_id int auto_increment primary key, @@ -727,7 +721,6 @@ DROP TABLE t1,t2; # Test problem with joining table to itself on a multi-part unique key # -drop table if exists t1; create table t1 (a int(11) not null, b int(11) not null, unique (a,b)) type=bdb; insert into t1 values (1,1), (1,2); select * from t1 where a = 1; diff --git a/mysql-test/t/bdb_cache.test b/mysql-test/t/bdb_cache.test index b1343c5e83e..0d7de75ccf6 100644 --- a/mysql-test/t/bdb_cache.test +++ b/mysql-test/t/bdb_cache.test @@ -4,7 +4,9 @@ # # Without auto_commit. # +--disable_warnings drop table if exists t1, t2, t3; +--enable_warnings flush status; set autocommit=0; create table t1 (a int not null) type=bdb; diff --git a/mysql-test/t/bench_count_distinct.test b/mysql-test/t/bench_count_distinct.test index 9059428bea4..c1adeab2c44 100644 --- a/mysql-test/t/bench_count_distinct.test +++ b/mysql-test/t/bench_count_distinct.test @@ -1,4 +1,10 @@ +# +# Test of count(distinct ..) +# + +--disable_warnings drop table if exists t1; +--enable_warnings create table t1(n int not null, key(n)) delay_key_write = 1; let $1=100; disable_query_log; diff --git a/mysql-test/t/bigint.test b/mysql-test/t/bigint.test index 15c61c2c0dc..3dde4b8a2c1 100644 --- a/mysql-test/t/bigint.test +++ b/mysql-test/t/bigint.test @@ -1,4 +1,11 @@ # +# Initialize + +--disable_warnings +drop table if exists t1; +--enable_warnings + +# # Test of reading of bigint values # select 0,256,00000000000000065536,2147483647,-2147483648,2147483648,+4294967296; @@ -11,7 +18,6 @@ select +9999999999999999999,-9999999999999999999; # This will work on 4.0 as we then have internal handling of bigint variables. # -drop table if exists t1; create table t1 (a bigint unsigned not null, primary key(a)); insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE); select * from t1; diff --git a/mysql-test/t/binary.test b/mysql-test/t/binary.test index fc2d91e20fe..0a5dd71f98e 100644 --- a/mysql-test/t/binary.test +++ b/mysql-test/t/binary.test @@ -1,8 +1,10 @@ # # test sort,min and max on binary fields # - +--disable_warnings drop table if exists t1,t2; +--enable_warnings + create table t1 (name char(20) not null, primary key (name)); create table t2 (name char(20) binary not null, primary key (name)); insert into t1 values ("å"); diff --git a/mysql-test/t/bool.test b/mysql-test/t/bool.test index 10f97fefb73..c001973baeb 100644 --- a/mysql-test/t/bool.test +++ b/mysql-test/t/bool.test @@ -2,7 +2,9 @@ # Test of boolean operations with NULL # +--disable_warnings DROP TABLE IF EXISTS t1; +--enable_warnings SELECT IF(NULL AND 1, 1, 2), IF(1 AND NULL, 1, 2); SELECT NULL AND 1, 1 AND NULL, 0 AND NULL, NULL and 0; @@ -33,19 +35,17 @@ DROP TABLE t1; # Read nA as !A, AB as A && B, AoB as A || B # Result table makes ANSI happy -drop table if exists t; -create table t(a int, b int); -insert into t values(null, null), (0, null), (1, null), (null, 0), (null, 1), (0, 0), (0, 1), (1, 0), (1, 1); +create table t1 (a int, b int); +insert into t1 values(null, null), (0, null), (1, null), (null, 0), (null, 1), (0, 0), (0, 1), (1, 0), (1, 1); # Below test is valid untill we have True/False implemented as 1/0 # To comply to all rules it must show that: n(AB) = nAonB, n(AoB) = nAnB -select ifnull(A, 'N') as A, ifnull(B, 'N') as B, ifnull(not A, 'N') as nA, ifnull(not B, 'N') as nB, ifnull(A and B, 'N') as AB, ifnull(not (A and B), 'N') as `n(AB)`, ifnull((not A or not B), 'N') as nAonB, ifnull(A or B, 'N') as AoB, ifnull(not(A or B), 'N') as `n(AoB)`, ifnull(not A and not B, 'N') as nAnB from t; +select ifnull(A, 'N') as A, ifnull(B, 'N') as B, ifnull(not A, 'N') as nA, ifnull(not B, 'N') as nB, ifnull(A and B, 'N') as AB, ifnull(not (A and B), 'N') as `n(AB)`, ifnull((not A or not B), 'N') as nAonB, ifnull(A or B, 'N') as AoB, ifnull(not(A or B), 'N') as `n(AoB)`, ifnull(not A and not B, 'N') as nAnB from t1; # This should work with any internal representation of True/False # Result must be same as above -select ifnull(A=1, 'N') as A, ifnull(B=1, 'N') as B, ifnull(not (A=1), 'N') as nA, ifnull(not (B=1), 'N') as nB, ifnull((A=1) and (B=1), 'N') as AB, ifnull(not ((A=1) and (B=1)), 'N') as `n(AB)`, ifnull((not (A=1) or not (B=1)), 'N') as nAonB, ifnull((A=1) or (B=1), 'N') as AoB, ifnull(not((A=1) or (B=1)), 'N') as `n(AoB)`, ifnull(not (A=1) and not (B=1), 'N') as nAnB from t; +select ifnull(A=1, 'N') as A, ifnull(B=1, 'N') as B, ifnull(not (A=1), 'N') as nA, ifnull(not (B=1), 'N') as nB, ifnull((A=1) and (B=1), 'N') as AB, ifnull(not ((A=1) and (B=1)), 'N') as `n(AB)`, ifnull((not (A=1) or not (B=1)), 'N') as nAonB, ifnull((A=1) or (B=1), 'N') as AoB, ifnull(not((A=1) or (B=1)), 'N') as `n(AoB)`, ifnull(not (A=1) and not (B=1), 'N') as nAnB from t1; - -drop table t; +drop table t1; diff --git a/mysql-test/t/bulk_replace.test b/mysql-test/t/bulk_replace.test index d366004c16f..755d34083f8 100644 --- a/mysql-test/t/bulk_replace.test +++ b/mysql-test/t/bulk_replace.test @@ -1,11 +1,10 @@ # # this is a test of bulk-insert code -# as used by REPLACE -# -# by Monty # +--disable_warnings drop table if exists t1; +--enable_warnings CREATE TABLE t1 (a int, unique (a), b int not null, unique(b), c int not null, index(c)); replace into t1 values (1,1,1),(2,2,2),(3,1,3); select * from t1; diff --git a/mysql-test/t/case.test b/mysql-test/t/case.test index 79511f5f546..6131d1500de 100644 --- a/mysql-test/t/case.test +++ b/mysql-test/t/case.test @@ -2,7 +2,9 @@ # Testing of CASE # +--disable_warnings drop table if exists t1; +--enable_warnings select CASE "b" when "a" then 1 when "b" then 2 END; select CASE "c" when "a" then 1 when "b" then 2 END; @@ -30,3 +32,12 @@ insert into t1 values(1),(2),(3),(4); select case a when 1 then 2 when 2 then 3 else 0 end as fcase, count(*) from t1 group by fcase; select case a when 1 then "one" when 2 then "two" else "nothing" end as fcase, count(*) from t1 group by fcase; drop table t1; + +# +# Test MAX(CASE ... ) that can return null +# + +create table t1 (row int not null, col int not null, val varchar(255) not null); +insert into t1 values (1,1,'orange'),(1,2,'large'),(2,1,'yellow'),(2,2,'medium'),(3,1,'green'),(3,2,'small'); +select max(case col when 1 then val else null end) as color from t1 group by row; +drop table t1; diff --git a/mysql-test/t/check.test b/mysql-test/t/check.test index 947566e725b..bc61aea2d66 100644 --- a/mysql-test/t/check.test +++ b/mysql-test/t/check.test @@ -1,8 +1,11 @@ connect (con1,localhost,root,,); connect (con2,localhost,root,,); connection con1; +--disable_warnings drop table if exists t1; -#add a lot of keys to slow down check +--enable_warnings + +# Add a lot of keys to slow down check create table t1(n int not null, key(n), key(n), key(n), key(n)); let $1=10000; disable_query_log; diff --git a/mysql-test/t/compare.test b/mysql-test/t/compare.test index 450d9c0961c..e5a2e310866 100644 --- a/mysql-test/t/compare.test +++ b/mysql-test/t/compare.test @@ -2,7 +2,10 @@ # Bug when using comparions of strings and integers. # +--disable_warnings drop table if exists t1; +--enable_warnings + CREATE TABLE t1 (id CHAR(12) not null, PRIMARY KEY (id)); insert into t1 values ('000000000001'),('000000000002'); explain select * from t1 where id=000000000001; diff --git a/mysql-test/t/connect.test b/mysql-test/t/connect.test index 0bc5ca3914f..7b441ee5f7b 100644 --- a/mysql-test/t/connect.test +++ b/mysql-test/t/connect.test @@ -41,7 +41,6 @@ show tables; #--error 1045 - # check if old password version also works update mysql.user set password=old_password("gambling2") where user="test"; flush privileges; @@ -63,5 +62,3 @@ show tables; #--error 1045 #connect (con1,localhost,test,zorro,); #--error 1045 - - diff --git a/mysql-test/t/constraints.test b/mysql-test/t/constraints.test index 8682cdc42a2..cc796e0abd2 100644 --- a/mysql-test/t/constraints.test +++ b/mysql-test/t/constraints.test @@ -2,7 +2,9 @@ # Testing of constraints # Currently MySQL only ignores the syntax. # +--disable_warnings drop table if exists t1; +--enable_warnings create table t1 (a int check (a>0)); insert into t1 values (1); diff --git a/mysql-test/t/count_distinct.test b/mysql-test/t/count_distinct.test index 3d795d44821..c7740e73ee8 100644 --- a/mysql-test/t/count_distinct.test +++ b/mysql-test/t/count_distinct.test @@ -2,7 +2,10 @@ # Problem with count(distinct) # +--disable_warnings drop table if exists t1,t2,t3; +--enable_warnings + create table t1 (libname varchar(21) not null, city text, primary key (libname)); create table t2 (isbn varchar(21) not null, author text, title text, primary key (isbn)); create table t3 (isbn varchar(21) not null, libname varchar(21) not null, quantity int ,primary key (isbn,libname)); diff --git a/mysql-test/t/count_distinct2.test b/mysql-test/t/count_distinct2.test index d1bea7614c8..9100f622dec 100644 --- a/mysql-test/t/count_distinct2.test +++ b/mysql-test/t/count_distinct2.test @@ -1,4 +1,6 @@ +--disable_warnings drop table if exists t1; +--enable_warnings create table t1(n1 int, n2 int, s char(20), vs varchar(20), t text); insert into t1 values (1,11, 'one','eleven', 'eleven'), diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index 3bad053875c..70a589c4be6 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -2,7 +2,10 @@ # Check some special create statements. # -drop table if exists t1,t2; +--disable_warnings +drop table if exists t1,t2,t3; +--enable_warnings + create table t1 (b char(0)); insert into t1 values (""),(null); select * from t1; @@ -12,7 +15,7 @@ create table t1 (b char(0) not null); create table if not exists t1 (b char(0) not null); insert into t1 values (""),(null); select * from t1; -drop table if exists t1; +drop table t1; # # Test of some CREATE TABLE'S that should fail @@ -91,11 +94,14 @@ create table t2 (a int) select * from t1; describe t1; describe t2; drop table if exists t2; -!$1060 create table t2 (a int, a float) select * from t1; +--error 1060 +create table t2 (a int, a float) select * from t1; drop table if exists t2; -!$1060 create table t2 (a int) select a as b, a+1 as b from t1; +--error 1060 +create table t2 (a int) select a as b, a+1 as b from t1; drop table if exists t2; -!$1060 create table t2 (b int) select a as b, a+1 as b from t1; +--error 1060 +create table t2 (b int) select a as b, a+1 as b from t1; drop table if exists t1,t2; # @@ -113,3 +119,43 @@ drop table if exists t1; create table t1 (a int, key(a)); create table t2 (b int, foreign key(b) references t1(a), key(b)); drop table if exists t1,t2; + +# +# Test for CREATE TABLE .. LIKE .. +# + +create table t1(id int not null, name char(20)); +insert into t1 values(10,'mysql'),(20,'monty- the creator'); +create table t2(id int not null); +insert into t2 values(10),(20); +create table t3 like t1; +show create table t3; +select * from t3; +create table if not exists t3 like t1; +select @@warning_count; +create temporary table t3 like t2; +show create table t3; +select * from t3; +drop table t3; +show create table t3; +select * from t3; +drop table t2, t3; +drop database if exists test_$1; +create database test_$1; +create table test_$1.t3 like t1; +create temporary table t3 like test_$1.t3; +show create table t3; +create table t2 like t3; +show create table t2; +select * from t2; +create table t3 like t1; +!$1050 create table t3 like test_$1.t3; +--error 1044,1 +create table non_existing_database.t1 like t1; +!$1051 create table t3 like non_existing_table; +!$1050 create temporary table t3 like t1; +!$1103 create table t3 like `a/a`; +drop table t1, t2, t3; +drop table t3; +drop database test_$1; + diff --git a/mysql-test/t/ctype_latin1_de.test b/mysql-test/t/ctype_latin1_de.test index e829005a229..a4b4b816ec4 100644 --- a/mysql-test/t/ctype_latin1_de.test +++ b/mysql-test/t/ctype_latin1_de.test @@ -1,7 +1,9 @@ # # Test latin_de character set # +--disable_warnings drop table if exists t1; +--enable_warnings create table t1 (a char (20) not null, b int not null auto_increment, index (a,b),index(b)); insert into t1 (a) values ('ä'),('ac'),('ae'),('ad'),('Äc'),('aeb'); insert into t1 (a) values ('üc'),('uc'),('ue'),('ud'),('Ü'),('ueb'),('uf'); diff --git a/mysql-test/t/ctype_many.test b/mysql-test/t/ctype_many.test index 7854bc38d6f..5530eee0dbe 100644 --- a/mysql-test/t/ctype_many.test +++ b/mysql-test/t/ctype_many.test @@ -1,8 +1,10 @@ +--disable_warnings DROP TABLE IF EXISTS t1; +--enable_warnings CREATE TABLE t1 ( comment CHAR(32) ASCII NOT NULL, - koi8_ru_f CHAR(32) CHARACTER SET koi8_ru NOT NULL + koi8_ru_f CHAR(32) CHARACTER SET koi8r NOT NULL ) CHARSET=latin5; SHOW CREATE TABLE t1; @@ -137,9 +139,12 @@ SELECT CONVERT(koi8_ru_f USING utf8),MIN(comment),COUNT(*) FROM t1 GROUP BY 1; ALTER TABLE t1 ADD utf8_f CHAR(32) CHARACTER SET utf8 NOT NULL; UPDATE t1 SET utf8_f=CONVERT(koi8_ru_f USING utf8); - SELECT * FROM t1; +ALTER TABLE t1 ADD bin_f CHAR(32) BYTE NOT NULL; +UPDATE t1 SET bin_f=koi8_ru_f; +SELECT COUNT(DISTINCT bin_f),COUNT(DISTINCT koi8_ru_f),COUNT(DISTINCT utf8_f) FROM t1; + SELECT koi8_ru_f,MIN(comment) FROM t1 GROUP BY 1; SELECT utf8_f,MIN(comment) FROM t1 GROUP BY 1; SELECT DISTINCT koi8_ru_f FROM t1; @@ -153,7 +158,7 @@ ORDER BY t11.koi8_ru_f,t11.comment,t12.comment; SELECT t11.comment,t12.comment FROM t1 t11,t1 t12 -WHERE t11.koi8_ru_f=CONVERT(t12.utf8_f USING koi8_ru) +WHERE t11.koi8_ru_f=CONVERT(t12.utf8_f USING koi8r) ORDER BY t12.utf8_f,t11.comment,t12.comment; ALTER TABLE t1 ADD ucs2_f CHAR(32) CHARACTER SET ucs2; diff --git a/mysql-test/t/delayed.test b/mysql-test/t/delayed.test index 67111ea1734..4cf26b330c6 100644 --- a/mysql-test/t/delayed.test +++ b/mysql-test/t/delayed.test @@ -3,7 +3,9 @@ # (Can't be tested with purify :( ) # +--disable_warnings drop table if exists t1; +--enable_warnings create table t1 (a char(10), tmsp timestamp); insert into t1 set a = 1; insert delayed into t1 set a = 2; diff --git a/mysql-test/t/delete.test b/mysql-test/t/delete.test index 704fb7ada1c..57321739bfb 100644 --- a/mysql-test/t/delete.test +++ b/mysql-test/t/delete.test @@ -2,7 +2,9 @@ # Check for problems with delete # +--disable_warnings drop table if exists t1; +--enable_warnings CREATE TABLE t1 (a tinyint(3), b tinyint(5)); INSERT INTO t1 VALUES (1,1); INSERT LOW_PRIORITY INTO t1 VALUES (1,2); @@ -36,7 +38,6 @@ insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(2 delete from t1 where a=27; drop table t1; -drop table if exists t; CREATE TABLE `t` ( `i` int(10) NOT NULL default '0', `i2` int(10) NOT NULL default '0', @@ -44,4 +45,4 @@ CREATE TABLE `t` ( ) TYPE=MyISAM CHARSET=latin1; -- error 1054 DELETE FROM t USING t WHERE post='1'; -drop table if exists t;
\ No newline at end of file +drop table if exists t; diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test index 5f63cea3c11..6d1d825a523 100644 --- a/mysql-test/t/derived.test +++ b/mysql-test/t/derived.test @@ -1,4 +1,13 @@ +# Initialize +--disable_warnings drop table if exists t1,t2,t3; +--enable_warnings + +select * from (select 2 from DUAL) b; +-- error 1054 +SELECT 1 as a FROM (SELECT 1 UNION SELECT a) b; +-- error 1054 +SELECT 1 as a FROM (SELECT a UNION SELECT 1) b; CREATE TABLE t1 (a int not null, b char (10) not null); insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c'); CREATE TABLE t2 (a int not null, b char (10) not null); @@ -20,7 +29,7 @@ SELECT 1 FROM (SELECT 1) a WHERE a=2; SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1) as a; select * from t1 as x1, (select * from t1) as x2; explain select * from t1 as x1, (select * from t1) as x2; -drop table if exists t1.t2,t3; +drop table if exists t2,t3; select * from (select 1) as a; select a from (select 1 as a) as b; select 1 from (select 1) as a; @@ -40,6 +49,12 @@ while ($1) enable_query_log; SELECT * FROM (SELECT * FROM t1) as b ORDER BY a ASC LIMIT 0,20; explain select count(*) from t1 as tt1, (select * from t1) as tt2; -drop table if exists t1; +drop table t1; SELECT * FROM (SELECT (SELECT * FROM (SELECT 1 as a) as a )) as b; select * from (select 1 as a) b left join (select 2 as a) c using(a); +--error 1054 +SELECT * FROM (SELECT 1 UNION SELECT a) b; +--error 1054 +SELECT 1 as a FROM (SELECT a UNION SELECT 1) b; +--error 1054 +SELECT 1 as a FROM (SELECT 1 UNION SELECT a) b; diff --git a/mysql-test/t/dirty_close.test b/mysql-test/t/dirty_close.test index 3ed22f26d5b..f965df8cfea 100644 --- a/mysql-test/t/dirty_close.test +++ b/mysql-test/t/dirty_close.test @@ -3,7 +3,11 @@ connect (con2,localhost,root,,); connection con1; dirty_close con1; connection con2; + +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (n int); insert into t1 values (1),(2),(3); select * from t1; diff --git a/mysql-test/t/distinct.test b/mysql-test/t/distinct.test index 7f75b6b1687..859c4042b1d 100644 --- a/mysql-test/t/distinct.test +++ b/mysql-test/t/distinct.test @@ -3,7 +3,9 @@ # Bug with group by and not used fields # +--disable_warnings drop table if exists t1,t2,t3; +--enable_warnings CREATE TABLE t1 (id int,facility char(20)); CREATE TABLE t2 (facility char(20)); @@ -198,7 +200,6 @@ drop table t1,t2,t3; # This also test the case when one doesn't use all fields in GROUP BY. # -drop table if exists t1; create table t1 (a int not null, b int not null, t time); insert into t1 values (1,1,"00:06:15"),(1,2,"00:06:15"),(1,2,"00:30:15"),(1,3,"00:06:15"),(1,3,"00:30:15"); select a,sec_to_time(sum(time_to_sec(t))) from t1 group by a,b; @@ -261,7 +262,7 @@ INSERT INTO t1 VALUES (128,0,33,33,8,':D','',996121863,1,0,2,996122850,2,0,0); CREATE TABLE t2 (userid int(10) unsigned NOT NULL auto_increment, usergroupid smallint(5) unsigned NOT NULL default '0', username varchar(50) NOT NULL default '', password varchar(50) NOT NULL default '', email varchar(50) NOT NULL default '', styleid smallint(5) unsigned NOT NULL default '0', parentemail varchar(50) NOT NULL default '', coppauser smallint(6) NOT NULL default '0', homepage varchar(100) NOT NULL default '', icq varchar(20) NOT NULL default '', aim varchar(20) NOT NULL default '', yahoo varchar(20) NOT NULL default '', signature mediumtext NOT NULL, adminemail smallint(6) NOT NULL default '0', showemail smallint(6) NOT NULL default '0', invisible smallint(6) NOT NULL default '0', usertitle varchar(250) NOT NULL default '', customtitle smallint(6) NOT NULL default '0', joindate int(10) unsigned NOT NULL default '0', cookieuser smallint(6) NOT NULL default '0', daysprune smallint(6) NOT NULL default '0', lastvisit int(10) unsigned NOT NULL default '0', lastactivity int(10) unsigned NOT NULL default '0', lastpost int(10) unsigned NOT NULL default '0', posts smallint(5) unsigned NOT NULL default '0', timezoneoffset varchar(4) NOT NULL default '', emailnotification smallint(6) NOT NULL default '0', buddylist mediumtext NOT NULL, ignorelist mediumtext NOT NULL, pmfolders mediumtext NOT NULL, receivepm smallint(6) NOT NULL default '0', emailonpm smallint(6) NOT NULL default '0', pmpopup smallint(6) NOT NULL default '0', avatarid smallint(6) NOT NULL default '0', avatarrevision int(6) unsigned NOT NULL default '0', options smallint(6) NOT NULL default '15', birthday date NOT NULL default '0000-00-00', maxposts smallint(6) NOT NULL default '-1', startofweek smallint(6) NOT NULL default '1', ipaddress varchar(20) NOT NULL default '', referrerid int(10) unsigned NOT NULL default '0', nosessionhash smallint(6) NOT NULL default '0', autorefresh smallint(6) NOT NULL default '-1', messagepopup tinyint(2) NOT NULL default '0', inforum smallint(5) unsigned NOT NULL default '0', ratenum smallint(5) unsigned NOT NULL default '0', ratetotal smallint(5) unsigned NOT NULL default '0', allowrate smallint(5) unsigned NOT NULL default '1', PRIMARY KEY (userid), KEY usergroupid (usergroupid), KEY username (username), KEY inforum (inforum)) TYPE=MyISAM; INSERT INTO t2 VALUES (33,6,'Kevin','0','kevin@stileproject.com',1,'',0,'http://www.stileproject.com','','','','',1,1,0,'Administrator',0,996120694,1,-1,1030996168,1031027028,1030599436,36,'-6',0,'','','',1,0,1,0,0,15,'0000-00-00',-1,1,'64.0.0.0',0,1,-1,0,0,4,19,1); SELECT DISTINCT t1.*, t2.* FROM t1 LEFT JOIN t2 ON (t2.userid = t1.touserid); -DROP TABLE IF EXISTS t1,t2; +DROP TABLE t1,t2; # # test with const_item in ORDER BY @@ -272,5 +273,4 @@ INSERT t1 VALUES (1,2,3); CREATE TABLE t2 (a int primary key, b int, c int); INSERT t2 VALUES (3,4,5); SELECT DISTINCT t1.a, t2.b FROM t1, t2 WHERE t1.a=1 ORDER BY t2.c; -DROP TABLE IF EXISTS t1,t2; - +DROP TABLE t1,t2; diff --git a/mysql-test/t/drop.test b/mysql-test/t/drop.test index c92f2b1f3b9..307dd45654d 100644 --- a/mysql-test/t/drop.test +++ b/mysql-test/t/drop.test @@ -1,5 +1,8 @@ +# Initialise +--disable_warnings drop table if exists t1; -drop table if exists t1; +--enable_warnings + --error 1051; drop table t1; create table t1(n int); diff --git a/mysql-test/t/empty_table.test b/mysql-test/t/empty_table.test index 9ea79ee157f..db0a8e6a247 100644 --- a/mysql-test/t/empty_table.test +++ b/mysql-test/t/empty_table.test @@ -2,7 +2,10 @@ # Some special cases with empty tables # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (nr int(5) not null auto_increment,b blob,str char(10), primary key (nr)); select count(*) from t1; select * from t1; diff --git a/mysql-test/t/err000001.test b/mysql-test/t/err000001.test index d9898054a83..b558c90b0c6 100644 --- a/mysql-test/t/err000001.test +++ b/mysql-test/t/err000001.test @@ -2,18 +2,30 @@ # Test some error conditions # +--disable_warnings drop table if exists t1; -!$1146 insert into t1 values(1); -!$1146 delete from t1; -!$1146 update t1 set a=1; +--enable_warnings +--error 1146 +insert into t1 values(1); +--error 1146 +delete from t1; +--error 1146 +update t1 set a=1; create table t1 (a int); -!$1054 select count(test.t1.b) from t1; -!$1109 select count(not_existing_database.t1) from t1; -!$1109 select count(not_existing_database.t1.a) from t1; +--error 1054 +select count(test.t1.b) from t1; +--error 1109 +select count(not_existing_database.t1) from t1; +--error 1109 +select count(not_existing_database.t1.a) from t1; --error 1044,1146 select count(not_existing_database.t1.a) from not_existing_database.t1; -!$1054 select 1 from t1 order by 2; -!$1054 select 1 from t1 group by 2; -!$1054 select 1 from t1 order by t1.b; -!$1054 select count(*),b from t1; +--error 1054 +select 1 from t1 order by 2; +--error 1054 +select 1 from t1 group by 2; +--error 1054 +select 1 from t1 order by t1.b; +--error 1054 +select count(*),b from t1; drop table t1; diff --git a/mysql-test/t/explain.test b/mysql-test/t/explain.test index 31a01ae1360..3e33d58215e 100644 --- a/mysql-test/t/explain.test +++ b/mysql-test/t/explain.test @@ -1,7 +1,9 @@ # # Test of different EXPLAIN's +--disable_warnings drop table if exists t1; +--enable_warnings create table t1 (id int not null, str char(10), unique(str)); insert into t1 values (1, null),(2, null),(3, "foo"),(4, "bar"); select * from t1 where str is null; diff --git a/mysql-test/t/flush.test b/mysql-test/t/flush.test index 540aa4235cc..44a821b63c2 100644 --- a/mysql-test/t/flush.test +++ b/mysql-test/t/flush.test @@ -9,9 +9,13 @@ connect (con1,localhost,root,,); connect (con2,localhost,root,,); connection con1; -drop table if exists t1; + +--disable_warnings +drop table if exists t1,t2; +drop database if exists mysqltest; +--enable_warnings + create temporary table t1(n int not null primary key); -drop table if exists t2; create table t2(n int); insert into t2 values(3); let $1=100; @@ -44,7 +48,6 @@ reap; #test if drop database will wait until we release the global read lock connection con1; -drop database if exists mysqltest; create database mysqltest; create table mysqltest.t1(n int); insert into mysqltest.t1 values (23); diff --git a/mysql-test/t/foreign_key.test b/mysql-test/t/foreign_key.test index 1afcb546f6a..8c35fd65f74 100644 --- a/mysql-test/t/foreign_key.test +++ b/mysql-test/t/foreign_key.test @@ -2,7 +2,10 @@ # Test syntax of foreign keys # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 ( a int not null references t2, b int not null references t2 (c), diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test index 5a64f2614aa..02c407abd6c 100644 --- a/mysql-test/t/fulltext.test +++ b/mysql-test/t/fulltext.test @@ -2,7 +2,9 @@ # Test of fulltext index # +--disable_warnings drop table if exists t1,t2,t3; +--enable_warnings CREATE TABLE t1 (a VARCHAR(200), b TEXT, FULLTEXT (a,b)); INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'), @@ -166,7 +168,6 @@ drop table t1; # ERROR 1030: Got error 127 from table handler # -drop table if exists t1; create table t1 (a text, fulltext key (a)); insert into t1 values ('aaaa'); repair table t1; diff --git a/mysql-test/t/fulltext_cache.test b/mysql-test/t/fulltext_cache.test index 0b15e57a97b..15f32fdb5a0 100644 --- a/mysql-test/t/fulltext_cache.test +++ b/mysql-test/t/fulltext_cache.test @@ -2,7 +2,10 @@ # Bugreport due to Roy Nasser <roy@vem.ca> # +--disable_warnings drop table if exists t1, t2; +--enable_warnings + CREATE TABLE t1 ( id int(10) unsigned NOT NULL auto_increment, q varchar(255) default NULL, diff --git a/mysql-test/t/fulltext_distinct.test b/mysql-test/t/fulltext_distinct.test index 86e2f7ca1b4..2ccfb94c819 100644 --- a/mysql-test/t/fulltext_distinct.test +++ b/mysql-test/t/fulltext_distinct.test @@ -3,7 +3,10 @@ # bug reported by Tibor Simko <tibor.simko@cern.ch> # +--disable_warnings DROP TABLE IF EXISTS t1, t2; +--enable_warnings + CREATE TABLE t1 ( id mediumint unsigned NOT NULL auto_increment, tag char(6) NOT NULL default '', diff --git a/mysql-test/t/fulltext_left_join.test b/mysql-test/t/fulltext_left_join.test index bcf7cbcc505..4fce8ee287e 100644 --- a/mysql-test/t/fulltext_left_join.test +++ b/mysql-test/t/fulltext_left_join.test @@ -2,7 +2,10 @@ # Test for bug from Jean-Cédric COSTA <jean-cedric.costa@ensmp.fr> # +--disable_warnings drop table if exists t1, t2; +--enable_warnings + CREATE TABLE t1 ( id VARCHAR(255) NOT NULL PRIMARY KEY, sujet VARCHAR(255), diff --git a/mysql-test/t/fulltext_multi.test b/mysql-test/t/fulltext_multi.test index 233c243146e..c312a5938b2 100644 --- a/mysql-test/t/fulltext_multi.test +++ b/mysql-test/t/fulltext_multi.test @@ -1,6 +1,8 @@ # several FULLTEXT indexes in one table test -use test; +--disable_warnings DROP TABLE IF EXISTS t1; +--enable_warnings + CREATE TABLE t1 ( a int(11) NOT NULL auto_increment, b text, diff --git a/mysql-test/t/fulltext_order_by.test b/mysql-test/t/fulltext_order_by.test index 3b60ee77db2..f8afe49d95d 100644 --- a/mysql-test/t/fulltext_order_by.test +++ b/mysql-test/t/fulltext_order_by.test @@ -1,5 +1,7 @@ -use test; +--disable_warnings DROP TABLE IF EXISTS t1; +--enable_warnings + CREATE TABLE t1 ( a INT AUTO_INCREMENT PRIMARY KEY, message CHAR(20), diff --git a/mysql-test/t/fulltext_update.test b/mysql-test/t/fulltext_update.test index 9e2ce3ccba5..a1d133ba3fe 100644 --- a/mysql-test/t/fulltext_update.test +++ b/mysql-test/t/fulltext_update.test @@ -2,7 +2,9 @@ # Test for bug by voi@ims.at # +--disable_warnings drop table if exists test; +--enable_warnings CREATE TABLE test ( gnr INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, url VARCHAR(80) DEFAULT '' NOT NULL, diff --git a/mysql-test/t/func_concat.test b/mysql-test/t/func_concat.test index d6da1d6a603..147367a6d27 100644 --- a/mysql-test/t/func_concat.test +++ b/mysql-test/t/func_concat.test @@ -2,7 +2,10 @@ # Test of problem with CONCAT_WS() and long separators. # +--disable_warnings DROP TABLE IF EXISTS t1; +--enable_warnings + CREATE TABLE t1 ( number INT NOT NULL, alpha CHAR(6) NOT NULL ); INSERT INTO t1 VALUES (1413006,'idlfmv'), (1413065,'smpsfz'),(1413127,'sljrhx'),(1413304,'qerfnd'); diff --git a/mysql-test/t/func_crypt.test b/mysql-test/t/func_crypt.test index 812bdade39f..af0ef661d06 100644 --- a/mysql-test/t/func_crypt.test +++ b/mysql-test/t/func_crypt.test @@ -1,3 +1,8 @@ select length(encrypt('foo', 'ff')) <> 0; --replace_result $1$aa$4OSUA5cjdx0RUQ08opV27/ aaqPiZY5xR5l. -select old_password('test'),length(password("1")),length(encrypt('test')),encrypt('test','aa'); + +# Test new and old password handling functions +select password("a",""), password("a",NULL), password("","a"), password(NULL,"a"); +select password("aaaaaaaaaaaaaaaa","a"), password("a","aaaaaaaaaaaaaaaa"); +select old_password('test'), length(password("1")), length(encrypt('test')), encrypt('test','aa'); +select old_password(""), old_password(NULL), password(""), password(NULL); diff --git a/mysql-test/t/func_date_add.test b/mysql-test/t/func_date_add.test index c0250c6ece4..35acfe84bee 100644 --- a/mysql-test/t/func_date_add.test +++ b/mysql-test/t/func_date_add.test @@ -2,7 +2,10 @@ # Test of DATE_ADD # +--disable_warnings drop table if exists t1; +--enable_warnings + CREATE TABLE t1 ( visitor_id int(10) unsigned DEFAULT '0' NOT NULL, group_id int(10) unsigned DEFAULT '0' NOT NULL, diff --git a/mysql-test/t/func_encrypt.test b/mysql-test/t/func_encrypt.test index 3b6acc54ec9..fbb71f850e2 100644 --- a/mysql-test/t/func_encrypt.test +++ b/mysql-test/t/func_encrypt.test @@ -1,6 +1,9 @@ -- source include/have_openssl.inc +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (x blob); insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','The quick red fox jumped over the lazy brown dog')); insert into t1 values (des_encrypt('a','The quick red fox jumped over the lazy brown dog')); diff --git a/mysql-test/t/func_equal.test b/mysql-test/t/func_equal.test index 0d7a4ed9778..cbf589ffcc2 100644 --- a/mysql-test/t/func_equal.test +++ b/mysql-test/t/func_equal.test @@ -1,3 +1,8 @@ +# Initialise +--disable_warnings +drop table if exists t1,t2; +--enable_warnings + # # Testing of the <=> operator # @@ -15,7 +20,6 @@ select "A"<=>"B","A"<=>NULL,NULL<=>"A"; # Test with tables # -drop table if exists t1,t2; create table t1 (id int, value int); create table t2 (id int, value int); diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test index 8a9a5655e1b..b6511779f51 100644 --- a/mysql-test/t/func_group.test +++ b/mysql-test/t/func_group.test @@ -2,7 +2,10 @@ # simple test of all group functions # +--disable_warnings drop table if exists t1,t2; +--enable_warnings + create table t1 (grp int, a bigint unsigned, c char(10) not null); insert into t1 values (1,1,"a"); insert into t1 values (2,2,"b"); diff --git a/mysql-test/t/func_if.test b/mysql-test/t/func_if.test index 85553d1a2fd..21e5836c781 100644 --- a/mysql-test/t/func_if.test +++ b/mysql-test/t/func_if.test @@ -1,7 +1,9 @@ # # Init section # +--disable_warnings drop table if exists t1; +--enable_warnings # # Simple IF tests diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test index 7bbc560276f..723f1707a42 100644 --- a/mysql-test/t/func_in.test +++ b/mysql-test/t/func_in.test @@ -1,3 +1,7 @@ +# Initialise +--disable_warnings +drop table if exists t1; +--enable_warnings # # test of IN (NULL) # @@ -14,7 +18,7 @@ select NULL in (1.5,2.5,3.5); select 1.5 in (1.5,NULL,3.5); select 3.5 in (1.5,NULL,3.5); select 10.5 in (1.5,NULL,3.5); -drop table if exists t1; + CREATE TABLE t1 (a int, b int, c int); insert into t1 values (1,2,3), (1,NULL,3); select 1 in (a,b,c) from t1; diff --git a/mysql-test/t/func_isnull.test b/mysql-test/t/func_isnull.test index bd3bcd8d04c..506efada0eb 100644 --- a/mysql-test/t/func_isnull.test +++ b/mysql-test/t/func_isnull.test @@ -2,7 +2,10 @@ # test of ISNULL() # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (id int auto_increment primary key not null, mydate date not null); insert into t1 values (0,"2002-05-01"),(0,"2002-05-01"),(0,"2002-05-01"); flush tables; diff --git a/mysql-test/t/func_like.test b/mysql-test/t/func_like.test index 09746fcc817..47590ae7559 100644 --- a/mysql-test/t/func_like.test +++ b/mysql-test/t/func_like.test @@ -2,7 +2,10 @@ # Test of like # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (a varchar(10), key(a)); insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test"); select * from t1 where a like "abc%"; diff --git a/mysql-test/t/func_regexp.test b/mysql-test/t/func_regexp.test index 7fbe4000cfc..6e5d601844e 100644 --- a/mysql-test/t/func_regexp.test +++ b/mysql-test/t/func_regexp.test @@ -2,7 +2,10 @@ # Some regexp tests # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (s1 char(64),s2 char(64)); insert into t1 values('aaa','aaa'); diff --git a/mysql-test/t/func_set.test b/mysql-test/t/func_set.test index cb1aa543d43..60d67a77562 100644 --- a/mysql-test/t/func_set.test +++ b/mysql-test/t/func_set.test @@ -15,3 +15,21 @@ select export_set(9,"Y","N","-",5),export_set(9,"Y","N"),export_set(9,"Y","N","" select elt(2,1),field(NULL,"a","b","c"); select find_in_set("","a,b,c"),find_in_set("","a,b,c,"),find_in_set("",",a,b,c"); select find_in_set("abc","abc"),find_in_set("ab","abc"),find_in_set("abcd","abc"); + +# +# test for a bug with elt() +# + +--disable_warnings +drop table if exists t1,t2; +--enable_warnings + +create table t1 (id int(10) not null unique); +create table t2 (id int(10) not null primary key, +val int(10) not null); +insert into t1 values (1),(2),(4); +insert into t2 values (1,1),(2,1),(3,1),(4,2); + +select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id; +select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id order by one.id; +drop table t1,t2; diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test index d355cc95317..a87707746ba 100644 --- a/mysql-test/t/func_str.test +++ b/mysql-test/t/func_str.test @@ -4,7 +4,9 @@ # ----------- # Testing string functions +--disable_warnings drop table if exists t1; +--enable_warnings select 'hello',"'hello'",'""hello""','''h''e''l''l''o''',"hel""lo",'hel\'lo'; select 'hello' 'monty'; @@ -69,6 +71,7 @@ select decode(encode("abcdef","monty"),"monty")="abcdef"; select quote('\'\"\\test'); select quote(concat('abc\'', '\\cba')); select quote(1/0), quote('\0\Z'); +select length(quote(concat(char(0),"test"))); # # Wrong usage of functions diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index 2e913bdf943..903b80eb12a 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -1,7 +1,9 @@ # # time functions # +--disable_warnings drop table if exists t1,t2,t3; +--enable_warnings select from_days(to_days("960101")),to_days(960201)-to_days("19960101"),to_days(date_add(curdate(), interval 1 day))-to_days(curdate()),weekday("1997-11-29"); select period_add("9602",-12),period_diff(199505,"9404") ; diff --git a/mysql-test/t/func_timestamp.test b/mysql-test/t/func_timestamp.test index 74e541f782d..8583c16073d 100644 --- a/mysql-test/t/func_timestamp.test +++ b/mysql-test/t/func_timestamp.test @@ -2,7 +2,10 @@ # Tests that depend on the timestamp and the TZ variable # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (Zeit time, Tag tinyint not null, Monat tinyint not null, Jahr smallint not null, index(Tag), index(Monat), index(Jahr) ); insert into t1 values ("09:26:00",16,9,1998),("09:26:00",16,9,1998); diff --git a/mysql-test/t/gcc296.test b/mysql-test/t/gcc296.test index 7c72b57ca54..ebca4dbc897 100644 --- a/mysql-test/t/gcc296.test +++ b/mysql-test/t/gcc296.test @@ -1,6 +1,9 @@ #try to crash gcc 2.96 -drop table if exists obory; -CREATE TABLE obory ( +--disable_warnings +drop table if exists t1; +--enable_warnings + +CREATE TABLE t1 ( kodoboru varchar(10) default NULL, obor tinytext, aobor tinytext, @@ -8,10 +11,10 @@ CREATE TABLE obory ( FULLTEXT KEY obor (obor), FULLTEXT KEY aobor (aobor) ); -INSERT INTO obory VALUES ('0101000000','aaa','AAA'); -INSERT INTO obory VALUES ('0102000000','bbb','BBB'); -INSERT INTO obory VALUES ('0103000000','ccc','CCC'); -INSERT INTO obory VALUES ('0104000000','xxx','XXX'); +INSERT INTO t1 VALUES ('0101000000','aaa','AAA'); +INSERT INTO t1 VALUES ('0102000000','bbb','BBB'); +INSERT INTO t1 VALUES ('0103000000','ccc','CCC'); +INSERT INTO t1 VALUES ('0104000000','xxx','XXX'); -select * from obory; -drop table obory; +select * from t1; +drop table t1; diff --git a/mysql-test/t/grant_cache.test b/mysql-test/t/grant_cache.test index 09ce1021fbf..84091d9b830 100644 --- a/mysql-test/t/grant_cache.test +++ b/mysql-test/t/grant_cache.test @@ -3,12 +3,17 @@ # # Test grants with query cache # +--disable_warnings drop table if exists test.t1,mysqltest.t1,mysqltest.t2; +--enable_warnings + reset query cache; flush status; connect (root,localhost,root,,test,0,master.sock); connection root; +--disable_warnings create database if not exists mysqltest; +--enable_warnings create table mysqltest.t1 (a int,b int,c int); create table mysqltest.t2 (a int,b int,c int); diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index 4682463c11f..a34c3a12363 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -1,10 +1,18 @@ +# Initialise +--disable_warnings +drop table if exists t1,t2,t3; +--enable_warnings + +# +# Simple test without tables + -- error 1111 SELECT 1 FROM (SELECT 1) as a GROUP BY SUM(1); + # # Test of group (Failed for Lars Hoss <lh@pbm.de>) # -drop table if exists t1,t2,t3; CREATE TABLE t1 ( spID int(10) unsigned, userID int(10) unsigned, @@ -40,7 +48,7 @@ INSERT INTO t2 VALUES (3,'name','pass','mail','Y','v','n','adr','1','1','1'); SELECT t2.userid, MIN(t1.score) FROM t1, t2 WHERE t1.userID=t2.userID GROUP BY t2.userid; SELECT t2.userid, MIN(t1.score) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid; SELECT t2.userid, MIN(t1.score+0.0) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid; -drop table test.t1,test.t2; +drop table t1,t2; # # Bug in GROUP BY, by Nikki Chumakov <nikki@saddam.cityline.ru> @@ -288,7 +296,6 @@ SELECT 1 FROM t1 GROUP BY CONCAT(a, b); INSERT INTO t1 values ('hij','klm'); SELECT CONCAT(a, b),count(*) FROM t1 GROUP BY 1; DROP TABLE t1; -drop table if exists t1; # # Test problem with ORDER BY on a SUM() column diff --git a/mysql-test/t/handler.test b/mysql-test/t/handler.test index 4f1b11c80ff..2b0a6a7be8d 100644 --- a/mysql-test/t/handler.test +++ b/mysql-test/t/handler.test @@ -2,7 +2,10 @@ # test of HANDLER ... # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (a int, b char(10), key a(a), key b(a,b)); insert into t1 values (17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"), diff --git a/mysql-test/t/having.test b/mysql-test/t/having.test index 7f0a1225bda..4bd56400f98 100644 --- a/mysql-test/t/having.test +++ b/mysql-test/t/having.test @@ -1,7 +1,10 @@ # test of problems with having (Reported by Mark Rogers) # +--disable_warnings drop table if exists t1,t2; +--enable_warnings + create table t1 (a int); select count(a) as b from t1 where a=0 having b > 0; insert into t1 values (null); diff --git a/mysql-test/t/heap.test b/mysql-test/t/heap.test index f8b27d09a19..cd5dbd5afbe 100644 --- a/mysql-test/t/heap.test +++ b/mysql-test/t/heap.test @@ -2,7 +2,10 @@ # Test of heap tables. # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (a int not null,b int not null, primary key (a)) type=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100; insert into t1 values(1,1),(2,2),(3,3),(4,4); delete from t1 where a=1 or a=0; diff --git a/mysql-test/t/heap_auto_increment.test b/mysql-test/t/heap_auto_increment.test index 8a0d19d9183..6f392f6830d 100644 --- a/mysql-test/t/heap_auto_increment.test +++ b/mysql-test/t/heap_auto_increment.test @@ -2,7 +2,10 @@ # Test of auto_increment; The test for BDB tables is in bdb.test # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (a int not null auto_increment,b int, primary key (a)) type=heap auto_increment=3; insert into t1 values (1,1),(NULL,3),(NULL,4); delete from t1 where a=4; diff --git a/mysql-test/t/heap_btree.test b/mysql-test/t/heap_btree.test index 5c0002fede4..3c2ff249415 100644 --- a/mysql-test/t/heap_btree.test +++ b/mysql-test/t/heap_btree.test @@ -2,7 +2,10 @@ # Test of heap tables. # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (a int not null,b int not null, primary key using BTREE (a)) type=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100; insert into t1 values(1,1),(2,2),(3,3),(4,4); delete from t1 where a=1 or a=0; diff --git a/mysql-test/t/heap_hash.test b/mysql-test/t/heap_hash.test index 5dbd2b4a928..7b375fdfa3c 100644 --- a/mysql-test/t/heap_hash.test +++ b/mysql-test/t/heap_hash.test @@ -2,7 +2,10 @@ # Test of heap tables. # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (a int not null,b int not null, primary key using HASH (a)) type=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100; insert into t1 values(1,1),(2,2),(3,3),(4,4); delete from t1 where a=1 or a=0; diff --git a/mysql-test/t/innodb-deadlock.test b/mysql-test/t/innodb-deadlock.test index 2648d6cdf9c..ba4ec4a9ae4 100644 --- a/mysql-test/t/innodb-deadlock.test +++ b/mysql-test/t/innodb-deadlock.test @@ -2,7 +2,10 @@ connect (con1,localhost,root,,); connect (con2,localhost,root,,); -drop table if exists t1; + +--disable_warnings +drop table if exists t1,t2; +--enable_warnings # # Testing of FOR UPDATE @@ -36,7 +39,6 @@ select * from t1; commit; drop table t1; -drop table if exists t1, t2; # # Testing of FOR UPDATE # diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index eb5b0c9efd2..e875bf883c7 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -4,7 +4,10 @@ # Small basic test with ignore # +--disable_warnings drop table if exists t1,t2; +--enable_warnings + create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) type=innodb; insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt'); @@ -664,7 +667,6 @@ DROP TABLE t1; # # Test of multi-table-update # -drop table if exists t1,t2; create table t1 (n int(10), d int(10)) type=innodb; create table t2 (n int(10), d int(10)) type=innodb; insert into t1 values(1,1),(1,2); diff --git a/mysql-test/t/innodb_cache.test b/mysql-test/t/innodb_cache.test index 9066a5f19ba..8a08c19703d 100644 --- a/mysql-test/t/innodb_cache.test +++ b/mysql-test/t/innodb_cache.test @@ -1,10 +1,14 @@ -- source include/have_innodb.inc -- source include/have_query_cache.inc +# Initialise +--disable_warnings +drop table if exists t1,t2,t3; +--enable_warnings + # # Without auto_commit. # -drop table if exists t1, t2, t3; flush status; set autocommit=0; create table t1 (a int not null) type=innodb; diff --git a/mysql-test/t/innodb_handler.test b/mysql-test/t/innodb_handler.test index 6b85be9c7ab..49178a6b6b7 100644 --- a/mysql-test/t/innodb_handler.test +++ b/mysql-test/t/innodb_handler.test @@ -4,7 +4,10 @@ # test of HANDLER ... # -drop table if exists t1; +--disable_warnings +drop table if exists t1,t2; +--enable_warnings + create table t1 (a int, b char(10), key a(a), key b(a,b)) type=innodb; insert into t1 values (17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"), diff --git a/mysql-test/t/ins000001.test b/mysql-test/t/ins000001.test index 4d75b4e7fe3..afcd27ebfca 100644 --- a/mysql-test/t/ins000001.test +++ b/mysql-test/t/ins000001.test @@ -1,5 +1,8 @@ use test; +--disable_warnings drop table if exists t1,t2; +--enable_warnings + create table t1 (email varchar(50)); insert into t1 values ('sasha@mysql.com'),('monty@mysql.com'), ('foo@hotmail.com'),('foo@aol.com'),('bar@aol.com'); diff --git a/mysql-test/t/insert.test b/mysql-test/t/insert.test index 0bca8dc5890..bfa8aac7a1f 100644 --- a/mysql-test/t/insert.test +++ b/mysql-test/t/insert.test @@ -2,7 +2,10 @@ # Test of refering to old values # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (a int not null); insert into t1 values (1); insert into t1 values (a+2); @@ -46,15 +49,19 @@ drop table t1; create table t1 (sid char(20), id int(2) NOT NULL auto_increment, key(sid, id)); insert into t1 values ('skr',NULL),('skr',NULL),('test',NULL); select * from t1; +insert into t1 values ('rts',NULL),('rts',NULL),('test',NULL); +select * from t1; drop table t1; # # Test of mysqld crash with fully qualified column names # -drop database if exists foo; -create database foo; -use foo; +--disable_warnings +drop database if exists test_$1; +--enable_warnings +create database test_$1; +use test_$1; create table t1 (c int); -insert into foo.t1 set foo.t1.c = '1'; -drop database foo; +insert into test_$1.t1 set test_$1.t1.c = '1'; +drop database test_$1; diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test index 42f65858d77..8fcb22e4684 100644 --- a/mysql-test/t/insert_select.test +++ b/mysql-test/t/insert_select.test @@ -2,7 +2,10 @@ # Problem with INSERT ... SELECT # +--disable_warnings drop table if exists t1,t2; +--enable_warnings + create table t1 (bandID MEDIUMINT UNSIGNED NOT NULL PRIMARY KEY, payoutID SMALLINT UNSIGNED NOT NULL); insert into t1 (bandID,payoutID) VALUES (1,6),(2,6),(3,4),(4,9),(5,10),(6,1),(7,12),(8,12); create table t2 (payoutID SMALLINT UNSIGNED NOT NULL PRIMARY KEY); @@ -12,13 +15,13 @@ insert into t2 (payoutID) SELECT payoutID+10 FROM t1; insert ignore into t2 (payoutID) SELECT payoutID+10 FROM t1; select * from t2; drop table t1,t2; + # # bug in bulk insert optimization # test case by Fournier Jocelyn <joc@presence-pc.com> # -DROP TABLE IF EXISTS crash1,crash2; -CREATE TABLE `crash1` ( +CREATE TABLE `t1` ( `numeropost` bigint(20) unsigned NOT NULL default '0', `icone` tinyint(4) unsigned NOT NULL default '0', `numreponse` bigint(20) unsigned NOT NULL auto_increment, @@ -34,7 +37,7 @@ CREATE TABLE `crash1` ( KEY `numreponse` (`numreponse`) ) TYPE=MyISAM; -CREATE TABLE `crash2` ( +CREATE TABLE `t2` ( `numeropost` bigint(20) unsigned NOT NULL default '0', `icone` tinyint(4) unsigned NOT NULL default '0', `numreponse` bigint(20) unsigned NOT NULL auto_increment, @@ -50,21 +53,21 @@ CREATE TABLE `crash2` ( KEY `numreponse` (`numreponse`) ) TYPE=MyISAM; -INSERT INTO crash2 +INSERT INTO t2 (numeropost,icone,numreponse,contenu,pseudo,date,ip,signature) VALUES (9,1,56,'test','joce','2001-07-25 13:50:53' ,3649052399,0); -INSERT INTO crash1 (numeropost,icone,contenu,pseudo,date,signature,ip) -SELECT 1618,icone,contenu,pseudo,date,signature,ip FROM crash2 +INSERT INTO t1 (numeropost,icone,contenu,pseudo,date,signature,ip) +SELECT 1618,icone,contenu,pseudo,date,signature,ip FROM t2 WHERE numeropost=9 ORDER BY numreponse ASC; show variables like '%bulk%'; -INSERT INTO crash1 (numeropost,icone,contenu,pseudo,date,signature,ip) -SELECT 1718,icone,contenu,pseudo,date,signature,ip FROM crash2 +INSERT INTO t1 (numeropost,icone,contenu,pseudo,date,signature,ip) +SELECT 1718,icone,contenu,pseudo,date,signature,ip FROM t2 WHERE numeropost=9 ORDER BY numreponse ASC; -DROP TABLE IF EXISTS crash1,crash2; +DROP TABLE IF EXISTS t1,t2; diff --git a/mysql-test/t/insert_update.test b/mysql-test/t/insert_update.test index 6c92774113a..f40391554cc 100644 --- a/mysql-test/t/insert_update.test +++ b/mysql-test/t/insert_update.test @@ -1,4 +1,7 @@ +--disable_warnings DROP TABLE IF EXISTS t1; +--enable_warnings + CREATE TABLE t1 (a INT, b INT, c INT, UNIQUE (A), UNIQUE(B)); INSERT t1 VALUES (1,2,10), (3,4,20); INSERT t1 VALUES (5,6,30) ON DUPLICATE KEY UPDATE c=c+100; diff --git a/mysql-test/t/isam.test b/mysql-test/t/isam.test index c7308c4b999..fc2dbac439c 100644 --- a/mysql-test/t/isam.test +++ b/mysql-test/t/isam.test @@ -1,6 +1,8 @@ -- source include/have_isam.inc +--disable_warnings drop table if exists t1,t2; +--enable_warnings # # Test possible problem with rows that are about 65535 bytes long @@ -41,10 +43,14 @@ drop table t1; # # Test of some CREATE TABLE's that should fail # -!$1121 create table t1 (a int,b text, index(a)) type=isam; -!$1073 create table t1 (a int,b text, index(b)) type=isam; -!$1075 create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) type=isam; -!$1121 create table t1 (ordid int(8), unique (ordid)) type=isam; +--error 1121 +create table t1 (a int,b text, index(a)) type=isam; +--error 1073 +create table t1 (a int,b text, index(b)) type=isam; +--error 1075 +create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) type=isam; +--error 1121 +create table t1 (ordid int(8), unique (ordid)) type=isam; drop table if exists t1; # diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test index 18006e8fd22..653b4271fe8 100644 --- a/mysql-test/t/join.test +++ b/mysql-test/t/join.test @@ -1,7 +1,9 @@ # # This failed for lia Perminov # +--disable_warnings drop table if exists t1,t2,t3; +--enable_warnings create table t1 (id int primary key); create table t2 (id int); diff --git a/mysql-test/t/join_crash.test b/mysql-test/t/join_crash.test index 4606b23f726..ada6e56e664 100644 --- a/mysql-test/t/join_crash.test +++ b/mysql-test/t/join_crash.test @@ -2,7 +2,10 @@ # This test gave a core dump # +--disable_warnings DROP TABLE IF EXISTS t1,t2,t3,t4; +--enable_warnings + CREATE TABLE t1 ( project_id int(11) NOT NULL auto_increment, project_row_lock int(11) NOT NULL default '0', diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test index af5f377afb5..bfeb5bbb06b 100644 --- a/mysql-test/t/join_outer.test +++ b/mysql-test/t/join_outer.test @@ -2,7 +2,9 @@ # test of left outer join # +--disable_warnings drop table if exists t1,t2,t3,t4,t5; +--enable_warnings CREATE TABLE t1 ( grp int(11) default NULL, @@ -109,7 +111,6 @@ drop table t1,t2; # Test of LEFT JOIN with const tables (failed for frankie@etsetb.upc.es) # -drop table if exists t1,t2,t3,t4; CREATE TABLE t1 ( cod_asig int(11) DEFAULT '0' NOT NULL, desc_larga_cat varchar(80) DEFAULT '' NOT NULL, diff --git a/mysql-test/t/key.test b/mysql-test/t/key.test index 1996c793880..4fd8cc86dd5 100644 --- a/mysql-test/t/key.test +++ b/mysql-test/t/key.test @@ -2,7 +2,10 @@ # This failed for Elizabeth Mattijsen # +--disable_warnings drop table if exists t1,t2,t3; +--enable_warnings + CREATE TABLE t1 ( ID CHAR(32) NOT NULL, name CHAR(32) NOT NULL, @@ -173,7 +176,6 @@ drop table t1; # Problem with UNIQUE() with NULL parts and auto increment # -DROP TABLE IF EXISTS t1; CREATE TABLE t1 (c CHAR(10) NOT NULL,i INT NOT NULL AUTO_INCREMENT, UNIQUE (c,i)); INSERT INTO t1 (c) VALUES (NULL),(NULL); diff --git a/mysql-test/t/key_diff.test b/mysql-test/t/key_diff.test index 60afb5f81a4..b4e4339ae33 100644 --- a/mysql-test/t/key_diff.test +++ b/mysql-test/t/key_diff.test @@ -1,7 +1,10 @@ # # Check on condition on different length keys. +--disable_warnings drop table if exists t1; +--enable_warnings + CREATE TABLE t1 ( a char(5) NOT NULL, b char(4) NOT NULL, diff --git a/mysql-test/t/key_primary.test b/mysql-test/t/key_primary.test index 2cdb117128f..816365c517c 100644 --- a/mysql-test/t/key_primary.test +++ b/mysql-test/t/key_primary.test @@ -2,7 +2,10 @@ # test of primary key conversions # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (t1 char(3) primary key); insert into t1 values("ABC"); insert into t1 values("ABA"); diff --git a/mysql-test/t/keywords.test b/mysql-test/t/keywords.test index 3bd757aa069..e7ec63afe54 100644 --- a/mysql-test/t/keywords.test +++ b/mysql-test/t/keywords.test @@ -2,7 +2,10 @@ # Test keywords as fields # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (time time, date date, timestamp timestamp); insert into t1 values ("12:22:22","97:02:03","1997-01-02"); select * from t1; diff --git a/mysql-test/t/kill.test b/mysql-test/t/kill.test index 6bcc43ac916..65d4f27059f 100644 --- a/mysql-test/t/kill.test +++ b/mysql-test/t/kill.test @@ -11,7 +11,10 @@ connect (con2, localhost, root,,); #remember id of con1 connection con1; +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (kill_id int); insert into t1 values(connection_id()); diff --git a/mysql-test/t/limit.test b/mysql-test/t/limit.test index d4f6ce186cf..88a9831aa68 100644 --- a/mysql-test/t/limit.test +++ b/mysql-test/t/limit.test @@ -2,7 +2,10 @@ # Test of update and delete with limit # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (a int primary key, b int not null); insert into t1 () values (); -- Testing default values insert into t1 values (1,1),(2,1),(3,1); diff --git a/mysql-test/t/lock.test b/mysql-test/t/lock.test index 385713174d2..0868cf2c4b1 100644 --- a/mysql-test/t/lock.test +++ b/mysql-test/t/lock.test @@ -2,7 +2,9 @@ # Testing of table locking # +--disable_warnings drop table if exists t1,t2; +--enable_warnings CREATE TABLE t1 ( `id` int(11) NOT NULL default '0', `id2` int(11) NOT NULL default '0', `id3` int(11) NOT NULL default '0', `dummy1` char(30) default NULL, PRIMARY KEY (`id`,`id2`), KEY `index_id3` (`id3`)) TYPE=MyISAM; insert into t1 (id,id2) values (1,1),(1,2),(1,3); LOCK TABLE t1 WRITE; diff --git a/mysql-test/t/lock_multi.test b/mysql-test/t/lock_multi.test index 792ae956e2a..0c6c59d0444 100644 --- a/mysql-test/t/lock_multi.test +++ b/mysql-test/t/lock_multi.test @@ -6,8 +6,11 @@ # -- source include/not_embedded.inc +--disable_warnings drop table if exists t1; -#test to see if select will get the lock ahead of low priority update +--enable_warnings + +# Test to see if select will get the lock ahead of low priority update connect (locker,localhost,root,,); connect (reader,localhost,root,,); diff --git a/mysql-test/t/lowercase_table.test b/mysql-test/t/lowercase_table.test index 0d04e6c7df7..f3a747c4d61 100644 --- a/mysql-test/t/lowercase_table.test +++ b/mysql-test/t/lowercase_table.test @@ -2,7 +2,10 @@ # Test of --lower-case-table-names # +--disable_warnings drop table if exists t1,t2,t3; +--enable_warnings + create table T1 (id int primary key, Word varchar(40) not null, Index(Word)); INSERT INTO T1 VALUES (1, 'a'), (2, 'b'), (3, 'c'); SELECT * FROM t1; diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test index 39c33ef8684..f84e10b0e3c 100644 --- a/mysql-test/t/merge.test +++ b/mysql-test/t/merge.test @@ -2,7 +2,10 @@ # test of MERGE TABLES # +--disable_warnings drop table if exists t1,t2,t3,t4,t5,t6; +--enable_warnings + create table t1 (a int not null primary key auto_increment, message char(20)); create table t2 (a int not null primary key auto_increment, message char(20)); INSERT INTO t1 (message) VALUES ("Testing"),("table"),("t1"); @@ -49,6 +52,7 @@ select * from t4; create table t5 (a int not null, b char(10), key(a)) type=MERGE UNION=(test.t1,test_2.t2); # Because of windows, it's important that we drop the merge tables first! +# This should give a warning on table t5 drop table if exists t5,t4,t3,t1,t2; create table t1 (c char(10)) type=myisam; @@ -110,10 +114,9 @@ select * from t1; drop table t1; # -# Bug found by Monty. +# Bug in flush tables combined with MERGE tables # -drop table if exists t3, t2, t1; create table t1 (a int not null, b int not null, key(a,b)); create table t2 (a int not null, b int not null, key(a,b)); create table t3 (a int not null, b int not null, key(a,b)) TYPE=MERGE UNION=(t1,t2); @@ -127,7 +130,6 @@ drop table t3,t1,t2; # [phi] testing INSERT_METHOD stuff # -drop table if exists t6, t5, t4, t3, t2, t1; # first testing of common stuff with new parameters create table t1 (a int not null, b int not null auto_increment, primary key(a,b)); create table t2 (a int not null, b int not null auto_increment, primary key(a,b)); @@ -181,15 +183,14 @@ CREATE TABLE t1 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default ' INSERT INTO t1 VALUES (1,1), (2,1); CREATE TABLE t2 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', PRIMARY KEY (a,b)) TYPE=MyISAM; INSERT INTO t2 VALUES (1,2), (2,2); -CREATE TABLE t ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', KEY a (a,b)) TYPE=MRG_MyISAM UNION=(t1,t2); -select max(b) from t where a = 2; +CREATE TABLE t3 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', KEY a (a,b)) TYPE=MRG_MyISAM UNION=(t1,t2); +select max(b) from t3 where a = 2; select max(b) from t1 where a = 2; -drop table if exists t,t1,t2; +drop table if exists t3,t1,t2; # # temporary merge tables # -drop table if exists t1, t2, t3, t4, t5, t6; create table t1 (a int not null); create table t2 (a int not null); insert into t1 values (1); @@ -208,7 +209,6 @@ drop table if exists t6, t3, t1, t2, t4, t5; # testing merge::records_in_range and optimizer # -DROP TABLE IF EXISTS t1, t2; CREATE TABLE t1 ( fileset_id tinyint(3) unsigned NOT NULL default '0', file_code varchar(32) NOT NULL default '', @@ -235,5 +235,5 @@ EXPLAIN SELECT * FROM t1 WHERE fileset_id = 2 AND file_code BETWEEN '0000000115' AND '0000000120' LIMIT 1; EXPLAIN SELECT * FROM t2 WHERE fileset_id = 2 AND file_code = '0000000115' LIMIT 1; -DROP TABLE IF EXISTS t2, t1; +DROP TABLE t2, t1; diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test index ff456b710c1..6156da82ec0 100644 --- a/mysql-test/t/multi_update.test +++ b/mysql-test/t/multi_update.test @@ -2,7 +2,10 @@ # Test of update statement that uses many tables. # +--disable_warnings drop table if exists t1,t2,t3; +--enable_warnings + create table t1(id1 int not null auto_increment primary key, t char(12)); create table t2(id2 int not null, t char(12)); create table t3(id3 int not null, t char(12), index(id3)); @@ -99,7 +102,7 @@ INSERT INTO t3 VALUES (1,'2002-02-04 00:00:00'),(3,'2002-05-12 00:00:00'),(5,'20 00:00:00'),(7,'2002-07-22 00:00:00'); delete t1,t2,t3 from t1,t2,t3 where to_days(now())-to_days(t3.mydate)>=30 and t3.id=t1.id and t3.id=t2.id; select * from t3; -DROP TABLE IF EXISTS t1,t2,t3; +DROP TABLE t1,t2,t3; CREATE TABLE IF NOT EXISTS `t1` ( `id` int(11) NOT NULL auto_increment, @@ -127,8 +130,7 @@ select * from t2; UPDATE t2, t1 SET t2.tst = t1.tst, t2.tst1 = t1.tst1 WHERE t2.ParId = t1.Id; select * from t2; - -drop table if exists t1, t2 ; +drop table t1, t2 ; create table t1 (n numeric(10)); create table t2 (n numeric(10)); @@ -213,4 +215,20 @@ insert into t2 values(1,10),(1,20); UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n; select * from t1; select * from t2; +UPDATE t1 a ,t2 b SET a.d=b.d,b.d=30 WHERE a.n=b.n; +select * from t1; +select * from t2; +DELETE t1, t2 FROM t1 a,t2 b where a.n=b.n; +select * from t1; +select * from t2; drop table t1,t2; + +CREATE TABLE t1 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM; +INSERT INTO t1 VALUES (1,'jedan'),(2,'dva'),(3,'tri'),(4,'xxxxxxxxxx'),(5,'a'),(10,''),(11,''),(12,''),(13,''); +CREATE TABLE t2 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM; +INSERT INTO t2 VALUES (1,'jedan'),(2,'dva'),(3,'tri'),(4,'xxxxxxxxxx'),(5,'a'); +CREATE TABLE t3 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM; +INSERT INTO t3 VALUES (1,'jedan'),(2,'dva'); +update t1,t2 set t1.naziv="aaaa" where t1.broj=t2.broj; +update t1,t2,t3 set t1.naziv="bbbb", t2.naziv="aaaa" where t1.broj=t2.broj and t2.broj=t3.broj; +drop table t1,t2,t3; diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index 9c261ebf5bb..ed08b1cbacb 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -2,7 +2,15 @@ # Test bugs in the MyISAM code # -drop table if exists t1; +# Initialise +--disable_warnings +drop table if exists t1,t2; +--enable_warnings + +# +# Test problem with CHECK TABLE; +# + CREATE TABLE t1 ( STRING_DATA char(255) default NULL, KEY string_data (STRING_DATA) @@ -82,7 +90,6 @@ DROP TABLE t1; # in ha_myisam::repair, and index size is changed (decreased). # -drop table if exists t1; create table t1 ( t1 char(255), key(t1(250))); insert t1 values ('137513751375137513751375137513751375137569516951695169516951695169516951695169'); insert t1 values ('178417841784178417841784178417841784178403420342034203420342034203420342034203'); @@ -121,7 +128,6 @@ drop table t1; # test of myisam with huge number of packed fields # -drop table if exists t1; create table t1 (i1 int, i2 int, i3 int, i4 int, i5 int, i6 int, i7 int, i8 int, i9 int, i10 int, i11 int, i12 int, i13 int, i14 int, i15 int, i16 int, i17 int, i18 int, i19 int, i20 int, i21 int, i22 int, i23 int, i24 int, i25 int, @@ -286,7 +292,7 @@ insert into t1 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); -drop table if exists t1; +drop table t1; # # Test of REPAIR that once failed @@ -326,3 +332,23 @@ CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255)); ALTER TABLE t1 ADD INDEX t1 (a, b, c); DROP TABLE t1; +# +# Test of cardinality of keys with NULL +# + +CREATE TABLE t1 (a int not null, b int, c int, key(b), key(c), key(a,b), key(c,a)); +INSERT into t1 values (0, null, 0), (0, null, 1), (0, null, 2), (0, null,3), (1,1,4); +create table t2 (a int not null, b int, c int, key(b), key(c), key(a)); +INSERT into t2 values (1,1,1), (2,2,2); +optimize table t1; +show index from t1; +explain select * from t1,t2 where t1.a=t2.a; +explain select * from t1,t2 force index(a) where t1.a=t2.a; +explain select * from t1 force index(a),t2 force index(a) where t1.a=t2.a; +explain select * from t1,t2 where t1.b=t2.b; +explain select * from t1,t2 force index(c) where t1.a=t2.a; +explain select * from t1 where a=0 or a=2; +explain select * from t1 force index (a) where a=0 or a=2; +explain select * from t1 where c=1; +explain select * from t1 use index() where c=1; +drop table t1,t2; diff --git a/mysql-test/t/null.test b/mysql-test/t/null.test index ad32e0be6ff..087ef81e13e 100644 --- a/mysql-test/t/null.test +++ b/mysql-test/t/null.test @@ -1,3 +1,8 @@ +# Initialise +--disable_warnings +drop table if exists t1; +--enable_warnings + # # Testing of NULL in a lot of different places # @@ -15,7 +20,6 @@ SELECT (NULL OR NULL) IS NULL; select NULL AND 0, 0 and NULL; select inet_ntoa(null),inet_aton(null),inet_aton("122.256"),inet_aton("122.226."),inet_aton(""); -drop table if exists t1; create table t1 (x int); insert into t1 values (null); select * from t1 where x != 0; diff --git a/mysql-test/t/null_key.test b/mysql-test/t/null_key.test index b1cbd5cdfb0..18d0d368891 100644 --- a/mysql-test/t/null_key.test +++ b/mysql-test/t/null_key.test @@ -1,7 +1,10 @@ # # Check null keys -drop table if exists t1; +--disable_warnings +drop table if exists t1,t2; +--enable_warnings + create table t1 (a int, b int not null,unique key (a,b),index(b)) type=myisam; insert ignore into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(null,7),(9,9),(8,8),(7,7),(null,9),(null,9),(6,6); explain select * from t1 where a is null; @@ -51,7 +54,6 @@ drop table t1; # The following failed for Matt Loschert # -DROP TABLE IF EXISTS t1,t2; CREATE TABLE t1 ( id int(10) unsigned NOT NULL auto_increment, uniq_id int(10) unsigned default NULL, diff --git a/mysql-test/t/odbc.test b/mysql-test/t/odbc.test index 3e0fc214d3e..9aac5948359 100644 --- a/mysql-test/t/odbc.test +++ b/mysql-test/t/odbc.test @@ -1,3 +1,8 @@ +# Initialise +--disable_warnings +drop table if exists t1; +--enable_warnings + # # Test some ODBC compatibility # @@ -8,7 +13,6 @@ select {fn length("hello")}, { date "1997-10-20" }; # Test retreiving row with last insert_id value. # -drop table if exists t1; create table t1 (a int not null auto_increment,b int not null,primary key (a,b)); insert into t1 SET A=NULL,B=1; insert into t1 SET a=null,b=2; diff --git a/mysql-test/t/olap.test b/mysql-test/t/olap.test index 8fe547db615..99bb2656001 100644 --- a/mysql-test/t/olap.test +++ b/mysql-test/t/olap.test @@ -1,6 +1,9 @@ -drop table if exists sales; -create table sales ( product varchar(32), country varchar(32), year int, profit int); -insert into sales values ( 'Computer', 'India',2000, 1200), +--disable_warnings +drop table if exists t1; +--enable_warnings + +create table t1 ( product varchar(32), country varchar(32), year int, profit int); +insert into t1 values ( 'Computer', 'India',2000, 1200), ( 'TV', 'United States', 1999, 150), ( 'Calculator', 'United States', 1999,50), ( 'Computer', 'United States', 1999,1500), @@ -15,13 +18,14 @@ insert into sales values ( 'Computer', 'India',2000, 1200), ( 'Computer', 'United States', 2000,1500), ( 'Calculator', 'United States', 2000,75); --error 1235 -select product, country , year, sum(profit) from sales group by product, country, year with cube; +select product, country , year, sum(profit) from t1 group by product, country, year with cube; --error 1235 -explain select product, country , year, sum(profit) from sales group by product, country, year with cube; +explain select product, country , year, sum(profit) from t1 group by product, country, year with cube; --error 1235 -select product, country , year, sum(profit) from sales group by product, country, year with rollup; +select product, country , year, sum(profit) from t1 group by product, country, year with rollup; --error 1235 -explain select product, country , year, sum(profit) from sales group by product, country, year with rollup; +explain select product, country , year, sum(profit) from t1 group by product, country, year with rollup; --error 1235 -select product, country , year, sum(profit) from sales group by product, country, year with cube union all select product, country , year, sum(profit) from sales group by product, country, year with rollup; -drop table sales; +select product, country , year, sum(profit) from t1 group by product, country, year with cube union all select product, country , year, sum(profit) from t1 group by product, country, year with rollup; +drop table t1; + diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test index 0ee6f901aae..c6bc7e9f868 100644 --- a/mysql-test/t/order_by.test +++ b/mysql-test/t/order_by.test @@ -2,7 +2,9 @@ # Bug with order by # +--disable_warnings drop table if exists t1,t2,t3; +--enable_warnings CREATE TABLE t1 ( id int(6) DEFAULT '0' NOT NULL, @@ -168,7 +170,6 @@ drop table t1,t2,t3; #bug reported by Wouter de Jong -drop table if exists t1; CREATE TABLE t1 ( member_id int(11) NOT NULL auto_increment, inschrijf_datum varchar(20) NOT NULL default '', @@ -330,3 +331,24 @@ INSERT INTO t2 (numeropost,pseudo) VALUES (1,'joce'),(1,'bug'); SELECT titre,t1.numeropost,auteur,icone,nbrep,0,date,vue,ouvert,lastauteur,dest FROM t2 LEFT JOIN t1 USING(numeropost) WHERE t2.pseudo='joce' ORDER BY date DESC LIMIT 0,30; SELECT titre,t1.numeropost,auteur,icone,nbrep,'0',date,vue,ouvert,lastauteur,dest FROM t2 LEFT JOIN t1 USING(numeropost) WHERE t2.pseudo='joce' ORDER BY date DESC LIMIT 0,30; drop table t1,t2; + +# +# Test of test_if_subkey() function +# + +CREATE TABLE t1 ( + FieldKey varchar(36) NOT NULL default '', + LongVal bigint(20) default NULL, + StringVal mediumtext, + KEY FieldKey (FieldKey), + KEY LongField (FieldKey,LongVal), + KEY StringField (FieldKey,StringVal(32)) +); +INSERT INTO t1 VALUES ('0',3,'0'),('0',2,'1'),('0',1,'2'),('1',2,'1'),('1',1,'3'), ('1',0,'2'),('2',3,'0'),('2',2,'1'),('2',1,'2'),('3',2,'1'),('3',1,'2'),('3','3','3'); +EXPLAIN SELECT * FROM t1 WHERE FieldKey = '1' ORDER BY LongVal; +SELECT * FROM t1 WHERE FieldKey = '1' ORDER BY LongVal; +EXPLAIN SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY LongVal; +SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY LongVal; +EXPLAIN SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY FieldKey, LongVal; +SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY FieldKey, LongVal; +DROP TABLE t1; diff --git a/mysql-test/t/order_fill_sortbuf.test b/mysql-test/t/order_fill_sortbuf.test index 6419f2a93df..37620ebe331 100644 --- a/mysql-test/t/order_fill_sortbuf.test +++ b/mysql-test/t/order_fill_sortbuf.test @@ -3,7 +3,10 @@ # rows MySQL needs to use a merge during the sort phase. # +--disable_warnings drop table if exists t1,t2; +--enable_warnings + CREATE TABLE `t1` ( `id` int(11) NOT NULL default '0', `id2` int(11) NOT NULL default '0', diff --git a/mysql-test/t/outfile.test b/mysql-test/t/outfile.test index c126d221bd2..a944df01051 100644 --- a/mysql-test/t/outfile.test +++ b/mysql-test/t/outfile.test @@ -21,3 +21,8 @@ #select * into dumpfile "/tmp/select-test.99" from t1; #select load_file("/tmp/select-test.not-exist"); #drop table t1; +#drop table if exists t; +#CREATE TABLE t ( t timestamp NOT NULL, c char(200) character set latin1 NOT NULL default '', i int(11), v varchar(200), b blob, KEY t (t)) TYPE=MyISAM; +#INSERT INTO t VALUES ('2002-12-20 12:01:20','',1,"aaa","bbb"); +#select * from t into outfile "check"; +#drop table if exists t; diff --git a/mysql-test/t/packet.test b/mysql-test/t/packet.test new file mode 100644 index 00000000000..5c4e7efcaf3 --- /dev/null +++ b/mysql-test/t/packet.test @@ -0,0 +1,31 @@ + +# +# Check protocol handling +# + +connect (con1,localhost,root,,); + +connection con1; +set global max_allowed_packet=100; +set max_allowed_packet=100; +set global net_buffer_length=100; +set net_buffer_length=100; +# Have to be > 1024 as min value of net_buffer_length is 1024 +SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len; +# Should return NULL as 200 is bigger than max_allowed_packet +select repeat('a',200); + +# +# Connection 2 should get error for too big packets +# +connect (con2,localhost,root,,); +connection con2; +select @@net_buffer_length, @@max_allowed_packet; +--error 1153 +SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len; +set global max_allowed_packet=default; +set max_allowed_packet=default; +set global net_buffer_length=default; +set net_buffer_length=default; +SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len; +select length(repeat('a',200)); diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test index 6c3f3d6ac52..e1df5fa7b3b 100644 --- a/mysql-test/t/query_cache.test +++ b/mysql-test/t/query_cache.test @@ -10,7 +10,10 @@ flush query cache; # This crashed in some versions flush query cache; # This crashed in some versions reset query cache; flush status; +--disable_warnings +drop database if exists mysqltest; drop table if exists t1,t2,t3,t11,t21, mysqltest.t1; +--enable_warnings # # First simple test @@ -368,6 +371,7 @@ select * from t2; show status like "Qcache_queries_in_cache"; select * from t3; show status like "Qcache_queries_in_cache"; +update t1 set i=(select distinct 1 from (select * from t2) a); drop table t1, t2, t3; # diff --git a/mysql-test/t/raid.test b/mysql-test/t/raid.test index 8b608c1069f..38c740201bc 100644 --- a/mysql-test/t/raid.test +++ b/mysql-test/t/raid.test @@ -5,7 +5,10 @@ show variables like "have_raid"; # Test of raided tables # +--disable_warnings DROP TABLE IF EXISTS t1,t2; +--enable_warnings + CREATE TABLE t1 ( id int unsigned not null auto_increment primary key, c char(255) not null diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test index 278807eeea4..31b3ced6cc6 100644 --- a/mysql-test/t/range.test +++ b/mysql-test/t/range.test @@ -2,7 +2,10 @@ # Problem med range optimizer # +--disable_warnings drop table if exists t1; +--enable_warnings + CREATE TABLE t1 ( event_date date DEFAULT '0000-00-00' NOT NULL, type int(11) DEFAULT '0' NOT NULL, diff --git a/mysql-test/t/rename.test b/mysql-test/t/rename.test index ce4651d8de3..48a9cb401d9 100644 --- a/mysql-test/t/rename.test +++ b/mysql-test/t/rename.test @@ -2,7 +2,10 @@ # Test of rename table # +--disable_warnings drop table if exists t0,t1,t2,t3,t4; +--enable_warnings + create table t0 SELECT 1,"table 1"; create table t2 SELECT 2,"table 2"; create table t3 SELECT 3,"table 3"; @@ -29,4 +32,6 @@ rename table t3 to t4, t5 to t3, t1 to t2, t4 to t1; select * from t1; select * from t2; select * from t3; + +# This should give a warning for t4 drop table if exists t1,t2,t3,t4; diff --git a/mysql-test/t/repair.test b/mysql-test/t/repair.test index 6d79014b23d..bdc5a57a07c 100644 --- a/mysql-test/t/repair.test +++ b/mysql-test/t/repair.test @@ -2,7 +2,10 @@ # Test of repair table # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 SELECT 1,"table 1"; repair table t1 use_frm; drop table if exists t1; diff --git a/mysql-test/t/replace.test b/mysql-test/t/replace.test index e9e01615a62..7aeb2475ab5 100644 --- a/mysql-test/t/replace.test +++ b/mysql-test/t/replace.test @@ -4,7 +4,9 @@ # Test of REPLACE with ISAM and MyISAM and HEAP # +--disable_warnings drop table if exists t1; +--enable_warnings CREATE TABLE t1 ( gesuchnr int(11) DEFAULT '0' NOT NULL, diff --git a/mysql-test/t/rollback.test b/mysql-test/t/rollback.test index bd37e69ae23..1673f1648d3 100644 --- a/mysql-test/t/rollback.test +++ b/mysql-test/t/rollback.test @@ -2,7 +2,9 @@ # This test should fail as MyISAM doesn't have rollback # +--disable_warnings drop table if exists t1; +--enable_warnings create table t1 (n int not null primary key) type=myisam; begin work; diff --git a/mysql-test/t/row.test b/mysql-test/t/row.test index 593e2342856..099eaa95c77 100644 --- a/mysql-test/t/row.test +++ b/mysql-test/t/row.test @@ -1,3 +1,8 @@ +# Initialise +--disable_warnings +drop table if exists t1; +--enable_warnings + select row(1,2,3) IN (row(3,2,3), row(1,2,3), row(1,3,3)); select row(10,2,3) IN (row(3,2,3), row(1,2,3), row(1,3,3)); select row(1,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3)); @@ -33,7 +38,7 @@ SELECT ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,3)); SELECT ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,NULL)); -- error 1239 SELECT ROW('test',2,ROW(3,33))=ROW('test',2,4); -drop table if exists t1; + create table t1 ( a int, b int, c int); insert into t1 values (1,2,3), (2,3,1), (3,2,1), (1,2,NULL); select * from t1 where ROW(1,2,3)=ROW(a,b,c); @@ -47,7 +52,7 @@ drop table t1; -- error 1239 select ROW(1,1); -drop table if exists t1; + create table t1 (i int); -- error 1239 select 1 from t1 where ROW(1,1); diff --git a/mysql-test/t/rpl000001.test b/mysql-test/t/rpl000001.test index ce6897e63e1..3975f14e523 100644 --- a/mysql-test/t/rpl000001.test +++ b/mysql-test/t/rpl000001.test @@ -1,5 +1,5 @@ source include/master-slave.inc; -drop table if exists t1,t2,t3; + create table t1 (word char(20) not null); load data infile '../../std_data/words.dat' into table t1; --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR diff --git a/mysql-test/t/rpl000002.test b/mysql-test/t/rpl000002.test index 5fabe0d2c59..803eb069b66 100644 --- a/mysql-test/t/rpl000002.test +++ b/mysql-test/t/rpl000002.test @@ -1,5 +1,5 @@ source include/master-slave.inc; -drop table if exists t1; + create table t1 (n int auto_increment primary key); set insert_id = 2000; insert into t1 values (NULL),(NULL),(NULL); @@ -12,7 +12,6 @@ drop table t1; sync_slave_with_master; stop slave; connection master; -drop table if exists t2; create table t2(id int auto_increment primary key, created datetime); set timestamp=12345; insert into t2 set created=now(); diff --git a/mysql-test/t/rpl000003.test b/mysql-test/t/rpl000003.test deleted file mode 100644 index f994ed94371..00000000000 --- a/mysql-test/t/rpl000003.test +++ /dev/null @@ -1,14 +0,0 @@ -source include/master-slave.inc; -drop table if exists t1; -create table t1(n int primary key); -!insert into t1 values (1),(2),(2); -insert into t1 values (3); -save_master_pos; -connection slave; -sync_with_master; -select * from t1; -connection master; -drop table t1; -save_master_pos; -connection slave; -sync_with_master; diff --git a/mysql-test/t/rpl000004.test b/mysql-test/t/rpl000004.test index 705e0d51b7b..8fc2977faab 100644 --- a/mysql-test/t/rpl000004.test +++ b/mysql-test/t/rpl000004.test @@ -1,18 +1,14 @@ source include/master-slave.inc; + set SQL_LOG_BIN=0; -drop table if exists t1; create table t1 (word char(20) not null, index(word)); load data infile '../../std_data/words.dat' into table t1; -drop table if exists t2; create table t2 (word char(20) not null); load data infile '../../std_data/words.dat' into table t2; create table t3 (word char(20) not null primary key); connection slave; -drop table if exists t1; load table t1 from master; -drop table if exists t2; load table t2 from master; -drop table if exists t3; load table t3 from master; check table t1; select count(*) from t2; diff --git a/mysql-test/t/rpl000005.test b/mysql-test/t/rpl000005.test index 1cfea242b69..ae713633df3 100644 --- a/mysql-test/t/rpl000005.test +++ b/mysql-test/t/rpl000005.test @@ -1,5 +1,5 @@ source include/master-slave.inc; -drop table if exists t1; + CREATE TABLE t1 (name varchar(64), age smallint(3)); INSERT INTO t1 SET name='Andy', age=31; INSERT t1 SET name='Jacob', age=2; diff --git a/mysql-test/t/rpl000006.test b/mysql-test/t/rpl000006.test index ad8622c2a81..c6438062bb7 100644 --- a/mysql-test/t/rpl000006.test +++ b/mysql-test/t/rpl000006.test @@ -5,12 +5,10 @@ source include/master-slave.inc; # Don't log table creating to the slave as we want to test LOAD TABLE set SQL_LOG_BIN=0,timestamp=200006; -drop table if exists t1; create table t1(t timestamp not null,a char(1)); insert into t1 ( a) values ('F'); select unix_timestamp(t) from t1; connection slave; -drop table if exists t1; load table t1 from master; select unix_timestamp(t) from t1; diff --git a/mysql-test/t/rpl000008-slave.opt b/mysql-test/t/rpl000008-slave.opt index 79b3bf6174b..177f89e0910 100644 --- a/mysql-test/t/rpl000008-slave.opt +++ b/mysql-test/t/rpl000008-slave.opt @@ -1 +1 @@ ---replicate-ignore-table=test.foo +--replicate-ignore-table=test.mysqltest_foo diff --git a/mysql-test/t/rpl000008.test b/mysql-test/t/rpl000008.test index 12760008b6d..ea782b99d28 100644 --- a/mysql-test/t/rpl000008.test +++ b/mysql-test/t/rpl000008.test @@ -1,29 +1,36 @@ -#this one assumes we are ignoring updates on table foo, but doing -#the ones on all other tables +# This one assumes we are ignoring updates on table mysqltest_foo, but doing +# the ones on all other tables + source include/master-slave.inc; connection slave; + +# +# For this test we must be in the test database +# use test; -drop table if exists foo; -create table foo (n int); -insert into foo values(4); + +--disable_warnings +drop table if exists mysqltest_foo; +drop table if exists mysqltest_bar; +--enable_warnings + +create table mysqltest_foo (n int); +insert into mysqltest_foo values(4); connection master; use test; -drop table if exists foo; -create table foo (n int); -insert into foo values(5); -drop table if exists bar; -create table bar (m int); -insert into bar values(15); -drop table if exists choo; -create table choo (k int); -insert into choo values(55); +create table mysqltest_foo (n int); +insert into mysqltest_foo values(5); +create table mysqltest_bar (m int); +insert into mysqltest_bar values(15); +create table t1 (k int); +insert into t1 values(55); save_master_pos; connection slave; sync_with_master; -select foo.n,bar.m,choo.k from foo,bar,choo; +select mysqltest_foo.n,mysqltest_bar.m,t1.k from mysqltest_foo,mysqltest_bar,t1; connection master; -drop table if exists foo,bar,choo; +drop table mysqltest_foo,mysqltest_bar,t1; save_master_pos; connection slave; sync_with_master; -drop table if exists foo,bar,choo; +drop table mysqltest_foo,mysqltest_bar,t1; diff --git a/mysql-test/t/rpl000009-slave.opt b/mysql-test/t/rpl000009-slave.opt index 245e310c5d8..c015c02ba78 100644 --- a/mysql-test/t/rpl000009-slave.opt +++ b/mysql-test/t/rpl000009-slave.opt @@ -1 +1 @@ ---replicate-wild-do-table=bar.% +--replicate-wild-do-table=mysqltest.% diff --git a/mysql-test/t/rpl000009.test b/mysql-test/t/rpl000009.test index 3d0827718ec..d5cb14350a6 100644 --- a/mysql-test/t/rpl000009.test +++ b/mysql-test/t/rpl000009.test @@ -1,36 +1,34 @@ -# This one assumes we are ignoring updates on tables in database foo, but doing -# the ones in database bar +# This one assumes we are ignoring updates on tables in database mysqltest2, +# but doing the ones in database mysqltest source include/master-slave.inc; -drop database if exists foo; -create database foo; -drop database if exists bar; -create database bar; +--disable_warnings +drop database if exists mysqltest2; +create database mysqltest2; +drop database if exists mysqltest; +create database mysqltest; +--enable_warnings + save_master_pos; connection slave; sync_with_master; -drop table if exists foo.foo; -create table foo.foo (n int); -insert into foo.foo values(4); +create table mysqltest2.foo (n int); +insert into mysqltest2.foo values(4); connection master; -drop table if exists foo.foo; -create table foo.foo (n int); -insert into foo.foo values(5); -drop table if exists bar.bar; -create table bar.bar (m int); -insert into bar.bar values(15); +create table mysqltest2.foo (n int); +insert into mysqltest2.foo values(5); +create table mysqltest.bar (m int); +insert into mysqltest.bar values(15); save_master_pos; connection slave; sync_with_master; -select foo.foo.n,bar.bar.m from foo.foo,bar.bar; +select mysqltest2.foo.n,mysqltest.bar.m from mysqltest2.foo,mysqltest.bar; connection master; -drop database if exists bar; -drop database if exists foo; +drop database mysqltest; +drop database mysqltest2; save_master_pos; connection slave; sync_with_master; -drop database if exists bar; -drop database if exists foo; # Now let's test load data from master @@ -38,19 +36,19 @@ drop database if exists foo; connection master; set sql_log_bin = 0; -create database foo; -create database bar; +create database mysqltest2; +create database mysqltest; show databases; -create table foo.t1(n int, s char(20)); -create table foo.t2(n int, s text); -insert into foo.t1 values (1, 'one'), (2, 'two'), (3, 'three'); -insert into foo.t2 values (11, 'eleven'), (12, 'twelve'), (13, 'thirteen'); +create table mysqltest2.t1(n int, s char(20)); +create table mysqltest2.t2(n int, s text); +insert into mysqltest2.t1 values (1, 'one'), (2, 'two'), (3, 'three'); +insert into mysqltest2.t2 values (11, 'eleven'), (12, 'twelve'), (13, 'thirteen'); -create table bar.t1(n int, s char(20)); -create table bar.t2(n int, s text); -insert into bar.t1 values (1, 'one bar'), (2, 'two bar'), (3, 'three bar'); -insert into bar.t2 values (11, 'eleven bar'), (12, 'twelve bar'), - (13, 'thirteen bar'); +create table mysqltest.t1(n int, s char(20)); +create table mysqltest.t2(n int, s text); +insert into mysqltest.t1 values (1, 'one test'), (2, 'two test'), (3, 'three test'); +insert into mysqltest.t2 values (11, 'eleven test'), (12, 'twelve test'), + (13, 'thirteen test'); set sql_log_bin = 1; save_master_pos; connection slave; @@ -62,26 +60,25 @@ load data from master; # Now let's check if we have the right tables and the right data in them show databases; -use foo; +use mysqltest2; show tables; -use bar; +use mysqltest; show tables; -select * from bar.t1; -select * from bar.t2; +select * from mysqltest.t1; +select * from mysqltest.t2; # Now let's see if replication works connection master; -insert into bar.t1 values (4, 'four bar'); +insert into mysqltest.t1 values (4, 'four test'); save_master_pos; connection slave; sync_with_master; -select * from bar.t1; +select * from mysqltest.t1; # Now time for cleanup connection master; -drop database bar; -drop database foo; +drop database mysqltest; +drop database mysqltest2; save_master_pos; connection slave; sync_with_master; - diff --git a/mysql-test/t/rpl000010.test b/mysql-test/t/rpl000010.test index 05a211fbd85..0725214694a 100644 --- a/mysql-test/t/rpl000010.test +++ b/mysql-test/t/rpl000010.test @@ -1,10 +1,8 @@ -#this tests the offset off by 22 mystery bug -#must run slave with --disconnect-slave-event-count=1 --master-connect-retry=1 +# This tests the offset off by 22 mystery bug +# Must run slave with --disconnect-slave-event-count=1 --master-connect-retry=1 + source include/master-slave.inc; -connection slave; -drop table if exists t1; -connection master; -drop table if exists t1; + create table t1 (n int not null auto_increment primary key); insert into t1 values(NULL); insert into t1 values(2); diff --git a/mysql-test/t/rpl000011.test b/mysql-test/t/rpl000011.test index dc84741694c..3b00afe10e4 100644 --- a/mysql-test/t/rpl000011.test +++ b/mysql-test/t/rpl000011.test @@ -1,5 +1,5 @@ source include/master-slave.inc; -drop table if exists t1; + create table t1 (n int); insert into t1 values(1); sync_slave_with_master; diff --git a/mysql-test/t/rpl000012.test b/mysql-test/t/rpl000012.test index 9f8ba9a4f91..7f440eaaa13 100644 --- a/mysql-test/t/rpl000012.test +++ b/mysql-test/t/rpl000012.test @@ -1,18 +1,16 @@ source include/master-slave.inc; connection master; -drop table if exists t1,t2,t3; create table t2 (n int); create temporary table t1 (n int); insert into t1 values(1),(2),(3); insert into t2 select * from t1; -drop table if exists test.t3; -create temporary table test.t3 (n int not null); -alter table test.t3 add primary key(n); +create temporary table t3 (n int not null); +alter table t3 add primary key(n); flush logs; insert into t3 values (100); insert into t2 select * from t3; -drop table if exists test.t3; +drop table if exists t3; insert into t2 values (101); connection master1; create temporary table t1 (n int); diff --git a/mysql-test/t/rpl000013.test b/mysql-test/t/rpl000013.test index 14619796e01..94d5feb3925 100644 --- a/mysql-test/t/rpl000013.test +++ b/mysql-test/t/rpl000013.test @@ -3,7 +3,7 @@ save_master_pos; connection slave; sync_with_master; connection master; -drop table if exists t2; + create table t2(n int); create temporary table t1 (n int); insert into t1 values(1),(2),(3); @@ -31,6 +31,10 @@ show status like 'Slave_open_temp_tables'; # connect (master2,localhost,root,,); connection master2; + +# We will get a warning for t1 as this is a temporary table that doesn't +# exist in this connection. + drop table if exists t1,t2; save_master_pos; connection slave; diff --git a/mysql-test/t/rpl000015.test b/mysql-test/t/rpl000015.test index 37155d33f08..9573dfd8fb3 100644 --- a/mysql-test/t/rpl000015.test +++ b/mysql-test/t/rpl000015.test @@ -23,7 +23,9 @@ sync_with_master; --replace_result $MASTER_MYPORT MASTER_PORT show slave status; connection master; +--disable_warnings drop table if exists t1; +--enable_warnings create table t1 (n int); insert into t1 values (10),(45),(90); sync_slave_with_master; diff --git a/mysql-test/t/rpl000016-slave.opt b/mysql-test/t/rpl000016-slave.opt deleted file mode 100644 index f27601e0d7d..00000000000 --- a/mysql-test/t/rpl000016-slave.opt +++ /dev/null @@ -1 +0,0 @@ --O max_binlog_size=2048 diff --git a/mysql-test/t/rpl000017.test b/mysql-test/t/rpl000017.test index 3bff9b4cbd8..f38e109cb19 100644 --- a/mysql-test/t/rpl000017.test +++ b/mysql-test/t/rpl000017.test @@ -7,7 +7,9 @@ grant replication slave on *.* to replicate@127.0.0.1 identified by 'aaaaaaaaaaa connection slave; start slave; connection master; +--disable_warnings drop table if exists t1; +--enable_warnings create table t1(n int); insert into t1 values(24); sync_slave_with_master; diff --git a/mysql-test/t/rpl000018.test b/mysql-test/t/rpl000018.test index e992f7938eb..b8c09ed431d 100644 --- a/mysql-test/t/rpl000018.test +++ b/mysql-test/t/rpl000018.test @@ -13,7 +13,9 @@ reset slave; start slave; connection master; show binary logs; +--disable_warnings drop table if exists t1; +--enable_warnings create table t1(n int); insert into t1 values (3351); sync_slave_with_master; diff --git a/mysql-test/t/rpl_alter.test b/mysql-test/t/rpl_alter.test index 710dd2d09d6..6b8cf773150 100644 --- a/mysql-test/t/rpl_alter.test +++ b/mysql-test/t/rpl_alter.test @@ -1,19 +1,22 @@ source include/master-slave.inc; -drop database if exists d1; -create database d1; -create table d1.t1 ( n int); -alter table d1.t1 add m int; -insert into d1.t1 values (1,2); -create table d1.t2 (n int); -insert into d1.t2 values (45); -rename table d1.t2 to d1.t3, d1.t1 to d1.t2; +--disable_warnings +drop database if exists test_$1; +--enable_warnings +create database test_$1; + +create table test_$1.t1 ( n int); +alter table test_$1.t1 add m int; +insert into test_$1.t1 values (1,2); +create table test_$1.t2 (n int); +insert into test_$1.t2 values (45); +rename table test_$1.t2 to test_$1.t3, test_$1.t1 to test_$1.t2; save_master_pos; connection slave; sync_with_master; -select * from d1.t2; -select * from d1.t3; +select * from test_$1.t2; +select * from test_$1.t3; connection master; -drop database d1; +drop database test_$1; save_master_pos; connection slave; sync_with_master; diff --git a/mysql-test/t/rpl_empty_master_crash.test b/mysql-test/t/rpl_empty_master_crash.test index afa76ce10bb..9d5a7a173b0 100644 --- a/mysql-test/t/rpl_empty_master_crash.test +++ b/mysql-test/t/rpl_empty_master_crash.test @@ -1,6 +1,7 @@ source include/master-slave.inc; -drop table if exists t1; + show slave status; + # # Load table should not succeed on the master as this is not a slave # diff --git a/mysql-test/t/rpl_log_pos.test b/mysql-test/t/rpl_log_pos.test index d320796edd3..bc1349a959a 100644 --- a/mysql-test/t/rpl_log_pos.test +++ b/mysql-test/t/rpl_log_pos.test @@ -6,7 +6,9 @@ show master status; sync_slave_with_master; --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT show slave status; +stop slave; change master to master_log_pos=73; +start slave; sleep 5; stop slave; @@ -17,6 +19,7 @@ start slave; sleep 5; --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT show slave status; +stop slave; change master to master_log_pos=173; --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT start slave; @@ -31,6 +34,7 @@ create table t1 (n int); insert into t1 values (1),(2),(3); save_master_pos; connection slave; +stop slave; change master to master_log_pos=79; start slave; sync_with_master; diff --git a/mysql-test/t/rpl_redirect.test b/mysql-test/t/rpl_redirect.test index 4082542f295..181d200b761 100644 --- a/mysql-test/t/rpl_redirect.test +++ b/mysql-test/t/rpl_redirect.test @@ -19,7 +19,6 @@ rpl_probe; #turn on master/slave query direction auto-magic enable_rpl_parse; -drop table if exists t1; create table t1 ( n int); insert into t1 values (1),(2),(3),(4); disable_rpl_parse; diff --git a/mysql-test/t/rpl_replicate_do.test b/mysql-test/t/rpl_replicate_do.test index 0800062dc05..dcb3c5034fd 100644 --- a/mysql-test/t/rpl_replicate_do.test +++ b/mysql-test/t/rpl_replicate_do.test @@ -2,9 +2,12 @@ # updates on t1 source include/master-slave.inc; +--disable_warnings drop table if exists t11; connection slave; drop table if exists t11; +--enable_warnings + create table t2 (n int); insert into t2 values(4); connection master; @@ -24,7 +27,7 @@ select * from t2; --error 1146 select * from t11; connection master; -drop table if exists t1,t2,t3,t11; +drop table if exists t1,t2,t11; save_master_pos; connection slave; sync_with_master; diff --git a/mysql-test/t/rpl_rotate_logs.test b/mysql-test/t/rpl_rotate_logs.test index c552936d93f..025e07382ba 100644 --- a/mysql-test/t/rpl_rotate_logs.test +++ b/mysql-test/t/rpl_rotate_logs.test @@ -1,5 +1,5 @@ # -# Test are run with max_binlog_size=2048 to force automatic rotation of the +# Test is run with max_binlog_size=2048 to force automatic rotation of the # binary log # Tests done: # - Check that slaves reports correct failures if master.info has strange @@ -8,14 +8,18 @@ # - Ensure that temporary tables works over flush logs and binary log # changes # - Test creating a duplicate key error and recover from it -# + connect (master,localhost,root,,test,0,master.sock); +--disable_warnings drop table if exists t1, t2, t3, t4; +--enable_warnings connect (slave,localhost,root,,test,0,slave.sock); system cat /dev/null > var/slave-data/master.info; system chmod 000 var/slave-data/master.info; connection slave; +--disable_warnings drop table if exists t1, t2, t3, t4; +--enable_warnings --error 1201 start slave; system chmod 600 var/slave-data/master.info; @@ -46,7 +50,6 @@ show slave status; select * from t1; connection master; flush logs; -drop table if exists t2; create table t2(m int not null auto_increment primary key); insert into t2 values (34),(67),(123); flush logs; @@ -102,7 +105,7 @@ connection master; create temporary table temp_table (a char(80) not null); insert into temp_table values ("testing temporary tables part 2"); let $1=100; -drop table if exists t3; + create table t3 (n int); disable_query_log; while ($1) diff --git a/mysql-test/t/rpl_skip_error.test b/mysql-test/t/rpl_skip_error.test index d43c59ef024..86c89c70314 100644 --- a/mysql-test/t/rpl_skip_error.test +++ b/mysql-test/t/rpl_skip_error.test @@ -1,5 +1,4 @@ source include/master-slave.inc; -drop table if exists t1; create table t1 (n int not null primary key); save_master_pos; diff --git a/mysql-test/t/rpl_temporary.test b/mysql-test/t/rpl_temporary.test new file mode 100644 index 00000000000..75519b75f75 --- /dev/null +++ b/mysql-test/t/rpl_temporary.test @@ -0,0 +1,79 @@ +source include/master-slave.inc; + +connect (con1,localhost,root,,); +connect (con2,localhost,root,,); + +--disable_warnings +drop table if exists t1,t2; +--enable_warnings + +create table t1(f int); +create table t2(f int); +insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); + +connection con1; +create temporary table t3(f int); +insert into t3 select * from t1 where f<6; +sleep 1; + +connection con2; +create temporary table t3(f int); +sleep 1; + +connection con1; +insert into t2 select count(*) from t3; +sleep 1; + +connection con2; +insert into t3 select * from t1 where f>=4; +sleep 1; + +connection con1; +drop temporary table t3; +sleep 1; + +connection con2; +insert into t2 select count(*) from t3; +drop temporary table t3; + +select * from t2; + +show binlog events; + +drop table t1, t2; + +use test; +SET TIMESTAMP=1040323920; +create table t1(f int); +SET TIMESTAMP=1040323931; +create table t2(f int); +SET TIMESTAMP=1040323938; +insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); + +SET TIMESTAMP=1040323945; +SET @@session.pseudo_thread_id=1; +create temporary table t3(f int); +SET TIMESTAMP=1040323952; +SET @@session.pseudo_thread_id=1; +insert into t3 select * from t1 where f<6; +SET TIMESTAMP=1040324145; +SET @@session.pseudo_thread_id=2; +create temporary table t3(f int); +SET TIMESTAMP=1040324186; +SET @@session.pseudo_thread_id=1; +insert into t2 select count(*) from t3; +SET TIMESTAMP=1040324200; +SET @@session.pseudo_thread_id=2; +insert into t3 select * from t1 where f>=4; +SET TIMESTAMP=1040324211; +SET @@session.pseudo_thread_id=1; +drop temporary table t3; +SET TIMESTAMP=1040324219; +SET @@session.pseudo_thread_id=2; +insert into t2 select count(*) from t3; +SET TIMESTAMP=1040324224; +SET @@session.pseudo_thread_id=2; +drop temporary table t3; + +select * from t2; +drop table t1,t2; diff --git a/mysql-test/t/sel000001.test b/mysql-test/t/sel000001.test deleted file mode 100644 index 77355f8d535..00000000000 --- a/mysql-test/t/sel000001.test +++ /dev/null @@ -1,18 +0,0 @@ -# sel000001 -# -# Versions -# -------- -# 3.22 -# 3.23 -# -# Description -# ----------- -# This test is just a simple select. -# Testing WHERE clause. -# - -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (s CHAR(20) PRIMARY KEY, id INT); -INSERT INTO t1 VALUES ('cat', 1), ('mouse', 3), ('dog', 2), ('snake', 77); -SELECT s, id FROM t1 WHERE s = 'mouse'; -drop table t1; diff --git a/mysql-test/t/sel000002.test b/mysql-test/t/sel000002.test deleted file mode 100644 index 9a89db2821c..00000000000 --- a/mysql-test/t/sel000002.test +++ /dev/null @@ -1,17 +0,0 @@ -# sel000002 -# -# Versions -# -------- -# 3.22 -# 3.23 -# -# Description -# ----------- -# This test is just a simple select. -# - -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (n INT); -INSERT INTO t1 VALUES (1), (2), (3); -SELECT * FROM t1; -drop table t1; diff --git a/mysql-test/t/sel000003.test b/mysql-test/t/sel000003.test deleted file mode 100644 index a3f6a7337c2..00000000000 --- a/mysql-test/t/sel000003.test +++ /dev/null @@ -1,18 +0,0 @@ -# sel000003 -# -# Versions -# -------- -# 3.22 -# 3.23 -# -# Description -# ----------- -# This test is just a simple select. -# Testing count() function and GROUP BY clause. -# - -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (name CHAR(20) NOT NULL PRIMARY KEY, score SMALLINT NOT NULL, KEY(score)); -INSERT INTO t1 VALUES ('Sasha', 20), ('Matt', 20), ('Monty', 10), ('David', 10), ('Tim', 10), ('Jeremy', 10); -SELECT COUNT(*) as n, score FROM t1 GROUP BY score; -drop table t1; diff --git a/mysql-test/t/sel000031.test b/mysql-test/t/sel000031.test deleted file mode 100644 index 29bafbb3040..00000000000 --- a/mysql-test/t/sel000031.test +++ /dev/null @@ -1,20 +0,0 @@ -# sel000031 -# -# Versions -# -------- -# 3.22 -# 3.23 -# -# Description -# ----------- -# test for a bug with elt() and order by - -drop table if exists t1,t2; -create table t1 (id int(10) not null unique); -create table t2 (id int(10) not null primary key, -val int(10) not null); -insert into t1 values (1),(2),(4); -insert into t2 values (1,1),(2,1),(3,1),(4,2); - -select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id order by one.id; -drop table t1,t2; diff --git a/mysql-test/t/sel000032.test b/mysql-test/t/sel000032.test deleted file mode 100644 index d31ba69e9d8..00000000000 --- a/mysql-test/t/sel000032.test +++ /dev/null @@ -1,20 +0,0 @@ -# sel000032 -# -# Versions -# -------- -# 3.22 -# 3.23 -# -# Description -# ----------- -# test for a bug with elt() - -drop table if exists t1,t2; -create table t1 (id int(10) not null unique); -create table t2 (id int(10) not null primary key, -val int(10) not null); -insert into t1 values (1),(2),(4); -insert into t2 values (1,1),(2,1),(3,1),(4,2); - -select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id; -drop table t1,t2; diff --git a/mysql-test/t/sel000033.test b/mysql-test/t/sel000033.test index 165e43ad9f8..72e096311ce 100644 --- a/mysql-test/t/sel000033.test +++ b/mysql-test/t/sel000033.test @@ -9,7 +9,9 @@ # ----------- # test for a bug with in() and unique key +--disable_warnings drop table if exists t1; +--enable_warnings create table t1 (id int(10) primary key); insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9); diff --git a/mysql-test/t/sel000100.test b/mysql-test/t/sel000100.test index cedb78b17e7..2f9c06d5cf4 100644 --- a/mysql-test/t/sel000100.test +++ b/mysql-test/t/sel000100.test @@ -1,4 +1,6 @@ +--disable_warnings DROP TABLE IF EXISTS t1,t2; +--enable_warnings CREATE TABLE t1 ( ID int(11) NOT NULL auto_increment, diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index 7ea86845cb0..d4effd2026c 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -6,9 +6,9 @@ # Simple select test # -use test; - +--disable_warnings drop table if exists t1,t2,t3,t4; +--enable_warnings CREATE TABLE t1 ( Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL, @@ -1489,8 +1489,6 @@ select t2.fld1,fld3,period,price,price2 from t2,t3 where t2.fld1>= 18201 and t2. # We need another table for join stuff.. # -drop table if exists company; - create table t4 ( companynr tinyint(2) unsigned zerofill NOT NULL default '00', companyname char(30) NOT NULL default '', @@ -1800,10 +1798,10 @@ select * from t1 natural right join (t1 as t2 left join t1 as t3 using (a)); select * from t1 natural join (t1 as t2 left join t1 as t3 using (a)); select * from (t1 as t2 left join t1 as t3 using (a)) natural join t1; drop table t1; -drop table if exists t1,t2; + CREATE TABLE t1 ( aa char(2), id int(11) NOT NULL auto_increment, t2_id int(11) NOT NULL default '0', PRIMARY KEY (id), KEY replace_id (t2_id)) TYPE=MyISAM; INSERT INTO t1 VALUES ("1",8264,2506),("2",8299,2517),("3",8301,2518),("4",8302,2519),("5",8303,2520),("6",8304,2521),("7",8305,2522); CREATE TABLE t2 ( id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) TYPE=MyISAM; INSERT INTO t2 VALUES (2517), (2518), (2519), (2520), (2521), (2522); select * from t1, t2 WHERE t1.t2_id = t2.id and t1.t2_id > 0 order by t1.id LIMIT 0, 5; -drop table if exists t1,t2; +drop table t1,t2; diff --git a/mysql-test/t/select_found.test b/mysql-test/t/select_found.test index fb57224dd19..06624d50a43 100644 --- a/mysql-test/t/select_found.test +++ b/mysql-test/t/select_found.test @@ -1,8 +1,10 @@ # # Testing of found_rows() # - +--disable_warnings drop table if exists t1,t2; +--enable_warnings + create table t1 (a int not null auto_increment, b int not null, primary key(a)); insert into t1 (b) values (2),(3),(5),(5),(5),(6),(7),(9); select SQL_CALC_FOUND_ROWS * from t1; diff --git a/mysql-test/t/select_safe.test b/mysql-test/t/select_safe.test index e76b7558997..cd8bce6369c 100644 --- a/mysql-test/t/select_safe.test +++ b/mysql-test/t/select_safe.test @@ -2,7 +2,10 @@ # test of safe selects # +--disable_warnings drop table if exists t1; +--enable_warnings + SET SQL_SAFE_UPDATES=1,SQL_SELECT_LIMIT=4, SQL_MAX_JOIN_SIZE=9; create table t1 (a int primary key, b char(20)); insert into t1 values(1,"test"); diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test index eb15eac8bad..a21436637d1 100644 --- a/mysql-test/t/show_check.test +++ b/mysql-test/t/show_check.test @@ -2,7 +2,10 @@ # Test of some show commands # +--disable_warnings drop table if exists t1,t2; +--enable_warnings + create table t1 (a int not null primary key, b int not null,c int not null, key(b,c)); insert into t1 values (1,2,2),(2,2,3),(3,2,4),(4,2,4); check table t1 fast; diff --git a/mysql-test/t/status.test b/mysql-test/t/status.test index cffca437cf1..90d7f814359 100644 --- a/mysql-test/t/status.test +++ b/mysql-test/t/status.test @@ -13,7 +13,10 @@ flush status; show status like 'Table_lock%'; connection con1; SET SQL_LOG_BIN=0; +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1(n int) type=myisam; insert into t1 values(1); connection con2; diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 0527d6a2001..1dcbd9a282d 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -1,6 +1,14 @@ +# Initialise +--disable_warnings +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t11,t12; +--enable_warnings + select (select 2); +explain select (select 2); SELECT (SELECT 1) UNION SELECT (SELECT 2); +explain SELECT (SELECT 1) UNION SELECT (SELECT 2); SELECT (SELECT (SELECT 0 UNION SELECT 0)); +explain SELECT (SELECT (SELECT 0 UNION SELECT 0)); -- error 1245 SELECT (SELECT 1 FROM (SELECT 1) as b HAVING a=1) as a; -- error 1245 @@ -15,7 +23,7 @@ SELECT (SELECT 1), a; SELECT 1 as a FROM (SELECT 1) as b HAVING (SELECT a)=1; -- error 1054 SELECT 1 FROM (SELECT (SELECT a) b) c; -SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id LIMIT 1); +SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id); -- error 1239 SELECT * FROM (SELECT 1) a WHERE 1 IN (SELECT 1,1); SELECT 1 IN (SELECT 1); @@ -26,8 +34,23 @@ select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1)); SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1)); SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL; SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL; +SELECT (SELECT 1,2,3) = ROW(1,2,3); +SELECT (SELECT 1,2,3) = ROW(1,2,1); +SELECT (SELECT 1,2,3) < ROW(1,2,1); +SELECT (SELECT 1,2,3) > ROW(1,2,1); +SELECT (SELECT 1,2,3) = ROW(1,2,NULL); +SELECT ROW(1,2,3) = (SELECT 1,2,3); +SELECT ROW(1,2,3) = (SELECT 1,2,1); +SELECT ROW(1,2,3) < (SELECT 1,2,1); +SELECT ROW(1,2,3) > (SELECT 1,2,1); +SELECT ROW(1,2,3) = (SELECT 1,2,NULL); +SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a'); +SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b'); +SELECT (SELECT 1.5,2,'a') = ROW('b',2,'b'); +SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a'); +SELECT (SELECT 1.5,2,'a') = ROW(1.5,'c','a'); +SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a'); -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8; create table t1 (a int); create table t2 (a int, b int); create table t3 (a int); @@ -44,11 +67,11 @@ select (select a from t3), a from t2; select * from t2 where t2.a=(select a from t1); insert into t3 values (6),(7),(3); select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1); -select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1) +(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 order by a limit 2) limit 3; -select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1) +(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a); -explain select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1) +explain (select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a); select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2; select (select t3.a from t3 where a<8 order by 1 desc limit 1), a from @@ -115,8 +138,6 @@ SELECT * FROM t1 WHERE b = (SELECT MIN(b) FROM t1); SELECT * FROM t2 WHERE b = (SELECT MIN(b) FROM t2); SELECT * FROM t3 WHERE b = (SELECT MIN(b) FROM t3); -drop table if exists t8; - CREATE TABLE `t8` ( `pseudo` varchar(35) character set latin1 NOT NULL default '', `email` varchar(60) character set latin1 NOT NULL default '', @@ -275,7 +296,7 @@ select * from t1; drop table t1, t2; #multi-delete with subselects -drop table if exists t11, t12, t2; + create table t11 (a int NOT NULL, b int, primary key (a)); create table t12 (a int NOT NULL, b int, primary key (a)); create table t2 (a int NOT NULL, b int, primary key (a)); @@ -345,7 +366,7 @@ drop table t1, t2, t3; -- error 1096 SELECT * FROM (SELECT 1) b WHERE 1 IN (SELECT *); -drop table if exists t; + CREATE TABLE t (id int(11) default NULL, KEY id (id)) TYPE=MyISAM CHARSET=latin1; INSERT INTO t VALUES (1),(2); SELECT * FROM t WHERE id IN (SELECT 1); @@ -363,7 +384,7 @@ CREATE TABLE t1 (id int(11) default NULL, KEY id (id)) TYPE=MyISAM CHARSET=latin INSERT INTO t1 values (1),(1); -- error 1240 UPDATE t SET id=(SELECT * FROM t1); -drop table t; +drop table t, t1; #NULL test @@ -408,4 +429,51 @@ select 1.5 > ALL (SELECT * from t); select 10.5 > ALL (SELECT * from t); select 1.5 > ANY (SELECT * from t); select 10.5 > ANY (SELECT * from t); +explain select (select a+1) from t; +select (select a+1) from t; +drop table t; + +#LIMIT is not supported now +create table t (a float); +-- error 1235 +select 10.5 IN (SELECT * from t LIMIT 1); +-- error 1235 +select 10.5 IN (SELECT * from t LIMIT 1 UNION SELECT 1.5); drop table t; + +create table t1 (a int, b int, c varchar(10)); +create table t2 (a int); +insert into t1 values (1,2,'a'),(2,3,'b'),(3,4,'c'); +insert into t2 values (1),(2),(NULL); +select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a'),(select c from t1 where a=t2.a) from t2; +select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b'),(select c from t1 where a=t2.a) from t2; +select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c'),(select c from t1 where a=t2.a) from t2; +drop table t1,t2; + +create table t1 (a int, b real, c varchar(10)); +insert into t1 values (1, 1, 'a'), (2,2,'b'), (NULL, 2, 'b'); +select ROW(1, 1, 'a') IN (select a,b,c from t1); +select ROW(1, 2, 'a') IN (select a,b,c from t1); +select ROW(1, 1, 'a') IN (select b,a,c from t1); +select ROW(1, 1, 'a') IN (select a,b,c from t1 where a is not null); +select ROW(1, 2, 'a') IN (select a,b,c from t1 where a is not null); +select ROW(1, 1, 'a') IN (select b,a,c from t1 where a is not null); +select ROW(1, 1, 'a') IN (select a,b,c from t1 where c='b' or c='a'); +select ROW(1, 2, 'a') IN (select a,b,c from t1 where c='b' or c='a'); +select ROW(1, 1, 'a') IN (select b,a,c from t1 where c='b' or c='a'); +-- error 1235 +select ROW(1, 1, 'a') IN (select b,a,c from t1 limit 2); +drop table t1; + +create table t1 (a int); +insert into t1 values (1); +do @a:=(SELECT a from t1); +select @a; +set @a:=2; +set @a:=(SELECT a from t1); +select @a; +drop table t1; +-- error 1146 +do (SELECT a from t1); +-- error 1146 +set @a:=(SELECT a from t1); diff --git a/mysql-test/t/symlink.test b/mysql-test/t/symlink.test index 586761921b8..67126930e60 100644 --- a/mysql-test/t/symlink.test +++ b/mysql-test/t/symlink.test @@ -3,10 +3,14 @@ disable_query_log; show variables like "have_symlink"; enable_query_log; +--disable_warnings +drop table if exists t1,t2,t7,t8,t9; +--enable_warnings + # # First create little data to play with # -drop table if exists t1,t2,t7,t8,t9; + create table t1 (a int not null auto_increment, b char(16) not null, primary key (a)); create table t2 (a int not null auto_increment, b char(16) not null, primary key (a)); insert into t1 (b) values ("test"),("test1"),("test2"),("test3"); diff --git a/mysql-test/t/tablelock.test b/mysql-test/t/tablelock.test index fa8c4f03675..fbc5d685096 100644 --- a/mysql-test/t/tablelock.test +++ b/mysql-test/t/tablelock.test @@ -2,7 +2,10 @@ # Test of lock tables # +--disable_warnings drop table if exists t1,t2; +--enable_warnings + create table t1 ( n int auto_increment primary key); lock tables t1 write; insert into t1 values(NULL); diff --git a/mysql-test/t/temp_table.test b/mysql-test/t/temp_table.test index 665e690a322..03b6fa35bfa 100644 --- a/mysql-test/t/temp_table.test +++ b/mysql-test/t/temp_table.test @@ -2,7 +2,10 @@ # Test of temporary tables # +--disable_warnings drop table if exists t1,t2; +--enable_warnings + CREATE TABLE t1 (c int not null, d char (10) not null); insert into t1 values(1,""),(2,"a"),(3,"b"); CREATE TEMPORARY TABLE t1 (a int not null, b char (10) not null); @@ -34,7 +37,6 @@ drop table t1; # Test CONCAT_WS with temporary tables # -drop table if exists t1; CREATE TABLE t1 (pkCrash INTEGER PRIMARY KEY,strCrash VARCHAR(255)); INSERT INTO t1 ( pkCrash, strCrash ) VALUES ( 1, '1'); SELECT CONCAT_WS(pkCrash, strCrash) FROM t1; @@ -74,8 +76,6 @@ drop table t1; # In MySQL 4.0.4 doing a GROUP BY on a NULL column created a disk based # temporary table when a memory based one would be good enough. -drop table if exists t1; - CREATE TABLE t1 ( d datetime default NULL ) TYPE=MyISAM; diff --git a/mysql-test/t/truncate.test b/mysql-test/t/truncate.test index eeb79f497fa..dd80baba269 100644 --- a/mysql-test/t/truncate.test +++ b/mysql-test/t/truncate.test @@ -1,7 +1,10 @@ # # Test of truncate # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (a integer, b integer,c1 CHAR(10)); insert into t1 (a) values (1),(2); truncate table t1; diff --git a/mysql-test/t/type_blob.test b/mysql-test/t/type_blob.test index 234daeabc2b..6a55c61f8a1 100644 --- a/mysql-test/t/type_blob.test +++ b/mysql-test/t/type_blob.test @@ -1,7 +1,10 @@ # # Basic cleanup # +--disable_warnings drop table if exists t1,t2,t3,t4,t5,t6,t7; +--enable_warnings + # # Check syntax for creating BLOB/TEXT @@ -23,7 +26,11 @@ drop table t1,t2,t3 CREATE TABLE t1 (a char(257) default "hello"); --error 1101 CREATE TABLE t2 (a blob default "hello"); + +# Safety to be able to continue with other tests if above fails +--disable_warnings drop table if exists t1,t2; +--enable_warnings # # test of full join with blob diff --git a/mysql-test/t/type_date.test b/mysql-test/t/type_date.test index 68c2d55aac9..6319a3990e6 100644 --- a/mysql-test/t/type_date.test +++ b/mysql-test/t/type_date.test @@ -1,6 +1,10 @@ # # test of problem with date fields # +--disable_warnings +drop table if exists t1,t2; +--enable_warnings + create table t1 (a char(16), b date, c datetime); insert into t1 SET a='test 2000-01-01', b='2000-01-01', c='2000-01-01'; select * from t1 where c = '2000-01-01'; @@ -11,7 +15,6 @@ drop table t1; # problem with date conversions # -drop table if exists t1,t2; CREATE TABLE t1 (name char(6),cdate date); INSERT INTO t1 VALUES ('name1','1998-01-01'); INSERT INTO t1 VALUES ('name2','1998-01-01'); diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test index 991f11e86ea..f791cd76d34 100644 --- a/mysql-test/t/type_datetime.test +++ b/mysql-test/t/type_datetime.test @@ -2,7 +2,10 @@ # testing different DATETIME ranges # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (t datetime); insert into t1 values(101),(691231),(700101),(991231),(10000101),(99991231),(101000000),(691231000000),(700101000000),(991231235959),(10000101000000),(99991231235959); select * from t1; diff --git a/mysql-test/t/type_decimal.test b/mysql-test/t/type_decimal.test index 7f73ec34e3a..9b10e8943ad 100644 --- a/mysql-test/t/type_decimal.test +++ b/mysql-test/t/type_decimal.test @@ -1,6 +1,9 @@ # bug in decimal() with negative numbers by kaido@tradenet.ee +--disable_warnings DROP TABLE IF EXISTS t1; +--enable_warnings + CREATE TABLE t1 ( id int(11) DEFAULT '0' NOT NULL auto_increment, datatype_id int(11) DEFAULT '0' NOT NULL, diff --git a/mysql-test/t/type_enum.test b/mysql-test/t/type_enum.test index 8f399e4364e..49ba73acaa8 100644 --- a/mysql-test/t/type_enum.test +++ b/mysql-test/t/type_enum.test @@ -2,7 +2,10 @@ # Problem with many enums # +--disable_warnings DROP TABLE if exists t1; +--enable_warnings + CREATE TABLE t1 ( field enum('001001','001004','001010','001018','001019','001020','001021','001027','001028','001029','001030','001031','001100','002003','002004','002005','002007','002008','002009','002012','002013','002014','003002','003003','003004','003005','003006','003007','003008','003009','003010','003011','003012','003013','003014','003015','003016','003017','003018','003019','004002','004003','004005','004006','004007','004008','004010','004012','004014','004016','004017','004020','004021','004022','004023','004024','004025','004026','006002','006004','006006','006010','006011','006012','006013','006014','007001','007002','007003','007004','007005','007006','007007','007008','007009','007010','007011','007012','007013','007014','007015','007016','007017','007018','007019','007020','007021','007022','007023','007024','007025','007026','007027','007028','007029','007030','007031','007032','007033','007034','007035','007036','007037','007038','007039','007040','007043','007044','009001','009002','009004','009005','009006','009007','009008','009009','009010','009011','009012','009013','010002','010003','010004','010005','010006','010007','010008','010009','010010','010011','010012','010013','010015','010016','010017','010018','010019','010020','010021','010022','010023','010024','010025','010026','010027','010028','011001','011002','011003','011004','011006','011012','011013','011014','011015','011016','012017','012018','012019','012023','012027','012028','012029','012030','012031','012032','012033','012034','012035','012036','012037','012038','012039','014001','016002','016003','016004','016007','016010','016011','016016','016019','016020','016021','016022','016023','016024','016026','016027','016028','016029','016030','016031','016032','016033','016034','017002','018001','019002','019004','020001','020003','020004','020005','020006','020007','020008','020009','022001','022002','022003','023001','023002','023003','023004','023005','023006','023007','023008','023010','023011','023012','023017','023019','023020','023021','023025','023026','023027','023028','023029','023030','023031','023032','023033','023034','023035','025001','025003','025004','025005','025006','025007','025008','025009','025010','025011','025012','025013','025014','025015','025016','025017','025018','025019','025020','025021','025022','025023','025024','025025','025026','025027','025028','025029','025030','025031','025032','025033','025034','025035','025036','025037','025038','025039','025040','025041','025042','025043','025044','025045','025046','025047','025048','025049','025050','025051','025052','025053','025054','025055','025056','025057','025058','025059','025060','025061','025062','025063','027001','027002','027011','035008','035012','036001','037001','037003','037004','037005','037006','037007','037008','037009','038004','038005','038006','038007','038009','039001','039002','039003','039004','039005','039006','046001','046002','046003','046004','046005','046007','046008','046009','046010','046011','046012','046013','046014','047001','047002','048001','051001','051002','051003','051004','052001','052002','052005','053015','053016','053019','053020','053023','053024','053026','053028','053029','053033','053034','053036','053037','053038','053039','053041','053042','053043','053045','053046','053047','053048','053051','053052','053054','053055','053056','053057','053068','053069','053070','053073','053074','053075','053086','053094','053095','053096','053097','053098','053099','053100','053101','053102','053103','053104','053105','053107','053122','053123','053124','053125','053127','053128','054001','054002','054003','054004','054005','054006','054007','054009','054010','056001','056002','056003','056004','056005','056006','056009','056010','056011','056016','056017','056018','056019','056020','056021','056022','057001','057002','057003','057004','058002','058003','058004','058005','060001','060003','060004','060005','060006','060007','061002','061003','061004','061005','061006','069006','069007','069010','069011','069012','069013','069014','069015','069016','069017','069018','069020','069021','069022','069023','069024','071002','071003','071004','071005','071006','071008','071011','071013','071020','071021','071022','072001','073001','073002','073003','073004','074001','074002','074003','074004','074005','074006','074007','074008','074009','074010','074011','074012','075001','075007','076101','076102','076103','077001','077002','077003','077004','077006','077007','077008','077009','078005','079002','079003','079004','079005','079006','079007','081001','082006','082007','082011','082013','082014','082015','082016','082017','082021','082022','082023','082024','082025','082026','082027','082028','082029','082030','082031','082032','082033','082034','082035','082036','082037','082038','082039','082040','082041','082042','082043','082044','084001','084002','084003','084004','084005','084007','084008','084009','084011','084013','084014','084016','084017','084027','084031','084032','084033','084035','084036','084037','084038','084039','084040','084041','084042','084043','084044','084045','084046','084047','084048','084049','084050','084051','085001','085002','085003','085004','085005','085006','085007','085009','085011','085012','085013','085014','085015','085016','085017','085018','085019','085020','085021','085022','085023','085028','085029','085030','085031','085033','085034','085035','085036','085037','085038','085040','085041','085042','085043','085044','085045','085046','085047','085048','085063','085064','085065','085068','085070','085071','085073','085082','085083','085086','085088','085089','085090','085091','085092','085093','085094','085095','085096','085097','085098','085099','085100','085101','085102','085103','085104','085105','085106','085107','085108','085109','085110','085111','085112','085113','085115','085119','085120','085121','085122','085123','085124','085125','085126','085127','085128','085129','085130','085132','085133','085134','085135','085136','085137','086001','086002','086003','086004','086005','088001','088003','088005','088006','088007','088008','088009','089001','090001','090002','090003','090004','090005','090006','090007','090008','090009','090010','090013','090015','090016','090017','090018','090019','090022','090027','090028','091001','091002','091005','091008','091009','091010','091011','091012','091013','091014','091015','091016','091017','091018','093001','093003','093098','093100','093102','093104','093141','093142','093146','093151','093153','093167','093168','093176','094001','094002','094004','094005','095004','099001','099002','100001','101001','102002','102003','105001','105002','106001','113001','113002','113003','113004','113005','113006','113007','113008','113009','113010','113011','113012','113013','113014','113015','113016','113017','113018','113019','113020','113021','113022','113023','113024','113025','113026','113027','113028','114001','115001','115002','115003','115004','115005','115006','115007','115008','115009','115010','115011','115012','115013','115014','115015','115016','115017','115018','115020','115021','115022','115023','115025','115026','115027','115028','115029','115030','115031','115032','115033','115034','115035','115036','115039','115040','115041','115042','115043','115044','115045','115046','115047','115048','115049','115050','115051','115052','115053','115054','115055','115056','115057','115059','115060','115061','115062','115063','115064','115065','115066','115067','115068','115069','115070','115071','115072','115073','115075','115076','115081','115082','115085','115086','115087','115088','115095','115096','115097','115098','115099','115101','115102','115103','115104','115105','115106','115108','115109','115110','115111','115112','115113','115114','115115','115116','115117','115118','115119','115120','115121','115122','116001','116002','116003','116004','116005','116006','116007','116008','116009','116010','116011','116012','117001','117002','117003','123001','124010','124014','124015','124019','124024','124025','124026','124027','124028','124029','124030','124031','124032','124033','124035','124036','124037','124038','124039','124040','124041','124042','124043','124044','124045','124046','124047','124048','124049','124050','124051','124052','124053','124054','124055','124056','124057','124058','124059','124060','124061','124062','124063','124064','124065','126001','126002','126003','126004','126005','126006','126007','126008','126009','126010','126011','126012','130001','132001','132002','132003','133001','133008','133009','133010','133011','133012','133013','133014','133015','133016','133017','133018','133019','133020','133021','133022','133023','133024','133025','133027','133028','133029','133030','133031','134001','135001','135002','135003','135004','135005','135006','135007','135008','135009','135010','136001','137009','137010','137011','137012','137013','137014','137015','137016','137017','137018','137019','138001','138002','138003','138004','139001','139003','140001','141001','141002','141003','141006','141007','141008','141009','141011','141012','141014','141015','141016','141017','141018','141019','141020','141021','141022','141023','141024','141025','141026','141027','141028','142001','142002','142003','142004','142005','142006','142007','142008','142010','142011','142012','144001','145001','145002','145003','145004','145005','145006','145007','145008','145009','145010','145011','145012','145013','145014','145015','145016','147001','150003','150005','150009','150013','150014','150015','150016','150017','150020','150021','152001','152002','152003','152004','152005','152006','152007','154001','154002','154003','155001','155002','155003','155004','155005','155006','159001','159002','159003','159004','160001','160002','160003','161001','162001','162002','162003','162004','162007','162010','162011','162012','163001','163002','163003','163005','163010','163011','163014','163015','163016','165001','165002','165003','165004','165005','165006','165007','165008','165009','165010','165011','165012','165013','165014','165015','165016','165017','165018','165019','165020','165021','165022','165023','165024','165025','165026','165027','165028','165029','165030','165031','165032','165033','165034','165035','165036','167001','168001','168002','168003','168004','168005','168007','168008','168009','168010','168011','168012','168013','168014','169001','169002','169003','169007','169008','169009','169010','170001','171001','171002','171003','171004','171005','171006','171007','171008','171009','172001','174001','174002','174003','176001','176002','176003','177001','177002','179001','179002','179003','179004','179005','179006','179007','179008','179009','179010','179011','179012','179013','179014','179015','179016','179017','179018','179019','179020','179021','179022','179023','179024','179025','179026','179027','179028','179029','179030','179031','179032','179033','179034','179035','179036','179037','179038','179039','179040','179041','179042','179043','179044','179045','179046','179047','180001','180010','180012','180013','180014','180015','180016','180017','180018','180019','180020','180021','180022','180023','180024','180025','180026','180027','180028','180030','180031','180032','180033','180034','180035','180036','180037','180038','180039','180041','180042','180043','180044','180045','180046','180047','180048','180049','180050','180051','180052','180053','180054','180055','180056','180057','180058','180059','180060','180061','180062','180063','180064','180065','180066','180067','180068','180069','180070','180071','182001','184001','184002','184005','184006','184007','184008','184009','184010','184011','185001','185003','187001','188001','188002','188003','188004','188005','188006','188007','188008','188009','188010','188011','191001','191002','192002','194001','194002','194003','194004','194005','194006','194007','195001','195002','195003','195004','195005','195006','195007','196001','196002','197001','197002','197003','197004','197005','197006','198001','198003','198004','198005','198006','198007','198008','198009','198010','198011','198012','198013','198014','198015','198016','198017','201001','201002','201005','202001','203001','203002','203003','203017','203018','203019','204001','204002','204003','205001','208001','208002','208003','208004','208005','209001','209002','209003','210001','210002','210003','210004','210005','210006','210007','210008','210009','210010','210011','210012','210013','211017','212001','212002','212003','212004','212005','212006','212007','212008','212009','212010','212011','212012','212013','218001','218003','218004','218006','218007','218008','218009','218011','218015','218016','218017','218018','218019','218020','218021','218022','218023','218024','218025','218026','218027','218028','218029','218030','218031','218032','218033','218034','218035','218036','221001','221002','221003','221004','221005','221006','221007','221008','221009','221010','221011','221012','221013','223001','223002','223003','224001','224002','224003','224006','224007','224008','225001','225002','225003','225004','225005','225006','225007','225008','225009','225010','225011','225012','225013','226001','226002','226003','226004','226005','226006','226007','226008','226009','227001','227002','227003','227004','227005','227006','227007','227008','227009','227010','227011','227012','227013','227014','227015','227016','227017','227018','227019','227020','227021','227022','227023','227024','227025','227026','227027','227028','227029','227030','227031','227032','227033','227034','227035','227036','227037','227038','227039','227040','227041','227042','227043','227044','227045','227046','227047','227048','227049','227050','227051','227052','227053','227054','227055','227056','227057','227058','227059','227060','227061','227062','227063','227064','227065','227066','227067','227068','227069','227070','227071','227072','227073','227074','227075','227076','227077','227078','227079','227080','227081','227082','227083','227084','227085','227086','227087','227088','227089','227090','227091','227092','227093','227094','227095','227096','227097','227098','227099','227100','227101','227102','227103','227104','227105','227106','227107','227108','227109','227110','227111','227112','227113','227114','227115','227116','227117','227118','227119','227120','227122','227123','227124','227125','227126','227127','227128','227129','227130','227131','227132','227133','227134','227135','227136','227137','227138','227139','227140','227141','227142','227143','227144','227145','227146','227147','227148','227149','227150','227151','227152','228001','229001','229002','229003','229004','229005','230001','230002','232001','233001','233002','233003','233004','233005','233006','233007','233008','234001','234002','234003','234004','234005','234006','234007','234008','234009','234010','234011','234012','234013','234014','234015','234016','234017','234018','234019','234020','234021','234022','234023','234024','234025','234026','234027','234028','234029','234030','235001','235002','235003','235004','235005','236001','236002','236003','237001','238002','238003','238004','238005','238006','238007','238008','333013','333014','333015','333016','333017','333018','333019','333020','333021','333022','333023','333024','333025','333030','333031','333032','333033','333034','333035','334001','334002','334003','334004','334005','334006','334007','336004','337001','337002','337003','337004','339001','339002','343001','344001','344002','344003','344004','344005','345001','345002','345003','347001','347002','348001','348002','348003','348004','348005','349001','349002','349003','350001','353001','353002','353003','353004','355001','355002','355003','355004','355005','355006','356001','358001','359001','359002','360001','360002','360003','360004','360005','366001','366002','366003','366004','369001','373001','373002','373003','373004','373005','373006','373007','373008','373009','373010','373011','373012','373013','373014','373015','373016','373017','373018','373019','373020','373021','374001','374002','374003','374004','374005','374006','374007','374008','374009','374010','374011','374012','374013','374014','374015','374016','376001','376002','376003','376004','376005','376006','376007','376008','376009','376010','376011','376012','376013','376016','376017','376018','376019','376020','376021','379003','382001','382002','383001','384001','384002','385001','385002','386001','386002','386003','386004','386005','386006','386007','386008','386009','386010','386011','386012','386013','386014','387001','389001','389002','389003','389004','392001','393001','393002','393003','393004','395001','396001','397001','397002','399001','399002','399003','400001','400002','401001','401002','401003','402001','402002','402003','402004','402005','403001','403002','403003','504001','504002','504004','504005','504006','504007','504008','504009','504010','504011','504012','504013','504014','504017','504018','504019','504021','504022','504023','504024','504025','506001','506002','508001','508002','511001','511002','511003','511004','511005','511006','511007','511008','511009','511010','511011','511012','511013','511014','511017','511018','511020','511021','511022','511024','511028','511029','513001','513002','513003','513004','514001','515001','515002','515003','515007','515008','515009','515010','515011','515012','515013','515014','515015','518001','518002','518003','520001','520002','521001','521002','521003','521004','521005','521006','521007','521008','521009','521010','521011','521012','521013','521014','521015','521016','523001','523002','523003','523004','523005','523006','523007','524001','700001','701001','701002','701003','702001','702002','702003','702004','702005','702006','702007','702008','703001','703002','703003','704001','704002','704003','704004','705001','706001','706002','707001','707002','707003','708001','709001','709002','710001','710002','711001','711002','712001','713001','713002','714001','714002','715001','716001','718001','718002','719001','719002','991001','991002','991003','991004','991005','991006','991007','991008','992001','995001','996001','996002','996003','998001','998002','998003','998004','998005','998006','998007','999001','999002','011017','011018','034001','034002','071010','208006','239001','519001','519003','126013','184012','053071','374017','374018','374019','374020','374021','404001','405002','405001','405003','405007','405006','405005','405004','240011','240010','240009','240008','240007','240006','240005','240004','240003','240002','240001','240012','240013','240014','240015','240016','240017','357001','235006','235007','712002','355008','355007','056023','999999','046015','019005','126014','241003','241002','241001','240018','240020','240019','242001','242002','242003','242004','242005','242006','089002','406001','406002','406003','406004','406005','406006','243001','243002','243003','243004','243005','243006','243007','243008','010030','010029','407001','407006','407005','407004','407003','407002','408001','366005','133032','016035','077010','996004','025064','011019','407007','407008','407009','409001','115123','504026','039007','039009','039008','039010','039011','039012','180072','240021','240023','408002','405008','235008','525001','525002','525003','525004','410001','410002','410003','410004','410005','410006','410007','410008','410009','410010','410011','410012','410013','410014','410015','410016','344006','240031','240030','240029','240028','240027','240026','240025','240024','240034','240033','240032','410017','410018','411001','411002','411003','411004','411005','411006','411007','411008','203020','203021','203022','412001','412002','412003','412004','069025','244001','244002','244009','244008','244007','244006','244005','244004','244003','244015','244014','244013','244012','244011','244010','244016','244017','240042','240041','240040','240039','240038','240037','240036','240035','405009','405010','240043','504034','504033','504032','504031','504030','504029','504028','504027','504042','504041','504040','504039','504038','504037','504036','504035','800001','410019','410020','410021','244018','244019','244020','399004','413001','504043','198018','198019','344007','082045','010031','010032','010033','010034','010035','504044','515016','801002','801003','801004','801005','802001','801001','414001','414002','414003','141029','141030','803001','803002','803003','803004','803005','803006','803007','803008','803009','803010','803011','803012','803013','803014','803015','803016','803017','410022','410023','803018','803019','803020','415002','415001','244021','011020','011023','011022','011021','025065','165037','165038','165039','416001','416002','416003','417001','418001','504045','803022','803021','240022','419001','420001','804010','804009','804008','804007','804006','804005','804004','804003','804002','804001','804020','804019','804018','804017','804016','804015','804014','804013','804012','804011','804024','804021','804023','804022','511019','511016','511015','511032','511031','511030','511027','511026','511025','511033','511023','133034','133033','169011','344008','344009','244022','244026','244025','244030','244023','244024','244027','244028','244029','244031','082046','082047','082048','126015','126016','416004','416005','421001','421002','016037','016036','115124','115125','115126','240049','240048','240047','240046','240045','240044','244032','244033','422001','422002','422003','422004','422005','184013','239002','805001','805002','805003','805004','805005','056024','423001','344010','235009','212014','056025','056026','802002','244034','244035','244036','244037','244038','244039','515017','504046','203015','245002','245001','071023','056027','056028','056029','056030','056031','056032','424001','056034','056033','805006','805007','805008','805009','805010','422008','422007','422006','422010','422009','422011','209004','150022','150023','100002','056035','023036','185004','185005','246001','247001','247002','425001','416006','165042','165041','165040','165043','010040','010039','010038','010037','010036','422012','422013','422014','422015','426000','248001','248002','248003','248004','248005','249001','249002','249003','249004','249005','249006','250007','250001','250002','250003','250004','250005','250006','250008','250009','250010','250011','250012','250013','251001','251002','422016','422017','422018','806001','806002','116013','235010','235011','091026','091027','091028','091029','091019','091020','091021','091022','091023','091024','091025','252001','243009','249007','249008','249009','011024','011025','427001','428002','428001','169012','429001','429002','429003') DEFAULT '001001' NOT NULL, KEY field (field) diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test index 23941ad2913..f6281ca6c21 100644 --- a/mysql-test/t/type_float.test +++ b/mysql-test/t/type_float.test @@ -2,11 +2,14 @@ # ----------- # Numeric floating point. +--disable_warnings +drop table if exists t1; +--enable_warnings + SELECT 10,10.0,10.,.1e+2,100.0e-1; 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; -drop table if exists t1; 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); @@ -44,6 +47,8 @@ drop table t1; # Errors -!$1063 create table t1 (f float(54)); # Should give an error +--error 1063 +create table t1 (f float(54)); # Should give an error +--disable_warnings drop table if exists t1; - +--enable_warnings diff --git a/mysql-test/t/type_ranges.test b/mysql-test/t/type_ranges.test index a07a1d97f37..53bfb063b2c 100644 --- a/mysql-test/t/type_ranges.test +++ b/mysql-test/t/type_ranges.test @@ -2,7 +2,9 @@ # Test ranges for all types and some other basic tests # +--disable_warnings drop table if exists t1,t2,t3; +--enable_warnings CREATE TABLE t1 ( auto int(5) unsigned DEFAULT 0 NOT NULL auto_increment, diff --git a/mysql-test/t/type_set.test b/mysql-test/t/type_set.test index 7f1a75e5dbd..4505e3f747b 100644 --- a/mysql-test/t/type_set.test +++ b/mysql-test/t/type_set.test @@ -2,7 +2,10 @@ # Test of SET with space # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (a set (' ','a','b') not null); show create table t1; drop table t1; diff --git a/mysql-test/t/type_time.test b/mysql-test/t/type_time.test index 2496ec36915..2f342f8bf67 100644 --- a/mysql-test/t/type_time.test +++ b/mysql-test/t/type_time.test @@ -1,7 +1,11 @@ # # testing of the TIME column type # + +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (t time); insert into t1 values("10:22:33"),("12:34:56.78"),(10),(1234),(123456.78),(1234559.99),("1"),("1:23"),("1:23:45"), ("10.22"), ("-10 1:22:33.45"),("20 10:22:33"),("1999-02-03 20:33:34"); insert t1 values (30),(1230),("1230"),("12:30"),("12:30:35"),("1 12:30:31.32"); diff --git a/mysql-test/t/type_timestamp.test b/mysql-test/t/type_timestamp.test index c51d439fde4..1c9275ecd0a 100644 --- a/mysql-test/t/type_timestamp.test +++ b/mysql-test/t/type_timestamp.test @@ -2,7 +2,10 @@ # Test timestamp # +--disable_warnings drop table if exists t1,t2; +--enable_warnings + CREATE TABLE t1 (a int, t timestamp); CREATE TABLE t2 (a int, t datetime); SET TIMESTAMP=1234; diff --git a/mysql-test/t/type_uint.test b/mysql-test/t/type_uint.test index 32bcd61ecdb..b4c88eae95d 100644 --- a/mysql-test/t/type_uint.test +++ b/mysql-test/t/type_uint.test @@ -2,7 +2,10 @@ # test of unsigned int # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (this int unsigned); insert into t1 values (1); insert into t1 values (-1); diff --git a/mysql-test/t/type_year.test b/mysql-test/t/type_year.test index 8f4f23badb4..9922df447fc 100644 --- a/mysql-test/t/type_year.test +++ b/mysql-test/t/type_year.test @@ -1,7 +1,10 @@ # # Test year # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (y year,y2 year(2)); insert into t1 values (0,0),(1999,1999),(2000,2000),(2001,2001),(70,70),(69,69); select * from t1; diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test index 449bafbdef6..b46f54c5c41 100644 --- a/mysql-test/t/union.test +++ b/mysql-test/t/union.test @@ -2,7 +2,10 @@ # Test of unions # +--disable_warnings drop table if exists t1,t2,t3; +--enable_warnings + CREATE TABLE t1 (a int not null, b char (10) not null); insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c'); CREATE TABLE t2 (a int not null, b char (10) not null); @@ -88,7 +91,7 @@ SELECT pseudo1 FROM t1 WHERE pseudo='joce' UNION SELECT pseudo FROM t1 WHERE pse SELECT pseudo1 FROM t1 WHERE pseudo='joce' UNION ALL SELECT pseudo FROM t1 WHERE pseudo1='joce'; SELECT pseudo1 FROM t1 WHERE pseudo='joce' UNION SELECT 1; drop table t1; -drop table if exists t1,t2; + create table t1 (a int); create table t2 (a int); insert into t1 values (1),(2),(3),(4),(5); diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test index 5cbbd2a350e..31d22c1f850 100644 --- a/mysql-test/t/update.test +++ b/mysql-test/t/update.test @@ -2,7 +2,10 @@ # test of updating of keys # -drop table if exists t1; +--disable_warnings +drop table if exists t1,t2; +--enable_warnings + create table t1 (a int auto_increment , primary key (a)); insert into t1 values (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL); update t1 set a=a+10 where a > 34; @@ -85,5 +88,8 @@ create table t1 (a int not null, b int not null); insert into t1 values (1,1),(1,2),(1,3); update t1 set b=4 where a=1 order by b asc limit 1; update t1 set b=4 where a=1 order by b desc limit 1; +create table t2 (a int not null, b int not null); +insert into t2 values (1,1),(1,2),(1,3); select * from t1; -drop table t1; +update t1 set b=(select distinct 1 from (select * from t2) a); +drop table t1,t2; diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test index bb1a9b59611..6260db8c370 100644 --- a/mysql-test/t/user_var.test +++ b/mysql-test/t/user_var.test @@ -1,11 +1,15 @@ -error 1054; +# Initialise +--disable_warnings +drop table if exists t1,t2; +--enable_warnings + +--error 1054 set @a := foo; set @a := connection_id() + 3; select @a - connection_id(); # Check using and setting variables with SELECT DISTINCT -drop table if exists t1,t2; CREATE TABLE t1 ( i int not null, v int not null,index (i)); insert into t1 values (1,1),(1,3),(2,1); create table t2 (i int not null, unique (i)); diff --git a/mysql-test/t/varbinary.test b/mysql-test/t/varbinary.test index cc9ee99b7f9..d58954a189b 100644 --- a/mysql-test/t/varbinary.test +++ b/mysql-test/t/varbinary.test @@ -1,3 +1,8 @@ +# Initialise +--disable_warnings +drop table if exists t1; +--enable_warnings + # # varbinary as string and number # @@ -10,7 +15,6 @@ select x'31',X'ffff'+0; # Test of hex constants in WHERE: # -drop table if exists t1; create table t1 (ID int(8) unsigned zerofill not null auto_increment,UNIQ bigint(21) unsigned zerofill not null,primary key (ID),unique (UNIQ) ); insert into t1 set UNIQ=0x38afba1d73e6a18a; insert into t1 set UNIQ=123; diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index 552777743f8..39aa5a20a71 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -1,7 +1,10 @@ # # test variables # -drop table if exists t1; +--disable_warnings +drop table if exists t1,t2; +--enable_warnings + set @`test`=1,@TEST=3,@select=2,@t5=1.23456; select @test,@`select`,@TEST,@not_used; set @test_int=10,@test_double=1e-10,@test_string="abcdeghi",@test_string2="abcdefghij",@select=NULL; @@ -34,13 +37,15 @@ drop table t1; set max_join_size=100; show variables like 'max_join_size'; -# Removed, because it has different value with/without BIG_TABLES -#show global variables like 'max_join_size'; +--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR +show global variables like 'max_join_size'; set GLOBAL max_join_size=2000; show global variables like 'max_join_size'; set max_join_size=DEFAULT; +--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR show variables like 'max_join_size'; set GLOBAL max_join_size=DEFAULT; +--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR show global variables like 'max_join_size'; set @@max_join_size=1000, @@global.max_join_size=2000; select @@local.max_join_size, @@global.max_join_size; @@ -227,7 +232,6 @@ set log_warnings=1; # key buffer # -DROP TABLE IF EXISTS t1,t2; create table t1 (a int not null auto_increment, primary key(a)); create table t2 (a int not null auto_increment, primary key(a)); insert into t1 values(null),(null),(null); diff --git a/mysql-test/t/warnings.test b/mysql-test/t/warnings.test index 5fb536def71..8cff8706c43 100644 --- a/mysql-test/t/warnings.test +++ b/mysql-test/t/warnings.test @@ -1,7 +1,10 @@ # # Test some warnings # +--disable-warnings drop table if exists t1; +--enable-warnings + create table t1 (a int); insert into t1 values (1); insert into t1 values ("hej"); @@ -11,3 +14,15 @@ insert into t1 values ("hej"); insert into t1 values ("hej"),("då"); drop table t1; set SQL_WARNINGS=0; + +# +# Test other warnings + +drop temporary table if exists not_exists; +drop table if exists not_exists_table; +show warnings limit 1; +drop database if exists not_exists_db; +show count(*) warnings; +create table t1(id int); +create table if not exists t1(id int); +select @@warning_count; diff --git a/mysys/Makefile.am b/mysys/Makefile.am index 330e1d6e59d..b93ddd2241d 100644 --- a/mysys/Makefile.am +++ b/mysys/Makefile.am @@ -50,7 +50,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c\ my_getopt.c my_mkdir.c \ default.c my_compress.c checksum.c raid.cc \ my_net.c my_semaphore.c my_port.c \ - my_vsnprintf.c charset.c my_bitmap.c my_bit.c md5.c \ + charset.c my_bitmap.c my_bit.c md5.c \ my_gethostbyname.c rijndael.c my_aes.c sha1.c \ my_handler.c EXTRA_DIST = thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c \ @@ -65,7 +65,6 @@ EXTRA_PROGRAMS = DEFS = -DDEFAULT_BASEDIR=\"$(prefix)\" \ -DDATADIR="\"$(MYSQLDATAdir)\"" \ -DDEFAULT_CHARSET_HOME="\"$(MYSQLBASEdir)\"" \ - -DDATADIR="\"$(MYSQLDATAdir)\"" \ -DSHAREDIR="\"$(MYSQLSHAREdir)\"" \ @DEFS@ @@ -104,6 +103,9 @@ test_dir: test_dir.c $(LIBRARIES) test_charset$(EXEEXT): test_charset.c $(LIBRARIES) $(LINK) $(FLAGS) -DMAIN $(srcdir)/test_charset.c $(LDADD) $(LIBS) +test_xml$(EXEEXT): test_xml.c $(LIBRARIES) + $(LINK) $(FLAGS) -DMAIN $(srcdir)/test_xml.c $(LDADD) $(LIBS) + charset2html$(EXEEXT): charset2html.c $(LIBRARIES) $(LINK) $(FLAGS) -DMAIN $(srcdir)/charset2html.c $(LDADD) $(LIBS) diff --git a/mysys/charset.c b/mysys/charset.c index cf0628495fc..c89e1d60c7e 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -19,121 +19,9 @@ #include <m_ctype.h> #include <m_string.h> #include <my_dir.h> +#include <my_xml.h> -const char *charsets_dir = NULL; -static int charset_initialized=0; - -#define MAX_LINE 1024 - -#define CTYPE_TABLE_SIZE 257 -#define TO_LOWER_TABLE_SIZE 256 -#define TO_UPPER_TABLE_SIZE 256 -#define SORT_ORDER_TABLE_SIZE 256 -#define TO_UNI_TABLE_SIZE 256 - -struct simpleconfig_buf_st { - FILE *f; - char buf[MAX_LINE]; - char *p; -}; - - -static my_bool get_word(struct simpleconfig_buf_st *fb, char *buf) -{ - char *endptr=fb->p; - - for (;;) - { - while (my_isspace(system_charset_info, *endptr)) - ++endptr; - if (*endptr && *endptr != '#') /* Not comment */ - break; /* Found something */ - if ((fgets(fb->buf, sizeof(fb->buf), fb->f)) == NULL) - return TRUE; /* end of file */ - endptr = fb->buf; - } - - while (!my_isspace(system_charset_info, *endptr)) - *buf++= *endptr++; - *buf=0; - fb->p = endptr; - - return FALSE; -} - - -char *get_charsets_dir(char *buf) -{ - const char *sharedir = SHAREDIR; - DBUG_ENTER("get_charsets_dir"); - - if (charsets_dir != NULL) - strmake(buf, charsets_dir, FN_REFLEN-1); - else - { - if (test_if_hard_path(sharedir) || - is_prefix(sharedir, DEFAULT_CHARSET_HOME)) - strxmov(buf, sharedir, "/", CHARSET_DIR, NullS); - else - strxmov(buf, DEFAULT_CHARSET_HOME, "/", sharedir, "/", CHARSET_DIR, - NullS); - } - convert_dirname(buf,buf,NullS); - DBUG_PRINT("info",("charsets dir='%s'", buf)); - DBUG_RETURN(strend(buf)); -} - - -static my_bool read_charset_index(myf myflags) -{ - struct simpleconfig_buf_st fb; - char buf[MAX_LINE], num_buf[MAX_LINE]; - - strmov(get_charsets_dir(buf), "Index"); - - if ((fb.f = my_fopen(buf, O_RDONLY, myflags)) == NULL) - return TRUE; - fb.buf[0] = '\0'; - fb.p = fb.buf; - - - while (!get_word(&fb, buf) && !get_word(&fb, num_buf)) - { - uint csnum; - uint length; - CHARSET_INFO *cs; - - if (!(csnum = atoi(num_buf))) - { - /* corrupt Index file */ - my_fclose(fb.f,myflags); - return TRUE; - } - - if (all_charsets[csnum]) - continue; - - if (!(cs=(CHARSET_INFO*) my_once_alloc(sizeof(cs[0]),myflags))) - { - my_fclose(fb.f,myflags); - return TRUE; - } - bzero(cs,sizeof(cs[0])); - - if (!(cs->name= (char*)my_once_alloc(length=(uint)strlen(buf)+1,myflags))) - { - my_fclose(fb.f,myflags); - return TRUE; - } - memcpy((char*)cs->name,buf,length); - cs->number=csnum; - all_charsets[csnum]=cs; - } - my_fclose(fb.f,myflags); - - return FALSE; -} static void set_max_sort_char(CHARSET_INFO *cs) { @@ -144,7 +32,7 @@ static void set_max_sort_char(CHARSET_INFO *cs) return; max_char=cs->sort_order[(uchar) cs->max_sort_char]; - for (i = 0; i < 256; i++) + for (i= 0; i < 256; i++) { if ((uchar) cs->sort_order[i] > max_char) { @@ -154,84 +42,37 @@ static void set_max_sort_char(CHARSET_INFO *cs) } } -static my_bool init_available_charsets(myf myflags) -{ - my_bool error=FALSE; - /* - We have to use charset_initialized to not lock on THR_LOCK_charset - inside get_internal_charset... - */ - if (!charset_initialized) - { - CHARSET_INFO **cs; - /* - To make things thread safe we are not allowing other threads to interfere - while we may changing the cs_info_table - */ - pthread_mutex_lock(&THR_LOCK_charset); - bzero(&all_charsets,sizeof(all_charsets)); - init_compiled_charsets(myflags); - - /* Copy compiled charsets */ - for (cs=all_charsets; cs < all_charsets+255 ; cs++) - { - if (*cs) - set_max_sort_char(*cs); - } - error = read_charset_index(myflags); - charset_initialized=1; - pthread_mutex_unlock(&THR_LOCK_charset); - } - return error; -} - - -void free_charsets(void) -{ - charset_initialized=0; -} - - -static my_bool fill_array(uchar *array, int sz, struct simpleconfig_buf_st *fb) -{ - char buf[MAX_LINE]; - while (sz--) - { - if (get_word(fb, buf)) - { - DBUG_PRINT("error",("get_word failed, expecting %d more words", sz + 1)); - return 1; - } - *array++ = (uchar) strtol(buf, NULL, 16); - } - return 0; -} - -static my_bool fill_uint16_array(uint16 *array, int sz, struct simpleconfig_buf_st *fb) +static void simple_cs_init_functions(CHARSET_INFO *cs) { - char buf[MAX_LINE]; - while (sz--) - { - if (get_word(fb, buf)) - { - DBUG_PRINT("error",("get_word failed, expecting %d more words", sz + 1)); - return 1; - } - *array++ = (uint16) strtol(buf, NULL, 16); - } - return 0; + cs->like_range = my_like_range_simple; + cs->wildcmp = my_wildcmp_8bit; + cs->strnncoll = my_strnncoll_simple; + cs->caseup_str = my_caseup_str_8bit; + cs->casedn_str = my_casedn_str_8bit; + cs->caseup = my_caseup_8bit; + cs->casedn = my_casedn_8bit; + cs->tosort = my_tosort_8bit; + cs->strcasecmp = my_strcasecmp_8bit; + cs->strncasecmp = my_strncasecmp_8bit; + cs->mb_wc = my_mb_wc_8bit; + cs->wc_mb = my_wc_mb_8bit; + cs->hash_caseup = my_hash_caseup_simple; + cs->hash_sort = my_hash_sort_simple; + cs->snprintf = my_snprintf_8bit; + cs->strntol = my_strntol_8bit; + cs->strntoul = my_strntoul_8bit; + cs->strntoll = my_strntoll_8bit; + cs->strntoull = my_strntoull_8bit; + cs->strntod = my_strntod_8bit; + cs->mbmaxlen = 1; } -static void get_charset_conf_name(const char *cs_name, char *buf) +typedef struct { - strxmov(get_charsets_dir(buf), cs_name, ".conf", NullS); -} - -typedef struct { - int nchars; - MY_UNI_IDX uidx; + int nchars; + MY_UNI_IDX uidx; } uni_idx; #define PLANE_SIZE 0x100 @@ -240,16 +81,18 @@ typedef struct { static int pcmp(const void * f, const void * s) { - const uni_idx *F=(const uni_idx*)f; - const uni_idx *S=(const uni_idx*)s; + const uni_idx *F= (const uni_idx*) f; + const uni_idx *S= (const uni_idx*) s; int res; - if(!(res=((S->nchars)-(F->nchars)))) + if (!(res=((S->nchars)-(F->nchars)))) res=((F->uidx.from)-(S->uidx.to)); return res; } -static my_bool create_fromuni(CHARSET_INFO *cs){ + +static my_bool create_fromuni(CHARSET_INFO *cs) +{ uni_idx idx[PLANE_NUM]; int i,n; @@ -257,14 +100,14 @@ static my_bool create_fromuni(CHARSET_INFO *cs){ bzero(idx,sizeof(idx)); /* Count number of characters in each plane */ - for(i=0;i<0x100;i++) + for (i=0; i< 0x100; i++) { uint16 wc=cs->tab_to_uni[i]; int pl= PLANE_NUMBER(wc); - if(wc || !i) + if (wc || !i) { - if(!idx[pl].nchars) + if (!idx[pl].nchars) { idx[pl].uidx.from=wc; idx[pl].uidx.to=wc; @@ -280,34 +123,37 @@ static my_bool create_fromuni(CHARSET_INFO *cs){ /* Sort planes in descending order */ qsort(&idx,PLANE_NUM,sizeof(uni_idx),&pcmp); - for(i=0;i<PLANE_NUM;i++) + for (i=0; i < PLANE_NUM; i++) { int ch,numchars; /* Skip empty plane */ - if(!idx[i].nchars) + if (!idx[i].nchars) break; numchars=idx[i].uidx.to-idx[i].uidx.from+1; - idx[i].uidx.tab=(unsigned char*)my_once_alloc(numchars*sizeof(*idx[i].uidx.tab),MYF(MY_WME)); + idx[i].uidx.tab=(unsigned char*)my_once_alloc(numchars * + sizeof(*idx[i].uidx.tab), + MYF(MY_WME)); bzero(idx[i].uidx.tab,numchars*sizeof(*idx[i].uidx.tab)); - for(ch=1;ch<PLANE_SIZE;ch++) + for (ch=1; ch < PLANE_SIZE; ch++) { uint16 wc=cs->tab_to_uni[ch]; - if(wc>=idx[i].uidx.from && wc<=idx[i].uidx.to && wc) + if (wc >= idx[i].uidx.from && wc <= idx[i].uidx.to && wc) { - int ofs=wc-idx[i].uidx.from; - idx[i].uidx.tab[ofs]=ch; + int ofs= wc - idx[i].uidx.from; + idx[i].uidx.tab[ofs]= ch; } } } /* Allocate and fill reverse table for each plane */ n=i; - cs->tab_from_uni=(MY_UNI_IDX*)my_once_alloc(sizeof(MY_UNI_IDX)*(n+1),MYF(MY_WME)); - for(i=0;i<n;i++) - cs->tab_from_uni[i]=idx[i].uidx; + cs->tab_from_uni= (MY_UNI_IDX*) my_once_alloc(sizeof(MY_UNI_IDX)*(n+1), + MYF(MY_WME)); + for (i=0; i< n; i++) + cs->tab_from_uni[i]= idx[i].uidx; /* Set end-of-list marker */ bzero(&cs->tab_from_uni[i],sizeof(MY_UNI_IDX)); @@ -315,93 +161,187 @@ static my_bool create_fromuni(CHARSET_INFO *cs){ } -static my_bool read_charset_file(const char *cs_name, CHARSET_INFO *set, - myf myflags) +static void simple_cs_copy_data(CHARSET_INFO *to, CHARSET_INFO *from) { - struct simpleconfig_buf_st fb; - char buf[FN_REFLEN]; - my_bool result; - DBUG_ENTER("read_charset_file"); - DBUG_PRINT("enter",("cs_name: %s", cs_name)); - - get_charset_conf_name(cs_name, buf); - DBUG_PRINT("info",("file name: %s", buf)); - - if ((fb.f = my_fopen(buf, O_RDONLY, myflags)) == NULL) - DBUG_RETURN(TRUE); - - fb.buf[0] = '\0'; /* Init for get_word */ - fb.p = fb.buf; - - result=FALSE; - if (fill_array(set->ctype, CTYPE_TABLE_SIZE, &fb) || - fill_array(set->to_lower, TO_LOWER_TABLE_SIZE, &fb) || - fill_array(set->to_upper, TO_UPPER_TABLE_SIZE, &fb) || - fill_array(set->sort_order, SORT_ORDER_TABLE_SIZE, &fb) || - fill_uint16_array(set->tab_to_uni,TO_UNI_TABLE_SIZE,&fb)) - result=TRUE; - - my_fclose(fb.f, MYF(0)); - DBUG_RETURN(result); + to->number= from->number ? from->number : to->number; + to->state|= from->state; + + if (from->csname) + to->csname= my_once_strdup(from->csname,MYF(MY_WME)); + + if (from->name) + to->name= my_once_strdup(from->name,MYF(MY_WME)); + + if (from->ctype) + to->ctype= (uchar*) my_once_memdup((char*) from->ctype, + MY_CS_CTYPE_TABLE_SIZE, MYF(MY_WME)); + if (from->to_lower) + to->to_lower= (uchar*) my_once_memdup((char*) from->to_lower, + MY_CS_TO_LOWER_TABLE_SIZE, MYF(MY_WME)); + if (from->to_upper) + to->to_upper= (uchar*) my_once_memdup((char*) from->to_upper, + MY_CS_TO_UPPER_TABLE_SIZE, MYF(MY_WME)); + if (from->sort_order) + { + to->sort_order= (uchar*) my_once_memdup((char*) from->sort_order, + MY_CS_SORT_ORDER_TABLE_SIZE, + MYF(MY_WME)); + set_max_sort_char(to); + } + if (from->tab_to_uni) + { + uint sz= MY_CS_TO_UNI_TABLE_SIZE*sizeof(uint16); + to->tab_to_uni= (uint16*) my_once_memdup((char*)from->tab_to_uni, sz, + MYF(MY_WME)); + create_fromuni(to); + } } -static CHARSET_INFO *add_charset(CHARSET_INFO *cs, myf flags) +static my_bool simple_cs_is_full(CHARSET_INFO *cs) { - uchar tmp_ctype[CTYPE_TABLE_SIZE]; - uchar tmp_to_lower[TO_LOWER_TABLE_SIZE]; - uchar tmp_to_upper[TO_UPPER_TABLE_SIZE]; - uchar tmp_sort_order[SORT_ORDER_TABLE_SIZE]; - uint16 tmp_to_uni[TO_UNI_TABLE_SIZE]; + return ((cs->csname && cs->tab_to_uni && cs->ctype && cs->to_upper && + cs->to_lower) && + (cs->number && cs->name && cs->sort_order)); +} - /* Note: cs->name and cs->number are already initialized */ - - cs->ctype=tmp_ctype; - cs->to_lower=tmp_to_lower; - cs->to_upper=tmp_to_upper; - cs->sort_order=tmp_sort_order; - cs->tab_to_uni=tmp_to_uni; - if (read_charset_file(cs->name, cs, flags)) - return NULL; - cs->ctype = (uchar*) my_once_alloc(CTYPE_TABLE_SIZE, MYF(MY_WME)); - cs->to_lower = (uchar*) my_once_alloc(TO_LOWER_TABLE_SIZE, MYF(MY_WME)); - cs->to_upper = (uchar*) my_once_alloc(TO_UPPER_TABLE_SIZE, MYF(MY_WME)); - cs->sort_order=(uchar*) my_once_alloc(SORT_ORDER_TABLE_SIZE, MYF(MY_WME)); - cs->tab_to_uni=(uint16*)my_once_alloc(TO_UNI_TABLE_SIZE*sizeof(uint16), MYF(MY_WME)); - memcpy((char*) cs->ctype, (char*) tmp_ctype, sizeof(tmp_ctype)); - memcpy((char*) cs->to_lower, (char*) tmp_to_lower, sizeof(tmp_to_lower)); - memcpy((char*) cs->to_upper, (char*) tmp_to_upper, sizeof(tmp_to_upper)); - memcpy((char*) cs->sort_order, (char*) tmp_sort_order, - sizeof(tmp_sort_order)); - memcpy((char*) cs->tab_to_uni, (char*) tmp_to_uni, sizeof(tmp_to_uni)); +static int add_collation(CHARSET_INFO *cs) +{ + if (cs->name && (cs->number || (cs->number=get_charset_number(cs->name)))) + { + if (!all_charsets[cs->number]) + { + if (!(all_charsets[cs->number]= + (CHARSET_INFO*) my_once_alloc(sizeof(CHARSET_INFO),MYF(0)))) + return MY_XML_ERROR; + bzero((void*)all_charsets[cs->number],sizeof(CHARSET_INFO)); + } + + if (!(all_charsets[cs->number]->state & MY_CS_COMPILED)) + { + simple_cs_copy_data(all_charsets[cs->number],cs); + if (simple_cs_is_full(all_charsets[cs->number])) + { + simple_cs_init_functions(all_charsets[cs->number]); + all_charsets[cs->number]->state |= MY_CS_LOADED; + } + } + cs->number= 0; + cs->name= NULL; + cs->state= 0; + cs->sort_order= NULL; + cs->state= 0; + } + return MY_XML_OK; +} + - cs->like_range = my_like_range_simple; - cs->wildcmp = my_wildcmp_8bit; - cs->strnncoll = my_strnncoll_simple; - cs->caseup_str = my_caseup_str_8bit; - cs->casedn_str = my_casedn_str_8bit; - cs->caseup = my_caseup_8bit; - cs->casedn = my_casedn_8bit; - cs->tosort = my_tosort_8bit; - cs->strcasecmp = my_strcasecmp_8bit; - cs->strncasecmp = my_strncasecmp_8bit; - cs->mb_wc = my_mb_wc_8bit; - cs->wc_mb = my_wc_mb_8bit; - cs->hash_caseup = my_hash_caseup_simple; - cs->hash_sort = my_hash_sort_simple; - cs->snprintf = my_snprintf_8bit; - cs->strntol = my_strntol_8bit; - cs->strntoul = my_strntoul_8bit; - cs->strntoll = my_strntoll_8bit; - cs->strntoull = my_strntoull_8bit; - cs->strntod = my_strntod_8bit; - cs->mbmaxlen = 1; +#define MAX_BUF 1024*16 +#define MY_CHARSET_INDEX "Index.xml" + +const char *charsets_dir= NULL; +static int charset_initialized=0; + + +static my_bool my_read_charset_file(const char *filename, myf myflags) +{ + char *buf; + int fd; + uint len; - set_max_sort_char(cs); - create_fromuni(cs); + if (!(buf= (char *)my_malloc(MAX_BUF,myflags))) + return FALSE; - return cs; + if ((fd=my_open(filename,O_RDONLY,myflags)) < 0) + { + my_free(buf,myflags); + return TRUE; + } + len=read(fd,buf,MAX_BUF); + my_close(fd,myflags); + + if (my_parse_charset_xml(buf,len,add_collation)) + { +#ifdef NOT_YET + printf("ERROR at line %d pos %d '%s'\n", + my_xml_error_lineno(&p)+1, + my_xml_error_pos(&p), + my_xml_error_string(&p)); +#endif + } + + my_free(buf, myflags); + return FALSE; +} + + +char *get_charsets_dir(char *buf) +{ + const char *sharedir= SHAREDIR; + DBUG_ENTER("get_charsets_dir"); + + if (charsets_dir != NULL) + strmake(buf, charsets_dir, FN_REFLEN-1); + else + { + if (test_if_hard_path(sharedir) || + is_prefix(sharedir, DEFAULT_CHARSET_HOME)) + strxmov(buf, sharedir, "/", CHARSET_DIR, NullS); + else + strxmov(buf, DEFAULT_CHARSET_HOME, "/", sharedir, "/", CHARSET_DIR, + NullS); + } + convert_dirname(buf,buf,NullS); + DBUG_PRINT("info",("charsets dir: '%s'", buf)); + DBUG_RETURN(strend(buf)); +} + +static my_bool init_available_charsets(myf myflags) +{ + char fname[FN_REFLEN]; + my_bool error=FALSE; + /* + We have to use charset_initialized to not lock on THR_LOCK_charset + inside get_internal_charset... + */ + if (!charset_initialized) + { + CHARSET_INFO **cs; + /* + To make things thread safe we are not allowing other threads to interfere + while we may changing the cs_info_table + */ + pthread_mutex_lock(&THR_LOCK_charset); + + bzero(&all_charsets,sizeof(all_charsets)); + init_compiled_charsets(myflags); + + /* Copy compiled charsets */ + for (cs=all_charsets; cs < all_charsets+255 ; cs++) + { + if (*cs) + set_max_sort_char(*cs); + } + + strmov(get_charsets_dir(fname), MY_CHARSET_INDEX); + error= my_read_charset_file(fname,myflags); + charset_initialized=1; + pthread_mutex_unlock(&THR_LOCK_charset); + } + return error; +} + + +void free_charsets(void) +{ + charset_initialized=0; +} + + +static void get_charset_conf_name(const char *cs_name, char *buf) +{ + strxmov(get_charsets_dir(buf), cs_name, ".conf", NullS); } @@ -411,10 +351,11 @@ uint get_charset_number(const char *charset_name) if (init_available_charsets(MYF(0))) /* If it isn't initialized */ return 0; - for (cs = all_charsets; cs < all_charsets+255; ++cs) + for (cs= all_charsets; cs < all_charsets+255; ++cs) + { if ( cs[0] && cs[0]->name && !strcmp(cs[0]->name, charset_name)) return cs[0]->number; - + } return 0; /* this mimics find_type() */ } @@ -426,7 +367,7 @@ const char *get_charset_name(uint charset_number) return "?"; cs=all_charsets[charset_number]; - if ( cs && (cs->number==charset_number) && cs->name ) + if (cs && (cs->number == charset_number) && cs->name ) return (char*) cs->name; return (char*) "?"; /* this mimics find_type() */ @@ -435,6 +376,7 @@ const char *get_charset_name(uint charset_number) static CHARSET_INFO *get_internal_charset(uint cs_number, myf flags) { + char buf[FN_REFLEN]; CHARSET_INFO *cs; /* To make things thread safe we are not allowing other threads to interfere @@ -442,23 +384,19 @@ static CHARSET_INFO *get_internal_charset(uint cs_number, myf flags) */ pthread_mutex_lock(&THR_LOCK_charset); - cs = all_charsets[cs_number]; - if (cs && !(cs->state & (MY_CS_COMPILED | MY_CS_LOADED))) - cs=add_charset(cs, flags); + cs= all_charsets[cs_number]; + if (cs && !(cs->state & (MY_CS_COMPILED | MY_CS_LOADED))) + { + strxmov(get_charsets_dir(buf), cs->csname, ".xml", NullS); + my_read_charset_file(buf,flags); + cs= (cs->state & MY_CS_LOADED) ? cs : NULL; + } pthread_mutex_unlock(&THR_LOCK_charset); return cs; } -static CHARSET_INFO *get_internal_charset_by_name(const char *name, myf flags) -{ - uint cs_number=get_charset_number(name); - return cs_number ? get_internal_charset(cs_number,flags) : NULL; -} - - - CHARSET_INFO *get_charset(uint cs_number, myf flags) { CHARSET_INFO *cs; @@ -472,7 +410,7 @@ CHARSET_INFO *get_charset(uint cs_number, myf flags) if (!cs && (flags & MY_WME)) { char index_file[FN_REFLEN], cs_string[23]; - strmov(get_charsets_dir(index_file), "Index"); + strmov(get_charsets_dir(index_file),MY_CHARSET_INDEX); cs_string[0]='#'; int10_to_str(cs_number, cs_string+1, 10); my_error(EE_UNKNOWN_CHARSET, MYF(ME_BELL), cs_string, index_file); @@ -485,50 +423,85 @@ my_bool set_default_charset(uint cs, myf flags) CHARSET_INFO *new_charset; DBUG_ENTER("set_default_charset"); DBUG_PRINT("enter",("character set: %d",(int) cs)); - new_charset = get_charset(cs, flags); + + new_charset= get_charset(cs, flags); if (!new_charset) { DBUG_PRINT("error",("Couldn't set default character set")); DBUG_RETURN(TRUE); /* error */ } - default_charset_info = new_charset; - system_charset_info = new_charset; + default_charset_info= new_charset; + system_charset_info= new_charset; + DBUG_RETURN(FALSE); } CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags) { + uint cs_number; CHARSET_INFO *cs; (void) init_available_charsets(MYF(0)); /* If it isn't initialized */ - cs=get_internal_charset_by_name(cs_name, flags); + + cs_number=get_charset_number(cs_name); + cs= cs_number ? get_internal_charset(cs_number,flags) : NULL; if (!cs && (flags & MY_WME)) { char index_file[FN_REFLEN]; - strmov(get_charsets_dir(index_file), "Index"); + strmov(get_charsets_dir(index_file),MY_CHARSET_INDEX); my_error(EE_UNKNOWN_CHARSET, MYF(ME_BELL), cs_name, index_file); } return cs; } + +CHARSET_INFO *get_charset_by_csname(const char *cs_name, myf flags) +{ + CHARSET_INFO *cs=NULL; + CHARSET_INFO **css; + (void) init_available_charsets(MYF(0)); /* If it isn't initialized */ + + for (css= all_charsets; css < all_charsets+255; ++css) + { + if ( css[0] && (css[0]->state & MY_CS_PRIMARY) && + css[0]->csname && !strcmp(css[0]->csname, cs_name)) + { + cs= css[0]->number ? get_internal_charset(css[0]->number,flags) : NULL; + break; + } + } + + if (!cs && (flags & MY_WME)) + { + char index_file[FN_REFLEN]; + strmov(get_charsets_dir(index_file),MY_CHARSET_INDEX); + my_error(EE_UNKNOWN_CHARSET, MYF(ME_BELL), cs_name, index_file); + } + + return cs; +} + + my_bool set_default_charset_by_name(const char *cs_name, myf flags) { CHARSET_INFO *new_charset; DBUG_ENTER("set_default_charset_by_name"); DBUG_PRINT("enter",("character set: %s", cs_name)); - new_charset = get_charset_by_name(cs_name, flags); + + new_charset= get_charset_by_name(cs_name, flags); if (!new_charset) { DBUG_PRINT("error",("Couldn't set default character set")); DBUG_RETURN(TRUE); /* error */ } - default_charset_info = new_charset; - system_charset_info = new_charset; + default_charset_info= new_charset; + system_charset_info= new_charset; DBUG_RETURN(FALSE); } + /* Only append name if it doesn't exist from before */ static my_bool charset_in_string(const char *name, DYNAMIC_STRING *s) @@ -540,13 +513,14 @@ static my_bool charset_in_string(const char *name, DYNAMIC_STRING *s) if (! pos[length] || pos[length] == ' ') return TRUE; /* Already existed */ } - return FALSE; } + static void charset_append(DYNAMIC_STRING *s, const char *name) { - if (!charset_in_string(name, s)) { + if (!charset_in_string(name, s)) + { dynstr_append(s, name); dynstr_append(s, " "); } @@ -556,7 +530,7 @@ static void charset_append(DYNAMIC_STRING *s, const char *name) /* Returns a dynamically-allocated string listing the character sets requested. The caller is responsible for freeing the memory. */ -char * list_charsets(myf want_flags) +char *list_charsets(myf want_flags) { DYNAMIC_STRING s; char *p; @@ -567,7 +541,7 @@ char * list_charsets(myf want_flags) if (want_flags & MY_CS_COMPILED) { CHARSET_INFO **cs; - for (cs = all_charsets; cs < all_charsets+255; cs++) + for (cs= all_charsets; cs < all_charsets+255; cs++) { if (cs[0]) { @@ -598,19 +572,19 @@ char * list_charsets(myf want_flags) if (want_flags & (MY_CS_INDEX|MY_CS_LOADED)) { CHARSET_INFO **cs; - for (cs = all_charsets; cs < all_charsets + 255; cs++) + for (cs= all_charsets; cs < all_charsets + 255; cs++) if (cs[0] && cs[0]->name && (cs[0]->state & want_flags) ) charset_append(&s, cs[0]->name); } if (s.length) { - s.str[s.length - 1] = '\0'; /* chop trailing space */ - p = my_strdup(s.str, MYF(MY_WME)); + s.str[s.length - 1]= '\0'; /* chop trailing space */ + p= my_strdup(s.str, MYF(MY_WME)); } else { - p = my_strdup("", MYF(MY_WME)); + p= my_strdup("", MYF(MY_WME)); } dynstr_free(&s); diff --git a/mysys/my_alloc.c b/mysys/my_alloc.c index 1ab86476e41..4d3b0604984 100644 --- a/mysys/my_alloc.c +++ b/mysys/my_alloc.c @@ -25,12 +25,13 @@ void init_alloc_root(MEM_ROOT *mem_root, uint block_size, uint pre_alloc_size __attribute__((unused))) { - mem_root->free= mem_root->used= 0; + mem_root->free= mem_root->used= mem_root->pre_alloc= 0; mem_root->min_malloc= 32; mem_root->block_size= block_size-MALLOC_OVERHEAD-sizeof(USED_MEM)-8; mem_root->error_handler= 0; mem_root->block_num= 4; /* We shift this with >>2 */ mem_root->first_block_usage= 0; + #if !(defined(HAVE_purify) && defined(EXTRA_DEBUG)) if (pre_alloc_size) { @@ -137,6 +138,7 @@ static inline void mark_blocks_free(MEM_ROOT* root) /* Now everything is set; Indicate that nothing is used anymore */ root->used= 0; + root->first_block_usage= 0; } diff --git a/mysys/my_compress.c b/mysys/my_compress.c index 1e46584d525..dd076311188 100644 --- a/mysys/my_compress.c +++ b/mysys/my_compress.c @@ -32,24 +32,28 @@ my_bool my_compress(byte *packet, ulong *len, ulong *complen) { + DBUG_ENTER("my_compress"); if (*len < MIN_COMPRESS_LENGTH) + { *complen=0; + DBUG_PRINT("note",("Packet too short: Not compressed")); + } else { byte *compbuf=my_compress_alloc(packet,len,complen); if (!compbuf) - return *complen ? 0 : 1; + DBUG_RETURN(*complen ? 0 : 1); memcpy(packet,compbuf,*len); my_free(compbuf,MYF(MY_WME)); } - return 0; + DBUG_RETURN(0); } byte *my_compress_alloc(const byte *packet, ulong *len, ulong *complen) { byte *compbuf; - *complen = *len * 120 / 100 + 12; - if (!(compbuf = (byte *) my_malloc(*complen,MYF(MY_WME)))) + *complen= *len * 120 / 100 + 12; + if (!(compbuf= (byte *) my_malloc(*complen,MYF(MY_WME)))) return 0; /* Not enough memory */ if (compress((Bytef*) compbuf,(ulong *) complen, (Bytef*) packet, (uLong) *len ) != Z_OK) @@ -59,31 +63,36 @@ byte *my_compress_alloc(const byte *packet, ulong *len, ulong *complen) } if (*complen >= *len) { - *complen=0; - my_free(compbuf,MYF(MY_WME)); + *complen= 0; + my_free(compbuf, MYF(MY_WME)); + DBUG_PRINT("note",("Packet got longer on compression; Not compressed")); return 0; } - swap(ulong,*len,*complen); /* *len is now packet length */ + swap(ulong, *len, *complen); /* *len is now packet length */ return compbuf; } my_bool my_uncompress (byte *packet, ulong *len, ulong *complen) { + DBUG_ENTER("my_uncompress"); if (*complen) /* If compressed */ { - byte *compbuf = (byte *) my_malloc (*complen,MYF(MY_WME)); + byte *compbuf= (byte *) my_malloc(*complen,MYF(MY_WME)); + int error; if (!compbuf) - return 1; /* Not enough memory */ - if (uncompress((Bytef*) compbuf, complen, (Bytef*) packet, *len) != Z_OK) + DBUG_RETURN(1); /* Not enough memory */ + if ((error=uncompress((Bytef*) compbuf, complen, (Bytef*) packet, *len)) + != Z_OK) { /* Probably wrong packet */ - my_free (compbuf,MYF(MY_WME)); - return 1; + DBUG_PRINT("error",("Can't uncompress packet, error: %d",error)); + my_free(compbuf, MYF(MY_WME)); + DBUG_RETURN(1); } - *len = *complen; - memcpy(packet,compbuf,*len); - my_free(compbuf,MYF(MY_WME)); + *len= *complen; + memcpy(packet, compbuf, *len); + my_free(compbuf, MYF(MY_WME)); } - return 0; + DBUG_RETURN(0); } #endif /* HAVE_COMPRESS */ diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index b2ee6e0f373..21adb9374ce 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -572,7 +572,7 @@ static longlong eval_num_suffix (char *argument, int *error, char *option_name) In case of an error, set error value in *err. */ -longlong getopt_ll (char *arg, const struct my_option *optp, int *err) +static longlong getopt_ll(char *arg, const struct my_option *optp, int *err) { longlong num; @@ -596,7 +596,7 @@ longlong getopt_ll (char *arg, const struct my_option *optp, int *err) values. */ -static ulonglong getopt_ull (char *arg, const struct my_option *optp, int *err) +static ulonglong getopt_ull(char *arg, const struct my_option *optp, int *err) { ulonglong num; diff --git a/mysys/my_handler.c b/mysys/my_handler.c index 2d51ab13f69..2fd7f1fcdee 100644 --- a/mysys/my_handler.c +++ b/mysys/my_handler.c @@ -40,15 +40,33 @@ static int compare_bin(uchar *a, uint a_length, uchar *b, uint b_length, return (int) (a_length-b_length); } -#define FCMP(A,B) ((int) (A) - (int) (B)) /* Compare two keys - Returns <0, 0, >0 acording to which is bigger - Key_length specifies length of key to use. Number-keys can't be splited - If flag <> SEARCH_FIND compare also position + + SYNOPSIS + ha_key_cmp() + keyseg Key segments of key to compare + a First key to compare, in format from _mi_pack_key() + This is normally key specified by user + b Second key to compare. This is always from a row + key_length Length of key to compare. This can be shorter than + a to just compare sub keys + next_flag How keys should be compared + If bit SEARCH_FIND is not set the keys includes the row + position and this should also be compared + + NOTES + Number-keys can't be splited + + RETURN VALUES + <0 If a < b + 0 If a == b + >0 If a > b */ +#define FCMP(A,B) ((int) (A) - (int) (B)) + int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, register uchar *b, uint key_length, uint nextflag, uint *diff_pos) @@ -59,9 +77,10 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, uint32 u_1,u_2; float f_1,f_2; double d_1,d_2; + uint next_key_length; *diff_pos=0; - for ( ; (int) key_length >0 ; keyseg++) + for ( ; (int) key_length >0 ; key_length=next_key_length, keyseg++) { uchar *end; uint piks=! (keyseg->flag & HA_NO_SORT); @@ -81,10 +100,21 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, { if (nextflag == (SEARCH_FIND | SEARCH_UPDATE)) nextflag=SEARCH_SAME; /* Allow duplicate keys */ + else if (nextflag & SEARCH_NULL_ARE_NOT_EQUAL) + { + /* + This is only used from mi_check() to calculate cardinality. + It can't be used when searching for a key as this would cause + compare of (a,b) and (b,a) to return the same value. + */ + return -1; + } + next_key_length=key_length; continue; /* To next key part */ } } end= a+ min(keyseg->length,key_length); + next_key_length=key_length-keyseg->length; switch ((enum ha_base_keytype) keyseg->type) { case HA_KEYTYPE_TEXT: /* Ascii; Key is converted */ @@ -93,12 +123,12 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, int a_length,b_length,pack_length; get_key_length(a_length,a); get_key_pack_length(b_length,pack_length,b); - key_length-= b_length + pack_length; + next_key_length=key_length-b_length-pack_length; if (piks && - (flag= mi_compare_text(keyseg->charset,a,a_length,b,b_length, - (my_bool) ((nextflag & SEARCH_PREFIX) && - key_length <= 0)))) + (flag=mi_compare_text(keyseg->charset,a,a_length,b,b_length, + (my_bool) ((nextflag & SEARCH_PREFIX) && + next_key_length <= 0)))) return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a+=a_length; b+=b_length; @@ -107,7 +137,6 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, else { uint length=(uint) (end-a), a_length=length, b_length=length; - key_length-= keyseg->length; if (!(nextflag & SEARCH_PREFIX)) { while (a_length && a[a_length-1] == ' ') @@ -116,9 +145,9 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, b_length--; } if (piks && - (flag= mi_compare_text(keyseg->charset,a,a_length,b,b_length, - (my_bool) ((nextflag & SEARCH_PREFIX) && - key_length <= 0)))) + (flag= mi_compare_text(keyseg->charset, a, a_length, b, b_length, + (my_bool) ((nextflag & SEARCH_PREFIX) && + next_key_length <= 0)))) return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a=end; b+=length; @@ -130,12 +159,12 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, int a_length,b_length,pack_length; get_key_length(a_length,a); get_key_pack_length(b_length,pack_length,b); - key_length-= b_length + pack_length; + next_key_length=key_length-b_length-pack_length; if (piks && (flag=compare_bin(a,a_length,b,b_length, (my_bool) ((nextflag & SEARCH_PREFIX) && - key_length <= 0)))) + next_key_length <= 0)))) return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a+=a_length; b+=b_length; @@ -144,11 +173,10 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, else { uint length=keyseg->length; - key_length-= keyseg->length; if (piks && (flag=compare_bin(a,length,b,length, (my_bool) ((nextflag & SEARCH_PREFIX) && - key_length <= 0)))) + next_key_length <= 0)))) return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a+=length; b+=length; @@ -159,12 +187,12 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, int a_length,b_length,pack_length; get_key_length(a_length,a); get_key_pack_length(b_length,pack_length,b); - key_length-= b_length + pack_length; + next_key_length=key_length-b_length-pack_length; if (piks && (flag= mi_compare_text(keyseg->charset,a,a_length,b,b_length, (my_bool) ((nextflag & SEARCH_PREFIX) && - key_length <= 0)))) + next_key_length <= 0)))) return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a+=a_length; b+=b_length; @@ -176,12 +204,12 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, int a_length,b_length,pack_length; get_key_length(a_length,a); get_key_pack_length(b_length,pack_length,b); - key_length-= b_length + pack_length; + next_key_length=key_length-b_length-pack_length; if (piks && (flag=compare_bin(a,a_length,b,b_length, (my_bool) ((nextflag & SEARCH_PREFIX) && - key_length <= 0)))) + next_key_length <= 0)))) return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a+=a_length; b+=b_length; @@ -196,7 +224,6 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a= end; b++; - key_length-= keyseg->length; break; } case HA_KEYTYPE_SHORT_INT: @@ -206,7 +233,6 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a= end; b+= 2; /* sizeof(short int); */ - key_length-= keyseg->length; break; case HA_KEYTYPE_USHORT_INT: { @@ -217,7 +243,6 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a= end; b+=2; /* sizeof(short int); */ - key_length-= keyseg->length; break; } case HA_KEYTYPE_LONG_INT: @@ -227,7 +252,6 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a= end; b+= 4; /* sizeof(long int); */ - key_length-= keyseg->length; break; case HA_KEYTYPE_ULONG_INT: u_1= mi_sint4korr(a); @@ -236,7 +260,6 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a= end; b+= 4; /* sizeof(long int); */ - key_length-= keyseg->length; break; case HA_KEYTYPE_INT24: l_1=mi_sint3korr(a); @@ -245,7 +268,6 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a= end; b+= 3; - key_length-= keyseg->length; break; case HA_KEYTYPE_UINT24: l_1=mi_uint3korr(a); @@ -254,7 +276,6 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a= end; b+= 3; - key_length-= keyseg->length; break; case HA_KEYTYPE_FLOAT: mi_float4get(f_1,a); @@ -263,7 +284,6 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a= end; b+= 4; /* sizeof(float); */ - key_length-= keyseg->length; break; case HA_KEYTYPE_DOUBLE: mi_float8get(d_1,a); @@ -272,13 +292,12 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a= end; b+= 8; /* sizeof(double); */ - key_length-= keyseg->length; break; case HA_KEYTYPE_NUM: /* Numeric key */ { int swap_flag= 0; int alength,blength; - + if (keyseg->flag & HA_REVERSE_SORT) { swap(uchar*,a,b); @@ -289,7 +308,7 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, { alength= *a++; blength= *b++; end=a+alength; - key_length-= blength + 1; + next_key_length=key_length-blength-1; } else { @@ -298,9 +317,7 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, /* remove pre space from keys */ for ( ; alength && *a == ' ' ; a++, alength--) ; for ( ; blength && *b == ' ' ; b++, blength--) ; - key_length-= keyseg->length; } - if (piks) { if (*a == '-') @@ -350,7 +367,6 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a= end; b+= 8; - key_length-= keyseg->length; break; } case HA_KEYTYPE_ULONGLONG: @@ -362,7 +378,6 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a= end; b+= 8; - key_length-= keyseg->length; break; } #endif diff --git a/mysys/my_init.c b/mysys/my_init.c index 2f5088d5b9e..ae7f78b7445 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -121,6 +121,7 @@ void my_end(int infoflag) } } free_charsets(); + my_once_free(); if (infoflag & MY_GIVE_INFO || info_file != stderr) { #ifdef HAVE_GETRUSAGE @@ -163,7 +164,6 @@ Voluntary context switches %ld, Involuntary context switches %ld\n", pthread_mutex_destroy(&THR_LOCK_malloc); pthread_mutex_destroy(&THR_LOCK_open); DBUG_POP(); /* Must be done before my_thread_end */ - my_once_free(); my_thread_end(); my_thread_global_end(); #endif diff --git a/mysys/my_once.c b/mysys/my_once.c index 1250ce24994..e1c728897aa 100644 --- a/mysys/my_once.c +++ b/mysys/my_once.c @@ -78,6 +78,25 @@ gptr my_once_alloc(unsigned int Size, myf MyFlags) } /* my_once_alloc */ +char *my_once_strdup(const char *src,myf myflags) +{ + uint len=strlen(src)+1; + char *dst=my_once_alloc(len, myflags); + if (dst) + memcpy(dst, src, len); + return dst; +} + + +char *my_once_memdup(const char *src, uint len, myf myflags) +{ + char *dst=my_once_alloc(len, myflags); + if (dst) + memcpy(dst, src, len); + return dst; +} + + /* Deallocate everything used by my_once_alloc diff --git a/mysys/my_rename.c b/mysys/my_rename.c index fde45eba456..d4f99e83247 100644 --- a/mysys/my_rename.c +++ b/mysys/my_rename.c @@ -45,6 +45,13 @@ int my_rename(const char *from, const char *to, myf MyFlags) } #endif #if defined(HAVE_RENAME) +#ifdef __WIN__ + /* + On windows we can't rename over an existing file: + Remove any conflicting files: + */ + (void) my_delete(to, MYF(0)); +#endif if (rename(from,to)) #else if (link(from, to) || unlink(from)) diff --git a/mysys/test_xml.c b/mysys/test_xml.c new file mode 100644 index 00000000000..2a679906cbf --- /dev/null +++ b/mysys/test_xml.c @@ -0,0 +1,105 @@ +/* Copyright (C) 2000 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include <stdio.h> +#include <string.h> +#include <unistd.h> +#include <fcntl.h> +#include "my_xml.h" + +static void mstr(char *str,const char *src,uint l1,uint l2) +{ + l1 = l1<l2 ? l1 : l2; + memcpy(str,src,l1); + str[l1]='\0'; +} + +static int dstr(MY_XML_PARSER *st,const char *attr, uint len) +{ + char str[1024]; + + mstr(str,attr,len,sizeof(str)-1); + printf("VALUE '%s'\n",str); + return MY_XML_OK; +} + +static int bstr(MY_XML_PARSER *st,const char *attr, uint len) +{ + char str[1024]; + + mstr(str,attr,len,sizeof(str)-1); + printf("ENTER %s\n",str); + return MY_XML_OK; +} + + +static int estr(MY_XML_PARSER *st,const char *attr, uint len) +{ + char str[1024]; + + mstr(str,attr,len,sizeof(str)-1); + printf("LEAVE %s\n",str); + return MY_XML_OK; +} + +static void usage(const char *prog) +{ + printf("Usage:\n"); + printf("%s xmlfile\n",prog); +} + +int main(int ac, char **av) +{ + char str[1024*64]=""; + const char *fn; + int f; + uint len; + MY_XML_PARSER p; + + if (ac<2) + { + usage(av[0]); + return 0; + } + + fn=av[1]?av[1]:"test.xml"; + if ((f=open(fn,O_RDONLY))<0) + { + fprintf(stderr,"Err '%s'\n",fn); + return 1; + } + + len=read(f,str,sizeof(str)-1); + str[len]='\0'; + + my_xml_parser_create(&p); + + my_xml_set_enter_handler(&p,bstr); + my_xml_set_value_handler(&p,dstr); + my_xml_set_leave_handler(&p,estr); + + if (MY_XML_OK!=(f=my_xml_parse(&p,str,len))) + { + printf("ERROR at line %d pos %d '%s'\n", + my_xml_error_lineno(&p)+1, + my_xml_error_pos(&p), + my_xml_error_string(&p)); + } + + my_xml_parser_free(&p); + + return 0; +} diff --git a/readline/tcap.h b/readline/tcap.h index 4606520bf87..58ab894d93e 100644 --- a/readline/tcap.h +++ b/readline/tcap.h @@ -42,7 +42,7 @@ #endif extern char PC; -extern const char *UP, *BC; +extern char *UP, *BC; extern short ospeed; diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 3ffa62d27c0..2c74c8e46a6 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -103,6 +103,8 @@ SUFFIXES = .sh -e 's!@''CC''@!@CC@!'\ -e 's!@''CXX''@!@CXX@!'\ -e 's!@''GXX''@!@GXX@!'\ + -e 's!@''CC_VERSION''@!@CC_VERSION@!'\ + -e 's!@''CXX_VERSION''@!@CXX_VERSION@!'\ -e 's!@''PERL''@!@PERL@!' \ -e 's!@''ASFLAGS''@!@SAVE_ASFLAGS@!'\ -e 's!@''CFLAGS''@!@SAVE_CFLAGS@!'\ diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh index 9d25943bb52..c2b1a0cb2b3 100644 --- a/scripts/make_binary_distribution.sh +++ b/scripts/make_binary_distribution.sh @@ -50,7 +50,7 @@ mkdir $BASE $BASE/bin $BASE/data $BASE/data/mysql $BASE/data/test \ $BASE/include $BASE/lib $BASE/support-files $BASE/share $BASE/share/mysql \ $BASE/tests $BASE/scripts $BASE/sql-bench $BASE/mysql-test \ $BASE/mysql-test/t $BASE/mysql-test/r \ - $BASE/mysql-test/include $BASE/mysql-test/std_data $BASE/man + $BASE/mysql-test/include $BASE/mysql-test/std_data $BASE/man $BASE/man/man1 chmod o-rwx $BASE/data $BASE/data/* @@ -107,7 +107,7 @@ rm $BASE/include/Makefile*; rm $BASE/include/*.in $CP tests/*.res tests/*.tst tests/*.pl $BASE/tests $CP support-files/* $BASE/support-files -$CP man/*.? $BASE/man +$CP man/*.1 $BASE/man/man1 $CP -r sql/share/* $BASE/share/mysql rm -f $BASE/share/mysql/Makefile* $BASE/share/mysql/*/*.OLD diff --git a/scripts/mysqlbug.sh b/scripts/mysqlbug.sh index 8dbc931b7f6..49ac08d0013 100644 --- a/scripts/mysqlbug.sh +++ b/scripts/mysqlbug.sh @@ -231,6 +231,8 @@ ${ORGANIZATION- $ORGANIZATION_C} >Class: $CLASS_C >Release: mysql-${VERSION} ($COMPILATION_COMMENT) `test -n "$MYSQL_SERVER" && echo ">Server: $MYSQL_SERVER"` +>C compiler: @CC_VERSION@ +>C++ compiler: @CXX_VERSION@ >Environment: $ENVIRONMENT_C `test -n "$SYSTEM" && echo "System: $SYSTEM"` diff --git a/sql-bench/bench-init.pl.sh b/sql-bench/bench-init.pl.sh index 9b999ee7f95..b7d2b962e13 100644 --- a/sql-bench/bench-init.pl.sh +++ b/sql-bench/bench-init.pl.sh @@ -48,7 +48,10 @@ $opt_optimization="None"; $opt_hw=""; $opt_threads=5; -$opt_time_limit=10*60; # Don't wait more than 10 min for some tests +if (!defined($opt_time_limit)) +{ + $opt_time_limit=10*60; # Don't wait more than 10 min for some tests +} $log_prog_args=join(" ", skip_arguments(\@ARGV,"comments","cmp","server", "user", "host", "database", "password", diff --git a/sql-bench/crash-me.sh b/sql-bench/crash-me.sh index 6c3ee9bd0dc..130816de0be 100644 --- a/sql-bench/crash-me.sh +++ b/sql-bench/crash-me.sh @@ -1,4 +1,5 @@ #!@PERL@ +# -*- perl -*- # Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB # # This library is free software; you can redistribute it and/or @@ -38,7 +39,7 @@ # as such, and clarify ones such as "mediumint" with comments such as # "3-byte int" or "same as xxx". -$version="1.59"; +$version="1.60"; use DBI; use Getopt::Long; @@ -47,14 +48,15 @@ require "$pwd/server-cfg" || die "Can't read Configuration file: $!\n"; $opt_server="mysql"; $opt_host="localhost"; $opt_database="test"; $opt_dir="limits"; -$opt_user=$opt_password=""; +$opt_user=$opt_password="";$opt_verbose=""; $opt_debug=$opt_help=$opt_Information=$opt_restart=$opt_force=$opt_quick=0; -$opt_log_all_queries=$opt_fix_limit_file=$opt_batch_mode=0; +$opt_log_all_queries=$opt_fix_limit_file=$opt_batch_mode=$opt_version=0; $opt_db_start_cmd=""; # the db server start command $opt_check_server=0; # Check if server is alive before each query $opt_sleep=10; # time to sleep while starting the db server $limit_changed=0; # For configure file $reconnect_count=0; +$opt_suffix=""; $opt_comment=$opt_config_file=$opt_log_queries_to_file=""; $limits{'crash_me_safe'}='yes'; $prompts{'crash_me_safe'}='crash me safe'; @@ -62,10 +64,24 @@ $limits{'operating_system'}= machine(); $prompts{'operating_system'}='crash-me tested on'; $retry_limit=3; -GetOptions("Information","help","server=s","debug","user=s","password=s","database=s","restart","force","quick","log-all-queries","comment=s","host=s","fix-limit-file","dir=s","db-start-cmd=s","sleep=s","batch-mode","config-file=s","log-queries-to-file=s","check-server") || usage(); +GetOptions("Information","help","server=s","debug","user=s","password=s", +"database=s","restart","force","quick","log-all-queries","comment=s", +"host=s","fix-limit-file","dir=s","db-start-cmd=s","sleep=s","suffix=s", +"batch-mode","config-file=s","log-queries-to-file=s","check-server", +"version", +"verbose!" => \$opt_verbose) || usage(); usage() if ($opt_help || $opt_Information); +version() && exit(0) if ($opt_version); -$opt_config_file="$pwd/$opt_dir/$opt_server.cfg" if (length($opt_config_file) == 0); +$opt_suffix = '-'.$opt_suffix if (length($opt_suffix) != 0); +$opt_config_file = "$pwd/$opt_dir/$opt_server$opt_suffix.cfg" + if (length($opt_config_file) == 0); +$log_prefix=' ###'; # prefix for log lines in result file +$safe_query_log=''; +$safe_query_result_log=''; +$log{"crash-me"}=""; + +#!!! if ($opt_fix_limit_file) { @@ -112,7 +128,8 @@ if (length($opt_comment)) $opt_log=0; if (length($opt_log_queries_to_file)) { - open(LOG,">$opt_log_queries_to_file") || die "Can't open file $opt_log_queries_to_file\n"; + open(LOG,">$opt_log_queries_to_file") || + die "Can't open file $opt_log_queries_to_file\n"; $opt_log=1; } @@ -163,11 +180,13 @@ $prompt="drop table require cascade/restrict"; $drop_attr=""; $dbh->do("drop table crash_me"); $dbh->do("drop table crash_me cascade"); -if (!safe_query(["create table crash_me (a integer not null)", +if (!safe_query_l('drop_requires_cascade', + ["create table crash_me (a integer not null)", "drop table crash_me"])) { $dbh->do("drop table crash_me cascade"); - if (safe_query(["create table crash_me (a integer not null)", + if (safe_query_l('drop_requires_cascade', + ["create table crash_me (a integer not null)", "drop table crash_me cascade"])) { save_config_data('drop_requires_cascade',"yes","$prompt"); @@ -192,11 +211,14 @@ $dbh->do("drop table crash_q $drop_attr"); $dbh->do("drop table crash_q1 $drop_attr"); $prompt="Tables without primary key"; -if (!safe_query(["create table crash_me (a integer not null,b char(10) not null)", +if (!safe_query_l('no_primary_key', + ["create table crash_me (a integer not null,b char(10) not null)", "insert into crash_me (a,b) values (1,'a')"])) { - if (!safe_query(["create table crash_me (a integer not null,b char(10) not null, primary key (a))", - "insert into crash_me (a,b) values (1,'a')"])) + if (!safe_query_l('no_primary_key', + ["create table crash_me (a integer not null,b char(10) not null". + ", primary key (a))", + "insert into crash_me (a,b) values (1,'a')"])) { die "Can't create table 'crash_me' with one record: $DBI::errstr\n"; } @@ -298,14 +320,31 @@ report("INSERT with set syntax",'insert_with_set', "create table crash_q (a integer)", "insert into crash_q SET a=1", "drop table crash_q $drop_attr"); +report("INSERT with DEFAULT","insert_with_default", + "create table crash_me_q (a int)", + "insert into crash_me_q (a) values (DEFAULT)", + "drop table crash_me_q $drop_attr"); + +report("INSERT with empty value list","insert_with_empty_value_list", + "create table crash_me_q (a int)", + "insert into crash_me_q (a) values ()", + "drop table crash_me_q $drop_attr"); + +report("INSERT DEFAULT VALUES","insert_default_values", + "create table crash_me_q (a int)", + "insert into crash_me_q DEFAULT VALUES", + "drop table crash_me_q $drop_attr"); + report("allows end ';'","end_colon", "select * from crash_me;"); try_and_report("LIMIT number of rows","select_limit", ["with LIMIT", "select * from crash_me limit 1"], ["with TOP", "select TOP 1 * from crash_me"]); -report("SELECT with LIMIT #,#","select_limit2", "select * from crash_me limit 1,1"); -report("SELECT with LIMIT # OFFSET #","select_limit3", "select * from crash_me limit 1 offset 1"); +report("SELECT with LIMIT #,#","select_limit2", + "select * from crash_me limit 1,1"); +report("SELECT with LIMIT # OFFSET #", + "select_limit3", "select * from crash_me limit 1 offset 1"); # The following alter table commands MUST be kept together! if ($dbh->do("create table crash_q (a integer, b integer,c1 CHAR(10))")) @@ -327,7 +366,8 @@ if ($dbh->do("create table crash_q (a integer, b integer,c1 CHAR(10))")) "alter table crash_q alter b set default 10"); report_one("Alter table drop column",'alter_drop_col', [["alter table crash_q drop column b","yes"], - ["alter table crash_q drop column b restrict","with restrict/cascade"]]); + ["alter table crash_q drop column b restrict", + "with restrict/cascade"]]); report("Alter table rename table",'alter_rename_table', "alter table crash_q rename to crash_q1"); } @@ -349,13 +389,14 @@ report("truncate","truncate_table", "drop table crash_q $drop_attr"); if ($dbh->do("create table crash_q (a integer, b integer,c1 CHAR(10))") && - $dbh->do("create table crash_q1 (a integer, b integer,c1 CHAR(10) not null)")) + $dbh->do("create table crash_q1 (a integer, b integer,c1 CHAR(10) not null)")) { report("Alter table add constraint",'alter_add_constraint', "alter table crash_q add constraint c2 check(a > b)"); report_one("Alter table drop constraint",'alter_drop_constraint', [["alter table crash_q drop constraint c2","yes"], - ["alter table crash_q drop constraint c2 restrict","with restrict/cascade"]]); + ["alter table crash_q drop constraint c2 restrict", + "with restrict/cascade"]]); report("Alter table add unique",'alter_add_unique', "alter table crash_q add constraint u1 unique(c1)"); try_and_report("Alter table drop unique",'alter_drop_unique', @@ -371,7 +412,8 @@ if ($dbh->do("create table crash_q (a integer, b integer,c1 CHAR(10))") && ["with add primary key", "alter table crash_q1 add primary key(c1)"]); report("Alter table add foreign key",'alter_add_foreign_key', - "alter table crash_q add constraint f1 foreign key(c1) references crash_q1(c1)"); + "alter table crash_q add constraint f1 foreign key(c1)", + " references crash_q1(c1)"); try_and_report("Alter table drop foreign key",'alter_drop_foreign_key', ["with drop constraint", "alter table crash_q drop constraint f1"], @@ -402,10 +444,12 @@ check_and_report("Group on column with null values",'group_by_null', $prompt="Having"; if (!defined($limits{'having'})) { # Complicated because of postgreSQL - if (!safe_query_result("select a from crash_me group by a having a > 0",1,0)) + if (!safe_query_result_l("having", + "select a from crash_me group by a having a > 0",1,0)) { - if (!safe_query_result("select a from crash_me group by a having a < 0", - 1,0)) + if (!safe_query_result_l("having", + "select a from crash_me group by a having a < 0", + 1,0)) { save_config_data("having","error",$prompt); } else { save_config_data("having","yes",$prompt); } @@ -446,7 +490,7 @@ $logical_value= $limits{'logical_value'}; $false=0; $result="no"; -if ($res=safe_query("select (1=1)=true $end_query")) { +if ($res=safe_query_l('has_true_false',"select (1=1)=true $end_query")) { $false="false"; $result="yes"; } @@ -492,7 +536,8 @@ else if ($i == 0) { - print "Can't connect to server: $DBI::errstr. Please start it and try again\n"; + print "Can't connect to server: $DBI::errstr.". + " Please start it and try again\n"; exit 1; } $dbh=safe_connect(); @@ -525,7 +570,9 @@ if (!defined($limits{'query_size'})) } for ($i=$first ; $i < $end ; $i*=2) { - last if (!safe_query($query . (" " x ($i - length($query)-length($end_query) -1)) . "$select$end_query")); + last if (!safe_query($query . + (" " x ($i - length($query)-length($end_query) -1)) + . "$select$end_query")); $first=$i; save_config_data("restart",$i,"") if ($opt_restart); } @@ -553,6 +600,13 @@ if (!defined($limits{'query_size'})) $query_size=$limits{'query_size'}; print "$limits{'query_size'}\n"; + +# +# Check for reserved words +# + +check_reserved_words($dbh); + # # Test database types # @@ -568,7 +622,8 @@ print "$limits{'query_size'}\n"; "interval month", "interval day", "interval day to hour", "interval day to minute", "interval day to second", - "interval hour", "interval hour to minute", "interval hour to second", + "interval hour", "interval hour to minute", + "interval hour to second", "interval minute", "interval minute to second", "interval second", "national character varying(20)", @@ -633,6 +688,7 @@ foreach $types (@types) # Test some type limits # + check_and_report("Remembers end space in char()","remember_end_space", ["create table crash_q (a char(10))", "insert into crash_q values('hello ')"], @@ -648,55 +704,6 @@ check_and_report("Remembers end space in varchar()", ["drop table crash_q $drop_attr"], 'hello ',6); -check_and_report("Supports 0000-00-00 dates","date_zero", - ["create table crash_me2 (a date not null)", - "insert into crash_me2 values ('0000-00-00')"], - "select a from crash_me2", - ["drop table crash_me2 $drop_attr"], - "0000-00-00",1); - -check_and_report("Supports 0001-01-01 dates","date_one", - ["create table crash_me2 (a date not null)", - "insert into crash_me2 values (DATE '0001-01-01')"], - "select a from crash_me2", - ["drop table crash_me2 $drop_attr"], - "0001-01-01",1); - -check_and_report("Supports 9999-12-31 dates","date_last", - ["create table crash_me2 (a date not null)", - "insert into crash_me2 values (DATE '9999-12-31')"], - "select a from crash_me2", - ["drop table crash_me2 $drop_attr"], - "9999-12-31",1); - -check_and_report("Supports 'infinity dates","date_infinity", - ["create table crash_me2 (a date not null)", - "insert into crash_me2 values ('infinity')"], - "select a from crash_me2", - ["drop table crash_me2 $drop_attr"], - "infinity",1); - -if (!defined($limits{'date_with_YY'})) -{ - check_and_report("Supports YY-MM-DD dates","date_with_YY", - ["create table crash_me2 (a date not null)", - "insert into crash_me2 values ('98-03-03')"], - "select a from crash_me2", - ["drop table crash_me2 $drop_attr"], - "1998-03-03",5); - if ($limits{'date_with_YY'} eq "yes") - { - undef($limits{'date_with_YY'}); - check_and_report("Supports YY-MM-DD 2000 compilant dates", - "date_with_YY", - ["create table crash_me2 (a date not null)", - "insert into crash_me2 values ('10-03-03')"], - "select a from crash_me2", - ["drop table crash_me2 $drop_attr"], - "2010-03-03",5); - } -} - if (($limits{'type_extra_float(2_arg)'} eq "yes" || $limits{'type_sql_decimal(2_arg)'} eq "yes") && (!defined($limits{'storage_of_float'}))) @@ -704,33 +711,33 @@ if (($limits{'type_extra_float(2_arg)'} eq "yes" || my $type=$limits{'type_extra_float(2_arg)'} eq "yes" ? "float(4,1)" : "decimal(4,1)"; my $result="undefined"; - if (execute_and_check(["create table crash_q (q1 $type)", + if (execute_and_check("storage_of_float",["create table crash_q (q1 $type)", "insert into crash_q values(1.14)"], "select q1 from crash_q", ["drop table crash_q $drop_attr"],1.1,0) && - execute_and_check(["create table crash_q (q1 $type)", + execute_and_check("storage_of_float",["create table crash_q (q1 $type)", "insert into crash_q values(1.16)"], "select q1 from crash_q", ["drop table crash_q $drop_attr"],1.1,0)) { $result="truncate"; } - elsif (execute_and_check(["create table crash_q (q1 $type)", + elsif (execute_and_check("storage_of_float",["create table crash_q (q1 $type)", "insert into crash_q values(1.14)"], "select q1 from crash_q", ["drop table crash_q $drop_attr"],1.1,0) && - execute_and_check(["create table crash_q (q1 $type)", + execute_and_check("storage_of_float",["create table crash_q (q1 $type)", "insert into crash_q values(1.16)"], "select q1 from crash_q", ["drop table crash_q $drop_attr"],1.2,0)) { $result="round"; } - elsif (execute_and_check(["create table crash_q (q1 $type)", + elsif (execute_and_check("storage_of_float",["create table crash_q (q1 $type)", "insert into crash_q values(1.14)"], "select q1 from crash_q", ["drop table crash_q $drop_attr"],1.14,0) && - execute_and_check(["create table crash_q (q1 $type)", + execute_and_check("storage_of_float",["create table crash_q (q1 $type)", "insert into crash_q values(1.16)"], "select q1 from crash_q", ["drop table crash_q $drop_attr"],1.16,0)) @@ -744,13 +751,17 @@ if (($limits{'type_extra_float(2_arg)'} eq "yes" || try_and_report("Type for row id", "rowid", ["rowid", - "create table crash_q (a rowid)","drop table crash_q $drop_attr"], + "create table crash_q (a rowid)", + "drop table crash_q $drop_attr"], ["auto_increment", - "create table crash_q (a int not null auto_increment, primary key(a))","drop table crash_q $drop_attr"], + "create table crash_q (a int not null auto_increment". + ", primary key(a))","drop table crash_q $drop_attr"], ["oid", - "create table crash_q (a oid, primary key(a))","drop table crash_q $drop_attr"], + "create table crash_q (a oid, primary key(a))", + "drop table crash_q $drop_attr"], ["serial", - "create table crash_q (a serial, primary key(a))","drop table crash_q $drop_attr"]); + "create table crash_q (a serial, primary key(a))", + "drop table crash_q $drop_attr"]); try_and_report("Automatic row id", "automatic_rowid", ["_rowid", @@ -767,21 +778,26 @@ try_and_report("Automatic row id", "automatic_rowid", (["+, -, * and /","+","5*3-4/2+1",14,0], ["ANSI SQL SUBSTRING","substring","substring('abcd' from 2 for 2)","bc",1], ["BIT_LENGTH","bit_length","bit_length('abc')",24,0], - ["searched CASE","searched_case","case when 1 > 2 then 'false' when 2 > 1 then 'true' end", "true",1], - ["simple CASE","simple_case","case 2 when 1 then 'false' when 2 then 'true' end", "true",1], + ["searched CASE","searched_case", + "case when 1 > 2 then 'false' when 2 > 1 then 'true' end", "true",1], + ["simple CASE","simple_case", + "case 2 when 1 then 'false' when 2 then 'true' end", "true",1], ["CAST","cast","CAST(1 as CHAR)","1",1], ["CHARACTER_LENGTH","character_length","character_length('abcd')","4",0], ["CHAR_LENGTH","char_length","char_length(b)","10",0], - ["CHAR_LENGTH(constant)","char_length(constant)","char_length('abcd')","4",0], + ["CHAR_LENGTH(constant)","char_length(constant)", + "char_length('abcd')","4",0], ["COALESCE","coalesce","coalesce($char_null,'bcd','qwe')","bcd",1], ["CURRENT_DATE","current_date","current_date",0,2], ["CURRENT_TIME","current_time","current_time",0,2], ["CURRENT_TIMESTAMP","current_timestamp","current_timestamp",0,2], - ["EXTRACT","extract_sql","extract(minute from timestamp '2000-02-23 18:43:12.987')",43,0], + ["EXTRACT","extract_sql", + "extract(minute from timestamp '2000-02-23 18:43:12.987')",43,0], ["LOCALTIME","localtime","localtime",0,2], ["LOCALTIMESTAMP","localtimestamp","localtimestamp",0,2], ["LOWER","lower","LOWER('ABC')","abc",1], - ["NULLIF with strings","nullif_string","NULLIF(NULLIF('first','second'),'first')",undef(),4], + ["NULLIF with strings","nullif_string", + "NULLIF(NULLIF('first','second'),'first')",undef(),4], ["NULLIF with numbers","nullif_num","NULLIF(NULLIF(1,2),1)",undef(),4], ["OCTET_LENGTH","octet_length","octet_length('abc')",3,0], ["POSITION","position","position('ll' in 'hello')",3,0], @@ -794,7 +810,7 @@ try_and_report("Automatic row id", "automatic_rowid", (["ASCII", "ascii", "ASCII('A')","65",0], ["CHAR", "char", "CHAR(65)" ,"A",1], ["CONCAT(2 arg)","concat", "concat('a','b')","ab",1], - ["DIFFERENCE()","difference","difference('abc','abe')",0,2], + ["DIFFERENCE()","difference","difference('abc','abe')",3,0], ["INSERT","insert","insert('abcd',2,2,'ef')","aefd",1], ["LEFT","left","left('abcd',2)","ab",1], ["LTRIM","ltrim","ltrim(' abcd')","abcd",1], @@ -838,14 +854,6 @@ try_and_report("Automatic row id", "automatic_rowid", ["TRUNCATE","truncate","truncate(18.18,-1)",10,0], ["NOW","now","now()",0,2], # Any value is acceptable ["CURDATE","curdate","curdate()",0,2], - ["DAYNAME","dayname","dayname(DATE '1997-02-01')","",2], - ["MONTH","month","month(DATE '1997-02-01')","",2], - ["MONTHNAME","monthname","monthname(DATE '1997-02-01')","",2], - ["DAYOFMONTH","dayofmonth","dayofmonth(DATE '1997-02-01')",1,0], - ["DAYOFWEEK","dayofweek","dayofweek(DATE '1997-02-01')",7,0], - ["DAYOFYEAR","dayofyear","dayofyear(DATE '1997-02-01')",32,0], - ["QUARTER","quarter","quarter(DATE '1997-02-01')",1,0], - ["YEAR","year","year(DATE '1997-02-01')",1997,0], ["CURTIME","curtime","curtime()",0,2], ["HOUR","hour","hour('12:13:14')",12,0], ["ANSI HOUR","hour_time","hour(TIME '12:13:14')",12,0], @@ -855,7 +863,8 @@ try_and_report("Automatic row id", "automatic_rowid", "timestampadd(SQL_TSI_SECOND,1,'1997-01-01 00:00:00')", "1997-01-01 00:00:01",1], ["TIMESTAMPDIFF","timestampdiff", - "timestampdiff(SQL_TSI_SECOND,'1997-01-01 00:00:02', '1997-01-01 00:00:01')","1",0], + "timestampdiff(SQL_TSI_SECOND,'1997-01-01 00:00:02',". + " '1997-01-01 00:00:01')","1",0], ["USER()","user()","user()",0,2], ["DATABASE","database","database()",0,2], ["IFNULL","ifnull","ifnull(2,3)",2,0], @@ -871,7 +880,6 @@ try_and_report("Automatic row id", "automatic_rowid", ["<> in SELECT","<>","1<>1","0",0], ["=","=","(1=1)",1,$logical_value], ["~* (case insensitive compare)","~*","'hi' ~* 'HI'",1,$logical_value], - ["ADD_MONTHS","add_months","add_months('1997-01-01',1)","1997-02-01",0], # oracle the date plus n months ["AND and OR in SELECT","and_or","1=1 AND 2=2",$logical_value,0], ["AND as '&&'",'&&',"1=1 && 2=2",$logical_value,0], ["ASCII_CHAR", "ascii_char", "ASCII_CHAR(65)","A",1], @@ -885,40 +893,38 @@ try_and_report("Automatic row id", "automatic_rowid", ["CONCAT(list)","concat_list", "concat('a','b','c','d')","abcd",1], ["CONVERT","convert","convert(CHAR,5)","5",1], ["COSH","cosh","cosh(0)","1",0], # oracle hyperbolic cosine of n. - ["DATEADD","dateadd","dateadd(day,3,'Nov 30 1997')",0,2], - ["DATEDIFF","datediff","datediff(month,'Oct 21 1997','Nov 30 1997')",0,2], - ["DATENAME","datename","datename(month,'Nov 30 1997')",0,2], - ["DATEPART","datepart","datepart(month,'July 20 1997')",0,2], - ["DATE_FORMAT","date_format", "date_format('1997-01-02 03:04:05','M W D Y y m d h i s w')", 0,2], ["ELT","elt","elt(2,'ONE','TWO','THREE')","TWO",1], ["ENCRYPT","encrypt","encrypt('hello')",0,2], ["FIELD","field","field('IBM','NCA','ICL','SUN','IBM','DIGITAL')",4,0], ["FORMAT","format","format(1234.5555,2)","1,234.56",1], - ["FROM_DAYS","from_days","from_days(729024)","1996-01-01",1], - ["FROM_UNIXTIME","from_unixtime","from_unixtime(0)",0,2], ["GETDATE","getdate","getdate()",0,2], - ["GREATEST","greatest","greatest('HARRY','HARRIOT','HAROLD')","HARRY",1], # oracle + ["GREATEST","greatest","greatest('HARRY','HARRIOT','HAROLD')","HARRY",1], ["IF","if", "if(5,6,7)",6,0], ["IN on numbers in SELECT","in_num","2 in (3,2,5,9,5,1)",$logical_value,0], ["IN on strings in SELECT","in_str","'monty' in ('david','monty','allan')", $logical_value,0], - ["INITCAP","initcap","initcap('the soap')","The Soap",1], # oracle Returns char, with the first letter of each word in uppercase + ["INITCAP","initcap","initcap('the soap')","The Soap",1], + # oracle Returns char, with the first letter of each word in uppercase ["INSTR (Oracle syntax)", "instr_oracle", "INSTR('CORPORATE FLOOR','OR',3,2)" ,"14",0], # oracle instring - ["INSTRB", "instrb", "INSTRB('CORPORATE FLOOR','OR',5,2)" ,"27",0], # oracle instring in bytes + ["INSTRB", "instrb", "INSTRB('CORPORATE FLOOR','OR',5,2)" ,"27",0], + # oracle instring in bytes ["INTERVAL","interval","interval(55,10,20,30,40,50,60,70,80,90,100)",5,0], - ["LAST_DAY","last_day","last_day('1997-04-01')","1997-04-30",0], # oracle last day of month of date ["LAST_INSERT_ID","last_insert_id","last_insert_id()",0,2], - ["LEAST","least","least('HARRY','HARRIOT','HAROLD')","HAROLD",1], # oracle - ["LENGTHB","lengthb","lengthb('CANDIDE')","14",0], # oracle length in bytes - ["LIKE ESCAPE in SELECT","like_escape","'%' like 'a%' escape 'a'",$logical_value,0], + ["LEAST","least","least('HARRY','HARRIOT','HAROLD')","HAROLD",1], + # oracle + ["LENGTHB","lengthb","lengthb('CANDIDE')","14",0], + # oracle length in bytes + ["LIKE ESCAPE in SELECT","like_escape", + "'%' like 'a%' escape 'a'",$logical_value,0], ["LIKE in SELECT","like","'a' like 'a%'",$logical_value,0], - ["LN","ln","ln(95)","4.55387689",0], # oracle natural logarithm of n + ["LN","ln","ln(95)","4.55387689",0], + # oracle natural logarithm of n ["LOCATE as INSTR","instr","instr('hello','ll')",3,0], - ["LOG(m,n)","log(m_n)","log(10,100)","2",0], # oracle logarithm, base m, of n - ["LOGN","logn","logn(2)","0.693147",0], # informix + ["LOG(m,n)","log(m_n)","log(10,100)","2",0], + # oracle logarithm, base m, of n + ["LOGN","logn","logn(2)","0.693147",0], + # informix ["LPAD","lpad","lpad('hi',4,'??')",'??hi',3], - ["MDY","mdy","mdy(7,1,1998)","1998-07-01",0], # informix ["MOD as %","%","10%7","3",0], - ["MONTHS_BETWEEN","months_between","months_between('1997-02-02','1997-01-01')","1.03225806",0], # oracle number of months between 2 dates ["NOT BETWEEN in SELECT","not_between","5 not between 4 and 6",0,0], ["NOT LIKE in SELECT","not_like","'a' not like 'a%'",0,0], ["NOT as '!' in SELECT","!","! 1",0,0], @@ -928,10 +934,9 @@ try_and_report("Automatic row id", "automatic_rowid", ["PASSWORD","password","password('hello')",0,2], ["PASTE", "paste", "paste('ABCDEFG',3,2,'1234')","AB1234EFG",1], ["PATINDEX","patindex","patindex('%a%','crash')",3,0], - ["PERIOD_ADD","period_add","period_add(9602,-12)",199502,0], - ["PERIOD_DIFF","period_diff","period_diff(199505,199404)",13,0], ["POW","pow","pow(3,2)",9,0], - ["RANGE","range","range(a)","0.0",0], # informix range(a) = max(a) - min(a) + ["RANGE","range","range(a)","0.0",0], + # informix range(a) = max(a) - min(a) ["REGEXP in SELECT","regexp","'a' regexp '^(a|b)*\$'",$logical_value,0], ["REPLICATE","replicate","replicate('a',5)","aaaaa",1], ["REVERSE","reverse","reverse('abcd')","dcba",1], @@ -943,23 +948,26 @@ try_and_report("Automatic row id", "automatic_rowid", ["STR","str","str(123.45,5,1)",123.5,3], ["STRCMP","strcmp","strcmp('abc','adc')",-1,0], ["STUFF","stuff","stuff('abc',2,3,'xyz')",'axyz',3], - ["SUBSTRB", "substrb", "SUBSTRB('ABCDEFG',5,4.2)" ,"CD",1], # oracle substring with bytes + ["SUBSTRB", "substrb", "SUBSTRB('ABCDEFG',5,4.2)" ,"CD",1], + # oracle substring with bytes ["SUBSTRING as MID","mid","mid('hello',3,2)","ll",1], - ["SUBSTRING_INDEX","substring_index","substring_index('www.tcx.se','.',-2)", "tcx.se",1], + ["SUBSTRING_INDEX","substring_index", + "substring_index('www.tcx.se','.',-2)", "tcx.se",1], ["SYSDATE","sysdate","sysdate()",0,2], ["TAIL","tail","tail('ABCDEFG',3)","EFG",0], - ["TANH","tanh","tanh(1)","0.462117157",0], # oracle hyperbolic tangent of n + ["TANH","tanh","tanh(1)","0.462117157",0], + # oracle hyperbolic tangent of n ["TIME_TO_SEC","time_to_sec","time_to_sec('01:23:21')","5001",0], - ["TO_DAYS","to_days","to_days(DATE '1996-01-01')",729024,0], ["TRANSLATE","translate","translate('abc','bc','de')",'ade',3], - ["TRIM; Many char extension","trim_many_char","trim(':!' FROM ':abc!')","abc",3], - ["TRIM; Substring extension","trim_substring","trim('cb' FROM 'abccb')","abc",3], + ["TRIM; Many char extension", + "trim_many_char","trim(':!' FROM ':abc!')","abc",3], + ["TRIM; Substring extension", + "trim_substring","trim('cb' FROM 'abccb')","abc",3], ["TRUNC","trunc","trunc(18.18,-1)",10,0], # oracle ["UID","uid","uid",0,2], # oracle uid from user ["UNIX_TIMESTAMP","unix_timestamp","unix_timestamp()",0,2], ["USERENV","userenv","userenv",0,2], # oracle user enviroment ["VERSION","version","version()",0,2], - ["WEEKDAY","weekday","weekday(DATE '1997-11-29')",5,0], ["automatic num->string convert","auto_num2string","concat('a',2)","a2",1], ["automatic string->num convert","auto_string2num","'1'+2",3,0], ["concatenation with +","concat_as_+","'abc' + 'def'","abcdef",1], @@ -969,8 +977,8 @@ try_and_report("Automatic row id", "automatic_rowid", ["RFILL (3 arg)",'rfill3arg',"rfill('abcd','.',6)",'abcd..',1], ["RPAD (4 arg)",'rpad4arg',"rpad('abcd',2,'+-',8)",'abcd+-+-',1], ["LPAD (4 arg)",'rpad4arg',"lpad('abcd',2,'+-',8)",'+-+-abcd',1], - ["SAPDB compatible TRIM (1 arg)",'trim1arg',"trim(' abcd ')",'abcd',1], - ["SAPDB compatible TRIM (2 arg)",'trim2arg',"trim('..abcd..','.')",'abcd',1], + ["TRIM (1 arg)",'trim1arg',"trim(' abcd ')",'abcd',1], + ["TRIM (2 arg)",'trim2arg',"trim('..abcd..','.')",'abcd',1], ["LTRIM (2 arg)",'ltrim2arg',"ltrim('..abcd..','.')",'abcd..',1], ["RTRIM (2 arg)",'rtrim2arg',"rtrim('..abcd..','.')",'..abcd',1], ["EXPAND",'expand2arg',"expand('abcd',6)",'abcd ',0], @@ -984,34 +992,24 @@ try_and_report("Automatic row id", "automatic_rowid", ["FLOAT",'float',"float(6666.66,4)",6667,0], ["LENGTH",'length',"length(1)",2,0], ["INDEX",'index',"index('abcdefg','cd',1,1)",3,0], - ["ADDDATE",'adddate',"ADDDATE('20021201',3)",'20021204',0], - ["SUBDATE",'subdate',"SUBDATE('20021204',3)",'20021201',0], - ["DATEDIFF (2 arg)",'datediff2arg',"DATEDIFF('20021204','20021201')",'3',0], # sapdb - ["DAYOFWEEK with sapdb internal date as arg",'dayofweek_sapdb',"DAYOFWEEK('19630816')",'5',0], - ["WEEKOFYEAR",'weekofyear',"WEEKOFYEAR('19630816')",'33',0], - ["DAYOFMONTH with sapdb internal date as arg",'dayofmonth_sapdb',"dayofmonth('19630816')",'16',0], - ["DAYOFYEAR with sapdb internal date as arg",'dayofyear_sapdb',"DAYOFYEAR('19630816')",'228',0], - ["MAKEDATE",'makedate',"MAKEDATE(1963,228)",'19630816',0], - ["DAYNAME with sapdb internal date as arg",'dayname_sapdb',"DAYNAME('19630816')",'Friday',0], - ["MONTHNAME with sapdb internal date as arg",'monthname_sapdb',"MONTHNAME('19630816')",'August',0], ["ADDTIME",'addtime',"ADDTIME('00200212','00000300')",'00200215',0], - ["SUBTIME",'subdate',"SUBDATE('00200215','00000300')",'00200212',0], + ["SUBTIME",'subtime',"SUBTIME('00200215','00000300')",'00200212',0], ["TIMEDIFF",'timediff',"TIMEDIFF('00200215','00200212')",'00000003',0], ["MAKETIME",'maketime',"MAKETIME(20,02,12)",'00200212',0], - ["YEAR with sapdb internal date as arg",'year_sapdb',"YEAR('20021201')",'2002',0], - ["MONTH with sapdb internal date as arg",'month_sapdb',"MONTH('20021201')",'12',0], - ["DAY",'day',"DAY('20021201')",1,0], - ["HOUR with sapdb internal time as arg",'hour_sapdb',"HOUR('00200212')",20,0], - ["MINUTE with sapdb internal time as arg",'minute_sapdb',"MINUTE('00200212')",2,0], - ["SECOND with sapdb internal time as arg",'second_sapdb',"SECOND('00200212')",12,0], - ["MICROSECOND",'microsecond',"MICROSECOND('19630816200212111111')",'111111',0], - ["TIMESTAMP",'timestamp',"timestamp('19630816','00200212')",'19630816200212000000',0], + ["HOUR with sapdb internal time as arg", + 'hour_sapdb',"HOUR('00200212')",20,0], + ["MINUTE with sapdb internal time as arg", + 'minute_sapdb',"MINUTE('00200212')",2,0], + ["SECOND with sapdb internal time as arg", + 'second_sapdb',"SECOND('00200212')",12,0], + ["MICROSECOND",'microsecond', + "MICROSECOND('19630816200212111111')",'111111',0], + ["TIMESTAMP",'timestamp', + "timestamp('19630816','00200212')",'19630816200212000000',0], ["TIME",'time',"time('00200212')",'00200212',0], - ["DATE",'date',"date('19630816')",'19630816',0], ["VALUE",'value',"value(NULL,'WALRUS')",'WALRUS',0], ["DECODE",'decode',"DECODE('S-103','T72',1,'S-103',2,'Leopard',3)",2,0], ["NUM",'num',"NUM('2123')",2123,0], - ["CHAR (conversation date)",'char_date',"CHAR(DATE('19630816'),EUR)",'16.08.1963',0], ["CHR (any type to string)",'chr_str',"CHR(67)",'67',0], ["HEX",'hex',"HEX('A')",41,0], ); @@ -1037,7 +1035,8 @@ try_and_report("Automatic row id", "automatic_rowid", ( ["BIT_AND",'bit_and',"bit_and(a)",1,0], ["BIT_OR", 'bit_or', "bit_or(a)",1,0], - ["COUNT(DISTINCT expr,expr,...)","count_distinct_list","count(distinct a,b)",1,0], + ["COUNT(DISTINCT expr,expr,...)", + "count_distinct_list","count(distinct a,b)",1,0], ["STD","std","std(a)",0,0], ["STDDEV","stddev","stddev(a)",0,0], ["VARIANCE","variance","variance(a)",0,0], @@ -1053,13 +1052,16 @@ try_and_report("Automatic row id", "automatic_rowid", ["IN on numbers","in_num","2 in (3,2,5,9,5,1)",1,0], ["LIKE ESCAPE","like_escape","b like '%' escape 'a'",1,0], ["LIKE","like","b like 'a%'",1,0], - ["MATCH UNIQUE","match_unique","1 match unique (select a from crash_me)",1,0], + ["MATCH UNIQUE","match_unique", + "1 match unique (select a from crash_me)",1,0], ["MATCH","match","1 match (select a from crash_me)",1,0], ["MATCHES","matches","b matcjhes 'a*'",1,0], ["NOT BETWEEN","not_between","7 not between 4 and 6",1,0], - ["NOT EXISTS","not_exists","not exists (select * from crash_me where a = 2)",1,0], + ["NOT EXISTS","not_exists", + "not exists (select * from crash_me where a = 2)",1,0], ["NOT LIKE","not_like","b not like 'b%'",1,0], - ["NOT UNIQUE","not_unique","not unique (select * from crash_me where a = 2)",1,0], + ["NOT UNIQUE","not_unique", + "not unique (select * from crash_me where a = 2)",1,0], ["UNIQUE","unique","unique (select * from crash_me)",1,0], ); @@ -1176,6 +1178,8 @@ if ($limits{'functions'} eq 'yes') "select $tmp $end_query",[], undef(),4); } $prompt="Need to cast NULL for arithmetic"; + add_log("Need_cast_for_null", + " Check if numeric_null ($numeric_null) is 'NULL'"); save_config_data("Need_cast_for_null", ($numeric_null eq "NULL") ? "no" : "yes", $prompt); @@ -1188,29 +1192,34 @@ else # Test: NOROUND { - my $resultat = 'undefined'; + my $result = 'undefined'; my $error; print "NOROUND: "; save_incomplete('func_extra_noround','Function NOROUND'); # 1) check if noround() function is supported - $error = safe_query("select noround(22.6) $end_query"); + $error = safe_query_l('func_extra_noround',"select noround(22.6) $end_query"); if ($error ne 1) # syntax error -- noround is not supported { - $resultat = 'no' - } else # Ok, now check if it really works - { - $error=safe_query( "create table crash_me_nr (a int)", + $result = 'no' + } + else # Ok, now check if it really works + { + $error=safe_query_l('func_extra_noround', + ["create table crash_me_nr (a int)", "insert into crash_me_nr values(noround(10.2))", - "drop table crash_me_nr $drop_attr"); - if ($error eq 1) { - $resultat = "syntax only"; - } else { - $resultat = 'yes'; - } - } - print "$resultat\n"; - save_config_data('func_extra_noround',$resultat,"Function NOROUND"); + "drop table crash_me_nr $drop_attr"]); + if ($error == 1) + { + $result= "syntax only"; + } + else + { + $result= 'yes'; + } + } + print "$result\n"; + save_config_data('func_extra_noround',$result,"Function NOROUND"); } check_parenthesis("func_sql_","CURRENT_USER"); @@ -1218,33 +1227,311 @@ check_parenthesis("func_sql_","SESSION_USER"); check_parenthesis("func_sql_","SYSTEM_USER"); check_parenthesis("func_sql_","USER"); + +if ($limits{'type_sql_date'} eq 'yes') +{ # + # Checking the format of date in result. + + safe_query("drop table crash_me_d $drop_attr"); + assert("create table crash_me_d (a date)"); + # find the example of date + my $dateexample; + if ($limits{'func_extra_sysdate'} eq 'yes') { + $dateexample=' sysdate() '; + } + elsif ($limits{'func_sql_current_date'} eq 'yes') { + $dateexample='CURRENT_DATE'; + } + elsif ($limits{'func_odbc_curdate'} eq 'yes') { + $dateexample='curdate()'; + } + elsif ($limits{'func_extra_getdate'} eq 'yes') { + $dateexample='getdate()'; + } + elsif ($limits{'func_odbc_now'} eq 'yes') { + $dateexample='now()'; + } else { + #try to guess + $dateexample="DATE '1963-08-16'"; + } ; + + my $key = 'date_format_inresult'; + my $prompt = "Date format in result"; + if (! safe_query_l('date_format_inresult', + "insert into crash_me_d values($dateexample) ")) + { + die "Cannot insert date ($dateexample):".$last_error; + }; + my $sth= $dbh->prepare("select a from crash_me_d"); + add_log('date_format_inresult',"< select a from crash_me_d"); + $sth->execute; + $_= $sth->fetchrow_array; + add_log('date_format_inresult',"> $_"); + safe_query_l($key,"delete from crash_me_d"); + if (/\d{4}-\d{2}-\d{2}/){ save_config_data($key,"iso",$prompt);} + elsif (/\d{2}-\d{2}-\d{2}/){ save_config_data($key,"short iso",$prompt);} + elsif (/\d{2}\.\d{2}\.\d{4}/){ save_config_data($key,"euro",$prompt);} + elsif (/\d{2}\.\d{2}\.\d{2}/){ save_config_data($key,"short euro",$prompt);} + elsif (/\d{2}\/\d{2}\/\d{4}/){ save_config_data($key,"usa",$prompt);} + elsif (/\d{2}\/\d{2}\/\d{2}/){ save_config_data($key,"short usa",$prompt);} + elsif (/\d*/){ save_config_data($key,"YYYYMMDD",$prompt);} + else { save_config_data($key,"unknown",$prompt);}; + $sth->finish; + + check_and_report("Supports YYYY-MM-DD (ISO) format","date_format_ISO", + [ "insert into crash_me_d(a) values ('1963-08-16')"], + "select a from crash_me_d", + ["delete from crash_me_d"], + make_date_r(1963,8,16),1); + + check_and_report("Supports DATE 'YYYY-MM-DD' (ISO) format", + "date_format_ISO_with_date", + [ "insert into crash_me_d(a) values (DATE '1963-08-16')"], + "select a from crash_me_d", + ["delete from crash_me_d"], + make_date_r(1963,8,16),1); + + check_and_report("Supports DD.MM.YYYY (EUR) format","date_format_EUR", + [ "insert into crash_me_d(a) values ('16.08.1963')"], + "select a from crash_me_d", + ["delete from crash_me_d"], + make_date_r(1963,8,16),1); + check_and_report("Supports DATE 'DD.MM.YYYY' (EUR) format", + "date_format_EUR_with_date", + [ "insert into crash_me_d(a) values (DATE '16.08.1963')"], + "select a from crash_me_d", + ["delete from crash_me_d"], + make_date_r(1963,8,16),1); + + check_and_report("Supports YYYYMMDD format", + "date_format_YYYYMMDD", + [ "insert into crash_me_d(a) values ('19630816')"], + "select a from crash_me_d", + ["delete from crash_me_d"], + make_date_r(1963,8,16),1); + check_and_report("Supports DATE 'YYYYMMDD' format", + "date_format_YYYYMMDD_with_date", + [ "insert into crash_me_d(a) values (DATE '19630816')"], + "select a from crash_me_d", + ["delete from crash_me_d"], + make_date_r(1963,8,16),1); + + check_and_report("Supports MM/DD/YYYY format", + "date_format_USA", + [ "insert into crash_me_d(a) values ('08/16/1963')"], + "select a from crash_me_d", + ["delete from crash_me_d"], + make_date_r(1963,8,16),1); + check_and_report("Supports DATE 'MM/DD/YYYY' format", + "date_format_USA_with_date", + [ "insert into crash_me_d(a) values (DATE '08/16/1963')"], + "select a from crash_me_d", + ["delete from crash_me_d"], + make_date_r(1963,8,16),1); + + + + + check_and_report("Supports 0000-00-00 dates","date_zero", + ["create table crash_me2 (a date not null)", + "insert into crash_me2 values (".make_date(0,0,0).")"], + "select a from crash_me2", + ["drop table crash_me2 $drop_attr"], + make_date_r(0,0,0),1); + + check_and_report("Supports 0001-01-01 dates","date_one", + ["create table crash_me2 (a date not null)", + "insert into crash_me2 values (".make_date(1,1,1).")"], + "select a from crash_me2", + ["drop table crash_me2 $drop_attr"], + make_date_r(1,1,1),1); + + check_and_report("Supports 9999-12-31 dates","date_last", + ["create table crash_me2 (a date not null)", + "insert into crash_me2 values (".make_date(9999,12,31).")"], + "select a from crash_me2", + ["drop table crash_me2 $drop_attr"], + make_date_r(9999,12,31),1); + + check_and_report("Supports 'infinity dates","date_infinity", + ["create table crash_me2 (a date not null)", + "insert into crash_me2 values ('infinity')"], + "select a from crash_me2", + ["drop table crash_me2 $drop_attr"], + "infinity",1); + + if (!defined($limits{'date_with_YY'})) + { + check_and_report("Supports YY-MM-DD dates","date_with_YY", + ["create table crash_me2 (a date not null)", + "insert into crash_me2 values ('98-03-03')"], + "select a from crash_me2", + ["drop table crash_me2 $drop_attr"], + make_date_r(1998,3,3),5); + if ($limits{'date_with_YY'} eq "yes") + { + undef($limits{'date_with_YY'}); + check_and_report("Supports YY-MM-DD 2000 compilant dates", + "date_with_YY", + ["create table crash_me2 (a date not null)", + "insert into crash_me2 values ('10-03-03')"], + "select a from crash_me2", + ["drop table crash_me2 $drop_attr"], + make_date_r(2010,3,3),5); + } + } + # Test: WEEK() -{ - my $explain=""; - my $resultat="no"; - my $error; - print "WEEK:"; - save_incomplete('func_odbc_week','WEEK'); - $error = safe_query_result("select week(DATE '1997-02-01') $end_query",5,0); - # actually this query must return 4 or 5 in the $last_result, - # $error can be 1 (not supported at all) , -1 ( probably USA weeks) - # and 0 - EURO weeks - if ($error == -1) { - if ($last_result == 4) { - $resultat = 'USA'; - $explain = ' started from Sunday'; - } else { - $resultat='error'; - $explain = " must return 4 or 5, but $last_error"; - } - } elsif ($error == 0) { - $resultat = 'EURO'; - $explain = ' started from Monday'; - } - print " $resultat\n"; - save_config_data('func_odbc_week',$resultat,"WEEK $explain"); + { + my $result="no"; + my $error; + print "WEEK:"; + save_incomplete('func_odbc_week','WEEK'); + $error = safe_query_result_l('func_odbc_week', + "select week(".make_date(1997,2,1).") $end_query",5,0); + # actually this query must return 4 or 5 in the $last_result, + # $error can be 1 (not supported at all) , -1 ( probably USA weeks) + # and 0 - EURO weeks + if ($error == -1) { + if ($last_result == 4) { + $result = 'USA'; + } else { + $result='error'; + add_log('func_odbc_week', + " must return 4 or 5, but $last_result"); + } + } elsif ($error == 0) { + $result = 'EURO'; + } + print " $result\n"; + save_config_data('func_odbc_week',$result,"WEEK"); + } + + my $insert_query ='insert into crash_me_d values('. + make_date(1997,2,1).')'; + safe_query($insert_query); + + foreach $fn ( ( + ["DAYNAME","dayname","dayname(a)","",2], + ["MONTH","month","month(a)","",2], + ["MONTHNAME","monthname","monthname(a)","",2], + ["DAYOFMONTH","dayofmonth","dayofmonth(a)",1,0], + ["DAYOFWEEK","dayofweek","dayofweek(a)",7,0], + ["DAYOFYEAR","dayofyear","dayofyear(a)",32,0], + ["QUARTER","quarter","quarter(a)",1,0], + ["YEAR","year","year(a)",1997,0])) + { + $prompt='Function '.$fn->[0]; + $key='func_odbc_'.$fn->[1]; + add_log($key,"< ".$insert_query); + check_and_report($prompt,$key, + [],"select ".$fn->[2]." from crash_me_d",[], + $fn->[3],$fn->[4] + ); + + }; + safe_query(['delete from crash_me_d', + 'insert into crash_me_d values('.make_date(1963,8,16).')']); + foreach $fn (( + ["DATEADD","dateadd","dateadd(day,3,make_date(1997,11,30))",0,2], + ["MDY","mdy","mdy(7,1,1998)","make_date_r(1998,07,01)",0], # informix + ["DATEDIFF","datediff", + "datediff(month,'Oct 21 1997','Nov 30 1997')",0,2], + ["DATENAME","datename","datename(month,'Nov 30 1997')",0,2], + ["DATEPART","datepart","datepart(month,'July 20 1997')",0,2], + ["DATE_FORMAT","date_format", + "date_format('1997-01-02 03:04:05','M W D Y y m d h i s w')", 0,2], + ["FROM_DAYS","from_days", + "from_days(729024)","make_date_r(1996,1,1)",1], + ["FROM_UNIXTIME","from_unixtime","from_unixtime(0)",0,2], + ["MONTHS_BETWEEN","months_between", + "months_between(make_date(1997,2,2),make_date(1997,1,1))", + "1.03225806",0], # oracle number of months between 2 dates + ["PERIOD_ADD","period_add","period_add(9602,-12)",199502,0], + ["PERIOD_DIFF","period_diff","period_diff(199505,199404)",13,0], + ["WEEKDAY","weekday","weekday(make_date(1997,11,29))",5,0], + ["ADDDATE",'adddate', + "ADDDATE(make_date(2002,12,01),3)",'make_date_r(2002,12,04)',0], + ["SUBDATE",'subdate', + "SUBDATE(make_date(2002,12,04),3)",'make_date_r(2002,12,01)',0], + ["DATEDIFF (2 arg)",'datediff2arg', + "DATEDIFF(make_date(2002,12,04),make_date(2002,12,01))",'3',0], + ["WEEKOFYEAR",'weekofyear', + "WEEKOFYEAR(make_date(1963,08,16))",'33',0], +# table crash_me_d must contain record with 1963-08-16 (for CHAR) + ["CHAR (conversation date)",'char_date', + "CHAR(a,EUR)",'16.08.1963',0], + ["MAKEDATE",'makedate',"MAKEDATE(1963,228)" + ,'make_date_r(1963,08,16)',0], + ["TO_DAYS","to_days", + "to_days(make_date(1996,01,01))",729024,0], + ["ADD_MONTHS","add_months", + "add_months(make_date(1997,01,01),1)","make_date_r(1997,02,01)",0], + # oracle the date plus n months + ["LAST_DAY","last_day", + "last_day(make_date(1997,04,01))","make_date_r(1997,04,30)",0], + # oracle last day of month of date + ["DATE",'date',"date(make_date(1963,8,16))", + 'make_date_r(1963,8,16)',0], + ["DAY",'day',"DAY(make_date(2002,12,01))",1,0])) + { + $prompt='Function '.$fn->[0]; + $key='func_extra_'.$fn->[1]; + my $qry="select ".$fn->[2]." from crash_me_d"; + while( $qry =~ /^(.*)make_date\((\d+),(\d+),(\d+)\)(.*)$/) + { + my $dt= &make_date($2,$3,$4); + $qry=$1.$dt.$5; + }; + my $result=$fn->[3]; + while( $result =~ /^(.*)make_date_r\((\d+),(\d+),(\d+)\)(.*)$/) + { + my $dt= &make_date_r($2,$3,$4); + $result=$1.$dt.$5; + }; + check_and_report($prompt,$key, + [],$qry,[], + $result,$fn->[4] + ); + + } + + safe_query("drop table crash_me_d $drop_attr"); + } + +# NOT id BETWEEN a and b +if ($limits{'func_where_not_between'} eq 'yes') +{ + my $result = 'error'; + my $err; + my $key='not_id_between'; + my $prompt='NOT ID BETWEEN interprets as ID NOT BETWEEN'; + print "$prompt:"; + save_incomplete($key,$prompt); + safe_query_l($key,["create table crash_me_b (i int)", + "insert into crash_me_b values(2)", + "insert into crash_me_b values(5)"]); + $err =safe_query_result_l($key, + "select i from crash_me_b where not i between 1 and 3", + 5,0); + if ($err eq 1) { + if (not defined($last_result)) { + $result='no'; + }; + }; + if ( $err eq 0) { + $result = 'yes'; + }; + safe_query_l($key,["drop table crash_me_b"]); + save_config_data($key,$result,$prompt); + print "$result\n"; +}; + + + + report("LIKE on numbers","like_with_number", "create table crash_q (a int,b int)", "insert into crash_q values(10,10)", @@ -1289,19 +1576,20 @@ if (defined($tmp)) if (!defined($limits{'multi_table_update'})) { if (check_and_report("Update with many tables","multi_table_update", - ["create table crash_q (a integer,b char(10))", - "insert into crash_q values(1,'c')", - "update crash_q left join crash_me on crash_q.a=crash_me.a set crash_q.b=crash_me.b"], - "select b from crash_q", - ["drop table crash_q $drop_attr"], - "a",1,undef(),2)) + ["create table crash_q (a integer,b char(10))", + "insert into crash_q values(1,'c')", + "update crash_q left join crash_me on crash_q.a=crash_me.a set crash_q.b=crash_me.b"], + "select b from crash_q", + ["drop table crash_q $drop_attr"], + "a",1,undef(),2)) { check_and_report("Update with many tables","multi_table_update", - ["create table crash_q (a integer,b char(10))", - "insert into crash_q values(1,'c')", - "update crash_q,crash_me set crash_q.b=crash_me.b where crash_q.a=crash_me.a"], - "select b from crash_q", - ["drop table crash_q $drop_attr"], + ["create table crash_q (a integer,b char(10))", + "insert into crash_q values(1,'c')", + "update crash_q,crash_me set crash_q.b=crash_me.b ". + "where crash_q.a=crash_me.a"], + "select b from crash_q", + ["drop table crash_q $drop_attr"], "a",1, 1); } @@ -1316,7 +1604,8 @@ report("DELETE FROM table1,table2...","multi_table_delete", check_and_report("Update with sub select","select_table_update", ["create table crash_q (a integer,b char(10))", "insert into crash_q values(1,'c')", - "update crash_q set b= (select b from crash_me where crash_q.a = crash_me.a)"], + "update crash_q set b= ". + "(select b from crash_me where crash_q.a = crash_me.a)"], "select b from crash_q", ["drop table crash_q $drop_attr"], "a",1); @@ -1460,27 +1749,27 @@ report("index in create table",'index_in_create', # later if (!(defined($limits{'create_index'}) && defined($limits{'drop_index'}))) { - if ($res=safe_query("create index crash_q on crash_me (a)")) + if ($res=safe_query_l('create_index',"create index crash_q on crash_me (a)")) { $res="yes"; $drop_res="yes"; $end_drop_keyword=""; - if (!safe_query("drop index crash_q")) + if (!safe_query_l('drop_index',"drop index crash_q")) { # Can't drop the standard way; Check if mSQL - if (safe_query("drop index crash_q from crash_me")) + if (safe_query_l('drop_index',"drop index crash_q from crash_me")) { $drop_res="with 'FROM'"; # Drop is not ANSI SQL $end_drop_keyword="drop index %i from %t"; } # else check if Access or MySQL - elsif (safe_query("drop index crash_q on crash_me")) + elsif (safe_query_l('drop_index',"drop index crash_q on crash_me")) { $drop_res="with 'ON'"; # Drop is not ANSI SQL $end_drop_keyword="drop index %i on %t"; } # else check if MS-SQL - elsif (safe_query("drop index crash_me.crash_q")) + elsif (safe_query_l('drop_index',"drop index crash_me.crash_q")) { $drop_res="with 'table.index'"; # Drop is not ANSI SQL $end_drop_keyword="drop index %t.%i"; @@ -1490,7 +1779,7 @@ if (!(defined($limits{'create_index'}) && defined($limits{'drop_index'}))) { # Old MySQL 3.21 supports only the create index syntax # This means that the second create doesn't give an error. - $res=safe_query(["create index crash_q on crash_me (a)", + $res=safe_query_l('create_index',["create index crash_q on crash_me (a)", "create index crash_q on crash_me (a)", "drop index crash_q"]); $res= $res ? 'ignored' : 'yes'; @@ -1586,25 +1875,31 @@ safe_query("drop table crash_q $drop_attr"); # test of different join types # -assert("create table crash_me2 (a integer not null,b char(10) not null, c1 integer)"); +assert("create table crash_me2 (a integer not null,b char(10) not null,". + " c1 integer)"); assert("insert into crash_me2 (a,b,c1) values (1,'b',1)"); assert("create table crash_me3 (a integer not null,b char(10) not null)"); assert("insert into crash_me3 (a,b) values (1,'b')"); report("inner join","inner_join", - "select crash_me.a from crash_me inner join crash_me2 ON crash_me.a=crash_me2.a"); + "select crash_me.a from crash_me inner join crash_me2 ON ". + "crash_me.a=crash_me2.a"); report("left outer join","left_outer_join", - "select crash_me.a from crash_me left join crash_me2 ON crash_me.a=crash_me2.a"); + "select crash_me.a from crash_me left join crash_me2 ON ". + "crash_me.a=crash_me2.a"); report("natural left outer join","natural_left_outer_join", "select c1 from crash_me natural left join crash_me2"); report("left outer join using","left_outer_join_using", "select c1 from crash_me left join crash_me2 using (a)"); report("left outer join odbc style","odbc_left_outer_join", - "select crash_me.a from { oj crash_me left outer join crash_me2 ON crash_me.a=crash_me2.a }"); + "select crash_me.a from { oj crash_me left outer join crash_me2 ON". + " crash_me.a=crash_me2.a }"); report("right outer join","right_outer_join", - "select crash_me.a from crash_me right join crash_me2 ON crash_me.a=crash_me2.a"); + "select crash_me.a from crash_me right join crash_me2 ON ". + "crash_me.a=crash_me2.a"); report("full outer join","full_outer_join", - "select crash_me.a from crash_me full join crash_me2 ON crash_me.a=crash_me2.a"); + "select crash_me.a from crash_me full join crash_me2 ON "." + crash_me.a=crash_me2.a"); report("cross join (same as from a,b)","cross_join", "select crash_me.a from crash_me cross join crash_me3"); report("natural join","natural_join", @@ -1658,7 +1953,8 @@ assert("drop table crash_me3 $drop_attr"); # >ALL | ANY | SOME - EXISTS - UNIQUE if (report("subqueries","subqueries", - "select a from crash_me where crash_me.a in (select max(a) from crash_me)")) + "select a from crash_me where crash_me.a in ". + "(select max(a) from crash_me)")) { $tmp=new query_repeat([],"select a from crash_me","","", " where a in (select a from crash_me",")", @@ -1728,38 +2024,49 @@ report("views","views", # Test: foreign key { - my $resultat = 'undefined'; + my $result = 'undefined'; my $error; print "foreign keys: "; save_incomplete('foreign_key','foreign keys'); # 1) check if foreign keys are supported - safe_query(create_table("crash_me_qf",["a integer not null"], - ["primary key (a)"])); - $error = safe_query( create_table("crash_me_qf2",["a integer not null", - "foreign key (a) references crash_me_qf (a)"], [])); - - if ($error eq 1) # OK -- syntax is supported + safe_query_l('foreign_key', + create_table("crash_me_qf", + ["a integer not null"], + ["primary key (a)"])); + $error= safe_query_l('foreign_key', + create_table("crash_me_qf2", + ["a integer not null", + "foreign key (a) references crash_me_qf (a)"], + [])); + + if ($error == 1) # OK -- syntax is supported { - $resultat = 'error'; + $result = 'error'; # now check if foreign key really works - safe_query( "insert into crash_me_qf values (1)"); - if (safe_query( "insert into crash_me_qf2 values (2)") eq 1) { - $resultat = 'syntax only'; - } else { - $resultat = 'yes'; - } - - } else { - $resultat = "no"; - } - safe_query( "drop table crash_me_qf2 $drop_attr","drop table crash_me_qf $drop_attr"); - print "$resultat\n"; - save_config_data('foreign_key',$resultat,"foreign keys"); + safe_query_l('foreign_key', "insert into crash_me_qf values (1)"); + if (safe_query_l('foreign_key', "insert into crash_me_qf2 values (2)") eq 1) + { + $result = 'syntax only'; + } + else + { + $result = 'yes'; + } + } + else + { + $result = "no"; + } + safe_query_l('foreign_key', "drop table crash_me_qf2 $drop_attr"); + safe_query_l('foreign_key', "drop table crash_me_qf $drop_attr"); + print "$result\n"; + save_config_data('foreign_key',$result,"foreign keys"); } report("Create SCHEMA","create_schema", - "create schema crash_schema create table crash_q (a int) create table crash_q2(b int)", + "create schema crash_schema create table crash_q (a int) ". + "create table crash_q2(b int)", "drop schema crash_schema cascade"); if ($limits{'foreign_key'} eq 'yes') @@ -1767,7 +2074,10 @@ if ($limits{'foreign_key'} eq 'yes') if ($limits{'create_schema'} eq 'yes') { report("Circular foreign keys","foreign_key_circular", - "create schema crash_schema create table crash_q (a int primary key, b int, foreign key (b) references crash_q2(a)) create table crash_q2(a int, b int, primary key(a), foreign key (b) references crash_q(a))", + "create schema crash_schema create table crash_q ". + "(a int primary key, b int, foreign key (b) references ". + "crash_q2(a)) create table crash_q2(a int, b int, ". + "primary key(a), foreign key (b) references crash_q(a))", "drop schema crash_schema cascade"); } } @@ -1795,35 +2105,47 @@ report("NULL constraint (SyBase style)","constraint_null", report("Triggers (ANSI SQL)","psm_trigger", "create table crash_q (a int ,b int)", - "create trigger crash_trigger after insert on crash_q referencing new table as new_a when (localtime > time '18:00:00') begin atomic end", + "create trigger crash_trigger after insert on crash_q referencing ". + "new table as new_a when (localtime > time '18:00:00') ". + "begin atomic end", "insert into crash_q values(1,2)", "drop trigger crash_trigger", "drop table crash_q $drop_attr"); report("PSM procedures (ANSI SQL)","psm_procedures", "create table crash_q (a int,b int)", - "create procedure crash_proc(in a1 int, in b1 int) language sql modifies sql data begin declare c1 int; set c1 = a1 + b1; insert into crash_q(a,b) values (a1,c1); end", + "create procedure crash_proc(in a1 int, in b1 int) language ". + "sql modifies sql data begin declare c1 int; set c1 = a1 + b1;". + " insert into crash_q(a,b) values (a1,c1); end", "call crash_proc(1,10)", "drop procedure crash_proc", "drop table crash_q $drop_attr"); report("PSM modules (ANSI SQL)","psm_modules", "create table crash_q (a int,b int)", - "create module crash_m declare procedure crash_proc(in a1 int, in b1 int) language sql modifies sql data begin declare c1 int; set c1 = a1 + b1; insert into crash_q(a,b) values (a1,c1); end; declare procedure crash_proc2(INOUT a int, in b int) contains sql set a = b + 10; end module", + "create module crash_m declare procedure ". + "crash_proc(in a1 int, in b1 int) language sql modifies sql ". + "data begin declare c1 int; set c1 = a1 + b1; ". + "insert into crash_q(a,b) values (a1,c1); end; ". + "declare procedure crash_proc2(INOUT a int, in b int) ". + "contains sql set a = b + 10; end module", "call crash_proc(1,10)", "drop module crash_m cascade", "drop table crash_q cascade $drop_attr"); report("PSM functions (ANSI SQL)","psm_functions", "create table crash_q (a int)", - "create function crash_func(in a1 int, in b1 int) returns int language sql deterministic contains sql begin return a1 * b1; end", + "create function crash_func(in a1 int, in b1 int) returns int". + " language sql deterministic contains sql ". + " begin return a1 * b1; end", "insert into crash_q values(crash_func(2,4))", "select a,crash_func(a,2) from crash_q", "drop function crash_func cascade", "drop table crash_q $drop_attr"); report("Domains (ANSI SQL)","domains", - "create domain crash_d as varchar(10) default 'Empty' check (value <> 'abcd')", + "create domain crash_d as varchar(10) default 'Empty' ". + "check (value <> 'abcd')", "create table crash_q(a crash_d, b int)", "insert into crash_q(a,b) values('xyz',10)", "insert into crash_q(b) values(10)", @@ -1999,28 +2321,31 @@ if ($limits{'unique_in_create'} eq 'yes') $max_keys,0)); find_limit("index parts","max_index_parts", - new query_table("create table crash_q ($key_definitions,unique (q0", + new query_table("create table crash_q ". + "($key_definitions,unique (q0", ",q%d","))", - ["insert into crash_q ($key_fields) values ($key_values)"], - "select q0 from crash_q",1, - "drop table crash_q $drop_attr", - $max_keys,1)); + ["insert into crash_q ($key_fields) values ($key_values)"], + "select q0 from crash_q",1, + "drop table crash_q $drop_attr", + $max_keys,1)); find_limit("max index part length","max_index_part_length", - new query_many(["create table crash_q (q char(%d) not null,unique(q))", - "insert into crash_q (q) values ('%s')"], - "select q from crash_q","%s", - ["drop table crash_q $drop_attr"], - $limits{'max_char_size'},0)); + new query_many(["create table crash_q (q char(%d) not null,". + "unique(q))", + "insert into crash_q (q) values ('%s')"], + "select q from crash_q","%s", + ["drop table crash_q $drop_attr"], + $limits{'max_char_size'},0)); if ($limits{'type_sql_varchar(1_arg)'} eq 'yes') { find_limit("index varchar part length","max_index_varchar_part_length", - new query_many(["create table crash_q (q varchar(%d) not null,unique(q))", - "insert into crash_q (q) values ('%s')"], - "select q from crash_q","%s", - ["drop table crash_q $drop_attr"], - $limits{'max_varchar_size'},0)); + new query_many(["create table crash_q (q varchar(%d) not null,". + "unique(q))", + "insert into crash_q (q) values ('%s')"], + "select q from crash_q","%s", + ["drop table crash_q $drop_attr"], + $limits{'max_varchar_size'},0)); } } @@ -2030,6 +2355,9 @@ if ($limits{'create_index'} ne 'no') if ($limits{'create_index'} eq 'ignored' || $limits{'unique_in_create'} eq 'yes') { # This should be true + add_log('max_index', + " max_unique_index=$limits{'max_unique_index'} ,". + "so max_index must be same"); save_config_data('max_index',$limits{'max_unique_index'},"max index"); print "indexes: $limits{'max_index'}\n"; } @@ -2037,10 +2365,11 @@ if ($limits{'create_index'} ne 'no') { if (!defined($limits{'max_index'})) { - assert("create table crash_q ($key_definitions)"); + safe_query_l('max_index',"create table crash_q ($key_definitions)"); for ($i=1; $i <= min($limits{'max_columns'},$max_keys) ; $i++) { - last if (!safe_query("create index crash_q$i on crash_q (q$i)")); + last if (!safe_query_l('max_index', + "create index crash_q$i on crash_q (q$i)")); } save_config_data('max_index',$i == $max_keys ? $max_keys : $i, "max index"); @@ -2056,10 +2385,12 @@ if ($limits{'create_index'} ne 'no') print "indexs: $limits{'max_index'}\n"; if (!defined($limits{'max_unique_index'})) { - assert("create table crash_q ($key_definitions)"); + safe_query_l('max_unique_index', + "create table crash_q ($key_definitions)"); for ($i=0; $i < min($limits{'max_columns'},$max_keys) ; $i++) { - last if (!safe_query("create unique index crash_q$i on crash_q (q$i)")); + last if (!safe_query_l('max_unique_index', + "create unique index crash_q$i on crash_q (q$i)")); } save_config_data('max_unique_index',$i == $max_keys ? $max_keys : $i, "max unique index"); @@ -2075,7 +2406,8 @@ if ($limits{'create_index'} ne 'no') print "unique indexes: $limits{'max_unique_index'}\n"; if (!defined($limits{'max_index_parts'})) { - assert("create table crash_q ($key_definitions)"); + safe_query_l('max_index_parts', + "create table crash_q ($key_definitions)"); $end_drop=$end_drop_keyword; $end_drop =~ s/%i/crash_q1%d/; $end_drop =~ s/%t/crash_q/; @@ -2156,23 +2488,29 @@ if (!defined($limits{$key})) { print "$prompt="; save_incomplete($key,$prompt); - if (!safe_query($server->create("crash_me_a",["a decimal(10,2)","b decimal(10,2)"]))) + if (!safe_query_l($key,$server->create("crash_me_a", + ["a decimal(10,2)","b decimal(10,2)"]))) { print DBI->errstr(); die "Can't create table 'crash_me_a' $DBI::errstr\n"; }; - if (!safe_query(["insert into crash_me_a (a,b) values (11.4,18.9)"])) + if (!safe_query_l($key, + ["insert into crash_me_a (a,b) values (11.4,18.9)"])) { die "Can't insert into table 'crash_me_a' a record: $DBI::errstr\n"; }; $arithmetic_safe = 'no'; $arithmetic_safe = 'yes' - if ( (safe_query_result('select count(*) from crash_me_a where a+b=30.3',1,0) == 0) - and (safe_query_result('select count(*) from crash_me_a where a+b-30.3 = 0',1,0) == 0) - and (safe_query_result('select count(*) from crash_me_a where a+b-30.3 < 0',0,0) == 0) - and (safe_query_result('select count(*) from crash_me_a where a+b-30.3 > 0',0,0) == 0) ); + if ( (safe_query_result_l($key, + 'select count(*) from crash_me_a where a+b=30.3',1,0) == 0) + and (safe_query_result_l($key, + 'select count(*) from crash_me_a where a+b-30.3 = 0',1,0) == 0) + and (safe_query_result_l($key, + 'select count(*) from crash_me_a where a+b-30.3 < 0',0,0) == 0) + and (safe_query_result_l($key, + 'select count(*) from crash_me_a where a+b-30.3 > 0',0,0) == 0)); save_config_data($key,$arithmetic_safe,$prompt); print "$arithmetic_safe\n"; assert("drop table crash_me_a $drop_attr"); @@ -2188,11 +2526,12 @@ if (!safe_query($server->create("crash_me_n",["i integer","r integer"]))) print DBI->errstr(); die "Can't create table 'crash_me_n' $DBI::errstr\n"; }; -assert("insert into crash_me_n (i) values(1)"); -assert("insert into crash_me_n values(2,2)"); -assert("insert into crash_me_n values(3,3)"); -assert("insert into crash_me_n values(4,4)"); -assert("insert into crash_me_n (i) values(5)"); + +safe_query_l("position_of_null",["insert into crash_me_n (i) values(1)", +"insert into crash_me_n values(2,2)", +"insert into crash_me_n values(3,3)", +"insert into crash_me_n values(4,4)", +"insert into crash_me_n (i) values(5)"]); $key = "position_of_null"; $prompt ="Where is null values in sorted recordset"; @@ -2202,7 +2541,8 @@ if (!defined($limits{$key})) print "$prompt="; $sth=$dbh->prepare("select r from crash_me_n order by r "); $sth->execute; - $limit= detect_null_position($sth); + add_log($key,"< select r from crash_me_n order by r "); + $limit= detect_null_position($key,$sth); $sth->finish; print "$limit\n"; save_config_data($key,$limit,$prompt); @@ -2218,7 +2558,8 @@ if (!defined($limits{$key})) print "$prompt="; $sth=$dbh->prepare("select r from crash_me_n order by r desc"); $sth->execute; - $limit= detect_null_position($sth); + add_log($key,"< select r from crash_me_n order by r desc"); + $limit= detect_null_position($key,$sth); $sth->finish; print "$limit\n"; save_config_data($key,$limit,$prompt); @@ -2230,6 +2571,9 @@ if (!defined($limits{$key})) assert("drop table crash_me_n $drop_attr"); + + + # # End of test # @@ -2243,18 +2587,31 @@ $dbh->disconnect || warn $dbh->errstr; save_all_config_data(); exit 0; +# End of test +# + +$dbh->do("drop table crash_me $drop_attr"); # Remove temporary table + +print "crash-me safe: $limits{'crash_me_safe'}\n"; +print "reconnected $reconnect_count times\n"; + +$dbh->disconnect || warn $dbh->errstr; +save_all_config_data(); +exit 0; + # Check where is nulls in the sorted result (for) # it expects exactly 5 rows in the result sub detect_null_position { + my $key = shift; my $sth = shift; my ($z,$r1,$r2,$r3,$r4,$r5); - $r1 = $sth->fetchrow_array; - $r2 = $sth->fetchrow_array; - $r3 = $sth->fetchrow_array; - $r4 = $sth->fetchrow_array; - $r5 = $sth->fetchrow_array; + $r1 = $sth->fetchrow_array; add_log($key,"> $r1"); + $r2 = $sth->fetchrow_array; add_log($key,"> $r2"); + $r3 = $sth->fetchrow_array; add_log($key,"> $r3"); + $r4 = $sth->fetchrow_array; add_log($key,"> $r4"); + $r5 = $sth->fetchrow_array; add_log($key,"> $r5"); return "first" if ( !defined($r1) && !defined($r2) && defined($r3)); return "last" if ( !defined($r5) && !defined($r4) && defined($r3)); return "random"; @@ -2263,19 +2620,27 @@ sub detect_null_position sub check_parenthesis { my $prefix=shift; my $fn=shift; - my $resultat='no'; + my $result='no'; my $param_name=$prefix.lc($fn); + my $r; save_incomplete($param_name,$fn); - if (safe_query("select $fn $end_query") == 1) + $r = safe_query("select $fn $end_query"); + add_log($param_name,$safe_query_log); + if ($r == 1) { - $resultat="yes"; + $result="yes"; } - elsif ( safe_query("select $fn() $end_query") == 1) - { - $resultat="with_parenthesis"; + else{ + $r = safe_query("select $fn() $end_query"); + add_log($param_name,$safe_query_log); + if ( $r == 1) + { + $result="with_parenthesis"; + } } - save_config_data($param_name,$resultat,$fn); + + save_config_data($param_name,$result,$fn); } sub check_constraint { @@ -2287,24 +2652,76 @@ sub check_constraint { save_incomplete($key,$prompt); print "$prompt="; my $res = 'no'; - - if ( ($t=safe_query($create)) == 1) + my $t; + $t=safe_query($create); + add_log($key,$safe_query_log); + if ( $t == 1) { $res='yes'; - if (safe_query($check) == 1) + $t= safe_query($check); + add_log($key,$safe_query_log); + if ($t == 1) { $res='syntax only'; } } safe_query($drop); + add_log($key,$safe_query_log); + save_config_data($key,$res,$prompt); print "$res\n"; } +sub make_date_r { + my $year=shift; + my $month=shift; + my $day=shift; + $_ = $limits{'date_format_inresult'}; + return sprintf "%02d-%02d-%02d", ($year%100),$month,$day if (/^short iso$/); + return sprintf "%04d-%02d-%02d", $year,$month,$day if (/^iso/); + return sprintf "%02d.%02d.%02d", $day,$month,($year%100) if (/^short euro/); + return sprintf "%02d.%02d.%04d", $day,$month,$year if (/^euro/); + return sprintf "%02d/%02d/%02d", $month,$day,($year%100) if (/^short usa/); + return sprintf "%02d/%02d/%04d", $month,$day,$year if (/^usa/); + return sprintf "%04d%02d%02d", $year,$month,$day if (/^YYYYMMDD/); + return "UNKNOWN FORMAT"; +} + + +sub make_date { + my $year=shift; + my $month=shift; + my $day=shift; + return sprintf "'%04d-%02d-%02d'", $year,$month,$day + if ($limits{'date_format_ISO'} eq yes); + return sprintf "DATE '%04d-%02d-%02d'", $year,$month,$day + if ($limits{'date_format_ISO_with_date'} eq yes); + return sprintf "'%02d.%02d.%04d'", $day,$month,$year + if ($limits{'date_format_EUR'} eq 'yes'); + return sprintf "DATE '%02d.%02d.%04d'", $day,$month,$year + if ($limits{'date_format_EUR_with_date'} eq 'yes'); + return sprintf "'%02d/%02d/%04d'", $month,$day,$year + if ($limits{'date_format_USA'} eq 'yes'); + return sprintf "DATE '%02d/%02d/%04d'", $month,$day,$year + if ($limits{'date_format_USA_with_date'} eq 'yes'); + return sprintf "'%04d%02d%02d'", $year,$month,$day + if ($limits{'date_format_YYYYMMDD'} eq 'yes'); + return sprintf "DATE '%04d%02d%02d'", $year,$month,$day + if ($limits{'date_format_YYYYMMDD_with_date'} eq 'yes'); + return "UNKNOWN FORMAT"; +} + + +sub version +{ + print "$0 Ver $version\n"; +} + + sub usage { + version(); print <<EOF; -$0 Ver $version This program tries to find all limits and capabilities for a SQL server. As it will use the server in some 'unexpected' ways, one @@ -2332,6 +2749,9 @@ $0 takes the following options: --batch-mode Don\'t ask any questions, quit on errors. +--config-file='filename' + Read limit results from specific file + --comment='some comment' Add this comment to the crash-me limit file @@ -2368,7 +2788,7 @@ $0 takes the following options: --password='password' Password for the current user. - + --restart Save states during each limit tests. This will make it possible to continue by restarting with the same options if there is some bug in the DBI or @@ -2376,9 +2796,15 @@ $0 takes the following options: --server='server name' (Default $opt_server) Run the test on the given server. - Known servers names are: Access, Adabas, AdabasD, Empress, Oracle, Informix, DB2, Mimer, mSQL, MS-SQL, MySQL, Pg, Solid or Sybase. + Known servers names are: Access, Adabas, AdabasD, Empress, Oracle, + Informix, DB2, Mimer, mSQL, MS-SQL, MySQL, Pg, Solid or Sybase. For others $0 can\'t report the server version. +--suffix='suffix' (Default '') + Add suffix to the output filename. For instance if you run crash-me like + "crash-me --suffix="myisam", + then output filename will look "mysql-myisam.cfg". + --user='user_name' User name to log into the SQL server. @@ -2388,6 +2814,10 @@ $0 takes the following options: --sleep='time in seconds' (Default $opt_sleep) Wait this long before restarting server. +--verbose +--noverbose + Log into the result file queries performed for determination parameter value + EOF exit(0); } @@ -2540,11 +2970,13 @@ sub safe_connect $dbh->{LongReadLen}= 16000000; # Set max retrieval buffer return $dbh; } - print "Error: $DBI::errstr; $server->{'data_source'} - '$opt_user' - '$opt_password'\n"; + print "Error: $DBI::errstr; $server->{'data_source'} ". + " - '$opt_user' - '$opt_password'\n"; print "I got the above error when connecting to $opt_server\n"; if (defined($object) && defined($object->{'limit'})) { - print "This check was done with limit: $object->{'limit'}.\nNext check will be done with a smaller limit!\n"; + print "This check was done with limit: $object->{'limit'}.". + "\nNext check will be done with a smaller limit!\n"; $object=undef(); } save_config_data('crash_me_safe','no',"crash me safe"); @@ -2600,6 +3032,15 @@ sub check_connect # # print query if debugging # +sub repr_query { + my $query=shift; + if (length($query) > 130) + { + $query=substr($query,0,120) . "...(" . (length($query)-120) . ")"; + } + return $query; +} + sub print_query { my ($query)=@_; @@ -2616,13 +3057,23 @@ sub print_query # # Do one or many queries. Return 1 if all was ok -# Note that all rows are executed (to ensure that we execute drop table commands) +# Note that all rows are executed +# (to ensure that we execute drop table commands) # +sub safe_query_l { + my $key = shift; + my $q = shift; + my $r = safe_query($q); + add_log($key,$safe_query_log); + return $r; +} + sub safe_query { my($queries)=@_; my($query,$ok,$retry_ok,$retry,@tmp,$sth); + $safe_query_log=""; $ok=1; if (ref($queries) ne "ARRAY") { @@ -2631,11 +3082,14 @@ sub safe_query } foreach $query (@$queries) { - printf "query1: %-80.80s ...(%d - %d)\n",$query,length($query),$retry_limit if ($opt_log_all_queries); + printf "query1: %-80.80s ...(%d - %d)\n",$query, + length($query),$retry_limit if ($opt_log_all_queries); print LOG "$query;\n" if ($opt_log); + $safe_query_log .= "< $query\n"; if (length($query) > $query_size) { $ok=0; + $safe_query_log .= "Query is too long\n"; next; } @@ -2645,6 +3099,7 @@ sub safe_query if (! ($sth=$dbh->prepare($query))) { print_query($query); + $safe_query_log .= "> couldn't prepare:". $dbh->errstr. "\n"; $retry=100 if (!$server->abort_if_fatal_error()); # Force a reconnect because of Access drop table bug! if ($retry == $retry_limit-2) @@ -2659,6 +3114,7 @@ sub safe_query if (!$sth->execute()) { print_query($query); + $safe_query_log .= "> execute error:". $dbh->errstr. "\n"; $retry=100 if (!$server->abort_if_fatal_error()); # Force a reconnect because of Access drop table bug! if ($retry == $retry_limit-2) @@ -2672,6 +3128,7 @@ sub safe_query { $retry = $retry_limit; $retry_ok = 1; + $safe_query_log .= "> OK\n"; } $sth->finish; } @@ -2687,6 +3144,213 @@ sub safe_query return $ok; } +sub check_reserved_words +{ + my ($dbh)= @_; + + my $answer, $prompt, $config, $keyword_type; + + my @keywords_ext = ( "ansi-92/99", "ansi92", "ansi99", "extra"); + + my %reserved_words = ( + 'ABSOLUTE' => 0, 'ACTION' => 0, 'ADD' => 0, + 'AFTER' => 0, 'ALIAS' => 0, 'ALL' => 0, + 'ALLOCATE' => 0, 'ALTER' => 0, 'AND' => 0, + 'ANY' => 0, 'ARE' => 0, 'AS' => 0, + 'ASC' => 0, 'ASSERTION' => 0, 'AT' => 0, + 'AUTHORIZATION' => 0, 'BEFORE' => 0, 'BEGIN' => 0, + 'BIT' => 0, 'BOOLEAN' => 0, 'BOTH' => 0, + 'BREADTH' => 0, 'BY' => 0, 'CALL' => 0, + 'CASCADE' => 0, 'CASCADED' => 0, 'CASE' => 0, + 'CAST' => 0, 'CATALOG' => 0, 'CHAR' => 0, + 'CHARACTER' => 0, 'CHECK' => 0, 'CLOSE' => 0, + 'COLLATE' => 0, 'COLLATION' => 0, 'COLUMN' => 0, + 'COMMIT' => 0, 'COMPLETION' => 0, 'CONNECT' => 0, + 'CONNECTION' => 0, 'CONSTRAINT' => 0, 'CONSTRAINTS' => 0, + 'CONTINUE' => 0, 'CORRESPONDING' => 0, 'CREATE' => 0, + 'CROSS' => 0, 'CURRENT' => 0, 'CURRENT_DATE' => 0, + 'CURRENT_TIME' => 0,'CURRENT_TIMESTAMP' => 0, 'CURRENT_USER' => 0, + 'CURSOR' => 0, 'CYCLE' => 0, 'DATA' => 0, + 'DATE' => 0, 'DAY' => 0, 'DEALLOCATE' => 0, + 'DEC' => 0, 'DECIMAL' => 0, 'DECLARE' => 0, + 'DEFAULT' => 0, 'DEFERRABLE' => 0, 'DEFERRED' => 0, + 'DELETE' => 0, 'DEPTH' => 0, 'DESC' => 0, + 'DESCRIBE' => 0, 'DESCRIPTOR' => 0, 'DIAGNOSTICS' => 0, + 'DICTIONARY' => 0, 'DISCONNECT' => 0, 'DISTINCT' => 0, + 'DOMAIN' => 0, 'DOUBLE' => 0, 'DROP' => 0, + 'EACH' => 0, 'ELSE' => 0, 'ELSEIF' => 0, + 'END' => 0, 'END-EXEC' => 0, 'EQUALS' => 0, + 'ESCAPE' => 0, 'EXCEPT' => 0, 'EXCEPTION' => 0, + 'EXEC' => 0, 'EXECUTE' => 0, 'EXTERNAL' => 0, + 'FALSE' => 0, 'FETCH' => 0, 'FIRST' => 0, + 'FLOAT' => 0, 'FOR' => 0, 'FOREIGN' => 0, + 'FOUND' => 0, 'FROM' => 0, 'FULL' => 0, + 'GENERAL' => 0, 'GET' => 0, 'GLOBAL' => 0, + 'GO' => 0, 'GOTO' => 0, 'GRANT' => 0, + 'GROUP' => 0, 'HAVING' => 0, 'HOUR' => 0, + 'IDENTITY' => 0, 'IF' => 0, 'IGNORE' => 0, + 'IMMEDIATE' => 0, 'IN' => 0, 'INDICATOR' => 0, + 'INITIALLY' => 0, 'INNER' => 0, 'INPUT' => 0, + 'INSERT' => 0, 'INT' => 0, 'INTEGER' => 0, + 'INTERSECT' => 0, 'INTERVAL' => 0, 'INTO' => 0, + 'IS' => 0, 'ISOLATION' => 0, 'JOIN' => 0, + 'KEY' => 0, 'LANGUAGE' => 0, 'LAST' => 0, + 'LEADING' => 0, 'LEAVE' => 0, 'LEFT' => 0, + 'LESS' => 0, 'LEVEL' => 0, 'LIKE' => 0, + 'LIMIT' => 0, 'LOCAL' => 0, 'LOOP' => 0, + 'MATCH' => 0, 'MINUTE' => 0, 'MODIFY' => 0, + 'MODULE' => 0, 'MONTH' => 0, 'NAMES' => 0, + 'NATIONAL' => 0, 'NATURAL' => 0, 'NCHAR' => 0, + 'NEW' => 0, 'NEXT' => 0, 'NO' => 0, + 'NONE' => 0, 'NOT' => 0, 'NULL' => 0, + 'NUMERIC' => 0, 'OBJECT' => 0, 'OF' => 0, + 'OFF' => 0, 'OLD' => 0, 'ON' => 0, + 'ONLY' => 0, 'OPEN' => 0, 'OPERATION' => 0, + 'OPTION' => 0, 'OR' => 0, 'ORDER' => 0, + 'OUTER' => 0, 'OUTPUT' => 0, 'PAD' => 0, + 'PARAMETERS' => 0, 'PARTIAL' => 0, 'PRECISION' => 0, + 'PREORDER' => 0, 'PREPARE' => 0, 'PRESERVE' => 0, + 'PRIMARY' => 0, 'PRIOR' => 0, 'PRIVILEGES' => 0, + 'PROCEDURE' => 0, 'PUBLIC' => 0, 'READ' => 0, + 'REAL' => 0, 'RECURSIVE' => 0, 'REF' => 0, + 'REFERENCES' => 0, 'REFERENCING' => 0, 'RELATIVE' => 0, + 'RESIGNAL' => 0, 'RESTRICT' => 0, 'RETURN' => 0, + 'RETURNS' => 0, 'REVOKE' => 0, 'RIGHT' => 0, + 'ROLE' => 0, 'ROLLBACK' => 0, 'ROUTINE' => 0, + 'ROW' => 0, 'ROWS' => 0, 'SAVEPOINT' => 0, + 'SCHEMA' => 0, 'SCROLL' => 0, 'SEARCH' => 0, + 'SECOND' => 0, 'SECTION' => 0, 'SELECT' => 0, + 'SEQUENCE' => 0, 'SESSION' => 0, 'SESSION_USER' => 0, + 'SET' => 0, 'SIGNAL' => 0, 'SIZE' => 0, + 'SMALLINT' => 0, 'SOME' => 0, 'SPACE' => 0, + 'SQL' => 0, 'SQLEXCEPTION' => 0, 'SQLSTATE' => 0, + 'SQLWARNING' => 0, 'STRUCTURE' => 0, 'SYSTEM_USER' => 0, + 'TABLE' => 0, 'TEMPORARY' => 0, 'THEN' => 0, + 'TIME' => 0, 'TIMESTAMP' => 0, 'TIMEZONE_HOUR' => 0, + 'TIMEZONE_MINUTE' => 0, 'TO' => 0, 'TRAILING' => 0, + 'TRANSACTION' => 0, 'TRANSLATION' => 0, 'TRIGGER' => 0, + 'TRUE' => 0, 'UNDER' => 0, 'UNION' => 0, + 'UNIQUE' => 0, 'UNKNOWN' => 0, 'UPDATE' => 0, + 'USAGE' => 0, 'USER' => 0, 'USING' => 0, + 'VALUE' => 0, 'VALUES' => 0, 'VARCHAR' => 0, + 'VARIABLE' => 0, 'VARYING' => 0, 'VIEW' => 0, + 'WHEN' => 0, 'WHENEVER' => 0, 'WHERE' => 0, + 'WHILE' => 0, 'WITH' => 0, 'WITHOUT' => 0, + 'WORK' => 0, 'WRITE' => 0, 'YEAR' => 0, + 'ZONE' => 0, + + 'ASYNC' => 1, 'AVG' => 1, 'BETWEEN' => 1, + 'BIT_LENGTH' => 1,'CHARACTER_LENGTH' => 1, 'CHAR_LENGTH' => 1, + 'COALESCE' => 1, 'CONVERT' => 1, 'COUNT' => 1, + 'EXISTS' => 1, 'EXTRACT' => 1, 'INSENSITIVE' => 1, + 'LOWER' => 1, 'MAX' => 1, 'MIN' => 1, + 'NULLIF' => 1, 'OCTET_LENGTH' => 1, 'OID' => 1, + 'OPERATORS' => 1, 'OTHERS' => 1, 'OVERLAPS' => 1, + 'PENDANT' => 1, 'POSITION' => 1, 'PRIVATE' => 1, + 'PROTECTED' => 1, 'REPLACE' => 1, 'SENSITIVE' => 1, + 'SIMILAR' => 1, 'SQLCODE' => 1, 'SQLERROR' => 1, + 'SUBSTRING' => 1, 'SUM' => 1, 'TEST' => 1, + 'THERE' => 1, 'TRANSLATE' => 1, 'TRIM' => 1, + 'TYPE' => 1, 'UPPER' => 1, 'VIRTUAL' => 1, + 'VISIBLE' => 1, 'WAIT' => 1, + + 'ADMIN' => 2, 'AGGREGATE' => 2, 'ARRAY' => 2, + 'BINARY' => 2, 'BLOB' => 2, 'CLASS' => 2, + 'CLOB' => 2, 'CONDITION' => 2, 'CONSTRUCTOR' => 2, + 'CONTAINS' => 2, 'CUBE' => 2, 'CURRENT_PATH' => 2, + 'CURRENT_ROLE' => 2, 'DATALINK' => 2, 'DEREF' => 2, + 'DESTROY' => 2, 'DESTRUCTOR' => 2, 'DETERMINISTIC' => 2, + 'DO' => 2, 'DYNAMIC' => 2, 'EVERY' => 2, + 'EXIT' => 2, 'EXPAND' => 2, 'EXPANDING' => 2, + 'FREE' => 2, 'FUNCTION' => 2, 'GROUPING' => 2, + 'HANDLER' => 2, 'HAST' => 2, 'HOST' => 2, + 'INITIALIZE' => 2, 'INOUT' => 2, 'ITERATE' => 2, + 'LARGE' => 2, 'LATERAL' => 2, 'LOCALTIME' => 2, + 'LOCALTIMESTAMP' => 2, 'LOCATOR' => 2, 'MEETS' => 2, + 'MODIFIES' => 2, 'NCLOB' => 2, 'NORMALIZE' => 2, + 'ORDINALITY' => 2, 'OUT' => 2, 'PARAMETER' => 2, + 'PATH' => 2, 'PERIOD' => 2, 'POSTFIX' => 2, + 'PRECEDES' => 2, 'PREFIX' => 2, 'READS' => 2, + 'REDO' => 2, 'REPEAT' => 2, 'RESULT' => 2, + 'ROLLUP' => 2, 'SETS' => 2, 'SPECIFIC' => 2, + 'SPECIFICTYPE' => 2, 'START' => 2, 'STATE' => 2, + 'STATIC' => 2, 'SUCCEEDS' => 2, 'TERMINATE' => 2, + 'THAN' => 2, 'TREAT' => 2, 'UNDO' => 2, + 'UNTIL' => 2, + + 'ACCESS' => 3, 'ANALYZE' => 3, 'AUDIT' => 3, + 'AUTO_INCREMENT' => 3, 'BACKUP' => 3, 'BDB' => 3, + 'BERKELEYDB' => 3, 'BIGINT' => 3, 'BREAK' => 3, + 'BROWSE' => 3, 'BTREE' => 3, 'BULK' => 3, + 'CHANGE' => 3, 'CHECKPOINT' => 3, 'CLUSTER' => 3, + 'CLUSTERED' => 3, 'COLUMNS' => 3, 'COMMENT' => 3, + 'COMPRESS' => 3, 'COMPUTE' => 3, 'CONTAINSTABLE' => 3, + 'DATABASE' => 3, 'DATABASES' => 3, 'DAY_HOUR' => 3, + 'DAY_MINUTE' => 3, 'DAY_SECOND' => 3, 'DBCC' => 3, + 'DELAYED' => 3, 'DENY' => 3, 'DISK' => 3, + 'DISTINCTROW' => 3, 'DISTRIBUTED' => 3, 'DUMMY' => 3, + 'DUMP' => 3, 'ENCLOSED' => 3, 'ERRLVL' => 3, + 'ERRORS' => 3, 'ESCAPED' => 3, 'EXCLUSIVE' => 3, + 'EXPLAIN' => 3, 'FIELDS' => 3, 'FILE' => 3, + 'FILLFACTOR' => 3, 'FREETEXT' => 3, 'FREETEXTTABLE' => 3, + 'FULLTEXT' => 3, 'GEOMETRY' => 3, 'HASH' => 3, + 'HIGH_PRIORITY' => 3, 'HOLDLOCK' => 3, 'HOUR_MINUTE' => 3, + 'HOUR_SECOND' => 3, 'IDENTIFIED' => 3, 'IDENTITYCOL' => 3, + 'IDENTITY_INSERT' => 3, 'INCREMENT' => 3, 'INDEX' => 3, + 'INFILE' => 3, 'INITIAL' => 3, 'INNODB' => 3, + 'KEYS' => 3, 'KILL' => 3, 'LINENO' => 3, + 'LINES' => 3, 'LOAD' => 3, 'LOCK' => 3, + 'LONG' => 3, 'LONGBLOB' => 3, 'LONGTEXT' => 3, + 'LOW_PRIORITY' => 3, 'MASTER_SERVER_ID' => 3, 'MAXEXTENTS' => 3, + 'MEDIUMBLOB' => 3, 'MEDIUMINT' => 3, 'MEDIUMTEXT' => 3, + 'MIDDLEINT' => 3, 'MINUS' => 3, 'MINUTE_SECOND' => 3, + 'MLSLABEL' => 3, 'MODE' => 3, 'MRG_MYISAM' => 3, + 'NOAUDIT' => 3, 'NOCHECK' => 3, 'NOCOMPRESS' => 3, + 'NONCLUSTERED' => 3, 'NOWAIT' => 3, 'NUMBER' => 3, + 'OFFLINE' => 3, 'OFFSETS' => 3, 'ONLINE' => 3, + 'OPENDATASOURCE' => 3, 'OPENQUERY' => 3, 'OPENROWSET' => 3, + 'OPENXML' => 3, 'OPTIMIZE' => 3, 'OPTIONALLY' => 3, + 'OUTFILE' => 3, 'OVER' => 3, 'PCTFREE' => 3, + 'PERCENT' => 3, 'PLAN' => 3, 'PRINT' => 3, + 'PROC' => 3, 'PURGE' => 3, 'RAISERROR' => 3, + 'RAW' => 3, 'READTEXT' => 3, 'RECONFIGURE' => 3, + 'REGEXP' => 3, 'RENAME' => 3, 'REPLICATION' => 3, + 'REQUIRE' => 3, 'RESOURCE' => 3, 'RESTORE' => 3, + 'RLIKE' => 3, 'ROWCOUNT' => 3, 'ROWGUIDCOL' => 3, + 'ROWID' => 3, 'ROWNUM' => 3, 'RTREE' => 3, + 'RULE' => 3, 'SAVE' => 3, 'SETUSER' => 3, + 'SHARE' => 3, 'SHOW' => 3, 'SHUTDOWN' => 3, + 'SONAME' => 3, 'SPATIAL' => 3, 'SQL_BIG_RESULT' => 3, +'SQL_CALC_FOUND_ROWS' => 3,'SQL_SMALL_RESULT' => 3, 'SSL' => 3, + 'STARTING' => 3, 'STATISTICS' => 3, 'STRAIGHT_JOIN' => 3, + 'STRIPED' => 3, 'SUCCESSFUL' => 3, 'SYNONYM' => 3, + 'SYSDATE' => 3, 'TABLES' => 3, 'TERMINATED' => 3, + 'TEXTSIZE' => 3, 'TINYBLOB' => 3, 'TINYINT' => 3, + 'TINYTEXT' => 3, 'TOP' => 3, 'TRAN' => 3, + 'TRUNCATE' => 3, 'TSEQUAL' => 3, 'TYPES' => 3, + 'UID' => 3, 'UNLOCK' => 3, 'UNSIGNED' => 3, + 'UPDATETEXT' => 3, 'USE' => 3, 'USER_RESOURCES' => 3, + 'VALIDATE' => 3, 'VARBINARY' => 3, 'VARCHAR2' => 3, + 'WAITFOR' => 3, 'WARNINGS' => 3, 'WRITETEXT' => 3, + 'XOR' => 3, 'YEAR_MONTH' => 3, 'ZEROFILL' => 3 +); + + + safe_query("drop table crash_me10 $drop_attr"); + + foreach my $keyword (sort {$a cmp $b} keys %reserved_words) + { + $keyword_type= $reserved_words{$keyword}; + + $prompt= "Keyword ".$keyword; + $config= "reserved_word_".$keywords_ext[$keyword_type]."_".lc($keyword); + + report_fail($prompt,$config, + "create table crash_me10 ($keyword int not null)", + "drop table crash_me10 $drop_attr" + ); + } +} # # Do a query on a query package object. @@ -2747,7 +3411,17 @@ sub report print "$prompt: "; if (!defined($limits{$limit})) { - save_config_data($limit,safe_query(\@queries) ? "yes" : "no",$prompt); + my $queries_result = safe_query(\@queries); + add_log($limit, $safe_query_log); + my $report_result; + if ( $queries_result) { + $report_result= "yes"; + add_log($limit,"As far as all queries returned OK, result is YES"); + } else { + $report_result= "no"; + add_log($limit,"As far as some queries didnt return OK, result is NO"); + } + save_config_data($limit,$report_result,$prompt); } print "$limits{$limit}\n"; return $limits{$limit} ne "no"; @@ -2759,7 +3433,17 @@ sub report_fail print "$prompt: "; if (!defined($limits{$limit})) { - save_config_data($limit,safe_query(\@queries) ? "no" : "yes",$prompt); + my $queries_result = safe_query(\@queries); + add_log($limit, $safe_query_log); + my $report_result; + if ( $queries_result) { + $report_result= "no"; + add_log($limit,"As far as all queries returned OK, result is NO"); + } else { + $report_result= "yes"; + add_log($limit,"As far as some queries didnt return OK, result is YES"); + } + save_config_data($limit,$report_result,$prompt); } print "$limits{$limit}\n"; return $limits{$limit} ne "no"; @@ -2779,7 +3463,7 @@ sub report_one $result="no"; foreach $query (@$queries) { - if (safe_query($query->[0])) + if (safe_query_l($limit,$query->[0])) { $result= $query->[1]; last; @@ -2803,6 +3487,7 @@ sub report_result { save_incomplete($limit,$prompt); $error=safe_query_result($query,"1",2); + add_log($limit,$safe_query_result_log); save_config_data($limit,$error ? "not supported" :$last_result,$prompt); } print "$limits{$limit}\n"; @@ -2823,16 +3508,19 @@ sub report_trans $dbh->rollback; $dbh->{AutoCommit} = 1; if (safe_query_result($check,"","")) { + add_log($limit,$safe_query_result_log); save_config_data($limit,"yes",$limit); } safe_query($clear); } else { + add_log($limit,$safe_query_log); save_config_data($limit,"error",$limit); } $dbh->{AutoCommit} = 1; } else { + add_log($limit,"Couldnt undef autocommit ?? "); save_config_data($limit,"no",$limit); } safe_query($clear); @@ -2851,20 +3539,26 @@ sub report_rollback { if (safe_query(\@$queries)) { + add_log($limit,$safe_query_log); + $dbh->rollback; $dbh->{AutoCommit} = 1; if (safe_query($check)) { + add_log($limit,$safe_query_log); save_config_data($limit,"no",$limit); } else { + add_log($limit,$safe_query_log); save_config_data($limit,"yes",$limit); }; safe_query($clear); } else { + add_log($limit,$safe_query_log); save_config_data($limit,"error",$limit); } } else { + add_log($limit,'Couldnt undef Autocommit??'); save_config_data($limit,"error",$limit); } safe_query($clear); @@ -2886,8 +3580,14 @@ sub check_and_report { save_incomplete($limit,$prompt); $tmp=1-safe_query(\@$pre); - $tmp=safe_query_result($query,$answer,$string_type) if (!$tmp); + add_log($limit,$safe_query_log); + if (!$tmp) + { + $tmp=safe_query_result($query,$answer,$string_type) ; + add_log($limit,$safe_query_result_log); + }; safe_query(\@$post); + add_log($limit,$safe_query_log); delete $limits{$limit}; if ($function == 3) # Report error as 'no'. { @@ -2925,7 +3625,7 @@ sub try_and_report foreach $test (@tests) { my $tmp_type= shift(@$test); - if (safe_query(\@$test)) + if (safe_query_l($limit,\@$test)) { $type=$tmp_type; goto outer; @@ -2944,32 +3644,49 @@ sub try_and_report sub execute_and_check { - my ($pre,$query,$post,$answer,$string_type)=@_; + my ($key,$pre,$query,$post,$answer,$string_type)=@_; my ($tmp); - $tmp=safe_query(\@$pre); - $tmp=safe_query_result($query,$answer,$string_type) == 0 if ($tmp); - safe_query(\@$post); + $tmp=safe_query_l($key,\@$pre); + + $tmp=safe_query_result_l($key,$query,$answer,$string_type) == 0 if ($tmp); + safe_query_l($key,\@$post); return $tmp; } # returns 0 if ok, 1 if error, -1 if wrong answer # Sets $last_result to value of query +sub safe_query_result_l{ + my ($key,$query,$answer,$result_type)=@_; + my $r = safe_query_result($query,$answer,$result_type); + add_log($key,$safe_query_result_log); + return $r; +} sub safe_query_result { +# result type can be +# 8 (must be empty), 2 (Any value), 0 (number) +# 1 (char, endspaces can differ), 3 (exact char), 4 (NULL) +# 5 (char with prefix), 6 (exact, errors are ignored) +# 7 (array of numbers) my ($query,$answer,$result_type)=@_; my ($sth,$row,$result,$retry); undef($last_result); - + $safe_query_result_log=""; + printf "\nquery3: %-80.80s\n",$query if ($opt_log_all_queries); print LOG "$query;\n" if ($opt_log); + $safe_query_result_log="<".$query."\n"; + for ($retry=0; $retry < $retry_limit ; $retry++) { if (!($sth=$dbh->prepare($query))) { print_query($query); + $safe_query_result_log .= "> prepare failed:".$dbh->errstr."\n"; + if ($server->abort_if_fatal_error()) { check_connect(); # Check that server is still up @@ -2981,6 +3698,7 @@ sub safe_query_result if (!$sth->execute) { print_query($query); + $safe_query_result_log .= "> execute failed:".$dbh->errstr."\n"; if ($server->abort_if_fatal_error()) { check_connect(); # Check that server is still up @@ -2997,6 +3715,7 @@ sub safe_query_result if (!($row=$sth->fetchrow_arrayref)) { print "\nquery: $query didn't return any result\n" if ($opt_debug); + $safe_query_result_log .= "> didn't return any result:".$dbh->errstr."\n"; $sth->finish; return ($result_type == 8) ? 0 : 1; } @@ -3007,41 +3726,72 @@ sub safe_query_result } $result=0; # Ok $last_result= $row->[0]; # Save for report_result; + $safe_query_result_log .= ">".$last_result."\n"; + # Note: + # if ($result_type == 2) We accept any return value as answer + if ($result_type == 0) # Compare numbers { - $row->[0] =~ s/,/,/; # Fix if ',' is used instead of '.' + $row->[0] =~ s/,/./; # Fix if ',' is used instead of '.' if ($row->[0] != $answer && (abs($row->[0]- $answer)/ (abs($row->[0]) + abs($answer))) > 0.01) { $result=-1; + $safe_query_result_log .= + "We expected '$answer' but got '$last_result' \n"; } } elsif ($result_type == 1) # Compare where end space may differ { $row->[0] =~ s/\s+$//; - $result=-1 if ($row->[0] ne $answer); + if ($row->[0] ne $answer) + { + $result=-1; + $safe_query_result_log .= + "We expected '$answer' but got '$last_result' \n"; + } ; } elsif ($result_type == 3) # This should be a exact match { - $result= -1 if ($row->[0] ne $answer); + if ($row->[0] ne $answer) + { + $result= -1; + $safe_query_result_log .= + "We expected '$answer' but got '$last_result' \n"; + }; } elsif ($result_type == 4) # If results should be NULL { - $result= -1 if (defined($row->[0])); + if (defined($row->[0])) + { + $result= -1; + $safe_query_result_log .= + "We expected NULL but got '$last_result' \n"; + }; } elsif ($result_type == 5) # Result should have given prefix { - $result= -1 if (length($row->[0]) < length($answer) && - substr($row->[0],1,length($answer)) ne $answer); + if (length($row->[0]) < length($answer) && + substr($row->[0],1,length($answer)) ne $answer) + { + $result= -1 ; + $safe_query_result_log .= + "Result must have prefix '$answer', but '$last_result' \n"; + }; } elsif ($result_type == 6) # Exact match but ignore errors { - $result= 1 if ($row->[0] ne $answer); + if ($row->[0] ne $answer) + { $result= 1; + $safe_query_result_log .= + "We expected '$answer' but got '$last_result' \n"; + } ; } elsif ($result_type == 7) # Compare against array of numbers { if ($row->[0] != $answer->[0]) { + $safe_query_result_log .= "must be '$answer->[0]' \n"; $result= -1; } else @@ -3050,16 +3800,20 @@ sub safe_query_result shift @$answer; while (($row=$sth->fetchrow_arrayref)) { + $safe_query_result_log .= ">$row\n"; + $value=shift(@$answer); if (!defined($value)) { print "\nquery: $query returned to many results\n" if ($opt_debug); + $safe_query_result_log .= "It returned to many results \n"; $result= 1; last; } if ($row->[0] != $value) { + $safe_query_result_log .= "Must return $value here \n"; $result= -1; last; } @@ -3068,6 +3822,7 @@ sub safe_query_result { print "\nquery: $query returned too few results\n" if ($opt_debug); + $safe_query_result_log .= "It returned too few results \n"; $result= 1; } } @@ -3080,13 +3835,14 @@ sub safe_query_result # # Find limit using binary search. This is a weighed binary search that -# will prefere lower limits to get the server to crash as few times as possible -# +# will prefere lower limits to get the server to crash as +# few times as possible + sub find_limit() { my ($prompt,$limit,$query)=@_; - my ($first,$end,$i,$tmp); + my ($first,$end,$i,$tmp,@tmp_array, $queries); print "$prompt: "; if (defined($end=$limits{$limit})) { @@ -3094,10 +3850,30 @@ sub find_limit() return $end; } save_incomplete($limit,$prompt); + add_log($limit,"We are trying (example with N=5):"); + $queries = $query->query(5); + if (ref($queries) ne "ARRAY") + { + push(@tmp_array,$queries); + $queries= \@tmp_array; + } + foreach $tmp (@$queries) + { add_log($limit,repr_query($tmp)); } + if (defined($queries = $query->check_query())) + { + if (ref($queries) ne "ARRAY") + { + @tmp_array=(); + push(@tmp_array,$queries); + $queries= \@tmp_array; + } + foreach $tmp (@$queries) + { add_log($limit,repr_query($tmp)); } + } if (defined($query->{'init'}) && !defined($end=$limits{'restart'}{'tohigh'})) { - if (!safe_query($query->{'init'})) + if (!safe_query_l($limit,$query->{'init'})) { $query->cleanup(); return "error"; @@ -3106,7 +3882,8 @@ sub find_limit() if (!limit_query($query,1)) # This must work { - print "\nMaybe fatal error: Can't check '$prompt' for limit=1\nerror: $last_error\n"; + print "\nMaybe fatal error: Can't check '$prompt' for limit=1\n". + "error: $last_error\n"; return "error"; } @@ -3125,7 +3902,7 @@ sub find_limit() $end= $query->max_limit(); $i=int(($end+$first)/2); } - + my $log_str = ""; unless(limit_query($query,0+$end)) { while ($first < $end) { @@ -3134,11 +3911,13 @@ sub find_limit() if (limit_query($query,$i)) { $first=$i; + $log_str .= " $i:OK"; $i=$first+int(($end-$first+1)/2); # to be a bit faster to go up } else - { + { $end=$i-1; + $log_str .= " $i:FAIL"; $i=$first+int(($end-$first+4)/5); # Prefere lower on errors } } @@ -3150,6 +3929,7 @@ sub find_limit() $end= $query->{'max_limit'}; } print "$end\n"; + add_log($limit,$log_str); save_config_data($limit,$end,$prompt); delete $limits{'restart'}; return $end; @@ -3201,6 +3981,7 @@ sub read_config_data { $limits{$key}=$limit eq "null"? undef : $limit; $prompts{$key}=length($prompt) ? substr($prompt,2) : ""; + $last_read=$key; delete $limits{'restart'}; } else @@ -3214,6 +3995,11 @@ sub read_config_data } } } + elsif (/\s*###(.*)$/) # log line + { + # add log line for previously read key + $log{$last_read} .= "$1\n"; + } elsif (!/^\s*$/ && !/^\#/) { die "Wrong config row: $_\n"; @@ -3235,6 +4021,17 @@ sub save_config_data print CONFIG_FILE "$key=$limit\t# $prompt\n"; $limits{$key}=$limit; $limit_changed=1; +# now write log lines (immediatelly after limits) + my $line; + my $last_line_was_empty=0; + foreach $line (split /\n/, $log{$key}) + { + print CONFIG_FILE " ###$line\n" + unless ( ($last_line_was_empty eq 1) + && ($line =~ /^\s+$/) ); + $last_line_was_empty= ($line =~ /^\s+$/)?1:0; + }; + if (($opt_restart && $limits{'operating_system'} =~ /windows/i) || ($limits{'operating_system'} =~ /NT/)) { @@ -3245,6 +4042,12 @@ sub save_config_data } } +sub add_log +{ + my $key = shift; + my $line = shift; + $log{$key} .= $line . "\n" if ($opt_verbose);; +} sub save_all_config_data { @@ -3258,12 +4061,21 @@ sub save_all_config_data select STDOUT; delete $limits{'restart'}; - print CONFIG_FILE "#This file is automaticly generated by crash-me $version\n\n"; + print CONFIG_FILE + "#This file is automaticly generated by crash-me $version\n\n"; foreach $key (sort keys %limits) { $tmp="$key=$limits{$key}"; print CONFIG_FILE $tmp . ("\t" x (int((32-min(length($tmp),32)+7)/8)+1)) . "# $prompts{$key}\n"; + my $line; + my $last_line_was_empty=0; + foreach $line (split /\n/, $log{$key}) + { + print CONFIG_FILE " ###$line\n" unless + ( ($last_line_was_empty eq 1) && ($line =~ /^\s*$/)); + $last_line_was_empty= ($line =~ /^\s*$/)?1:0; + }; } close CONFIG_FILE; } @@ -3541,7 +4353,6 @@ sub new bless $self; } - sub query { my ($self,$i)=@_; @@ -3832,7 +4643,8 @@ sub query $self->{'limit'}=$limit; $res=$parts=$values=""; - $size=main::min($main::limits{'max_index_part_length'},$main::limits{'max_char_size'}); + $size=main::min($main::limits{'max_index_part_length'}, + $main::limits{'max_char_size'}); $size=1 if ($size == 0); # Avoid infinite loop errors for ($length=$i=0; $length + $size <= $limit ; $length+=$size, $i++) { diff --git a/sql-bench/server-cfg.sh b/sql-bench/server-cfg.sh index 7f96c06ef99..589ce519a86 100644 --- a/sql-bench/server-cfg.sh +++ b/sql-bench/server-cfg.sh @@ -1,4 +1,5 @@ #!@PERL@ +# -*- perl -*- # Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB # # This library is free software; you can redistribute it and/or @@ -671,9 +672,9 @@ sub create $field =~ s/int\(\d*\)/int/; $field =~ s/float\(\d*,\d*\)/float/; $field =~ s/ double/ float/; - $field =~ s/ decimal/ float/i; - $field =~ s/ big_decimal/ float/i; - $field =~ s/ date/ int/i; +# $field =~ s/ decimal/ float/i; +# $field =~ s/ big_decimal/ float/i; +# $field =~ s/ date/ int/i; # Pg doesn't have blob, it has text instead $field =~ s/ blob/ text/; $query.= $field . ','; @@ -946,9 +947,9 @@ sub create $field =~ s/ double/ float/i; # Solid doesn't have blob, it has long varchar $field =~ s/ blob/ long varchar/; - $field =~ s/ decimal/ float/i; - $field =~ s/ big_decimal/ float/i; - $field =~ s/ date/ int/i; +# $field =~ s/ decimal/ float/i; +# $field =~ s/ big_decimal/ float/i; +# $field =~ s/ date/ int/i; $query.= $field . ','; } substr($query,-1)=")"; # Remove last ','; @@ -1194,9 +1195,9 @@ sub create $field =~ s/ blob/ text/; $field =~ s/ varchar\((\d+)\)/ char($1,3)/; $field =~ s/ char\((\d+)\)/ char($1,3)/; - $field =~ s/ decimal/ float/i; - $field =~ s/ big_decimal/ longfloat/i; - $field =~ s/ date/ int/i; +# $field =~ s/ decimal/ float/i; +# $field =~ s/ big_decimal/ longfloat/i; +# $field =~ s/ date/ int/i; $field =~ s/ float(.*)/ float/i; if ($field =~ / int\((\d+)\)/) { if ($1 > 4) { @@ -2896,8 +2897,8 @@ sub create $query="create table $table_name ("; foreach $field (@$fields) { - $field =~ s/ decimal/ double(10,2)/i; - $field =~ s/ big_decimal/ double(10,2)/i; +# $field =~ s/ decimal/ double(10,2)/i; +# $field =~ s/ big_decimal/ double(10,2)/i; $field =~ s/ tinyint\(.*\)/ smallint/i; $field =~ s/ smallint\(.*\)/ smallint/i; $field =~ s/ mediumint/ integer/i; @@ -2985,7 +2986,7 @@ sub new bless $self; $self->{'cmp_name'} = "interbase"; - $self->{'data_source'} = "DBI:InterBase:database=$database:ib_dialect=3"; + $self->{'data_source'} = "DBI:InterBase:database=$database;ib_dialect=3"; $self->{'limits'} = \%limits; $self->{'blob'} = "blob"; $self->{'text'} = ""; @@ -3000,7 +3001,7 @@ sub new $limits{'max_tables'} = 65000; # Should be big enough $limits{'max_text_size'} = 15000; # Max size with default buffers. $limits{'query_size'} = 1000000; # Max size with default buffers. - $limits{'max_index'} = 31; # Max number of keys + $limits{'max_index'} = 65000; # Max number of keys $limits{'max_index_parts'} = 8; # Max segments/key $limits{'max_column_name'} = 128; # max table and column name @@ -3050,16 +3051,13 @@ sub new sub version { my ($self)=@_; - my ($dbh,$sth,$version,@row); - + my ($dbh,$version); + + $version='Interbase ?'; + $dbh=$self->connect(); -# $sth = $dbh->prepare("show version"); -# $sth->execute; -# @row = $sth->fetchrow_array; -# $version = $row[0]; -# $version =~ s/.*version \"(.*)\"$/$1/; + eval { $version = $dbh->func('version','ib_database_info')->{'version'}; }; $dbh->disconnect; - $version = "6.0Beta"; $version .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/); return $version; } @@ -3090,36 +3088,34 @@ sub connect sub create { my($self,$table_name,$fields,$index,$options) = @_; - my($query,@queries); + my($query,@queries,@keys,@indexes); $query="create table $table_name ("; foreach $field (@$fields) { - $field =~ s/ big_decimal/ float/i; - $field =~ s/ double/ float/i; +# $field =~ s/ big_decimal/ decimal/i; + $field =~ s/ double/ double precision/i; $field =~ s/ tinyint/ smallint/i; - $field =~ s/ mediumint/ int/i; - $field =~ s/ integer/ int/i; + $field =~ s/ mediumint/ integer/i; + $field =~ s/\bint\b/integer/i; $field =~ s/ float\(\d,\d\)/ float/i; - $field =~ s/ date/ int/i; # Because of tcp ? $field =~ s/ smallint\(\d\)/ smallint/i; - $field =~ s/ int\(\d\)/ int/i; + $field =~ s/ integer\(\d\)/ integer/i; $query.= $field . ','; } foreach $ind (@$index) { - my @index; - if ( $ind =~ /\bKEY\b/i ){ + if ( $ind =~ /(\bKEY\b)|(\bUNIQUE\b)/i ){ push(@keys,"ALTER TABLE $table_name ADD $ind"); }else{ - my @fields = split(' ',$index); + my @fields = split(' ',$ind); my $query="CREATE INDEX $fields[1] ON $table_name $fields[2]"; - push(@index,$query); + push(@indexes,$query); } } substr($query,-1)=")"; # Remove last ','; $query.=" $options" if (defined($options)); - push(@queries,$query); + push(@queries,$query,@keys,@indexes); return @queries; } @@ -3470,7 +3466,8 @@ sub version if ($sth->execute && (@row = $sth->fetchrow_array) && $row[0] =~ /([\d\.]+)/) { - $version="sap-db $1"; + $version=$row[0]; + $version =~ s/KERNEL/SAP DB/i; } $sth->finish; $dbh->disconnect; @@ -3531,7 +3528,6 @@ sub create }else{ my @fields = split(' ',$ind); my $query="CREATE INDEX $fields[1] ON $table_name $fields[2]"; - print "$query \n"; push(@index,$query); } } diff --git a/sql-bench/test-alter-table.sh b/sql-bench/test-alter-table.sh index cc6453188de..f338792e9ef 100644 --- a/sql-bench/test-alter-table.sh +++ b/sql-bench/test-alter-table.sh @@ -27,6 +27,7 @@ $opt_start_field_count=8; # start with this many fields $opt_loop_count=20; # How many tests to do $opt_row_count=1000; # Rows in the table $opt_field_count=1000; # Add until this many fields. +$opt_time_limit=10*60; # Don't wait more than 10 min for some tests chomp($pwd = `pwd`); $pwd = "." if ($pwd eq ''); require "$pwd/bench-init.pl" || die "Can't read Configuration file: $!\n"; @@ -113,10 +114,9 @@ if ($opt_fast) } else { - $add=1 if (!$limits{'alter_add_multi_col'}); + $add=1 if (!$limits->{'alter_add_multi_col'}); } - $count=0; while ($field_count < $opt_field_count) { @@ -131,19 +131,43 @@ while ($field_count < $opt_field_count) $tmp="" if (!$multi_add); # Adabas } do_query($dbh,"ALTER TABLE bench " . substr($fields,1)); + $end_time=new Benchmark; + last if ($estimated=predict_query_time($loop_time,$end_time,\$count,$count, + $opt_field_count/$add+1)); } $end_time=new Benchmark; -print "Time for alter_table_add ($count): " . +if ($estimated) +{ print "Estimated time"; } +else +{ print "Time"; } +print " for alter_table_add ($count): " . timestr(timediff($end_time, $loop_time),"all") . "\n\n"; +# +# If estimated, fix table to have known number of fields +# +if ($estimated && $field_count < $opt_field_count) +{ + $fields=""; + $tmp="ADD "; + while ($field_count < $opt_field_count) + { + $field_count++; + $fields.=",$tmp i${field_count} integer"; + $tmp="" if (!$multi_add); # Adabas + } + do_query($dbh,"ALTER TABLE bench " . substr($fields,1)); +} + #### #### Test adding and deleting index on the first $opt_start_fields #### $loop_time=new Benchmark; -for ($i=1; $i < $opt_start_field_count ; $i++) +$count= 0; +for ($i=1; $i <= $opt_start_field_count ; $i++) { $dbh->do("CREATE INDEX bench_ind$i ON bench (i${i})") || die $DBI::errstr; } @@ -153,7 +177,7 @@ print "Time for create_index ($opt_start_field_count): " . timestr(timediff($end_time, $loop_time),"all") . "\n\n"; $loop_time=new Benchmark; -for ($i=1; $i < $opt_start_field_count ; $i++) +for ($i=1; $i <= $opt_start_field_count ; $i++) { $dbh->do($server->drop_index("bench","bench_ind$i")) || die $DBI::errstr; } @@ -182,10 +206,17 @@ while ($field_count > $opt_start_field_count) } $dbh->do("ALTER TABLE bench " . substr($fields,1) . $server->{'drop_attr'}) || die $DBI::errstr; + $end_time=new Benchmark; + last if ($estimated=predict_query_time($loop_time,$end_time,\$count,$count, + $opt_field_count/$add+1)); } $end_time=new Benchmark; -print "Time for alter_table_drop ($count): " . +if ($estimated) +{ print "Estimated time"; } +else +{ print "Time"; } +print " for alter_table_drop ($count): " . timestr(timediff($end_time, $loop_time),"all") . "\n\n"; skip_dropcol: diff --git a/sql-bench/test-insert.sh b/sql-bench/test-insert.sh index 93bc2840b3b..c26ed42f7ed 100644 --- a/sql-bench/test-insert.sh +++ b/sql-bench/test-insert.sh @@ -21,10 +21,11 @@ # $opt_loop_count rows in random order # # changes made for Oracle compatibility -# - $limits{'func_odbc_mod'} is OK from crash-me, but it fails here so set we +# - $limits->{'func_odbc_mod'} is OK from crash-me, but it fails here so set we # set it to 0 in server-cfg -# - the default server config runs out of rollback segments, so I added a couple -# of disconnect/connects to reset +# - the default server config runs out of rollback segments, so we added a +# couple of disconnect/connects to reset +# ##################### Standard benchmark inits ############################## use DBI; diff --git a/sql/Makefile.am b/sql/Makefile.am index 245e4c5d258..c4b641f714b 100644 --- a/sql/Makefile.am +++ b/sql/Makefile.am @@ -52,7 +52,7 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \ field.h handler.h \ ha_isammrg.h ha_isam.h ha_myisammrg.h\ ha_heap.h ha_myisam.h ha_berkeley.h ha_innodb.h \ - opt_range.h opt_ft.h \ + opt_range.h opt_ft.h protocol.h \ sql_select.h structs.h table.h sql_udf.h hash_filo.h\ lex.h lex_symbol.h sql_acl.h sql_crypt.h \ log_event.h mini_client.h sql_repl.h slave.h \ diff --git a/sql/field.cc b/sql/field.cc index c3feb0b8826..dfc41f37205 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -34,8 +34,6 @@ // Maximum allowed exponent value for converting string to decimal #define MAX_EXPONENT 1024 - - /***************************************************************************** Instansiate templates and static variables *****************************************************************************/ @@ -67,39 +65,44 @@ void Field_num::prepend_zeros(String *value) /* Test if given number is a int (or a fixed format float with .000) - This is only used to give warnings in ALTER TABLE or LOAD DATA... + + SYNOPSIS + test_if_int() + str String to test + end Pointer to char after last used digit + cs Character set + + NOTES + This is called after one has called my_strntol() or similar function. + This is only used to give warnings in ALTER TABLE or LOAD DATA... + + TODO + Make this multi-byte-character safe + + RETURN + 0 ok + 1 error */ -bool test_if_int(const char *str,int length, CHARSET_INFO *cs) +bool test_if_int(const char *str, int length, const char *int_end, + CHARSET_INFO *cs) { + if (str == int_end) + return 0; // Empty string const char *end=str+length; + if ((str= int_end) == end) + return 1; // All digits was used - cs=system_charset_info; // QQ move test_if_int into CHARSET_INFO struct - - // Allow start space - while (str != end && my_isspace(cs,*str)) - str++; /* purecov: inspected */ - if (str != end && (*str == '-' || *str == '+')) - str++; - if (str == end) - return 0; // Error: Empty string - for (; str != end ; str++) + /* Allow end .0000 */ + if (*str == '.') { - if (!my_isdigit(cs,*str)) - { - if (*str == '.') - { // Allow '.0000' - for (str++ ; str != end && *str == '0'; str++) ; - if (str == end) - return 1; - } - if (!my_isspace(cs,*str)) - return 0; - for (str++ ; str != end ; str++) - if (!my_isspace(cs,*str)) - return 0; - return 1; - } + for (str++ ; str != end && *str == '0'; str++) ; + } + /* Allow end space */ + for (str++ ; str != end ; str++) + { + if (!my_isspace(cs,*str)) + return 0; } return 1; } @@ -107,7 +110,7 @@ bool test_if_int(const char *str,int length, CHARSET_INFO *cs) static bool test_if_real(const char *str,int length, CHARSET_INFO *cs) { - cs=system_charset_info; // QQ move test_if_int into CHARSET_INFO struct + cs= system_charset_info; // QQ move test_if_real into CHARSET_INFO struct while (length && my_isspace(cs,*str)) { // Allow start space @@ -207,17 +210,10 @@ bool Field::send_binary(Protocol *protocol) void Field_num::add_zerofill_and_unsigned(String &res) const { - uint oldlen=res.length(); - if (oldlen < res.alloced_length()) - { - uint len=res.alloced_length()-oldlen; - char *end=(char*)(res.ptr()+oldlen); - CHARSET_INFO *cs=res.charset(); - len=cs->snprintf(cs,end,len,"%s%s", - unsigned_flag ? " unsigned" : "", - zerofill ? " zerofill" : ""); - res.length(len+oldlen); - } + if (unsigned_flag) + res.append(" unsigned"); + if (zerofill) + res.append(" zerofill"); } void Field_num::make_field(Send_field *field) @@ -247,19 +243,15 @@ void Field_str::make_field(Send_field *field) field->decimals=0; } + void Field_str::add_binary_or_charset(String &res) const { - uint oldlen=res.length(); - if (oldlen < res.alloced_length()) + if (binary()) + res.append(" binary"); + else if (field_charset != table->table_charset) { - CHARSET_INFO *cs=res.charset(); - uint len=res.alloced_length() - oldlen; - char *end=(char*)(res.ptr()+oldlen); - if (binary()) - len=cs->snprintf(cs,end,len," binary"); - else - len=cs->snprintf(cs,end,len," character set %s",field_charset->name); - res.length(oldlen+len); + res.append(" character set "); + res.append(field_charset->csname); } } @@ -287,7 +279,7 @@ uint Field::fill_cache_field(CACHE_FIELD *copy) bool Field::get_date(TIME *ltime,bool fuzzydate) { char buff[40]; - String tmp(buff,sizeof(buff),my_charset_latin1),tmp2,*res; + String tmp(buff,sizeof(buff),my_charset_bin),tmp2,*res; if (!(res=val_str(&tmp,&tmp2)) || str_to_TIME(res->ptr(),res->length(),ltime,fuzzydate) == TIMESTAMP_NONE) return 1; @@ -297,7 +289,7 @@ bool Field::get_date(TIME *ltime,bool fuzzydate) bool Field::get_time(TIME *ltime) { char buff[40]; - String tmp(buff,sizeof(buff),my_charset_latin1),tmp2,*res; + String tmp(buff,sizeof(buff),my_charset_bin),tmp2,*res; if (!(res=val_str(&tmp,&tmp2)) || str_to_time(res->ptr(),res->length(),ltime)) return 1; @@ -311,23 +303,23 @@ void Field::store_time(TIME *ltime,timestamp_type type) char buff[25]; switch (type) { case TIMESTAMP_NONE: - store("",0,my_charset_latin1); // Probably an error + store("",0,my_charset_bin); // Probably an error break; case TIMESTAMP_DATE: sprintf(buff,"%04d-%02d-%02d", ltime->year,ltime->month,ltime->day); - store(buff,10,my_charset_latin1); + store(buff,10,my_charset_bin); break; case TIMESTAMP_FULL: sprintf(buff,"%04d-%02d-%02d %02d:%02d:%02d", ltime->year,ltime->month,ltime->day, ltime->hour,ltime->minute,ltime->second); - store(buff,19,my_charset_latin1); + store(buff,19,my_charset_bin); break; case TIMESTAMP_TIME: { ulong length= my_sprintf(buff, (buff, "%02d:%02d:%02d", ltime->hour,ltime->minute,ltime->second)); - store(buff,(uint) length, my_charset_latin1); + store(buff,(uint) length, my_charset_bin); break; } } @@ -340,15 +332,12 @@ bool Field::optimize_range(uint idx) } /**************************************************************************** - Functions for the Field_null + Field_null, a field that always return NULL ****************************************************************************/ void Field_null::sql_type(String &res) const { - CHARSET_INFO *cs=res.charset(); - uint len; - len=cs->snprintf(cs,(char*)res.ptr(),res.alloced_length(),"null"); - res.length(len); + res.set_latin1("null", 4); } @@ -360,7 +349,7 @@ void Field_null::sql_type(String &res) const void Field_decimal::reset(void) { - Field_decimal::store("0",1,my_charset_latin1); + Field_decimal::store("0",1,my_charset_bin); } void Field_decimal::overflow(bool negative) @@ -404,11 +393,16 @@ void Field_decimal::overflow(bool negative) int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs) { - String l1from; + char buff[80]; + String tmp(buff,sizeof(buff), my_charset_bin); - l1from.copy(from,len,cs,my_charset_latin1); - from=l1from.ptr(); - len=l1from.length(); + /* Convert character set if the old one is multi byte */ + if (cs->mbmaxlen > 1) + { + tmp.copy(from, len, cs, my_charset_bin); + from= tmp.ptr(); + len= tmp.length(); + } const char *end= from+len; /* The pointer where the field value starts (i.e., "where to write") */ @@ -461,7 +455,7 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs) There are three steps in this function : - parse the input string - modify the position of digits around the decimal dot '.' - according to the exponent value (if specified) + according to the exponent value (if specified) - write the formatted number */ @@ -469,7 +463,7 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs) tmp_dec++; /* skip pre-space */ - while (from != end && my_isspace(my_charset_latin1,*from)) + while (from != end && my_isspace(my_charset_bin,*from)) from++; if (from == end) { @@ -506,13 +500,13 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs) for (; from!=end && *from == '0'; from++) ; // Read prezeros pre_zeros_end=int_digits_from=from; /* Read non zero digits at the left of '.'*/ - for (; from != end && my_isdigit(my_charset_latin1, *from) ; from++) ; + for (; from != end && my_isdigit(my_charset_bin, *from) ; from++) ; int_digits_end=from; if (from!=end && *from == '.') // Some '.' ? from++; frac_digits_from= from; /* Read digits at the right of '.' */ - for (;from!=end && my_isdigit(my_charset_latin1, *from); from++) ; + for (;from!=end && my_isdigit(my_charset_bin, *from); from++) ; frac_digits_end=from; // Some exponentiation symbol ? if (from != end && (*from == 'e' || *from == 'E')) @@ -528,7 +522,7 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs) exponents will become small (e.g. 1e4294967296 will become 1e0, and the field will finally contain 1 instead of its max possible value). */ - for (;from!=end && my_isdigit(my_charset_latin1, *from); from++) + for (;from!=end && my_isdigit(my_charset_bin, *from); from++) { exponent=10*exponent+(*from-'0'); if (exponent>MAX_EXPONENT) @@ -546,7 +540,7 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs) if (current_thd->count_cuted_fields) { // Skip end spaces - for (;from != end && my_isspace(my_charset_latin1, *from); from++) ; + for (;from != end && my_isspace(my_charset_bin, *from); from++) ; if (from != end) // If still something left, warn { current_thd->cuted_fields++; @@ -838,30 +832,29 @@ int Field_decimal::store(longlong nr) double Field_decimal::val_real(void) { - CHARSET_INFO *cs=charset(); - return my_strntod(cs,ptr,field_length,NULL); + return my_strntod(my_charset_bin, ptr, field_length, NULL); } longlong Field_decimal::val_int(void) { - CHARSET_INFO *cs=charset(); if (unsigned_flag) - return my_strntoull(cs,ptr,field_length,NULL,10); + return my_strntoull(my_charset_bin, ptr, field_length, NULL, 10); else - return my_strntoll(cs,ptr,field_length,NULL,10); + return my_strntoll( my_charset_bin, ptr, field_length, NULL, 10); } + String *Field_decimal::val_str(String *val_buffer __attribute__((unused)), String *val_ptr) { char *str; - CHARSET_INFO *cs=current_thd->variables.thd_charset; for (str=ptr ; *str == ' ' ; str++) ; uint tmp_length=(uint) (str-ptr); + val_ptr->set_charset(my_charset_bin); if (field_length < tmp_length) // Error in data val_ptr->length(0); else - val_ptr->copy((const char*) str,field_length-tmp_length,my_charset_latin1,cs); + val_ptr->set_latin1((const char*) str, field_length-tmp_length); return val_ptr; } @@ -878,9 +871,9 @@ int Field_decimal::cmp(const char *a_ptr,const char *b_ptr) for (end=a_ptr+field_length; a_ptr != end && (*a_ptr == *b_ptr || - ((my_isspace(my_charset_latin1,*a_ptr) || *a_ptr == '+' || + ((my_isspace(my_charset_bin,*a_ptr) || *a_ptr == '+' || *a_ptr == '0') && - (my_isspace(my_charset_latin1,*b_ptr) || *b_ptr == '+' || + (my_isspace(my_charset_bin,*b_ptr) || *b_ptr == '+' || *b_ptr == '0'))); a_ptr++,b_ptr++) { @@ -908,7 +901,7 @@ void Field_decimal::sort_string(char *to,uint length) char *str,*end; for (str=ptr,end=ptr+length; str != end && - ((my_isspace(my_charset_latin1,*str) || *str == '+' || + ((my_isspace(my_charset_bin,*str) || *str == '+' || *str == '0')) ; str++) *to++=' '; @@ -920,7 +913,7 @@ void Field_decimal::sort_string(char *to,uint length) *to++=1; // Smaller than any number str++; while (str != end) - if (my_isdigit(my_charset_latin1,*str)) + if (my_isdigit(my_charset_bin,*str)) *to++= (char) ('9' - *str++); else *to++= *str++; @@ -933,14 +926,12 @@ void Field_decimal::sql_type(String &res) const { CHARSET_INFO *cs=res.charset(); uint tmp=field_length; - uint len; if (!unsigned_flag) tmp--; if (dec) tmp--; - len=cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(), - "decimal(%d,%d)",tmp,dec); - res.length(len); + res.length(cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(), + "decimal(%d,%d)",tmp,dec)); add_zerofill_and_unsigned(res); } @@ -951,7 +942,8 @@ void Field_decimal::sql_type(String &res) const int Field_tiny::store(const char *from,uint len,CHARSET_INFO *cs) { - long tmp= my_strntol(cs,from,len,(char **)NULL,10); + char *end; + long tmp= my_strntol(cs, from, len, &end,10); int error= 0; if (unsigned_flag) @@ -968,7 +960,7 @@ int Field_tiny::store(const char *from,uint len,CHARSET_INFO *cs) current_thd->cuted_fields++; error= 1; } - else if (current_thd->count_cuted_fields && !test_if_int(from,len,cs)) + else if (current_thd->count_cuted_fields && !test_if_int(from,len,end,cs)) { current_thd->cuted_fields++; error= 1; @@ -988,7 +980,7 @@ int Field_tiny::store(const char *from,uint len,CHARSET_INFO *cs) current_thd->cuted_fields++; error= 1; } - else if (current_thd->count_cuted_fields && !test_if_int(from,len,cs)) + else if (current_thd->count_cuted_fields && !test_if_int(from,len,end,cs)) { current_thd->cuted_fields++; error= 1; @@ -1098,7 +1090,7 @@ longlong Field_tiny::val_int(void) String *Field_tiny::val_str(String *val_buffer, String *val_ptr __attribute__((unused))) { - CHARSET_INFO *cs=current_thd->variables.thd_charset; + CHARSET_INFO *cs= my_charset_bin; uint length; uint mlength=max(field_length+1,5*cs->mbmaxlen); val_buffer->alloc(mlength); @@ -1140,22 +1132,19 @@ void Field_tiny::sort_string(char *to,uint length __attribute__((unused))) void Field_tiny::sql_type(String &res) const { CHARSET_INFO *cs=res.charset(); - uint len=cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(), - "tinyint(%d)",(int) field_length); - res.length(len); + res.length(cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(), + "tinyint(%d)",(int) field_length)); add_zerofill_and_unsigned(res); } /**************************************************************************** -** short int + Field type short int (2 byte) ****************************************************************************/ - -// Note: Sometimes this should be fixed to check for garbage after number. - int Field_short::store(const char *from,uint len,CHARSET_INFO *cs) { - long tmp= my_strntol(cs,from,len,NULL,10); + char *end; + long tmp= my_strntol(cs, from, len, &end, 10); int error= 0; if (unsigned_flag) { @@ -1171,7 +1160,7 @@ int Field_short::store(const char *from,uint len,CHARSET_INFO *cs) current_thd->cuted_fields++; error= 1; } - else if (current_thd->count_cuted_fields && !test_if_int(from,len,cs)) + else if (current_thd->count_cuted_fields && !test_if_int(from,len,end,cs)) { current_thd->cuted_fields++; error= 1; @@ -1191,7 +1180,7 @@ int Field_short::store(const char *from,uint len,CHARSET_INFO *cs) current_thd->cuted_fields++; error= 1; } - else if (current_thd->count_cuted_fields && !test_if_int(from,len,cs)) + else if (current_thd->count_cuted_fields && !test_if_int(from,len,end,cs)) { current_thd->cuted_fields++; error= 1; @@ -1337,7 +1326,7 @@ longlong Field_short::val_int(void) String *Field_short::val_str(String *val_buffer, String *val_ptr __attribute__((unused))) { - CHARSET_INFO *cs=current_thd->variables.thd_charset; + CHARSET_INFO *cs= my_charset_bin; uint length; uint mlength=max(field_length+1,7*cs->mbmaxlen); val_buffer->alloc(mlength); @@ -1351,9 +1340,9 @@ String *Field_short::val_str(String *val_buffer, shortget(j,ptr); if (unsigned_flag) - length=(uint) cs->l10tostr(cs,to,mlength, 10, (long) (uint16) j); + length=(uint) cs->l10tostr(cs, to, mlength, 10, (long) (uint16) j); else - length=(uint) cs->l10tostr(cs,to,mlength,-10, (long) j); + length=(uint) cs->l10tostr(cs, to, mlength,-10, (long) j); val_buffer->length(length); if (zerofill) prepend_zeros(val_buffer); @@ -1414,22 +1403,20 @@ void Field_short::sort_string(char *to,uint length __attribute__((unused))) void Field_short::sql_type(String &res) const { CHARSET_INFO *cs=res.charset(); - uint len=cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(), - "smallint(%d)",(int) field_length); - res.length(len); + res.length(cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(), + "smallint(%d)",(int) field_length)); add_zerofill_and_unsigned(res); } /**************************************************************************** -** medium int + Field type medium int (3 byte) ****************************************************************************/ -// Note: Sometimes this should be fixed to check for garbage after number. - int Field_medium::store(const char *from,uint len,CHARSET_INFO *cs) { - long tmp= my_strntol(cs,from,len,NULL,10); + char *end; + long tmp= my_strntol(cs, from, len, &end, 10); int error= 0; if (unsigned_flag) @@ -1446,7 +1433,7 @@ int Field_medium::store(const char *from,uint len,CHARSET_INFO *cs) current_thd->cuted_fields++; error= 1; } - else if (current_thd->count_cuted_fields && !test_if_int(from,len,cs)) + else if (current_thd->count_cuted_fields && !test_if_int(from,len,end,cs)) { current_thd->cuted_fields++; error= 1; @@ -1466,7 +1453,7 @@ int Field_medium::store(const char *from,uint len,CHARSET_INFO *cs) current_thd->cuted_fields++; error= 1; } - else if (current_thd->count_cuted_fields && !test_if_int(from,len,cs)) + else if (current_thd->count_cuted_fields && !test_if_int(from,len,end,cs)) { current_thd->cuted_fields++; error= 1; @@ -1572,16 +1559,18 @@ double Field_medium::val_real(void) return (double) j; } + longlong Field_medium::val_int(void) { long j= unsigned_flag ? (long) uint3korr(ptr) : sint3korr(ptr); return (longlong) j; } + String *Field_medium::val_str(String *val_buffer, String *val_ptr __attribute__((unused))) { - CHARSET_INFO *cs=current_thd->variables.thd_charset; + CHARSET_INFO *cs= my_charset_bin; uint length; uint mlength=max(field_length+1,10*cs->mbmaxlen); val_buffer->alloc(mlength); @@ -1632,9 +1621,8 @@ void Field_medium::sort_string(char *to,uint length __attribute__((unused))) void Field_medium::sql_type(String &res) const { CHARSET_INFO *cs=res.charset(); - uint len=cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(), - "mediumint(%d)",(int) field_length); - res.length(len); + res.length(cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(), + "mediumint(%d)",(int) field_length)); add_zerofill_and_unsigned(res); } @@ -1643,26 +1631,23 @@ void Field_medium::sql_type(String &res) const ****************************************************************************/ -// Note: Sometimes this should be fixed to check for garbage after number. - int Field_long::store(const char *from,uint len,CHARSET_INFO *cs) { + long tmp; + int error= 0; char *end; + /* TODO: Make multi-byte-character safe */ while (len && my_isspace(cs,*from)) { len--; from++; } - long tmp; - String tmp_str(from, len, cs); - from= tmp_str.c_ptr(); // Add end null if needed - int error= 0; - errno=0; + my_errno=0; if (unsigned_flag) { if (!len || *from == '-') { tmp=0; // Set negative to 0 - errno=ERANGE; + my_errno=ERANGE; error= 1; } else @@ -1670,9 +1655,9 @@ int Field_long::store(const char *from,uint len,CHARSET_INFO *cs) } else tmp=my_strntol(cs,from,len,&end,10); - if (errno || + if (my_errno || (from+len != end && current_thd->count_cuted_fields && - !test_if_int(from,len,cs))) + !test_if_int(from,len,end,cs))) { current_thd->cuted_fields++; error= 1; @@ -1817,7 +1802,7 @@ longlong Field_long::val_int(void) String *Field_long::val_str(String *val_buffer, String *val_ptr __attribute__((unused))) { - CHARSET_INFO *cs=current_thd->variables.thd_charset; + CHARSET_INFO *cs= my_charset_bin; uint length; uint mlength=max(field_length+1,12*cs->mbmaxlen); val_buffer->alloc(mlength); @@ -1896,34 +1881,32 @@ void Field_long::sort_string(char *to,uint length __attribute__((unused))) void Field_long::sql_type(String &res) const { CHARSET_INFO *cs=res.charset(); - uint len=cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(), - "int(%d)",(int) field_length); - res.length(len); + res.length(cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(), + "int(%d)",(int) field_length)); add_zerofill_and_unsigned(res); } /**************************************************************************** -** longlong int + Field type longlong int (8 bytes) ****************************************************************************/ int Field_longlong::store(const char *from,uint len,CHARSET_INFO *cs) { + longlong tmp; + int error= 0; char *end; + /* TODO: Make multi byte safe */ while (len && my_isspace(cs,*from)) { // For easy error check len--; from++; } - longlong tmp; - String tmp_str(from, len, cs); - from= tmp_str.c_ptr(); // Add end null if needed - int error= 0; - errno=0; + my_errno=0; if (unsigned_flag) { if (!len || *from == '-') { tmp=0; // Set negative to 0 - errno=ERANGE; + my_errno= ERANGE; error= 1; } else @@ -1931,9 +1914,9 @@ int Field_longlong::store(const char *from,uint len,CHARSET_INFO *cs) } else tmp=my_strntoll(cs,from,len,&end,10); - if (errno || + if (my_errno || (from+len != end && current_thd->count_cuted_fields && - !test_if_int(from,len,cs))) + !test_if_int(from,len,end,cs))) current_thd->cuted_fields++; #ifdef WORDS_BIGENDIAN if (table->db_low_byte_first) @@ -2042,7 +2025,7 @@ longlong Field_longlong::val_int(void) String *Field_longlong::val_str(String *val_buffer, String *val_ptr __attribute__((unused))) { - CHARSET_INFO *cs=current_thd->variables.thd_charset; + CHARSET_INFO *cs= my_charset_bin; uint length; uint mlength=max(field_length+1,22*cs->mbmaxlen); val_buffer->alloc(mlength); @@ -2128,9 +2111,8 @@ void Field_longlong::sort_string(char *to,uint length __attribute__((unused))) void Field_longlong::sql_type(String &res) const { CHARSET_INFO *cs=res.charset(); - uint len=cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(), - "bigint(%d)",(int) field_length); - res.length(len); + res.length(cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(), + "bigint(%d)",(int) field_length)); add_zerofill_and_unsigned(res); } @@ -2140,8 +2122,8 @@ void Field_longlong::sql_type(String &res) const int Field_float::store(const char *from,uint len,CHARSET_INFO *cs) { - errno=0; - Field_float::store(my_strntod(cs,from,len,(char**)NULL)); + errno=0; // my_strntod() changes errno + Field_float::store(my_strntod(cs,(char*) from,len,(char**)NULL)); if (errno || current_thd->count_cuted_fields && !test_if_real(from,len,cs)) { current_thd->cuted_fields++; @@ -2394,18 +2376,16 @@ bool Field_float::send_binary(Protocol *protocol) void Field_float::sql_type(String &res) const { - CHARSET_INFO *cs=res.charset(); - uint len; if (dec == NOT_FIXED_DEC) { - len=cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(),"float"); + res.set_latin1("float", 5); } else { - len=cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(), - "float(%d,%d)",(int) field_length,dec); + CHARSET_INFO *cs= res.charset(); + res.length(cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(), + "float(%d,%d)",(int) field_length,dec)); } - res.length(len); add_zerofill_and_unsigned(res); } @@ -2415,9 +2395,9 @@ void Field_float::sql_type(String &res) const int Field_double::store(const char *from,uint len,CHARSET_INFO *cs) { - errno=0; + errno=0; // my_strntod() changes errno int error= 0; - double j= my_strntod(cs,from,len,(char**)0); + double j= my_strntod(cs,(char*) from,len,(char**)0); if (errno || current_thd->count_cuted_fields && !test_if_real(from,len,cs)) { current_thd->cuted_fields++; @@ -2599,7 +2579,7 @@ String *Field_double::val_str(String *val_buffer, bool Field_double::send_binary(Protocol *protocol) { - return protocol->store((float) Field_double::val_real(), dec, (String*) 0); + return protocol->store((double) Field_double::val_real(), dec, (String*) 0); } @@ -2655,17 +2635,15 @@ void Field_double::sort_string(char *to,uint length __attribute__((unused))) void Field_double::sql_type(String &res) const { CHARSET_INFO *cs=res.charset(); - uint len; if (dec == NOT_FIXED_DEC) { - len=cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(),"double"); + res.set_latin1("double",6); } else { - len=cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(), - "double(%d,%d)",(int) field_length,dec); + res.length(cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(), + "double(%d,%d)",(int) field_length,dec)); } - res.length(len); add_zerofill_and_unsigned(res); } @@ -2722,9 +2700,9 @@ int Field_timestamp::store(double nr) /* -** Convert a datetime of formats YYMMDD, YYYYMMDD or YYMMDDHHMSS to -** YYYYMMDDHHMMSS. The high date '99991231235959' is checked before this -** function. + Convert a datetime of formats YYMMDD, YYYYMMDD or YYMMDDHHMSS to + YYYYMMDDHHMMSS. The high date '99991231235959' is checked before this + function. */ static longlong fix_datetime(longlong nr) @@ -2797,7 +2775,6 @@ double Field_timestamp::val_real(void) longlong Field_timestamp::val_int(void) { - uint len,pos; int part_time; uint32 temp; time_t time_arg; @@ -2855,9 +2832,10 @@ String *Field_timestamp::val_str(String *val_buffer, if (temp == 0L) { /* Zero time is "000000" */ - strmov(to, "0000-00-00 00:00:00"); - return val_buffer; + val_ptr->set("0000-00-00 00:00:00", 19, my_charset_bin); + return val_ptr; } + val_buffer->set_charset(my_charset_bin); // Safety time_arg=(time_t) temp; localtime_r(&time_arg,&tm_tmp); l_time=&tm_tmp; @@ -2996,9 +2974,7 @@ void Field_timestamp::sort_string(char *to,uint length __attribute__((unused))) void Field_timestamp::sql_type(String &res) const { - CHARSET_INFO *cs=res.charset(); - uint len=cs->snprintf(cs,(char*)res.ptr(),res.alloced_length(),"timestamp"); - res.length(len); + res.set_latin1("timestamp", 9); } @@ -3126,6 +3102,12 @@ longlong Field_time::val_int(void) return (longlong) sint3korr(ptr); } + +/* + This function is multi-byte safe as the result string is always of type + my_charset_bin +*/ + String *Field_time::val_str(String *val_buffer, String *val_ptr __attribute__((unused))) { @@ -3169,7 +3151,7 @@ bool Field_time::send_binary(Protocol *protocol) Field_time::get_time(&tm); tm.day= tm.hour/3600; // Move hours to days tm.hour-= tm.day*3600; - return protocol->store(&tm); + return protocol->store_time(&tm); } @@ -3190,9 +3172,7 @@ void Field_time::sort_string(char *to,uint length __attribute__((unused))) void Field_time::sql_type(String &res) const { - CHARSET_INFO *cs=res.charset(); - uint len=cs->snprintf(cs,(char*)res.ptr(),res.alloced_length(),"time"); - res.length(len); + res.set_latin1("time", 4); } /**************************************************************************** @@ -3203,7 +3183,8 @@ void Field_time::sql_type(String &res) const int Field_year::store(const char *from, uint len,CHARSET_INFO *cs) { - long nr= my_strntol(cs,from,len,NULL,10); + char *end; + long nr= my_strntol(cs, from, len, &end, 10); if (nr < 0 || nr >= 100 && nr <= 1900 || nr > 2155) { @@ -3211,7 +3192,7 @@ int Field_year::store(const char *from, uint len,CHARSET_INFO *cs) current_thd->cuted_fields++; return 1; } - else if (current_thd->count_cuted_fields && !test_if_int(from,len,cs)) + else if (current_thd->count_cuted_fields && !test_if_int(from,len,end,cs)) current_thd->cuted_fields++; if (nr != 0 || len != 4) { @@ -3254,6 +3235,11 @@ int Field_year::store(longlong nr) return 0; } +bool Field_year::send_binary(Protocol *protocol) +{ + ulonglong tmp= Field_year::val_int(); + return protocol->store_short(tmp); +} double Field_year::val_real(void) { @@ -3283,9 +3269,8 @@ String *Field_year::val_str(String *val_buffer, void Field_year::sql_type(String &res) const { CHARSET_INFO *cs=res.charset(); - ulong len=cs->snprintf(cs,(char*)res.ptr(),res.alloced_length(), - "year(%d)",(int) field_length); - res.length(len); + res.length(cs->snprintf(cs,(char*)res.ptr(),res.alloced_length(), + "year(%d)",(int) field_length)); } @@ -3372,6 +3357,17 @@ int Field_date::store(longlong nr) } +bool Field_date::send_binary(Protocol *protocol) +{ + longlong tmp= Field_date::val_int(); + TIME tm; + tm.year= (uint32) tmp/10000L % 10000; + tm.month= (uint32) tmp/100 % 100; + tm.day= (uint32) tmp % 100; + return protocol->store_date(&tm); +} + + double Field_date::val_real(void) { int32 j; @@ -3455,9 +3451,7 @@ void Field_date::sort_string(char *to,uint length __attribute__((unused))) void Field_date::sql_type(String &res) const { - CHARSET_INFO *cs=res.charset(); - uint len=cs->snprintf(cs,(char*)res.ptr(),res.alloced_length(),"date"); - res.length(len); + res.set_latin1("date", 4); } /**************************************************************************** @@ -3544,7 +3538,12 @@ void Field_newdate::store_time(TIME *ltime,timestamp_type type) int3store(ptr,tmp); } - +bool Field_newdate::send_binary(Protocol *protocol) +{ + TIME tm; + Field_newdate::get_date(&tm,0); + return protocol->store_date(&tm); +} double Field_newdate::val_real(void) { @@ -3620,9 +3619,7 @@ void Field_newdate::sort_string(char *to,uint length __attribute__((unused))) void Field_newdate::sql_type(String &res) const { - CHARSET_INFO *cs=res.charset(); - uint len=cs->snprintf(cs,(char*)res.ptr(),res.alloced_length(),"date"); - res.length(len); + res.set_latin1("date", 4); } @@ -3705,6 +3702,13 @@ void Field_datetime::store_time(TIME *ltime,timestamp_type type) longlongstore(ptr,tmp); } +bool Field_datetime::send_binary(Protocol *protocol) +{ + TIME tm; + Field_datetime::get_date(&tm, 1); + return protocol->store(&tm); +} + double Field_datetime::val_real(void) { @@ -3846,9 +3850,7 @@ void Field_datetime::sort_string(char *to,uint length __attribute__((unused))) void Field_datetime::sql_type(String &res) const { - CHARSET_INFO *cs=res.charset(); - uint len=cs->snprintf(cs,(char*)res.ptr(),res.alloced_length(),"datetime"); - res.length(len); + res.set_latin1("datetime", 8); } /**************************************************************************** @@ -3903,7 +3905,7 @@ int Field_string::store(double nr) int width=min(field_length,DBL_DIG+5); sprintf(buff,"%-*.*g",width,max(width-5,0),nr); end=strcend(buff,' '); - return Field_string::store(buff,(uint) (end - buff), my_charset_latin1); + return Field_string::store(buff,(uint) (end - buff), my_charset_bin); } @@ -3926,7 +3928,6 @@ double Field_string::val_real(void) longlong Field_string::val_int(void) { - longlong value; CHARSET_INFO *cs=charset(); return my_strntoll(cs,ptr,field_length,NULL,10); } @@ -4016,11 +4017,6 @@ int Field_string::pack_cmp(const char *a, const char *b, uint length) uint a_length= (uint) (uchar) *a++; uint b_length= (uint) (uchar) *b++; - if (binary()) - { - int cmp= memcmp(a,b,min(a_length,b_length)); - return cmp ? cmp : (int) (a_length - b_length); - } return my_strnncoll(field_charset, (const uchar*)a,a_length, (const uchar*)b,b_length); @@ -4035,11 +4031,6 @@ int Field_string::pack_cmp(const char *b, uint length) end--; uint a_length = (uint) (end - ptr); - if (binary()) - { - int cmp= memcmp(ptr,b,min(a_length,b_length)); - return cmp ? cmp : (int) (a_length - b_length); - } return my_strnncoll(field_charset, (const uchar*)ptr,a_length, (const uchar*)b, b_length); @@ -4093,7 +4084,7 @@ int Field_varstring::store(double nr) int width=min(field_length,DBL_DIG+5); sprintf(buff,"%-*.*g",width,max(width-5,0),nr); end=strcend(buff,' '); - return Field_varstring::store(buff,(uint) (end - buff), my_charset_latin1); + return Field_varstring::store(buff,(uint) (end - buff), my_charset_bin); } @@ -4230,11 +4221,6 @@ int Field_varstring::pack_cmp(const char *a, const char *b, uint key_length) a_length= (uint) (uchar) *a++; b_length= (uint) (uchar) *b++; } - if (binary()) - { - int cmp= memcmp(a,b,min(a_length,b_length)); - return cmp ? cmp : (int) (a_length - b_length); - } return my_strnncoll(field_charset, (const uchar *)a,a_length, (const uchar *)b,b_length); @@ -4253,11 +4239,6 @@ int Field_varstring::pack_cmp(const char *b, uint key_length) { b_length= (uint) (uchar) *b++; } - if (binary()) - { - int cmp= memcmp(a,b,min(a_length,b_length)); - return cmp ? cmp : (int) (a_length - b_length); - } return my_strnncoll(field_charset, (const uchar *)a,a_length, (const uchar *)b,b_length); @@ -4276,7 +4257,7 @@ uint Field_varstring::max_packed_col_length(uint max_length) return (max_length > 255 ? 2 : 1)+max_length; } -void Field_varstring::get_key_image(char *buff, uint length, imagetype type) +void Field_varstring::get_key_image(char *buff, uint length, CHARSET_INFO *cs,imagetype type) { length-= HA_KEY_BLOB_LENGTH; uint f_length=uint2korr(ptr); @@ -4290,10 +4271,10 @@ void Field_varstring::get_key_image(char *buff, uint length, imagetype type) #endif } -void Field_varstring::set_key_image(char *buff,uint length) +void Field_varstring::set_key_image(char *buff,uint length, CHARSET_INFO *cs) { length=uint2korr(buff); // Real length is here - (void) Field_varstring::store(buff+2, length, default_charset_info); + (void) Field_varstring::store(buff+2, length, cs); } @@ -4439,22 +4420,23 @@ int Field_blob::store(const char *from,uint len,CHARSET_INFO *cs) int Field_blob::store(double nr) { - value.set(nr,2,current_thd->variables.thd_charset); - return Field_blob::store(value.ptr(),(uint) value.length(), value.charset()); + CHARSET_INFO *cs=charset(); + value.set(nr, 2, cs); + return Field_blob::store(value.ptr(),(uint) value.length(), cs); } int Field_blob::store(longlong nr) { - value.set(nr,current_thd->variables.thd_charset); - return Field_blob::store(value.ptr(), (uint) value.length(), value.charset()); + CHARSET_INFO *cs=charset(); + value.set(nr, cs); + return Field_blob::store(value.ptr(), (uint) value.length(), cs); } double Field_blob::val_real(void) { char *blob; - memcpy_fixed(&blob,ptr+packlength,sizeof(char*)); if (!blob) return 0.0; @@ -4471,8 +4453,7 @@ longlong Field_blob::val_int(void) if (!blob) return 0; uint32 length=get_length(ptr); - CHARSET_INFO *cs=charset(); - return my_strntoll(cs,blob,length,NULL,10); + return my_strntoll(charset(),blob,length,NULL,10); } @@ -4482,9 +4463,9 @@ String *Field_blob::val_str(String *val_buffer __attribute__((unused)), char *blob; memcpy_fixed(&blob,ptr+packlength,sizeof(char*)); if (!blob) - val_ptr->set("",0,field_charset); // A bit safer than ->length(0) + val_ptr->set("",0,charset()); // A bit safer than ->length(0) else - val_ptr->set((const char*) blob,get_length(ptr),field_charset); + val_ptr->set((const char*) blob,get_length(ptr),charset()); return val_ptr; } @@ -4542,7 +4523,8 @@ int Field_blob::cmp_binary(const char *a_ptr, const char *b_ptr, /* The following is used only when comparing a key */ -void Field_blob::get_key_image(char *buff,uint length, imagetype type) +void Field_blob::get_key_image(char *buff,uint length, + CHARSET_INFO *cs,imagetype type) { length-= HA_KEY_BLOB_LENGTH; uint32 blob_length= get_length(ptr); @@ -4567,9 +4549,11 @@ void Field_blob::get_key_image(char *buff,uint length, imagetype type) if ((uint32) length > blob_length) { -#ifdef HAVE_purify + /* + Must clear this as we do a memcmp in opt_range.cc to detect + identical keys + */ bzero(buff+2+blob_length, (length-blob_length)); -#endif length=(uint) blob_length; } int2store(buff,length); @@ -4577,14 +4561,14 @@ void Field_blob::get_key_image(char *buff,uint length, imagetype type) memcpy(buff+2,blob,length); } -void Field_blob::set_key_image(char *buff,uint length) +void Field_blob::set_key_image(char *buff,uint length, CHARSET_INFO *cs) { length=uint2korr(buff); - (void) Field_blob::store(buff+2,length, default_charset_info); + (void) Field_blob::store(buff+2,length,cs); } -void Field_geom::get_key_image(char *buff,uint length, imagetype type) +void Field_geom::get_key_image(char *buff,uint length,CHARSET_INFO *cs, imagetype type) { length-=HA_KEY_BLOB_LENGTH; ulong blob_length=get_length(ptr); @@ -4603,7 +4587,7 @@ void Field_geom::get_key_image(char *buff,uint length, imagetype type) return; } -void Field_geom::set_key_image(char *buff,uint length) +void Field_geom::set_key_image(char *buff,uint length,CHARSET_INFO *cs) { Field_blob::set_key_image(buff, length); } @@ -4673,22 +4657,26 @@ void Field_blob::sort_string(char *to,uint length) void Field_blob::sql_type(String &res) const { - CHARSET_INFO *cs=res.charset(); const char *str; - uint len; + uint length; switch (packlength) { - default: str="tiny"; break; - case 2: str=""; break; - case 3: str="medium"; break; - case 4: str="long"; break; + default: str="tiny"; length=4; break; + case 2: str=""; length=0; break; + case 3: str="medium"; length= 6; break; + case 4: str="long"; length=4; break; + } + res.set_latin1(str,length); + if (binary()) + res.append("blob"); + else + { + res.append("text"); + if (field_charset != table->table_charset) + { + res.append(" character set "); + res.append(field_charset->csname); + } } - - len=cs->snprintf(cs,(char*)res.ptr(),res.alloced_length(),"%s%s%s%s", - str, - binary() ? "blob" : "text", - binary() ? "" : " character set ", - binary() ? "" : field_charset->name); - res.length(len); } @@ -4744,11 +4732,6 @@ int Field_blob::pack_cmp(const char *a, const char *b, uint key_length) a_length= (uint) (uchar) *a++; b_length= (uint) (uchar) *b++; } - if (binary()) - { - int cmp= memcmp(a,b,min(a_length,b_length)); - return cmp ? cmp : (int) (a_length - b_length); - } return my_strnncoll(field_charset, (const uchar *)a,a_length, (const uchar *)b,b_length); @@ -4772,11 +4755,6 @@ int Field_blob::pack_cmp(const char *b, uint key_length) { b_length= (uint) (uchar) *b++; } - if (binary()) - { - int cmp= memcmp(a,b,min(a_length,b_length)); - return cmp ? cmp : (int) (a_length - b_length); - } return my_strnncoll(field_charset, (const uchar *)a,a_length, (const uchar *)b,b_length); @@ -5430,8 +5408,7 @@ create_field::create_field(Field *old_field,Field *orig_field) orig_field) { char buff[MAX_FIELD_WIDTH],*pos; - CHARSET_INFO *field_charset= charset; - String tmp(buff,sizeof(buff),field_charset); + String tmp(buff,sizeof(buff), charset); /* Get the value from record[2] (the default value row) */ my_ptrdiff_t diff= (my_ptrdiff_t) (orig_field->table->rec_buff_length*2); @@ -5443,7 +5420,7 @@ create_field::create_field(Field *old_field,Field *orig_field) { pos= (char*) sql_memdup(tmp.ptr(),tmp.length()+1); pos[tmp.length()]=0; - def=new Item_string(pos,tmp.length(),field_charset); + def=new Item_string(pos,tmp.length(), charset); } } } diff --git a/sql/field.h b/sql/field.h index 3f9503764b4..6e049f45814 100644 --- a/sql/field.h +++ b/sql/field.h @@ -133,7 +133,9 @@ public: tmp->unireg_check=Field::NONE; tmp->flags&= (NOT_NULL_FLAG | BLOB_FLAG | UNSIGNED_FLAG | ZEROFILL_FLAG | BINARY_FLAG | ENUM_FLAG | SET_FLAG); +#ifdef PROBABLY_WRONG tmp->table_name= new_table->table_name; +#endif tmp->reset_fields(); } return tmp; @@ -149,14 +151,14 @@ public: if (null_ptr) null_ptr=ADD_TO_PTR(null_ptr,ptr_diff,uchar*); } - inline void get_image(char *buff,uint length) + inline void get_image(char *buff,uint length, CHARSET_INFO *cs) { memcpy(buff,ptr,length); } - inline void set_image(char *buff,uint length) + inline void set_image(char *buff,uint length, CHARSET_INFO *cs) { memcpy(ptr,buff,length); } - virtual void get_key_image(char *buff,uint length, imagetype type) - { get_image(buff,length); } - virtual void set_key_image(char *buff,uint length) - { set_image(buff,length); } + virtual void get_key_image(char *buff,uint length, CHARSET_INFO *cs, imagetype type) + { get_image(buff,length,cs); } + virtual void set_key_image(char *buff,uint length, CHARSET_INFO *cs) + { set_image(buff,length,cs); } inline int cmp_image(char *buff,uint length) { return memcmp(ptr,buff,length); } inline longlong val_int_offset(uint row_offset) @@ -166,7 +168,7 @@ public: ptr-=row_offset; return tmp; } - bool send_binary(Protocol *protocol); + virtual bool send_binary(Protocol *protocol); virtual char *pack(char* to, const char *from, uint max_length=~(uint) 0) { uint32 length=pack_length(); @@ -792,7 +794,6 @@ public: double val_real(void); longlong val_int(void); String *val_str(String*,String *); - bool send_binary(Protocol *protocol); int cmp(const char *,const char*); void sort_string(char *buff,uint length); void sql_type(String &str) const; @@ -833,11 +834,10 @@ public: double val_real(void); longlong val_int(void); String *val_str(String*,String *); - bool send_binary(Protocol *protocol); int cmp(const char *,const char*); void sort_string(char *buff,uint length); - void get_key_image(char *buff,uint length, imagetype type); - void set_key_image(char *buff,uint length); + void get_key_image(char *buff,uint length, CHARSET_INFO *cs, imagetype type); + void set_key_image(char *buff,uint length, CHARSET_INFO *cs); void sql_type(String &str) const; char *pack(char *to, const char *from, uint max_length=~(uint) 0); const char *unpack(char* to, const char *from); @@ -876,7 +876,6 @@ public: double val_real(void); longlong val_int(void); String *val_str(String*,String *); - bool send_binary(Protocol *protocol); int cmp(const char *,const char*); int cmp(const char *a, uint32 a_length, const char *b, uint32 b_length); int cmp_offset(uint offset); @@ -908,8 +907,8 @@ public: store_length(length); memcpy_fixed(ptr+packlength,&data,sizeof(char*)); } - void get_key_image(char *buff,uint length, imagetype type); - void set_key_image(char *buff,uint length); + void get_key_image(char *buff,uint length, CHARSET_INFO *cs, imagetype type); + void set_key_image(char *buff,uint length, CHARSET_INFO *cs); void sql_type(String &str) const; inline bool copy() { char *tmp; @@ -952,8 +951,8 @@ public: enum_field_types type() const { return FIELD_TYPE_GEOMETRY;} void sql_type(String &str) const; - void get_key_image(char *buff,uint length, imagetype type); - void set_key_image(char *buff,uint length); + void get_key_image(char *buff,uint length, CHARSET_INFO *cs,imagetype type); + void set_key_image(char *buff,uint length, CHARSET_INFO *cs); }; @@ -984,7 +983,6 @@ public: double val_real(void); longlong val_int(void); String *val_str(String*,String *); - bool send_binary(Protocol *protocol); int cmp(const char *,const char*); void sort_string(char *buff,uint length); uint32 pack_length() const { return (uint32) packlength; } @@ -1100,7 +1098,8 @@ bool set_field_to_null(Field *field); bool set_field_to_null_with_conversions(Field *field, bool no_conversions); uint find_enum(TYPELIB *typelib,const char *x, uint length); ulonglong find_set(TYPELIB *typelib,const char *x, uint length); -bool test_if_int(const char *str,int length,CHARSET_INFO *cs); +bool test_if_int(const char *str, int length, const char *int_end, + CHARSET_INFO *cs); /* The following are for the interface with the .frm file diff --git a/sql/filesort.cc b/sql/filesort.cc index 97e06997617..00ef12839cf 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -470,10 +470,11 @@ static void make_sortkey(register SORTPARAM *param, switch (sort_field->result_type) { case STRING_RESULT: { + CHARSET_INFO *cs=item->charset(); if (item->maybe_null) *to++=1; /* All item->str() to use some extra byte for end null.. */ - String tmp((char*) to,sort_field->length+4,default_charset_info); + String tmp((char*) to,sort_field->length+4,cs); String *res=item->val_str(&tmp); if (!res) { @@ -488,7 +489,6 @@ static void make_sortkey(register SORTPARAM *param, break; } length=res->length(); - CHARSET_INFO *cs=res->charset(); int diff=(int) (sort_field->length-length); if (diff < 0) { @@ -496,7 +496,7 @@ static void make_sortkey(register SORTPARAM *param, length=sort_field->length; } #ifdef USE_STRCOLL - if(use_strnxfrm(cs)) + if (use_strnxfrm(cs)) { if (item->binary()) { diff --git a/sql/gstream.cc b/sql/gstream.cc index 5a58fef6744..a97ed9cae03 100644 --- a/sql/gstream.cc +++ b/sql/gstream.cc @@ -3,36 +3,38 @@ int GTextReadStream::get_next_toc_type() const { const char *cur = m_cur; - while((*cur)&&(strchr(" \t\r\n",*cur))) + while ((*cur)&&(strchr(" \t\r\n",*cur))) { cur++; } - if(!(*cur)) + if (!(*cur)) { return eostream; } - if(((*cur>='a') && (*cur<='z')) || ((*cur>='A') && (*cur<='Z')) || (*cur=='_')) + if (((*cur>='a') && (*cur<='z')) || ((*cur>='A') && (*cur<='Z')) || + (*cur=='_')) { return word; } - if(((*cur>='0') && (*cur<='9')) || (*cur=='-') || (*cur=='+') || (*cur=='.')) + if (((*cur>='0') && (*cur<='9')) || (*cur=='-') || (*cur=='+') || + (*cur=='.')) { return numeric; } - if(*cur == '(') + if (*cur == '(') { return l_bra; } - if(*cur == ')') + if (*cur == ')') { return r_bra; } - if(*cur == ',') + if (*cur == ',') { return comma; } @@ -43,28 +45,28 @@ int GTextReadStream::get_next_toc_type() const const char *GTextReadStream::get_next_word(int *word_len) { const char *cur = m_cur; - while((*cur)&&(strchr(" \t\r\n",*cur))) + while ((*cur)&&(strchr(" \t\r\n",*cur))) { cur++; } m_last_text_position = cur; - if(!(*cur)) + if (!(*cur)) { return 0; } const char *wd_start = cur; - if(((*cur<'a') || (*cur>'z')) && ((*cur<'A') || (*cur>'Z')) && (*cur!='_')) + if (((*cur<'a') || (*cur>'z')) && ((*cur<'A') || (*cur>'Z')) && (*cur!='_')) { return NULL; } ++cur; - while(((*cur>='a') && (*cur<='z')) || ((*cur>='A') && (*cur<='Z')) || (*cur=='_') || - ((*cur>='0') && (*cur<='9'))) + while (((*cur>='a') && (*cur<='z')) || ((*cur>='A') && (*cur<='Z')) || + (*cur=='_') || ((*cur>='0') && (*cur<='9'))) { ++cur; } @@ -79,19 +81,19 @@ const char *GTextReadStream::get_next_word(int *word_len) int GTextReadStream::get_next_number(double *d) { const char *cur = m_cur; - while((*cur)&&(strchr(" \t\r\n",*cur))) + while ((*cur)&&(strchr(" \t\r\n",*cur))) { cur++; } m_last_text_position = cur; - if(!(*cur)) + if (!(*cur)) { set_error_msg("Numeric constant expected"); return 1; } - if(((*cur<'0') || (*cur>'9')) && (*cur!='-') && (*cur!='+') && (*cur!='.')) + if (((*cur<'0') || (*cur>'9')) && (*cur!='-') && (*cur!='+') && (*cur!='.')) { set_error_msg("Numeric constant expected"); return 1; @@ -101,7 +103,7 @@ int GTextReadStream::get_next_number(double *d) *d = strtod(cur, &endptr); - if(endptr) + if (endptr) { m_cur = endptr; } @@ -112,11 +114,11 @@ int GTextReadStream::get_next_number(double *d) char GTextReadStream::get_next_symbol() { const char *cur = m_cur; - while((*cur)&&(strchr(" \t\r\n",*cur))) + while ((*cur)&&(strchr(" \t\r\n",*cur))) { cur++; } - if(!(*cur)) + if (!(*cur)) { return 0; } diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc index c5d588d1f19..6d2538279d9 100644 --- a/sql/ha_berkeley.cc +++ b/sql/ha_berkeley.cc @@ -512,7 +512,8 @@ int ha_berkeley::open(const char *name, int mode, uint test_if_locked) file->app_private= (void*) (table->key_info+table->primary_key); if ((error= txn_begin(db_env, 0, (DB_TXN**) &transaction, 0)) || (error= (file->open(file, transaction, - fn_format(name_buff, name, "", ha_berkeley_ext, 2 | 4), + fn_format(name_buff, name, "", ha_berkeley_ext, + 2 | 4), "main", DB_BTREE, open_mode, 0))) || (error= transaction->commit(transaction, 0))) { @@ -1940,6 +1941,27 @@ int ha_berkeley::delete_table(const char *name) DBUG_RETURN(error); } + +int ha_berkeley::rename_table(const char * from, const char * to) +{ + int error; + char from_buff[FN_REFLEN]; + char to_buff[FN_REFLEN]; + + if ((error= db_create(&file, db_env, 0))) + my_errno= error; + else + { + /* On should not do a file->close() after rename returns */ + error= file->rename(file, + fn_format(from_buff, from, "", ha_berkeley_ext, 2 | 4), + NULL, fn_format(to_buff, to, "", ha_berkeley_ext, + 2 | 4), 0); + } + return error; +} + + /* How many seeks it will take to read through the table This is to be comparable to the number returned by records_in_range so @@ -2098,7 +2120,7 @@ int ha_berkeley::analyze(THD* thd, HA_CHECK_OPT* check_opt) free(stat); stat=0; } - if (key_file[i]->stat(key_file[i], (void*) &stat, 0)) + if ((key_file[i]->stat)(key_file[i], (void*) &stat, 0)) goto err; /* purecov: inspected */ share->rec_per_key[i]= (stat->bt_ndata / (stat->bt_nkeys ? stat->bt_nkeys : 1)); @@ -2111,7 +2133,7 @@ int ha_berkeley::analyze(THD* thd, HA_CHECK_OPT* check_opt) free(stat); stat=0; } - if (file->stat(file, (void*) &stat, 0)) + if ((file->stat)(file, (void*) &stat, 0)) goto err; /* purecov: inspected */ } pthread_mutex_lock(&share->mutex); diff --git a/sql/ha_berkeley.h b/sql/ha_berkeley.h index dfdd12470d6..dd42e7ab9e2 100644 --- a/sql/ha_berkeley.h +++ b/sql/ha_berkeley.h @@ -152,6 +152,7 @@ class ha_berkeley: public handler int create(const char *name, register TABLE *form, HA_CREATE_INFO *create_info); int delete_table(const char *name); + int rename_table(const char* from, const char* to); THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, enum thr_lock_type lock_type); diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index a50ee6cf93d..68de2a529c9 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -82,7 +82,8 @@ are declared in mysqld.cc: */ long innobase_mirrored_log_groups, innobase_log_files_in_group, innobase_log_file_size, innobase_log_buffer_size, - innobase_buffer_pool_size, innobase_additional_mem_pool_size, + innobase_buffer_pool_size, innobase_buffer_pool_awe_mem_mb, + innobase_additional_mem_pool_size, innobase_file_io_threads, innobase_lock_wait_timeout, innobase_thread_concurrency, innobase_force_recovery; @@ -225,10 +226,14 @@ convert_error_code_to_mysql( return(HA_ERR_ROW_IS_REFERENCED); - } else if (error == (int) DB_CANNOT_ADD_CONSTRAINT) { + } else if (error == (int) DB_CANNOT_ADD_CONSTRAINT) { return(HA_ERR_CANNOT_ADD_FOREIGN); + } else if (error == (int) DB_COL_APPEARS_TWICE_IN_INDEX) { + + return(HA_ERR_WRONG_TABLE_DEF); + } else if (error == (int) DB_OUT_OF_FILE_SPACE) { return(HA_ERR_RECORD_FILE_FULL); @@ -749,7 +754,25 @@ innobase_init(void) srv_log_buffer_size = (ulint) innobase_log_buffer_size; srv_flush_log_at_trx_commit = (ulint) innobase_flush_log_at_trx_commit; - srv_pool_size = (ulint) innobase_buffer_pool_size; + /* We set srv_pool_size here in units of 1 kB. InnoDB internally + changes the value so that it becomes the number of database pages. */ + + if (innobase_buffer_pool_awe_mem_mb == 0) { + /* Careful here: we first convert the signed long int to ulint + and only after that divide */ + + srv_pool_size = ((ulint) innobase_buffer_pool_size) / 1024; + } else { + srv_use_awe = TRUE; + srv_pool_size = (ulint) + (1024 * innobase_buffer_pool_awe_mem_mb); + srv_awe_window_size = (ulint) innobase_buffer_pool_size; + + /* Note that what the user specified as + innodb_buffer_pool_size is actually the AWE memory window + size in this case, and the real buffer pool size is + determined by .._awe_mem_mb. */ + } srv_mem_pool_size = (ulint) innobase_additional_mem_pool_size; @@ -1235,7 +1258,14 @@ ha_innobase::open( if (primary_key != MAX_KEY) { fprintf(stderr, "InnoDB: Error: table %s has no primary key in InnoDB\n" - "InnoDB: data dictionary, but has one in MySQL!\n", name); + "InnoDB: data dictionary, but has one in MySQL!\n" + "InnoDB: If you created the table with a MySQL\n" + "InnoDB: version < 3.23.54 and did not define a primary\n" + "InnoDB: key, but defined a unique key with all non-NULL\n" + "InnoDB: columns, then MySQL internally treats that key\n" + "InnoDB: as the primary key. You can fix this error by\n" + "InnoDB: dump + DROP + CREATE + reimport of the table.\n", + name); } ((row_prebuilt_t*)innobase_prebuilt) @@ -1572,6 +1602,8 @@ build_template( ibool fetch_all_in_key = FALSE; ulint i; + ut_a(templ_type != ROW_MYSQL_REC_FIELDS || thd == current_thd); + clust_index = dict_table_get_first_index_noninline(prebuilt->table); if (!prebuilt->hint_no_need_to_fetch_extra_cols) { @@ -1596,6 +1628,12 @@ build_template( } if (prebuilt->select_lock_type == LOCK_X) { + /* In versions < 3.23.50 we always retrieved the clustered + index record if prebuilt->select_lock_type == LOCK_S, + but there is really not need for that, and in some cases + performance could be seriously degraded because the MySQL + optimizer did not know about our convention! */ + /* We always retrieve the whole clustered index record if we use exclusive row level locks, for example, if the read is done in an UPDATE statement. */ @@ -1604,12 +1642,6 @@ build_template( } if (templ_type == ROW_MYSQL_REC_FIELDS) { - /* In versions < 3.23.50 we always retrieved the clustered - index record if prebuilt->select_lock_type == LOCK_S, - but there is really not need for that, and in some cases - performance could be seriously degraded because the MySQL - optimizer did not know about our convention! */ - index = prebuilt->index; } else { index = clust_index; @@ -1900,12 +1932,9 @@ ha_innobase::write_row( the counter here. */ skip_auto_inc_decr = FALSE; - - if (error == DB_DUPLICATE_KEY) { - ut_a(user_thd->query); - dict_accept(user_thd->query, "REPLACE", - &skip_auto_inc_decr); - } + if (error == DB_DUPLICATE_KEY && + user_thd->lex.sql_command == SQLCOM_REPLACE) + skip_auto_inc_decr= TRUE; if (!skip_auto_inc_decr && incremented_auto_inc_counter && prebuilt->trx->auto_inc_lock) { @@ -2441,7 +2470,9 @@ ha_innobase::index_read_last( } /************************************************************************ -Changes the active index of a handle. */ +Changes the active index of a handle. Note that since we build also the +template for a search, update_thd() must already have been called, in +::external_lock, for example. */ int ha_innobase::change_active_index( @@ -2456,6 +2487,10 @@ ha_innobase::change_active_index( statistic_increment(ha_read_key_count, &LOCK_status); DBUG_ENTER("change_active_index"); + ut_a(prebuilt->trx == + (trx_t*) current_thd->transaction.all.innobase_tid); + ut_a(user_thd == current_thd); + active_index = keynr; if (keynr != MAX_KEY && table->keys > 0) { @@ -2481,11 +2516,13 @@ ha_innobase::change_active_index( dict_index_copy_types(prebuilt->search_tuple, prebuilt->index, prebuilt->index->n_fields); - /* Maybe MySQL changes the active index for a handle also - during some queries, we do not know: then it is safest to build - the template such that all columns will be fetched */ + /* MySQL changes the active index for a handle also during some + queries, for example SELECT MAX(a), SUM(a) first retrieves the MAX() + and then calculates te sum. Previously we played safe and used + the flag ROW_MYSQL_WHOLE_ROW below, but that caused unnecessary + copying. Starting from MySQL-4.1 we use a more efficient flag here. */ - build_template(prebuilt, user_thd, table, ROW_MYSQL_WHOLE_ROW); + build_template(prebuilt, user_thd, table, ROW_MYSQL_REC_FIELDS); DBUG_RETURN(0); } @@ -3717,8 +3754,18 @@ ha_innobase::extra( obsolete! */ switch (operation) { + case HA_EXTRA_FLUSH: + if (prebuilt->blob_heap) { + row_mysql_prebuilt_free_blob_heap(prebuilt); + } + break; case HA_EXTRA_RESET: - case HA_EXTRA_RESET_STATE: + if (prebuilt->blob_heap) { + row_mysql_prebuilt_free_blob_heap(prebuilt); + } + prebuilt->read_just_key = 0; + break; + case HA_EXTRA_RESET_STATE: prebuilt->read_just_key = 0; break; case HA_EXTRA_NO_KEYREAD: @@ -3805,8 +3852,8 @@ innobase_map_isolation_level( enum_tx_isolation iso) /* in: MySQL isolation level code */ { switch(iso) { - case ISO_READ_COMMITTED: return(TRX_ISO_READ_COMMITTED); case ISO_REPEATABLE_READ: return(TRX_ISO_REPEATABLE_READ); + case ISO_READ_COMMITTED: return(TRX_ISO_READ_COMMITTED); case ISO_SERIALIZABLE: return(TRX_ISO_SERIALIZABLE); case ISO_READ_UNCOMMITTED: return(TRX_ISO_READ_UNCOMMITTED); default: ut_a(0); return(0); @@ -3861,11 +3908,9 @@ ha_innobase::external_lock( trx->n_mysql_tables_in_use++; prebuilt->mysql_has_locked = TRUE; - if (thd->variables.tx_isolation != ISO_REPEATABLE_READ) { - trx->isolation_level = innobase_map_isolation_level( + trx->isolation_level = innobase_map_isolation_level( (enum_tx_isolation) thd->variables.tx_isolation); - } if (trx->isolation_level == TRX_ISO_SERIALIZABLE && prebuilt->select_lock_type == LOCK_NONE) { diff --git a/sql/ha_innodb.h b/sql/ha_innodb.h index d2639f39c5b..86fb5d1947b 100644 --- a/sql/ha_innodb.h +++ b/sql/ha_innodb.h @@ -178,7 +178,8 @@ extern char *innobase_home, *innobase_tmpdir, *innobase_logdir; extern long innobase_lock_scan_time; extern long innobase_mirrored_log_groups, innobase_log_files_in_group; extern long innobase_log_file_size, innobase_log_buffer_size; -extern long innobase_buffer_pool_size, innobase_additional_mem_pool_size; +extern long innobase_buffer_pool_size, innobase_buffer_pool_awe_mem_mb, + innobase_additional_mem_pool_size; extern long innobase_file_io_threads, innobase_lock_wait_timeout; extern long innobase_force_recovery, innobase_thread_concurrency; extern char *innobase_data_home_dir, *innobase_data_file_path; diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index 28c3372dde6..754d7dc8641 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -641,7 +641,7 @@ int ha_myisam::repair(THD *thd, MI_CHECK ¶m, bool optimize) the following 'if', thought conceptually wrong, is a useful optimization nevertheless. */ - if (file->state != &file->s->state.state); + if (file->state != &file->s->state.state) file->s->state.state = *file->state; if (file->s->base.auto_key) update_auto_increment_key(¶m, file, 1); @@ -695,12 +695,22 @@ void ha_myisam::deactivate_non_unique_index(ha_rows rows) mi_extra(file, HA_EXTRA_NO_KEYS, 0); else { - /* Only disable old index if the table was empty */ - if (file->state->records == 0) + /* + Only disable old index if the table was empty and we are inserting + a lot of rows. + We should not do this for only a few rows as this is slower and + we don't want to update the key statistics based of only a few rows. + */ + if (file->state->records == 0 && + (!rows || rows >= MI_MIN_ROWS_TO_USE_BULK_INSERT)) mi_disable_non_unique_index(file,rows); - ha_myisam::extra_opt(HA_EXTRA_BULK_INSERT_BEGIN, - current_thd->variables.bulk_insert_buff_size); - table->bulk_insert= 1; + else + { + mi_init_bulk_insert(file, + current_thd->variables.bulk_insert_buff_size, + rows); + table->bulk_insert= 1; + } } } enable_activate_all_index=1; @@ -717,7 +727,7 @@ bool ha_myisam::activate_all_index(THD *thd) MYISAM_SHARE* share = file->s; DBUG_ENTER("activate_all_index"); - mi_extra(file, HA_EXTRA_BULK_INSERT_END, 0); + mi_end_bulk_insert(file); table->bulk_insert= 0; if (enable_activate_all_index && share->state.key_map != set_bits(ulonglong, share->base.keys)) @@ -958,13 +968,11 @@ int ha_myisam::extra(enum ha_extra_function operation) } -/* To be used with WRITE_CACHE, EXTRA_CACHE and BULK_INSERT_BEGIN */ +/* To be used with WRITE_CACHE and EXTRA_CACHE */ int ha_myisam::extra_opt(enum ha_extra_function operation, ulong cache_size) { - if ((specialflag & SPECIAL_SAFE_MODE) & - (operation == HA_EXTRA_WRITE_CACHE || - operation == HA_EXTRA_BULK_INSERT_BEGIN)) + if ((specialflag & SPECIAL_SAFE_MODE) && operation == HA_EXTRA_WRITE_CACHE) return 0; return mi_extra(file, operation, (void*) &cache_size); } @@ -1229,8 +1237,7 @@ longlong ha_myisam::get_auto_increment() } if (table->bulk_insert) - mi_extra(file, HA_EXTRA_BULK_INSERT_FLUSH, - (void*) &table->next_number_index); + mi_flush_bulk_insert(file, table->next_number_index); longlong nr; int error; diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc index 4398aaecf4d..3bd812821f6 100644 --- a/sql/ha_myisammrg.cc +++ b/sql/ha_myisammrg.cc @@ -239,6 +239,13 @@ void ha_myisammrg::info(uint flag) #else ref_length=4; // Can't be > than my_off_t #endif + if (flag & HA_STATUS_CONST) + { + if (table->key_parts) + memcpy((char*) table->key_info[0].rec_per_key, + (char*) info.rec_per_key, + sizeof(table->key_info[0].rec_per_key)*table->key_parts); + } } @@ -257,9 +264,7 @@ int ha_myisammrg::extra(enum ha_extra_function operation) int ha_myisammrg::extra_opt(enum ha_extra_function operation, ulong cache_size) { - if ((specialflag & SPECIAL_SAFE_MODE) & - (operation == HA_EXTRA_WRITE_CACHE || - operation == HA_EXTRA_BULK_INSERT_BEGIN)) + if ((specialflag & SPECIAL_SAFE_MODE) && operation == HA_EXTRA_WRITE_CACHE) return 0; return myrg_extra(file, operation, (void*) &cache_size); } diff --git a/sql/item.cc b/sql/item.cc index 12195ae359a..7363a285e32 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -47,11 +47,6 @@ Item::Item(): loop_id= 0; } -Item_ref_in_optimizer::Item_ref_in_optimizer(Item_in_optimizer *master, - char *table_name_par, - char *field_name_par): - Item_ref(master->args, table_name_par, field_name_par), owner(master) {} - bool Item::check_loop(uint id) { @@ -121,7 +116,7 @@ bool Item_string::eq(const Item *item, bool binary_cmp) const bool Item::get_date(TIME *ltime,bool fuzzydate) { char buff[40]; - String tmp(buff,sizeof(buff),default_charset_info),*res; + String tmp(buff,sizeof(buff), my_charset_bin),*res; if (!(res=val_str(&tmp)) || str_to_TIME(res->ptr(),res->length(),ltime,fuzzydate) == TIMESTAMP_NONE) { @@ -139,7 +134,7 @@ bool Item::get_date(TIME *ltime,bool fuzzydate) bool Item::get_time(TIME *ltime) { char buff[40]; - String tmp(buff,sizeof(buff),default_charset_info),*res; + String tmp(buff,sizeof(buff),my_charset_bin),*res; if (!(res=val_str(&tmp)) || str_to_time(res->ptr(),res->length(),ltime)) { @@ -178,7 +173,7 @@ const char *Item_ident::full_name() const char *tmp; if (!table_name) return field_name ? field_name : name ? name : "tmp_field"; - if (db_name) + if (db_name && db_name[0]) { tmp=(char*) sql_alloc((uint) strlen(db_name)+(uint) strlen(table_name)+ (uint) strlen(field_name)+3); @@ -198,6 +193,7 @@ String *Item_field::val_str(String *str) { if ((null_value=field->is_null())) return 0; + str->set_charset(str_value.charset()); return field->val_str(str,&str_value); } @@ -220,6 +216,7 @@ String *Item_field::str_result(String *str) { if ((null_value=result_field->is_null())) return 0; + str->set_charset(str_value.charset()); return result_field->val_str(str,&str_value); } @@ -383,7 +380,8 @@ double Item_param::val() { switch (item_result_type) { case STRING_RESULT: - return (double)my_strntod(str_value.charset(),str_value.ptr(),str_value.length(),(char**)0); + return (double) my_strntod(str_value.charset(), (char*) str_value.ptr(), + str_value.length(), (char**) 0); case INT_RESULT: return (double)int_value; default: @@ -437,20 +435,6 @@ String *Item_copy_string::val_str(String *str) return &str_value; } -double Item_ref_in_optimizer::val() -{ - return owner->get_cache(); -} -longlong Item_ref_in_optimizer::val_int() -{ - return owner->get_cache_int(); -} -String* Item_ref_in_optimizer::val_str(String* s) -{ - return owner->get_cache_str(s); -} - - /* Functions to convert item to field (for send_fields) */ @@ -464,18 +448,6 @@ bool Item::fix_fields(THD *thd, return 0; } -bool Item_outer_select_context_saver::fix_fields(THD *thd, - struct st_table_list *list, - Item ** ref) -{ - DBUG_ENTER("Item_outer_select_context_saver::fix_fields"); - bool res= item->fix_fields(thd, - 0, // do not show current subselect fields - &item); - *ref= item; - DBUG_RETURN(res); -} - bool Item_asterisk_remover::fix_fields(THD *thd, struct st_table_list *list, Item ** ref) @@ -529,6 +501,26 @@ bool Item_asterisk_remover::fix_fields(THD *thd, DBUG_RETURN(res); } +bool Item_ref_on_list_position::fix_fields(THD *thd, + struct st_table_list *tables, + Item ** reference) +{ + List_iterator<Item> li(list); + Item *item; + for (uint i= 0; (item= li++) && i < pos; i++); + if (item) + { + ref= li.ref(); + return Item_ref_null_helper::fix_fields(thd, tables, reference); + } + else + { + ref= 0; + my_error(ER_CARDINALITY_COL, MYF(0), pos); + return 1; + } +} + double Item_ref_null_helper::val() { double tmp= (*ref)->val_result(); @@ -556,8 +548,11 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) { if (!field) // If field is not checked { - Field *tmp; - if ((tmp= find_field_in_tables(thd, this, tables, 0)) == not_found_field) + TABLE_LIST *where= 0; + Field *tmp= (Field *)not_found_field; + if (outer_resolving || + (tmp= find_field_in_tables(thd, this, tables, &where, 0)) == + not_found_field) { /* We can't find table field in table list of current select, @@ -575,20 +570,21 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) Item **refer= (Item **)not_found_item; // Prevent using outer fields in subselects, that is not supported now SELECT_LEX *cursel=(SELECT_LEX *) thd->lex.current_select; - if (cursel->linkage != DERIVED_TABLE_TYPE) - for (SELECT_LEX *sl=cursel->outer_select(); + if (cursel->master_unit()->first_select()->linkage != DERIVED_TABLE_TYPE) + for (SELECT_LEX *sl=(outer_resolving?cursel:cursel->outer_select()); sl; sl= sl->outer_select()) { if ((tmp= find_field_in_tables(thd, this, - (last= sl)->get_table_list(), + (last= sl)->get_table_list(), &where, 0)) != not_found_field) break; if ((refer= find_item_in_list(this, sl->item_list, REPORT_EXCEPT_NOT_FOUND)) != (Item **)not_found_item) break; - if (sl->linkage == DERIVED_TABLE_TYPE) + if (sl->master_unit()->first_select()->linkage == + DERIVED_TABLE_TYPE) break; // do not look over derived table } if (!tmp) @@ -598,7 +594,7 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) else if (tmp == not_found_field && refer == (Item **)not_found_item) { // call to return error code - find_field_in_tables(thd, this, tables, 1); + find_field_in_tables(thd, this, tables, &where, 1); return -1; } else if (refer != (Item **)not_found_item) @@ -608,7 +604,6 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) (char *)field_name); if (!r) return 1; - int res; if (r->check_cols(1) || r->fix_fields(thd, tables, ref)) return 1; r->depended_from= last; @@ -624,6 +619,17 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) found table as depended (of select where was found table) */ thd->lex.current_select->mark_as_dependent(last); + if (depended_from->having_fix_field) + { + Item_ref *rf; + *ref= rf= new Item_ref((where->db[0]?where->db:0), + (char *)where->alias, + (char *)field_name); + if (!rf) + return 1; + (rf)->outer_resolving= outer_resolving; + return rf->check_cols(1) || rf->fix_fields(thd, tables, ref); + } } } else if (!tmp) @@ -639,14 +645,6 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) table->used_fields++; table->used_keys&=field->part_of_key; } - if (depended_from != 0 && depended_from->having_fix_field) - { - *ref= new Item_ref((char *)db_name, (char *)table_name, - (char *)field_name); - if (!*ref) - return 1; - return (*ref)->check_cols(1) || (*ref)->fix_fields(thd, tables, ref); - } fixed= 1; return 0; } @@ -1075,16 +1073,21 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference) { if (!ref) { - SELECT_LEX *sl= thd->lex.current_select->outer_select(); + TABLE_LIST *where= 0; + SELECT_LEX *sl= (outer_resolving? + thd->lex.current_select->select_lex(): + thd->lex.current_select->outer_select()); /* Finding only in current select will be performed for selects that have not outer one and for derived tables (which not support using outer fields for now) */ - if ((ref= find_item_in_list(this, + if (outer_resolving || + (ref= find_item_in_list(this, *(thd->lex.current_select->get_item_list()), ((sl && - thd->lex.current_select->linkage != + thd->lex.current_select->master_unit()-> + first_select()->linkage != DERIVED_TABLE_TYPE) ? REPORT_EXCEPT_NOT_FOUND : REPORT_ALL_ERRORS))) == @@ -1108,9 +1111,10 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference) (Item **)not_found_item) break; if ((tmp= find_field_in_tables(thd, this, - sl->get_table_list(), + sl->get_table_list(), &where, 0)) != not_found_field); - if (sl->linkage == DERIVED_TABLE_TYPE) + if (sl->master_unit()->first_select()->linkage == + DERIVED_TABLE_TYPE) break; // do not look over derived table } @@ -1206,7 +1210,7 @@ Item *resolve_const_item(Item *item,Item *comp_item) if (res_type == STRING_RESULT) { char buff[MAX_FIELD_WIDTH]; - String tmp(buff,sizeof(buff),default_charset_info),*result; + String tmp(buff,sizeof(buff),my_charset_bin),*result; result=item->val_str(&tmp); if (item->null_value) { @@ -1220,7 +1224,7 @@ Item *resolve_const_item(Item *item,Item *comp_item) #ifdef DELETE_ITEMS delete item; #endif - return new Item_string(name,tmp_str,length,default_charset_info); + return new Item_string(name,tmp_str,length,result->charset()); } if (res_type == INT_RESULT) { @@ -1261,8 +1265,8 @@ bool field_is_equal_to_item(Field *field,Item *item) { char item_buff[MAX_FIELD_WIDTH]; char field_buff[MAX_FIELD_WIDTH]; - String item_tmp(item_buff,sizeof(item_buff),default_charset_info),*item_result; - String field_tmp(field_buff,sizeof(field_buff),default_charset_info); + String item_tmp(item_buff,sizeof(item_buff),my_charset_bin),*item_result; + String field_tmp(field_buff,sizeof(field_buff),my_charset_bin); item_result=item->val_str(&item_tmp); if (item->null_value) return 1; // This must be true @@ -1277,6 +1281,141 @@ bool field_is_equal_to_item(Field *field,Item *item) return result == field->val_real(); } +Item_cache* Item_cache::get_cache(Item_result type) +{ + switch (type) + { + case INT_RESULT: + return new Item_cache_int(); + case REAL_RESULT: + return new Item_cache_real(); + case STRING_RESULT: + return new Item_cache_str(); + case ROW_RESULT: + return new Item_cache_row(); + default: + // should never be in real life + DBUG_ASSERT(0); + return 0; + } +} + +void Item_cache_str::store(Item *item) +{ + str_value.set(buffer, sizeof(buffer), item->charset()); + value= item->str_result(&str_value); + if ((null_value= item->null_value)) + value= 0; + else if (value != &str_value) + { + /* + We copy string value to avoid changing value if 'item' is table field + in queries like following (where t1.c is varchar): + select a, + (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a'), + (select c from t1 where a=t2.a) + from t2; + */ + str_value.copy(*value); + value= &str_value; + } + +} +double Item_cache_str::val() +{ + if (value) + return my_strntod(value->charset(), (char*) value->ptr(), + value->length(), (char**) 0); + else + return (double)0; +} +longlong Item_cache_str::val_int() +{ + if (value) + return my_strntoll(value->charset(), value->ptr(), + value->length(), (char**) 0, 10); + else + return (longlong)0; +} + +bool Item_cache_row::allocate(uint num) +{ + item_count= num; + THD *thd= current_thd; + return (!(values= + (Item_cache **) thd->calloc(sizeof(Item_cache *)*item_count))); +} + +bool Item_cache_row::setup(Item * item) +{ + if (!values && allocate(item->cols())) + return 1; + for (uint i= 0; i < item_count; i++) + { + Item *el= item->el(i); + Item_cache *tmp; + if (!(tmp= values[i]= Item_cache::get_cache(el->result_type()))) + return 1; + tmp->setup(el); + } + return 0; +} + +void Item_cache_row::store(Item * item) +{ + null_value= 0; + item->bring_value(); + for (uint i= 0; i < item_count; i++) + { + values[i]->store(item->el(i)); + null_value|= values[i]->null_value; + } +} + +void Item_cache_row::illegal_method_call(const char *method) +{ + DBUG_ENTER("Item_cache_row::illegal_method_call"); + DBUG_PRINT("error", ("!!! %s method was called for row item", method)); + DBUG_ASSERT(0); + my_error(ER_CARDINALITY_COL, MYF(0), 1); + DBUG_VOID_RETURN; +} + +bool Item_cache_row::check_cols(uint c) +{ + if (c != item_count) + { + my_error(ER_CARDINALITY_COL, MYF(0), c); + return 1; + } + return 0; +} + +bool Item_cache_row::null_inside() +{ + for (uint i= 0; i < item_count; i++) + { + if (values[i]->cols() > 1) + { + if (values[i]->null_inside()) + return 1; + } + else + { + values[i]->val_int(); + if (values[i]->null_value) + return 1; + } + } + return 0; +} + +void Item_cache_row::bring_value() +{ + for (uint i= 0; i < item_count; i++) + values[i]->bring_value(); + return; +} /***************************************************************************** ** Instantiate templates diff --git a/sql/item.h b/sql/item.h index 47c7541d3e3..1d5e92f6404 100644 --- a/sql/item.h +++ b/sql/item.h @@ -32,12 +32,12 @@ public: static void *operator new(size_t size) {return (void*) sql_alloc((uint) size); } static void operator delete(void *ptr,size_t size) {} /*lint -e715 */ - enum Type {FIELD_ITEM,FUNC_ITEM,SUM_FUNC_ITEM,STRING_ITEM, - INT_ITEM,REAL_ITEM,NULL_ITEM,VARBIN_ITEM, - COPY_STR_ITEM,FIELD_AVG_ITEM, DEFAULT_ITEM, - PROC_ITEM,COND_ITEM,REF_ITEM,FIELD_STD_ITEM, - FIELD_VARIANCE_ITEM,CONST_ITEM, - SUBSELECT_ITEM, ROW_ITEM}; + enum Type {FIELD_ITEM, FUNC_ITEM, SUM_FUNC_ITEM, STRING_ITEM, + INT_ITEM, REAL_ITEM, NULL_ITEM, VARBIN_ITEM, + COPY_STR_ITEM, FIELD_AVG_ITEM, DEFAULT_ITEM, + PROC_ITEM,COND_ITEM, REF_ITEM, FIELD_STD_ITEM, + FIELD_VARIANCE_ITEM, CONST_ITEM, + SUBSELECT_ITEM, ROW_ITEM, CACHE_ITEM}; enum cond_result { COND_UNDEF,COND_OK,COND_TRUE,COND_FALSE }; String str_value; /* used to store value */ @@ -101,6 +101,7 @@ public: CHARSET_INFO *thd_charset() const; CHARSET_INFO *charset() const { return str_value.charset(); }; void set_charset(CHARSET_INFO *cs) { str_value.set_charset(cs); } + virtual void set_outer_resolving() {} // Row emulation virtual uint cols() { return 1; } @@ -108,64 +109,12 @@ public: virtual Item** addr(uint i) { return 0; } virtual bool check_cols(uint c); // It is not row => null inside is impossible - virtual bool null_inside() { return 0; }; + virtual bool null_inside() { return 0; } + // used in row subselects to get value of elements + virtual void bring_value() {} }; -/* - Wrapper base class -*/ - -class Item_wrapper :public Item -{ -protected: - Item *item; -public: - /* - Following methods should not be used, because fix_fields exclude this - item (it assign '*ref' with field 'item' in derived classes) - */ - enum Type type() const { return item->type(); } - enum_field_types field_type() const { return item->field_type(); } - double val() { return item->val(); } - longlong val_int() { return item->val_int(); } - String* val_str(String* s) { return item->val_str(s); } - bool check_cols(uint col) { return item->check_cols(col); } - bool eq(const Item *item, bool binary_cmp) const - { return item->eq(item, binary_cmp); } - bool is_null() - { - item->val_int(); - return item->null_value; - } - bool get_date(TIME *ltime, bool fuzzydate) - { - return (null_value=item->get_date(ltime, fuzzydate)); - } - bool send(Protocol *prot, String *tmp) { return item->send(prot, tmp); } - int save_in_field(Field *field, bool no_conversions) - { - return item->save_in_field(field, no_conversions); - } - void save_org_in_field(Field *field) { item->save_org_in_field(field); } - enum Item_result result_type () const { return item->result_type(); } - table_map used_tables() const { return item->used_tables(); } -}; - - -/* - Save context of name resolution for Item, used in subselect transformer. -*/ -class Item_outer_select_context_saver :public Item_wrapper -{ -public: - Item_outer_select_context_saver(Item *it) - { - item= it; - } - bool fix_fields(THD *, struct st_table_list *, Item ** ref); -}; - class st_select_lex; class Item_ident :public Item { @@ -174,12 +123,14 @@ public: const char *table_name; const char *field_name; st_select_lex *depended_from; + bool outer_resolving; /* used for items from reduced subselect */ Item_ident(const char *db_name_par,const char *table_name_par, const char *field_name_par) - :db_name(db_name_par),table_name(table_name_par), - field_name(field_name_par), depended_from(0) + :db_name(db_name_par), table_name(table_name_par), + field_name(field_name_par), depended_from(0), outer_resolving(0) { name = (char*) field_name_par; } const char *full_name() const; + void set_outer_resolving() { outer_resolving= 1; } }; @@ -394,7 +345,8 @@ public: name=(char*) str_value.ptr(); decimals=NOT_FIXED_DEC; } - Item_string(const char *name_par,const char *str,uint length,CHARSET_INFO *cs) + Item_string(const char *name_par, const char *str, uint length, + CHARSET_INFO *cs) { str_value.set(str,length,cs); max_length=length; @@ -405,11 +357,13 @@ public: enum Type type() const { return STRING_ITEM; } double val() { - return my_strntod(str_value.charset(),str_value.ptr(),str_value.length(),(char**)NULL); + return my_strntod(str_value.charset(), (char*) str_value.ptr(), + str_value.length(), (char**) 0); } longlong val_int() { - return my_strntoll(str_value.charset(),str_value.ptr(),str_value.length(),(char**) 0,10); + return my_strntoll(str_value.charset(), str_value.ptr(), + str_value.length(), (char**) 0, 10); } String *val_str(String*) { return (String*) &str_value; } int save_in_field(Field *field, bool no_conversions); @@ -568,7 +522,7 @@ protected: Item_in_subselect* owner; public: Item_ref_null_helper(Item_in_subselect* master, Item **item, - char *table_name_par,char *field_name_par): + char *table_name_par, char *field_name_par): Item_ref(item, table_name_par, field_name_par), owner(master) {} double val(); longlong val_int(); @@ -576,6 +530,28 @@ public: bool get_date(TIME *ltime, bool fuzzydate); }; + +/* + Used to find item in list of select items after '*' items processing. + + Because item '*' can be used in item list. when we create + Item_ref_on_list_position we do not know how item list will be changed, but + we know number of item position (I mean queries like "select * from t"). +*/ +class Item_ref_on_list_position: public Item_ref_null_helper +{ +protected: + List<Item> &list; + uint pos; +public: + Item_ref_on_list_position(Item_in_subselect* master, + List<Item> &li, uint num, + char *table_name, char *field_name): + Item_ref_null_helper(master, 0, table_name, field_name), + list(li), pos(num) {} + bool fix_fields(THD *, struct st_table_list *, Item ** ref); +}; + /* To resolve '*' field moved to condition and register NULL values @@ -592,24 +568,6 @@ public: bool fix_fields(THD *, struct st_table_list *, Item ** ref); }; -class Item_in_optimizer; -class Item_ref_in_optimizer: public Item_ref -{ -protected: - Item_in_optimizer* owner; -public: - Item_ref_in_optimizer(Item_in_optimizer* master, - char *table_name_par,char *field_name_par); - double val(); - longlong val_int(); - String* val_str(String* s); - bool fix_fields(THD *, struct st_table_list *, Item ** ref) - { - fixed= 1; - return 0; - } -}; - /* The following class is used to optimize comparing of date columns We need to save the original item, to be able to set the field to the @@ -658,7 +616,11 @@ public: enum Item_result result_type () const { return STRING_RESULT; } enum_field_types field_type() const { return cached_field_type; } double val() - { return null_value ? 0.0 : my_strntod(str_value.charset(),str_value.ptr(),str_value.length(),NULL); } + { + return (null_value ? 0.0 : + my_strntod(str_value.charset(), (char*) str_value.ptr(), + str_value.length(),NULL)); + } longlong val_int() { return null_value ? LL(0) : my_strntoll(str_value.charset(),str_value.ptr(),str_value.length(),(char**) 0,10); } String *val_str(String*); @@ -724,6 +686,122 @@ public: bool cmp(void); }; +class Item_cache: public Item +{ +public: + virtual bool allocate(uint i) { return 0; }; + virtual bool setup(Item *) { return 0; }; + virtual void store(Item *)= 0; + void set_len_n_dec(uint32 max_len, uint8 dec) + { + max_length= max_len; + decimals= dec; + } + enum Type type() const { return CACHE_ITEM; } + static Item_cache* get_cache(Item_result type); +}; + +class Item_cache_int: public Item_cache +{ + longlong value; +public: + Item_cache_int() { fixed= 1; null_value= 1; } + + void store(Item *item) + { + value= item->val_int_result(); + null_value= item->null_value; + } + double val() { return (double) value; } + longlong val_int() { return value; } + String* val_str(String *str) { str->set(value, thd_charset()); return str; } + enum Item_result result_type() const { return INT_RESULT; } +}; + +class Item_cache_real: public Item_cache +{ + double value; +public: + Item_cache_real() { fixed= 1; null_value= 1; } + + void store(Item *item) + { + value= item->val_result(); + null_value= item->null_value; + } + double val() { return value; } + longlong val_int() { return (longlong) (value+(value > 0 ? 0.5 : -0.5)); } + String* val_str(String *str) + { + str->set(value, decimals, thd_charset()); + return str; + } + enum Item_result result_type() const { return REAL_RESULT; } +}; + +class Item_cache_str: public Item_cache +{ + char buffer[80]; + String *value; +public: + Item_cache_str() { fixed= 1; null_value= 1; } + + void store(Item *item); + double val(); + longlong val_int(); + String* val_str(String *) { return value; } + enum Item_result result_type() const { return STRING_RESULT; } + CHARSET_INFO *charset() const { return value->charset(); }; +}; + +class Item_cache_row: public Item_cache +{ + Item_cache **values; + uint item_count; +public: + Item_cache_row(): values(0), item_count(2) { fixed= 1; null_value= 1; } + + /* + 'allocate' used only in row transformer, to preallocate space for row + cache. + */ + bool allocate(uint num); + /* + 'setup' is needed only by row => it not called by simple row subselect + (only by IN subselect (in subselect optimizer)) + */ + bool setup(Item *item); + void store(Item *item); + void illegal_method_call(const char *); + void make_field(Send_field *) + { + illegal_method_call((const char*)"make_field"); + }; + double val() + { + illegal_method_call((const char*)"val"); + return 0; + }; + longlong val_int() + { + illegal_method_call((const char*)"val_int"); + return 0; + }; + String *val_str(String *) + { + illegal_method_call((const char*)"val_str"); + return 0; + }; + enum Item_result result_type() const { return ROW_RESULT; } + + uint cols() { return item_count; } + Item* el(uint i) { return values[i]; } + Item** addr(uint i) { return (Item **) (values + i); } + bool check_cols(uint c); + bool null_inside(); + void bring_value(); +}; + extern Item_buff *new_Item_buff(Item *item); extern Item_result item_cmp_type(Item_result a,Item_result b); extern Item *resolve_const_item(Item *item,Item *cmp_item); diff --git a/sql/item_buff.cc b/sql/item_buff.cc index 7b8976bb572..573d4ab17e3 100644 --- a/sql/item_buff.cc +++ b/sql/item_buff.cc @@ -99,7 +99,7 @@ bool Item_field_buff::cmp(void) { bool tmp= field->cmp(buff) != 0; // This is not a blob! if (tmp) - field->get_image(buff,length); + field->get_image(buff,length,field->charset()); if (null_value != field->is_null()) { null_value= !null_value; diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 851a591bae9..3d65c05b9cf 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -153,11 +153,7 @@ int Arg_comparator::set_compare_func(Item_bool_func2 *item, Item_result type) comparators[i].set_cmp_func(owner, (*a)->addr(i), (*b)->addr(i)); } else - { - my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); - current_thd->fatal_error= 1; return 1; - } } return 0; } @@ -247,6 +243,8 @@ int Arg_comparator::compare_e_int() int Arg_comparator::compare_row() { int res= 0; + (*a)->bring_value(); + (*b)->bring_value(); uint n= (*a)->cols(); for (uint i= 0; i<n; i++) { @@ -261,6 +259,8 @@ int Arg_comparator::compare_row() int Arg_comparator::compare_e_row() { int res= 0; + (*a)->bring_value(); + (*b)->bring_value(); uint n= (*a)->cols(); for (uint i= 0; i<n; i++) { @@ -270,60 +270,59 @@ int Arg_comparator::compare_e_row() return 1; } -longlong Item_in_optimizer::val_int() +bool Item_in_optimizer::preallocate_row() { - int_cache_ok= 1; - flt_cache_ok= 0; - str_cache_ok= 0; - int_cache= args[0]->val_int_result(); - if (args[0]->null_value) - { - null_value= 1; - return 0; - } - longlong tmp= args[1]->val_int_result(); - null_value= args[1]->null_value; - return tmp; + return (!(cache= Item_cache::get_cache(ROW_RESULT))); } -longlong Item_in_optimizer::get_cache_int() +bool Item_in_optimizer::fix_fields(THD *thd, struct st_table_list *tables, + Item ** ref) { - if (!int_cache_ok) + if (args[0]->fix_fields(thd, tables, args)) + return 1; + if (args[0]->maybe_null) + maybe_null=1; + if (args[0]->binary()) + set_charset(my_charset_bin); + with_sum_func= args[0]->with_sum_func; + used_tables_cache= args[0]->used_tables(); + const_item_cache= args[0]->const_item(); + if (!cache && !(cache= Item_cache::get_cache(args[0]->result_type()))) + return 1; + cache->setup(args[0]); + if (args[1]->fix_fields(thd, tables, args)) + return 1; + Item_in_subselect * sub= (Item_in_subselect *)args[1]; + if (args[0]->cols() != sub->engine->cols()) { - int_cache_ok= 1; - flt_cache_ok= 0; - str_cache_ok= 0; - int_cache= args[0]->val_int_result(); - null_value= args[0]->null_value; + my_error(ER_CARDINALITY_COL, MYF(0), args[0]->cols()); + return 1; } - return int_cache; + if (args[1]->maybe_null) + maybe_null=1; + with_sum_func= with_sum_func || args[1]->with_sum_func; + used_tables_cache|= args[1]->used_tables(); + const_item_cache&= args[1]->const_item(); + return 0; } -double Item_in_optimizer::get_cache() +longlong Item_in_optimizer::val_int() { - if (!flt_cache_ok) + cache->store(args[0]); + if (cache->null_value) { - flt_cache_ok= 1; - int_cache_ok= 0; - str_cache_ok= 0; - flt_cache= args[0]->val_result(); - null_value= args[0]->null_value; + null_value= 1; + return 0; } - return flt_cache; + longlong tmp= args[1]->val_int_result(); + null_value= args[1]->null_value; + return tmp; } -String *Item_in_optimizer::get_cache_str(String *s) +bool Item_in_optimizer::is_null() { - if (!str_cache_ok) - { - str_cache_ok= 1; - int_cache_ok= 0; - flt_cache_ok= 0; - str_value.set(buffer, sizeof(buffer), s->charset()); - str_cache= args[0]->str_result(&str_value); - null_value= args[0]->null_value; - } - return str_cache; + cache->store(args[0]); + return (null_value= (cache->null_value || args[1]->is_null())); } longlong Item_func_eq::val_int() @@ -869,8 +868,9 @@ String *Item_func_case::val_str(String *str) null_value=1; return 0; } + null_value= 0; if (!(res=item->val_str(str))) - null_value=1; + null_value= 1; return res; } @@ -935,6 +935,13 @@ Item_func_case::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) return 0; } +void Item_func_case::set_outer_resolving() +{ + first_expr->set_outer_resolving(); + else_expr->set_outer_resolving(); + Item_func::set_outer_resolving(); +} + bool Item_func_case::check_loop(uint id) { DBUG_ENTER("Item_func_case::check_loop"); @@ -1217,8 +1224,9 @@ void cmp_item_row::store_value(Item *item) { THD *thd= current_thd; n= item->cols(); - if ((comparators= (cmp_item **) thd->alloc(sizeof(cmp_item *)*n))) + if ((comparators= (cmp_item **) thd->calloc(sizeof(cmp_item *)*n))) { + item->bring_value(); item->null_value= 0; for (uint i=0; i < n; i++) if ((comparators[i]= cmp_item::get_comparator(item->el(i)))) @@ -1227,18 +1235,10 @@ void cmp_item_row::store_value(Item *item) item->null_value|= item->el(i)->null_value; } else - { - my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); - thd->fatal_error= 1; return; - } } else - { - my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); - thd->fatal_error= 1; return; - } } void cmp_item_row::store_value_by_template(cmp_item *t, Item *item) @@ -1252,6 +1252,7 @@ void cmp_item_row::store_value_by_template(cmp_item *t, Item *item) n= tmpl->n; if ((comparators= (cmp_item **) sql_alloc(sizeof(cmp_item *)*n))) { + item->bring_value(); item->null_value= 0; for (uint i=0; i < n; i++) if ((comparators[i]= tmpl->comparators[i]->make_same())) @@ -1261,18 +1262,10 @@ void cmp_item_row::store_value_by_template(cmp_item *t, Item *item) item->null_value|= item->el(i)->null_value; } else - { - my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); - current_thd->fatal_error= 1; return; - } } else - { - my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); - current_thd->fatal_error= 1; return; - } } int cmp_item_row::cmp(Item *arg) @@ -1284,6 +1277,7 @@ int cmp_item_row::cmp(Item *arg) return 1; } bool was_null= 0; + arg->bring_value(); for (uint i=0; i < n; i++) if (comparators[i]->cmp(arg->el(i))) { @@ -1509,6 +1503,15 @@ bool Item_cond::check_loop(uint id) DBUG_RETURN(0); } +void Item_cond::set_outer_resolving() +{ + Item_func::set_outer_resolving(); + List_iterator<Item> li(list); + Item *item; + while ((item= li++)) + item->set_outer_resolving(); +} + void Item_cond::split_sum_func(List<Item> &fields) { List_iterator<Item> li(list); diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 994e51ef89f..bd7d1bfaf7a 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -85,25 +85,28 @@ public: void fix_length_and_dec() { decimals=0; max_length=1; } }; +class Item_cache; class Item_in_optimizer: public Item_bool_func { protected: - char buffer[80]; - longlong int_cache; - double flt_cache; - String *str_cache; - bool int_cache_ok, flt_cache_ok, str_cache_ok; -public: - Item_in_optimizer(Item *a,Item *b): - Item_bool_func(a,b), int_cache_ok(0), flt_cache_ok(0), str_cache_ok(0) {} - bool is_null() { return test(args[0]->is_null() || args[1]->is_null()); } + Item_cache *cache; +public: + Item_in_optimizer(Item *a, Item_in_subselect *b): + Item_bool_func(a, (Item *)b), cache(0) {} + // used by row in transformer + bool preallocate_row(); + bool fix_fields(THD *, struct st_table_list *, Item **); + bool is_null(); + /* + Item_in_optimizer item is special boolean function. On value request + (one of val, val_int or val_str methods) it evaluate left expression + of IN by storing it value in cache item (one of Item_cache* items), + then it test cache is it NULL. If left expression (cache) is NULL then + Item_in_optimizer return NULL, else it evaluate Item_in_subselect. + */ longlong val_int(); - - double get_cache(); - longlong get_cache_int(); - String *get_cache_str(String *s); - - friend class Item_ref_in_optimizer; + + Item_cache **get_cache() { return &cache; } }; class Item_bool_func2 :public Item_int_func @@ -281,6 +284,11 @@ public: const char *func_name() const { return "interval"; } void update_used_tables(); bool check_loop(uint id); + void set_outer_resolving() + { + item->set_outer_resolving(); + Item_func::set_outer_resolving(); + } }; @@ -363,6 +371,7 @@ public: bool fix_fields(THD *thd, struct st_table_list *tlist, Item **ref); Item *find_item(String *str); bool check_loop(uint id); + void set_outer_resolving(); }; @@ -542,10 +551,14 @@ public: cmp_item_row(): comparators(0), n(0) {} ~cmp_item_row() { - if(comparators) - for(uint i= 0; i < n; i++) + if (comparators) + { + for (uint i= 0; i < n; i++) + { if (comparators[i]) delete comparators[i]; + } + } } void store_value(Item *item); int cmp(Item *arg); @@ -647,6 +660,11 @@ class Item_func_in :public Item_int_func DBUG_RETURN(item->check_loop(id)); } bool nulls_in_row(); + void set_outer_resolving() + { + item->set_outer_resolving(); + Item_int_func::set_outer_resolving(); + } }; /* Functions used by where clause */ @@ -788,6 +806,7 @@ public: friend int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds); bool check_loop(uint id); void top_level_item() { abort_on_null=1; } + void set_outer_resolving(); }; diff --git a/sql/item_create.cc b/sql/item_create.cc index 259427af901..0dba7f6e3ae 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -303,6 +303,18 @@ Item *create_func_pow(Item* a, Item *b) return new Item_func_pow(a,b); } +Item *create_func_current_user() +{ + THD *thd=current_thd; + char buff[HOSTNAME_LENGTH+USERNAME_LENGTH+2]; + uint length; + + length= (uint) (strxmov(buff, thd->priv_user, "@", thd->host_or_ip, NullS) - + buff); + return new Item_string("CURRENT_USER()", thd->memdup(buff, length), length, + default_charset_info); +} + Item *create_func_quarter(Item* a) { return new Item_func_quarter(a); @@ -406,7 +418,7 @@ Item *create_func_ucase(Item* a) Item *create_func_version(void) { - return new Item_string(NullS,server_version, + return new Item_string("VERSION()",server_version, (uint) strlen(server_version), default_charset_info); } diff --git a/sql/item_create.h b/sql/item_create.h index 937ea782273..97386ca9b0b 100644 --- a/sql/item_create.h +++ b/sql/item_create.h @@ -71,6 +71,7 @@ Item *create_func_period_add(Item* a, Item *b); Item *create_func_period_diff(Item* a, Item *b); Item *create_func_pi(void); Item *create_func_pow(Item* a, Item *b); +Item *create_func_current_user(void); Item *create_func_quarter(Item* a); Item *create_func_radians(Item *a); Item *create_func_release_lock(Item* a); diff --git a/sql/item_func.cc b/sql/item_func.cc index 79bb0cbb0ae..47d26169d06 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -146,6 +146,16 @@ bool Item_func::check_loop(uint id) DBUG_RETURN(0); } +void Item_func::set_outer_resolving() +{ + if (arg_count) + { + Item **arg,**arg_end; + for (arg= args, arg_end= args+arg_count; arg != arg_end; arg++) + (*arg)->set_outer_resolving(); + } +} + void Item_func::split_sum_func(List<Item> &fields) { Item **arg,**arg_end; @@ -1885,7 +1895,7 @@ longlong Item_func_set_last_insert_id::val_int() longlong Item_func_benchmark::val_int() { char buff[MAX_FIELD_WIDTH]; - String tmp(buff,sizeof(buff), default_charset_info); + String tmp(buff,sizeof(buff), my_charset_bin); THD *thd=current_thd; for (ulong loop=0 ; loop < loop_count && !thd->killed; loop++) @@ -2031,7 +2041,7 @@ Item_func_set_user_var::update() case STRING_RESULT: { char buffer[MAX_FIELD_WIDTH]; - String tmp(buffer,sizeof(buffer),default_charset_info); + String tmp(buffer,sizeof(buffer),my_charset_bin); (void) val_str(&tmp); break; } @@ -2171,11 +2181,14 @@ void Item_func_get_user_var::fix_length_and_dec() maybe_null=1; decimals=NOT_FIXED_DEC; max_length=MAX_BLOB_WIDTH; - if ((var_entry= get_variable(&thd->user_vars, name, 0))) - const_var_flag= thd->query_id != var_entry->update_query_id; + var_entry= get_variable(&thd->user_vars, name, 0); } +bool Item_func_get_user_var::const_item() const +{ return var_entry && current_thd->query_id != var_entry->update_query_id; } + + enum Item_result Item_func_get_user_var::result_type() const { user_var_entry *entry; @@ -2223,7 +2236,7 @@ longlong Item_func_inet_aton::val_int() char c = '.'; // we mark c to indicate invalid IP in case length is 0 char buff[36]; - String *s,tmp(buff,sizeof(buff),default_charset_info); + String *s,tmp(buff,sizeof(buff),my_charset_bin); if (!(s = args[0]->val_str(&tmp))) // If null value goto err; null_value=0; @@ -2358,6 +2371,15 @@ bool Item_func_match::check_loop(uint id) DBUG_RETURN(0); } +void Item_func_match::set_outer_resolving() +{ + Item_real_func::set_outer_resolving(); + List_iterator<Item> li(fields); + Item *item; + while ((item= li++)) + item->set_outer_resolving(); +} + bool Item_func_match::fix_index() { List_iterator_fast<Item> li(fields); diff --git a/sql/item_func.h b/sql/item_func.h index 36d6dcbe002..11793b11bdb 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -133,6 +133,7 @@ public: friend class udf_handler; Field *tmp_table_field(TABLE *t_arg); bool check_loop(uint id); + void set_outer_resolving(); }; @@ -632,6 +633,11 @@ public: DBUG_RETURN(1); DBUG_RETURN(item->check_loop(id)); } + void set_outer_resolving() + { + item->set_outer_resolving(); + Item_int_func::set_outer_resolving(); + } }; @@ -807,7 +813,7 @@ public: double val() { String *res; res=val_str(&str_value); - return res ? my_strntod(res->charset(),res->ptr(),res->length(),0) : 0.0; + return res ? my_strntod(res->charset(),(char*) res->ptr(),res->length(),0) : 0.0; } longlong val_int() { @@ -928,11 +934,10 @@ class Item_func_get_user_var :public Item_func { LEX_STRING name; user_var_entry *var_entry; - bool const_var_flag; public: Item_func_get_user_var(LEX_STRING a): - Item_func(), name(a), const_var_flag(1) {} + Item_func(), name(a) {} user_var_entry *get_entry(); double val(); longlong val_int(); @@ -946,9 +951,9 @@ public: */ enum_field_types field_type() const { return MYSQL_TYPE_STRING; } const char *func_name() const { return "get_user_var"; } - bool const_item() const { return const_var_flag; } + bool const_item() const; table_map used_tables() const - { return const_var_flag ? 0 : RAND_TABLE_BIT; } + { return const_item() ? 0 : RAND_TABLE_BIT; } bool eq(const Item *item, bool binary_cmp) const; }; @@ -989,7 +994,7 @@ public: { ft_handler->please->close_search(ft_handler); ft_handler=0; - if(join_key) + if (join_key) table->file->ft_handler=0; table->fulltext_searched=0; } @@ -1006,6 +1011,7 @@ public: bool fix_index(); void init_search(bool no_order); bool check_loop(uint id); + void set_outer_resolving(); }; diff --git a/sql/item_row.cc b/sql/item_row.cc index 85a81a50256..355228e45df 100644 --- a/sql/item_row.cc +++ b/sql/item_row.cc @@ -18,7 +18,7 @@ #include "assert.h" Item_row::Item_row(List<Item> &arg): - Item(), array_holder(1), used_tables_cache(0), const_item_cache(1) + Item(), used_tables_cache(0), array_holder(1), const_item_cache(1) { //TODO: think placing 2-3 component items in item (as it done for function) @@ -41,7 +41,7 @@ void Item_row::illegal_method_call(const char *method) DBUG_ENTER("Item_row::illegal_method_call"); DBUG_PRINT("error", ("!!! %s method was called for row item", method)); DBUG_ASSERT(0); - my_error(ER_CARDINALITY_COL, MYF(0), arg_count); + my_error(ER_CARDINALITY_COL, MYF(0), 1); DBUG_VOID_RETURN; } @@ -54,7 +54,16 @@ bool Item_row::fix_fields(THD *thd, TABLE_LIST *tabl, Item **ref) if (items[i]->fix_fields(thd, tabl, items+i)) return 1; used_tables_cache |= items[i]->used_tables(); - const_item_cache&= items[i]->const_item(); + if (const_item_cache&= items[i]->const_item() && !with_null) + { + if (items[i]->cols() > 1) + with_null|= items[i]->null_inside(); + else + { + items[i]->val_int(); + with_null|= items[i]->null_value; + } + } maybe_null|= items[i]->maybe_null; } return 0; @@ -82,21 +91,24 @@ bool Item_row::check_cols(uint c) return 0; } -bool Item_row::null_inside() +void Item_row::bring_value() { for (uint i= 0; i < arg_count; i++) - { - if (items[i]->cols() > 1) - { - if (items[i]->null_inside()) - return 1; - } - else - { - items[i]->val_int(); - if (items[i]->null_value) - return 1; - } - } + items[i]->bring_value(); +} + +void Item_row::set_outer_resolving() +{ + for (uint i= 0; i < arg_count; i++) + items[i]->set_outer_resolving(); +} + +bool Item_row::check_loop(uint id) +{ + if (Item::check_loop(id)) + return 1; + for (uint i= 0; i < arg_count; i++) + if (items[i]->check_loop(id)) + return 1; return 0; } diff --git a/sql/item_row.h b/sql/item_row.h index 4767d19d08f..ccaf68bed64 100644 --- a/sql/item_row.h +++ b/sql/item_row.h @@ -16,24 +16,27 @@ class Item_row: public Item { - bool array_holder; + Item **items; table_map used_tables_cache; - bool const_item_cache; uint arg_count; - Item **items; + bool array_holder; + bool const_item_cache; + bool with_null; public: Item_row(List<Item> &); Item_row(Item_row *item): - Item(), array_holder(0), + Item(), + items(item->items), used_tables_cache(item->used_tables_cache), - const_item_cache(item->const_item_cache), arg_count(item->arg_count), - items(item->items) + array_holder(0), + const_item_cache(item->const_item_cache), + with_null(0) {} ~Item_row() { - if(array_holder && items) + if (array_holder && items) sql_element_free(items); } @@ -64,10 +67,13 @@ public: bool const_item() const { return const_item_cache; }; enum Item_result result_type() const { return ROW_RESULT; } void update_used_tables(); + bool check_loop(uint id); + void set_outer_resolving(); uint cols() { return arg_count; } Item* el(uint i) { return items[i]; } Item** addr(uint i) { return items + i; } bool check_cols(uint c); - bool null_inside(); + bool null_inside() { return with_null; }; + void bring_value(); }; diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 0b9658a5c2a..4358f14f08e 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -54,7 +54,8 @@ double Item_str_func::val() { String *res; res=val_str(&str_value); - return res ? my_strntod(res->charset(),res->ptr(),res->length(),NULL) : 0.0; + return res ? my_strntod(res->charset(), (char*) res->ptr(),res->length(), + NULL) : 0.0; } longlong Item_str_func::val_int() @@ -1271,18 +1272,60 @@ String *Item_func_trim::val_str(String *str) return &tmp_value; } +/* + Password() function can have 2 args now. Second argument can be used + to make results repeatable +*/ String *Item_func_password::val_str(String *str) { - String *res =args[0]->val_str(str); + struct rand_struct rand_st; // local structure for 2 param version + ulong seed=0; // seed to initialise random generator to + + String *res =args[0]->val_str(str); if ((null_value=args[0]->null_value)) return 0; - if (res->length() == 0) - return &empty_string; - make_scrambled_password(tmp_value,res->c_ptr(),opt_old_passwords, - ¤t_thd->rand); - str->set(tmp_value,get_password_length(opt_old_passwords),res->charset()); - return str; + + if (arg_count == 1) + { + if (res->length() == 0) + return &empty_string; + make_scrambled_password(tmp_value,res->c_ptr(),opt_old_passwords, + ¤t_thd->rand); + str->set(tmp_value,get_password_length(opt_old_passwords),res->charset()); + return str; + } + else + { + /* We'll need the buffer to get second parameter */ + char key_buff[80]; + String tmp_key_value(key_buff, sizeof(key_buff), system_charset_info); + String *key =args[1]->val_str(&tmp_key_value); + + /* Check second argument for NULL value. First one is already checked */ + if ((null_value=args[1]->null_value)) + return 0; + + /* This shall be done after checking for null for proper results */ + if (res->length() == 0) + return &empty_string; + + /* Generate the seed first this allows to avoid double allocation */ + char* seed_ptr=key->c_ptr(); + while (*seed_ptr) + { + seed=seed*211+*seed_ptr; /* Use simple hashing */ + seed_ptr++; + } + + /* Use constants which allow nice random values even with small seed */ + randominit(&rand_st,seed*111111+33333333L,seed*1111+55555555L); + + make_scrambled_password(tmp_value,res->c_ptr(),opt_old_passwords, + &rand_st); + str->set(tmp_value,get_password_length(opt_old_passwords),res->charset()); + return str; + } } String *Item_func_old_password::val_str(String *str) @@ -1438,6 +1481,8 @@ String *Item_func_soundex::val_str(String *str) { String *res =args[0]->val_str(str); char last_ch,ch; + CHARSET_INFO *cs=my_charset_latin1; + if ((null_value=args[0]->null_value)) return 0; /* purecov: inspected */ @@ -1445,22 +1490,23 @@ String *Item_func_soundex::val_str(String *str) return str; /* purecov: inspected */ char *to= (char *) tmp_value.ptr(); char *from= (char *) res->ptr(), *end=from+res->length(); - - while (from != end && my_isspace(str->charset(),*from)) // Skip pre-space + tmp_value.set_charset(cs); + + while (from != end && my_isspace(cs,*from)) // Skip pre-space from++; /* purecov: inspected */ if (from == end) return &empty_string; // No alpha characters. - *to++ = my_toupper(str->charset(),*from);// Copy first letter - last_ch = get_scode(str->charset(),from);// code of the first letter + *to++ = my_toupper(cs,*from); // Copy first letter + last_ch = get_scode(cs,from); // code of the first letter // for the first 'double-letter check. // Loop on input letters until // end of input (null) or output // letter code count = 3 for (from++ ; from < end ; from++) { - if (!my_isalpha(str->charset(),*from)) + if (!my_isalpha(cs,*from)) continue; - ch=get_scode(str->charset(),from); + ch=get_scode(cs,from); if ((ch != '0') && (ch != last_ch)) // if not skipped or double { *to++ = ch; // letter, copy to output @@ -1958,7 +2004,8 @@ String *Item_func_conv_charset::val_str(String *str) d0=d=(unsigned char*)str->ptr(); de=d+dmaxlen; - while( s < se && d < de){ + while (s < se && d < de) + { cnvres=from->mb_wc(from,&wc,s,se); if (cnvres>0) @@ -2032,7 +2079,7 @@ String *Item_func_conv_charset3::val_str(String *str) d0=d=(unsigned char*)str->ptr(); de=d+dmaxlen; - while( s < se && d < de){ + while (s < se && d < de){ cnvres=from_charset->mb_wc(from_charset,&wc,s,se); if (cnvres>0) @@ -2394,7 +2441,7 @@ String *Item_func_quote::val_str(String *str) */ to= (char*) str->ptr() + new_length - 1; *to--= '\''; - for (start= (char*) arg->ptr() ; end-- != start; to--) + for (start= (char*) arg->ptr(),end= start + arg_length; end-- != start; to--) { /* We can't use the bitmask here as we want to replace \O and ^Z with 0 @@ -2436,7 +2483,8 @@ General functions for spatial objects String *Item_func_geometry_from_text::val_str(String *str) { Geometry geom; - String *wkt = args[0]->val_str(str); + String arg_val; + String *wkt = args[0]->val_str(&arg_val); GTextReadStream trs(wkt->ptr(), wkt->length()); str->length(0); @@ -2454,7 +2502,8 @@ void Item_func_geometry_from_text::fix_length_and_dec() String *Item_func_as_text::val_str(String *str) { - String *wkt = args[0]->val_str(str); + String arg_val; + String *wkt = args[0]->val_str(&arg_val); Geometry geom; if ((null_value=(args[0]->null_value || @@ -2491,7 +2540,8 @@ String *Item_func_geometry_type::val_str(String *str) String *Item_func_envelope::val_str(String *str) { - String *wkb = args[0]->val_str(str); + String arg_val; + String *wkb = args[0]->val_str(&arg_val); Geometry geom; null_value = args[0]->null_value || @@ -2504,7 +2554,8 @@ String *Item_func_envelope::val_str(String *str) String *Item_func_centroid::val_str(String *str) { - String *wkb = args[0]->val_str(str); + String arg_val; + String *wkb = args[0]->val_str(&arg_val); Geometry geom; null_value = args[0]->null_value || @@ -2522,7 +2573,8 @@ String *Item_func_centroid::val_str(String *str) String *Item_func_spatial_decomp::val_str(String *str) { - String *wkb = args[0]->val_str(str); + String arg_val; + String *wkb = args[0]->val_str(&arg_val); Geometry geom; if ((null_value = (args[0]->null_value || @@ -2530,6 +2582,7 @@ String *Item_func_spatial_decomp::val_str(String *str) return 0; null_value=1; + str->length(0); switch(decomp_func) { case SP_STARTPOINT: @@ -2559,7 +2612,8 @@ ret: String *Item_func_spatial_decomp_n::val_str(String *str) { - String *wkb = args[0]->val_str(str); + String arg_val; + String *wkb = args[0]->val_str(&arg_val); long n = (long) args[1]->val_int(); Geometry geom; @@ -2613,6 +2667,9 @@ Functions to concatinate various spatial objects String *Item_func_point::val_str(String *str) { + double x= args[0]->val(); + double y= args[1]->val(); + if ( (null_value = (args[0]->null_value || args[1]->null_value || str->realloc(1+4+8+8)))) @@ -2621,8 +2678,8 @@ String *Item_func_point::val_str(String *str) str->length(0); str->q_append((char)Geometry::wkbNDR); str->q_append((uint32)Geometry::wkbPoint); - str->q_append((double)args[0]->val()); - str->q_append((double)args[1]->val()); + str->q_append(x); + str->q_append(y); return str; } @@ -2639,12 +2696,13 @@ String *Item_func_point::val_str(String *str) String *Item_func_spatial_collection::val_str(String *str) { + String arg_value; uint i; null_value=1; str->length(0); - if(str->reserve(9,512)) + if (str->reserve(9,512)) return 0; str->q_append((char)Geometry::wkbNDR); @@ -2653,11 +2711,10 @@ String *Item_func_spatial_collection::val_str(String *str) for (i = 0; i < arg_count; ++i) { + String *res = args[i]->val_str(&arg_value); if (args[i]->null_value) goto ret; - String *res = args[i]->val_str(str); - if ( coll_type == Geometry::wkbGeometryCollection ) { /* @@ -2715,10 +2772,8 @@ String *Item_func_spatial_collection::val_str(String *str) uint32 n_points; double x1, y1, x2, y2; - if (len < WKB_HEADER_SIZE + 4 + 8 + 8) + if (len < 4 + 2 * POINT_DATA_SIZE) goto ret; - data+=WKB_HEADER_SIZE; - len-=WKB_HEADER_SIZE; uint32 llen=len; const char *ldata=data; @@ -2730,10 +2785,6 @@ String *Item_func_spatial_collection::val_str(String *str) float8get(y1,data); data+=8; - len-= 4 + 8 + 8; - - if (len < n_points * POINT_DATA_SIZE) - goto ret; data+=(n_points-2) * POINT_DATA_SIZE; float8get(x2,data); diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index c8706c2c933..c90ff6e2295 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -108,14 +108,19 @@ public: separator->fix_fields(thd, tlist, &separator) || Item_func::fix_fields(thd, tlist, ref)); } - const char *func_name() const { return "concat_ws"; } - bool check_loop(uint id) - { - DBUG_ENTER("Item_func_concat_ws::check_loop"); - if (Item_str_func::check_loop(id)) - DBUG_RETURN(1); - DBUG_RETURN(separator->check_loop(id)); - } + const char *func_name() const { return "concat_ws"; } + bool check_loop(uint id) + { + DBUG_ENTER("Item_func_concat_ws::check_loop"); + if (Item_str_func::check_loop(id)) + DBUG_RETURN(1); + DBUG_RETURN(separator->check_loop(id)); + } + void set_outer_resolving() + { + separator->set_outer_resolving(); + Item_func::set_outer_resolving(); + } }; class Item_func_reverse :public Item_str_func @@ -257,6 +262,7 @@ class Item_func_password :public Item_str_func char tmp_value[64]; /* This should be enough for new password format */ public: Item_func_password(Item *a) :Item_str_func(a) {} + Item_func_password(Item *a, Item *b) :Item_str_func(a,b) {} String *val_str(String *); void fix_length_and_dec() { max_length = get_password_length(opt_old_passwords); } const char *func_name() const { return "password"; } @@ -393,6 +399,11 @@ public: DBUG_RETURN(1); DBUG_RETURN(item->check_loop(id)); } + void set_outer_resolving() + { + item->set_outer_resolving(); + Item_str_func::set_outer_resolving(); + } }; @@ -421,6 +432,11 @@ public: DBUG_RETURN(1); DBUG_RETURN(item->check_loop(id)); } + void set_outer_resolving() + { + item->set_outer_resolving(); + Item_str_func::set_outer_resolving(); + } }; diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index a8bbc433b7a..c5ecdc87d40 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -32,6 +32,11 @@ SUBSELECT TODO: #include "mysql_priv.h" #include "sql_select.h" +inline Item * and_items(Item* cond, Item *item) +{ + return (cond? (new Item_cond_and(cond, item)) : item); +} + Item_subselect::Item_subselect(): Item_result_field(), engine_owner(1), value_assigned(0), substitution(0), have_to_be_excluded(0) @@ -51,7 +56,7 @@ void Item_subselect::init(THD *thd, st_select_lex *select_lex, DBUG_ENTER("Item_subselect::init"); DBUG_PRINT("subs", ("select_lex 0x%xl", (ulong) select_lex)); - select_transformer(select_lex); + select_transformer(thd, select_lex->master_unit()); if (select_lex->next_select()) engine= new subselect_union_engine(thd, select_lex->master_unit(), result, this); @@ -67,7 +72,7 @@ Item_subselect::~Item_subselect() delete engine; } -void Item_subselect::select_transformer(st_select_lex *select_lex) +void Item_subselect::select_transformer(THD *thd, st_select_lex_unit *unit) { DBUG_ENTER("Item_subselect::select_transformer"); DBUG_VOID_RETURN; @@ -112,9 +117,14 @@ bool Item_subselect::check_loop(uint id) DBUG_RETURN(engine->check_loop(id)); } +Item::Type Item_subselect::type() const +{ + return SUBSELECT_ITEM; +} + void Item_subselect::fix_length_and_dec() { - engine->fix_length_and_dec(); + engine->fix_length_and_dec(0); } inline table_map Item_subselect::used_tables() const @@ -122,56 +132,165 @@ inline table_map Item_subselect::used_tables() const return (table_map) engine->depended() ? 1L : 0L; } -Item_singleval_subselect::Item_singleval_subselect(THD *thd, +Item_singlerow_subselect::Item_singlerow_subselect(THD *thd, st_select_lex *select_lex): - Item_subselect() + Item_subselect(), value(0) { - DBUG_ENTER("Item_singleval_subselect::Item_singleval_subselect"); - init(thd, select_lex, new select_singleval_subselect(this)); + DBUG_ENTER("Item_singlerow_subselect::Item_singlerow_subselect"); + init(thd, select_lex, new select_singlerow_subselect(this)); max_columns= 1; maybe_null= 1; + max_columns= UINT_MAX; DBUG_VOID_RETURN; } -void Item_singleval_subselect::fix_length_and_dec() +void Item_singlerow_subselect::reset() { - engine->fix_length_and_dec(); - res_type= engine->type(); + null_value= 1; + if (value) + value->null_value= 1; } -Item::Type Item_subselect::type() const +void Item_singlerow_subselect::select_transformer(THD *thd, + st_select_lex_unit *unit) { - return SUBSELECT_ITEM; + SELECT_LEX *select_lex= unit->first_select(); + + if (!select_lex->next_select() && !select_lex->table_list.elements && + select_lex->item_list.elements == 1 && + // TODO: mark subselect items from item list separately + !(select_lex->item_list.head()->type() == FIELD_ITEM || + select_lex->item_list.head()->type() == REF_ITEM) + ) + { + + have_to_be_excluded= 1; + if (thd->lex.describe) + { + char warn_buff[MYSQL_ERRMSG_SIZE]; + sprintf(warn_buff, ER(ER_SELECT_REDUCED), select_lex->select_number); + push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, + ER_SELECT_REDUCED, warn_buff); + } + substitution= select_lex->item_list.head(); + substitution->set_outer_resolving(); + + if (select_lex->where || select_lex->having) + { + Item *cond; + if (!select_lex->having) + cond= select_lex->where; + else if (!select_lex->where) + cond= select_lex->having; + else + if (!(cond= new Item_cond_and(select_lex->having, select_lex->where))) + return; + if (!(substitution= new Item_func_if(cond, substitution, + new Item_null()))) + return; + } + } } -double Item_singleval_subselect::val () +void Item_singlerow_subselect::store(uint i, Item *item) { - if (engine->exec()) + row[i]->store(item); +} + +enum Item_result Item_singlerow_subselect::result_type() const +{ + return engine->type(); +} + +void Item_singlerow_subselect::fix_length_and_dec() +{ + if ((max_columns= engine->cols()) == 1) + { + engine->fix_length_and_dec(row= &value); + if (!(value= Item_cache::get_cache(engine->type()))) + return; + } + else + { + THD *thd= current_thd; + if (!(row= (Item_cache**)thd->alloc(sizeof(Item_cache*)*max_columns))) + return; + engine->fix_length_and_dec(row); + value= *row; + } + maybe_null= engine->may_be_null(); +} + +uint Item_singlerow_subselect::cols() +{ + return engine->cols(); +} + +bool Item_singlerow_subselect::check_cols(uint c) +{ + if (c != engine->cols()) + { + my_error(ER_CARDINALITY_COL, MYF(0), c); + return 1; + } + return 0; +} + +bool Item_singlerow_subselect::null_inside() +{ + for (uint i= 0; i < max_columns ; i++) + { + if (row[i]->null_value) + return 1; + } + return 0; +} + +void Item_singlerow_subselect::bring_value() +{ + engine->exec(); +} + +double Item_singlerow_subselect::val () +{ + if (!engine->exec() && !value->null_value) + { + null_value= 0; + return value->val(); + } + else { reset(); return 0; } - return real_value; } -longlong Item_singleval_subselect::val_int () +longlong Item_singlerow_subselect::val_int () { - if (engine->exec()) + if (!engine->exec() && !value->null_value) + { + null_value= 0; + return value->val_int(); + } + else { reset(); return 0; } - return int_value; } -String *Item_singleval_subselect::val_str (String *str) +String *Item_singlerow_subselect::val_str (String *str) { - if (engine->exec() || null_value) + if (!engine->exec() && !value->null_value) + { + null_value= 0; + return value->val_str(str); + } + else { reset(); return 0; } - return &string_value; } Item_exists_subselect::Item_exists_subselect(THD *thd, @@ -213,7 +332,7 @@ Item_allany_subselect::Item_allany_subselect(THD *thd, Item * left_exp, left_expr= left_exp; func= f; init(thd, select_lex, new select_exists_subselect(this)); - max_columns= UINT_MAX; + max_columns= 1; reset(); // We need only 1 row to determinate existence select_lex->master_unit()->global_parameters->select_limit= 1; @@ -223,8 +342,9 @@ Item_allany_subselect::Item_allany_subselect(THD *thd, Item * left_exp, void Item_exists_subselect::fix_length_and_dec() { - decimals=0; + decimals= 0; max_length= 1; + max_columns= engine->cols(); } double Item_exists_subselect::val () @@ -313,28 +433,44 @@ Item_allany_subselect::Item_allany_subselect(Item_allany_subselect *item): func= item->func; } -void Item_in_subselect::single_value_transformer(st_select_lex *select_lex, +void Item_in_subselect::single_value_transformer(THD *thd, + st_select_lex_unit *unit, Item *left_expr, compare_func_creator func) { DBUG_ENTER("Item_in_subselect::single_value_transformer"); + if (unit->global_parameters->select_limit != HA_POS_ERROR) + { + my_error(ER_NOT_SUPPORTED_YET, MYF(0), + "LIMIT & IN/ALL/ANY/SOME subquery"); + DBUG_VOID_RETURN; + } + // no sense in ORDER BY without LIMIT + unit->global_parameters->order_list.empty(); + Item_in_optimizer *optimizer; substitution= optimizer= new Item_in_optimizer(left_expr, this); if (!optimizer) - { - current_thd->fatal_error= 1; DBUG_VOID_RETURN; - } + /* As far as Item_ref_in_optimizer do not substitude itself on fix_fields we can use same item for all selects. */ - Item *expr= new Item_ref_in_optimizer(optimizer, (char *)"<no matter>", - (char*)"<left expr>"); - select_lex->master_unit()->dependent= 1; - for (SELECT_LEX * sl= select_lex; sl; sl= sl->next_select()) + Item *expr= new Item_ref((Item**)optimizer->get_cache(), + (char *)"<no matter>", + (char*)"<left expr>"); + unit->dependent= 1; + for (SELECT_LEX * sl= unit->first_select(); sl; sl= sl->next_select()) { - select_lex->dependent= 1; + if (sl->select_limit != HA_POS_ERROR) + { + my_error(ER_NOT_SUPPORTED_YET, MYF(0), + "LIMIT & IN/ALL/ANY/SOME subquery"); + DBUG_VOID_RETURN; + } + + sl->dependent= 1; Item *item; if (sl->item_list.elements > 1) { @@ -344,24 +480,16 @@ void Item_in_subselect::single_value_transformer(st_select_lex *select_lex, else item= (Item*) sl->item_list.pop(); - if (sl->having || sl->with_sum_func || sl->group_list.first || - sl->order_list.first) + sl->order_list.empty(); // no sense in ORDER BY without LIMIT + + if (sl->having || sl->with_sum_func || sl->group_list.first) { sl->item_list.push_back(item); item= (*func)(expr, new Item_ref_null_helper(this, sl->item_list.head_ref(), (char *)"<no matter>", (char*)"<result>")); - if (sl->having || sl->with_sum_func || sl->group_list.first) - if (sl->having) - sl->having= new Item_cond_and(sl->having, item); - else - sl->having= item; - else - if (sl->where) - sl->where= new Item_cond_and(sl->having, item); - else - sl->where= item; + sl->having= and_items(sl->having, item); } else { @@ -372,10 +500,7 @@ void Item_in_subselect::single_value_transformer(st_select_lex *select_lex, item= (*func)(expr, new Item_asterisk_remover(this, item, (char *)"<no matter>", (char*)"<result>")); - if (sl->where) - sl->where= new Item_cond_and(sl->where, item); - else - sl->where= item; + sl->where= and_items(sl->where, item); } else { @@ -385,7 +510,7 @@ void Item_in_subselect::single_value_transformer(st_select_lex *select_lex, my_error(ER_NO_TABLES_USED, MYF(0)); DBUG_VOID_RETURN; } - if (select_lex->next_select()) + if (unit->first_select()->next_select()) { /* It is in union => we should perform it. @@ -402,7 +527,6 @@ void Item_in_subselect::single_value_transformer(st_select_lex *select_lex, item= (*func)(left_expr, item); substitution= item; have_to_be_excluded= 1; - THD *thd= current_thd; if (thd->lex.describe) { char warn_buff[MYSQL_ERRMSG_SIZE]; @@ -417,15 +541,91 @@ void Item_in_subselect::single_value_transformer(st_select_lex *select_lex, DBUG_VOID_RETURN; } -void Item_in_subselect::select_transformer(st_select_lex *select_lex) +void Item_in_subselect::row_value_transformer(THD *thd, + st_select_lex_unit *unit, + Item *left_expr) { - single_value_transformer(select_lex, left_expr, - &Item_bool_func2::eq_creator); + DBUG_ENTER("Item_in_subselect::row_value_transformer"); + if (unit->global_parameters->select_limit != + HA_POS_ERROR) + { + /* + Because we do the following (not exactly, following is just explenation) + transformation + SELECT * from t1 WHERE t1.a IN (SELECT t2.a FROM t2) + -> + SELECT * from t1 WHERE EXISTS(SELECT 1 FROM t2 t1.a = t2.a LIMIT 1) + + it's impossible to support limit in the sub select. + */ + my_error(ER_NOT_SUPPORTED_YET, MYF(0), + "LIMIT & IN/ALL/ANY/SOME subquery"); + DBUG_VOID_RETURN; + } + // no sense in ORDER BY without LIMIT + unit->global_parameters->order_list.empty(); + + Item_in_optimizer *optimizer; + substitution= optimizer= new Item_in_optimizer(left_expr, this); + if (!optimizer) + DBUG_VOID_RETURN; + + unit->dependent= 1; + uint n= left_expr->cols(); + if (optimizer->preallocate_row() || (*optimizer->get_cache())->allocate(n)) + DBUG_VOID_RETURN; + for (SELECT_LEX * sl= unit->first_select(); sl; sl= sl->next_select()) + { + if (sl->select_limit != HA_POS_ERROR) + { + my_error(ER_NOT_SUPPORTED_YET, MYF(0), + "LIMIT & IN/ALL/ANY/SOME subquery"); + DBUG_VOID_RETURN; + } + sl->order_list.empty(); // no sense in ORDER BY without LIMIT + + sl->dependent= 1; + + Item *item= 0; + List_iterator_fast<Item> li(sl->item_list); + for (uint i= 0; i < n; i++) + { + Item *func= + new Item_ref_on_list_position(this, sl->item_list, i, + (char *) "<no matter>", + (char *) "<list ref>"); + func= + Item_bool_func2::eq_creator(new Item_ref((*optimizer->get_cache())-> + addr(i), + (char *)"<no matter>", + (char *)"<left expr>"), + func); + item= and_items(item, func); + } + + if (sl->having || sl->with_sum_func || sl->group_list.first || + !sl->table_list.elements) + sl->having= and_items(sl->having, item); + else + sl->where= and_items(sl->where, item); + } + DBUG_VOID_RETURN; } -void Item_allany_subselect::select_transformer(st_select_lex *select_lex) + +void Item_in_subselect::select_transformer(THD *thd, st_select_lex_unit *unit) { - single_value_transformer(select_lex, left_expr, func); + if (left_expr->cols() == 1) + single_value_transformer(thd, unit, left_expr, + &Item_bool_func2::eq_creator); + else + row_value_transformer(thd, unit, left_expr); +} + +void Item_allany_subselect::select_transformer(THD *thd, + st_select_lex_unit *unit) +{ + single_value_transformer(thd, unit, left_expr, func); } subselect_single_select_engine::subselect_single_select_engine(THD *thd, @@ -462,7 +662,7 @@ subselect_union_engine::subselect_union_engine(THD *thd, subselect_engine(thd, item, result) { unit= u; - if( !result) + if (!result) { //out of memory thd->fatal_error= 1; @@ -478,13 +678,13 @@ int subselect_single_select_engine::prepare() prepared= 1; SELECT_LEX_NODE *save_select= thd->lex.current_select; thd->lex.current_select= select_lex; - if(join->prepare((TABLE_LIST*) select_lex->table_list.first, - select_lex->where, - (ORDER*) select_lex->order_list.first, - (ORDER*) select_lex->group_list.first, - select_lex->having, - (ORDER*) 0, select_lex, - select_lex->master_unit(), 0)) + if (join->prepare((TABLE_LIST*) select_lex->table_list.first, + select_lex->where, + (ORDER*) select_lex->order_list.first, + (ORDER*) select_lex->group_list.first, + select_lex->having, + (ORDER*) 0, select_lex, + select_lex->master_unit(), 0)) return 1; thd->lex.current_select= save_select; return 0; @@ -495,31 +695,82 @@ int subselect_union_engine::prepare() return unit->prepare(thd, result); } -void subselect_single_select_engine::fix_length_and_dec() +static Item_result set_row(SELECT_LEX *select_lex, Item * item, + Item_cache **row, bool *maybe_null) { + Item_result res_type= STRING_RESULT; + Item *sel_item; List_iterator_fast<Item> li(select_lex->item_list); - Item *sel_item= li++; - item->max_length= sel_item->max_length; - res_type= sel_item->result_type(); - item->decimals= sel_item->decimals; + for (uint i= 0; (sel_item= li++); i++) + { + item->max_length= sel_item->max_length; + res_type= sel_item->result_type(); + item->decimals= sel_item->decimals; + *maybe_null= sel_item->maybe_null; + if (row) + { + if (!(row[i]= Item_cache::get_cache(res_type))) + return STRING_RESULT; // we should return something + row[i]->set_len_n_dec(sel_item->max_length, sel_item->decimals); + } + } + if (select_lex->item_list.elements > 1) + res_type= ROW_RESULT; + return res_type; } -void subselect_union_engine::fix_length_and_dec() +void subselect_single_select_engine::fix_length_and_dec(Item_cache **row) { - uint32 mlen= 0, len; - Item *sel_item= 0; - for (SELECT_LEX *sl= unit->first_select(); sl; sl= sl->next_select()) + DBUG_ASSERT(row || select_lex->item_list.elements==1); + res_type= set_row(select_lex, item, row, &maybe_null); + if (cols() != 1) + maybe_null= 0; +} + +void subselect_union_engine::fix_length_and_dec(Item_cache **row) +{ + DBUG_ASSERT(row || unit->first_select()->item_list.elements==1); + + if (unit->first_select()->item_list.elements == 1) { - List_iterator_fast<Item> li(sl->item_list); - Item *s_item= li++; - if ((len= s_item->max_length)) - mlen= len; - if (!sel_item) - sel_item= s_item; + uint32 mlen= 0, len; + Item *sel_item= 0; + for (SELECT_LEX *sl= unit->first_select(); sl; sl= sl->next_select()) + { + List_iterator_fast<Item> li(sl->item_list); + Item *s_item= li++; + if ((len= s_item->max_length) > mlen) + mlen= len; + if (!sel_item) + sel_item= s_item; + maybe_null= s_item->maybe_null; + } + item->max_length= mlen; + res_type= sel_item->result_type(); + item->decimals= sel_item->decimals; + if (row) + { + if (!(row[0]= Item_cache::get_cache(res_type))) + return; + row[0]->set_len_n_dec(mlen, sel_item->decimals); + } + } + else + { + SELECT_LEX *sl= unit->first_select(); + bool fake= 0; + res_type= set_row(sl, item, row, &fake); + for (sl= sl->next_select(); sl; sl->next_select()) + { + List_iterator_fast<Item> li(sl->item_list); + Item *sel_item; + for (uint i= 0; (sel_item= li++); i++) + { + if (sel_item->max_length > row[i]->max_length) + row[i]->max_length= sel_item->max_length; + } + } } - item->max_length= mlen; - res_type= sel_item->result_type(); - item->decimals= sel_item->decimals; } int subselect_single_select_engine::exec() diff --git a/sql/item_subselect.h b/sql/item_subselect.h index 0e6f939803d..cf7f612224a 100644 --- a/sql/item_subselect.h +++ b/sql/item_subselect.h @@ -71,7 +71,7 @@ public: { null_value= 1; } - virtual void select_transformer(st_select_lex *select_lex); + virtual void select_transformer(THD *thd, st_select_lex_unit *unit); bool assigned() { return value_assigned; } void assigned(bool a) { value_assigned= a; } enum Type type() const; @@ -86,51 +86,43 @@ public: bool check_loop(uint id); friend class select_subselect; + friend class Item_in_optimizer; }; /* single value subselect */ -class Item_singleval_subselect :public Item_subselect +class Item_cache; +class Item_singlerow_subselect :public Item_subselect { protected: - longlong int_value; /* Here stored integer value of this item */ - double real_value; /* Here stored real value of this item */ - /* - Here stored string value of this item. - (str_value used only as temporary buffer, because it can be changed - by Item::save_field) - */ - String string_value; - enum Item_result res_type; /* type of results */ - + Item_cache *value, **row; public: - Item_singleval_subselect(THD *thd, st_select_lex *select_lex); - Item_singleval_subselect(Item_singleval_subselect *item): + Item_singlerow_subselect(THD *thd, st_select_lex *select_lex); + Item_singlerow_subselect(Item_singlerow_subselect *item): Item_subselect(item) { - int_value= item->int_value; - real_value= item->real_value; - string_value.set(item->string_value, 0, item->string_value.length()); + value= item->value; max_length= item->max_length; decimals= item->decimals; - res_type= item->res_type; - } - virtual void reset() - { - null_value= 1; - int_value= 0; - real_value= 0; - max_length= 4; - res_type= STRING_RESULT; } - double val (); + void reset(); + void select_transformer(THD *thd, st_select_lex_unit *unit); + void store(uint i, Item* item); + double val(); longlong val_int (); String *val_str (String *); - Item *new_item() { return new Item_singleval_subselect(this); } - enum Item_result result_type() const { return res_type; } + Item *new_item() { return new Item_singlerow_subselect(this); } + enum Item_result result_type() const; void fix_length_and_dec(); - friend class select_singleval_subselect; + uint cols(); + Item* el(uint i) { return (Item*)row[i]; } + Item** addr(uint i) { return (Item**)row + i; } + bool check_cols(uint c); + bool null_inside(); + void bring_value(); + + friend class select_singlerow_subselect; }; /* exists subselect */ @@ -149,7 +141,7 @@ public: } Item_exists_subselect(): Item_subselect() {} - virtual void reset() + void reset() { value= 0; } @@ -181,9 +173,11 @@ public: null_value= 0; was_null= 0; } - virtual void select_transformer(st_select_lex *select_lex); - void single_value_transformer(st_select_lex *select_lex, + virtual void select_transformer(THD *thd, st_select_lex_unit *unit); + void single_value_transformer(THD *thd, st_select_lex_unit *unit, Item *left_expr, compare_func_creator func); + void row_value_transformer(THD *thd, st_select_lex_unit *unit, + Item *left_expr); longlong val_int(); double val(); String *val_str(String*); @@ -202,22 +196,18 @@ public: Item_allany_subselect(THD *thd, Item * left_expr, compare_func_creator f, st_select_lex *select_lex); Item_allany_subselect(Item_allany_subselect *item); - virtual void select_transformer(st_select_lex *select_lex); + virtual void select_transformer(THD *thd, st_select_lex_unit *unit); }; -class subselect_engine +class subselect_engine: public Sql_alloc { protected: select_subselect *result; /* results storage class */ THD *thd; /* pointer to current THD */ Item_subselect *item; /* item, that use this engine */ enum Item_result res_type; /* type of results */ + bool maybe_null; /* may be null (first item in select) */ public: - static void *operator new(size_t size) - { - return (void*) sql_alloc((uint) size); - } - static void operator delete(void *ptr, size_t size) {} subselect_engine(THD *thd, Item_subselect *si, select_subselect *res) { @@ -225,16 +215,19 @@ public: item= si; this->thd= thd; res_type= STRING_RESULT; + maybe_null= 0; } + virtual ~subselect_engine() {}; // to satisfy compiler virtual int prepare()= 0; - virtual void fix_length_and_dec()= 0; + virtual void fix_length_and_dec(Item_cache** row)= 0; virtual int exec()= 0; virtual uint cols()= 0; /* return number of columnss in select */ virtual bool depended()= 0; /* depended from outer select */ enum Item_result type() { return res_type; } virtual bool check_loop(uint id)= 0; virtual void exclude()= 0; + bool may_be_null() { return maybe_null; }; }; class subselect_single_select_engine: public subselect_engine @@ -249,7 +242,7 @@ public: select_subselect *result, Item_subselect *item); int prepare(); - void fix_length_and_dec(); + void fix_length_and_dec(Item_cache** row); int exec(); uint cols(); bool depended(); @@ -266,7 +259,7 @@ public: select_subselect *result, Item_subselect *item); int prepare(); - void fix_length_and_dec(); + void fix_length_and_dec(Item_cache** row); int exec(); uint cols(); bool depended(); diff --git a/sql/item_sum.cc b/sql/item_sum.cc index f54ab87b81d..b15fceda686 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -341,7 +341,8 @@ double Item_sum_hybrid::val() switch (hybrid_type) { case STRING_RESULT: String *res; res=val_str(&str_value); - return res ? my_strntod(res->charset(),res->ptr(),res->length(),(char**)0) : 0.0; + return (res ? my_strntod(res->charset(), (char*) res->ptr(),res->length(), + (char**) 0) : 0.0); case INT_RESULT: if (unsigned_flag) return ulonglong2double(sum_int); @@ -542,7 +543,7 @@ void Item_sum_hybrid::reset_field() if (hybrid_type == STRING_RESULT) { char buff[MAX_FIELD_WIDTH]; - String tmp(buff,sizeof(buff),default_charset_info),*res; + String tmp(buff,sizeof(buff),result_field->charset()),*res; res=args[0]->val_str(&tmp); if (args[0]->null_value) @@ -897,17 +898,17 @@ String *Item_variance_field::val_str(String *str) #include "sql_select.h" -static int simple_raw_key_cmp(void* arg, byte* key1, byte* key2) +int simple_raw_key_cmp(void* arg, byte* key1, byte* key2) { return memcmp(key1, key2, *(uint*) arg); } -static int simple_str_key_cmp(void* arg, byte* key1, byte* key2) +int simple_str_key_cmp(void* arg, byte* key1, byte* key2) { - /* BAR TODO: remove default_charset_info */ - return my_strnncoll(default_charset_info, - (const uchar*) key1, *(uint*) arg, - (const uchar*) key2, *(uint*) arg); + Item_sum_count_distinct* item = (Item_sum_count_distinct*)arg; + CHARSET_INFO *cs=item->key_charset; + uint len=item->key_length; + return my_strnncoll(cs, (const uchar*) key1, len, (const uchar*) key2, len); } /* @@ -1037,14 +1038,22 @@ bool Item_sum_count_distinct::setup(THD *thd) Field* field = table->field[0]; switch(field->type()) { - /* - If we have a string, we must take care of charsets and case - sensitivity - */ case FIELD_TYPE_STRING: case FIELD_TYPE_VAR_STRING: - compare_key = (qsort_cmp2)(field->binary() ? simple_raw_key_cmp: - simple_str_key_cmp); + if (field->binary()) + { + compare_key = (qsort_cmp2)simple_raw_key_cmp; + cmp_arg = (void*) &key_length; + } + else + { + /* + If we have a string, we must take care of charsets and case + sensitivity + */ + compare_key = (qsort_cmp2)simple_str_key_cmp; + cmp_arg = (void*) this; + } break; default: /* @@ -1052,11 +1061,12 @@ bool Item_sum_count_distinct::setup(THD *thd) be compared with memcmp */ compare_key = (qsort_cmp2)simple_raw_key_cmp; + cmp_arg = (void*) &key_length; break; } - key_length = field->pack_length(); - cmp_arg = (void*) &key_length; - rec_offset = 1; + key_charset = field->charset(); + key_length = field->pack_length(); + rec_offset = 1; } else // too bad, cannot cheat - there is more than one field { diff --git a/sql/item_sum.h b/sql/item_sum.h index 50375fbf77c..ffc9558822d 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -156,7 +156,8 @@ class Item_sum_count_distinct :public Item_sum_int TMP_TABLE_PARAM *tmp_table_param; TREE tree; uint key_length; - + CHARSET_INFO *key_charset; + // calculated based on max_heap_table_size. If reached, // walk the tree and dump it into MyISAM table uint max_elements_in_tree; @@ -175,6 +176,8 @@ class Item_sum_count_distinct :public Item_sum_int int tree_to_myisam(); friend int composite_key_cmp(void* arg, byte* key1, byte* key2); + friend int simple_str_key_cmp(void* arg, byte* key1, byte* key2); + friend int simple_raw_key_cmp(void* arg, byte* key1, byte* key2); friend int dump_leaf(byte* key, uint32 count __attribute__((unused)), Item_sum_count_distinct* item); @@ -481,7 +484,8 @@ public: double val() { String *res; res=val_str(&str_value); - return res ? my_strntod(res->charset(),res->ptr(),res->length(),(char**) 0) : 0.0; + return res ? my_strntod(res->charset(),(char*) res->ptr(),res->length(), + (char**) 0) : 0.0; } longlong val_int() { diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 796070acb8a..744c0c1fa49 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -529,7 +529,7 @@ void Item_func_now::fix_length_and_dec() { struct tm tm_tmp,*start; time_t query_start=current_thd->query_start(); - CHARSET_INFO *cs=thd_charset(); + CHARSET_INFO *cs=my_charset_bin; decimals=0; max_length=19*cs->mbmaxlen; diff --git a/sql/key.cc b/sql/key.cc index 84669808b92..875a89a146f 100644 --- a/sql/key.cc +++ b/sql/key.cc @@ -192,8 +192,7 @@ int key_cmp(TABLE *table,const byte *key,uint idx,uint key_length) if (!(key_part->key_type & (FIELDFLAG_NUMBER+FIELDFLAG_BINARY+ FIELDFLAG_PACK))) { - /* BAR TODO: I'm not sure this should be system_charset_info */ - if (my_strnncoll(system_charset_info, + if (my_strnncoll(key_part->field->charset(), (const uchar*) key, length, (const uchar*) table->record[0]+key_part->offset,length)) return 1; diff --git a/sql/lex.h b/sql/lex.h index 78255d477fa..a505911ccf6 100644 --- a/sql/lex.h +++ b/sql/lex.h @@ -161,6 +161,7 @@ static SYMBOL symbols[] = { { "FLUSH", SYM(FLUSH_SYM),0,0}, { "FALSE", SYM(FALSE_SYM),0,0}, { "FOREIGN", SYM(FOREIGN),0,0}, + { "FORCE", SYM(FORCE_SYM),0,0}, { "RAID_TYPE", SYM(RAID_TYPE),0,0}, { "RAID_CHUNKS", SYM(RAID_CHUNKS),0,0}, { "RAID_CHUNKSIZE", SYM(RAID_CHUNKSIZE),0,0}, @@ -426,7 +427,7 @@ static SYMBOL sql_functions[] = { { "CAST", SYM(CAST_SYM),0,0}, { "CEIL", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_ceiling)}, { "CEILING", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_ceiling)}, - { "CURRENT_USER", SYM(USER),0,0}, + { "CURRENT_USER", SYM(FUNC_ARG0),0,CREATE_FUNC(create_func_current_user)}, { "BIT_LENGTH", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_bit_length)}, { "CENTROID", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_centroid)}, { "CHAR_LENGTH", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_char_length)}, diff --git a/sql/log.cc b/sql/log.cc index 9d56a16b0da..de64ad844f0 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -665,7 +665,12 @@ int MYSQL_LOG::purge_first_log(struct st_relay_log_info* rli) rli->linfo.log_file_name); goto err; } + /* + Reset position to current log. This involves setting both of the + position variables: + */ rli->relay_log_pos = BIN_LOG_HEADER_SIZE; + rli->pending = 0; strmake(rli->relay_log_name,rli->linfo.log_file_name, sizeof(rli->relay_log_name)-1); @@ -1128,8 +1133,20 @@ bool MYSQL_LOG::write(Log_event* event_info) if (file == &log_file) { - error = ha_report_binlog_offset_and_commit(thd, log_file_name, + /* + LOAD DATA INFILE in AUTOCOMMIT=1 mode writes to the binlog + chunks also before it is successfully completed. We only report + the binlog write and do the commit inside the transactional table + handler if the log event type is appropriate. + */ + + if (event_info->get_type_code() == QUERY_EVENT + || event_info->get_type_code() == EXEC_LOAD_EVENT) + { + error = ha_report_binlog_offset_and_commit(thd, log_file_name, file->pos_in_file); + } + should_rotate= (my_b_tell(file) >= (my_off_t) max_binlog_size); } @@ -1172,7 +1189,7 @@ uint MYSQL_LOG::next_file_id() NOTE - We only come here if there is something in the cache. - - The thing in the cache is always a complete transcation + - The thing in the cache is always a complete transaction - 'cache' needs to be reinitialized after this functions returns. IMPLEMENTATION @@ -1240,6 +1257,13 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache) log_file.pos_in_file))) goto err; signal_update(); + if (my_b_tell(&log_file) >= (my_off_t) max_binlog_size) + { + pthread_mutex_lock(&LOCK_index); + new_file(0); // inside mutex + pthread_mutex_unlock(&LOCK_index); + } + } VOID(pthread_mutex_unlock(&LOCK_log)); DBUG_RETURN(0); diff --git a/sql/log_event.cc b/sql/log_event.cc index 22416fa77a7..36fca5250ac 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -295,11 +295,27 @@ Log_event::Log_event(const char* buf, bool old_format) ****************************************************************************/ int Log_event::exec_event(struct st_relay_log_info* rli) { - if (rli) // QQ When is this not true ? + /* + rli is null when (as far as I (Guilhem) know) + the caller is + Load_log_event::exec_event *and* that one is called from + Execute_load_log_event::exec_event. + In this case, we don't do anything here ; + Execute_load_log_event::exec_event will call Log_event::exec_event + again later with the proper rli. + Strictly speaking, if we were sure that rli is null + only in the case discussed above, 'if (rli)' is useless here. + But as we are not 100% sure, keep it for now. + */ + if (rli) { - rli->inc_pos(get_event_len(),log_pos); - DBUG_ASSERT(rli->sql_thd != 0); - flush_relay_log_info(rli); + if (rli->inside_transaction) + rli->inc_pending(get_event_len()); + else + { + rli->inc_pos(get_event_len(),log_pos); + flush_relay_log_info(rli); + } } return 0; } @@ -741,7 +757,9 @@ int Query_log_event::write_data(IO_CACHE* file) #ifndef MYSQL_CLIENT Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg, ulong query_length, bool using_trans) - :Log_event(thd_arg, 0, using_trans), data_buf(0), query(query_arg), + :Log_event(thd_arg, !thd_arg->lex.tmp_table_used ? + 0 : LOG_EVENT_THREAD_SPECIFIC_F, using_trans), + data_buf(0), query(query_arg), db(thd_arg->db), q_len((uint32) query_length), error_code(thd_arg->killed ? ER_SERVER_SHUTDOWN: thd_arg->net.last_errno), thread_id(thd_arg->thread_id) @@ -823,6 +841,8 @@ void Query_log_event::print(FILE* file, bool short_form, char* last_db) *end++=';'; *end++='\n'; my_fwrite(file, (byte*) buff, (uint) (end-buff),MYF(MY_NABP | MY_WME)); + if (flags & LOG_EVENT_THREAD_SPECIFIC_F) + fprintf(file,"SET @@session.pseudo_thread_id=%lu;\n",(ulong)thread_id); my_fwrite(file, (byte*) query, q_len, MYF(MY_NABP | MY_WME)); fprintf(file, ";\n"); } @@ -858,7 +878,7 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli) thd->query_error= 0; // clear error thd->clear_error(); - thd->slave_proxy_id = thread_id; // for temp tables + thd->variables.pseudo_thread_id= thread_id; // for temp tables /* Sanity check to make sure the master did not get a really bad @@ -870,6 +890,19 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli) mysql_log.write(thd,COM_QUERY,"%s",thd->query); DBUG_PRINT("query",("%s",thd->query)); mysql_parse(thd, thd->query, q_len); + + /* + Set a flag if we are inside an transaction so that we can restart + the transaction from the start if we are killed + + This will only be done if we are supporting transactional tables + in the slave. + */ + if (!strcmp(thd->query,"BEGIN")) + rli->inside_transaction= opt_using_transactions; + else if (!strcmp(thd->query,"COMMIT")) + rli->inside_transaction=0; + DBUG_PRINT("info",("expected_error: %d last_errno: %d", expected_error, thd->net.last_errno)); if ((expected_error != (actual_error= thd->net.last_errno)) && @@ -1423,13 +1456,35 @@ void Load_log_event::set_fields(List<Item> &field_list) } #endif // !MYSQL_CLIENT -/***************************************************************************** - - Load_log_event::exec_event() - - ****************************************************************************/ #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) -int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli) +/* + Does the data loading job when executing a LOAD DATA on the slave + + SYNOPSIS + Load_log_event::exec_event + net + rli + use_rli_only_for_errors - if set to 1, rli is provided to + Load_log_event::exec_event only for this + function to have RPL_LOG_NAME and + rli->last_slave_error, both being used by + error reports. rli's position advancing + is skipped (done by the caller which is + Execute_load_log_event::exec_event). + - if set to 0, rli is provided for full use, + i.e. for error reports and position + advancing. + + DESCRIPTION + Does the data loading job when executing a LOAD DATA on the slave + + RETURN VALUE + 0 Success + 1 Failure +*/ + +int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli, + bool use_rli_only_for_errors) { init_sql_alloc(&thd->mem_root, 8192,0); thd->db = rewrite_db((char*)db); @@ -1477,7 +1532,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli) ex.skip_lines = skip_lines; List<Item> field_list; set_fields(field_list); - thd->slave_proxy_id = thd->thread_id; + thd->variables.pseudo_thread_id= thd->thread_id; if (net) { // mysql_load will use thd->net to read the file @@ -1491,9 +1546,15 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli) TL_WRITE)) thd->query_error = 1; if (thd->cuted_fields) + { + /* + log_pos is the position of the LOAD + event in the master log + */ sql_print_error("Slave: load data infile at position %s in log \ -'%s' produced %d warning(s)", llstr(rli->master_log_pos,llbuff), RPL_LOG_NAME, +'%s' produced %d warning(s)", llstr(log_pos,llbuff), RPL_LOG_NAME, thd->cuted_fields ); + } if (net) net->pkt_nr= thd->net.pkt_nr; } @@ -1532,7 +1593,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli) return 1; } - return Log_event::exec_event(rli); + return ( use_rli_only_for_errors ? 0 : Log_event::exec_event(rli) ); } #endif @@ -2670,7 +2731,11 @@ int Execute_load_log_event::exec_event(struct st_relay_log_info* rli) save_options = thd->options; thd->options &= ~ (ulong) (OPTION_BIN_LOG); lev->thd = thd; - if (lev->exec_event(0,0)) + /* + lev->exec_event should use rli only for errors + i.e. should not advance rli's position + */ + if (lev->exec_event(0,rli,1)) { slave_print_error(rli,my_errno, "Failed executing load from '%s'", fname); thd->options = save_options; diff --git a/sql/log_event.h b/sql/log_event.h index 7ba203e7f30..c5ff3ffd4da 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -212,8 +212,10 @@ struct sql_ex_info #define BINLOG_MAGIC "\xfe\x62\x69\x6e" -#define LOG_EVENT_TIME_F 0x1 -#define LOG_EVENT_FORCED_ROTATE_F 0x2 +#define LOG_EVENT_TIME_F 0x1 +#define LOG_EVENT_FORCED_ROTATE_F 0x2 +#define LOG_EVENT_THREAD_SPECIFIC_F 0x4 /* query depends on thread + (for example: TEMPORARY TABLE) */ enum Log_event_type { @@ -466,9 +468,10 @@ public: void pack_info(Protocol* protocol); int exec_event(struct st_relay_log_info* rli) { - return exec_event(thd->slave_net,rli); + return exec_event(thd->slave_net,rli,0); } - int exec_event(NET* net, struct st_relay_log_info* rli); + int exec_event(NET* net, struct st_relay_log_info* rli, + bool use_rli_only_for_errors); #endif /* HAVE_REPLICATION */ #else void print(FILE* file, bool short_form = 0, char* last_db = 0); diff --git a/sql/mini_client.cc b/sql/mini_client.cc index d32154685f0..2ee4b551d71 100644 --- a/sql/mini_client.cc +++ b/sql/mini_client.cc @@ -547,10 +547,13 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user, bzero((char*) &UNIXaddr,sizeof(UNIXaddr)); UNIXaddr.sun_family = AF_UNIX; strmov(UNIXaddr.sun_path, unix_socket); - if (mc_sock_connect(sock,(struct sockaddr *) &UNIXaddr, sizeof(UNIXaddr), + if (mc_sock_connect(sock, + my_reinterpret_cast(struct sockaddr *) (&UNIXaddr), + sizeof(UNIXaddr), mysql->options.connect_timeout) <0) { - DBUG_PRINT("error",("Got error %d on connect to local server",socket_errno)); + DBUG_PRINT("error",("Got error %d on connect to local server", + socket_errno)); net->last_errno=CR_CONNECTION_ERROR; sprintf(net->last_error,ER(net->last_errno),unix_socket,socket_errno); goto error; @@ -637,7 +640,9 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user, my_gethostbyname_r_free(); } sock_addr.sin_port = (ushort) htons((ushort) port); - if (mc_sock_connect(sock,(struct sockaddr *) &sock_addr, sizeof(sock_addr), + if (mc_sock_connect(sock, + my_reinterpret_cast(struct sockaddr *) (&sock_addr), + sizeof(sock_addr), mysql->options.connect_timeout) <0) { DBUG_PRINT("error",("Got error %d on connect to '%s'", diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index cf0cefd76da..cdc668d9b28 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -235,6 +235,10 @@ void debug_sync_point(const char* lock_name, uint lock_timeout); #define SHOW_LOG_STATUS_FREE "FREE" #define SHOW_LOG_STATUS_INUSE "IN USE" +/* Options to add_table_to_list() */ +#define TL_OPTION_UPDATING 1 +#define TL_OPTION_FORCE_INDEX 2 + /* Some portable defines */ #define portable_sizeof_char_ptr 8 @@ -323,11 +327,12 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create, bool silent); int mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create); int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent); void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, ushort flags); -int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists); +int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists, + my_bool drop_temporary); int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, - bool log_query); + bool drop_temporary, bool log_query); int mysql_rm_table_part2_with_lock(THD *thd, TABLE_LIST *tables, - bool if_exists, + bool if_exists, bool drop_temporary, bool log_query); int quick_rm_table(enum db_type base,const char *db, const char *table_name); @@ -422,6 +427,9 @@ int mysql_alter_table(THD *thd, char *new_db, char *new_name, enum enum_duplicates handle_duplicates, enum enum_enable_or_disable keys_onoff=LEAVE_AS_IS, bool simple_alter=0); +int mysql_create_like_table(THD *thd, TABLE_LIST *table, + HA_CREATE_INFO *create_info, + Table_ident *src_table); bool mysql_rename_table(enum db_type base, const char *old_db, const char * old_name, @@ -463,7 +471,7 @@ bool drop_locked_tables(THD *thd,const char *db, const char *table_name); void abort_locked_tables(THD *thd,const char *db, const char *table_name); extern const Field *not_found_field; Field *find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables, - bool report_error); + TABLE_LIST **where, bool report_error); Field *find_field_in_table(THD *thd,TABLE *table,const char *name,uint length, bool check_grant,bool allow_rowid); #ifdef HAVE_OPENSSL @@ -523,7 +531,8 @@ int check_insert_fields(THD *thd,TABLE *table,List<Item> &fields, /* sql_error.cc */ void push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level, uint code, const char *msg); -void store_warning(THD *thd, uint errcode, ...); +void push_warning_printf(THD *thd, MYSQL_ERROR::enum_warning_level level, + uint code, const char *format, ...); void mysql_reset_errors(THD *thd); my_bool mysqld_show_warnings(THD *thd, ulong levels_to_show); @@ -574,8 +583,7 @@ bool rm_temporary_table(enum db_type base, char *path); void free_io_cache(TABLE *entry); void intern_close_table(TABLE *entry); bool close_thread_table(THD *thd, TABLE **table_ptr); -void close_thread_tables(THD *thd,bool locked=0); -bool close_thread_table(THD *thd, TABLE **table_ptr); +void close_thread_tables(THD *thd, bool locked=0, bool skip_derived=0); void close_temporary_tables(THD *thd); TABLE_LIST * find_table_in_list(TABLE_LIST *table, const char *db_name, const char *table_name); @@ -705,6 +713,8 @@ extern my_bool opt_sql_bin_update, opt_safe_user_create, opt_no_mix_types; extern my_bool opt_safe_show_db, opt_local_infile, lower_case_table_names; extern my_bool opt_slave_compressed_protocol, use_temp_pool; extern my_bool opt_enable_named_pipe; +extern char *shared_memory_base_name; +extern bool opt_enable_shared_memory; extern char f_fyllchar; extern MYSQL_LOG mysql_log,mysql_update_log,mysql_slow_log,mysql_bin_log; @@ -814,7 +824,6 @@ uint calc_week(TIME *ltime, bool with_year, bool sunday_first_day_of_week, void find_date(char *pos,uint *vek,uint flag); TYPELIB *convert_strings_to_array_type(my_string *typelibs, my_string *end); TYPELIB *typelib(List<String> &strings); -void clean_up(bool print_message=1); ulong get_form_pos(File file, uchar *head, TYPELIB *save_names); ulong make_new_entry(File file,uchar *fileinfo,TYPELIB *formnames, const char *newname); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 2bacdfc14bf..e63ee43e3e3 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -34,6 +34,8 @@ #include <ft_global.h> #include <assert.h> +#define mysqld_charset my_charset_latin1 + #ifndef DBUG_OFF #define ONE_THREAD #endif @@ -180,7 +182,6 @@ static char szPipeName [ 257 ]; static SECURITY_ATTRIBUTES saPipeSecurity; static SECURITY_DESCRIPTOR sdPipeDescriptor; static HANDLE hPipe = INVALID_HANDLE_VALUE; -static uint handler_count; static bool opt_enable_named_pipe = 0; #endif #ifdef __WIN__ @@ -205,7 +206,7 @@ static char **opt_argv; #else #define MYSQL_SERVER_SUFFIX "" #endif /* __NT__ */ -#endif +#endif /* __WIN__ */ #ifdef HAVE_BERKELEY_DB SHOW_COMP_OPTION have_berkeley_db=SHOW_OPTION_YES; @@ -246,6 +247,12 @@ SHOW_COMP_OPTION have_query_cache=SHOW_OPTION_NO; const char *show_comp_option_name[]= {"YES", "NO", "DISABLED"}; bool opt_large_files= sizeof(my_off_t) > 4; +#if SIZEOF_OFF_T > 4 && defined(BIG_TABLES) +#define GET_HA_ROWS GET_ULL +#else +#define GET_HA_ROWS GET_ULONG +#endif + /* Variables to store startup options @@ -344,8 +351,8 @@ arg_cmp_func Arg_comparator::comparator_matrix[4][2] = {&Arg_comparator::compare_int, &Arg_comparator::compare_e_int}, {&Arg_comparator::compare_row, &Arg_comparator::compare_e_row}}; #ifdef HAVE_SMEM -static char *shared_memory_base_name=default_shared_memory_base_name; -static bool opt_enable_shared_memory = 0; +char *shared_memory_base_name=default_shared_memory_base_name; +bool opt_enable_shared_memory = 0; #endif volatile ulong cached_thread_count=0; @@ -484,7 +491,7 @@ extern "C" pthread_handler_decl(handle_slave,arg); static uint set_maximum_open_files(uint max_file_limit); #endif static ulong find_bit_type(const char *x, TYPELIB *bit_lib); - +static void clean_up(bool print_message); #ifndef EMBEDDED_LIBRARY /**************************************************************************** @@ -760,13 +767,13 @@ void kill_mysql(void) #if defined(OS2) extern "C" void kill_server(int sig_ptr) -#define RETURN_FROM_KILL_SERVER return +#define RETURN_FROM_KILL_SERVER DBUG_RETURN #elif !defined(__WIN__) static void *kill_server(void *sig_ptr) -#define RETURN_FROM_KILL_SERVER return 0 +#define RETURN_FROM_KILL_SERVER DBUG_RETURN(0) #else static void __cdecl kill_server(int sig_ptr) -#define RETURN_FROM_KILL_SERVER return +#define RETURN_FROM_KILL_SERVER DBUG_RETURN #endif { int sig=(int) (long) sig_ptr; // This is passed a int @@ -848,7 +855,7 @@ extern "C" sig_handler print_signal_warning(int sig) void unireg_end(void) { - clean_up(); + clean_up(1); my_thread_end(); #ifdef SIGNALS_DONT_BREAK_READ exit(0); @@ -863,7 +870,7 @@ extern "C" void unireg_abort(int exit_code) DBUG_ENTER("unireg_abort"); if (exit_code) sql_print_error("Aborting\n"); - clean_up(); /* purecov: inspected */ + clean_up(1); /* purecov: inspected */ DBUG_PRINT("quit",("done with cleanup in unireg_abort")); my_thread_end(); exit(exit_code); /* purecov: inspected */ @@ -914,12 +921,12 @@ void clean_up(bool print_message) regex_end(); #endif + if (print_message && errmesg) + sql_print_error(ER(ER_SHUTDOWN_COMPLETE),my_progname); #if !defined(__WIN__) && !defined(EMBEDDED_LIBRARY) if (!opt_bootstrap) (void) my_delete(pidfile_name,MYF(0)); // This may not always exist #endif - if (print_message && errmesg) - sql_print_error(ER(ER_SHUTDOWN_COMPLETE),my_progname); x_free((gptr) my_errmsg[ERRMAPP]); /* Free messages */ DBUG_PRINT("quit", ("Error messages freed")); /* Tell main we are ready */ @@ -929,6 +936,10 @@ void clean_up(bool print_message) /* do the broadcast inside the lock to ensure that my_end() is not called */ (void) pthread_cond_broadcast(&COND_thread_count); (void) pthread_mutex_unlock(&LOCK_thread_count); + /* + The following lines may never be executed as the main thread may have + killed us + */ DBUG_PRINT("quit", ("done with cleanup")); } /* clean_up */ @@ -994,7 +1005,7 @@ static void set_user(const char *user) { // allow a numeric uid to be used const char *pos; - for (pos=user; my_isdigit(system_charset_info,*pos); pos++) ; + for (pos=user; my_isdigit(mysqld_charset,*pos); pos++) ; if (*pos) // Not numeric id { fprintf(stderr,"Fatal error: Can't change to run as user '%s' ; Please check that the user exists!\n",user); @@ -1509,7 +1520,7 @@ static void init_signals(void) /* Change limits so that we will get a core file */ struct rlimit rl; rl.rlim_cur = rl.rlim_max = RLIM_INFINITY; - if (setrlimit(RLIMIT_CORE, &rl)) + if (setrlimit(RLIMIT_CORE, &rl) && global_system_variables.log_warnings) sql_print_error("Warning: setrlimit could not change the size of core files to 'infinity'; We may not be able to generate a core file on signals"); } #endif @@ -1578,8 +1589,11 @@ extern "C" void *signal_hand(void *arg __attribute__((unused))) my_thread_init(); // Init new thread DBUG_ENTER("signal_hand"); SIGNAL_THD; - /* Setup alarm handler */ - init_thr_alarm(max_connections+max_insert_delayed_threads); + /* + Setup alarm handler + The two extra handlers are for slave threads + */ + init_thr_alarm(max_connections+max_insert_delayed_threads+2); #if SIGINT != THR_KILL_SIGNAL (void) sigemptyset(&set); // Setup up SIGINT for debug (void) sigaddset(&set,SIGINT); // For debugging @@ -1667,12 +1681,15 @@ extern "C" void *signal_hand(void *arg __attribute__((unused))) } break; case SIGHUP: - reload_acl_and_cache((THD*) 0, - (REFRESH_LOG | REFRESH_TABLES | REFRESH_FAST | - REFRESH_STATUS | REFRESH_GRANT | REFRESH_THREADS | - REFRESH_HOSTS), - (TABLE_LIST*) 0); // Flush logs - mysql_print_status((THD*) 0); // Send debug some info + if (!abort_loop) + { + reload_acl_and_cache((THD*) 0, + (REFRESH_LOG | REFRESH_TABLES | REFRESH_FAST | + REFRESH_STATUS | REFRESH_GRANT | + REFRESH_THREADS | REFRESH_HOSTS), + (TABLE_LIST*) 0); // Flush logs + mysql_print_status((THD*) 0); // Send debug some info + } break; #ifdef USE_ONE_SIGNAL_HAND case THR_SERVER_ALARM: @@ -1839,6 +1856,7 @@ bool open_log(MYSQL_LOG *log, const char *hostname, no_auto_events); } + static int init_common_variables(const char *conf_file_name, int argc, char **argv, const char **groups) { @@ -2340,6 +2358,478 @@ The server will not act as a slave."); #endif /* EMBEDDED_LIBRARY */ +#ifdef REMOTE + +#ifdef __WIN__ +int win_main(int argc, char **argv) +#else +int main(int argc, char **argv) +#endif +{ + DEBUGGER_OFF; + + my_umask=0660; // Default umask for new files + my_umask_dir=0700; // Default umask for new directories + MAIN_THD; + /* + Initialize signal_th and shutdown_th to main_th for default value + as we need to initialize them to something safe. They are used + when compiled with safemalloc. + */ + SIGNAL_THD; + SHUTDOWN_THD; + MY_INIT(argv[0]); // init my_sys library & pthreads + tzset(); // Set tzname + + start_time=time((time_t*) 0); +#ifdef OS2 + { + // fix timezone for daylight saving + struct tm *ts = localtime(&start_time); + if (ts->tm_isdst > 0) + _timezone -= 3600; + } +#endif +#ifdef HAVE_TZNAME +#if defined(HAVE_LOCALTIME_R) && defined(_REENTRANT) + { + struct tm tm_tmp; + localtime_r(&start_time,&tm_tmp); + strmov(time_zone,tzname[tm_tmp.tm_isdst != 0 ? 1 : 0]); + } +#else + { + struct tm *start_tm; + start_tm=localtime(&start_time); + strmov(time_zone,tzname[start_tm->tm_isdst != 0 ? 1 : 0]); + } +#endif +#endif + + if (gethostname(glob_hostname,sizeof(glob_hostname)-4) < 0) + strmov(glob_hostname,"mysql"); + strmake(pidfile_name, glob_hostname, sizeof(pidfile_name)-5); + strmov(fn_ext(pidfile_name),".pid"); // Add proper extension +#ifndef DBUG_OFF + strxmov(strend(server_version),MYSQL_SERVER_SUFFIX,"-debug",NullS); +#else + strmov(strend(server_version),MYSQL_SERVER_SUFFIX); +#endif +#ifdef _CUSTOMSTARTUPCONFIG_ + if (_cust_check_startup()) + { + /* _cust_check_startup will report startup failure error */ + exit( 1 ); + } +#endif + load_defaults(MYSQL_CONFIG_NAME,load_default_groups,&argc,&argv); + defaults_argv=argv; + + set_options(); + get_options(argc,argv); + max_system_variables.pseudo_thread_id= (ulong)~0; + if (opt_log || opt_update_log || opt_slow_log || opt_bin_log) + strcat(server_version,"-log"); + DBUG_PRINT("info",("%s Ver %s for %s on %s\n",my_progname, + server_version, SYSTEM_TYPE,MACHINE_TYPE)); + + /* These must be set early */ + + (void) pthread_mutex_init(&LOCK_mysql_create_db,MY_MUTEX_INIT_SLOW); + (void) pthread_mutex_init(&LOCK_Acl,MY_MUTEX_INIT_SLOW); + (void) pthread_mutex_init(&LOCK_open,MY_MUTEX_INIT_FAST); + (void) pthread_mutex_init(&LOCK_thread_count,MY_MUTEX_INIT_FAST); + (void) pthread_mutex_init(&LOCK_mapped_file,MY_MUTEX_INIT_SLOW); + (void) pthread_mutex_init(&LOCK_status,MY_MUTEX_INIT_FAST); + (void) pthread_mutex_init(&LOCK_error_log,MY_MUTEX_INIT_FAST); + (void) pthread_mutex_init(&LOCK_delayed_insert,MY_MUTEX_INIT_FAST); + (void) pthread_mutex_init(&LOCK_delayed_status,MY_MUTEX_INIT_FAST); + (void) pthread_mutex_init(&LOCK_delayed_create,MY_MUTEX_INIT_SLOW); + (void) pthread_mutex_init(&LOCK_manager,MY_MUTEX_INIT_FAST); + (void) pthread_mutex_init(&LOCK_crypt,MY_MUTEX_INIT_FAST); + (void) pthread_mutex_init(&LOCK_bytes_sent,MY_MUTEX_INIT_FAST); + (void) pthread_mutex_init(&LOCK_bytes_received,MY_MUTEX_INIT_FAST); + (void) pthread_mutex_init(&LOCK_timezone,MY_MUTEX_INIT_FAST); + (void) pthread_mutex_init(&LOCK_user_conn, MY_MUTEX_INIT_FAST); + (void) pthread_mutex_init(&LOCK_rpl_status, MY_MUTEX_INIT_FAST); + (void) pthread_mutex_init(&LOCK_active_mi, MY_MUTEX_INIT_FAST); + (void) pthread_mutex_init(&LOCK_global_system_variables, MY_MUTEX_INIT_FAST); + (void) my_rwlock_init(&LOCK_grant, NULL); + (void) pthread_cond_init(&COND_thread_count,NULL); + (void) pthread_cond_init(&COND_refresh,NULL); + (void) pthread_cond_init(&COND_thread_cache,NULL); + (void) pthread_cond_init(&COND_flush_thread_cache,NULL); + (void) pthread_cond_init(&COND_manager,NULL); + (void) pthread_cond_init(&COND_rpl_status, NULL); + init_signals(); + + if (set_default_charset_by_name(sys_charset.value, MYF(MY_WME))) + exit(1); + charsets_list= list_charsets(MYF(MY_CS_COMPILED | MY_CS_CONFIG)); + +#ifdef HAVE_OPENSSL + if (opt_use_ssl) + { + /* having ssl_acceptor_fd != 0 signals the use of SSL */ + ssl_acceptor_fd= new_VioSSLAcceptorFd(opt_ssl_key, opt_ssl_cert, + opt_ssl_ca, opt_ssl_capath, + opt_ssl_cipher); + DBUG_PRINT("info",("ssl_acceptor_fd: %lx", (long) ssl_acceptor_fd)); + if (!ssl_acceptor_fd) + opt_use_ssl = 0; + } +#endif /* HAVE_OPENSSL */ + +#ifdef HAVE_LIBWRAP + libwrapName= my_progname+dirname_length(my_progname); + openlog(libwrapName, LOG_PID, LOG_AUTH); +#endif + + if (!(opt_specialflag & SPECIAL_NO_PRIOR)) + my_pthread_setprio(pthread_self(),CONNECT_PRIOR); + /* Parameter for threads created for connections */ + (void) pthread_attr_init(&connection_attrib); + (void) pthread_attr_setdetachstate(&connection_attrib, + PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&connection_attrib,thread_stack); + + if (!(opt_specialflag & SPECIAL_NO_PRIOR)) + my_pthread_attr_setprio(&connection_attrib,WAIT_PRIOR); + pthread_attr_setscope(&connection_attrib, PTHREAD_SCOPE_SYSTEM); + +#if defined( SET_RLIMIT_NOFILE) || defined( OS2) + /* connections and databases needs lots of files */ + { + uint wanted_files=10+(uint) max(max_connections*5, + max_connections+table_cache_size*2); + set_if_bigger(wanted_files, open_files_limit); + // Note that some system returns 0 if we succeed here: + uint files=set_maximum_open_files(wanted_files); + if (files && files < wanted_files && ! open_files_limit) + { + max_connections= (ulong) min((files-10),max_connections); + table_cache_size= (ulong) max((files-10-max_connections)/2,64); + DBUG_PRINT("warning", + ("Changed limits: max_connections: %ld table_cache: %ld", + max_connections,table_cache_size)); + sql_print_error("Warning: Changed limits: max_connections: %ld table_cache: %ld",max_connections,table_cache_size); + } + } +#endif + unireg_init(opt_specialflag); /* Set up extern variabels */ + init_errmessage(); /* Read error messages from file */ + lex_init(); + item_init(); + set_var_init(); + mysys_uses_curses=0; +#ifdef USE_REGEX + regex_init(); +#endif + select_thread=pthread_self(); + select_thread_in_use=1; + if (use_temp_pool && bitmap_init(&temp_pool,1024,1)) + unireg_abort(1); + + /* + We have enough space for fiddling with the argv, continue + */ + umask(((~my_umask) & 0666)); + if (my_setwd(mysql_real_data_home,MYF(MY_WME))) + { + unireg_abort(1); /* purecov: inspected */ + } + mysql_data_home= mysql_data_home_buff; + mysql_data_home[0]=FN_CURLIB; // all paths are relative from here + mysql_data_home[1]=0; + server_init(); + table_cache_init(); + hostname_cache_init(); + query_cache_result_size_limit(query_cache_limit); + query_cache_resize(query_cache_size); + randominit(&sql_rand,(ulong) start_time,(ulong) start_time/2); + reset_floating_point_exceptions(); + init_thr_lock(); + init_slave_list(); +#ifdef HAVE_OPENSSL + if (des_key_file) + load_des_key_file(des_key_file); +#endif /* HAVE_OPENSSL */ + + /* Setup log files */ + if (opt_log) + open_log(&mysql_log, glob_hostname, opt_logname, ".log", NullS, + LOG_NORMAL); + if (opt_update_log) + { + open_log(&mysql_update_log, glob_hostname, opt_update_logname, "", + NullS, LOG_NEW); + using_update_log=1; + } + + if (opt_slow_log) + open_log(&mysql_slow_log, glob_hostname, opt_slow_logname, "-slow.log", + NullS, LOG_NORMAL); +#ifdef __WIN__ +#define MYSQL_ERR_FILE "mysql.err" + if (!opt_console) + { + freopen(MYSQL_ERR_FILE,"a+",stdout); + freopen(MYSQL_ERR_FILE,"a+",stderr); + } +#endif + if (ha_init()) + { + sql_print_error("Can't init databases"); + if (unix_sock != INVALID_SOCKET) + unlink(mysql_unix_port); + exit(1); + } + ha_key_cache(); +#if defined(HAVE_MLOCKALL) && defined(MCL_CURRENT) + if (locked_in_memory && !geteuid()) + { + if (mlockall(MCL_CURRENT)) + { + sql_print_error("Warning: Failed to lock memory. Errno: %d\n",errno); + } + else + locked_in_memory=1; + } +#else + locked_in_memory=0; +#endif + + if (opt_myisam_log) + (void) mi_log( 1 ); + ft_init_stopwords(ft_precompiled_stopwords); + +#ifdef __WIN__ + if (!opt_console) + FreeConsole(); // Remove window +#endif + + /* + init signals & alarm + After this we can't quit by a simple unireg_abort + */ + error_handler_hook = my_message_sql; + if (pthread_key_create(&THR_THD,NULL) || + pthread_key_create(&THR_MALLOC,NULL)) + { + sql_print_error("Can't create thread-keys"); + if (unix_sock != INVALID_SOCKET) + unlink(mysql_unix_port); + exit(1); + } + start_signal_handler(); // Creates pidfile + if (acl_init((THD*) 0, opt_noacl)) + { + abort_loop=1; + select_thread_in_use=0; + (void) pthread_kill(signal_thread,MYSQL_KILL_SIGNAL); +#ifndef __WIN__ + if (!opt_bootstrap) + (void) my_delete(pidfile_name,MYF(MY_WME)); // Not needed anymore +#endif + if (unix_sock != INVALID_SOCKET) + unlink(mysql_unix_port); + exit(1); + } + if (!opt_noacl) + (void) grant_init((THD*) 0); + init_max_user_conn(); + init_update_queries(); + DBUG_ASSERT(current_thd == 0); + +#ifdef HAVE_DLOPEN + if (!opt_noacl) + udf_init(); +#endif + /* init_slave() must be called after the thread keys are created */ + init_slave(); + + DBUG_ASSERT(current_thd == 0); + if (opt_bin_log && !server_id) + { + server_id= !master_host ? 1 : 2; + switch (server_id) { +#ifdef EXTRA_DEBUG + case 1: + sql_print_error("\ +Warning: You have enabled the binary log, but you haven't set server-id:\n\ +Updates will be logged to the binary log, but connections to slaves will\n\ +not be accepted."); + break; +#endif + case 2: + sql_print_error("\ +Warning: You should set server-id to a non-0 value if master_host is set.\n\ +The server will not act as a slave."); + break; + } + } + if (opt_bin_log) + { + open_log(&mysql_bin_log, glob_hostname, opt_bin_logname, "-bin", + opt_binlog_index_name,LOG_BIN); + using_update_log=1; + } + + + if (opt_bootstrap) + { + int error=bootstrap(stdin); + end_thr_alarm(); // Don't allow alarms + unireg_abort(error ? 1 : 0); + } + if (opt_init_file) + { + if (read_init_file(opt_init_file)) + { + end_thr_alarm(); // Don't allow alarms + unireg_abort(1); + } + } + (void) thr_setconcurrency(concurrency); // 10 by default +#if defined(__WIN__) && !defined(EMBEDDED_LIBRARY) //IRENA + { + hEventShutdown=CreateEvent(0, FALSE, FALSE, shutdown_event_name); + pthread_t hThread; + if (pthread_create(&hThread,&connection_attrib,handle_shutdown,0)) + sql_print_error("Warning: Can't create thread to handle shutdown requests"); + + // On "Stop Service" we have to do regular shutdown + Service.SetShutdownEvent(hEventShutdown); + } +#endif +#ifdef OS2 + { + pthread_cond_init( &eventShutdown, NULL); + pthread_t hThread; + if (pthread_create(&hThread,&connection_attrib,handle_shutdown,0)) + sql_print_error("Warning: Can't create thread to handle shutdown requests"); + } +#endif + + if ( +#ifdef HAVE_BERKELEY_DB + !berkeley_skip || +#endif + (flush_time && flush_time != ~(ulong) 0L)) + { + pthread_t hThread; + if (pthread_create(&hThread,&connection_attrib,handle_manager,0)) + sql_print_error("Warning: Can't create thread to manage maintenance"); + } + + printf(ER(ER_READY),my_progname,server_version,""); + fflush(stdout); +#if defined(__NT__) || defined(HAVE_SMEM) +#ifdef __NT__ + if (hPipe == INVALID_HANDLE_VALUE && + (!have_tcpip || opt_disable_networking) && + !opt_enable_shared_memory) + { + sql_print_error("TCP/IP,--shared-memory or --named-pipe should be configured on NT OS"); + unireg_abort(1); + } + else +#endif + { + pthread_mutex_lock(&LOCK_thread_count); + (void) pthread_cond_init(&COND_handler_count,NULL); + { + pthread_t hThread; + handler_count=0; +#ifdef __NT__ + if (hPipe != INVALID_HANDLE_VALUE && opt_enable_named_pipe) + { + handler_count++; + if (pthread_create(&hThread,&connection_attrib, + handle_connections_namedpipes, 0)) + { + sql_print_error("Warning: Can't create thread to handle named pipes"); + handler_count--; + } + } +#endif +#ifdef HAVE_SMEM + if (opt_enable_shared_memory) + { + handler_count++; + if (pthread_create(&hThread,&connection_attrib, + handle_connections_shared_memory, 0)) + { + sql_print_error("Warning: Can't create thread to handle shared memory"); + handler_count--; + } + } +#endif + if (have_tcpip && !opt_disable_networking) + { + handler_count++; + if (pthread_create(&hThread,&connection_attrib, + handle_connections_sockets, 0)) + { + sql_print_error("Warning: Can't create thread to handle tcp/ip"); + handler_count--; + } + } + while (handler_count > 0) + { + pthread_cond_wait(&COND_handler_count,&LOCK_thread_count); + } + } + pthread_mutex_unlock(&LOCK_thread_count); + } +#else + handle_connections_sockets(0); +#ifdef EXTRA_DEBUG2 + sql_print_error("Exiting main thread"); +#endif +#endif /* __NT__ */ + + /* (void) pthread_attr_destroy(&connection_attrib); */ + + DBUG_PRINT("quit",("Exiting main thread")); + +#ifndef __WIN__ +#ifdef EXTRA_DEBUG2 + sql_print_error("Before Lock_thread_count"); +#endif + (void) pthread_mutex_lock(&LOCK_thread_count); + DBUG_PRINT("quit", ("Got thread_count mutex")); + select_thread_in_use=0; // For close_connections + (void) pthread_mutex_unlock(&LOCK_thread_count); + (void) pthread_cond_broadcast(&COND_thread_count); +#ifdef EXTRA_DEBUG2 + sql_print_error("After lock_thread_count"); +#endif +#endif /* __WIN__ */ + + /* Wait until cleanup is done */ + (void) pthread_mutex_lock(&LOCK_thread_count); + while (!ready_to_exit) + pthread_cond_wait(&COND_thread_count,&LOCK_thread_count); + (void) pthread_mutex_unlock(&LOCK_thread_count); + +#if defined(__WIN__) && !defined(EMBEDDED_LIBRARY) + if (Service.IsNT() && start_mode) + Service.Stop(); + else + { + Service.SetShutdownEvent(0); + if (hEventShutdown) + CloseHandle(hEventShutdown); + } +#endif + my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0); + exit(0); + return(0); /* purecov: deadcode */ +} +#endif /* REMOTE */ + + /**************************************************************************** Main and thread entry function for Win32 (all this is needed only to run mysqld as a service on WinNT) @@ -3239,6 +3729,7 @@ enum options { OPT_INNODB_LOG_FILE_SIZE, OPT_INNODB_LOG_BUFFER_SIZE, OPT_INNODB_BUFFER_POOL_SIZE, + OPT_INNODB_BUFFER_POOL_AWE_MEM_MB, OPT_INNODB_ADDITIONAL_MEM_POOL_SIZE, OPT_INNODB_FILE_IO_THREADS, OPT_INNODB_LOCK_WAIT_TIMEOUT, @@ -3802,6 +4293,10 @@ struct my_option my_long_options[] = "The size of the memory buffer InnoDB uses to cache data and indexes of its tables.", (gptr*) &innobase_buffer_pool_size, (gptr*) &innobase_buffer_pool_size, 0, GET_LONG, REQUIRED_ARG, 8*1024*1024L, 1024*1024L, ~0L, 0, 1024*1024L, 0}, + {"innodb_buffer_pool_awe_mem_mb", OPT_INNODB_BUFFER_POOL_AWE_MEM_MB, + "If Windows AWE is used, the size of InnoDB buffer pool allocated from the AWE memory.", + (gptr*) &innobase_buffer_pool_awe_mem_mb, (gptr*) &innobase_buffer_pool_awe_mem_mb, 0, + GET_LONG, REQUIRED_ARG, 0, 0, 63000, 0, 1, 0}, {"innodb_additional_mem_pool_size", OPT_INNODB_ADDITIONAL_MEM_POOL_SIZE, "Size of a memory pool InnoDB uses to store data dictionary information and other internal data structures.", (gptr*) &innobase_additional_mem_pool_size, @@ -3848,8 +4343,13 @@ struct my_option my_long_options[] = {"lower_case_table_names", OPT_LOWER_CASE_TABLE_NAMES, "If set to 1 table names are stored in lowercase on disk and table names will be case-insensitive.", (gptr*) &lower_case_table_names, - (gptr*) &lower_case_table_names, 0, - GET_BOOL, NO_ARG, IF_WIN(1,0), 0, 1, 0, 1, 0}, + (gptr*) &lower_case_table_names, 0, GET_BOOL, NO_ARG, +#ifdef FN_NO_CASE_SENCE + 1 +#else + 0 +#endif + , 0, 1, 0, 1, 0}, {"max_allowed_packet", OPT_MAX_ALLOWED_PACKET, "Max packetlength to send/receive from to server.", (gptr*) &global_system_variables.max_allowed_packet, @@ -3888,7 +4388,7 @@ struct my_option my_long_options[] = {"max_join_size", OPT_MAX_JOIN_SIZE, "Joins that are probably going to read more than max_join_size records return an error.", (gptr*) &global_system_variables.max_join_size, - (gptr*) &max_system_variables.max_join_size, 0, GET_ULONG, REQUIRED_ARG, + (gptr*) &max_system_variables.max_join_size, 0, GET_HA_ROWS, REQUIRED_ARG, ~0L, 1, ~0L, 0, 1, 0}, {"max_prepared_statements", OPT_MAX_PREP_STMT, "Max number of prepared_statements for a thread", @@ -4291,12 +4791,12 @@ static void set_options(void) sizeof(mysql_real_data_home)-1); /* Set default values for some variables */ - global_system_variables.table_type=DB_TYPE_MYISAM; - global_system_variables.tx_isolation=ISO_REPEATABLE_READ; + global_system_variables.table_type= DB_TYPE_MYISAM; + global_system_variables.tx_isolation= ISO_REPEATABLE_READ; global_system_variables.select_limit= (ulonglong) HA_POS_ERROR; - max_system_variables.select_limit= (ulong) HA_POS_ERROR; + max_system_variables.select_limit= (ulonglong) HA_POS_ERROR; global_system_variables.max_join_size= (ulonglong) HA_POS_ERROR; - max_system_variables.max_join_size= (ulonglong) HA_POS_ERROR; + max_system_variables.max_join_size= (ulonglong) HA_POS_ERROR; #ifdef __WIN__ /* Allow Win32 users to move MySQL anywhere */ @@ -4435,7 +4935,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), exit(1); } val= p--; - while (my_isspace(system_charset_info, *p) && p > argument) + while (my_isspace(mysqld_charset, *p) && p > argument) *p-- = 0; if (p == argument) { @@ -4445,7 +4945,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), } *val= 0; val+= 2; - while (*val && my_isspace(system_charset_info, *val)) + while (*val && my_isspace(mysqld_charset, *val)) *val++; if (!*val) { @@ -4588,7 +5088,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), have_symlink=SHOW_OPTION_DISABLED; break; case (int) OPT_BIND_ADDRESS: - if (argument && my_isdigit(system_charset_info, argument[0])) + if (argument && my_isdigit(mysqld_charset, argument[0])) { my_bind_addr = (ulong) inet_addr(argument); } @@ -4699,8 +5199,11 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), berkeley_lock_type=berkeley_lock_types[type-1]; else { - if (test_if_int(argument,(uint) strlen(argument), my_charset_latin1)) - berkeley_lock_scan_time=atoi(argument); + char *end; + uint length= strlen(argument); + long value= my_strntol(my_charset_latin1, argument, length, &end, 10); + if (test_if_int(argument,(uint) length, end, my_charset_latin1)) + berkeley_lock_scan_time= value; else { fprintf(stderr,"Unknown lock type: %s\n",argument); @@ -5003,8 +5506,8 @@ static ulong find_bit_type(const char *x, TYPELIB *bit_lib) j=pos; while (j != end) { - if (my_toupper(system_charset_info,*i++) != - my_toupper(system_charset_info,*j++)) + if (my_toupper(mysqld_charset,*i++) != + my_toupper(mysqld_charset,*j++)) goto skipp; } found_int=bit; diff --git a/sql/net_serv.cc b/sql/net_serv.cc index f9adee5812a..550fb772fce 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -74,7 +74,7 @@ extern pthread_mutex_t LOCK_bytes_sent , LOCK_bytes_received; #include "thr_alarm.h" #define TEST_BLOCKING 8 -#define MAX_THREE_BYTES 255L*255L*255L +#define MAX_PACKET_LENGTH (256L*256L*256L-1) static my_bool net_write_buff(NET *net,const char *packet,ulong len); @@ -133,13 +133,17 @@ my_bool net_realloc(NET *net, ulong length) { uchar *buff; ulong pkt_length; + DBUG_ENTER("net_realloc"); + DBUG_PRINT("enter",("length: %lu", length)); + if (length >= net->max_packet_size) { - DBUG_PRINT("error",("Packet too large (%lu)", length)); + DBUG_PRINT("error",("Packet too large. Max sixe: %lu", + net->max_packet_size)); net->error= 1; net->report_error= 1; net->last_errno= ER_NET_PACKET_TOO_LARGE; - return 1; + DBUG_RETURN(1); } pkt_length = (length+IO_SIZE-1) & ~(IO_SIZE-1); /* @@ -155,11 +159,11 @@ my_bool net_realloc(NET *net, ulong length) #ifdef MYSQL_SERVER net->last_errno= ER_OUT_OF_RESOURCES; #endif - return 1; + DBUG_RETURN(1); } net->buff=net->write_pos=buff; net->buff_end=buff+(net->max_packet=pkt_length); - return 0; + DBUG_RETURN(0); } /* Remove unwanted characters from connection */ @@ -221,13 +225,13 @@ my_net_write(NET *net,const char *packet,ulong len) { uchar buff[NET_HEADER_SIZE]; /* - Big packets are handled by splitting them in packets of MAX_THREE_BYTES - length. The last packet is always a packet that is < MAX_THREE_BYTES. - (The last packet may even have a lengt of 0) + Big packets are handled by splitting them in packets of MAX_PACKET_LENGTH + length. The last packet is always a packet that is < MAX_PACKET_LENGTH. + (The last packet may even have a length of 0) */ - while (len >= MAX_THREE_BYTES) + while (len >= MAX_PACKET_LENGTH) { - const ulong z_size = MAX_THREE_BYTES; + const ulong z_size = MAX_PACKET_LENGTH; int3store(buff, z_size); buff[3]= (uchar) net->pkt_nr++; if (net_write_buff(net, (char*) buff, NET_HEADER_SIZE) || @@ -242,7 +246,7 @@ my_net_write(NET *net,const char *packet,ulong len) if (net_write_buff(net,(char*) buff,NET_HEADER_SIZE)) return 1; DBUG_DUMP("packet_header",(char*) buff,NET_HEADER_SIZE); - return net_write_buff(net,packet,len); + return test(net_write_buff(net,packet,len)); } /* @@ -281,57 +285,110 @@ net_write_command(NET *net,uchar command, ulong length=len+1+head_len; /* 1 extra byte for command */ uchar buff[NET_HEADER_SIZE+1]; uint header_size=NET_HEADER_SIZE+1; + DBUG_ENTER("net_write_command"); + DBUG_PRINT("enter",("length: %lu", len)); + buff[4]=command; /* For first packet */ - if (length >= MAX_THREE_BYTES) + if (length >= MAX_PACKET_LENGTH) { /* Take into account that we have the command in the first header */ - len= MAX_THREE_BYTES - 1 - head_len; + len= MAX_PACKET_LENGTH - 1 - head_len; do { - int3store(buff, MAX_THREE_BYTES); + int3store(buff, MAX_PACKET_LENGTH); buff[3]= (uchar) net->pkt_nr++; if (net_write_buff(net,(char*) buff, header_size) || net_write_buff(net, header, head_len) || net_write_buff(net, packet, len)) - return 1; + DBUG_RETURN(1); packet+= len; - length-= MAX_THREE_BYTES; - len=MAX_THREE_BYTES; - head_len=0; - header_size=NET_HEADER_SIZE; - } while (length >= MAX_THREE_BYTES); + length-= MAX_PACKET_LENGTH; + len= MAX_PACKET_LENGTH; + head_len= 0; + header_size= NET_HEADER_SIZE; + } while (length >= MAX_PACKET_LENGTH); len=length; /* Data left to be written */ } int3store(buff,length); buff[3]= (uchar) net->pkt_nr++; - return test(net_write_buff(net, (char*) buff, header_size) || + DBUG_RETURN(test(net_write_buff(net, (char*) buff, header_size) || (head_len && net_write_buff(net, (char*) header, head_len)) || - net_write_buff(net, packet, len) || net_flush(net)); + net_write_buff(net, packet, len) || net_flush(net))); } /* Caching the data in a local buffer before sending it. - One can force the buffer to be flushed with 'net_flush'. + + SYNOPSIS + net_write_buff() + net Network handler + packet Packet to send + len Length of packet + + DESCRIPTION + Fill up net->buffer and send it to the client when full. + + If the rest of the to-be-sent-packet is bigger than buffer, + send it in one big block (to avoid copying to internal buffer). + If not, copy the rest of the data to the buffer and return without + sending data. + + NOTES + The cached buffer can be sent as it is with 'net_flush()'. + + In this code we have to be careful to not send a packet longer than + MAX_PACKET_LENGTH to net_real_write() if we are using the compressed protocol + as we store the length of the compressed packet in 3 bytes. + + RETURN + 0 ok + 1 */ static my_bool net_write_buff(NET *net,const char *packet,ulong len) { - ulong left_length=(ulong) (net->buff_end - net->write_pos); + ulong left_length; + if (net->compress && net->max_packet > MAX_PACKET_LENGTH) + left_length= MAX_PACKET_LENGTH - (net->write_pos - net->buff); + else + left_length= (ulong) (net->buff_end - net->write_pos); - while (len > left_length) + if (len > left_length) { - memcpy((char*) net->write_pos,packet,left_length); - if (net_real_write(net,(char*) net->buff,net->max_packet)) - return 1; - net->write_pos=net->buff; - packet+=left_length; - len-=left_length; - left_length=net->max_packet; + if (net->write_pos != net->buff) + { + /* Fill up already used packet and write it */ + memcpy((char*) net->write_pos,packet,left_length); + if (net_real_write(net,(char*) net->buff, + (ulong) (net->write_pos - net->buff) + left_length)) + return 1; + net->write_pos= net->buff; + packet+= left_length; + len-= left_length; + } + if (net->compress) + { + /* + We can't have bigger packets than 16M with compression + Because the uncompressed length is stored in 3 bytes + */ + left_length= MAX_PACKET_LENGTH; + while (len > left_length) + { + if (net_real_write(net, packet, left_length)) + return 1; + packet+= left_length; + len-= left_length; + } + } + if (len > net->max_packet) + return net_real_write(net, packet, len) ? 1 : 0; + /* Send out rest of the blocks as full sized blocks */ } memcpy((char*) net->write_pos,packet,len); - net->write_pos+=len; + net->write_pos+= len; return 0; } @@ -384,11 +441,7 @@ net_real_write(NET *net,const char *packet,ulong len) memcpy(b+header_length,packet,len); if (my_compress((byte*) b+header_length,&len,&complen)) - { - DBUG_PRINT("warning", - ("Compression error; Continuing without compression")); complen=0; - } int3store(&b[NET_HEADER_SIZE],complen); int3store(b,len); b[3]=(uchar) (net->compress_pkt_nr++); @@ -491,27 +544,15 @@ net_real_write(NET *net,const char *packet,ulong len) *****************************************************************************/ #ifndef NO_ALARM -/* - Help function to clear the commuication buffer when we get a too - big packet -*/ -static void my_net_skip_rest(NET *net, uint32 remain, thr_alarm_t *alarmed) +static my_bool net_safe_read(NET *net, char *buff, uint32 length, + thr_alarm_t *alarmed) { - ALARM alarm_buff; uint retry_count=0; - my_bool old_mode; - - if (!thr_alarm_in_use(&alarmed)) - { - if (!thr_alarm(alarmed,net->read_timeout,&alarm_buff) || - vio_blocking(net->vio, TRUE, &old_mode) < 0) - return; /* Can't setup, abort */ - } - while (remain > 0) + while (length > 0) { - ulong length; - if ((int) (length=vio_read(net->vio,(char*) net->buff,remain)) <= 0L) + int tmp; + if ((tmp=vio_read(net->vio,(char*) net->buff, length)) <= 0) { my_bool interrupted = vio_should_retry(net->vio); if (!thr_got_alarm(&alarmed) && interrupted) @@ -519,11 +560,60 @@ static void my_net_skip_rest(NET *net, uint32 remain, thr_alarm_t *alarmed) if (retry_count++ < net->retry_count) continue; } - return; + return 1; + } + length-= tmp; + } + return 0; +} + +/* + Help function to clear the commuication buffer when we get a too big packet. + + SYNOPSIS + my_net_skip_rest() + net Communication handle + remain Bytes to read + alarmed Parameter for thr_alarm() + alarm_buff Parameter for thr_alarm() + + RETURN VALUES + 0 Was able to read the whole packet + 1 Got mailformed packet from client +*/ + +static my_bool my_net_skip_rest(NET *net, uint32 remain, thr_alarm_t *alarmed, + ALARM *alarm_buff) +{ + uint32 old=remain; + DBUG_ENTER("my_net_skip_rest"); + DBUG_PRINT("enter",("bytes_to_skip: %u", (uint) remain)); + + if (!thr_alarm_in_use(&alarmed)) + { + my_bool old_mode; + if (!thr_alarm(alarmed,net->read_timeout, alarm_buff) || + vio_blocking(net->vio, TRUE, &old_mode) < 0) + DBUG_RETURN(1); /* Can't setup, abort */ + } + for (;;) + { + while (remain > 0) + { + uint length= min(remain, net->max_packet); + if (net_safe_read(net, (char*) net->buff, length, alarmed)) + DBUG_RETURN(1); + statistic_add(bytes_received, length, &LOCK_bytes_received); + remain -= (uint32) length; } - remain -= (uint32) length; - statistic_add(bytes_received,length,&LOCK_bytes_received); + if (old != MAX_PACKET_LENGTH) + break; + if (net_safe_read(net, (char*) net->buff, NET_HEADER_SIZE, alarmed)) + DBUG_RETURN(1); + old=remain= uint3korr(net->buff); + net->pkt_nr++; } + DBUG_RETURN(0); } #endif /* NO_ALARM */ @@ -623,9 +713,8 @@ my_real_read(NET *net, ulong *complen) continue; } #endif - DBUG_PRINT("error",("Couldn't read packet: remain: %lu errno: %d length: %ld alarmed: %d", - remain,vio_errno(net->vio), length, - thr_got_alarm(&alarmed))); + DBUG_PRINT("error",("Couldn't read packet: remain: %u errno: %d length: %ld", + remain, vio_errno(net->vio), length)); len= packet_error; net->error= 2; /* Close socket */ net->report_error= 1; @@ -668,7 +757,10 @@ my_real_read(NET *net, ulong *complen) #ifdef HAVE_COMPRESS if (net->compress) { - /* complen is > 0 if package is really compressed */ + /* + If the packet is compressed then complen > 0 and contains the + number of bytes in the uncompressed packet + */ *complen=uint3korr(&(net->buff[net->where_b + NET_HEADER_SIZE])); } #endif @@ -682,11 +774,12 @@ my_real_read(NET *net, ulong *complen) { if (net_realloc(net,helping)) { -#ifndef NO_ALARM - if (i == 1) - my_net_skip_rest(net, (uint32) len, &alarmed); +#if defined(MYSQL_SERVER) && !defined(NO_ALARM) + if (!net->compress && + !my_net_skip_rest(net, (uint32) len, &alarmed, &alarm_buff)) + net->error= 3; /* Successfully skiped packet */ #endif - len= packet_error; /* Return error */ + len= packet_error; /* Return error and close connection */ goto end; } } @@ -730,7 +823,7 @@ my_net_read(NET *net) { #endif len = my_real_read(net,&complen); - if (len == MAX_THREE_BYTES) + if (len == MAX_PACKET_LENGTH) { /* First packet of a multi-packet. Concatenate the packets */ ulong save_pos = net->where_b; @@ -739,8 +832,8 @@ my_net_read(NET *net) { net->where_b += len; total_length += len; - len = my_real_read (net,&complen); - } while (len == MAX_THREE_BYTES); + len = my_real_read(net,&complen); + } while (len == MAX_PACKET_LENGTH); if (len != packet_error) len+= total_length; net->where_b = save_pos; @@ -767,7 +860,7 @@ my_net_read(NET *net) } else { - /* reuse buffer, as there is noting in it that we need */ + /* reuse buffer, as there is nothing in it that we need */ buf_length=start_of_packet=first_packet_offset=0; } for (;;) @@ -798,7 +891,7 @@ my_net_read(NET *net) else start_of_packet+= read_length + NET_HEADER_SIZE; - if (read_length != MAX_THREE_BYTES) /* last package */ + if (read_length != MAX_PACKET_LENGTH) /* last package */ { multi_byte_packet= 0; /* No last zero len packet */ break; diff --git a/sql/nt_servc.cc b/sql/nt_servc.cc index b917c91ce15..93bae6f444d 100644 --- a/sql/nt_servc.cc +++ b/sql/nt_servc.cc @@ -431,7 +431,7 @@ BOOL NTService::SeekStatus(LPCSTR szInternName, int OperationType) if (ret_error == ERROR_ACCESS_DENIED) { printf("Install/Remove of the Service Denied!\n"); - if(!is_super_user()) + if (!is_super_user()) printf("That operation should be made by an user with Administrator privileges!\n"); } else @@ -530,13 +530,13 @@ BOOL NTService::is_super_user() UINT x; BOOL ret_value=FALSE; - if(!OpenThreadToken(GetCurrentThread(), TOKEN_QUERY, TRUE,&hAccessToken )) + if (!OpenThreadToken(GetCurrentThread(), TOKEN_QUERY, TRUE,&hAccessToken )) { - if(GetLastError() != ERROR_NO_TOKEN) - return FALSE; + if (GetLastError() != ERROR_NO_TOKEN) + return FALSE; - if(!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hAccessToken)) - return FALSE; + if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hAccessToken)) + return FALSE; } ret_value= GetTokenInformation(hAccessToken,TokenGroups,InfoBuffer, @@ -544,21 +544,21 @@ BOOL NTService::is_super_user() CloseHandle(hAccessToken); - if(!ret_value ) - return FALSE; + if (!ret_value ) + return FALSE; - if(!AllocateAndInitializeSid(&siaNtAuthority, 2, - SECURITY_BUILTIN_DOMAIN_RID, - DOMAIN_ALIAS_RID_ADMINS, - 0, 0, 0, 0, 0, 0, - &psidAdministrators)) - return FALSE; + if (!AllocateAndInitializeSid(&siaNtAuthority, 2, + SECURITY_BUILTIN_DOMAIN_RID, + DOMAIN_ALIAS_RID_ADMINS, + 0, 0, 0, 0, 0, 0, + &psidAdministrators)) + return FALSE; ret_value = FALSE; - for(x=0;x<ptgGroups->GroupCount;x++) + for (x=0;x<ptgGroups->GroupCount;x++) { - if( EqualSid(psidAdministrators, ptgGroups->Groups[x].Sid) ) + if ( EqualSid(psidAdministrators, ptgGroups->Groups[x].Sid) ) { ret_value = TRUE; break; diff --git a/sql/opt_range.cc b/sql/opt_range.cc index c8b1ad380d4..43066a29624 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -603,12 +603,14 @@ int SQL_SELECT::test_quick_select(key_map keys_to_use, table_map prev_tables, records++; /* purecov: inspected */ scan_time=(double) records / TIME_FOR_COMPARE+1; read_time=(double) head->file->scan_time()+ scan_time + 1.0; + if (head->force_index) + scan_time= read_time= DBL_MAX; if (limit < records) read_time=(double) records+scan_time+1; // Force to use index else if (read_time <= 2.0 && !force_quick_range) DBUG_RETURN(0); /* No need for quick select */ - DBUG_PRINT("info",("Time to scan table: %ld",(long) read_time)); + DBUG_PRINT("info",("Time to scan table: %g", read_time)); keys_to_use&=head->keys_in_use_for_query; if (keys_to_use) @@ -929,7 +931,7 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part, { bool like_error; char buff1[MAX_FIELD_WIDTH],*min_str,*max_str; - String tmp(buff1,sizeof(buff1),default_charset_info),*res; + String tmp(buff1,sizeof(buff1),value->charset()),*res; uint length,offset,min_length,max_length; if (!field->optimize_range(param->real_keynr[key_part->key])) @@ -1043,7 +1045,7 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part, if (maybe_null) *str= (char) field->is_real_null(); // Set to 1 if null field->get_key_image(str+maybe_null,key_part->part_length, - key_part->image_type); + field->charset(),key_part->image_type); if (!(tree=new SEL_ARG(field,str,str))) DBUG_RETURN(0); @@ -2162,18 +2164,29 @@ check_quick_keys(PARAM *param,uint idx,SEL_ARG *key_tree, tmp=1; // Max one record else { - tmp=param->table->file-> - records_in_range((int) keynr, - (byte*) (!min_key_length ? NullS : - param->min_key), - min_key_length, - tmp_min_flag & NEAR_MIN ? - HA_READ_AFTER_KEY : HA_READ_KEY_EXACT, - (byte*) (!max_key_length ? NullS : - param->max_key), - max_key_length, - (tmp_max_flag & NEAR_MAX ? - HA_READ_BEFORE_KEY : HA_READ_AFTER_KEY)); + if (tmp_min_flag & GEOM_FLAG) + { + tmp= param->table->file-> + records_in_range((int) keynr, (byte*)(param->min_key + 1), + min_key_length, + (ha_rkey_function)(tmp_min_flag ^ GEOM_FLAG), + (byte *)NullS, 0, HA_READ_KEY_EXACT); + } + else + { + tmp=param->table->file-> + records_in_range((int) keynr, + (byte*) (!min_key_length ? NullS : + param->min_key), + min_key_length, + tmp_min_flag & NEAR_MIN ? + HA_READ_AFTER_KEY : HA_READ_KEY_EXACT, + (byte*) (!max_key_length ? NullS : + param->max_key), + max_key_length, + (tmp_max_flag & NEAR_MAX ? + HA_READ_BEFORE_KEY : HA_READ_AFTER_KEY)); + } } end: if (tmp == HA_POS_ERROR) // Impossible range @@ -2783,7 +2796,7 @@ static void print_key(KEY_PART *key_part,const char *key,uint used_length) { char buff[1024]; - String tmp(buff,sizeof(buff),default_charset_info); + String tmp(buff,sizeof(buff),my_charset_bin); for (uint length=0; length < used_length ; @@ -2803,7 +2816,8 @@ print_key(KEY_PART *key_part,const char *key,uint used_length) } field->set_key_image((char*) key,key_part->part_length - ((field->type() == FIELD_TYPE_BLOB) ? - HA_KEY_BLOB_LENGTH : 0)); + HA_KEY_BLOB_LENGTH : 0), + field->charset()); field->val_str(&tmp,&tmp); fwrite(tmp.ptr(),sizeof(char),tmp.length(),DBUG_FILE); } diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc index 1477d46e756..b1bb36353bf 100644 --- a/sql/opt_sum.cc +++ b/sql/opt_sum.cc @@ -364,7 +364,8 @@ static bool find_range_key(TABLE_REF *ref, Field* field, COND *cond) // Save found constant if (part->null_bit) *key_ptr++= (byte) test(part->field->is_null()); - part->field->get_key_image((char*) key_ptr,part->length, Field::itRAW); + part->field->get_key_image((char*) key_ptr,part->length, + part->field->charset(), Field::itRAW); key_ptr+=part->store_length - test(part->null_bit); left_length-=part->store_length; } diff --git a/sql/password.c b/sql/password.c index 9fd3757106d..da7a499ba09 100644 --- a/sql/password.c +++ b/sql/password.c @@ -573,7 +573,7 @@ void get_hash_and_password(ulong* salt, uint8 pversion, char* hash, unsigned cha while (salt<salt_end) /* Iterate over these elements*/ { val=*salt; - for(t=3;t>=0;t--) + for (t=3;t>=0;t--) { bp[t]=val%256; diff --git a/sql/procedure.h b/sql/procedure.h index bc1b6062e1d..bc77803230f 100644 --- a/sql/procedure.h +++ b/sql/procedure.h @@ -59,7 +59,7 @@ public: void set(double nr) { value=nr; } void set(longlong nr) { value=(double) nr; } void set(const char *str,uint length,CHARSET_INFO *cs) - { value=my_strntod(cs,str,length,(char**)0); } + { value=my_strntod(cs,(char*) str,length,(char**)0); } double val() { return value; } longlong val_int() { return (longlong) value; } String *val_str(String *s) { s->set(value,decimals,thd_charset()); return s; } @@ -99,7 +99,8 @@ public: double val() { CHARSET_INFO *cs=str_value.charset(); - return my_strntod(cs, str_value.ptr(), str_value.length(),(char**)0); + return my_strntod(cs, (char*) str_value.ptr(), str_value.length(), + (char**) 0); } longlong val_int() { diff --git a/sql/protocol.cc b/sql/protocol.cc index 9926d4a6432..882fd5268b1 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -209,7 +209,10 @@ net_printf(THD *thd, uint errcode, ...) { if (thd->bootstrap) { - /* In bootstrap it's ok to print on stderr */ + /* + In bootstrap it's ok to print on stderr + This may also happen when we get an error from a slave thread + */ fprintf(stderr,"ERROR: %d %s\n",errcode,text_pos); thd->fatal_error=1; } @@ -397,7 +400,7 @@ net_store_length(char *pkg, ulonglong length) } *packet++=254; int8store(packet,length); - return (char*) packet+9; + return (char*) packet+8; } @@ -657,7 +660,7 @@ bool Protocol_simple::store_null() field_pos++; #endif char buff[1]; - buff[0]= 251; + buff[0]= (char)251; return packet->append(buff, sizeof(buff), PACKET_BUFFET_EXTRA_ALLOC); } @@ -815,13 +818,27 @@ bool Protocol_simple::store_time(TIME *tm) /**************************************************************************** Functions to handle the binary protocol used with prepared statements + + Data format: + + [ok:1] <-- reserved ok packet + [null_field:(field_count+7+2)/8] <-- reserved to send null data. The size is + calculated using: + bit_fields= (field_count+7+2)/8; + 2 bits are reserved + [[length]data] <-- data field (the length applies only for + string/binary/time/timestamp fields and + rest of them are not sent as they have + the default length that client understands + based on the field type + [..]..[[length]data] <-- data ****************************************************************************/ bool Protocol_prep::prepare_for_send(List<Item> *item_list) { Protocol::prepare_for_send(item_list); - bit_fields= (field_count+3)/8; - if (packet->alloc(bit_fields)) + bit_fields= (field_count+9)/8; + if (packet->alloc(bit_fields+1)) return 1; /* prepare_for_resend will be called after this one */ return 0; @@ -830,9 +847,8 @@ bool Protocol_prep::prepare_for_send(List<Item> *item_list) void Protocol_prep::prepare_for_resend() { - packet->length(bit_fields); - bzero((char*) packet->ptr()+1, bit_fields-1); - packet[0]=1; // Marker for ok packet + packet->length(bit_fields+1); + bzero((char*) packet->ptr(), 1+bit_fields); field_pos=0; } @@ -851,10 +867,9 @@ bool Protocol_prep::store(const char *from,uint length) return net_store_data(from, length); } - bool Protocol_prep::store_null() { - uint offset=(field_pos+2)/8, bit= (1 << ((field_pos+2) & 7)); + uint offset= (field_pos+2)/8+1, bit= (1 << ((field_pos+2) & 7)); /* Room for this as it's allocated in prepare_for_send */ char *to= (char*) packet->ptr()+offset; *to= (char) ((uchar) *to | (uchar) bit); @@ -880,7 +895,8 @@ bool Protocol_prep::store_short(longlong from) { #ifndef DEBUG_OFF DBUG_ASSERT(field_types == 0 || - field_types[field_pos] == MYSQL_TYPE_SHORT); + field_types[field_pos] == MYSQL_TYPE_SHORT || + field_types[field_pos] == MYSQL_TYPE_YEAR); #endif field_pos++; char *to= packet->prep_append(2, PACKET_BUFFET_EXTRA_ALLOC); @@ -977,11 +993,11 @@ bool Protocol_prep::store(TIME *tm) pos= buff+1; int2store(pos, tm->year); - int2store(pos+2, tm->month); - int2store(pos+3, tm->day); - int2store(pos+4, tm->hour); - int2store(pos+5, tm->minute); - int2store(pos+6, tm->second); + pos[2]= (uchar) tm->month; + pos[3]= (uchar) tm->day; + pos[4]= (uchar) tm->hour; + pos[5]= (uchar) tm->minute; + pos[6]= (uchar) tm->second; int4store(pos+7, tm->second_part); if (tm->second_part) length=11; @@ -1014,17 +1030,24 @@ bool Protocol_prep::store_time(TIME *tm) field_pos++; pos= buff+1; pos[0]= tm->neg ? 1 : 0; - int4store(pos+1, tm->day); - int2store(pos+5, tm->hour); - int2store(pos+7, tm->minute); - int2store(pos+9, tm->second); - int4store(pos+11, tm->second_part); + int4store(pos+1, tm->day); + pos[5]= (uchar) tm->hour; + pos[6]= (uchar) tm->minute; + pos[7]= (uchar) tm->second; + int4store(pos+8, tm->second_part); if (tm->second_part) - length=14; + length=11; else if (tm->hour || tm->minute || tm->second || tm->day) - length=10; + length=8; else length=0; buff[0]=(char) length; // Length is stored first return packet->append(buff, length+1, PACKET_BUFFET_EXTRA_ALLOC); } + +#if 0 +bool Protocol_prep::send_fields(List<Item> *list, uint flag) +{ + return prepare_for_send(list); +}; +#endif diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc index 6ef252467c3..49b061ae6b4 100644 --- a/sql/repl_failsafe.cc +++ b/sql/repl_failsafe.cc @@ -84,7 +84,7 @@ static int init_failsafe_rpl_thread(THD* thd) #endif thd->mem_root.free=thd->mem_root.used=0; - if ((ulong) thd->variables.max_join_size == (ulong) HA_POS_ERROR) + if (thd->variables.max_join_size == HA_POS_ERROR) thd->options|= OPTION_BIG_SELECTS; thd->proc_info="Thread initialized"; diff --git a/sql/set_var.cc b/sql/set_var.cc index 66aded8422f..0cf2b50a6ea 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -21,6 +21,8 @@ - If the variable is thread specific, add it to 'system_variables' struct. If not, add it to mysqld.cc and an declaration in 'mysql_priv.h' + - Don't forget to initialize new fields in global_system_variables and + max_system_variables! - Use one of the 'sys_var... classes from set_var.h or write a specific one for the variable type. - Define it in the 'variable definition list' in this file. @@ -155,11 +157,13 @@ sys_var_thd_ulong sys_max_error_count("max_error_count", &SV::max_error_count); sys_var_thd_ulong sys_max_heap_table_size("max_heap_table_size", &SV::max_heap_table_size); -sys_var_thd_ulonglong sys_max_join_size("max_join_size", +sys_var_thd_ulong sys_pseudo_thread_id("pseudo_thread_id", + &SV::pseudo_thread_id); +sys_var_thd_ha_rows sys_max_join_size("max_join_size", &SV::max_join_size, fix_max_join_size); #ifndef TO_BE_DELETED /* Alias for max_join_size */ -sys_var_thd_ulonglong sys_sql_max_join_size("sql_max_join_size", +sys_var_thd_ha_rows sys_sql_max_join_size("sql_max_join_size", &SV::max_join_size, fix_max_join_size); #endif @@ -283,7 +287,7 @@ static sys_var_thd_bit sys_unique_checks("unique_checks", /* Local state variables */ -static sys_var_thd_ulonglong sys_select_limit("sql_select_limit", +static sys_var_thd_ha_rows sys_select_limit("sql_select_limit", &SV::select_limit); static sys_var_timestamp sys_timestamp("timestamp"); static sys_var_last_insert_id sys_last_insert_id("last_insert_id"); @@ -369,6 +373,7 @@ sys_var *sys_variables[]= &sys_net_retry_count, &sys_net_wait_timeout, &sys_net_write_timeout, + &sys_pseudo_thread_id, &sys_query_cache_size, #ifdef HAVE_QUERY_CACHE &sys_query_cache_limit, @@ -451,6 +456,7 @@ struct show_var_st init_vars[]= { #ifdef HAVE_INNOBASE_DB {"innodb_additional_mem_pool_size", (char*) &innobase_additional_mem_pool_size, SHOW_LONG }, {"innodb_buffer_pool_size", (char*) &innobase_buffer_pool_size, SHOW_LONG }, + {"innodb_buffer_pool_awe_mem_mb", (char*) &innobase_buffer_pool_awe_mem_mb, SHOW_LONG }, {"innodb_data_file_path", (char*) &innobase_data_file_path, SHOW_CHAR_PTR}, {"innodb_data_home_dir", (char*) &innobase_data_home_dir, SHOW_CHAR_PTR}, {"innodb_file_io_threads", (char*) &innobase_file_io_threads, SHOW_LONG }, @@ -521,6 +527,7 @@ struct show_var_st init_vars[]= { {"pid_file", (char*) pidfile_name, SHOW_CHAR}, {"port", (char*) &mysql_port, SHOW_INT}, {"protocol_version", (char*) &protocol_version, SHOW_INT}, + {sys_pseudo_thread_id.name, (char*) &sys_pseudo_thread_id, SHOW_SYS}, {sys_read_buff_size.name, (char*) &sys_read_buff_size, SHOW_SYS}, {sys_read_rnd_buff_size.name,(char*) &sys_read_rnd_buff_size, SHOW_SYS}, {sys_rpl_recovery_rank.name,(char*) &sys_rpl_recovery_rank, SHOW_SYS}, @@ -611,7 +618,7 @@ static void fix_max_join_size(THD *thd, enum_var_type type) { if (type != OPT_GLOBAL) { - if (thd->variables.max_join_size == (ulonglong) HA_POS_ERROR) + if (thd->variables.max_join_size == HA_POS_ERROR) thd->options|= OPTION_BIG_SELECTS; else thd->options&= ~OPTION_BIG_SELECTS; @@ -770,12 +777,7 @@ bool sys_var_thd_ulong::update(THD *thd, set_var *var) if (option_limits) tmp= (ulong) getopt_ull_limit_value(tmp, option_limits); if (var->type == OPT_GLOBAL) - { - /* Lock is needed to make things safe on 32 bit systems */ - pthread_mutex_lock(&LOCK_global_system_variables); global_system_variables.*offset= (ulong) tmp; - pthread_mutex_unlock(&LOCK_global_system_variables); - } else thd->variables.*offset= (ulong) tmp; return 0; @@ -802,10 +804,60 @@ byte *sys_var_thd_ulong::value_ptr(THD *thd, enum_var_type type) } +bool sys_var_thd_ha_rows::update(THD *thd, set_var *var) +{ + ulonglong tmp= var->value->val_int(); + + /* Don't use bigger value than given with --maximum-variable-name=.. */ + if ((ha_rows) tmp > max_system_variables.*offset) + tmp= max_system_variables.*offset; + + if (option_limits) + tmp= (ha_rows) getopt_ull_limit_value(tmp, option_limits); + if (var->type == OPT_GLOBAL) + { + /* Lock is needed to make things safe on 32 bit systems */ + pthread_mutex_lock(&LOCK_global_system_variables); + global_system_variables.*offset= (ha_rows) tmp; + pthread_mutex_unlock(&LOCK_global_system_variables); + } + else + thd->variables.*offset= (ha_rows) tmp; + return 0; +} + + +void sys_var_thd_ha_rows::set_default(THD *thd, enum_var_type type) +{ + if (type == OPT_GLOBAL) + { + /* We will not come here if option_limits is not set */ + pthread_mutex_lock(&LOCK_global_system_variables); + global_system_variables.*offset= (ha_rows) option_limits->def_value; + pthread_mutex_unlock(&LOCK_global_system_variables); + } + else + thd->variables.*offset= global_system_variables.*offset; +} + + +byte *sys_var_thd_ha_rows::value_ptr(THD *thd, enum_var_type type) +{ + if (type == OPT_GLOBAL) + return (byte*) &(global_system_variables.*offset); + return (byte*) &(thd->variables.*offset); +} + + bool sys_var_thd_ulonglong::update(THD *thd, set_var *var) { if (var->type == OPT_GLOBAL) + { + /* Lock is needed to make things safe on 32 bit systems */ + pthread_mutex_lock(&LOCK_global_system_variables); global_system_variables.*offset= var->value->val_int(); + pthread_mutex_unlock(&LOCK_global_system_variables); + } else thd->variables.*offset= var->value->val_int(); return 0; @@ -815,7 +867,11 @@ bool sys_var_thd_ulonglong::update(THD *thd, set_var *var) void sys_var_thd_ulonglong::set_default(THD *thd, enum_var_type type) { if (type == OPT_GLOBAL) + { + pthread_mutex_lock(&LOCK_global_system_variables); global_system_variables.*offset= (ulonglong) option_limits->def_value; + pthread_mutex_unlock(&LOCK_global_system_variables); + } else thd->variables.*offset= global_system_variables.*offset; } @@ -922,6 +978,8 @@ Item *sys_var::item(THD *thd, enum_var_type var_type) return new Item_uint((int32) *(ulong*) value_ptr(thd, var_type)); case SHOW_LONGLONG: return new Item_int(*(longlong*) value_ptr(thd, var_type)); + case SHOW_HA_ROWS: + return new Item_int((longlong) *(ha_rows*) value_ptr(thd, var_type)); case SHOW_MY_BOOL: return new Item_int((int32) *(my_bool*) value_ptr(thd, var_type),1); case SHOW_CHAR: diff --git a/sql/set_var.h b/sql/set_var.h index 795d9f0d0ab..f9a275941ef 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -212,6 +212,24 @@ public: }; +class sys_var_thd_ha_rows :public sys_var_thd +{ +public: + ha_rows SV::*offset; + sys_var_thd_ha_rows(const char *name_arg, ha_rows SV::*offset_arg) + :sys_var_thd(name_arg), offset(offset_arg) + {} + sys_var_thd_ha_rows(const char *name_arg, ha_rows SV::*offset_arg, + sys_after_update_func func) + :sys_var_thd(name_arg,func), offset(offset_arg) + {} + bool update(THD *thd, set_var *var); + void set_default(THD *thd, enum_var_type type); + SHOW_TYPE type() { return SHOW_HA_ROWS; } + byte *value_ptr(THD *thd, enum_var_type type); +}; + + class sys_var_thd_ulonglong :public sys_var_thd { public: diff --git a/sql/share/Makefile.am b/sql/share/Makefile.am index c70ac9ccf57..35202ff4722 100644 --- a/sql/share/Makefile.am +++ b/sql/share/Makefile.am @@ -7,7 +7,7 @@ dist-hook: done; \ sleep 1 ; touch $(srcdir)/*/errmsg.sys $(INSTALL_DATA) $(srcdir)/charsets/README $(distdir)/charsets - $(INSTALL_DATA) $(srcdir)/charsets/Index $(distdir)/charsets + $(INSTALL_DATA) $(srcdir)/charsets/Index.xml $(distdir)/charsets all: @AVAILABLE_LANGUAGES_ERRORS@ @@ -25,8 +25,7 @@ install-data-local: done $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/charsets $(INSTALL_DATA) $(srcdir)/charsets/README $(DESTDIR)$(pkgdatadir)/charsets/README - $(INSTALL_DATA) $(srcdir)/charsets/Index $(DESTDIR)$(pkgdatadir)/charsets/Index - $(INSTALL_DATA) $(srcdir)/charsets/*.conf $(DESTDIR)$(pkgdatadir)/charsets + $(INSTALL_DATA) $(srcdir)/charsets/*.xml $(DESTDIR)$(pkgdatadir)/charsets fix_errors: for lang in @AVAILABLE_LANGUAGES@; \ diff --git a/sql/share/charsets/Index b/sql/share/charsets/Index deleted file mode 100644 index b2d9fe3e2a1..00000000000 --- a/sql/share/charsets/Index +++ /dev/null @@ -1,70 +0,0 @@ -# sql/share/charsets/Index -# -# This file lists all of the available character sets. Please keep this -# file sorted by character set number. - - -big5 1 -czech 2 -dec8 3 -dos 4 -german1 5 -hp8 6 -koi8_ru 7 -latin1 8 -latin2 9 -swe7 10 -usa7 11 -ujis 12 -sjis 13 -cp1251 14 -danish 15 -hebrew 16 -tis620 18 -euc_kr 19 -estonia 20 -hungarian 21 -koi8_ukr 22 -# win1251ukr is depreciated. Use cp1251cias, cp1251csas or cp1251bin instead. -win1251ukr 23 -gb2312 24 -greek 25 -win1250 26 -croat 27 -gbk 28 -# cp1257 is depreciated. -# Use cp1257ltlvciai, cp1257ltlvcsas, cp1257bin, cp1257ltlvcias instead -cp1257 29 -latin5 30 -latin1_de 31 -armscii8 32 -utf8 33 -win1250ch 34 - -ucs2 35 -cp866 36 -keybcs2 37 - -macce 38 -macroman 39 - -pclatin2 40 -latvian 41 -latvian1 42 -maccebin 43 -macceciai 44 -maccecias 45 -maccecsas 46 -latin1bin 47 -latin1cias 48 -latin1csas 49 -cp1251bin 50 -cp1251cias 51 -cp1251csas 52 -macromanbin 53 -macromancias 54 -macromanciai 55 -macromancsas 56 -cp1256 57 - -binary 63 diff --git a/sql/share/charsets/Index.xml b/sql/share/charsets/Index.xml new file mode 100644 index 00000000000..e6cea7bc615 --- /dev/null +++ b/sql/share/charsets/Index.xml @@ -0,0 +1,460 @@ +<?xml version='1.0' encoding="utf-8"?> + +<charsets max-id=63> + +<description> +This file lists all of the available character sets. +To make maintaining easier please: + - keep records sorted by collation number. + - change charsets.max-id when adding a new collation. +</description> + +<charset name="big5"> + <family>Traditional Chinese</family> + <alias>big-5</alias> + <alias>bigfive</alias> + <alias>big-five</alias> + <alias>cn-big5</alias> + <alias>csbig5</alias> + <collation name="big5" id="1" order="Chinese" flag="primary" flag="compiled"/> +</charset> + +<charset name="latin2"> + <family>Central European</family> + <alias>csisolatin2</alias> + <alias>iso-8859-2</alias> + <alias>iso-ir-101</alias> + <alias>iso_8859-2</alias> + <alias>iso_8859-2:1987</alias> + <alias>l2</alias> + <collation name="czech" id="2" order="Czech" flag="compiled"/> + <collation name="latin2" id="9" flag="primary"> + <order>Hungarian</order> + <order>Polish</order> + <order>Romanian</order> + <order>Croatian</order> + <order>Slovak</order> + <order>Slovenian</order> + <order>Sorbian</order> + </collation> + <collation name="hungarian" id="21" order="Hungarian"/> + <collation name="croat" id="27" order="Croatian"/> +</charset> + +<charset name="dec8"> + <family>Western</family> + <collation name="dec8" id="3" flag="primary"> + <order>Dutch</order> + <order>English</order> + <order>French</order> + <order>German Duden</order> + <order>Italian</order> + <order>Latin</order> + <order>Pogtuguese</order> + <order>Spanish</order> + </collation> +</charset> + +<charset name="pclatin1"> + <family>Western</family> + <alias>850</alias> + <alias>cp850</alias> + <alias>cspc850multilingual</alias> + <alias>ibm850</alias> + <collation name="pclatin1" id="4" flag="primary"> + <order>Dutch</order> + <order>English</order> + <order>French</order> + <order>German Duden</order> + <order>Italian</order> + <order>Latin</order> + <order>Pogtuguese</order> + <order>Spanish</order> + </collation> +</charset> + +<charset name="latin1"> + <family>Western</family> + <alias>csisolatin1</alias> + <alias>iso-8859-1</alias> + <alias>iso-ir-100</alias> + <alias>iso_8859-1</alias> + <alias>iso_8859-1:1987</alias> + <alias>l1</alias> + <alias>latin1</alias> + <collation name="german1" id="5" order="German Duden"/> + <collation name="latin1" id="8" order="Finnish, Swedish" flag="primary"/> + <collation name="danish" id="15" order="Danish"/> + <collation name="latin1_de" id="31" order="German DIN" flag="compiled"/> + <collation name="latin1_bin" id="47" order="Binary"/> + <collation name="latin1_ci_as" id="48"> + <order>Dutch</order> + <order>English</order> + <order>French</order> + <order>German Duden</order> + <order>Italian</order> + <order>Latin</order> + <order>Pogtuguese</order> + <order>Spanish</order> + </collation> + <collation name="latin1_cs_as" id="49"> + <order>Dutch</order> + <order>English</order> + <order>French</order> + <order>German Duden</order> + <order>Italian</order> + <order>Latin</order> + <order>Pogtuguese</order> + <order>Spanish</order> + </collation> +</charset> + +<charset name="hp8"> + <family>Western</family> + <alias>hproman8</alias> + <collation name="hp8" id="6" flag="primary"> + <order>Dutch</order> + <order>English</order> + <order>French</order> + <order>German Duden</order> + <order>Italian</order> + <order>Latin</order> + <order>Pogtuguese</order> + <order>Spanish</order> + </collation> +</charset> + +<charset name="koi8r"> + <family>Cyrillic</family> + <alias>koi8-r</alias> + <alias>cskoi8r</alias> + <collation name="koi8r" id="7" order="Russian" flag="primary"/> +</charset> + +<charset name="swe7"> + <family>Western</family> + <alias>iso-646-se</alias> + <collation name="swe7" id="10" order="Swedish" flag="primary"/> +</charset> + +<charset name="ascii"> + <family>Western</family> + <alias>us</alias> + <alias>us-ascii</alias> + <alias>csascii</alias> + <alias>iso-ir-6</alias> + <alias>iso646-us</alias> + <collation name="ascii" id="11" order="English" flag="primary"/> +</charset> + +<charset name="ujis"> + <family>Japanese</family> + <alias>euc-jp</alias> + <collation name="ujis" id="12" order="Japanese" flag="primary"/> +</charset> + +<charset name="sjis"> + <family>Japanese</family> + <alias>s-jis</alias> + <alias>shift-jis</alias> + <alias>x-sjis</alias> + <collation name="sjis" id="13" order="Japanese" flag="primary"/> +</charset> + +<charset name="cp1251"> + <family>Cyrillic</family> + <alias>windows-1251</alias> + <alias>ms-cyr</alias> + <alias>ms-cyrillic</alias> + <collation name="cp1251" id="14" flag="primary"> + <order>Belarusian</order> + <order>Bulgarian</order> + <order>Macedonian</order> + <order>Russian</order> + <order>Serbian</order> + <order>Mongolian</order> + <order>Ukrainian</order> + </collation> + <collation name="win1251ukr" id="23" order="<Depreciated>"/> + <collation name="cp1251_bin" id="50" order="Binary"/> + <collation name="cp1251_ci_as" id="51"> + <order>Belarusian</order> + <order>Bulgarian</order> + <order>Macedonian</order> + <order>Russian</order> + <order>Serbian</order> + <order>Mongolian</order> + <order>Ukrainian</order> + </collation> + <collation name="cp1251_cs_as" id="52"> + <order>Belarusian</order> + <order>Bulgarian</order> + <order>Macedonian</order> + <order>Russian</order> + <order>Serbian</order> + <order>Mongolian</order> + <order>Ukrainian</order> + </collation> +</charset> + +<charset name="hebrew"> + <family>Hebrew</family> + <alias>csisolatinhebrew</alias> + <alias>iso-8859-8</alias> + <alias>iso-ir-138</alias> + <collation name="hebrew" id="16" order="Hebrew" flag="primary"/> +</charset> + +<charset name="tis620"> + <family>Thai</family> + <alias>tis-620</alias> + <collation name="tis620" id="18" order="Thai" flag="primary" flag="compiled"/> +</charset> + +<charset name="euckr"> + <family>Korean</family> + <alias>euc_kr</alias> + <alias>euc-kr</alias> + <collation name="euckr" id="19" order="Korean" flag="primary" flag="compiled"/> +</charset> + +<charset name="latin7"> + <family>Baltic</family> + <alias>BalticRim</alias> + <alias>iso-8859-13</alias> + <alias>l7</alias> + <collation name="estonia" id="20" order="Estonian" flag="primary"/> + <collation name="latvian" id="41" order="Latvian"/> + <collation name="latvian1" id="42" order="Latvian"/> +</charset> + +<charset name="koi8u"> + <family>Cyrillic</family> + <alias>koi8-u</alias> + <collation name="koi8u" id="22" order="Ukranian" flag="primary"/> +</charset> + +<charset name="gb2312"> + <family>Simplified Chinese</family> + <alias>chinese</alias> + <alias>iso-ir-58</alias> + <collation name="gb2312" id="24" order="Chinese" flag="primary" flag="compiled"/> +</charset> + +<charset name="greek"> + <family>Greek</family> + <alias>csisolatingreek</alias> + <alias>ecma-118</alias> + <alias>greek8</alias> + <alias>iso-8859-7</alias> + <alias>iso-ir-126</alias> + <collation name="greek" id="25" order="Greek" flag="primary"/> +</charset> + +<charset name="cp1250"> + <family>Central European</family> + <alias>ms-ce</alias> + <alias>windows-1250</alias> + <collation name="cp1250" id="26" flag="primary"> + <order>Hungarian</order> + <order>Polish</order> + <order>Romanian</order> + <order>Croatian</order> + <order>Slovak</order> + <order>Slovenian</order> + <order>Sorbian</order> + </collation> + <collation name="cp1250_czech" id="34" order="Czech"/> +</charset> + +<charset name="gbk"> + <family>East Asian</family> + <alias>cp936</alias> + <collation name="gbk" id="28" order="Chinese" flag="primary" flag="compiled"/> +</charset> + +<charset name="cp1257"> + <family>Baltic</family> + <alias>WinBaltRim</alias> + <alias>windows-1257</alias> + <collation name="cp1257" id="29" order="<Depreciated>"/> + <collation name="cp1257_bin" id="58" order="Binary"/> + <collation name="cp1257_ci_ai" id="59" flag="primary"> + <order>Latvian</order> + <order>Lithuanian</order> + </collation> + <collation name="cp1257_ci_as" id="60"> + <order>Latvian</order> + <order>Lithuanian</order> + </collation> + <collation name="cp1257_cs_as" id="61"> + <order>Latvian</order> + <order>Lithuanian</order> + </collation> +</charset> + +<charset name="latin5"> + <family>South Asian</family> + <alias>csisolatin5</alias> + <alias>iso-8859-9</alias> + <alias>iso-ir-148</alias> + <alias>l5</alias> + <alias>latin5</alias> + <alias>turkish</alias> + <collation name="latin5" id="30" order="Turkish" flag="primary"/> +</charset> + +<charset name="armscii8"> + <family>South Asian</family> + <alias>armscii-8</alias> + <collation name="armscii8" id="32" order="Armenian" flag="primary"/> +</charset> + +<charset name="utf8"> + <family>Unicode</family> + <alias>utf-8</alias> + <collation name="utf8" id="33" flag="primary"/> +</charset> + +<charset name="ucs2"> + <family>Unicode</family> + <collation name="ucs2" id="35" flag="primary"/> +</charset> + +<charset name="cp866"> + <family>Cyrillic</family> + <alias>866</alias> + <alias>csibm866</alias> + <alias>ibm866</alias> + <alias>DOSCyrillicRussian</alias> + <collation name="cp866" id="36" order="Russian" flag="primary"/> +</charset> + +<charset name="keybcs2"> + <family>Central European</family> + <collation name="keybcs2" id="37" order="Czech" flag="primary"/> +</charset> + +<charset name="MacCE"> + <family>Central European</family> + <alias>MacCentralEurope</alias> + <collation name="macce" id="38" flag="primary"> + <order>Hungarian</order> + <order>Polish</order> + <order>Romanian</order> + <order>Croatian</order> + <order>Slovak</order> + <order>Slovenian</order> + <order>Sorbian</order> + </collation> + <collation name="macce_bin" id="43" order="Binary"/> + <collation name="macce_ci_ai" id="44"> + <order>Hungarian</order> + <order>Polish</order> + <order>Romanian</order> + <order>Croatian</order> + <order>Slovak</order> + <order>Slovenian</order> + <order>Sorbian</order> + </collation> + <collation name="macce_ci_as" id="45"> + <order>Hungarian</order> + <order>Polish</order> + <order>Romanian</order> + <order>Croatian</order> + <order>Slovak</order> + <order>Slovenian</order> + <order>Sorbian</order> + </collation> + <collation name="macce_cs_as" id="46"> + <order>Hungarian</order> + <order>Polish</order> + <order>Romanian</order> + <order>Croatian</order> + <order>Slovak</order> + <order>Slovenian</order> + <order>Sorbian</order> + </collation> +</charset> + +<charset name="MacRoman"> + <family>Western</family> + <alias>Mac</alias> + <alias>Macintosh</alias> + <alias>csmacintosh</alias> + <collation name="macroman" id="39" flag="primary"> + <order>Dutch</order> + <order>English</order> + <order>French</order> + <order>German Duden</order> + <order>Italian</order> + <order>Latin</order> + <order>Pogtuguese</order> + <order>Spanish</order> + </collation> + <collation name="macroman_bin" id="53" order="Binary"/> + <collation name="macroman_ci_as" id="54"> + <order>Dutch</order> + <order>English</order> + <order>French</order> + <order>German Duden</order> + <order>Italian</order> + <order>Latin</order> + <order>Pogtuguese</order> + <order>Spanish</order> + </collation> + <collation name="macroman_ci_ai" id="55"> + <order>Dutch</order> + <order>English</order> + <order>French</order> + <order>German Duden</order> + <order>Italian</order> + <order>Latin</order> + <order>Pogtuguese</order> + <order>Spanish</order> + </collation> + <collation name="macroman_cs_as" id="56"> + <order>Dutch</order> + <order>English</order> + <order>French</order> + <order>German Duden</order> + <order>Italian</order> + <order>Latin</order> + <order>Pogtuguese</order> + <order>Spanish</order> + </collation> +</charset> + +<charset name="pclatin2"> + <family>Central European</family> + <alias>852</alias> + <alias>cp852</alias> + <alias>ibm852</alias> + <collation name="pclatin2" id="40" flag="primary"> + <order>Hungarian</order> + <order>Polish</order> + <order>Romanian</order> + <order>Croatian</order> + <order>Slovak</order> + <order>Slovenian</order> + <order>Sorbian</order> + </collation> +</charset> + +<charset name="cp1256"> + <family>Arabic</family> + <alias>ms-arab</alias> + <alias>windows-1256</alias> + <collation name="cp1256" id="57" order="Arabic" flag="primary"> + <order>Arabic</order> + <order>Persian</order> + <order>Pakistani</order> + <order>Urdu</order> + </collation> +</charset> + +<charset name="binary"> + <collation name="binary" id="63" order="Binary" flag="primary" flag="compiled"/> +</charset> + +</charsets> diff --git a/sql/share/charsets/maccebin.conf b/sql/share/charsets/MacCE.xml index f859e64354c..fe64fd18abc 100644 --- a/sql/share/charsets/maccebin.conf +++ b/sql/share/charsets/MacCE.xml @@ -1,9 +1,11 @@ -# Mac OS Central European, binary sort order -# -# Czech (cs), Hungarian (hu), Polish (pl), Romanian (ro), Croatian (hr), -# Slovak (sk), Slovenian (sl), Sorbian. -# -# ctype array (must be 257 elements) +<?xml version='1.0' encoding="utf-8"?> + +<charsets> + +<charset name="MacCE"> + +<ctype> +<map> 00 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 @@ -21,8 +23,12 @@ 00 00 00 00 00 00 00 00 02 01 02 01 00 00 02 01 02 01 00 00 02 01 02 01 01 02 01 01 02 01 01 01 02 01 01 02 01 02 01 02 01 02 02 01 01 02 01 00 +</map> +</ctype> -# to_lower array (must be 256 elements) + +<lower> +<map> 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F @@ -39,8 +45,12 @@ D0 D1 D2 D3 D4 D5 D6 D7 D8 DA DA DE DC DD DE E0 E0 E4 E2 E3 E4 E6 E6 87 E9 E9 92 EC EC F0 97 99 F0 F3 9C F3 F5 F5 F7 F7 F9 F9 FA FD B8 FD AE FF +</map> +</lower> + -# to_upper array (must be 256 elements) +<upper> +<map> 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F @@ -57,26 +67,12 @@ D0 D1 D2 D3 D4 D5 D6 D7 CF D9 D9 DB DC DD DB DF DF E1 E2 E3 E1 E5 E5 E7 E8 E8 EA EB EB ED EE EF ED F1 F2 F1 F4 F4 F6 F6 F8 F8 B5 FB FC FB FE FF +</map> +</upper> -# sort_order array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF -# Unicode mapping (must be 256 elements) +<unicode> +<map> 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F @@ -93,4 +89,121 @@ 2013 2014 201C 201D 2018 2019 00F7 25CA 014D 0154 0155 0158 2039 203A 0159 0156 0157 0160 201A 201E 0161 015A 015B 00C1 0164 0165 00CD 017D 017E 016A 00D3 00D4 016B 016E 00DA 016F 0170 0171 0172 0173 00DD 00FD 0137 017B 0141 017C 0122 02C7 +</map> +</unicode> + + +<collation name="macce"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 46 47 4A 4C 52 53 55 56 5A 5B 5D 62 62 67 + 6F 70 71 75 79 81 88 89 8A 8B 8D 90 91 92 93 94 + 95 41 46 47 4A 4C 52 53 55 56 5A 5B 5D 62 62 67 + 6F 70 71 75 79 81 88 89 8A 8B 8D 96 97 98 99 9A + 41 41 41 4C 41 67 81 41 41 47 41 47 47 47 4C 8D + 8D 4A 56 4A 4C 4C 4C 67 4C 67 67 67 81 4C 4C 81 + A0 A1 4C A3 A4 A5 A6 75 A8 A9 AA 4C AC AD 53 56 + 56 56 B2 B3 56 5B B6 B7 5D 5D 5D 5D 5D 5D 5D 62 + 62 62 C2 C3 62 62 C6 C7 C8 C9 CA 62 67 67 67 67 + D0 D1 D2 D3 D4 D5 D6 D7 67 71 71 71 DC DD 71 71 + 71 75 E2 E3 75 75 75 41 79 79 56 8D 8D 81 67 67 + 81 81 81 81 81 81 81 81 8B 8B 5B 8D 5D 8D 53 FF +</map> +</collation> + + +<collation name="macce_bin"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF + B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF + C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF + D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</collation> + + +<collation name="macce_ci_ai"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 4B 4D 53 57 63 65 69 6B 73 75 79 83 85 8D + 9B 9D 9F A7 AE B2 C0 C2 C4 C6 CA D2 D3 D4 D5 D6 + D7 41 4B 4D 53 57 63 65 69 6B 73 75 79 83 85 8D + 9B 9D 9F A7 AE B2 C0 C2 C4 C6 CA D8 D9 DA DB DC + 41 41 41 57 41 8D B2 41 41 4D 41 4D 4D 4D 57 CA + CA 53 6B 53 57 57 57 8D 57 8D 8D 8D B2 57 57 B2 + DD DE 57 DF E0 E1 E2 A7 E3 E4 E5 57 E6 E7 65 6B + 6B 6B E8 E9 6B 75 EA EB 79 79 79 79 79 79 79 85 + 85 85 EC ED 85 85 EE EF F0 F1 F2 85 8D 8D 8D 8D + F3 F4 F5 F6 F7 F8 F9 FA 8D 9F 9F 9F FB FC 9F 9F + 9F A7 FD FE A7 A7 A7 41 BE BE 6B CA CA B2 8D 8D + B2 B2 B2 B2 B2 B2 B2 B2 C6 C6 75 CA 79 CA 65 FF +</map> +</collation> + + +<collation name="macce_ci_as"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 4B 4D 53 57 63 65 69 6B 73 75 79 83 85 8D + 9B 9D 9F A7 AE B2 C0 C2 C4 C6 CA D2 D3 D4 D5 D6 + D7 41 4B 4D 53 57 63 65 69 6B 73 75 79 83 85 8D + 9B 9D 9F A7 AE B2 C0 C2 C4 C6 CA D8 D9 DA DB DC + 45 47 47 59 49 91 B6 43 49 4F 45 4F 51 51 59 CE + CE 55 71 55 5B 5B 5D 8F 5D 99 91 97 B8 5F 5F B6 + DD DE 61 DF E0 E1 E2 AD E3 E4 E5 61 E6 E7 67 6F + 6F 6D E8 E9 6D 77 EA EB 7B 81 82 7F 7F 7D 7D 8B + 8B 87 EC ED 87 89 EE EF F0 F1 F2 89 93 97 93 95 + F3 F4 F5 F6 F7 F8 F9 FA 95 A1 A1 A3 FB FC A3 A5 + A5 A9 FD FE A9 AB AB 43 B0 B0 71 CC CC BC 8F 99 + BC B4 B8 B4 BA BA BE BE C8 C8 77 D0 7B D0 67 FF + +</map> +</collation> + + +<collation name="macce_cs_as"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 4B 4D 53 57 63 65 69 6B 73 75 79 83 85 8D + 9B 9D 9F A7 AE B2 C0 C2 C4 C6 CA D2 D3 D4 D5 D6 + D7 42 4C 4E 54 58 64 66 6A 6C 74 76 7A 84 86 8E + 9C 9E A0 A8 AF B3 C1 C3 C5 C7 CB D8 D9 DA DB DC + 45 47 48 59 49 91 B6 44 4A 4F 46 50 51 52 5A CE + CF 55 72 56 5B 5C 5D 90 5E 9A 92 98 B8 5F 60 B7 + DD DE 61 DF E0 E1 E2 AD E3 E4 E5 62 E6 E7 68 6F + 70 6D E8 E9 6E 77 EA EB 7C 81 82 7F 80 7D 7E 8B + 8C 87 EC ED 88 89 EE EF F0 F1 F2 8A 93 97 94 95 + F3 F4 F5 F6 F7 F8 F9 FA 96 A1 A2 A3 FB FC A4 A5 + A6 A9 FD FE AA AB AC 43 B0 B1 71 CC CD BC 8F 99 + BD B4 B9 B5 BA BB BE BF C8 C9 78 D0 7B D1 67 FF +</map> +</collation> + + +</charset> +</charsets> diff --git a/sql/share/charsets/macroman.conf b/sql/share/charsets/MacRoman.xml index 11cbee40e94..b17860f56b2 100644 --- a/sql/share/charsets/macroman.conf +++ b/sql/share/charsets/MacRoman.xml @@ -1,4 +1,11 @@ -# ctype array (must be 257 elements) +<?xml version='1.0' encoding="utf-8"?> + +<charsets> + +<charset name="MacRoman"> + +<ctype> +<map> 00 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 @@ -16,8 +23,11 @@ 00 00 00 00 00 00 00 00 02 01 00 00 00 00 00 00 00 00 00 00 00 20 01 01 01 01 01 01 01 01 01 01 00 01 01 01 01 02 00 00 00 00 00 00 00 00 00 00 +</map> +</ctype> -# to_lower array (must be 256 elements) +<lower> +<map> 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F @@ -34,8 +44,11 @@ D0 D1 D2 D3 D4 D5 D6 D7 D8 D8 DA DB DC DD DE DF E0 E1 E2 E3 E4 89 90 87 91 8F 92 94 95 93 97 99 F0 98 9C 9E 9D F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</lower> -# to_upper array (must be 256 elements) +<upper> +<map> 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F @@ -52,26 +65,12 @@ D0 D1 D2 D3 D4 D5 D6 D7 D9 D9 DA DB DC DD DE DF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</upper> -# sort_order array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 49 50 52 53 57 59 60 61 67 68 69 70 71 72 - 79 80 81 82 84 85 90 91 92 93 95 A0 A1 A2 A3 A4 - A5 41 49 50 52 53 57 59 60 61 67 68 69 70 71 72 - 79 80 81 82 84 85 90 91 92 93 95 A6 A7 A8 A9 AA - 41 41 50 53 71 72 85 41 41 41 41 41 41 50 53 53 - 53 53 61 61 61 61 71 72 72 72 72 72 85 85 85 85 - AB AC AD AE AF B0 B1 82 B2 B3 B4 B5 B6 B7 48 72 - B8 B9 BA BB BC BD BE BF C0 C1 C2 C3 C4 C5 48 72 - C6 C7 C8 C9 57 CA CB CC CD CE CF 41 41 72 D0 D1 - D2 D3 D4 D5 D6 D7 D8 D9 93 93 DA DB DC DD DE DF - E0 E1 E2 E3 E4 41 53 41 53 53 61 61 61 61 72 72 - F0 72 85 85 85 61 F6 F7 F8 F9 FA FB FC FD FE FF -# Unicode mappping (must be 256 elements) +<unicode> +<map> 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F @@ -88,4 +87,115 @@ 2013 2014 201C 201D 2018 2019 00F7 25CA 00FF 0178 2044 20AC 2039 203A FB01 FB02 2021 00B7 201A 201E 2030 00C2 00CA 00C1 00CB 00C8 00CD 00CE 00CF 00CC 00D3 00D4 F8FF 00D2 00DA 00DB 00D9 0131 02C6 02DC 00AF 02D8 02D9 02DA 00B8 02DD 02DB 02C7 +</map> +</unicode> + +<collation name="macroman"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 49 50 52 53 57 59 60 61 67 68 69 70 71 72 + 79 80 81 82 84 85 90 91 92 93 95 A0 A1 A2 A3 A4 + A5 41 49 50 52 53 57 59 60 61 67 68 69 70 71 72 + 79 80 81 82 84 85 90 91 92 93 95 A6 A7 A8 A9 AA + 41 41 50 53 71 72 85 41 41 41 41 41 41 50 53 53 + 53 53 61 61 61 61 71 72 72 72 72 72 85 85 85 85 + AB AC AD AE AF B0 B1 82 B2 B3 B4 B5 B6 B7 48 72 + B8 B9 BA BB BC BD BE BF C0 C1 C2 C3 C4 C5 48 72 + C6 C7 C8 C9 57 CA CB CC CD CE CF 41 41 72 D0 D1 + D2 D3 D4 D5 D6 D7 D8 D9 93 93 DA DB DC DD DE DF + E0 E1 E2 E3 E4 41 53 41 53 53 61 61 61 61 72 72 + F0 72 85 85 85 61 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</collation> + +<collation name="macroman_bin"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF + B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF + C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF + D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</collation> + +<collation name="macroman_ci_ai"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 51 53 57 59 63 66 68 6A 75 77 79 7B 7D 81 + 91 93 95 97 9A 9C A6 A8 AA AC B0 B2 B3 B4 B5 B6 + B7 41 51 53 57 59 63 66 68 6A 75 77 79 7B 7D 81 + 91 93 95 97 9A 9C A6 A8 AA AC B0 B8 B9 BA BB BC + 41 41 53 59 7D 81 9C 41 41 41 41 41 41 53 59 59 + 59 59 6A 6A 6A 6A 7D 81 81 81 81 81 9C 9C 9C 9C + BD BE BF C0 C1 C2 C3 97 C4 C5 C6 C7 C8 C9 41 81 + CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 41 81 + D8 D9 DA DB 63 DC DD DE DF E0 E1 41 41 81 81 81 + E2 E3 E4 E5 E6 E7 E8 E9 AC AC EA EB EC ED EE EF + F0 F1 F2 F3 F4 41 59 41 59 59 6A 6A 6A 6A 81 81 + F0 81 9C 9C 9C 6A F6 F7 F8 F9 FA FB FC FD FE FF + +</map> +</collation> + +<collation name="macroman_ci_as"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 51 53 57 59 63 66 68 6A 75 77 79 7B 7D 81 + 91 93 95 97 9A 9C A6 A8 AA AC B0 B2 B3 B4 B5 B6 + B7 41 51 53 57 59 63 66 68 6A 75 77 79 7B 7D 81 + 91 93 95 97 9A 9C A6 A8 AA AC B0 B8 B9 BA BB BC + 4B 4D 55 5D 7F 8B A4 45 43 47 4B 49 4D 55 5D 5B + 5F 61 6E 6C 70 72 7F 85 83 87 8B 89 A0 9E A2 A4 + BD BE BF C0 C1 C2 C3 99 C4 C5 C6 C7 C8 C9 4F 8D + CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 4F 8D + D8 D9 DA DB 65 DC DD DE DF E0 E1 43 49 89 8F 8F + E2 E3 E4 E5 E6 E7 E8 E9 AE AE EA EB EC ED EE EF + F0 F1 F2 F3 F4 47 5F 45 61 5B 6E 70 70 6C 85 87 + F0 83 A0 A2 9E 72 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</collation> + +<collation name="macroman_cs_as"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 51 53 57 59 63 66 68 6A 75 77 79 7B 7D 81 + 91 93 95 97 9A 9C A6 A8 AA AC B0 B2 B3 B4 B5 B6 + B7 42 52 54 58 5A 64 67 69 6B 76 78 7A 7C 7E 82 + 92 94 96 98 9B 9D A7 A9 AB AD B1 B8 B9 BA BB BC + 4B 4D 55 5D 7F 8B A4 46 44 48 4C 4A 4E 56 5E 5C + 60 62 6F 6D 71 73 80 86 84 88 8C 8A A1 9F A3 A5 + BD BE BF C0 C1 C2 C3 99 C4 C5 C6 C7 C8 C9 4F 8D + CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 50 8E + D8 D9 DA DB 65 DC DD DE DF E0 E1 43 49 89 8F 90 + E2 E3 E4 E5 E6 E7 E8 E9 AF AE EA EB EC ED EE EF + F0 F1 F2 F3 F4 47 5F 45 61 5B 6E 70 72 6C 85 87 + F0 83 A0 A2 9E 74 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</collation> + +</charset> +</charsets> diff --git a/sql/share/charsets/armscii8.conf b/sql/share/charsets/armscii8.conf deleted file mode 100644 index 54d2d0fec47..00000000000 --- a/sql/share/charsets/armscii8.conf +++ /dev/null @@ -1,93 +0,0 @@ -# Configuration file for the armscii8 (armenian) character set - -# ctype array (must have 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 01 02 01 02 01 02 01 02 01 02 01 02 01 02 - 01 02 01 02 01 02 01 02 01 02 01 02 01 02 01 02 - 01 02 01 02 01 02 01 02 01 02 01 02 01 02 01 02 - 01 02 01 02 01 02 01 02 01 02 01 02 01 02 01 02 - 01 02 01 02 01 02 01 02 01 02 01 02 01 02 10 10 - -# to_lower array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 AA AB AC AD AE AF - B0 B1 B3 B3 B5 B5 B7 B7 B9 B9 BB BB BD BD BF BF - C1 C1 C3 C3 C5 C5 C7 C7 C9 C9 CB CB CD CD CF CF - D1 D1 D3 D3 D5 D5 D7 D7 D9 D9 DB DB DD DD DF DF - E1 E1 E3 E3 E5 E5 E7 E7 E9 E9 EB EB ED ED EF EF - F1 F1 F3 F3 F5 F5 F7 F7 F9 F9 FB FB FD FD FE FF - -# to_upper array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B2 B4 B4 B6 B6 B8 B8 BA BA BC BC BE BE - C0 C0 C2 C2 C4 C4 C6 C6 C8 C8 CA CA CC CC CE CE - D0 D0 D2 D2 D4 D4 D6 D6 D8 D8 DA DA DC DC DE DE - E0 E0 E2 E2 E4 E4 E6 E6 E8 E8 EA EA EC EC EE EE - F0 F0 F2 F2 F4 F4 F6 F6 F8 F8 FA FA FC FC FE FF - -# sort_order array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F -0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F -0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F -00A0 2741 00A7 0589 0029 0028 00BB 00AB 2014 002E 055D 002C 002D 055F 2026 055C -055B 055E 0531 0561 0532 0562 0533 0563 0534 0564 0535 0565 0536 0566 0537 0567 -0538 0568 0539 0569 053A 056A 053B 056B 053C 056C 053D 056D 053E 056E 053F 056F -0540 0570 0541 0571 0542 0572 0543 0573 0544 0574 0545 0575 0546 0576 0547 0577 -0548 0578 0549 0579 054A 057A 054B 057B 054C 057C 054D 057D 054E 057E 054F 057F -0550 0580 0551 0581 0552 0582 0553 0583 0554 0584 0555 0585 0556 0586 2019 0027 diff --git a/sql/share/charsets/armscii8.xml b/sql/share/charsets/armscii8.xml new file mode 100644 index 00000000000..99ab5eb336d --- /dev/null +++ b/sql/share/charsets/armscii8.xml @@ -0,0 +1,119 @@ +<?xml version='1.0' encoding="utf-8"?> + +<charsets> + +<charset name="armscii8"> + +<ctype> +<map> + 00 + 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 + 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 + 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 10 10 01 02 01 02 01 02 01 02 01 02 01 02 01 02 + 01 02 01 02 01 02 01 02 01 02 01 02 01 02 01 02 + 01 02 01 02 01 02 01 02 01 02 01 02 01 02 01 02 + 01 02 01 02 01 02 01 02 01 02 01 02 01 02 01 02 + 01 02 01 02 01 02 01 02 01 02 01 02 01 02 10 10 +</map> +</ctype> + + +<lower> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 AA AB AC AD AE AF + B0 B1 B3 B3 B5 B5 B7 B7 B9 B9 BB BB BD BD BF BF + C1 C1 C3 C3 C5 C5 C7 C7 C9 C9 CB CB CD CD CF CF + D1 D1 D3 D3 D5 D5 D7 D7 D9 D9 DB DB DD DD DF DF + E1 E1 E3 E3 E5 E5 E7 E7 E9 E9 EB EB ED ED EF EF + F1 F1 F3 F3 F5 F5 F7 F7 F9 F9 FB FB FD FD FE FF +</map> +</lower> + + +<upper> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF + B0 B1 B2 B2 B4 B4 B6 B6 B8 B8 BA BA BC BC BE BE + C0 C0 C2 C2 C4 C4 C6 C6 C8 C8 CA CA CC CC CE CE + D0 D0 D2 D2 D4 D4 D6 D6 D8 D8 DA DA DC DC DE DE + E0 E0 E2 E2 E4 E4 E6 E6 E8 E8 EA EA EC EC EE EE + F0 F0 F2 F2 F4 F4 F6 F6 F8 F8 FA FA FC FC FE FF +</map> +</upper> + + +<unicode> +<map> +0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F +0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F +0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F +0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F +0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F +0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F +0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F +0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F +0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F +0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F +00A0 2741 00A7 0589 0029 0028 00BB 00AB 2014 002E 055D 002C 002D 055F 2026 055C +055B 055E 0531 0561 0532 0562 0533 0563 0534 0564 0535 0565 0536 0566 0537 0567 +0538 0568 0539 0569 053A 056A 053B 056B 053C 056C 053D 056D 053E 056E 053F 056F +0540 0570 0541 0571 0542 0572 0543 0573 0544 0574 0545 0575 0546 0576 0547 0577 +0548 0578 0549 0579 054A 057A 054B 057B 054C 057C 054D 057D 054E 057E 054F 057F +0550 0580 0551 0581 0552 0582 0553 0583 0554 0584 0555 0585 0556 0586 2019 0027 +</map> +</unicode> + + +<collation name="armscii8"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF + B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF + C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF + D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</collation> + +</charset> + +</charsets> diff --git a/sql/share/charsets/cp1257bin.conf b/sql/share/charsets/ascii.xml index 032f8a7e05d..67ab57de88f 100644 --- a/sql/share/charsets/cp1257bin.conf +++ b/sql/share/charsets/ascii.xml @@ -1,9 +1,11 @@ -# -# cp1257 character set -# -# Binary sorting order -# -# ctype array (must be 257 elements) +<?xml version='1.0' encoding="utf-8"?> + +<charsets> + +<charset name="ascii"> + +<ctype> +<map> 00 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 @@ -12,17 +14,21 @@ 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 + 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 01 00 01 00 00 00 00 01 - 00 00 00 00 00 00 00 00 02 00 02 00 00 00 00 02 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 00 01 01 01 01 01 01 01 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 00 02 02 02 02 02 02 02 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +</map> +</ctype> + -# to_lower array (must be 256 elements) +<lower> +<map> 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F @@ -33,14 +39,18 @@ 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 BA AB AC AD AE BF + A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF + C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF + D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</lower> + -# to_upper array (must be 256 elements) +<upper> +<map> 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F @@ -51,22 +61,48 @@ 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 BA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 A8 B9 BA BB BC BD BE AF + A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF + B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</upper> -# sort_order array (must be 256 elements) + +<unicode> +<map> +0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F +0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F +0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F +0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F +0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F +0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F +0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F +0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 0000 +0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 +0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 +0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 +0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 +0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 +0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 +0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 +0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 +</map> +</unicode> + + +<collation name="ascii"> +<map> 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 50 51 52 53 54 55 56 57 58 59 5A 5C 5D 5B 5E 5F + 45 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 59 7F 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF @@ -75,22 +111,9 @@ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</collation> -# Unicode mapping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 20AC 0000 201A 0000 201E 2026 2020 2021 0000 2030 0000 2039 0000 00A8 02C7 00B8 - 0000 2018 2019 201C 201D 2022 2013 2014 0000 2122 0000 203A 0000 00AF 02DB 0000 - 00A0 0000 00A2 00A3 00A4 0000 00A6 00A7 00D8 00A9 0156 00AB 00AC 00AD 00AE 00C6 - 00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00F8 00B9 0157 00BB 00BC 00BD 00BE 00E6 - 0104 012E 0100 0106 00C4 00C5 0118 0112 010C 00C9 0179 0116 0122 0136 012A 013B - 0160 0143 0145 00D3 014C 00D5 00D6 00D7 0172 0141 015A 016A 00DC 017B 017D 00DF - 0105 012F 0101 0107 00E4 00E5 0119 0113 010D 00E9 017A 0117 0123 0137 012B 013C - 0161 0144 0146 00F3 014D 00F5 00F6 00F7 0173 0142 015B 016B 00FC 017C 017E 02D9 +</charset> +</charsets> diff --git a/sql/share/charsets/win1250.conf b/sql/share/charsets/cp1250.xml index 0a5b5074bde..a863aceffc9 100644 --- a/sql/share/charsets/win1250.conf +++ b/sql/share/charsets/cp1250.xml @@ -1,6 +1,11 @@ -# Configuration file for the win1250 character set. +<?xml version='1.0' encoding="utf-8"?> -# The ctype array must have 257 elements. +<charsets> + +<charset name="cp1250"> + +<ctype> +<map> 00 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 @@ -18,8 +23,12 @@ 01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 10 +</map> +</ctype> + -# The to_lower array must have 256 elements. +<lower> +<map> 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F @@ -36,8 +45,12 @@ F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</lower> -# The to_upper array must have 256 elements. + +<upper> +<map> 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F @@ -54,26 +67,12 @@ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE A7 C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF +</map> +</upper> -# The sort_order array must have 256 elements. - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 46 49 4A 4B 4C 4D 4E 4F 50 52 53 55 - 56 57 58 59 5B 5C 5D 5E 5F 60 61 63 64 65 66 67 - 68 41 42 43 46 49 4A 4B 4C 4D 4E 4F 50 52 53 55 - 56 57 58 59 5B 5C 5D 5E 5F 60 61 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 5A 8B 5A 5B 62 62 - 90 91 92 93 94 95 96 97 98 99 5A 9B 5A 5B 62 62 - 20 A1 A2 50 A4 41 A6 59 A8 A9 59 AB AC AD AE 62 - B0 B1 B2 50 B4 B5 B6 B7 B8 41 59 BB 50 BD 50 62 - 58 41 41 41 41 50 45 43 44 49 49 49 49 4D 4D 46 - 47 53 53 55 55 55 55 D7 58 5C 5C 5C 5C 60 5B 59 - 58 41 41 41 41 50 45 43 44 49 49 49 49 4D 4D 46 - 47 53 53 55 55 55 55 F7 58 5C 5C 5C 5C 60 5B FF -# Unicode mapping table (256 elements) +<unicode> +<map> 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F @@ -90,3 +89,33 @@ 0110 0143 0147 00D3 00D4 0150 00D6 00D7 0158 016E 00DA 0170 00DC 00DD 0162 00DF 0155 00E1 00E2 0103 00E4 013A 0107 00E7 010D 00E9 0119 00EB 011B 00ED 00EE 010F 0111 0144 0148 00F3 00F4 0151 00F6 00F7 0159 016F 00FA 0171 00FC 00FD 0163 02D9 +</map> +</unicode> + + +<collation name="cp1250"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 42 43 46 49 4A 4B 4C 4D 4E 4F 50 52 53 55 + 56 57 58 59 5B 5C 5D 5E 5F 60 61 63 64 65 66 67 + 68 41 42 43 46 49 4A 4B 4C 4D 4E 4F 50 52 53 55 + 56 57 58 59 5B 5C 5D 5E 5F 60 61 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 5A 8B 5A 5B 62 62 + 90 91 92 93 94 95 96 97 98 99 5A 9B 5A 5B 62 62 + 20 A1 A2 50 A4 41 A6 59 A8 A9 59 AB AC AD AE 62 + B0 B1 B2 50 B4 B5 B6 B7 B8 41 59 BB 50 BD 50 62 + 58 41 41 41 41 50 45 43 44 49 49 49 49 4D 4D 46 + 47 53 53 55 55 55 55 D7 58 5C 5C 5C 5C 60 5B 59 + 58 41 41 41 41 50 45 43 44 49 49 49 49 4D 4D 46 + 47 53 53 55 55 55 55 F7 58 5C 5C 5C 5C 60 5B FF +</map> +</collation> + +<collation name="cp1250_czech"/> + +</charset> + +</charsets> diff --git a/sql/share/charsets/cp1251.conf b/sql/share/charsets/cp1251.conf deleted file mode 100644 index ee72c6e7b27..00000000000 --- a/sql/share/charsets/cp1251.conf +++ /dev/null @@ -1,93 +0,0 @@ -# Configuration file for the cp1251 character set - -# ctype array (must have 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - -# to_lower array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 A8 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - -# sort_order array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7C 7D 7E 7F 80 - 81 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 82 83 84 85 FF - FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF - FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF - FF FF FF FF FF FF FF FF 61 FF FF FF FF FF FF FF - FF FF FF FF FF FF FF FF 61 FF FF FF FF FF FF FF - 5B 5C 5D 5E 5F 60 62 63 64 65 66 67 68 69 6A 6B - 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B - 5B 5C 5D 5E 5F 60 62 63 64 65 66 67 68 69 6A 6B - 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B - -# Unicode mapping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 0402 0403 201A 0453 201E 2026 2020 2021 0000 2030 0409 2039 040A 040C 040B 040F - 0452 2018 2019 201C 201D 2022 2013 2014 0000 2122 0459 203A 045A 045C 045B 045F - 00A0 040E 045E 0408 00A4 0490 00A6 00A7 0401 00A9 0404 00AB 00AC 00AD 00AE 0407 - 00B0 00B1 0406 0456 0491 00B5 00B6 00B7 0451 2116 0454 00BB 0458 0405 0455 0457 - 0410 0411 0412 0413 0414 0415 0416 0417 0418 0419 041A 041B 041C 041D 041E 041F - 0420 0421 0422 0423 0424 0425 0426 0427 0428 0429 042A 042B 042C 042D 042E 042F - 0430 0431 0432 0433 0434 0435 0436 0437 0438 0439 043A 043B 043C 043D 043E 043F - 0440 0441 0442 0443 0444 0445 0446 0447 0448 0449 044A 044B 044C 044D 044E 044F - diff --git a/sql/share/charsets/cp1251cias.conf b/sql/share/charsets/cp1251.xml index 612be640b11..48c525eb797 100644 --- a/sql/share/charsets/cp1251cias.conf +++ b/sql/share/charsets/cp1251.xml @@ -1,12 +1,11 @@ -# -# cp1251 -# Case insensitive, accent sensitive -# Sort order is correct for Belarusian, Bulgarian, Macedonian, -# Russian, Serbian, Mongolian languages. Almost good for Ukrainian, -# except that "CYRILLIC LETTER SOFT SIGN" is not in the end of alphabet, -# but between YERU and E. -# -# ctype array (must be 257 elements) +<?xml version='1.0' encoding="utf-8"?> + +<charsets> + +<charset name="cp1251"> + +<ctype> +<map> 00 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 @@ -24,8 +23,12 @@ 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 +</map> +</ctype> + -# to_lower array (must be 256 elements) +<lower> +<map> 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F @@ -42,8 +45,12 @@ F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</lower> -# to_upper array (must be 256 elements) + +<upper> +<map> 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F @@ -60,26 +67,12 @@ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF +</map> +</upper> -# sort_order array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 43 45 47 49 4B 4D 4F 51 53 55 57 59 5B 5D - 5F 61 63 65 67 69 6B 6D 6F 71 73 D3 D4 D5 D6 D7 - D8 41 43 45 47 49 4B 4D 4F 51 53 55 57 59 5B 5D - 5F 61 63 65 67 69 6B 6D 6F 71 73 D9 DA DB DC DD - 81 83 DE 83 DF E0 E1 E2 E3 E4 A1 E5 A7 9D B3 C1 - 81 E6 E7 E8 E9 EA EB EC ED EE A1 EF A7 9D B3 C1 - F0 B7 B7 99 F1 7D F2 F3 87 F4 89 F5 F6 F7 F8 95 - F9 FA 93 93 7D FB FC FD 87 FE 89 FF 99 8F 8F 95 - 75 77 79 7B 7F 85 8B 8D 91 97 9B 9F A3 A5 A9 AB - AD AF B1 B5 B9 BB BD BF C3 C5 C7 C9 CB CD CF D1 - 75 77 79 7B 7F 85 8B 8D 91 97 9B 9F A3 A5 A9 AB - AD AF B1 B5 B9 BB BD BF C3 C5 C7 C9 CB CD CF D1 -# Unicode mapping (must be 256 elements) +<unicode> +<map> 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F @@ -97,3 +90,127 @@ 0430 0431 0432 0433 0434 0435 0436 0437 0438 0439 043A 043B 043C 043D 043E 043F 0440 0441 0442 0443 0444 0445 0446 0447 0448 0449 044A 044B 044C 044D 044E 044F +</map> +</unicode> + + +<collation name="cp1251"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7C 7D 7E 7F 80 + 81 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 82 83 84 85 FF + FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF + FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF + FF FF FF FF FF FF FF FF 61 FF FF FF FF FF FF FF + FF FF FF FF FF FF FF FF 61 FF FF FF FF FF FF FF + 5B 5C 5D 5E 5F 60 62 63 64 65 66 67 68 69 6A 6B + 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B + 5B 5C 5D 5E 5F 60 62 63 64 65 66 67 68 69 6A 6B + 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B +</map> +</collation> + + +<collation name="cp1251_bin"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF + B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF + C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF + D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</collation> + + +<collation name="cp1251_ci_as"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 43 45 47 49 4B 4D 4F 51 53 55 57 59 5B 5D + 5F 61 63 65 67 69 6B 6D 6F 71 73 D3 D4 D5 D6 D7 + D8 41 43 45 47 49 4B 4D 4F 51 53 55 57 59 5B 5D + 5F 61 63 65 67 69 6B 6D 6F 71 73 D9 DA DB DC DD + 81 83 DE 83 DF E0 E1 E2 E3 E4 A1 E5 A7 9D B3 C1 + 81 E6 E7 E8 E9 EA EB EC ED EE A1 EF A7 9D B3 C1 + F0 B7 B7 99 F1 7D F2 F3 87 F4 89 F5 F6 F7 F8 95 + F9 FA 93 93 7D FB FC FD 87 FE 89 FF 99 8F 8F 95 + 75 77 79 7B 7F 85 8B 8D 91 97 9B 9F A3 A5 A9 AB + AD AF B1 B5 B9 BB BD BF C3 C5 C7 C9 CB CD CF D1 + 75 77 79 7B 7F 85 8B 8D 91 97 9B 9F A3 A5 A9 AB + AD AF B1 B5 B9 BB BD BF C3 C5 C7 C9 CB CD CF D1 +</map> +</collation> + + +<collation name="cp1251_cs_as"> +<!-- +# Case insensitive, accent sensitive +# Sort order is correct for Belarusian, Bulgarian, Macedonian, +# Russian, Serbian, Mongolian languages. Almost good for Ukrainian, +# except that "CYRILLIC LETTER SOFT SIGN" is not in the end of alphabet, +# but between YERU and E. +--> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 43 45 47 49 4B 4D 4F 51 53 55 57 59 5B 5D + 5F 61 63 65 67 69 6B 6D 6F 71 73 D3 D4 D5 D6 D7 + D8 42 44 46 48 4A 4C 4E 50 52 54 56 58 5A 5C 5E + 60 62 64 66 68 6A 6C 6E 70 72 74 D9 DA DB DC DD + 81 83 DE 84 DF E0 E1 E2 E3 E4 A1 E5 A7 9D B3 C1 + 82 E6 E7 E8 E9 EA EB EC ED EE A2 EF A8 9E B4 C2 + F0 B7 B8 99 F1 7D F2 F3 87 F4 89 F5 F6 F7 F8 95 + F9 FA 93 94 7E FB FC FD 88 FE 8A FF 9A 8F 90 96 + 75 77 79 7B 7F 85 8B 8D 91 97 9B 9F A3 A5 A9 AB + AD AF B1 B5 B9 BB BD BF C3 C5 C7 C9 CB CD CF D1 + 76 78 7A 7C 80 86 8C 8E 92 98 9C A0 A4 A6 AA AC + AE B0 B2 B6 BA BC BE C0 C4 C6 C8 CA CC CE D0 D2 +</map> +</collation> + + +<collation name="win1251ukr"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 20 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + A5 A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 B3 B4 + B5 B6 B7 B8 B9 BA BB BC BD BE BF C0 C1 C2 C3 C4 + C5 C6 C7 C8 C9 84 CA CB 88 CC 87 CD CE CF D0 8D + D1 D2 8C 8C 84 D3 D4 D5 88 D6 87 D7 D8 D9 DA 8D + 80 81 82 83 85 86 89 8A 8B 8E 8F 90 91 92 93 94 + 95 96 97 98 99 9A 9B 9C 9D 9E 9F A0 A1 A2 A3 A4 + 80 81 82 83 85 86 89 8A 8B 8E 8F 90 91 92 93 94 + 95 96 97 98 99 9A 9B 9C 9D 9E 9F A0 A1 A2 A3 A4 +</map> +</collation> + + +</charset> + +</charsets> diff --git a/sql/share/charsets/cp1251bin.conf b/sql/share/charsets/cp1251bin.conf deleted file mode 100644 index 4c17fee5934..00000000000 --- a/sql/share/charsets/cp1251bin.conf +++ /dev/null @@ -1,95 +0,0 @@ -# -# cp1251 -# Binary sort order -# -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 - 01 01 00 02 00 00 00 00 00 00 01 00 01 01 01 01 - 02 00 00 00 00 00 00 00 00 00 02 00 02 02 02 02 - 00 01 02 01 00 01 00 00 01 00 01 00 00 00 00 01 - 00 00 01 02 02 00 00 00 02 00 02 00 02 01 02 02 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - -# to_lower array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 54 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 54 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 90 83 82 83 84 85 86 87 88 89 9A 8B 9C 9D 9E 9F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A2 A2 BC A4 B4 A6 A7 B8 A9 BA AB AC AD AE BF - B0 B1 B3 B3 B4 B5 B6 B7 B8 B9 BA BB BC BE BE BF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 74 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 74 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 81 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 80 91 92 93 94 95 96 97 98 99 8A 9B 8C 9D 8E 8F - A0 A1 A1 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B2 A5 B5 B6 B7 A8 B9 AA BB A3 BD BD AF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - -# sort_order array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# Unicode mapping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 0402 0403 201A 0453 201E 2026 2020 2021 0000 2030 0409 2039 040A 040C 040B 040F - 0452 2018 2019 201C 201D 2022 2013 2014 0000 2122 0459 203A 045A 045C 045B 045F - 00A0 040E 045E 0408 00A4 0490 00A6 00A7 0401 00A9 0404 00AB 00AC 00AD 00AE 0407 - 00B0 00B1 0406 0456 0491 00B5 00B6 00B7 0451 2116 0454 00BB 0458 0405 0455 0457 - 0410 0411 0412 0413 0414 0415 0416 0417 0418 0419 041A 041B 041C 041D 041E 041F - 0420 0421 0422 0423 0424 0425 0426 0427 0428 0429 042A 042B 042C 042D 042E 042F - 0430 0431 0432 0433 0434 0435 0436 0437 0438 0439 043A 043B 043C 043D 043E 043F - 0440 0441 0442 0443 0444 0445 0446 0447 0448 0449 044A 044B 044C 044D 044E 044F - diff --git a/sql/share/charsets/cp1251csas.conf b/sql/share/charsets/cp1251csas.conf deleted file mode 100644 index b6b2f853ea9..00000000000 --- a/sql/share/charsets/cp1251csas.conf +++ /dev/null @@ -1,99 +0,0 @@ -# -# cp1251 -# Case sensitive, accent sensitive -# Sort order is correct for Belarusian, Bulgarian, Macedonian, -# Russian, Serbian, Mongolian languages. Almost good for Ukrainian, -# except that "CYRILLIC LETTER SOFT SIGN" is not in the end of alphabet, -# but between YERU and E. -# -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 - 01 01 00 02 00 00 00 00 00 00 01 00 01 01 01 01 - 02 00 00 00 00 00 00 00 00 00 02 00 02 02 02 02 - 00 01 02 01 00 01 00 00 01 00 01 00 00 00 00 01 - 00 00 01 02 02 00 00 00 02 00 02 00 02 01 02 02 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - -# to_lower array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 54 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 54 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 90 83 82 83 84 85 86 87 88 89 9A 8B 9C 9D 9E 9F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A2 A2 BC A4 B4 A6 A7 B8 A9 BA AB AC AD AE BF - B0 B1 B3 B3 B4 B5 B6 B7 B8 B9 BA BB BC BE BE BF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 74 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 74 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 81 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 80 91 92 93 94 95 96 97 98 99 8A 9B 8C 9D 8E 8F - A0 A1 A1 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B2 A5 B5 B6 B7 A8 B9 AA BB A3 BD BD AF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - -# sort_order array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 43 45 47 49 4B 4D 4F 51 53 55 57 59 5B 5D - 5F 61 63 65 67 69 6B 6D 6F 71 73 D3 D4 D5 D6 D7 - D8 42 44 46 48 4A 4C 4E 50 52 54 56 58 5A 5C 5E - 60 62 64 66 68 6A 6C 6E 70 72 74 D9 DA DB DC DD - 81 83 DE 84 DF E0 E1 E2 E3 E4 A1 E5 A7 9D B3 C1 - 82 E6 E7 E8 E9 EA EB EC ED EE A2 EF A8 9E B4 C2 - F0 B7 B8 99 F1 7D F2 F3 87 F4 89 F5 F6 F7 F8 95 - F9 FA 93 94 7E FB FC FD 88 FE 8A FF 9A 8F 90 96 - 75 77 79 7B 7F 85 8B 8D 91 97 9B 9F A3 A5 A9 AB - AD AF B1 B5 B9 BB BD BF C3 C5 C7 C9 CB CD CF D1 - 76 78 7A 7C 80 86 8C 8E 92 98 9C A0 A4 A6 AA AC - AE B0 B2 B6 BA BC BE C0 C4 C6 C8 CA CC CE D0 D2 - -# Unicode mapping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 0402 0403 201A 0453 201E 2026 2020 2021 0000 2030 0409 2039 040A 040C 040B 040F - 0452 2018 2019 201C 201D 2022 2013 2014 0000 2122 0459 203A 045A 045C 045B 045F - 00A0 040E 045E 0408 00A4 0490 00A6 00A7 0401 00A9 0404 00AB 00AC 00AD 00AE 0407 - 00B0 00B1 0406 0456 0491 00B5 00B6 00B7 0451 2116 0454 00BB 0458 0405 0455 0457 - 0410 0411 0412 0413 0414 0415 0416 0417 0418 0419 041A 041B 041C 041D 041E 041F - 0420 0421 0422 0423 0424 0425 0426 0427 0428 0429 042A 042B 042C 042D 042E 042F - 0430 0431 0432 0433 0434 0435 0436 0437 0438 0439 043A 043B 043C 043D 043E 043F - 0440 0441 0442 0443 0444 0445 0446 0447 0448 0449 044A 044B 044C 044D 044E 044F - diff --git a/sql/share/charsets/cp1256.conf b/sql/share/charsets/cp1256.xml index 6072551813c..4947839a728 100644 --- a/sql/share/charsets/cp1256.conf +++ b/sql/share/charsets/cp1256.xml @@ -1,7 +1,13 @@ -# -# Arabic, Persian, Pakistani, Urdu -# -# ctype array (must be 257 elements) +<?xml version='1.0' encoding="utf-8"?> + +<!-- Arabic, Persian, Pakistani, Urdu --> + +<charsets> + +<charset name=""> + +<ctype> +<map> 00 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 @@ -19,8 +25,12 @@ 03 03 03 03 03 03 03 00 03 03 03 03 03 03 03 03 02 03 02 03 03 03 03 02 02 02 02 02 03 03 02 02 03 03 03 03 02 03 03 00 03 02 03 02 02 00 00 00 +</map> +</ctype> + -# to_lower array (must be 256 elements) +<lower> +<map> 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F @@ -37,8 +47,12 @@ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</lower> + -# to_upper array (must be 256 elements) +<upper> +<map> 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F @@ -55,26 +69,12 @@ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</upper> -# sort_order array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 45 47 4A 4C 52 55 57 59 5D 5F 61 63 65 67 - 6C 6E 70 72 74 76 7B 7D 7F 81 83 B9 BA BB BC BD - BE 41 45 47 4A 4C 52 55 57 59 5D 5F 61 63 65 67 - 6C 6E 70 72 74 76 7B 7D 7F 81 83 BF C0 C1 C2 C3 - C4 8E C5 54 C6 C7 C8 C9 CA CB CC CD 6A 92 99 CE - A5 CF D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 6A DA DB DC - DD B6 DE DF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB - EC ED EE EF F0 F1 F2 F3 F4 F5 B7 F6 F7 F8 F9 B8 - FA 85 86 87 88 89 8A 8B 8C 8D 9F 90 91 93 94 95 - 96 97 98 9A 9B 9C 9D FB 9E 9F A0 A1 AD A2 A3 A4 - 43 A6 44 A7 A8 A9 AA 49 4E 4F 50 51 AB AC 5B 5C - AE AF B0 B1 69 B2 B3 FC B4 78 B5 79 7A FD FE FF -# Unicode mapping (must be 256 elements) +<unicode> +<map> 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F @@ -91,4 +91,33 @@ 0630 0631 0632 0633 0634 0635 0636 00D7 0637 0638 0639 063A 0640 0641 0642 0643 00E0 0644 00E2 0645 0646 0647 0648 00E7 00E8 00E9 00EA 00EB 0649 064A 00EE 00EF 064B 064C 064D 064E 00F4 064F 0650 00F7 0651 00F9 0652 00FB 00FC 200E 200F 0000 +</map> +</unicode> + + +<collation name="cp1256"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 45 47 4A 4C 52 55 57 59 5D 5F 61 63 65 67 + 6C 6E 70 72 74 76 7B 7D 7F 81 83 B9 BA BB BC BD + BE 41 45 47 4A 4C 52 55 57 59 5D 5F 61 63 65 67 + 6C 6E 70 72 74 76 7B 7D 7F 81 83 BF C0 C1 C2 C3 + C4 8E C5 54 C6 C7 C8 C9 CA CB CC CD 6A 92 99 CE + A5 CF D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 6A DA DB DC + DD B6 DE DF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB + EC ED EE EF F0 F1 F2 F3 F4 F5 B7 F6 F7 F8 F9 B8 + FA 85 86 87 88 89 8A 8B 8C 8D 9F 90 91 93 94 95 + 96 97 98 9A 9B 9C 9D FB 9E 9F A0 A1 AD A2 A3 A4 + 43 A6 44 A7 A8 A9 AA 49 4E 4F 50 51 AB AC 5B 5C + AE AF B0 B1 69 B2 B3 FC B4 78 B5 79 7A FD FE FF +</map> +</collation> + + +</charset> + +</charsets> diff --git a/sql/share/charsets/cp1257.conf b/sql/share/charsets/cp1257.conf deleted file mode 100644 index 8338f99c83b..00000000000 --- a/sql/share/charsets/cp1257.conf +++ /dev/null @@ -1,92 +0,0 @@ -# Configuration file for the cp1257 character set. - -# The ctype array must have 257 elements. - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 01 01 00 00 00 00 01 00 01 00 00 01 00 00 00 00 - 01 00 00 00 00 00 00 00 01 00 00 01 00 00 01 00 - 02 02 00 00 00 00 02 00 02 00 00 02 00 00 00 00 - 02 00 00 00 00 00 00 00 02 00 00 02 00 00 02 00 - -# The to_lower array must have 256 elements. - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - E0 E1 C2 C3 C4 C5 E6 C7 E8 C9 CA EB CC CD CE CF - F0 D1 D2 D3 D4 D5 D6 D7 F8 D9 DA FB DC DD FE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# The to_upper array must have 256 elements. - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - C0 C1 E2 E3 E4 E5 C6 E7 C8 E9 EA CB EC ED EE EF - D0 F1 F2 F3 F4 F5 F6 F7 D8 F9 FA DB FC FD DE FF - -# The sort_order array must have 256 elements. - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 43 44 46 47 4A 4B 4C 4D 50 51 52 53 54 55 - 56 57 58 59 5B 5C 5F 60 61 4E FF 62 63 64 65 66 - 67 41 43 44 46 47 4A 4B 4C 4D 50 51 52 53 54 55 - 56 57 58 59 5B 5C 5F 60 61 4E FF 68 69 6A 6B FF - FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF - FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF - FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF - FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF - 42 4F FF FF FF FF 48 FF 45 FF FF 49 FF FF FF FF - 5A FF FF FF FF FF FF FF 5E FF FF 5D FF FF FF FF - FF 4F FF FF FF FF 48 FF 45 FF FF 49 FF FF FF FF - 5A FF FF FF FF FF FF FF 5E FF FF 5D FF FF FF FF - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F -20AC 0000 201A 0000 201E 2026 2020 2021 0000 2030 0000 2039 0000 00A8 02C7 00B8 -0000 2018 2019 201C 201D 2022 2013 2014 0000 2122 0000 203A 0000 00AF 02DB 0000 -00A0 0000 00A2 00A3 00A4 0000 00A6 00A7 00D8 00A9 0156 00AB 00AC 00AD 00AE 00C6 -00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00F8 00B9 0157 00BB 00BC 00BD 00BE 00E6 -0104 012E 0100 0106 00C4 00C5 0118 0112 010C 00C9 0179 0116 0122 0136 012A 013B -0160 0143 0145 00D3 014C 00D5 00D6 00D7 0172 0141 015A 016A 00DC 017B 017D 00DF -0105 012F 0101 0107 00E4 00E5 0119 0113 010D 00E9 017A 0117 0123 0137 012B 013C -0161 0144 0146 00F3 014D 00F5 00F6 00F7 0173 0142 015B 016B 00FC 017C 017E 02D9 diff --git a/sql/share/charsets/cp1257.xml b/sql/share/charsets/cp1257.xml new file mode 100644 index 00000000000..5ac2b746ff9 --- /dev/null +++ b/sql/share/charsets/cp1257.xml @@ -0,0 +1,229 @@ +<?xml version='1.0' encoding="utf-8"?> + +<charsets> + +<charset name="cp1257"> + +<ctype> +<map> + 00 + 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 + 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 + 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 01 00 01 00 00 00 00 01 + 00 00 00 00 00 00 00 00 02 00 02 00 00 00 00 02 + 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 00 01 01 01 01 01 01 01 02 + 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 00 02 02 02 02 02 02 02 00 +</map> +</ctype> + + +<lower> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 BA AB AC AD AE BF + B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</lower> + + +<upper> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 BA AB AC AD AE AF + B0 B1 B2 B3 B4 B5 B6 B7 A8 B9 BA BB BC BD BE AF + C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF + D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF + C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF + D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF +</map> +</upper> + + +<unicode> +<map> + 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F + 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F + 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F + 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F + 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F + 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F + 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F + 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F + 20AC 0000 201A 0000 201E 2026 2020 2021 0000 2030 0000 2039 0000 00A8 02C7 00B8 + 0000 2018 2019 201C 201D 2022 2013 2014 0000 2122 0000 203A 0000 00AF 02DB 0000 + 00A0 0000 00A2 00A3 00A4 0000 00A6 00A7 00D8 00A9 0156 00AB 00AC 00AD 00AE 00C6 + 00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00F8 00B9 0157 00BB 00BC 00BD 00BE 00E6 + 0104 012E 0100 0106 00C4 00C5 0118 0112 010C 00C9 0179 0116 0122 0136 012A 013B + 0160 0143 0145 00D3 014C 00D5 00D6 00D7 0172 0141 015A 016A 00DC 017B 017D 00DF + 0105 012F 0101 0107 00E4 00E5 0119 0113 010D 00E9 017A 0117 0123 0137 012B 013C + 0161 0144 0146 00F3 014D 00F5 00F6 00F7 0173 0142 015B 016B 00FC 017C 017E 02D9 +</map> +</unicode> + + +<collation name="cp1257"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 43 44 46 47 4A 4B 4C 4D 50 51 52 53 54 55 + 56 57 58 59 5B 5C 5F 60 61 4E FF 62 63 64 65 66 + 67 41 43 44 46 47 4A 4B 4C 4D 50 51 52 53 54 55 + 56 57 58 59 5B 5C 5F 60 61 4E FF 68 69 6A 6B FF + FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF + FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF + FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF + FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF + 42 4F FF FF FF FF 48 FF 45 FF FF 49 FF FF FF FF + 5A FF FF FF FF FF FF FF 5E FF FF 5D FF FF FF FF + FF 4F FF FF FF FF 48 FF 45 FF FF 49 FF FF FF FF + 5A FF FF FF FF FF FF FF 5E FF FF 5D FF FF FF FF +</map> +</collation> + + +<collation name="cp1257_bin"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF + B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF + C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF + D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</collation> + + +<collation name="cp1257_ci_ai"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 4D 4F 55 57 61 63 67 69 6F 71 75 7B 7D 83 + 8F 91 93 97 9E A0 A8 AA AC AE B0 B8 B9 BA BB BC + BD 41 4D 4F 55 57 61 63 67 69 6F 71 75 7B 7D 83 + 8F 91 93 97 9E A0 A8 AA AC AE B0 BE BF C0 C1 C4 + C5 C6 C7 C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4 + D5 D6 D7 D8 D9 DA DB DC DD DE DF E0 E1 E2 E3 E4 + E5 E6 E7 E8 E9 EA EB EC 83 ED 93 EE EF F0 F1 41 + F2 F3 F4 F5 F6 F7 F8 F9 83 FA 93 FB FC FD FE 41 + 41 69 41 4F 41 41 57 57 4F 57 B0 57 63 71 69 75 + 97 7D 7D 83 83 83 83 C2 A0 75 97 A0 A0 B0 B0 97 + 41 69 41 4F 41 41 57 57 4F 57 B0 57 63 71 69 75 + 97 7D 7D 83 83 83 83 C3 A0 75 97 A0 A0 B0 B0 FF +</map> +</collation> + + +<collation name="cp1257_ci_as"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 4D 4F 55 57 61 63 67 69 6F 71 75 7B 7D 83 + 8F 91 93 97 9E A0 A8 AA AC AE B0 B8 B9 BA BB BC + BD 41 4D 4F 55 57 61 63 67 69 6F 71 75 7B 7D 83 + 8F 91 93 97 9E A0 A8 AA AC AE B0 BE BF C0 C1 C4 + C5 C6 C7 C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4 + D5 D6 D7 D8 D9 DA DB DC DD DE DF E0 E1 E2 E3 E4 + E5 E6 E7 E8 E9 EA EB EC 85 ED 95 EE EF F0 F1 4B + F2 F3 F4 F5 F6 F7 F8 F9 85 FA 95 FB FC FD FE 4B + 43 6B 45 51 47 49 59 5B 53 5D B2 5F 65 73 6D 77 + 99 7F 81 87 89 8B 8D C2 A2 79 9B A4 A6 B4 B6 9D + 43 6B 45 51 47 49 59 5B 53 5D B2 5F 65 73 6D 77 + 99 7F 81 87 89 8B 8D C3 A2 79 9B A4 A6 B4 B6 FF +</map> +</collation> + + +<collation name="cp1257_cs_as"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 4D 4F 55 57 61 63 67 69 6F 71 75 7B 7D 83 + 8F 91 93 97 9E A0 A8 AA AC AE B0 B8 B9 BA BB BC + BD 42 4E 50 56 58 62 64 68 6A 70 72 76 7C 7E 84 + 90 92 94 98 9F A1 A9 AB AD AF B1 BE BF C0 C1 C4 + C5 C6 C7 C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4 + D5 D6 D7 D8 D9 DA DB DC DD DE DF E0 E1 E2 E3 E4 + E5 E6 E7 E8 E9 EA EB EC 85 ED 95 EE EF F0 F1 4B + F2 F3 F4 F5 F6 F7 F8 F9 86 FA 96 FB FC FD FE 4C + 43 6B 45 51 47 49 59 5B 53 5D B2 5F 65 73 6D 77 + 99 7F 81 87 89 8B 8D C2 A2 79 9B A4 A6 B4 B6 9D + 44 6C 46 52 48 4A 5A 5C 54 5E B3 60 66 74 6E 78 + 9A 80 82 88 8A 8C 8E C3 A3 7A 9C A5 A7 B5 B7 FF +</map> +</collation> + + +<collation name="cp1257ltlv"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 47 49 4D 4F 57 59 5D 5F 65 67 6B 6F 71 75 + 79 7B 7D 81 85 87 8D 8F 91 93 95 FF FF FF FF FF + FF 42 48 4A 4E 50 58 5A 5E 60 66 68 6C 70 72 76 + 7A 7C 7E 82 86 88 8E 90 92 94 96 FF FF FF FF FF + FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF + FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF + FF FF FF FF FF FF FF FF FF FF 7F FF FF FF FF FF + FF FF FF FF FF FF FF FF FF FF 80 FF FF FF FF FF + 45 63 43 FF FF FF 53 51 4B FF FF 55 5B 69 61 6D + 83 FF 73 FF 77 FF FF FF 8B FF FF 89 FF 99 97 FF + 46 64 44 FF FF FF 54 52 4C FF FF 56 5C 6A 62 6E + 84 FF 74 FF 78 FF FF FF 8C FF FF 8A FF 9A 98 FF +</map> +</collation> + +</charset> + +</charsets> diff --git a/sql/share/charsets/cp1257ltlvciai.conf b/sql/share/charsets/cp1257ltlvciai.conf deleted file mode 100644 index 246ae4d1fe8..00000000000 --- a/sql/share/charsets/cp1257ltlvciai.conf +++ /dev/null @@ -1,97 +0,0 @@ -# -# cp1257 character set -# -# Case-insensitive, accent insensitive sorting order -# For Latvian and Lithuanian languages -# -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 01 00 01 00 00 00 00 01 - 00 00 00 00 00 00 00 00 02 00 02 00 00 00 00 02 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 00 01 01 01 01 01 01 01 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 00 02 02 02 02 02 02 02 00 - -# to_lower array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 BA AB AC AD AE BF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 BA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 A8 B9 BA BB BC BD BE AF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF - -# sort_order array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 4D 4F 55 57 61 63 67 69 6F 71 75 7B 7D 83 - 8F 91 93 97 9E A0 A8 AA AC AE B0 B8 B9 BA BB BC - BD 41 4D 4F 55 57 61 63 67 69 6F 71 75 7B 7D 83 - 8F 91 93 97 9E A0 A8 AA AC AE B0 BE BF C0 C1 C4 - C5 C6 C7 C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4 - D5 D6 D7 D8 D9 DA DB DC DD DE DF E0 E1 E2 E3 E4 - E5 E6 E7 E8 E9 EA EB EC 83 ED 93 EE EF F0 F1 41 - F2 F3 F4 F5 F6 F7 F8 F9 83 FA 93 FB FC FD FE 41 - 41 69 41 4F 41 41 57 57 4F 57 B0 57 63 71 69 75 - 97 7D 7D 83 83 83 83 C2 A0 75 97 A0 A0 B0 B0 97 - 41 69 41 4F 41 41 57 57 4F 57 B0 57 63 71 69 75 - 97 7D 7D 83 83 83 83 C3 A0 75 97 A0 A0 B0 B0 FF - -# Unicode mapping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 20AC 0000 201A 0000 201E 2026 2020 2021 0000 2030 0000 2039 0000 00A8 02C7 00B8 - 0000 2018 2019 201C 201D 2022 2013 2014 0000 2122 0000 203A 0000 00AF 02DB 0000 - 00A0 0000 00A2 00A3 00A4 0000 00A6 00A7 00D8 00A9 0156 00AB 00AC 00AD 00AE 00C6 - 00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00F8 00B9 0157 00BB 00BC 00BD 00BE 00E6 - 0104 012E 0100 0106 00C4 00C5 0118 0112 010C 00C9 0179 0116 0122 0136 012A 013B - 0160 0143 0145 00D3 014C 00D5 00D6 00D7 0172 0141 015A 016A 00DC 017B 017D 00DF - 0105 012F 0101 0107 00E4 00E5 0119 0113 010D 00E9 017A 0117 0123 0137 012B 013C - 0161 0144 0146 00F3 014D 00F5 00F6 00F7 0173 0142 015B 016B 00FC 017C 017E 02D9 - diff --git a/sql/share/charsets/cp1257ltlvcias.conf b/sql/share/charsets/cp1257ltlvcias.conf deleted file mode 100644 index 6e49f5a245d..00000000000 --- a/sql/share/charsets/cp1257ltlvcias.conf +++ /dev/null @@ -1,97 +0,0 @@ -# -# cp1257 character set -# -# Case-insensitive, accent sensitive sorting order -# For Latvian and Lithuanian languages -# -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 01 00 01 00 00 00 00 01 - 00 00 00 00 00 00 00 00 02 00 02 00 00 00 00 02 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 00 01 01 01 01 01 01 01 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 00 02 02 02 02 02 02 02 00 - -# to_lower array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 BA AB AC AD AE BF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 BA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 A8 B9 BA BB BC BD BE AF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF - -# sort_order array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 4D 4F 55 57 61 63 67 69 6F 71 75 7B 7D 83 - 8F 91 93 97 9E A0 A8 AA AC AE B0 B8 B9 BA BB BC - BD 41 4D 4F 55 57 61 63 67 69 6F 71 75 7B 7D 83 - 8F 91 93 97 9E A0 A8 AA AC AE B0 BE BF C0 C1 C4 - C5 C6 C7 C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4 - D5 D6 D7 D8 D9 DA DB DC DD DE DF E0 E1 E2 E3 E4 - E5 E6 E7 E8 E9 EA EB EC 85 ED 95 EE EF F0 F1 4B - F2 F3 F4 F5 F6 F7 F8 F9 85 FA 95 FB FC FD FE 4B - 43 6B 45 51 47 49 59 5B 53 5D B2 5F 65 73 6D 77 - 99 7F 81 87 89 8B 8D C2 A2 79 9B A4 A6 B4 B6 9D - 43 6B 45 51 47 49 59 5B 53 5D B2 5F 65 73 6D 77 - 99 7F 81 87 89 8B 8D C3 A2 79 9B A4 A6 B4 B6 FF - -# Unicode mapping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 20AC 0000 201A 0000 201E 2026 2020 2021 0000 2030 0000 2039 0000 00A8 02C7 00B8 - 0000 2018 2019 201C 201D 2022 2013 2014 0000 2122 0000 203A 0000 00AF 02DB 0000 - 00A0 0000 00A2 00A3 00A4 0000 00A6 00A7 00D8 00A9 0156 00AB 00AC 00AD 00AE 00C6 - 00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00F8 00B9 0157 00BB 00BC 00BD 00BE 00E6 - 0104 012E 0100 0106 00C4 00C5 0118 0112 010C 00C9 0179 0116 0122 0136 012A 013B - 0160 0143 0145 00D3 014C 00D5 00D6 00D7 0172 0141 015A 016A 00DC 017B 017D 00DF - 0105 012F 0101 0107 00E4 00E5 0119 0113 010D 00E9 017A 0117 0123 0137 012B 013C - 0161 0144 0146 00F3 014D 00F5 00F6 00F7 0173 0142 015B 016B 00FC 017C 017E 02D9 - diff --git a/sql/share/charsets/cp1257ltlvcsas.conf b/sql/share/charsets/cp1257ltlvcsas.conf deleted file mode 100644 index 32cd1390bd5..00000000000 --- a/sql/share/charsets/cp1257ltlvcsas.conf +++ /dev/null @@ -1,97 +0,0 @@ -# -# cp1257 character set -# -# Case-sensitive, accent sensitive sorting order -# For Latvian and Lithuanian languages -# -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 01 00 01 00 00 00 00 01 - 00 00 00 00 00 00 00 00 02 00 02 00 00 00 00 02 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 00 01 01 01 01 01 01 01 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 00 02 02 02 02 02 02 02 00 - -# to_lower array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 BA AB AC AD AE BF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 BA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 A8 B9 BA BB BC BD BE AF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF - -# sort_order array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 4D 4F 55 57 61 63 67 69 6F 71 75 7B 7D 83 - 8F 91 93 97 9E A0 A8 AA AC AE B0 B8 B9 BA BB BC - BD 42 4E 50 56 58 62 64 68 6A 70 72 76 7C 7E 84 - 90 92 94 98 9F A1 A9 AB AD AF B1 BE BF C0 C1 C4 - C5 C6 C7 C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4 - D5 D6 D7 D8 D9 DA DB DC DD DE DF E0 E1 E2 E3 E4 - E5 E6 E7 E8 E9 EA EB EC 85 ED 95 EE EF F0 F1 4B - F2 F3 F4 F5 F6 F7 F8 F9 86 FA 96 FB FC FD FE 4C - 43 6B 45 51 47 49 59 5B 53 5D B2 5F 65 73 6D 77 - 99 7F 81 87 89 8B 8D C2 A2 79 9B A4 A6 B4 B6 9D - 44 6C 46 52 48 4A 5A 5C 54 5E B3 60 66 74 6E 78 - 9A 80 82 88 8A 8C 8E C3 A3 7A 9C A5 A7 B5 B7 FF - -# Unicode mapping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 20AC 0000 201A 0000 201E 2026 2020 2021 0000 2030 0000 2039 0000 00A8 02C7 00B8 - 0000 2018 2019 201C 201D 2022 2013 2014 0000 2122 0000 203A 0000 00AF 02DB 0000 - 00A0 0000 00A2 00A3 00A4 0000 00A6 00A7 00D8 00A9 0156 00AB 00AC 00AD 00AE 00C6 - 00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00F8 00B9 0157 00BB 00BC 00BD 00BE 00E6 - 0104 012E 0100 0106 00C4 00C5 0118 0112 010C 00C9 0179 0116 0122 0136 012A 013B - 0160 0143 0145 00D3 014C 00D5 00D6 00D7 0172 0141 015A 016A 00DC 017B 017D 00DF - 0105 012F 0101 0107 00E4 00E5 0119 0113 010D 00E9 017A 0117 0123 0137 012B 013C - 0161 0144 0146 00F3 014D 00F5 00F6 00F7 0173 0142 015B 016B 00FC 017C 017E 02D9 - diff --git a/sql/share/charsets/cp866.conf b/sql/share/charsets/cp866.xml index 0e4dcb3b9bc..2b050f3c993 100644 --- a/sql/share/charsets/cp866.conf +++ b/sql/share/charsets/cp866.xml @@ -1,9 +1,12 @@ -# -# cp866_DOSCyrillicRussian -# Case insensitive, accent sensitive. -# -# -# ctype array (must be 257 elements) +<?xml version='1.0' encoding="utf-8"?> + +<charsets> + +<charset name="cp866"> +<!-- cp866_DOSCyrillicRussian --> + +<ctype> +<map> 00 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 @@ -21,8 +24,12 @@ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 01 02 01 02 01 02 01 02 00 00 00 00 00 00 00 48 +</map> +</ctype> -# to_lower array (must be 256 elements) + +<lower> +<map> 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F @@ -39,8 +46,12 @@ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF F1 F1 F3 F3 F5 F5 F7 F7 F8 F9 FA FB FC FD FE FF +</map> +</lower> + -# to_upper array (must be 256 elements) +<upper> +<map> 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F @@ -57,26 +68,12 @@ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F F0 F0 F2 F2 F4 F4 F6 F6 F8 F9 FA FB FC FD FE FF +</map> +</upper> -# sort_order array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 43 45 47 49 4B 4D 4F 51 53 55 57 59 5B 5D - 5F 61 63 65 67 69 6B 6D 6F 71 73 BD BE BF C0 C1 - C2 41 43 45 47 49 4B 4D 4F 51 54 55 57 59 5B 5D - 5F 61 63 65 67 69 6B 6D 6F 71 73 C3 C4 C5 C6 C7 - 75 77 79 7B 7D 7F 85 87 89 8D 8F 91 93 95 97 99 - 9B 9D 9F A1 A5 A7 A9 AB AD AF B1 B3 B5 B7 B9 BB - 75 77 79 7B 7D 7F 85 87 89 8D 8F 91 93 95 97 99 - C8 C9 CA D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - 9B 9D 9F A1 A5 A7 A9 AB AD AF B1 B3 B5 B7 B9 BB - 81 81 83 83 8B 8B A3 A3 CB CC CD CE CF D0 D1 D2 -# Unicode mapping (must be 256 elements) +<unicode> +<map> 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F @@ -93,4 +90,33 @@ 2568 2564 2565 2559 2558 2552 2553 256B 256A 2518 250C 2588 2584 258C 2590 2580 0440 0441 0442 0443 0444 0445 0446 0447 0448 0449 044A 044B 044C 044D 044E 044F 0401 0451 0404 0454 0407 0457 040E 045E 00B0 2219 00B7 221A 207F 00B2 25A0 00A0 +</map> +</unicode> + + +<collation name="cp866"> +<!-- Case insensitive, accent sensitive --> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 43 45 47 49 4B 4D 4F 51 53 55 57 59 5B 5D + 5F 61 63 65 67 69 6B 6D 6F 71 73 BD BE BF C0 C1 + C2 41 43 45 47 49 4B 4D 4F 51 54 55 57 59 5B 5D + 5F 61 63 65 67 69 6B 6D 6F 71 73 C3 C4 C5 C6 C7 + 75 77 79 7B 7D 7F 85 87 89 8D 8F 91 93 95 97 99 + 9B 9D 9F A1 A5 A7 A9 AB AD AF B1 B3 B5 B7 B9 BB + 75 77 79 7B 7D 7F 85 87 89 8D 8F 91 93 95 97 99 + C8 C9 CA D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF + 9B 9D 9F A1 A5 A7 A9 AB AD AF B1 B3 B5 B7 B9 BB + 81 81 83 83 8B 8B A3 A3 CB CC CD CE CF D0 D1 D2 +</map> +</collation> + +</charset> + +</charsets> diff --git a/sql/share/charsets/croat.conf b/sql/share/charsets/croat.conf deleted file mode 100644 index bc8c1a376eb..00000000000 --- a/sql/share/charsets/croat.conf +++ /dev/null @@ -1,92 +0,0 @@ -# Configuration file for the croat character set - -# ctype array (must have 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 00 00 00 00 00 00 00 00 00 01 00 00 00 01 00 00 - 00 00 00 00 00 00 00 00 00 02 00 00 00 02 00 00 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 02 - -# to_lower array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 9A 8B 8C 8D 9E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 8A 9B 9C 9D 8E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF - -# sort_order array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 46 48 49 4A 4B 4C 4D 4E 4F 50 51 52 - 53 54 55 56 58 59 5A 5B 5C 5D 5E 5B 5C 5D 5E 5F - 60 41 42 43 46 48 49 4A 4B 4C 4D 4E 4F 50 51 52 - 53 54 55 56 58 59 5A 5B 5C 5D 5E 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 57 8B 8C 8D 5F 8F - 90 91 92 93 94 95 96 97 98 99 57 9B 9C 9D 5F 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - 41 41 41 41 5C 5B 45 43 44 45 45 45 49 49 49 49 - 47 4E 4F 4F 4F 4F 5D D7 D8 55 55 55 59 59 DE DF - 41 41 41 41 5C 5B 45 43 44 45 45 45 49 49 49 49 - 47 4E 4F 4F 4F 4F 5D F7 D8 55 55 55 59 59 DE FF - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F -0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F -0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F -00A0 0104 02D8 0141 00A4 013D 015A 00A7 00A8 0160 015E 0164 0179 00AD 017D 017B -00B0 0105 02DB 0142 00B4 013E 015B 02C7 00B8 0161 015F 0165 017A 02DD 017E 017C -0154 00C1 00C2 0102 00C4 0139 0106 00C7 010C 00C9 0118 00CB 011A 00CD 00CE 010E -0110 0143 0147 00D3 00D4 0150 00D6 00D7 0158 016E 00DA 0170 00DC 00DD 0162 00DF -0155 00E1 00E2 0103 00E4 013A 0107 00E7 010D 00E9 0119 00EB 011B 00ED 00EE 010F -0111 0144 0148 00F3 00F4 0151 00F6 00F7 0159 016F 00FA 0171 00FC 00FD 0163 02D9 diff --git a/sql/share/charsets/danish.conf b/sql/share/charsets/danish.conf deleted file mode 100644 index 1543a64d7c3..00000000000 --- a/sql/share/charsets/danish.conf +++ /dev/null @@ -1,92 +0,0 @@ -# Configuration file for the danish character set - -# ctype array (must have 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 02 - -# to_lower array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF - -# sort_order array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - 41 41 41 41 5B 5D 5B 43 45 45 45 45 49 49 49 49 - 44 4E 4F 4F 4F 4F 5C D7 5C 55 55 55 59 59 DE DF - 41 41 41 41 5B 5D 5B 43 45 45 45 45 49 49 49 49 - 44 4E 4F 4F 4F 4F 5C F7 5C 55 55 55 59 59 DE FF - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F -0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F -0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F -00A0 00A1 00A2 00A3 00A4 00A5 00A6 00A7 00A8 00A9 00AA 00AB 00AC 00AD 00AE 00AF -00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00B8 00B9 00BA 00BB 00BC 00BD 00BE 00BF -00C0 00C1 00C2 00C3 00C4 00C5 00C6 00C7 00C8 00C9 00CA 00CB 00CC 00CD 00CE 00CF -00D0 00D1 00D2 00D3 00D4 00D5 00D6 00D7 00D8 00D9 00DA 00DB 00DC 00DD 00DE 00DF -00E0 00E1 00E2 00E3 00E4 00E5 00E6 00E7 00E8 00E9 00EA 00EB 00EC 00ED 00EE 00EF -00F0 00F1 00F2 00F3 00F4 00F5 00F6 00F7 00F8 00F9 00FA 00FB 00FC 00FD 00FE 00FF diff --git a/sql/share/charsets/dec8.conf b/sql/share/charsets/dec8.xml index d1ffe45032d..4e76bbffd14 100644 --- a/sql/share/charsets/dec8.conf +++ b/sql/share/charsets/dec8.xml @@ -1,6 +1,11 @@ -# Configuration file for the dec8 character set +<?xml version='1.0' encoding="utf-8"?> -# ctype array (must have 257 elements) +<charsets> + +<charset name="dec8"> + +<ctype> +<map> 00 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 @@ -18,8 +23,12 @@ 01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 02 +</map> +</ctype> + -# to_lower array (must have 256 elements) +<lower> +<map> 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F @@ -36,8 +45,12 @@ F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</lower> -# to_upper array (must have 256 elements) + +<upper> +<map> 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F @@ -54,26 +67,12 @@ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF +</map> +</upper> -# sort_order array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - 41 41 41 41 5C 5B 5C 43 45 45 45 45 49 49 49 49 - 44 4E 4F 4F 4F 4F 5D D7 D8 55 55 55 59 59 DE DF - 41 41 41 41 5C 5B 5C 43 45 45 45 45 49 49 49 49 - 44 4E 4F 4F 4F 4F 5D F7 D8 55 55 55 59 59 DE FF -# Unicode mapping (256 elements) +<unicode> +<map> 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F @@ -90,3 +89,33 @@ 0000 00D1 00D2 00D3 00D4 00D5 00D6 0152 00D8 00D9 00DA 00DB 00DC 0178 0000 00DF 00E0 00E1 00E2 00E3 00E4 00E5 00E6 00E7 00E8 00E9 00EA 00EB 00EC 00ED 00EE 00EF 0000 00F1 00F2 00F3 00F4 00F5 00F6 0153 00F8 00F9 00FA 00FB 00FC 00FF 0000 0000 +</map> +</unicode> + + +<collation name="dec8"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF + B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF + 41 41 41 41 5C 5B 5C 43 45 45 45 45 49 49 49 49 + 44 4E 4F 4F 4F 4F 5D D7 D8 55 55 55 59 59 DE DF + 41 41 41 41 5C 5B 5C 43 45 45 45 45 49 49 49 49 + 44 4E 4F 4F 4F 4F 5D F7 D8 55 55 55 59 59 DE FF +</map> +</collation> + + +</charset> + + +</charsets> diff --git a/sql/share/charsets/dos.conf b/sql/share/charsets/dos.conf deleted file mode 100644 index 205202711b8..00000000000 --- a/sql/share/charsets/dos.conf +++ /dev/null @@ -1,93 +0,0 @@ -# Configuration file for the dos (aka cp437 DOSLatinUS) character set - -# ctype array (must have 257 elements) - 00 - 20 30 30 30 30 30 30 20 20 28 28 28 28 28 30 30 - 30 30 30 30 30 30 30 30 30 30 20 30 30 30 30 30 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 30 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 01 01 - 01 02 01 02 02 02 02 02 02 01 01 10 10 10 10 10 - 02 02 02 02 02 01 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 20 - -# to_lower array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 87 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 84 86 - 82 91 91 93 94 95 96 97 98 94 81 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A4 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 9A 90 41 8E 41 8F 80 45 45 45 49 49 49 8E 8F - 90 92 92 4F 99 4F 55 55 59 99 9A 9B 9C 9D 9E 9F - 41 49 4F 55 A5 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# sort_order array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 43 59 45 41 5C 41 5B 43 45 45 45 49 49 49 5C 5B - 45 5C 5C 4F 5D 4F 55 55 59 5D 59 24 24 24 24 24 - 41 49 4F 55 4E 4E A6 A7 3F A9 AA AB AC 21 22 22 - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# Unicode mapping (256 elements) - -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000a 000b 000c 000d 000e 000f -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001a 001b 001c 001d 001e 001f -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002a 002b 002c 002d 002e 002f -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003a 003b 003c 003d 003e 003f -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004a 004b 004c 004d 004e 004f -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005a 005b 005c 005d 005e 005f -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006a 006b 006c 006d 006e 006f -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007a 007b 007c 007d 007e 007f -00c7 00fc 00e9 00e2 00e4 00e0 00e5 00e7 00ea 00eb 00e8 00ef 00ee 00ec 00c4 00c5 -00c9 00e6 00c6 00f4 00f6 00f2 00fb 00f9 00ff 00d6 00dc 00a2 00a3 00a5 20a7 0192 -00e1 00ed 00f3 00fa 00f1 00d1 00aa 00ba 00bf 2310 00ac 00bd 00bc 00a1 00ab 00bb -2591 2592 2593 2502 2524 2561 2562 2556 2555 2563 2551 2557 255d 255c 255b 2510 -2514 2534 252c 251c 2500 253c 255e 255f 255a 2554 2569 2566 2560 2550 256c 2567 -2568 2564 2565 2559 2558 2552 2553 256b 256a 2518 250c 2588 2584 258c 2590 2580 -03b1 00df 0393 03c0 03a3 03c3 00b5 03c4 03a6 0398 03a9 03b4 221e 03c6 03b5 2229 -2261 00b1 2265 2264 2320 2321 00f7 2248 00b0 2219 00b7 221a 207f 00b2 25a0 00a0 diff --git a/sql/share/charsets/estonia.conf b/sql/share/charsets/estonia.conf deleted file mode 100644 index 0226fd1fe82..00000000000 --- a/sql/share/charsets/estonia.conf +++ /dev/null @@ -1,92 +0,0 @@ -# Configuration file for the estonia character set. - -# The ctype array must have 257 elements. - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 02 - -# The to_lower array must have 256 elements. - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 BA AB AC AD AE BF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# The to_upper array must have 256 elements. - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 A8 B9 AA BB BC BD BE AF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF - -# The sort_order array must have 256 elements. - 00 02 03 04 05 06 07 08 09 2E 2F 30 31 32 0A 0B - 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B - 2C 33 34 35 36 37 38 27 39 3A 3B 5D 3C 28 3D 3E - 76 7A 7C 7E 80 81 82 83 84 85 3F 40 5E 5F 60 41 - 42 86 90 92 98 9A A4 A6 AA AC B2 B4 B8 BE C0 C6 - CE D0 D2 D6 E5 E8 EE F0 FA FC DD 43 44 45 46 47 - 48 87 91 93 99 9B A5 A7 AB AD B3 B5 B9 BF C1 C7 - CF D1 D3 D7 E6 E9 EF F1 FB FD DE 49 4A 4B 4C 1C - 01 1D 57 1E 5A 74 71 72 1F 75 20 5B 21 4E 52 51 - 22 55 56 58 59 73 2A 2B 23 E7 24 5C 25 4F 54 26 - 2D FE 66 67 68 FF 4D 69 CC 6A D4 62 6B 29 6C 8E - 6D 61 7D 7F 50 6E 6F 70 CD 7B D5 63 77 78 79 8F - 8C B0 88 94 F4 8A A2 A0 96 9C DF 9E A8 B6 AE BA - DB C2 C4 C8 CA F2 F6 64 EC BC D8 EA F8 E1 E3 DA - 8D B1 89 95 F5 8B A3 A1 97 9D E0 9F A9 B7 AF BB - DC C3 C5 C9 CB F3 F7 65 ED BD D9 EB F9 E2 E4 53 - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F -0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F -0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F -00A0 201D 00A2 00A3 00A4 201E 00A6 00A7 00D8 00A9 0156 00AB 00AC 00AD 00AE 00C6 -00B0 00B1 00B2 00B3 201C 00B5 00B6 00B7 00F8 00B9 0157 00BB 00BC 00BD 00BE 00E6 -0104 012E 0100 0106 00C4 00C5 0118 0112 010C 00C9 0179 0116 0122 0136 012A 013B -0160 0143 0145 00D3 014C 00D5 00D6 00D7 0172 0141 015A 016A 00DC 017B 017D 00DF -0105 012F 0101 0107 00E4 00E5 0119 0113 010D 00E9 017A 0117 0123 0137 012B 013C -0161 0144 0146 00F3 014D 00F5 00F6 00F7 0173 0142 015B 016B 00FC 017C 017E 2019 diff --git a/sql/share/charsets/german1.conf b/sql/share/charsets/german1.conf deleted file mode 100644 index 64f27da3499..00000000000 --- a/sql/share/charsets/german1.conf +++ /dev/null @@ -1,92 +0,0 @@ -# Configuration file for the german1 character set - -# ctype array (must have 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 02 - -# to_lower array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF - -# sort_order array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - 41 41 41 41 41 41 41 43 45 45 45 45 49 49 49 49 - D0 4E 4F 4F 4F 4F 4F D7 4F 55 55 55 55 59 DE 53 - 41 41 41 41 41 41 41 43 45 45 45 45 49 49 49 49 - D0 4E 4F 4F 4F 4F 4F F7 4F 55 55 55 55 59 DE FF - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F -0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F -0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F -00A0 00A1 00A2 00A3 00A4 00A5 00A6 00A7 00A8 00A9 00AA 00AB 00AC 00AD 00AE 00AF -00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00B8 00B9 00BA 00BB 00BC 00BD 00BE 00BF -00C0 00C1 00C2 00C3 00C4 00C5 00C6 00C7 00C8 00C9 00CA 00CB 00CC 00CD 00CE 00CF -00D0 00D1 00D2 00D3 00D4 00D5 00D6 00D7 00D8 00D9 00DA 00DB 00DC 00DD 00DE 00DF -00E0 00E1 00E2 00E3 00E4 00E5 00E6 00E7 00E8 00E9 00EA 00EB 00EC 00ED 00EE 00EF -00F0 00F1 00F2 00F3 00F4 00F5 00F6 00F7 00F8 00F9 00FA 00FB 00FC 00FD 00FE 00FF diff --git a/sql/share/charsets/greek.conf b/sql/share/charsets/greek.conf deleted file mode 100644 index 5eb38e2efbe..00000000000 --- a/sql/share/charsets/greek.conf +++ /dev/null @@ -1,93 +0,0 @@ -# Configuration file for the greek character set - -# ctype array (must have 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 48 10 10 10 00 00 10 10 10 10 00 10 10 10 00 10 - 10 10 10 10 10 10 01 10 01 01 01 10 01 10 01 01 - 02 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 00 01 01 01 01 01 01 01 01 01 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 00 - -# to_lower array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 DC B7 DD DE DF BB FC BD FD FE - C0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 D2 F3 F4 F5 F6 F7 F8 F9 FA FB DC DD DE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - DA C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB C1 C5 C7 C9 - DB C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D3 D3 D4 D5 D6 D7 D8 D9 DA DB CF D5 D9 FF - -# sort_order array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 C1 B7 C5 C7 C9 BB CF BD D5 D9 - C9 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 C9 D5 C1 C5 C7 C9 - D5 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D3 D3 D4 D5 D6 D7 D8 D9 C9 D5 CF D5 D9 FF - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F -0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F -0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F -00A0 02BD 02BC 00A3 0000 0000 00A6 00A7 00A8 00A9 0000 00AB 00AC 00AD 0000 2015 -00B0 00B1 00B2 00B3 0384 0385 0386 00B7 0388 0389 038A 00BB 038C 00BD 038E 038F -0390 0391 0392 0393 0394 0395 0396 0397 0398 0399 039A 039B 039C 039D 039E 039F -03A0 03A1 0000 03A3 03A4 03A5 03A6 03A7 03A8 03A9 03AA 03AB 03AC 03AD 03AE 03AF -03B0 03B1 03B2 03B3 03B4 03B5 03B6 03B7 03B8 03B9 03BA 03BB 03BC 03BD 03BE 03BF -03C0 03C1 03C2 03C3 03C4 03C5 03C6 03C7 03C8 03C9 03CA 03CB 03CC 03CD 03CE 0000 -
\ No newline at end of file diff --git a/sql/share/charsets/greek.xml b/sql/share/charsets/greek.xml new file mode 100644 index 00000000000..eeb22236675 --- /dev/null +++ b/sql/share/charsets/greek.xml @@ -0,0 +1,120 @@ +<?xml version='1.0' encoding="utf-8"?> + +<charsets> + +<charset name="greek"> + +<ctype> +<map> + 00 + 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 + 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 + 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 48 10 10 10 00 00 10 10 10 10 00 10 10 10 00 10 + 10 10 10 10 10 10 01 10 01 01 01 10 01 10 01 01 + 02 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 + 01 01 00 01 01 01 01 01 01 01 01 01 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 00 + </map> +</ctype> + + +<lower> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF + B0 B1 B2 B3 B4 B5 DC B7 DD DE DF BB FC BD FD FE + C0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 D2 F3 F4 F5 F6 F7 F8 F9 FA FB DC DD DE DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</lower> + + +<upper> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF + B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF + DA C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF + D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB C1 C5 C7 C9 + DB C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF + D0 D1 D3 D3 D4 D5 D6 D7 D8 D9 DA DB CF D5 D9 FF +</map> +</upper> + + +<unicode> +<map> +0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F +0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F +0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F +0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F +0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F +0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F +0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F +0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F +0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F +0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F +00A0 02BD 02BC 00A3 0000 0000 00A6 00A7 00A8 00A9 0000 00AB 00AC 00AD 0000 2015 +00B0 00B1 00B2 00B3 0384 0385 0386 00B7 0388 0389 038A 00BB 038C 00BD 038E 038F +0390 0391 0392 0393 0394 0395 0396 0397 0398 0399 039A 039B 039C 039D 039E 039F +03A0 03A1 0000 03A3 03A4 03A5 03A6 03A7 03A8 03A9 03AA 03AB 03AC 03AD 03AE 03AF +03B0 03B1 03B2 03B3 03B4 03B5 03B6 03B7 03B8 03B9 03BA 03BB 03BC 03BD 03BE 03BF +03C0 03C1 03C2 03C3 03C4 03C5 03C6 03C7 03C8 03C9 03CA 03CB 03CC 03CD 03CE 0000 +</map> +</unicode> + + +<collation name="greek"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF + B0 B1 B2 B3 B4 B5 C1 B7 C5 C7 C9 BB CF BD D5 D9 + C9 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF + D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 C9 D5 C1 C5 C7 C9 + D5 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF + D0 D1 D3 D3 D4 D5 D6 D7 D8 D9 C9 D5 CF D5 D9 FF +</map> +</collation> + +</charset> + +</charsets> + diff --git a/sql/share/charsets/hebrew.conf b/sql/share/charsets/hebrew.conf deleted file mode 100644 index 84581f6f1bb..00000000000 --- a/sql/share/charsets/hebrew.conf +++ /dev/null @@ -1,93 +0,0 @@ -# Configuration file for the hebrew character set - -# ctype array (must have 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 00 00 00 00 00 - -# to_lower array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# sort_order array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F -0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F -0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F -00A0 0000 00A2 00A3 00A4 00A5 00A6 00A7 00A8 00A9 00D7 00AB 00AC 00AD 00AE 203E -00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00B8 00B9 00F7 00BB 00BC 00BD 00BE 0000 -0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 -0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 2017 -05D0 05D1 05D2 05D3 05D4 05D5 05D6 05D7 05D8 05D9 05DA 05DB 05DC 05DD 05DE 05DF -05E0 05E1 05E2 05E3 05E4 05E5 05E6 05E7 05E8 05E9 05EA 0000 0000 0000 0000 0000 -
\ No newline at end of file diff --git a/sql/share/charsets/latin1bin.conf b/sql/share/charsets/hebrew.xml index 37e6350bcb2..3bf8bec370e 100644 --- a/sql/share/charsets/latin1bin.conf +++ b/sql/share/charsets/hebrew.xml @@ -1,9 +1,11 @@ -# -# Latin1, accent sensitive, case sensitive -# -# Binary sorting order -# -# ctype array (must be 257 elements) +<?xml version='1.0' encoding="utf-8"?> + +<charsets> + +<charset name="hebrew"> + +<ctype> +<map> 00 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 @@ -13,16 +15,20 @@ 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 00 01 01 01 01 01 01 01 02 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 00 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 00 00 00 00 00 + </map> +</ctype> + -# to_lower array (must be 256 elements) +<lower> +<map> 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F @@ -35,12 +41,16 @@ 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF + C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF + D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</lower> + -# to_upper array (must be 256 elements) +<upper> +<map> 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F @@ -55,42 +65,56 @@ B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</upper> + -# sort_order array (must be 256 elements) +<unicode> +<map> +0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F +0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F +0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F +0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F +0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F +0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F +0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F +0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F +0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F +0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F +00A0 0000 00A2 00A3 00A4 00A5 00A6 00A7 00A8 00A9 00D7 00AB 00AC 00AD 00AE 203E +00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00B8 00B9 00F7 00BB 00BC 00BD 00BE 0000 +0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 +0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 2017 +05D0 05D1 05D2 05D3 05D4 05D5 05D6 05D7 05D8 05D9 05DA 05DB 05DC 05DD 05DE 05DF +05E0 05E1 05E2 05E3 05E4 05E5 05E6 05E7 05E8 05E9 05EA 0000 0000 0000 0000 0000 +</map> +</unicode> + + +<collation name="hebrew"> +<map> 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF + D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</collation> + +</charset> -# Unicode mapping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F - 0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F - 00A0 00A1 00A2 00A3 00A4 00A5 00A6 00A7 00A8 00A9 00AA 00AB 00AC 00AD 00AE 00AF - 00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00B8 00B9 00BA 00BB 00BC 00BD 00BE 00BF - 00C0 00C1 00C2 00C3 00C4 00C5 00C6 00C7 00C8 00C9 00CA 00CB 00CC 00CD 00CE 00CF - 00D0 00D1 00D2 00D3 00D4 00D5 00D6 00D7 00D8 00D9 00DA 00DB 00DC 00DD 00DE 00DF - 00E0 00E1 00E2 00E3 00E4 00E5 00E6 00E7 00E8 00E9 00EA 00EB 00EC 00ED 00EE 00EF - 00F0 00F1 00F2 00F3 00F4 00F5 00F6 00F7 00F8 00F9 00FA 00FB 00FC 00FD 00FE 00FF +</charsets> diff --git a/sql/share/charsets/hp8.conf b/sql/share/charsets/hp8.conf deleted file mode 100644 index 07036d6f186..00000000000 --- a/sql/share/charsets/hp8.conf +++ /dev/null @@ -1,93 +0,0 @@ -# Configuration file for the hp8 character set - -# ctype array (must have 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 20 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 20 20 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 02 10 10 10 10 10 10 02 10 02 02 - 01 10 10 01 02 10 10 02 01 10 01 01 01 10 10 10 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 20 20 20 20 10 10 10 10 10 10 10 10 10 20 - -# to_lower array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 C8 C0 C9 C1 CD D1 DD A8 A9 AA AB AC CB C3 AF - B0 B2 B2 B3 B5 B5 B7 B7 B8 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D4 D1 D6 D7 D4 D5 D6 D7 CC D9 CE CF C5 DD DE C2 - C4 E2 E2 E4 E4 D5 D9 C6 CA EA EA EC EC C7 EF EF - F1 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B1 B3 B4 B4 B6 B6 B8 B9 BA BB BC BD BE BF - A2 A4 DF AE E0 DC E7 ED A1 A3 E8 AD D8 A5 DA DB - D0 A6 D2 D3 D0 E5 D2 D3 D8 E6 DA DB DC A7 DE DF - E0 E1 E1 E3 E3 E5 E6 E7 E8 E9 E9 EB EB ED EE EE - F0 F0 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# sort_order array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5C 5D 5B 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F -0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F -0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F -00A0 00C0 00C2 00C8 00CA 00CB 00CE 00CF 00B4 02CB 02C6 00A8 02DC 00D9 00DB 20A4 -00AF 00DD 00FD 00B0 00C7 00E7 00D1 00F1 00A1 00BF 00A4 00A3 00A5 00A7 0192 00A2 -00E2 00EA 00F4 00FB 00E1 00E9 00F3 00FA 00E0 00E8 00F2 00F9 00E4 00EB 00F6 00FC -00C5 00EE 00D8 00C6 00E5 00ED 00F8 00E6 00C4 00EC 00D6 00DC 00C9 00EF 00DF 00D4 -00C1 00C3 00E3 00D0 00F0 00CD 00CC 00D3 00D2 00D5 00F5 0160 0161 00DA 0178 00FF -00DE 00FE 00B7 00B5 00B6 00BE 2014 00BC 00BD 00AA 00BA 00AB 25A0 00BB 00B1 0000 - diff --git a/sql/share/charsets/hp8.xml b/sql/share/charsets/hp8.xml new file mode 100644 index 00000000000..036f1cd067c --- /dev/null +++ b/sql/share/charsets/hp8.xml @@ -0,0 +1,120 @@ +<?xml version='1.0' encoding="utf-8"?> + +<charsets> + +<charset name="hp8"> + +<ctype> +<map> + 00 + 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 + 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 + 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 10 20 20 10 10 10 10 10 10 10 10 10 10 10 10 10 + 10 10 10 10 10 02 10 10 10 10 10 10 02 10 02 02 + 01 10 10 01 02 10 10 02 01 10 01 01 01 10 10 10 + 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 10 10 20 20 20 20 10 10 10 10 10 10 10 10 10 20 +</map> +</ctype> + + +<lower> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 C8 C0 C9 C1 CD D1 DD A8 A9 AA AB AC CB C3 AF + B0 B2 B2 B3 B5 B5 B7 B7 B8 B9 BA BB BC BD BE BF + C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF + D4 D1 D6 D7 D4 D5 D6 D7 CC D9 CE CF C5 DD DE C2 + C4 E2 E2 E4 E4 D5 D9 C6 CA EA EA EC EC C7 EF EF + F1 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</lower> + + +<upper> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF + B0 B1 B1 B3 B4 B4 B6 B6 B8 B9 BA BB BC BD BE BF + A2 A4 DF AE E0 DC E7 ED A1 A3 E8 AD D8 A5 DA DB + D0 A6 D2 D3 D0 E5 D2 D3 D8 E6 DA DB DC A7 DE DF + E0 E1 E1 E3 E3 E5 E6 E7 E8 E9 E9 EB EB ED EE EE + F0 F0 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</upper> + + +<unicode> +<map> +0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F +0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F +0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F +0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F +0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F +0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F +0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F +0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F +0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F +0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F +00A0 00C0 00C2 00C8 00CA 00CB 00CE 00CF 00B4 02CB 02C6 00A8 02DC 00D9 00DB 20A4 +00AF 00DD 00FD 00B0 00C7 00E7 00D1 00F1 00A1 00BF 00A4 00A3 00A5 00A7 0192 00A2 +00E2 00EA 00F4 00FB 00E1 00E9 00F3 00FA 00E0 00E8 00F2 00F9 00E4 00EB 00F6 00FC +00C5 00EE 00D8 00C6 00E5 00ED 00F8 00E6 00C4 00EC 00D6 00DC 00C9 00EF 00DF 00D4 +00C1 00C3 00E3 00D0 00F0 00CD 00CC 00D3 00D2 00D5 00F5 0160 0161 00DA 0178 00FF +00DE 00FE 00B7 00B5 00B6 00BE 2014 00BC 00BD 00AA 00BA 00AB 25A0 00BB 00B1 0000 + +</map> +</unicode> + + +<collation name="hp8"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5C 5D 5B 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF + B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF + C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF + D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</collation> + +</charset> + +</charsets> diff --git a/sql/share/charsets/hungarian.conf b/sql/share/charsets/hungarian.conf deleted file mode 100644 index dffaff9348d..00000000000 --- a/sql/share/charsets/hungarian.conf +++ /dev/null @@ -1,92 +0,0 @@ -# Configuration file for the hungarian character set - -# ctype array (must have 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 48 - 01 10 01 10 01 01 10 00 00 01 01 01 01 10 01 01 - 10 02 10 02 10 02 02 10 10 02 02 02 02 10 02 02 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 10 01 01 01 01 01 01 10 01 01 01 01 01 01 01 10 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 10 - -# to_lower array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8B 8B A1 A1 8E A0 - 82 91 92 93 94 A2 96 A3 96 94 81 9B 9C 9D 9E 9F - A0 A1 A2 A3 B5 B6 A6 93 A8 B9 BA BB BC AD BE BF - B0 B1 B2 B3 B4 E1 B6 B7 B8 B9 BA BB BC BD BE BF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - D0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF - A2 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA 96 EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 9A 90 83 84 85 86 87 88 89 8A 8A 8C 8D 8E 8F - 90 91 92 A7 99 95 98 97 98 99 9A 9B 9C 9D 9E 9F - 8F 8D 95 97 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 A0 B2 A2 B4 B5 A5 B7 B8 A9 AA AB AC BD AE AF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - E0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA EB CC CD CE CF - F0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF - -# sort_order array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 47 48 4C 4E 53 54 55 56 5A 5B 5C 60 61 64 - 69 6A 6B 6E 72 75 7A 7B 7C 7D 7F 83 84 85 86 87 - 88 41 47 48 4C 4E 53 54 55 56 5A 5B 5C 60 61 64 - 69 6A 6B 6E 72 75 7A 7B 7C 7D 7F 89 8A 8B 8C 00 - 01 78 4E 04 05 06 07 08 09 0A 67 67 56 56 0F 41 - 4E 12 13 67 67 64 78 75 78 67 78 1C 1D 1E 1F FF - 41 56 64 75 5E 6F FF 67 FF 70 71 73 80 FF 81 82 - FF 42 FF 5D FF 41 6F FF FF 70 71 73 80 FF 81 82 - 6C 41 44 45 46 5F 49 4B 4A 4E 51 52 50 56 57 4D - FF 62 63 64 66 67 67 FF 6D 77 75 78 78 7E 74 FF - 64 41 44 45 46 5F 49 4B 4A 4E 51 78 50 56 58 4D - FF 62 63 64 66 67 67 FF 6D 77 75 78 78 7E 74 FF - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F -0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F -0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F -00A0 0104 02D8 0141 00A4 013D 015A 00A7 00A8 0160 015E 0164 0179 00AD 017D 017B -00B0 0105 02DB 0142 00B4 013E 015B 02C7 00B8 0161 015F 0165 017A 02DD 017E 017C -0154 00C1 00C2 0102 00C4 0139 0106 00C7 010C 00C9 0118 00CB 011A 00CD 00CE 010E -0110 0143 0147 00D3 00D4 0150 00D6 00D7 0158 016E 00DA 0170 00DC 00DD 0162 00DF -0155 00E1 00E2 0103 00E4 013A 0107 00E7 010D 00E9 0119 00EB 011B 00ED 00EE 010F -0111 0144 0148 00F3 00F4 0151 00F6 00F7 0159 016F 00FA 0171 00FC 00FD 0163 02D9 diff --git a/sql/share/charsets/keybcs2.conf b/sql/share/charsets/keybcs2.xml index f272960b683..bdbb364822f 100644 --- a/sql/share/charsets/keybcs2.conf +++ b/sql/share/charsets/keybcs2.xml @@ -1,4 +1,11 @@ -# ctype array (must be 257 elements) +<?xml version='1.0' encoding="utf-8"?> + +<charsets> + +<charset name="keybcs2"> + +<ctype> +<map> 00 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 @@ -16,8 +23,12 @@ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 02 01 02 01 02 00 02 01 01 01 02 00 02 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 +</map> +</ctype> -# to_lower array (must be 256 elements) + +<lower> +<map> 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F @@ -34,8 +45,12 @@ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF E0 E1 E2 E3 E4 E5 E6 E7 ED E9 EA EB EC ED EE EF F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</lower> + -# to_upper array (must be 256 elements) +<upper> +<map> 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F @@ -52,26 +67,12 @@ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC E8 EE EF F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</upper> -# sort_order array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 44 45 47 49 50 51 52 53 54 55 56 57 58 5A - 5E 5F 60 63 66 68 6C 6D 6E 6F 72 90 91 92 93 94 - 95 41 44 45 47 49 50 51 52 53 54 55 56 57 58 5A - 5E 5F 60 63 66 68 6C 6D 6E 6F 72 96 97 98 99 9A - 45 68 49 47 41 47 66 45 49 49 56 53 56 56 41 41 - 49 72 72 5A 5A 5A 68 68 6F 5A 68 63 56 6F 60 66 - 41 53 5A 68 58 58 68 5A 63 60 60 60 A0 A1 A2 A3 - A4 A5 A6 B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC - BD BE BF C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC - CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC - 80 65 83 87 88 89 DD 8A 85 8B 84 81 DE 85 82 DF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF -# Unicode mappping (must be 256 elements) +<unicode> +<map> 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F @@ -88,4 +89,32 @@ 2568 2564 2565 2559 2558 2552 2553 256B 256A 2518 250C 2588 2584 258C 2590 2580 03B1 00DF 0393 03C0 03A3 03C3 00B5 03C4 03A6 0398 03A9 03B4 221E 03C6 03B5 2229 2261 00B1 2265 2264 2320 2321 00F7 2248 00B0 2219 00B7 221A 207F 00B2 25A0 00A0 +</map> +</unicode> + + +<collation name="keybcs2"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 44 45 47 49 50 51 52 53 54 55 56 57 58 5A + 5E 5F 60 63 66 68 6C 6D 6E 6F 72 90 91 92 93 94 + 95 41 44 45 47 49 50 51 52 53 54 55 56 57 58 5A + 5E 5F 60 63 66 68 6C 6D 6E 6F 72 96 97 98 99 9A + 45 68 49 47 41 47 66 45 49 49 56 53 56 56 41 41 + 49 72 72 5A 5A 5A 68 68 6F 5A 68 63 56 6F 60 66 + 41 53 5A 68 58 58 68 5A 63 60 60 60 A0 A1 A2 A3 + A4 A5 A6 B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC + BD BE BF C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC + CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC + 80 65 83 87 88 89 DD 8A 85 8B 84 81 DE 85 82 DF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</collation> + +</charset> + +</charsets> diff --git a/sql/share/charsets/koi8_ru.conf b/sql/share/charsets/koi8_ru.conf deleted file mode 100644 index b1d9755173f..00000000000 --- a/sql/share/charsets/koi8_ru.conf +++ /dev/null @@ -1,93 +0,0 @@ -# Configuration file for the koi8_ru character set - -# ctype array (must have 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 02 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 01 10 10 10 10 10 10 10 10 10 10 10 10 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - -# to_lower array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 A3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - -# to_upper array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 B3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# sort_order array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 E5 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE - AF B0 B1 E5 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD - FE DF E0 F6 E3 E4 F4 E2 F5 E8 E9 EA EB EC ED EE - EF FF F0 F1 F2 F3 E6 E1 FC FB E7 F8 FD F9 F7 FA - FE DF E0 F6 E3 E4 F4 E2 F5 E8 E9 EA EB EC ED EE - EF FF F0 F1 F2 F3 E6 E1 FC FB E7 F8 FD F9 F7 FA - -# Unicode mapping table (256 elements) - -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000a 000b 000c 000d 000e 000f -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001a 001b 001c 001d 001e 001f -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002a 002b 002c 002d 002e 002f -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003a 003b 003c 003d 003e 003f -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004a 004b 004c 004d 004e 004f -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005a 005b 005c 005d 005e 005f -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006a 006b 006c 006d 006e 006f -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007a 007b 007c 007d 007e 007f -2500 2502 250c 2510 2514 2518 251c 2524 252c 2534 253c 2580 2584 2588 258c 2590 -2591 2592 2593 2320 25a0 2219 221a 2248 2264 2265 00a0 2321 00b0 00b2 00b7 00f7 -2550 2551 2552 0451 2553 2554 2555 2556 2557 2558 2559 255a 255b 255c 255d 255e -255f 2560 2561 0401 2562 2563 2564 2565 2566 2567 2568 2569 256a 256b 256c 00a9 -044e 0430 0431 0446 0434 0435 0444 0433 0445 0438 0439 043a 043b 043c 043d 043e -043f 044f 0440 0441 0442 0443 0436 0432 044c 044b 0437 0448 044d 0449 0447 044a -042e 0410 0411 0426 0414 0415 0424 0413 0425 0418 0419 041a 041b 041c 041d 041e -041f 042f 0420 0421 0422 0423 0416 0412 042c 042b 0417 0428 042d 0429 0427 042a diff --git a/sql/share/charsets/koi8r.xml b/sql/share/charsets/koi8r.xml new file mode 100644 index 00000000000..dae780f14fc --- /dev/null +++ b/sql/share/charsets/koi8r.xml @@ -0,0 +1,119 @@ +<?xml version='1.0' encoding="utf-8"?> + +<charsets> + +<charset name="koi8r"> + +<ctype> +<map> + 00 + 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 + 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 + 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 + 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 10 10 10 02 10 10 10 10 10 10 10 10 10 10 10 10 + 10 10 10 01 10 10 10 10 10 10 10 10 10 10 10 10 + 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 + 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 +</map> +</ctype> + + +<lower> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF + B0 B1 B2 A3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF + C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF + D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF + C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF + D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF +</map> +</lower> + + +<upper> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 B3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF + B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</upper> + + +<unicode> +<map> +0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000a 000b 000c 000d 000e 000f +0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001a 001b 001c 001d 001e 001f +0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002a 002b 002c 002d 002e 002f +0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003a 003b 003c 003d 003e 003f +0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004a 004b 004c 004d 004e 004f +0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005a 005b 005c 005d 005e 005f +0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006a 006b 006c 006d 006e 006f +0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007a 007b 007c 007d 007e 007f +2500 2502 250c 2510 2514 2518 251c 2524 252c 2534 253c 2580 2584 2588 258c 2590 +2591 2592 2593 2320 25a0 2219 221a 2248 2264 2265 00a0 2321 00b0 00b2 00b7 00f7 +2550 2551 2552 0451 2553 2554 2555 2556 2557 2558 2559 255a 255b 255c 255d 255e +255f 2560 2561 0401 2562 2563 2564 2565 2566 2567 2568 2569 256a 256b 256c 00a9 +044e 0430 0431 0446 0434 0435 0444 0433 0445 0438 0439 043a 043b 043c 043d 043e +043f 044f 0440 0441 0442 0443 0436 0432 044c 044b 0437 0448 044d 0449 0447 044a +042e 0410 0411 0426 0414 0415 0424 0413 0425 0418 0419 041a 041b 041c 041d 041e +041f 042f 0420 0421 0422 0423 0416 0412 042c 042b 0417 0428 042d 0429 0427 042a +</map> +</unicode> + + +<collation name="koi8r"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 E5 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE + AF B0 B1 E5 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD + FE DF E0 F6 E3 E4 F4 E2 F5 E8 E9 EA EB EC ED EE + EF FF F0 F1 F2 F3 E6 E1 FC FB E7 F8 FD F9 F7 FA + FE DF E0 F6 E3 E4 F4 E2 F5 E8 E9 EA EB EC ED EE + EF FF F0 F1 F2 F3 E6 E1 FC FB E7 F8 FD F9 F7 FA +</map> +</collation> + +</charset> + +</charsets> diff --git a/sql/share/charsets/koi8_ukr.conf b/sql/share/charsets/koi8u.xml index 5a552900544..e6cba068997 100644 --- a/sql/share/charsets/koi8_ukr.conf +++ b/sql/share/charsets/koi8u.xml @@ -1,6 +1,11 @@ -# Configuration file for the koi8_ukr character set +<?xml version='1.0' encoding="utf-8"?> -# ctype array (must have 257 elements) +<charsets> + +<charset name="koi8u"> + +<ctype> +<map> 00 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 @@ -18,8 +23,12 @@ 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 +</map> +</ctype> + -# to_lower array (must have 256 elements) +<lower> +<map> 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F @@ -36,8 +45,12 @@ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF +</map> +</lower> -# to_upper array (must have 256 elements) + +<upper> +<map> 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F @@ -54,26 +67,12 @@ F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</upper> -# sort_order array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 20 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - A5 A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 B3 B4 - B5 B6 B7 B8 B9 BA BB BC BD BE BF C0 C1 C2 C3 C4 - C5 C6 C7 88 87 C8 8C 8D C9 CA CB CC CD 84 CE CF - D0 D1 D2 88 87 D3 8C 8D D4 D5 D6 D7 D8 84 D9 DA - A3 80 81 9B 85 86 99 83 9A 8B 8E 8F 90 91 92 93 - 94 A4 95 96 97 98 89 82 A1 A0 8A 9D A2 9E 9C 9F - A3 80 81 9B 85 86 99 83 9A 8B 8E 8F 90 91 92 93 - 94 A4 95 96 97 98 89 82 A1 A0 8A 9D A2 9E 9C 9F -# Unicode mapping (256 elements) +<unicode> +<map> 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F @@ -90,3 +89,32 @@ 043F 044F 0440 0441 0442 0443 0436 0432 044C 044B 0437 0448 044D 0449 0447 044A 042E 0410 0411 0426 0414 0415 0424 0413 0425 0418 0419 041A 041B 041C 041D 041E 041F 042F 0420 0421 0422 0423 0416 0412 042C 042B 0417 0428 042D 0429 0427 042A +</map> +</unicode> + + +<collation name="koi8u"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 20 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + A5 A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 B3 B4 + B5 B6 B7 B8 B9 BA BB BC BD BE BF C0 C1 C2 C3 C4 + C5 C6 C7 88 87 C8 8C 8D C9 CA CB CC CD 84 CE CF + D0 D1 D2 88 87 D3 8C 8D D4 D5 D6 D7 D8 84 D9 DA + A3 80 81 9B 85 86 99 83 9A 8B 8E 8F 90 91 92 93 + 94 A4 95 96 97 98 89 82 A1 A0 8A 9D A2 9E 9C 9F + A3 80 81 9B 85 86 99 83 9A 8B 8E 8F 90 91 92 93 + 94 A4 95 96 97 98 89 82 A1 A0 8A 9D A2 9E 9C 9F +</map> +</collation> + +</charset> + +</charsets> + diff --git a/sql/share/charsets/latin1.conf b/sql/share/charsets/latin1.conf deleted file mode 100644 index 7cb5cfb3cfd..00000000000 --- a/sql/share/charsets/latin1.conf +++ /dev/null @@ -1,92 +0,0 @@ -# Configuration file for the latin1 character set - -# ctype array (must have 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 02 - -# to_lower array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF - -# sort_order array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - 41 41 41 41 5C 5B 5C 43 45 45 45 45 49 49 49 49 - 44 4E 4F 4F 4F 4F 5D D7 D8 55 55 55 59 59 DE DF - 41 41 41 41 5C 5B 5C 43 45 45 45 45 49 49 49 49 - 44 4E 4F 4F 4F 4F 5D F7 D8 55 55 55 59 59 DE FF - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F -0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F -0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F -00A0 00A1 00A2 00A3 00A4 00A5 00A6 00A7 00A8 00A9 00AA 00AB 00AC 00AD 00AE 00AF -00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00B8 00B9 00BA 00BB 00BC 00BD 00BE 00BF -00C0 00C1 00C2 00C3 00C4 00C5 00C6 00C7 00C8 00C9 00CA 00CB 00CC 00CD 00CE 00CF -00D0 00D1 00D2 00D3 00D4 00D5 00D6 00D7 00D8 00D9 00DA 00DB 00DC 00DD 00DE 00DF -00E0 00E1 00E2 00E3 00E4 00E5 00E6 00E7 00E8 00E9 00EA 00EB 00EC 00ED 00EE 00EF -00F0 00F1 00F2 00F3 00F4 00F5 00F6 00F7 00F8 00F9 00FA 00FB 00FC 00FD 00FE 00FF diff --git a/sql/share/charsets/latin1.xml b/sql/share/charsets/latin1.xml new file mode 100644 index 00000000000..c14e369454e --- /dev/null +++ b/sql/share/charsets/latin1.xml @@ -0,0 +1,233 @@ +<?xml version='1.0' encoding="utf-8"?> + +<charsets> + +<charset name="latin1"> + +<ctype> +<map> + 00 + 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 + 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 + 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 00 01 01 01 01 01 01 01 02 + 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 00 02 02 02 02 02 02 02 02 +</map> +</ctype> + + +<lower> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF + B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</lower> + + +<upper> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF + B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF + C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF + D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF + C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF + D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF +</map> +</upper> + + +<unicode> +<map> + 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F + 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F + 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F + 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F + 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F + 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F + 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F + 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F + 0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F + 0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F + 00A0 00A1 00A2 00A3 00A4 00A5 00A6 00A7 00A8 00A9 00AA 00AB 00AC 00AD 00AE 00AF + 00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00B8 00B9 00BA 00BB 00BC 00BD 00BE 00BF + 00C0 00C1 00C2 00C3 00C4 00C5 00C6 00C7 00C8 00C9 00CA 00CB 00CC 00CD 00CE 00CF + 00D0 00D1 00D2 00D3 00D4 00D5 00D6 00D7 00D8 00D9 00DA 00DB 00DC 00DD 00DE 00DF + 00E0 00E1 00E2 00E3 00E4 00E5 00E6 00E7 00E8 00E9 00EA 00EB 00EC 00ED 00EE 00EF + 00F0 00F1 00F2 00F3 00F4 00F5 00F6 00F7 00F8 00F9 00FA 00FB 00FC 00FD 00FE 00FF +</map> +</unicode> + + +<collation name="latin1"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF + B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF + 41 41 41 41 5C 5B 5C 43 45 45 45 45 49 49 49 49 + 44 4E 4F 4F 4F 4F 5D D7 D8 55 55 55 59 59 DE DF + 41 41 41 41 5C 5B 5C 43 45 45 45 45 49 49 49 49 + 44 4E 4F 4F 4F 4F 5D F7 D8 55 55 55 59 59 DE FF +</map> +</collation> + + +<collation name="german1"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF + B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF + 41 41 41 41 41 41 41 43 45 45 45 45 49 49 49 49 + D0 4E 4F 4F 4F 4F 4F D7 4F 55 55 55 55 59 DE 53 + 41 41 41 41 41 41 41 43 45 45 45 45 49 49 49 49 + D0 4E 4F 4F 4F 4F 4F F7 4F 55 55 55 55 59 DE FF +</map> +</collation> + + +<collation name="danish"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF + B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF + 41 41 41 41 5B 5D 5B 43 45 45 45 45 49 49 49 49 + 44 4E 4F 4F 4F 4F 5C D7 5C 55 55 55 59 59 DE DF + 41 41 41 41 5B 5D 5B 43 45 45 45 45 49 49 49 49 + 44 4E 4F 4F 4F 4F 5C F7 5C 55 55 55 59 59 DE FF +</map> +</collation> + + +<collation name="latin1_de"/> + + +<collation name="latin1_bin"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF + B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF + C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF + D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</collation> + + +<collation name="latin1_ci_as"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 51 53 57 5B 65 67 69 6B 75 77 79 7B 7D 81 + 8F 91 93 95 98 9A A4 A6 A8 AA AF B3 B4 B5 B6 B7 + B8 41 51 53 57 5B 65 67 69 6B 75 77 79 7B 7D 81 + 8F 91 93 95 98 9A A4 A6 A8 AA AF B9 BA BB BC BF + C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF + D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF + 43 45 47 49 4B 4D 4F 55 5D 5F 61 63 6D 6F 71 73 + 59 7F 83 85 87 89 8B BD 8D 9C 9E A0 A2 AC B1 97 + 43 45 47 49 4B 4D 4F 55 5D 5F 61 63 6D 6F 71 73 + 59 7F 83 85 87 89 8B BE 8D 9C 9E A0 A2 AC B1 AE +</map> +</collation> + + +<collation name="latin1_cs_as"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 51 53 57 5B 65 67 69 6B 75 77 79 7B 7D 81 + 8F 91 93 95 98 9A A4 A6 A8 AA AF B3 B4 B5 B6 B7 + B8 42 52 54 58 5C 66 68 6A 6C 76 78 7A 7C 7E 82 + 90 92 94 96 99 9B A5 A7 A9 AB B0 B9 BA BB BC BF + C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF + D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF + 43 45 47 49 4B 4D 4F 55 5D 5F 61 63 6D 6F 71 73 + 59 7F 83 85 87 89 8B BD 8D 9C 9E A0 A2 AC B1 97 + 44 46 48 4A 4C 4E 50 56 5E 60 62 64 6E 70 72 74 + 5A 80 84 86 88 8A 8C BE 8E 9D 9F A1 A3 AD B2 AE +</map> +</collation> + + +</charset> + +</charsets> diff --git a/sql/share/charsets/latin1cias.conf b/sql/share/charsets/latin1cias.conf deleted file mode 100644 index 3b0e104aafd..00000000000 --- a/sql/share/charsets/latin1cias.conf +++ /dev/null @@ -1,97 +0,0 @@ -# -# Latin1, accent sensitive, case insensitive -# -# Sorting for Dutch, English, French, German (Duden), -# Italian, Latin, Pogtuguese, Spanish -# -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 00 01 01 01 01 01 01 01 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 00 02 02 02 02 02 02 02 02 - -# to_lower array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF - -# sort_order array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 51 53 57 5B 65 67 69 6B 75 77 79 7B 7D 81 - 8F 91 93 95 98 9A A4 A6 A8 AA AF B3 B4 B5 B6 B7 - B8 41 51 53 57 5B 65 67 69 6B 75 77 79 7B 7D 81 - 8F 91 93 95 98 9A A4 A6 A8 AA AF B9 BA BB BC BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - 43 45 47 49 4B 4D 4F 55 5D 5F 61 63 6D 6F 71 73 - 59 7F 83 85 87 89 8B BD 8D 9C 9E A0 A2 AC B1 97 - 43 45 47 49 4B 4D 4F 55 5D 5F 61 63 6D 6F 71 73 - 59 7F 83 85 87 89 8B BE 8D 9C 9E A0 A2 AC B1 AE - -# Unicode mapping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F - 0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F - 00A0 00A1 00A2 00A3 00A4 00A5 00A6 00A7 00A8 00A9 00AA 00AB 00AC 00AD 00AE 00AF - 00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00B8 00B9 00BA 00BB 00BC 00BD 00BE 00BF - 00C0 00C1 00C2 00C3 00C4 00C5 00C6 00C7 00C8 00C9 00CA 00CB 00CC 00CD 00CE 00CF - 00D0 00D1 00D2 00D3 00D4 00D5 00D6 00D7 00D8 00D9 00DA 00DB 00DC 00DD 00DE 00DF - 00E0 00E1 00E2 00E3 00E4 00E5 00E6 00E7 00E8 00E9 00EA 00EB 00EC 00ED 00EE 00EF - 00F0 00F1 00F2 00F3 00F4 00F5 00F6 00F7 00F8 00F9 00FA 00FB 00FC 00FD 00FE 00FF - diff --git a/sql/share/charsets/latin1csas.conf b/sql/share/charsets/latin1csas.conf deleted file mode 100644 index cb3a1285de8..00000000000 --- a/sql/share/charsets/latin1csas.conf +++ /dev/null @@ -1,97 +0,0 @@ -# -# Latin1, accent sensitive, case sensitive -# -# Sorting for Dutch, English, French, German (Duden), -# Italian, Latin, Pogtuguese, Spanish -# -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 00 01 01 01 01 01 01 01 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 00 02 02 02 02 02 02 02 02 - -# to_lower array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF - -# sort_order array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 51 53 57 5B 65 67 69 6B 75 77 79 7B 7D 81 - 8F 91 93 95 98 9A A4 A6 A8 AA AF B3 B4 B5 B6 B7 - B8 42 52 54 58 5C 66 68 6A 6C 76 78 7A 7C 7E 82 - 90 92 94 96 99 9B A5 A7 A9 AB B0 B9 BA BB BC BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - 43 45 47 49 4B 4D 4F 55 5D 5F 61 63 6D 6F 71 73 - 59 7F 83 85 87 89 8B BD 8D 9C 9E A0 A2 AC B1 97 - 44 46 48 4A 4C 4E 50 56 5E 60 62 64 6E 70 72 74 - 5A 80 84 86 88 8A 8C BE 8E 9D 9F A1 A3 AD B2 AE - -# Unicode mapping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F - 0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F - 00A0 00A1 00A2 00A3 00A4 00A5 00A6 00A7 00A8 00A9 00AA 00AB 00AC 00AD 00AE 00AF - 00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00B8 00B9 00BA 00BB 00BC 00BD 00BE 00BF - 00C0 00C1 00C2 00C3 00C4 00C5 00C6 00C7 00C8 00C9 00CA 00CB 00CC 00CD 00CE 00CF - 00D0 00D1 00D2 00D3 00D4 00D5 00D6 00D7 00D8 00D9 00DA 00DB 00DC 00DD 00DE 00DF - 00E0 00E1 00E2 00E3 00E4 00E5 00E6 00E7 00E8 00E9 00EA 00EB 00EC 00ED 00EE 00EF - 00F0 00F1 00F2 00F3 00F4 00F5 00F6 00F7 00F8 00F9 00FA 00FB 00FC 00FD 00FE 00FF - diff --git a/sql/share/charsets/latin2.conf b/sql/share/charsets/latin2.conf deleted file mode 100644 index cc21af9faa1..00000000000 --- a/sql/share/charsets/latin2.conf +++ /dev/null @@ -1,92 +0,0 @@ -# Configuration file for the latin2 character set - -# ctype array (must have 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 48 01 10 01 10 01 01 10 10 01 01 01 01 10 01 01 - 10 02 10 02 10 02 02 10 10 02 02 02 02 10 02 02 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 10 01 01 01 01 01 01 10 01 01 01 01 01 01 01 10 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 10 - -# to_lower array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 B1 A2 B3 A4 B5 B6 A7 A8 B9 BA BB BC AD BE BF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - D0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 A1 B2 A3 B4 A5 A6 B7 B8 A9 AA AB AC BD AE AF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - F0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF - -# sort_order array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 44 45 48 49 4B 4C 4D 4E 4F 50 51 53 54 56 - 58 59 5A 5B 5E 5F 60 61 62 63 64 68 69 6A 6B 6C - 6D 41 44 45 48 49 4B 4C 4D 4E 4F 50 51 53 54 56 - 58 59 5A 5B 5E 5F 60 61 62 63 64 6E 6F 70 71 FF - FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF - FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF - FF 42 FF 52 FF 51 5C FF FF 5D 5B 5E 65 FF 67 66 - FF 42 FF 52 FF 51 5C FF FF 5D 5B 5E 65 FF 67 66 - 5A 43 43 43 43 51 46 45 47 49 4A 49 49 4E 4E 48 - FF 55 54 57 56 56 56 FF 5A 5F 5F 5F 5F 63 5E FF - 5A 43 43 43 43 51 46 45 47 49 4A 49 49 4E 4E 48 - FF 55 54 57 56 56 56 FF 5A 5F 5F 5F 5F 63 5E FF - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F -0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F -0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F -00A0 0104 02D8 0141 00A4 013D 015A 00A7 00A8 0160 015E 0164 0179 00AD 017D 017B -00B0 0105 02DB 0142 00B4 013E 015B 02C7 00B8 0161 015F 0165 017A 02DD 017E 017C -0154 00C1 00C2 0102 00C4 0139 0106 00C7 010C 00C9 0118 00CB 011A 00CD 00CE 010E -0110 0143 0147 00D3 00D4 0150 00D6 00D7 0158 016E 00DA 0170 00DC 00DD 0162 00DF -0155 00E1 00E2 0103 00E4 013A 0107 00E7 010D 00E9 0119 00EB 011B 00ED 00EE 010F -0111 0144 0148 00F3 00F4 0151 00F6 00F7 0159 016F 00FA 0171 00FC 00FD 0163 02D9 diff --git a/sql/share/charsets/latin2.xml b/sql/share/charsets/latin2.xml new file mode 100644 index 00000000000..377ab19e8ad --- /dev/null +++ b/sql/share/charsets/latin2.xml @@ -0,0 +1,167 @@ +<?xml version='1.0' encoding="utf-8"?> + +<charsets> + +<charset name="latin2"> + +<ctype> +<map> + 00 + 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 + 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 + 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 48 01 10 01 10 01 01 10 10 01 01 01 01 10 01 01 + 10 02 10 02 10 02 02 10 10 02 02 02 02 10 02 02 + 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 + 10 01 01 01 01 01 01 10 01 01 01 01 01 01 01 10 + 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 10 +</map> +</ctype> + + +<lower> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 B1 A2 B3 A4 B5 B6 A7 A8 B9 BA BB BC AD BE BF + B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + D0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</lower> + + +<upper> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF + B0 A1 B2 A3 B4 A5 A6 B7 B8 A9 AA AB AC BD AE AF + C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF + D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF + C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF + F0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF +</map> +</upper> + + +<unicode> +<map> +0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F +0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F +0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F +0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F +0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F +0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F +0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F +0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F +0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F +0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F +00A0 0104 02D8 0141 00A4 013D 015A 00A7 00A8 0160 015E 0164 0179 00AD 017D 017B +00B0 0105 02DB 0142 00B4 013E 015B 02C7 00B8 0161 015F 0165 017A 02DD 017E 017C +0154 00C1 00C2 0102 00C4 0139 0106 00C7 010C 00C9 0118 00CB 011A 00CD 00CE 010E +0110 0143 0147 00D3 00D4 0150 00D6 00D7 0158 016E 00DA 0170 00DC 00DD 0162 00DF +0155 00E1 00E2 0103 00E4 013A 0107 00E7 010D 00E9 0119 00EB 011B 00ED 00EE 010F +0111 0144 0148 00F3 00F4 0151 00F6 00F7 0159 016F 00FA 0171 00FC 00FD 0163 02D9 +</map> +</unicode> + + +<collation name="latin2"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 44 45 48 49 4B 4C 4D 4E 4F 50 51 53 54 56 + 58 59 5A 5B 5E 5F 60 61 62 63 64 68 69 6A 6B 6C + 6D 41 44 45 48 49 4B 4C 4D 4E 4F 50 51 53 54 56 + 58 59 5A 5B 5E 5F 60 61 62 63 64 6E 6F 70 71 FF + FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF + FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF + FF 42 FF 52 FF 51 5C FF FF 5D 5B 5E 65 FF 67 66 + FF 42 FF 52 FF 51 5C FF FF 5D 5B 5E 65 FF 67 66 + 5A 43 43 43 43 51 46 45 47 49 4A 49 49 4E 4E 48 + FF 55 54 57 56 56 56 FF 5A 5F 5F 5F 5F 63 5E FF + 5A 43 43 43 43 51 46 45 47 49 4A 49 49 4E 4E 48 + FF 55 54 57 56 56 56 FF 5A 5F 5F 5F 5F 63 5E FF +</map> +</collation> + + +<collation name="croat"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 42 43 46 48 49 4A 4B 4C 4D 4E 4F 50 51 52 + 53 54 55 56 58 59 5A 5B 5C 5D 5E 5B 5C 5D 5E 5F + 60 41 42 43 46 48 49 4A 4B 4C 4D 4E 4F 50 51 52 + 53 54 55 56 58 59 5A 5B 5C 5D 5E 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 57 8B 8C 8D 5F 8F + 90 91 92 93 94 95 96 97 98 99 57 9B 9C 9D 5F 9F + A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF + B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF + 41 41 41 41 5C 5B 45 43 44 45 45 45 49 49 49 49 + 47 4E 4F 4F 4F 4F 5D D7 D8 55 55 55 59 59 DE DF + 41 41 41 41 5C 5B 45 43 44 45 45 45 49 49 49 49 + 47 4E 4F 4F 4F 4F 5D F7 D8 55 55 55 59 59 DE FF +</map> +</collation> + + +<collation name="czech"/> + + +<collation name="hungarian"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 47 48 4C 4E 53 54 55 56 5A 5B 5C 60 61 64 + 69 6A 6B 6E 72 75 7A 7B 7C 7D 7F 83 84 85 86 87 + 88 41 47 48 4C 4E 53 54 55 56 5A 5B 5C 60 61 64 + 69 6A 6B 6E 72 75 7A 7B 7C 7D 7F 89 8A 8B 8C 00 + 01 78 4E 04 05 06 07 08 09 0A 67 67 56 56 0F 41 + 4E 12 13 67 67 64 78 75 78 67 78 1C 1D 1E 1F FF + 41 56 64 75 5E 6F FF 67 FF 70 71 73 80 FF 81 82 + FF 42 FF 5D FF 41 6F FF FF 70 71 73 80 FF 81 82 + 6C 41 44 45 46 5F 49 4B 4A 4E 51 52 50 56 57 4D + FF 62 63 64 66 67 67 FF 6D 77 75 78 78 7E 74 FF + 64 41 44 45 46 5F 49 4B 4A 4E 51 78 50 56 58 4D + FF 62 63 64 66 67 67 FF 6D 77 75 78 78 7E 74 FF +</map> +</collation> + + +</charset> + +</charsets> diff --git a/sql/share/charsets/latin5.conf b/sql/share/charsets/latin5.conf deleted file mode 100644 index d603d019ce6..00000000000 --- a/sql/share/charsets/latin5.conf +++ /dev/null @@ -1,96 +0,0 @@ -# Configuration file for the latin5 (turkish) character set - -# Note: all accented characters are compared separately (this -# is different from the default latin1 character set, where -# e.g. a = ä = á, etc.). - -# ctype array (must have 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 02 - -# to_lower array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 61 62 63 64 65 66 67 68 FD 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC 69 FE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 DD 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC 49 DE FF - -# sort_order array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 45 46 47 48 4A 4B 4D 4E 4F 50 51 52 - 54 55 56 57 59 5A 5C 5D 5E 5F 60 61 62 63 64 65 - 66 41 42 43 45 46 47 48 4A 4C 4D 4E 4F 50 51 52 - 54 55 56 57 59 5A 5C 5D 5E 5F 60 87 88 89 8A 8B - 8C 8D 8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B - 9C 9D 9E 9F A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB - AC AD AE AF B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB - BC BD BE BF C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB - CC CD CE CF D0 D1 D2 44 D3 D4 D5 D6 D7 D8 D9 DA - 49 DB DC DD DE DF 53 E0 E1 E2 E3 E4 5B 4C 58 E5 - CC CD CE CF D0 D1 D2 44 D3 D4 D5 D6 D7 D8 D9 DA - 49 DB DC DD DE DF 53 FA E1 E2 E3 E4 5B 4B 58 FF - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F -0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F -0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F -00A0 00A1 00A2 00A3 00A4 00A5 00A6 00A7 00A8 00A9 00AA 00AB 00AC 00AD 00AE 00AF -00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00B8 00B9 00BA 00BB 00BC 00BD 00BE 00BF -00C0 00C1 00C2 00C3 00C4 00C5 00C6 00C7 00C8 00C9 00CA 00CB 00CC 00CD 00CE 00CF -011E 00D1 00D2 00D3 00D4 00D5 00D6 00D7 00D8 00D9 00DA 00DB 00DC 0130 015E 00DF -00E0 00E1 00E2 00E3 00E4 00E5 00E6 00E7 00E8 00E9 00EA 00EB 00EC 00ED 00EE 00EF -011F 00F1 00F2 00F3 00F4 00F5 00F6 00F7 00F8 00F9 00FA 00FB 00FC 0131 015F 00FF diff --git a/sql/share/charsets/latin5.xml b/sql/share/charsets/latin5.xml new file mode 100644 index 00000000000..a072ffc5072 --- /dev/null +++ b/sql/share/charsets/latin5.xml @@ -0,0 +1,125 @@ +<?xml version='1.0' encoding="utf-8"?> + +<charsets> + +<charset name="latin5"> + +<ctype> +<map> + 00 + 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 + 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 + 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02 + 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 02 +</map> +</ctype> + + +<lower> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 61 62 63 64 65 66 67 68 FD 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF + B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC 69 FE DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</lower> + + +<upper> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 DD 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF + B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF + C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF + D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF + C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF + D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC 49 DE FF +</map> +</upper> + + +<unicode> +<map> +0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F +0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F +0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F +0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F +0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F +0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F +0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F +0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F +0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F +0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F +00A0 00A1 00A2 00A3 00A4 00A5 00A6 00A7 00A8 00A9 00AA 00AB 00AC 00AD 00AE 00AF +00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00B8 00B9 00BA 00BB 00BC 00BD 00BE 00BF +00C0 00C1 00C2 00C3 00C4 00C5 00C6 00C7 00C8 00C9 00CA 00CB 00CC 00CD 00CE 00CF +011E 00D1 00D2 00D3 00D4 00D5 00D6 00D7 00D8 00D9 00DA 00DB 00DC 0130 015E 00DF +00E0 00E1 00E2 00E3 00E4 00E5 00E6 00E7 00E8 00E9 00EA 00EB 00EC 00ED 00EE 00EF +011F 00F1 00F2 00F3 00F4 00F5 00F6 00F7 00F8 00F9 00FA 00FB 00FC 0131 015F 00FF +</map> +</unicode> + + +<collation name="latin5"> +<!-- +# Note: all accented characters are compared separately (this +# is different from the default latin1 character set, where +# e.g. a = ä = á, etc.). +--> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 42 43 45 46 47 48 4A 4B 4D 4E 4F 50 51 52 + 54 55 56 57 59 5A 5C 5D 5E 5F 60 61 62 63 64 65 + 66 41 42 43 45 46 47 48 4A 4C 4D 4E 4F 50 51 52 + 54 55 56 57 59 5A 5C 5D 5E 5F 60 87 88 89 8A 8B + 8C 8D 8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B + 9C 9D 9E 9F A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB + AC AD AE AF B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB + BC BD BE BF C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB + CC CD CE CF D0 D1 D2 44 D3 D4 D5 D6 D7 D8 D9 DA + 49 DB DC DD DE DF 53 E0 E1 E2 E3 E4 5B 4C 58 E5 + CC CD CE CF D0 D1 D2 44 D3 D4 D5 D6 D7 D8 D9 DA + 49 DB DC DD DE DF 53 FA E1 E2 E3 E4 5B 4B 58 FF +</map> +</collation> + + +</charset> + +</charsets> diff --git a/sql/share/charsets/latin7.xml b/sql/share/charsets/latin7.xml new file mode 100644 index 00000000000..eae4d501f44 --- /dev/null +++ b/sql/share/charsets/latin7.xml @@ -0,0 +1,168 @@ +<?xml version='1.0' encoding="utf-8"?> + +<charsets> + +<charset name="latin7"> + +<ctype> +<map> + 00 + 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 + 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 + 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 + 01 20 10 20 10 10 00 00 20 10 20 10 20 10 10 10 + 20 10 10 10 10 10 10 10 20 00 20 10 20 10 10 20 + 48 20 10 10 10 20 10 10 10 10 01 10 10 10 10 01 + 10 10 10 10 10 10 10 10 10 10 02 10 10 10 10 02 + 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02 + 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 10 +</map> +</ctype> + + +<lower> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 BA AB AC AD AE BF + B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</lower> + + +<upper> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF + B0 B1 B2 B3 B4 B5 B6 B7 A8 B9 AA BB BC BD BE AF + C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF + D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF + C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF + D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF +</map> +</upper> + + +<unicode> +<map> +0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F +0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F +0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F +0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F +0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F +0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F +0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F +0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F +0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F +0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F +00A0 201D 00A2 00A3 00A4 201E 00A6 00A7 00D8 00A9 0156 00AB 00AC 00AD 00AE 00C6 +00B0 00B1 00B2 00B3 201C 00B5 00B6 00B7 00F8 00B9 0157 00BB 00BC 00BD 00BE 00E6 +0104 012E 0100 0106 00C4 00C5 0118 0112 010C 00C9 0179 0116 0122 0136 012A 013B +0160 0143 0145 00D3 014C 00D5 00D6 00D7 0172 0141 015A 016A 00DC 017B 017D 00DF +0105 012F 0101 0107 00E4 00E5 0119 0113 010D 00E9 017A 0117 0123 0137 012B 013C +0161 0144 0146 00F3 014D 00F5 00F6 00F7 0173 0142 015B 016B 00FC 017C 017E 2019 +</map> +</unicode> + + +<collation name="estonia"> +<map> + 00 02 03 04 05 06 07 08 09 2E 2F 30 31 32 0A 0B + 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B + 2C 33 34 35 36 37 38 27 39 3A 3B 5D 3C 28 3D 3E + 76 7A 7C 7E 80 81 82 83 84 85 3F 40 5E 5F 60 41 + 42 86 90 92 98 9A A4 A6 AA AC B2 B4 B8 BE C0 C6 + CE D0 D2 D6 E5 E8 EE F0 FA FC DD 43 44 45 46 47 + 48 87 91 93 99 9B A5 A7 AB AD B3 B5 B9 BF C1 C7 + CF D1 D3 D7 E6 E9 EF F1 FB FD DE 49 4A 4B 4C 1C + 01 1D 57 1E 5A 74 71 72 1F 75 20 5B 21 4E 52 51 + 22 55 56 58 59 73 2A 2B 23 E7 24 5C 25 4F 54 26 + 2D FE 66 67 68 FF 4D 69 CC 6A D4 62 6B 29 6C 8E + 6D 61 7D 7F 50 6E 6F 70 CD 7B D5 63 77 78 79 8F + 8C B0 88 94 F4 8A A2 A0 96 9C DF 9E A8 B6 AE BA + DB C2 C4 C8 CA F2 F6 64 EC BC D8 EA F8 E1 E3 DA + 8D B1 89 95 F5 8B A3 A1 97 9D E0 9F A9 B7 AF BB + DC C3 C5 C9 CB F3 F7 65 ED BD D9 EB F9 E2 E4 53 +</map> +</collation> + + +<collation name="latvian"> +<!-- Created for case-sensitive record search --> +<!-- by Andis Grasis & Rihards Grasis e-mail:andis@cata.lv --> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 30 32 33 34 35 36 37 2B 38 39 3A 5C 3B 2C 3C 3D + 76 7A 7C 7E 80 81 82 83 84 85 3E 3F 5D 5E 5F 40 + 41 86 92 94 9A 9C A6 A8 AC AE B4 B6 BA C0 C2 C8 + D4 D6 D8 DC E3 E6 EE F0 F2 F4 F6 42 43 44 45 46 + 47 87 93 95 9B 9D A7 A9 AD AF B5 B7 BB C1 C3 C9 + D5 D7 D9 DD E4 E7 EF F1 F3 F5 F7 48 49 4A 4B 20 + 75 21 56 22 59 73 70 71 23 74 24 5A 25 4D 51 50 + 26 54 55 57 58 72 2E 2F 27 E5 28 5B 29 4E 53 2A + 31 FE 65 66 67 FF 4C 68 D3 69 DA 61 6A 2D 6B 90 + 6C 60 7D 7F 4F 6D 6E 6F D2 7B DB 62 77 78 79 91 + 8E B2 8A 96 88 8C A4 A2 98 9E F8 A0 AA B8 B0 BE + E1 C4 C6 CA CE D0 CC 63 EC BC DE EA E8 FA FC E0 + 8F B3 8B 97 89 8D A5 A3 99 9F F9 A1 AB B9 B1 BF + E2 C5 C7 CB CF D1 CD 64 ED BD DF EB E9 FB FD 52 +</map> +</collation> + + +<collation name="latvian1"> +<!-- Created for case-insensitive record search --> +<!-- Created by Andis & Rihards --> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 30 32 33 34 35 36 37 2B 38 39 3A 5C 3B 2C 3C 3D + 76 7A 7C 7E 80 81 82 83 84 85 3E 3F 5D 5E 5F 40 + 41 86 92 94 9A 9C A6 A8 AC AE B4 B6 BA C0 C2 C8 + D4 D6 D8 DC E3 E6 EE F0 F2 F4 F6 42 43 44 45 46 + 47 86 92 94 9A 9C A6 A8 AC AE B4 B6 BA C0 C2 C8 + D4 D6 D8 DC E2 E6 EE F0 F2 F4 F6 48 49 4A 4B 20 + 75 21 56 22 59 73 70 71 23 74 24 5A 25 4D 51 50 + 26 54 55 57 58 72 2E 2F 27 E5 28 5B 29 4E 53 2A + 31 FE 65 66 67 FF 4C 68 2D 69 DA 61 6A 2D 6B 90 + 6C 60 7D 7F 4F 6D 6E 6F D3 7B DB 62 77 78 79 90 + 8E B2 8A 96 88 8C A4 A2 98 9E F8 A0 AA B8 B0 BE + E1 C4 C6 CA CE D0 CC 63 EC BC DE EA E8 FA FC E0 + 8E B2 8A 96 88 8C A4 A2 98 9E F8 A0 AA B8 B0 BE + E1 C4 C6 CA CE D0 CC 64 EC BC DE EA E8 FA FC 52 +</map> +</collation> + + +</charset> + +</charsets> diff --git a/sql/share/charsets/latvian.conf b/sql/share/charsets/latvian.conf deleted file mode 100644 index c3dee95d55c..00000000000 --- a/sql/share/charsets/latvian.conf +++ /dev/null @@ -1,95 +0,0 @@ -# Configuration file for the latvian character set. -# Created for case-sensitive record search -# Created accord with windows-1257 (iso-8859-4) codepage -# Created by Andis Grasis & Rihards Grasis e-mail:andis@cata.lv - -# The ctype array must have 257 elements. - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 01 20 10 20 10 10 00 00 20 10 20 10 20 10 10 10 - 20 10 10 10 10 10 10 10 20 00 20 10 20 10 10 20 - 48 20 10 10 10 20 10 10 10 10 01 10 10 10 10 01 - 10 10 10 10 10 10 10 10 10 10 02 10 10 10 10 02 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 10 - -# The to_lower array must have 256 elements. - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 BA AB AC AD AE BF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# The to_upper array must have 256 elements. - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 A8 B9 AA BB BC BD BE AF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF - -# The sort_order array must have 256 elements. - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 30 32 33 34 35 36 37 2B 38 39 3A 5C 3B 2C 3C 3D - 76 7A 7C 7E 80 81 82 83 84 85 3E 3F 5D 5E 5F 40 - 41 86 92 94 9A 9C A6 A8 AC AE B4 B6 BA C0 C2 C8 - D4 D6 D8 DC E3 E6 EE F0 F2 F4 F6 42 43 44 45 46 - 47 87 93 95 9B 9D A7 A9 AD AF B5 B7 BB C1 C3 C9 - D5 D7 D9 DD E4 E7 EF F1 F3 F5 F7 48 49 4A 4B 20 - 75 21 56 22 59 73 70 71 23 74 24 5A 25 4D 51 50 - 26 54 55 57 58 72 2E 2F 27 E5 28 5B 29 4E 53 2A - 31 FE 65 66 67 FF 4C 68 D3 69 DA 61 6A 2D 6B 90 - 6C 60 7D 7F 4F 6D 6E 6F D2 7B DB 62 77 78 79 91 - 8E B2 8A 96 88 8C A4 A2 98 9E F8 A0 AA B8 B0 BE - E1 C4 C6 CA CE D0 CC 63 EC BC DE EA E8 FA FC E0 - 8F B3 8B 97 89 8D A5 A3 99 9F F9 A1 AB B9 B1 BF - E2 C5 C7 CB CF D1 CD 64 ED BD DF EB E9 FB FD 52 - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F -0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F -0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F -00A0 201D 00A2 00A3 00A4 201E 00A6 00A7 00D8 00A9 0156 00AB 00AC 00AD 00AE 00C6 -00B0 00B1 00B2 00B3 201C 00B5 00B6 00B7 00F8 00B9 0157 00BB 00BC 00BD 00BE 00E6 -0104 012E 0100 0106 00C4 00C5 0118 0112 010C 00C9 0179 0116 0122 0136 012A 013B -0160 0143 0145 00D3 014C 00D5 00D6 00D7 0172 0141 015A 016A 00DC 017B 017D 00DF -0105 012F 0101 0107 00E4 00E5 0119 0113 010D 00E9 017A 0117 0123 0137 012B 013C -0161 0144 0146 00F3 014D 00F5 00F6 00F7 0173 0142 015B 016B 00FC 017C 017E 2019 diff --git a/sql/share/charsets/latvian1.conf b/sql/share/charsets/latvian1.conf deleted file mode 100644 index 3094525052d..00000000000 --- a/sql/share/charsets/latvian1.conf +++ /dev/null @@ -1,94 +0,0 @@ -# Configuration file for the latvian character set. -# Created for case-insensitive record search -# Created by Andis & Rihards - -# The ctype array must have 257 elements. - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 00 00 10 00 10 10 00 00 00 00 00 10 00 10 10 10 - 00 10 10 10 10 10 10 10 00 00 00 10 00 10 10 00 - 48 00 10 10 10 00 10 10 10 10 01 10 10 10 10 10 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 10 - -# The to_lower array must have 256 elements. - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 BA AB AC AD AE BF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# The to_upper array must have 256 elements. - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 A8 B9 AA BB BC BD BE AF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF - -# The sort_order array must have 256 elements. - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 30 32 33 34 35 36 37 2B 38 39 3A 5C 3B 2C 3C 3D - 76 7A 7C 7E 80 81 82 83 84 85 3E 3F 5D 5E 5F 40 - 41 86 92 94 9A 9C A6 A8 AC AE B4 B6 BA C0 C2 C8 - D4 D6 D8 DC E3 E6 EE F0 F2 F4 F6 42 43 44 45 46 - 47 86 92 94 9A 9C A6 A8 AC AE B4 B6 BA C0 C2 C8 - D4 D6 D8 DC E2 E6 EE F0 F2 F4 F6 48 49 4A 4B 20 - 75 21 56 22 59 73 70 71 23 74 24 5A 25 4D 51 50 - 26 54 55 57 58 72 2E 2F 27 E5 28 5B 29 4E 53 2A - 31 FE 65 66 67 FF 4C 68 2D 69 DA 61 6A 2D 6B 90 - 6C 60 7D 7F 4F 6D 6E 6F D3 7B DB 62 77 78 79 90 - 8E B2 8A 96 88 8C A4 A2 98 9E F8 A0 AA B8 B0 BE - E1 C4 C6 CA CE D0 CC 63 EC BC DE EA E8 FA FC E0 - 8E B2 8A 96 88 8C A4 A2 98 9E F8 A0 AA B8 B0 BE - E1 C4 C6 CA CE D0 CC 64 EC BC DE EA E8 FA FC 52 - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F -0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F -0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F -00A0 201D 00A2 00A3 00A4 201E 00A6 00A7 00D8 00A9 0156 00AB 00AC 00AD 00AE 00C6 -00B0 00B1 00B2 00B3 201C 00B5 00B6 00B7 00F8 00B9 0157 00BB 00BC 00BD 00BE 00E6 -0104 012E 0100 0106 00C4 00C5 0118 0112 010C 00C9 0179 0116 0122 0136 012A 013B -0160 0143 0145 00D3 014C 00D5 00D6 00D7 0172 0141 015A 016A 00DC 017B 017D 00DF -0105 012F 0101 0107 00E4 00E5 0119 0113 010D 00E9 017A 0117 0123 0137 012B 013C -0161 0144 0146 00F3 014D 00F5 00F6 00F7 0173 0142 015B 016B 00FC 017C 017E 2019 diff --git a/sql/share/charsets/macce.conf b/sql/share/charsets/macce.conf deleted file mode 100644 index f3ac08df087..00000000000 --- a/sql/share/charsets/macce.conf +++ /dev/null @@ -1,91 +0,0 @@ -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 - 01 01 02 01 01 01 01 02 02 01 02 02 01 02 02 01 - 02 01 02 02 01 02 01 02 02 02 02 02 02 01 02 02 - 00 00 01 00 00 00 00 02 00 00 00 02 00 00 02 01 - 02 01 00 00 02 01 00 00 02 01 02 01 02 01 02 01 - 02 01 00 00 02 01 00 00 00 00 00 02 01 01 02 01 - 00 00 00 00 00 00 00 00 02 01 02 01 00 00 02 01 - 02 01 00 00 02 01 02 01 01 02 01 01 02 01 01 01 - 02 01 01 02 01 02 01 02 01 02 02 01 01 02 01 00 - -# to_lower array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 54 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 54 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 8A 82 82 8E 88 9A 9F 87 88 8B 8A 8B 8D 8D 8E 90 - 90 93 92 93 95 95 98 97 98 99 9A 9B 9C 9E 9E 9F - A0 A1 AB A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE B0 - B0 B4 B2 B3 B4 FA B6 B7 B8 BA BA BC BC BE BE C0 - C0 C4 C2 C3 C4 CB C6 C7 C8 C9 CA CB CE 9B CE D8 - D0 D1 D2 D3 D4 D5 D6 D7 D8 DA DA DE DC DD DE E0 - E0 E4 E2 E3 E4 E6 E6 87 E9 E9 92 EC EC F0 97 99 - F0 F3 9C F3 F5 F5 F7 F7 F9 F9 FA FD B8 FD AE FF - -# to_upper array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 74 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 74 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 81 83 84 85 86 E7 84 89 80 89 8C 8C 83 8F - 8F 91 EA 91 94 94 96 EE 96 EF 85 CD F2 9D 9D 86 - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA A2 AC AD FE AF - AF B1 B2 B3 B1 B5 B6 B7 FC B9 B9 BB BB BD BD BF - BF C1 C2 C3 C1 C5 C6 C7 C8 C9 CA C5 CC CD CC CF - D0 D1 D2 D3 D4 D5 D6 D7 CF D9 D9 DB DC DD DB DF - DF E1 E2 E3 E1 E5 E5 E7 E8 E8 EA EB EB ED EE EF - ED F1 F2 F1 F4 F4 F6 F6 F8 F8 B5 FB FC FB FE FF - -# sort_order array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 46 47 4A 4C 52 53 55 56 5A 5B 5D 62 62 67 - 6F 70 71 75 79 81 88 89 8A 8B 8D 90 91 92 93 94 - 95 41 46 47 4A 4C 52 53 55 56 5A 5B 5D 62 62 67 - 6F 70 71 75 79 81 88 89 8A 8B 8D 96 97 98 99 9A - 41 41 41 4C 41 67 81 41 41 47 41 47 47 47 4C 8D - 8D 4A 56 4A 4C 4C 4C 67 4C 67 67 67 81 4C 4C 81 - A0 A1 4C A3 A4 A5 A6 75 A8 A9 AA 4C AC AD 53 56 - 56 56 B2 B3 56 5B B6 B7 5D 5D 5D 5D 5D 5D 5D 62 - 62 62 C2 C3 62 62 C6 C7 C8 C9 CA 62 67 67 67 67 - D0 D1 D2 D3 D4 D5 D6 D7 67 71 71 71 DC DD 71 71 - 71 75 E2 E3 75 75 75 41 79 79 56 8D 8D 81 67 67 - 81 81 81 81 81 81 81 81 8B 8B 5B 8D 5D 8D 53 FF - -# Unicode mappping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 00C4 0100 0101 00C9 0104 00D6 00DC 00E1 0105 010C 00E4 010D 0106 0107 00E9 0179 - 017A 010E 00ED 010F 0112 0113 0116 00F3 0117 00F4 00F6 00F5 00FA 011A 011B 00FC - 2020 00B0 0118 00A3 00A7 2022 00B6 00DF 00AE 00A9 2122 0119 00A8 2260 0123 012E - 012F 012A 2264 2265 012B 0136 2202 2211 0142 013B 013C 013D 013E 0139 013A 0145 - 0146 0143 00AC 221A 0144 0147 2206 00AB 00BB 2026 00A0 0148 0150 00D5 0151 014C - 2013 2014 201C 201D 2018 2019 00F7 25CA 014D 0154 0155 0158 2039 203A 0159 0156 - 0157 0160 201A 201E 0161 015A 015B 00C1 0164 0165 00CD 017D 017E 016A 00D3 00D4 - 016B 016E 00DA 016F 0170 0171 0172 0173 00DD 00FD 0137 017B 0141 017C 0122 02C7 - diff --git a/sql/share/charsets/macceciai.conf b/sql/share/charsets/macceciai.conf deleted file mode 100644 index d7cdaddc425..00000000000 --- a/sql/share/charsets/macceciai.conf +++ /dev/null @@ -1,96 +0,0 @@ -# Mac OS Central European, case insensitive, accent sensitive -# -# Czech (cs), Hungarian (hu), Polish (pl), Romanian (ro), Croatian (hr), -# Slovak (sk), Slovenian (sl), Sorbian. -# -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 - 01 01 02 01 01 01 01 02 02 01 02 02 01 02 02 01 - 02 01 02 02 01 02 01 02 02 02 02 02 02 01 02 02 - 00 00 01 00 00 00 00 02 00 00 00 02 00 00 02 01 - 02 01 00 00 02 01 00 00 02 01 02 01 02 01 02 01 - 02 01 00 00 02 01 00 00 00 00 00 02 01 01 02 01 - 00 00 00 00 00 00 00 00 02 01 02 01 00 00 02 01 - 02 01 00 00 02 01 02 01 01 02 01 01 02 01 01 01 - 02 01 01 02 01 02 01 02 01 02 02 01 01 02 01 00 - -# to_lower array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 54 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 54 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 8A 82 82 8E 88 9A 9F 87 88 8B 8A 8B 8D 8D 8E 90 - 90 93 92 93 95 95 98 97 98 99 9A 9B 9C 9E 9E 9F - A0 A1 AB A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE B0 - B0 B4 B2 B3 B4 FA B6 B7 B8 BA BA BC BC BE BE C0 - C0 C4 C2 C3 C4 CB C6 C7 C8 C9 CA CB CE 9B CE D8 - D0 D1 D2 D3 D4 D5 D6 D7 D8 DA DA DE DC DD DE E0 - E0 E4 E2 E3 E4 E6 E6 87 E9 E9 92 EC EC F0 97 99 - F0 F3 9C F3 F5 F5 F7 F7 F9 F9 FA FD B8 FD AE FF - -# to_upper array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 74 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 74 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 81 83 84 85 86 E7 84 89 80 89 8C 8C 83 8F - 8F 91 EA 91 94 94 96 EE 96 EF 85 CD F2 9D 9D 86 - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA A2 AC AD FE AF - AF B1 B2 B3 B1 B5 B6 B7 FC B9 B9 BB BB BD BD BF - BF C1 C2 C3 C1 C5 C6 C7 C8 C9 CA C5 CC CD CC CF - D0 D1 D2 D3 D4 D5 D6 D7 CF D9 D9 DB DC DD DB DF - DF E1 E2 E3 E1 E5 E5 E7 E8 E8 EA EB EB ED EE EF - ED F1 F2 F1 F4 F4 F6 F6 F8 F8 B5 FB FC FB FE FF - -# sort_order array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 4B 4D 53 57 63 65 69 6B 73 75 79 83 85 8D - 9B 9D 9F A7 AE B2 C0 C2 C4 C6 CA D2 D3 D4 D5 D6 - D7 41 4B 4D 53 57 63 65 69 6B 73 75 79 83 85 8D - 9B 9D 9F A7 AE B2 C0 C2 C4 C6 CA D8 D9 DA DB DC - 41 41 41 57 41 8D B2 41 41 4D 41 4D 4D 4D 57 CA - CA 53 6B 53 57 57 57 8D 57 8D 8D 8D B2 57 57 B2 - DD DE 57 DF E0 E1 E2 A7 E3 E4 E5 57 E6 E7 65 6B - 6B 6B E8 E9 6B 75 EA EB 79 79 79 79 79 79 79 85 - 85 85 EC ED 85 85 EE EF F0 F1 F2 85 8D 8D 8D 8D - F3 F4 F5 F6 F7 F8 F9 FA 8D 9F 9F 9F FB FC 9F 9F - 9F A7 FD FE A7 A7 A7 41 BE BE 6B CA CA B2 8D 8D - B2 B2 B2 B2 B2 B2 B2 B2 C6 C6 75 CA 79 CA 65 FF - -# Unicode mapping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 00C4 0100 0101 00C9 0104 00D6 00DC 00E1 0105 010C 00E4 010D 0106 0107 00E9 0179 - 017A 010E 00ED 010F 0112 0113 0116 00F3 0117 00F4 00F6 00F5 00FA 011A 011B 00FC - 2020 00B0 0118 00A3 00A7 2022 00B6 00DF 00AE 00A9 2122 0119 00A8 2260 0123 012E - 012F 012A 2264 2265 012B 0136 2202 2211 0142 013B 013C 013D 013E 0139 013A 0145 - 0146 0143 00AC 221A 0144 0147 2206 00AB 00BB 2026 00A0 0148 0150 00D5 0151 014C - 2013 2014 201C 201D 2018 2019 00F7 25CA 014D 0154 0155 0158 2039 203A 0159 0156 - 0157 0160 201A 201E 0161 015A 015B 00C1 0164 0165 00CD 017D 017E 016A 00D3 00D4 - 016B 016E 00DA 016F 0170 0171 0172 0173 00DD 00FD 0137 017B 0141 017C 0122 02C7 - diff --git a/sql/share/charsets/maccecias.conf b/sql/share/charsets/maccecias.conf deleted file mode 100644 index 8cefd4cf9ec..00000000000 --- a/sql/share/charsets/maccecias.conf +++ /dev/null @@ -1,96 +0,0 @@ -# Mac OS Central European, case insensitive, accent sensitive -# -# Czech (cs), Hungarian (hu), Polish (pl), Romanian (ro), Croatian (hr), -# Slovak (sk), Slovenian (sl), Sorbian. -# -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 - 01 01 02 01 01 01 01 02 02 01 02 02 01 02 02 01 - 02 01 02 02 01 02 01 02 02 02 02 02 02 01 02 02 - 00 00 01 00 00 00 00 02 00 00 00 02 00 00 02 01 - 02 01 00 00 02 01 00 00 02 01 02 01 02 01 02 01 - 02 01 00 00 02 01 00 00 00 00 00 02 01 01 02 01 - 00 00 00 00 00 00 00 00 02 01 02 01 00 00 02 01 - 02 01 00 00 02 01 02 01 01 02 01 01 02 01 01 01 - 02 01 01 02 01 02 01 02 01 02 02 01 01 02 01 00 - -# to_lower array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 54 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 54 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 8A 82 82 8E 88 9A 9F 87 88 8B 8A 8B 8D 8D 8E 90 - 90 93 92 93 95 95 98 97 98 99 9A 9B 9C 9E 9E 9F - A0 A1 AB A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE B0 - B0 B4 B2 B3 B4 FA B6 B7 B8 BA BA BC BC BE BE C0 - C0 C4 C2 C3 C4 CB C6 C7 C8 C9 CA CB CE 9B CE D8 - D0 D1 D2 D3 D4 D5 D6 D7 D8 DA DA DE DC DD DE E0 - E0 E4 E2 E3 E4 E6 E6 87 E9 E9 92 EC EC F0 97 99 - F0 F3 9C F3 F5 F5 F7 F7 F9 F9 FA FD B8 FD AE FF - -# to_upper array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 74 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 74 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 81 83 84 85 86 E7 84 89 80 89 8C 8C 83 8F - 8F 91 EA 91 94 94 96 EE 96 EF 85 CD F2 9D 9D 86 - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA A2 AC AD FE AF - AF B1 B2 B3 B1 B5 B6 B7 FC B9 B9 BB BB BD BD BF - BF C1 C2 C3 C1 C5 C6 C7 C8 C9 CA C5 CC CD CC CF - D0 D1 D2 D3 D4 D5 D6 D7 CF D9 D9 DB DC DD DB DF - DF E1 E2 E3 E1 E5 E5 E7 E8 E8 EA EB EB ED EE EF - ED F1 F2 F1 F4 F4 F6 F6 F8 F8 B5 FB FC FB FE FF - -# sort_order array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 4B 4D 53 57 63 65 69 6B 73 75 79 83 85 8D - 9B 9D 9F A7 AE B2 C0 C2 C4 C6 CA D2 D3 D4 D5 D6 - D7 41 4B 4D 53 57 63 65 69 6B 73 75 79 83 85 8D - 9B 9D 9F A7 AE B2 C0 C2 C4 C6 CA D8 D9 DA DB DC - 45 47 47 59 49 91 B6 43 49 4F 45 4F 51 51 59 CE - CE 55 71 55 5B 5B 5D 8F 5D 99 91 97 B8 5F 5F B6 - DD DE 61 DF E0 E1 E2 AD E3 E4 E5 61 E6 E7 67 6F - 6F 6D E8 E9 6D 77 EA EB 7B 81 82 7F 7F 7D 7D 8B - 8B 87 EC ED 87 89 EE EF F0 F1 F2 89 93 97 93 95 - F3 F4 F5 F6 F7 F8 F9 FA 95 A1 A1 A3 FB FC A3 A5 - A5 A9 FD FE A9 AB AB 43 B0 B0 71 CC CC BC 8F 99 - BC B4 B8 B4 BA BA BE BE C8 C8 77 D0 7B D0 67 FF - -# Unicode mapping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 00C4 0100 0101 00C9 0104 00D6 00DC 00E1 0105 010C 00E4 010D 0106 0107 00E9 0179 - 017A 010E 00ED 010F 0112 0113 0116 00F3 0117 00F4 00F6 00F5 00FA 011A 011B 00FC - 2020 00B0 0118 00A3 00A7 2022 00B6 00DF 00AE 00A9 2122 0119 00A8 2260 0123 012E - 012F 012A 2264 2265 012B 0136 2202 2211 0142 013B 013C 013D 013E 0139 013A 0145 - 0146 0143 00AC 221A 0144 0147 2206 00AB 00BB 2026 00A0 0148 0150 00D5 0151 014C - 2013 2014 201C 201D 2018 2019 00F7 25CA 014D 0154 0155 0158 2039 203A 0159 0156 - 0157 0160 201A 201E 0161 015A 015B 00C1 0164 0165 00CD 017D 017E 016A 00D3 00D4 - 016B 016E 00DA 016F 0170 0171 0172 0173 00DD 00FD 0137 017B 0141 017C 0122 02C7 - diff --git a/sql/share/charsets/maccecsas.conf b/sql/share/charsets/maccecsas.conf deleted file mode 100644 index 8cc1de422f2..00000000000 --- a/sql/share/charsets/maccecsas.conf +++ /dev/null @@ -1,96 +0,0 @@ -# Mac OS Central European, case sensitive, accent sensitive -# -# Czech (cs), Hungarian (hu), Polish (pl), Romanian (ro), Croatian (hr), -# Slovak (sk), Slovenian (sl), Sorbian. -# -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 - 01 01 02 01 01 01 01 02 02 01 02 02 01 02 02 01 - 02 01 02 02 01 02 01 02 02 02 02 02 02 01 02 02 - 00 00 01 00 00 00 00 02 00 00 00 02 00 00 02 01 - 02 01 00 00 02 01 00 00 02 01 02 01 02 01 02 01 - 02 01 00 00 02 01 00 00 00 00 00 02 01 01 02 01 - 00 00 00 00 00 00 00 00 02 01 02 01 00 00 02 01 - 02 01 00 00 02 01 02 01 01 02 01 01 02 01 01 01 - 02 01 01 02 01 02 01 02 01 02 02 01 01 02 01 00 - -# to_lower array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 54 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 54 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 8A 82 82 8E 88 9A 9F 87 88 8B 8A 8B 8D 8D 8E 90 - 90 93 92 93 95 95 98 97 98 99 9A 9B 9C 9E 9E 9F - A0 A1 AB A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE B0 - B0 B4 B2 B3 B4 FA B6 B7 B8 BA BA BC BC BE BE C0 - C0 C4 C2 C3 C4 CB C6 C7 C8 C9 CA CB CE 9B CE D8 - D0 D1 D2 D3 D4 D5 D6 D7 D8 DA DA DE DC DD DE E0 - E0 E4 E2 E3 E4 E6 E6 87 E9 E9 92 EC EC F0 97 99 - F0 F3 9C F3 F5 F5 F7 F7 F9 F9 FA FD B8 FD AE FF - -# to_upper array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 74 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 74 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 81 83 84 85 86 E7 84 89 80 89 8C 8C 83 8F - 8F 91 EA 91 94 94 96 EE 96 EF 85 CD F2 9D 9D 86 - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA A2 AC AD FE AF - AF B1 B2 B3 B1 B5 B6 B7 FC B9 B9 BB BB BD BD BF - BF C1 C2 C3 C1 C5 C6 C7 C8 C9 CA C5 CC CD CC CF - D0 D1 D2 D3 D4 D5 D6 D7 CF D9 D9 DB DC DD DB DF - DF E1 E2 E3 E1 E5 E5 E7 E8 E8 EA EB EB ED EE EF - ED F1 F2 F1 F4 F4 F6 F6 F8 F8 B5 FB FC FB FE FF - -# sort_order array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 4B 4D 53 57 63 65 69 6B 73 75 79 83 85 8D - 9B 9D 9F A7 AE B2 C0 C2 C4 C6 CA D2 D3 D4 D5 D6 - D7 42 4C 4E 54 58 64 66 6A 6C 74 76 7A 84 86 8E - 9C 9E A0 A8 AF B3 C1 C3 C5 C7 CB D8 D9 DA DB DC - 45 47 48 59 49 91 B6 44 4A 4F 46 50 51 52 5A CE - CF 55 72 56 5B 5C 5D 90 5E 9A 92 98 B8 5F 60 B7 - DD DE 61 DF E0 E1 E2 AD E3 E4 E5 62 E6 E7 68 6F - 70 6D E8 E9 6E 77 EA EB 7C 81 82 7F 80 7D 7E 8B - 8C 87 EC ED 88 89 EE EF F0 F1 F2 8A 93 97 94 95 - F3 F4 F5 F6 F7 F8 F9 FA 96 A1 A2 A3 FB FC A4 A5 - A6 A9 FD FE AA AB AC 43 B0 B1 71 CC CD BC 8F 99 - BD B4 B9 B5 BA BB BE BF C8 C9 78 D0 7B D1 67 FF - -# Unicode mapping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 00C4 0100 0101 00C9 0104 00D6 00DC 00E1 0105 010C 00E4 010D 0106 0107 00E9 0179 - 017A 010E 00ED 010F 0112 0113 0116 00F3 0117 00F4 00F6 00F5 00FA 011A 011B 00FC - 2020 00B0 0118 00A3 00A7 2022 00B6 00DF 00AE 00A9 2122 0119 00A8 2260 0123 012E - 012F 012A 2264 2265 012B 0136 2202 2211 0142 013B 013C 013D 013E 0139 013A 0145 - 0146 0143 00AC 221A 0144 0147 2206 00AB 00BB 2026 00A0 0148 0150 00D5 0151 014C - 2013 2014 201C 201D 2018 2019 00F7 25CA 014D 0154 0155 0158 2039 203A 0159 0156 - 0157 0160 201A 201E 0161 015A 015B 00C1 0164 0165 00CD 017D 017E 016A 00D3 00D4 - 016B 016E 00DA 016F 0170 0171 0172 0173 00DD 00FD 0137 017B 0141 017C 0122 02C7 - diff --git a/sql/share/charsets/macromanbin.conf b/sql/share/charsets/macromanbin.conf deleted file mode 100644 index d0845c07f2b..00000000000 --- a/sql/share/charsets/macromanbin.conf +++ /dev/null @@ -1,96 +0,0 @@ -# -# Mac OS Roman, accent insensitive, case insensitive -# -# Binary sort order -# -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 10 - 20 01 01 01 01 01 01 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 00 00 00 00 00 00 00 02 00 00 00 00 00 00 01 01 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 02 - 00 00 00 00 02 00 00 00 00 00 00 20 01 01 01 02 - 00 00 00 00 00 00 00 00 02 01 00 00 00 00 00 00 - 00 00 00 00 00 20 01 01 01 01 01 01 01 01 01 01 - 00 01 01 01 01 02 00 00 00 00 00 00 00 00 00 00 - -# to_lower array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 8A 8C 8D 8E 96 9A 9F 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD BE BF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA 88 8B 9B CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D8 DA DB DC DD DE DF - E0 E1 E2 E3 E4 89 90 87 91 8F 92 94 95 93 97 99 - F0 98 9C 9E 9D F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 E7 CB E5 80 CC 81 82 83 E9 - E6 E8 EA ED EB EC 84 EE F1 EF 85 CD F2 F4 F3 86 - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD AE AF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D9 D9 DA DB DC DD DE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# sort_order array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# Unicode mapping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 00C4 00C5 00C7 00C9 00D1 00D6 00DC 00E1 00E0 00E2 00E4 00E3 00E5 00E7 00E9 00E8 - 00EA 00EB 00ED 00EC 00EE 00EF 00F1 00F3 00F2 00F4 00F6 00F5 00FA 00F9 00FB 00FC - 2020 00B0 00A2 00A3 00A7 2022 00B6 00DF 00AE 00A9 2122 00B4 00A8 2260 00C6 00D8 - 221E 00B1 2264 2265 00A5 00B5 2202 2211 220F 03C0 222B 00AA 00BA 03A9 00E6 00F8 - 00BF 00A1 00AC 221A 0192 2248 2206 00AB 00BB 2026 00A0 00C0 00C3 00D5 0152 0153 - 2013 2014 201C 201D 2018 2019 00F7 25CA 00FF 0178 2044 20AC 2039 203A FB01 FB02 - 2021 00B7 201A 201E 2030 00C2 00CA 00C1 00CB 00C8 00CD 00CE 00CF 00CC 00D3 00D4 - F8FF 00D2 00DA 00DB 00D9 0131 02C6 02DC 00AF 02D8 02D9 02DA 00B8 02DD 02DB 02C7 - diff --git a/sql/share/charsets/macromanciai.conf b/sql/share/charsets/macromanciai.conf deleted file mode 100644 index 457e6b4f8d9..00000000000 --- a/sql/share/charsets/macromanciai.conf +++ /dev/null @@ -1,97 +0,0 @@ -# -# Mac OS Roman, accent insensitive, case insensitive -# -# Sort order: Dutch, English, French, German (Duden), -# Italian, Latin, Pogtuguese, Spanish -# -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 10 - 20 01 01 01 01 01 01 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 00 00 00 00 00 00 00 02 00 00 00 00 00 00 01 01 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 02 - 00 00 00 00 02 00 00 00 00 00 00 20 01 01 01 02 - 00 00 00 00 00 00 00 00 02 01 00 00 00 00 00 00 - 00 00 00 00 00 20 01 01 01 01 01 01 01 01 01 01 - 00 01 01 01 01 02 00 00 00 00 00 00 00 00 00 00 - -# to_lower array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 8A 8C 8D 8E 96 9A 9F 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD BE BF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA 88 8B 9B CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D8 DA DB DC DD DE DF - E0 E1 E2 E3 E4 89 90 87 91 8F 92 94 95 93 97 99 - F0 98 9C 9E 9D F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 E7 CB E5 80 CC 81 82 83 E9 - E6 E8 EA ED EB EC 84 EE F1 EF 85 CD F2 F4 F3 86 - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD AE AF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D9 D9 DA DB DC DD DE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# sort_order array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 51 53 57 59 63 66 68 6A 75 77 79 7B 7D 81 - 91 93 95 97 9A 9C A6 A8 AA AC B0 B2 B3 B4 B5 B6 - B7 41 51 53 57 59 63 66 68 6A 75 77 79 7B 7D 81 - 91 93 95 97 9A 9C A6 A8 AA AC B0 B8 B9 BA BB BC - 41 41 53 59 7D 81 9C 41 41 41 41 41 41 53 59 59 - 59 59 6A 6A 6A 6A 7D 81 81 81 81 81 9C 9C 9C 9C - BD BE BF C0 C1 C2 C3 97 C4 C5 C6 C7 C8 C9 41 81 - CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 41 81 - D8 D9 DA DB 63 DC DD DE DF E0 E1 41 41 81 81 81 - E2 E3 E4 E5 E6 E7 E8 E9 AC AC EA EB EC ED EE EF - F0 F1 F2 F3 F4 41 59 41 59 59 6A 6A 6A 6A 81 81 - F0 81 9C 9C 9C 6A F6 F7 F8 F9 FA FB FC FD FE FF - -# Unicode mapping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 00C4 00C5 00C7 00C9 00D1 00D6 00DC 00E1 00E0 00E2 00E4 00E3 00E5 00E7 00E9 00E8 - 00EA 00EB 00ED 00EC 00EE 00EF 00F1 00F3 00F2 00F4 00F6 00F5 00FA 00F9 00FB 00FC - 2020 00B0 00A2 00A3 00A7 2022 00B6 00DF 00AE 00A9 2122 00B4 00A8 2260 00C6 00D8 - 221E 00B1 2264 2265 00A5 00B5 2202 2211 220F 03C0 222B 00AA 00BA 03A9 00E6 00F8 - 00BF 00A1 00AC 221A 0192 2248 2206 00AB 00BB 2026 00A0 00C0 00C3 00D5 0152 0153 - 2013 2014 201C 201D 2018 2019 00F7 25CA 00FF 0178 2044 20AC 2039 203A FB01 FB02 - 2021 00B7 201A 201E 2030 00C2 00CA 00C1 00CB 00C8 00CD 00CE 00CF 00CC 00D3 00D4 - F8FF 00D2 00DA 00DB 00D9 0131 02C6 02DC 00AF 02D8 02D9 02DA 00B8 02DD 02DB 02C7 - diff --git a/sql/share/charsets/macromancias.conf b/sql/share/charsets/macromancias.conf deleted file mode 100644 index a00d7d412e6..00000000000 --- a/sql/share/charsets/macromancias.conf +++ /dev/null @@ -1,97 +0,0 @@ -# -# Mac OS Roman, accent sensitive, case insensitive -# -# Sort order: Dutch, English, French, German (Duden), -# Italian, Latin, Pogtuguese, Spanish -# -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 10 - 20 01 01 01 01 01 01 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 00 00 00 00 00 00 00 02 00 00 00 00 00 00 01 01 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 02 - 00 00 00 00 02 00 00 00 00 00 00 20 01 01 01 02 - 00 00 00 00 00 00 00 00 02 01 00 00 00 00 00 00 - 00 00 00 00 00 20 01 01 01 01 01 01 01 01 01 01 - 00 01 01 01 01 02 00 00 00 00 00 00 00 00 00 00 - -# to_lower array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 8A 8C 8D 8E 96 9A 9F 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD BE BF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA 88 8B 9B CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D8 DA DB DC DD DE DF - E0 E1 E2 E3 E4 89 90 87 91 8F 92 94 95 93 97 99 - F0 98 9C 9E 9D F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 E7 CB E5 80 CC 81 82 83 E9 - E6 E8 EA ED EB EC 84 EE F1 EF 85 CD F2 F4 F3 86 - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD AE AF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D9 D9 DA DB DC DD DE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# sort_order array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 51 53 57 59 63 66 68 6A 75 77 79 7B 7D 81 - 91 93 95 97 9A 9C A6 A8 AA AC B0 B2 B3 B4 B5 B6 - B7 41 51 53 57 59 63 66 68 6A 75 77 79 7B 7D 81 - 91 93 95 97 9A 9C A6 A8 AA AC B0 B8 B9 BA BB BC - 4B 4D 55 5D 7F 8B A4 45 43 47 4B 49 4D 55 5D 5B - 5F 61 6E 6C 70 72 7F 85 83 87 8B 89 A0 9E A2 A4 - BD BE BF C0 C1 C2 C3 99 C4 C5 C6 C7 C8 C9 4F 8D - CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 4F 8D - D8 D9 DA DB 65 DC DD DE DF E0 E1 43 49 89 8F 8F - E2 E3 E4 E5 E6 E7 E8 E9 AE AE EA EB EC ED EE EF - F0 F1 F2 F3 F4 47 5F 45 61 5B 6E 70 70 6C 85 87 - F0 83 A0 A2 9E 72 F6 F7 F8 F9 FA FB FC FD FE FF - -# Unicode mapping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 00C4 00C5 00C7 00C9 00D1 00D6 00DC 00E1 00E0 00E2 00E4 00E3 00E5 00E7 00E9 00E8 - 00EA 00EB 00ED 00EC 00EE 00EF 00F1 00F3 00F2 00F4 00F6 00F5 00FA 00F9 00FB 00FC - 2020 00B0 00A2 00A3 00A7 2022 00B6 00DF 00AE 00A9 2122 00B4 00A8 2260 00C6 00D8 - 221E 00B1 2264 2265 00A5 00B5 2202 2211 220F 03C0 222B 00AA 00BA 03A9 00E6 00F8 - 00BF 00A1 00AC 221A 0192 2248 2206 00AB 00BB 2026 00A0 00C0 00C3 00D5 0152 0153 - 2013 2014 201C 201D 2018 2019 00F7 25CA 00FF 0178 2044 20AC 2039 203A FB01 FB02 - 2021 00B7 201A 201E 2030 00C2 00CA 00C1 00CB 00C8 00CD 00CE 00CF 00CC 00D3 00D4 - F8FF 00D2 00DA 00DB 00D9 0131 02C6 02DC 00AF 02D8 02D9 02DA 00B8 02DD 02DB 02C7 - diff --git a/sql/share/charsets/macromancsas.conf b/sql/share/charsets/macromancsas.conf deleted file mode 100644 index 1f67148680d..00000000000 --- a/sql/share/charsets/macromancsas.conf +++ /dev/null @@ -1,97 +0,0 @@ -# -# Mac OS Roman, accent sensitive, case sensitive -# -# Sort order: Dutch, English, French, German (Duden), -# Italian, Latin, Pogtuguese, Spanish -# -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 10 - 20 01 01 01 01 01 01 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 00 00 00 00 00 00 00 02 00 00 00 00 00 00 01 01 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 02 - 00 00 00 00 02 00 00 00 00 00 00 20 01 01 01 02 - 00 00 00 00 00 00 00 00 02 01 00 00 00 00 00 00 - 00 00 00 00 00 20 01 01 01 01 01 01 01 01 01 01 - 00 01 01 01 01 02 00 00 00 00 00 00 00 00 00 00 - -# to_lower array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 8A 8C 8D 8E 96 9A 9F 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD BE BF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA 88 8B 9B CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D8 DA DB DC DD DE DF - E0 E1 E2 E3 E4 89 90 87 91 8F 92 94 95 93 97 99 - F0 98 9C 9E 9D F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 E7 CB E5 80 CC 81 82 83 E9 - E6 E8 EA ED EB EC 84 EE F1 EF 85 CD F2 F4 F3 86 - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD AE AF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D9 D9 DA DB DC DD DE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# sort_order array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 51 53 57 59 63 66 68 6A 75 77 79 7B 7D 81 - 91 93 95 97 9A 9C A6 A8 AA AC B0 B2 B3 B4 B5 B6 - B7 42 52 54 58 5A 64 67 69 6B 76 78 7A 7C 7E 82 - 92 94 96 98 9B 9D A7 A9 AB AD B1 B8 B9 BA BB BC - 4B 4D 55 5D 7F 8B A4 46 44 48 4C 4A 4E 56 5E 5C - 60 62 6F 6D 71 73 80 86 84 88 8C 8A A1 9F A3 A5 - BD BE BF C0 C1 C2 C3 99 C4 C5 C6 C7 C8 C9 4F 8D - CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 50 8E - D8 D9 DA DB 65 DC DD DE DF E0 E1 43 49 89 8F 90 - E2 E3 E4 E5 E6 E7 E8 E9 AF AE EA EB EC ED EE EF - F0 F1 F2 F3 F4 47 5F 45 61 5B 6E 70 72 6C 85 87 - F0 83 A0 A2 9E 74 F6 F7 F8 F9 FA FB FC FD FE FF - -# Unicode mapping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 00C4 00C5 00C7 00C9 00D1 00D6 00DC 00E1 00E0 00E2 00E4 00E3 00E5 00E7 00E9 00E8 - 00EA 00EB 00ED 00EC 00EE 00EF 00F1 00F3 00F2 00F4 00F6 00F5 00FA 00F9 00FB 00FC - 2020 00B0 00A2 00A3 00A7 2022 00B6 00DF 00AE 00A9 2122 00B4 00A8 2260 00C6 00D8 - 221E 00B1 2264 2265 00A5 00B5 2202 2211 220F 03C0 222B 00AA 00BA 03A9 00E6 00F8 - 00BF 00A1 00AC 221A 0192 2248 2206 00AB 00BB 2026 00A0 00C0 00C3 00D5 0152 0153 - 2013 2014 201C 201D 2018 2019 00F7 25CA 00FF 0178 2044 20AC 2039 203A FB01 FB02 - 2021 00B7 201A 201E 2030 00C2 00CA 00C1 00CB 00C8 00CD 00CE 00CF 00CC 00D3 00D4 - F8FF 00D2 00DA 00DB 00D9 0131 02C6 02DC 00AF 02D8 02D9 02DA 00B8 02DD 02DB 02C7 - diff --git a/sql/share/charsets/pclatin1.xml b/sql/share/charsets/pclatin1.xml new file mode 100644 index 00000000000..742dcaec459 --- /dev/null +++ b/sql/share/charsets/pclatin1.xml @@ -0,0 +1,119 @@ +<?xml version='1.0' encoding="utf-8"?> + +<charsets> + +<charset name="pclatin1"> + +<ctype> +<map> + 00 + 20 30 30 30 30 30 30 20 20 28 28 28 28 28 30 30 + 30 30 30 30 30 30 30 30 30 30 20 30 30 30 30 30 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 + 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 + 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 30 + 02 02 02 02 02 02 02 02 02 02 02 02 02 02 01 01 + 01 02 01 02 02 02 02 02 02 01 01 10 10 10 10 10 + 02 02 02 02 02 01 10 10 10 10 10 10 10 10 10 10 + 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 20 +</map> +</ctype> + + +<lower> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 87 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 84 86 + 82 91 91 93 94 95 96 97 98 94 81 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A4 A6 A7 A8 A9 AA AB AC AD AE AF + B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF + C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF + D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</lower> + + +<upper> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 9A 90 41 8E 41 8F 80 45 45 45 49 49 49 8E 8F + 90 92 92 4F 99 4F 55 55 59 99 9A 9B 9C 9D 9E 9F + 41 49 4F 55 A5 A5 A6 A7 A8 A9 AA AB AC AD AE AF + B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF + C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF + D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</upper> + + +<unicode> +<map> +0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000a 000b 000c 000d 000e 000f +0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001a 001b 001c 001d 001e 001f +0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002a 002b 002c 002d 002e 002f +0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003a 003b 003c 003d 003e 003f +0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004a 004b 004c 004d 004e 004f +0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005a 005b 005c 005d 005e 005f +0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006a 006b 006c 006d 006e 006f +0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007a 007b 007c 007d 007e 007f +00c7 00fc 00e9 00e2 00e4 00e0 00e5 00e7 00ea 00eb 00e8 00ef 00ee 00ec 00c4 00c5 +00c9 00e6 00c6 00f4 00f6 00f2 00fb 00f9 00ff 00d6 00dc 00a2 00a3 00a5 20a7 0192 +00e1 00ed 00f3 00fa 00f1 00d1 00aa 00ba 00bf 2310 00ac 00bd 00bc 00a1 00ab 00bb +2591 2592 2593 2502 2524 2561 2562 2556 2555 2563 2551 2557 255d 255c 255b 2510 +2514 2534 252c 251c 2500 253c 255e 255f 255a 2554 2569 2566 2560 2550 256c 2567 +2568 2564 2565 2559 2558 2552 2553 256b 256a 2518 250c 2588 2584 258c 2590 2580 +03b1 00df 0393 03c0 03a3 03c3 00b5 03c4 03a6 0398 03a9 03b4 221e 03c6 03b5 2229 +2261 00b1 2265 2264 2320 2321 00f7 2248 00b0 2219 00b7 221a 207f 00b2 25a0 00a0 +</map> +</unicode> + + +<collation name="pclatin1"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 43 59 45 41 5C 41 5B 43 45 45 45 49 49 49 5C 5B + 45 5C 5C 4F 5D 4F 55 55 59 5D 59 24 24 24 24 24 + 41 49 4F 55 4E 4E A6 A7 3F A9 AA AB AC 21 22 22 + B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF + C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF + D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</collation> + +</charset> + +</charsets> diff --git a/sql/share/charsets/pclatin2.conf b/sql/share/charsets/pclatin2.xml index dea8d085595..4402edcd847 100644 --- a/sql/share/charsets/pclatin2.conf +++ b/sql/share/charsets/pclatin2.xml @@ -1,4 +1,11 @@ -# ctype array (must be 257 elements) +<?xml version='1.0' encoding="utf-8"?> + +<charsets> + +<charset name="pclatin2"> + +<ctype> +<map> 00 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 @@ -16,8 +23,12 @@ 02 01 01 01 02 01 01 01 02 00 00 00 00 01 01 00 01 02 01 01 02 02 01 02 01 01 02 01 02 01 02 00 00 00 00 00 00 00 00 00 00 00 00 02 01 02 00 48 +</map> +</ctype> -# to_lower array (must be 256 elements) + +<lower> +<map> 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F @@ -34,8 +45,12 @@ D0 D0 D4 89 D4 E5 A1 8C D8 D9 DA DB DC EE 85 DF A2 E1 93 E4 E4 E5 E7 E7 EA A3 E8 FB EC EC EE EF F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</lower> + -# to_upper array (must be 256 elements) +<upper> +<map> 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F @@ -52,26 +67,12 @@ D1 D1 D2 D3 D2 D5 D6 D7 B7 D9 DA DB DC DD DE DF E0 E1 E2 E3 E3 D5 E6 E6 E8 E9 E8 EB ED ED DD EF F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA EB FC FC FE FF +</map> +</upper> -# sort_order array (must be 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 47 48 4C 4F 54 55 56 57 5A 5B 5C 5E 5F 62 - 67 68 69 6C 71 74 75 76 77 78 7B 90 91 92 93 94 - 95 41 47 48 4C 4F 54 55 56 57 5A 5B 5C 5E 5F 62 - 67 68 69 6C 71 74 75 76 77 78 7B 96 97 98 99 9A - 48 74 4F 41 41 74 48 48 5C 4F 62 62 57 7B 41 48 - 4F 5C 5C 62 62 5C 5C 6C 6C 62 74 71 71 5C 9E 48 - 41 57 62 74 41 41 7B 7B 4F 4F AA 7B 48 6C AE AF - B0 B1 B2 B3 B4 41 41 4F 6C B5 BA BB BC 7B 7B BF - C0 C1 C2 C3 C4 C5 41 41 C8 C9 CA CB CC CD CE CF - 4C 4C 4C 4F 4C 60 57 57 4F D9 DA DB DC 71 74 DF - 62 70 62 60 60 60 6C 6C 69 74 69 74 78 78 71 EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA 74 69 69 FE FF -# Unicode mappping (must be 256 elements) +<unicode> +<map> 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F @@ -88,4 +89,31 @@ 0111 0110 010E 00CB 010F 0147 00CD 00CE 011B 2518 250C 2588 2584 0162 016E 2580 00D3 00DF 00D4 0143 0144 0148 0160 0161 0154 00DA 0155 0170 00FD 00DD 0163 00B4 00AD 02DD 02DB 02C7 02D8 00A7 00F7 00B8 00B0 00A8 02D9 0171 0158 0159 25A0 00A0 +</map> +</unicode> + + +<collation name="pclatin2"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 47 48 4C 4F 54 55 56 57 5A 5B 5C 5E 5F 62 + 67 68 69 6C 71 74 75 76 77 78 7B 90 91 92 93 94 + 95 41 47 48 4C 4F 54 55 56 57 5A 5B 5C 5E 5F 62 + 67 68 69 6C 71 74 75 76 77 78 7B 96 97 98 99 9A + 48 74 4F 41 41 74 48 48 5C 4F 62 62 57 7B 41 48 + 4F 5C 5C 62 62 5C 5C 6C 6C 62 74 71 71 5C 9E 48 + 41 57 62 74 41 41 7B 7B 4F 4F AA 7B 48 6C AE AF + B0 B1 B2 B3 B4 41 41 4F 6C B5 BA BB BC 7B 7B BF + C0 C1 C2 C3 C4 C5 41 41 C8 C9 CA CB CC CD CE CF + 4C 4C 4C 4F 4C 60 57 57 4F D9 DA DB DC 71 74 DF + 62 70 62 60 60 60 6C 6C 69 74 69 74 78 78 71 EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA 74 69 69 FE FF +</map> +</collation> + +</charset> +</charsets> diff --git a/sql/share/charsets/swe7.conf b/sql/share/charsets/swe7.xml index 49938800f39..ffa1d90608d 100644 --- a/sql/share/charsets/swe7.conf +++ b/sql/share/charsets/swe7.xml @@ -1,6 +1,11 @@ -# Configuration file for the swe7 character set +<?xml version='1.0' encoding="utf-8"?> -# ctype array (must have 257 elements) +<charsets> + +<charset name="swe7"> + +<ctype> +<map> 00 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 @@ -18,8 +23,12 @@ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +</map> +</ctype> + -# to_lower array (must have 256 elements) +<lower> +<map> 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F @@ -36,8 +45,12 @@ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</lower> -# to_upper array (must have 256 elements) + +<upper> +<map> 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F @@ -54,26 +67,12 @@ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</upper> -# sort_order array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 45 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5C 5D 5B 59 5F - 45 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5C 5D 5B 59 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF -# Unicode mapping (256 elements) +<unicode> +<map> 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F @@ -90,3 +89,33 @@ 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 +</map> +</unicode> + + +<collation name="swe7"> +<map> + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 45 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5C 5D 5B 59 5F + 45 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5C 5D 5B 59 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF + B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF + C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF + D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF +</map> +</collation> + +</charset> + +</charsets> + + diff --git a/sql/share/charsets/usa7.conf b/sql/share/charsets/usa7.conf deleted file mode 100644 index 380fc9b5d8b..00000000000 --- a/sql/share/charsets/usa7.conf +++ /dev/null @@ -1,92 +0,0 @@ -# Configuration file for the usa7 character set - -# ctype array (must have 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - -# to_lower array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# sort_order array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5C 5D 5B 5E 5F - 45 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 59 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 0000 -0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 -0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 -0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 -0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 -0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 -0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 -0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 -0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 diff --git a/sql/share/charsets/win1251.conf b/sql/share/charsets/win1251.conf deleted file mode 100644 index 2164cb36b9e..00000000000 --- a/sql/share/charsets/win1251.conf +++ /dev/null @@ -1,100 +0,0 @@ -# Configuration file for the win1251 character set - -# NOTE: this character set is deprecated. Please don't use it -# unless you must because of old tables. -# -# If you want to convert your files to charset cp1251, you can do: -# -# myisamchk -rq --set-character-set-name=cp1251 *.MYI - - -# ctype array (must have 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 01 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 02 10 10 10 10 10 10 10 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - -# to_lower array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F5 F7 F8 F9 FA FB FC FD FE FF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 A8 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D5 D7 D8 D9 DA DB DC DD DE DF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - -# sort_order array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 C6 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 C6 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C7 C8 C9 CA CB CC CD CE CF D0 - D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF E0 - C0 C1 C2 C3 C4 C5 C7 C8 C9 CA CB CC CD CE CF D0 - D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF E0 - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F -0402 0403 201A 0453 201E 2026 2020 2021 0000 2030 0409 2039 040A 040C 040B 040F -0452 2018 2019 201C 201D 2022 2013 2014 0000 2122 0459 203A 045A 045C 045B 045F -00A0 040E 045E 0408 00A4 0490 00A6 00A7 0401 00A9 0404 00AB 00AC 00AD 00AE 0407 -00B0 00B1 0406 0456 0491 00B5 00B6 00B7 0451 2116 0454 00BB 0458 0405 0455 0457 -0410 0411 0412 0413 0414 0415 0416 0417 0418 0419 041A 041B 041C 041D 041E 041F -0420 0421 0422 0423 0424 0425 0426 0427 0428 0429 042A 042B 042C 042D 042E 042F -0430 0431 0432 0433 0434 0435 0436 0437 0438 0439 043A 043B 043C 043D 043E 043F -0440 0441 0442 0443 0444 0445 0446 0447 0448 0449 044A 044B 044C 044D 044E 044F diff --git a/sql/share/charsets/win1251ukr.conf b/sql/share/charsets/win1251ukr.conf deleted file mode 100644 index da08e4c7d6f..00000000000 --- a/sql/share/charsets/win1251ukr.conf +++ /dev/null @@ -1,95 +0,0 @@ -# Configuration file for the win1251ukr character set - -# it's really, just a cp1251 charset with Ukranian letter -# marked as "letters" - -# ctype array (must have 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 01 10 01 10 10 10 10 01 - 10 10 01 02 10 10 10 10 02 10 02 10 10 10 10 02 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - -# to_lower array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 20 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 20 20 20 20 20 A5 20 20 A8 20 AA 20 20 20 20 AF - 20 20 B2 B2 A5 20 20 20 A8 20 AA 20 20 20 20 AF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF - -# to_upper array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 20 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 20 20 20 20 20 B4 20 20 B8 20 BA 20 20 20 20 BF - 20 20 B3 B3 B4 20 20 20 B8 20 BA 20 20 20 20 BF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# sort_order array (must have 256 elements) - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F - 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 20 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - A5 A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 B3 B4 - B5 B6 B7 B8 B9 BA BB BC BD BE BF C0 C1 C2 C3 C4 - C5 C6 C7 C8 C9 84 CA CB 88 CC 87 CD CE CF D0 8D - D1 D2 8C 8C 84 D3 D4 D5 88 D6 87 D7 D8 D9 DA 8D - 80 81 82 83 85 86 89 8A 8B 8E 8F 90 91 92 93 94 - 95 96 97 98 99 9A 9B 9C 9D 9E 9F A0 A1 A2 A3 A4 - 80 81 82 83 85 86 89 8A 8B 8E 8F 90 91 92 93 94 - 95 96 97 98 99 9A 9B 9C 9D 9E 9F A0 A1 A2 A3 A4 - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F -0402 0403 201A 0453 201E 2026 2020 2021 0000 2030 0409 2039 040A 040C 040B 040F -0452 2018 2019 201C 201D 2022 2013 2014 0000 2122 0459 203A 045A 045C 045B 045F -00A0 040E 045E 0408 00A4 0490 00A6 00A7 0401 00A9 0404 00AB 00AC 00AD 00AE 0407 -00B0 00B1 0406 0456 0491 00B5 00B6 00B7 0451 2116 0454 00BB 0458 0405 0455 0457 -0410 0411 0412 0413 0414 0415 0416 0417 0418 0419 041A 041B 041C 041D 041E 041F -0420 0421 0422 0423 0424 0425 0426 0427 0428 0429 042A 042B 042C 042D 042E 042F -0430 0431 0432 0433 0434 0435 0436 0437 0438 0439 043A 043B 043C 043D 043E 043F -0440 0441 0442 0443 0444 0445 0446 0447 0448 0449 044A 044B 044C 044D 044E 044F diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt index 6c1a6db674b..6c3196bfeba 100644 --- a/sql/share/czech/errmsg.txt +++ b/sql/share/czech/errmsg.txt @@ -208,8 +208,8 @@ v/* "Tabulka '%-.64s' je ozna-Bèena jako poru¹ená a poslední (automatická?) oprava se nezdaøila", "Some non-transactional changed tables couldn't be rolled back", "Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again', -"This operation cannot be performed with a running slave, run SLAVE STOP first", -"This operation requires a running slave, configure slave and do SLAVE START", +"This operation cannot be performed with a running slave, run STOP SLAVE first", +"This operation requires a running slave, configure slave and do START SLAVE", "The server is not configured as slave, fix in config file or with CHANGE MASTER TO", "Could not initialize master info structure, check permisions on master.info", "Could not create slave thread, check system resources", @@ -259,3 +259,4 @@ v/* "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt index 2067f13d593..dcc016511dd 100644 --- a/sql/share/danish/errmsg.txt +++ b/sql/share/danish/errmsg.txt @@ -202,8 +202,8 @@ "Tabellen '%-.64s' er markeret med fejl og sidste (automatiske?) REPAIR fejlede", "Advarsel: Visse data i tabeller der ikke understøtter transaktioner kunne ikke tilbagestilles", "Fler-udtryks transaktion krævede mere plads en 'max_binlog_cache_size' bytes. Forhøj værdien af denne variabel og prøv igen', -"Denne handling kunne ikke udføres med kørende slave, brug først kommandoen SLAVE STOP", -"Denne handling kræver en kørende slave. Konfigurer en slave og brug kommandoen SLAVE START", +"Denne handling kunne ikke udføres med kørende slave, brug først kommandoen STOP SLAVE", +"Denne handling kræver en kørende slave. Konfigurer en slave og brug kommandoen START SLAVE", "Denne server er ikke konfigureret som slave. Ret in config-filen eller brug kommandoen CHANGE MASTER TO", "Kunne ikke initialisere master info-struktur. Check om rettigheder i master.info", "Kunne ikke danne en slave-tråd. Check systemressourcerne", @@ -253,3 +253,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt index 0c8d652653f..6091616fc4a 100644 --- a/sql/share/dutch/errmsg.txt +++ b/sql/share/dutch/errmsg.txt @@ -210,8 +210,8 @@ "Tabel '%-.64s' staat als gecrashed gemarkeerd en de laatste (automatische?) reparatie poging mislukte", "Waarschuwing: Roll back mislukt voor sommige buiten transacties gewijzigde tabellen", "Multi-statement transactie vereist meer dan 'max_binlog_cache_size' bytes opslag. Verhoog deze mysqld variabele en probeer opnieuw', -"Deze operatie kan niet worden uitgevoerd met een actieve slave, doe eerst SLAVE STOP", -"Deze operatie vereist een actieve slave, configureer slave en doe dan SLAVE START", +"Deze operatie kan niet worden uitgevoerd met een actieve slave, doe eerst STOP SLAVE", +"Deze operatie vereist een actieve slave, configureer slave en doe dan START SLAVE", "De server is niet geconfigureerd als slave, fix in configuratie bestand of met CHANGE MASTER TO", "Kon master info structuur niet initialiseren, controleer permissies in master.info", "Kon slave thread niet aanmaken, controleer systeem resources", @@ -261,3 +261,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt index 68e4f07f246..465992e63b2 100644 --- a/sql/share/english/errmsg.txt +++ b/sql/share/english/errmsg.txt @@ -199,8 +199,8 @@ "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", "Some non-transactional changed tables couldn't be rolled back", "Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again', -"This operation cannot be performed with a running slave, run SLAVE STOP first", -"This operation requires a running slave, configure slave and do SLAVE START", +"This operation cannot be performed with a running slave, run STOP SLAVE first", +"This operation requires a running slave, configure slave and do START SLAVE", "The server is not configured as slave, fix in config file or with CHANGE MASTER TO", "Could not initialize master info structure, check permisions on master.info", "Could not create slave thread, check system resources", @@ -217,8 +217,8 @@ "Deadlock found when trying to get lock; Try restarting transaction", "The used table type doesn't support FULLTEXT indexes", "Cannot add foreign key constraint", -"Cannot add a child row: a foreign key constraint fails", -"Cannot delete a parent row: a foreign key constraint fails", +"Cannot add or update a child row: a foreign key constraint fails", +"Cannot delete or update a parent row: a foreign key constraint fails", "Error connecting to master: %-.128s", "Error running query on master: %-.128s", "Error when executing command %s: %-.128s", @@ -250,3 +250,4 @@ "Every derived table must have it's own alias", "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt index 13663cca8e2..43eb5de89a5 100644 --- a/sql/share/estonian/errmsg.txt +++ b/sql/share/estonian/errmsg.txt @@ -204,8 +204,8 @@ "Tabel '%-.64s' on märgitud vigaseks ja viimane (automaatne?) parandus ebaõnnestus", "Hoiatus: mõnesid transaktsioone mittetoetavaid tabeleid ei suudetud tagasi kerida", "Mitme lausendiga transaktsioon nõudis rohkem ruumi kui lubatud 'max_binlog_cache_size' muutujaga. Suurenda muutuja väärtust ja proovi uuesti", -"This operation cannot be performed with a running slave, run SLAVE STOP first", -"This operation requires a running slave, configure slave and do SLAVE START", +"This operation cannot be performed with a running slave, run STOP SLAVE first", +"This operation requires a running slave, configure slave and do START SLAVE", "The server is not configured as slave, fix in config file or with CHANGE MASTER TO", "Could not initialize master info structure, check permisions on master.info", "Could not create slave thread, check system resources", @@ -255,3 +255,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt index ac1764aa7eb..d7bb19c2876 100644 --- a/sql/share/french/errmsg.txt +++ b/sql/share/french/errmsg.txt @@ -199,8 +199,8 @@ "La table '%-.64s' est marquée 'crashed' et le dernier 'repair' a échoué", "Attention: certaines tables ne supportant pas les transactions ont été changées et elles ne pourront pas être restituées", "Cette transaction à commandes multiples nécessite plus de 'max_binlog_cache_size' octets de stockage, augmentez cette variable de mysqld et réessayez', -"Cette opération ne peut être réalisée avec un esclave actif, faites SLAVE STOP d'abord", -"Cette opération nécessite un esclave actif, configurez les esclaves et faites SLAVE START", +"Cette opération ne peut être réalisée avec un esclave actif, faites STOP SLAVE d'abord", +"Cette opération nécessite un esclave actif, configurez les esclaves et faites START SLAVE", "Le server n'est pas configuré comme un esclave, changez le fichier de configuration ou utilisez CHANGE MASTER TO", "Impossible d'initialiser les structures d'information de maître, vérifiez les permissions sur master.info", "Impossible de créer une tâche esclave, vérifiez les ressources système", @@ -250,3 +250,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt index c996066d0eb..765fbd875e2 100644 --- a/sql/share/german/errmsg.txt +++ b/sql/share/german/errmsg.txt @@ -208,8 +208,8 @@ "Tabelle '%-.64s' ist als defekt makiert und der letzte (automatische) Reparaturversuch schlug fehl.", "Warnung: Das Rollback konnte bei einigen Tabellen, die nicht mittels Transaktionen geändert wurden, nicht ausgeführt werden.", "Multi-Statement Transaktionen benötigen mehr als 'max_binlog_cache_size' Bytes An Speicher. Diese mysqld-Variable vergrössern und erneut versuchen.', -"Diese Operation kann nicht bei einem aktiven Slave durchgeführt werden. Das Kommand SLAVE STOP muss zuerst ausgeführt werden.", -"Diese Operation benötigt einen aktiven Slave. Slave konfigurieren und mittels SLAVE START aktivieren.", +"Diese Operation kann nicht bei einem aktiven Slave durchgeführt werden. Das Kommand STOP SLAVE muss zuerst ausgeführt werden.", +"Diese Operation benötigt einen aktiven Slave. Slave konfigurieren und mittels START SLAVE aktivieren.", "Der Server ist nicht als Slave konfigiriert. Im Konfigurations-File oder mittel CHANGE MASTER TO beheben.", "Konnte Master-Info-Struktur nicht initialisieren; Berechtigungen von master.info prüfen.", "Konnte keinen Slave-Thread starten. System-Resourcen überprüfen.", @@ -260,3 +260,4 @@ "Für jede abgeleitete Tabelle muss ein eigener Alias angegeben werden.", "Select %u wurde während der Optimierung reduziert.", "Tabelle '%-.64s', die in einem der SELECT-Befehle verwendet wurde kann nicht in %-.32s verwendet werden." +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt index 7e680216b3e..8831d4e47b9 100644 --- a/sql/share/greek/errmsg.txt +++ b/sql/share/greek/errmsg.txt @@ -199,8 +199,8 @@ "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", "Some non-transactional changed tables couldn't be rolled back", "Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again', -"This operation cannot be performed with a running slave, run SLAVE STOP first", -"This operation requires a running slave, configure slave and do SLAVE START", +"This operation cannot be performed with a running slave, run STOP SLAVE first", +"This operation requires a running slave, configure slave and do START SLAVE", "The server is not configured as slave, fix in config file or with CHANGE MASTER TO", "Could not initialize master info structure, check permisions on master.info", "Could not create slave thread, check system resources", @@ -250,3 +250,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt index 747d2be5a3b..8d6c321d316 100644 --- a/sql/share/hungarian/errmsg.txt +++ b/sql/share/hungarian/errmsg.txt @@ -201,8 +201,8 @@ "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", "Some non-transactional changed tables couldn't be rolled back", "Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again', -"This operation cannot be performed with a running slave, run SLAVE STOP first", -"This operation requires a running slave, configure slave and do SLAVE START", +"This operation cannot be performed with a running slave, run STOP SLAVE first", +"This operation requires a running slave, configure slave and do START SLAVE", "The server is not configured as slave, fix in config file or with CHANGE MASTER TO", "Could not initialize master info structure, check permisions on master.info", "Could not create slave thread, check system resources", @@ -252,3 +252,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt index ef7efa925af..451ad3e058b 100644 --- a/sql/share/italian/errmsg.txt +++ b/sql/share/italian/errmsg.txt @@ -199,8 +199,8 @@ "La tabella '%-.64s' e` segnalata come corrotta e l'ultima ricostruzione (automatica?) e` fallita", "Attenzione: Alcune delle modifiche alle tabelle non transazionali non possono essere ripristinate (roll back impossibile)", "La transazione a comandi multipli (multi-statement) ha richiesto piu` di 'max_binlog_cache_size' bytes di disco: aumentare questa variabile di mysqld e riprovare', -"Questa operazione non puo' essere eseguita con un database 'slave' che gira, lanciare prima SLAVE STOP", -"Questa operaione richiede un database 'slave', configurarlo ed eseguire SLAVE START", +"Questa operazione non puo' essere eseguita con un database 'slave' che gira, lanciare prima STOP SLAVE", +"Questa operaione richiede un database 'slave', configurarlo ed eseguire START SLAVE", "Il server non e' configurato come 'slave', correggere il file di configurazione cambiando CHANGE MASTER TO", "Impossibile inizializzare la struttura 'master info', controllare i permessi sul file master.info", "Impossibile creare il thread 'slave', controllare le risorse di sistema", @@ -219,25 +219,25 @@ "Impossibile aggiungere il vincolo di integrita' referenziale (foreign key constraint)", "Impossibile aggiungere la riga: un vincolo d'integrita' referenziale non e' soddisfatto", "Impossibile cancellare la riga: un vincolo d'integrita' referenziale non e' soddisfatto", -"Error connecting to master: %-.128s", -"Error running query on master: %-.128s", -"Error when executing command %s: %-.128s", -"Wrong usage of %s and %s", -"The used SELECT statements have a different number of columns", -"Can't execute the query because you have a conflicting read lock", -"Mixing of transactional and non-transactional tables is disabled", -"Option '%s' used twice in statement", -"User '%-.64s' has exceeded the '%s' resource (current value: %ld)", -"Access denied. You need the %-.128s privilege for this operation", -"Variable '%-.64s' is a LOCAL variable and can't be used with SET GLOBAL", -"Variable '%-.64s' is a GLOBAL variable and should be set with SET GLOBAL", -"Variable '%-.64s' doesn't have a default value", -"Variable '%-.64s' can't be set to the value of '%-.64s'", -"Wrong argument type to variable '%-.64s'", -"Variable '%-.64s' can only be set, not read", -"Wrong usage/placement of '%s'", -"This version of MySQL doesn't yet support '%s'", -"Got fatal error %d: '%-.128s' from master when reading data from binary log", +"Errore durante la connessione al master: %-.128s", +"Errore eseguendo una query sul master: %-.128s", +"Errore durante l'esecuzione del comando %s: %-.128s", +"Uso errato di %s e %s", +"La SELECT utilizzata ha un numero di colonne differente", +"Impossibile eseguire la query perche' c'e' un conflitto con in lock di lettura", +"E' disabilitata la possibilita' di mischiare tabelle transazionali e non-transazionali", +"L'opzione '%s' e' stata usata due volte nel comando", +"L'utente '%-.64s' ha ecceduto la risorsa '%s' (valore corrente: %ld)", +"Accesso non consentito. Serve il privilegio %-.128s per questa operazione", +"La variabile '%-.64s' e' una variabile locale ( LOCAL ) e non puo' essere cambiata usando SET GLOBAL", +"La variabile '%-.64s' e' una variabile globale ( GLOBAL ) e deve essere cambiata usando SET GLOBAL", +"La variabile '%-.64s' non ha un valore di default", +"Alla variabile '%-.64s' non puo' essere assegato il valore '%-.64s'", +"Tipo di valore errato per la variabile '%-.64s'", +"Alla variabile '%-.64s' e' di sola scrittura quindi puo' essere solo assegnato un valore, non letto", +"Uso/posizione di '%s' sbagliato", +"Questa versione di MySQL non supporta ancora '%s'", +"Errore fatale %d: '%-.128s' dal master leggendo i dati dal log binario", "Wrong foreign key definition for '%-.64s': %s", "Key reference and table reference doesn't match", "Cardinality error (more/less than %d columns)", @@ -250,3 +250,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt index 61b69000473..70ab2d6d42d 100644 --- a/sql/share/japanese/errmsg.txt +++ b/sql/share/japanese/errmsg.txt @@ -201,8 +201,8 @@ "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", "Some non-transactional changed tables couldn't be rolled back", "Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again', -"This operation cannot be performed with a running slave, run SLAVE STOP first", -"This operation requires a running slave, configure slave and do SLAVE START", +"This operation cannot be performed with a running slave, run STOP SLAVE first", +"This operation requires a running slave, configure slave and do START SLAVE", "The server is not configured as slave, fix in config file or with CHANGE MASTER TO", "Could not initialize master info structure, check permisions on master.info", "Could not create slave thread, check system resources", @@ -252,3 +252,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt index 9c367c43551..c18c3ed3873 100644 --- a/sql/share/korean/errmsg.txt +++ b/sql/share/korean/errmsg.txt @@ -199,8 +199,8 @@ "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", "Some non-transactional changed tables couldn't be rolled back", "Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again', -"This operation cannot be performed with a running slave, run SLAVE STOP first", -"This operation requires a running slave, configure slave and do SLAVE START", +"This operation cannot be performed with a running slave, run STOP SLAVE first", +"This operation requires a running slave, configure slave and do START SLAVE", "The server is not configured as slave, fix in config file or with CHANGE MASTER TO", "Could not initialize master info structure, check permisions on master.info", "Could not create slave thread, check system resources", @@ -250,3 +250,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt index a3fed98e81a..9cd99613f52 100644 --- a/sql/share/norwegian-ny/errmsg.txt +++ b/sql/share/norwegian-ny/errmsg.txt @@ -201,8 +201,8 @@ "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", "Some non-transactional changed tables couldn't be rolled back", "Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again', -"This operation cannot be performed with a running slave, run SLAVE STOP first", -"This operation requires a running slave, configure slave and do SLAVE START", +"This operation cannot be performed with a running slave, run STOP SLAVE first", +"This operation requires a running slave, configure slave and do START SLAVE", "The server is not configured as slave, fix in config file or with CHANGE MASTER TO", "Could not initialize master info structure, check permisions on master.info", "Could not create slave thread, check system resources", @@ -252,3 +252,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt index 26eabe3b91f..32fe6c30b34 100644 --- a/sql/share/norwegian/errmsg.txt +++ b/sql/share/norwegian/errmsg.txt @@ -201,8 +201,8 @@ "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", "Some non-transactional changed tables couldn't be rolled back", "Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again', -"This operation cannot be performed with a running slave, run SLAVE STOP first", -"This operation requires a running slave, configure slave and do SLAVE START", +"This operation cannot be performed with a running slave, run STOP SLAVE first", +"This operation requires a running slave, configure slave and do START SLAVE", "The server is not configured as slave, fix in config file or with CHANGE MASTER TO", "Could not initialize master info structure, check permisions on master.info", "Could not create slave thread, check system resources", @@ -252,3 +252,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt index 616a5d4919b..4b59a62f991 100644 --- a/sql/share/polish/errmsg.txt +++ b/sql/share/polish/errmsg.txt @@ -203,8 +203,8 @@ "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", "Some non-transactional changed tables couldn't be rolled back", "Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again', -"This operation cannot be performed with a running slave, run SLAVE STOP first", -"This operation requires a running slave, configure slave and do SLAVE START", +"This operation cannot be performed with a running slave, run STOP SLAVE first", +"This operation requires a running slave, configure slave and do START SLAVE", "The server is not configured as slave, fix in config file or with CHANGE MASTER TO", "Could not initialize master info structure, check permisions on master.info", "Could not create slave thread, check system resources", @@ -254,3 +254,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt index 04a9afaa808..7236bd86652 100644 --- a/sql/share/portuguese/errmsg.txt +++ b/sql/share/portuguese/errmsg.txt @@ -199,8 +199,8 @@ "Tabela '%-.64s' está marcada como danificada e a última reparação (automática?) falhou", "Aviso: Algumas tabelas não-transacionais alteradas não puderam ser reconstituídas (rolled back)", "Transações multi-declaradas (multi-statement transactions) requeriram mais do que o valor limite (max_binlog_cache_size) de bytes para armazenagem. Aumente o valor desta variável do mysqld e tente novamente", -"Esta operação não pode ser realizada com um 'slave' em execução. Execute SLAVE STOP primeiro", -"Esta operação requer um 'slave' em execução. Configure o 'slave' e execute SLAVE START", +"Esta operação não pode ser realizada com um 'slave' em execução. Execute STOP SLAVE primeiro", +"Esta operação requer um 'slave' em execução. Configure o 'slave' e execute START SLAVE", "O servidor não está configurado como 'slave'. Acerte o arquivo de configuração ou use CHANGE MASTER TO", "Não pode inicializar a estrutura de informação do 'master'. Verifique as permissões em 'master.info'", "Não conseguiu criar 'thread' de 'slave'. Verifique os recursos do sistema", @@ -250,3 +250,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt index 0ae6fc8e51a..0b8bbe1c219 100644 --- a/sql/share/romanian/errmsg.txt +++ b/sql/share/romanian/errmsg.txt @@ -203,8 +203,8 @@ "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", "Some non-transactional changed tables couldn't be rolled back", "Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again', -"This operation cannot be performed with a running slave, run SLAVE STOP first", -"This operation requires a running slave, configure slave and do SLAVE START", +"This operation cannot be performed with a running slave, run STOP SLAVE first", +"This operation requires a running slave, configure slave and do START SLAVE", "The server is not configured as slave, fix in config file or with CHANGE MASTER TO", "Could not initialize master info structure, check permisions on master.info", "Could not create slave thread, check system resources", @@ -254,3 +254,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt index 343178b3118..2f1eedd207c 100644 --- a/sql/share/russian/errmsg.txt +++ b/sql/share/russian/errmsg.txt @@ -202,8 +202,8 @@ "ôÁÂÌÉÃÁ '%-.64s' ÐÏÍÅÞÅÎÁ ËÁË ÉÓÐÏÒÞÅÎÎÁÑ É ÐÏÓÌÅÄÎÑÑ ÐÏÐÙÔËÁ ÉÓÐÒÁ×ÌÅÎÉÑ (Á×ÔÏÍÁÔÉÞÅÓËÁÑ?) ÎÅ ÕÄÁÌÁÓØ", "ðÒÅÄÕÐÒÅÖÄÅÎÉÅ: ÎÅËÏÔÏÒÙÅ ÎÅÔÒÁÎÚÁËÃÉÏÎÎÙÅ ÔÁÂÌÉÃÙ ÎÅ ÐÏÄÞÉÎÑÀÔÓÑ ROLLBACK", "íÎÏÇÏÚÁÐÒÏÓÎÁÑ ÔÒÁÎÚÁËÃÉÑ ÔÒÅÂÕÅÔ Õ×ÅÌÉÞÅÎÉÑ 'max_binlog_cache_size' - Õ×ÅÌÉÞÔÅ ÜÔÕ ÐÅÒÅÍÅÎÎÕÀ É ÐÏÐÒÏÂÕÊÔÅ ÅÝÅ ÒÁÚ", -"üÔÁ ÏÐÅÒÁÃÉÑ ÎÅ×ÏÚÍÏÖÎÁ Ó ÁËÔÉ×ÎÙÍ slave, ÎÁÄÏ SLAVE STOP", -"üÔÁ ÏÐÅÒÁÃÉÑ ÎÅ×ÏÚÍÏÖÎÁ Ó ÐÁÓÓÉ×ÎÙÍ slave, ÎÁÄÏ SLAVE START", +"üÔÁ ÏÐÅÒÁÃÉÑ ÎÅ×ÏÚÍÏÖÎÁ Ó ÁËÔÉ×ÎÙÍ slave, ÎÁÄÏ STOP SLAVE", +"üÔÁ ÏÐÅÒÁÃÉÑ ÎÅ×ÏÚÍÏÖÎÁ Ó ÐÁÓÓÉ×ÎÙÍ slave, ÎÁÄÏ START SLAVE", "üÔÏÔ ÓÅÒ×ÅÒ ÎÅ slave, ÉÓÐÒÁ×ØÔÅ × ËÏÎÆÉÇÕÒÁÃÉÏÎÎÏÍ ÆÁÊÌÅ ÉÌÉ ËÏÍÍÁÎÄÏÊ CHANGE MASTER TO", "îÅ ÐÏÌÕÞÉÌÏÓØ ÉÎÉÃÉÁÌÉÚÉÒÏ×ÁÔØ ÓÔÒÕËÔÕÒÕ master info, ÐÒÏ×ÅÒÔÅ persmissions ÎÁ ÆÁÊÌÅ master.info", "îÅ ÍÏÇÕ ÓÏÚÄÁÔØ ÐÒÏÃÅÓÓ SLAVE, ÐÒÏ×ÅÒØÔÅ ÓÉÓÔÅÍÎÙÅ ÒÅÓÕÒÓÙ", @@ -253,3 +253,4 @@ "Every derived table must have it's own alias" "Select %u ÂÙÌ ÕÐÒÁÚÄÎÅÎ × ÐÒÏÃÅÓÓÅ ÏÐÔÉÍÉÚÁÃÉÉ", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file diff --git a/sql/share/serbian/errmsg.txt b/sql/share/serbian/errmsg.txt index b04b94b82e8..75cfd73f3f0 100644 --- a/sql/share/serbian/errmsg.txt +++ b/sql/share/serbian/errmsg.txt @@ -205,8 +205,8 @@ "Tabela '%-.64s' je markirana kao ošteæena, a zadnja (automatska?) popravka je bila neuspela", "Upozorenje: Neke izmenjene tabele ne podržavaju komandu 'ROLLBACK'", "Transakcija sa više stavki zahtevala je više od 'max_binlog_cache_size' bajtova skladišnog prostora. Uveæajte ovu promenljivu servera i pokušajte ponovo', -"Ova operacija ne može biti izvršena dok je aktivan podreðeni server. Zadajte prvo komandu 'SLAVE STOP' da zaustavite podreðeni server.", -"Ova operacija zahteva da je aktivan podreðeni server. Konfigurišite prvo podreðeni server i onda izvršite komandu 'SLAVE START'", +"Ova operacija ne može biti izvršena dok je aktivan podreðeni server. Zadajte prvo komandu 'STOP SLAVE' da zaustavite podreðeni server.", +"Ova operacija zahteva da je aktivan podreðeni server. Konfigurišite prvo podreðeni server i onda izvršite komandu 'START SLAVE'", "Server nije konfigurisan kao podreðeni server, ispravite konfiguracioni file ili na njemu izvršite komandu 'CHANGE MASTER TO'", "Nisam mogao da inicijalizujem informacionu strukturu glavnog servera, proverite da li imam privilegije potrebne za pristup file-u 'master.info'", "Nisam mogao da startujem thread za podreðeni server, proverite sistemske resurse", @@ -246,3 +246,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt index f8f52f86b6a..de354f234c7 100644 --- a/sql/share/slovak/errmsg.txt +++ b/sql/share/slovak/errmsg.txt @@ -207,8 +207,8 @@ "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", "Some non-transactional changed tables couldn't be rolled back", "Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again', -"This operation cannot be performed with a running slave, run SLAVE STOP first", -"This operation requires a running slave, configure slave and do SLAVE START", +"This operation cannot be performed with a running slave, run STOP SLAVE first", +"This operation requires a running slave, configure slave and do START SLAVE", "The server is not configured as slave, fix in config file or with CHANGE MASTER TO", "Could not initialize master info structure, check permisions on master.info", "Could not create slave thread, check system resources", @@ -258,3 +258,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt index 674d36e9d8c..a528c3e6b36 100644 --- a/sql/share/spanish/errmsg.txt +++ b/sql/share/spanish/errmsg.txt @@ -200,8 +200,8 @@ "Tabla '%-.64s' está marcada como crashed y la última reparación (automactica?) falló", "Aviso: Algunas tablas no transancionales no pueden tener rolled back", "Multipla transición necesita mas que 'max_binlog_cache_size' bytes de almacenamiento. Aumente esta variable mysqld y tente de nuevo', -"Esta operación no puede ser hecha con el esclavo funcionando, primero use SLAVE STOP", -"Esta operación necesita el esclavo funcionando, configure esclavo y haga el SLAVE START", +"Esta operación no puede ser hecha con el esclavo funcionando, primero use STOP SLAVE", +"Esta operación necesita el esclavo funcionando, configure esclavo y haga el START SLAVE", "El servidor no está configurado como esclavo, edite el archivo config file o con CHANGE MASTER TO", "No puedo inicializar la estructura info del master, verifique permisiones en el master.info", "No puedo crear el thread esclavo, verifique recursos del sistema", @@ -251,3 +251,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt index 052568ac30d..5473f4e8e42 100644 --- a/sql/share/swedish/errmsg.txt +++ b/sql/share/swedish/errmsg.txt @@ -199,8 +199,8 @@ "Tabell '%-.64s' är crashad och senast (automatiska?) reparation misslyckades", "Några icke transaktionella tabeller kunde inte återställas vid ROLLBACK", "Transaktionen krävde mera än 'max_binlog_cache_size' minne. Utöka denna mysqld variabel och försök på nytt", -"Denna operation kan inte göras under replikering; Gör SLAVE STOP först", -"Denna operation kan endast göras under replikering; Konfigurera slaven och gör SLAVE START", +"Denna operation kan inte göras under replikering; Gör STOP SLAVE först", +"Denna operation kan endast göras under replikering; Konfigurera slaven och gör START SLAVE", "Servern är inte konfigurerade som en replikations slav. Ändra konfigurationsfilen eller gör CHANGE MASTER TO", "Kunde inte initializera replications-strukturerna. Kontrollera privilegerna för 'master.info'", "Kunde inte starta en tråd för replikering", @@ -250,3 +250,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt index 122506f17cf..0b91786d1f3 100644 --- a/sql/share/ukrainian/errmsg.txt +++ b/sql/share/ukrainian/errmsg.txt @@ -204,8 +204,8 @@ "ôÁÂÌÉÃÀ '%-.64s' ÍÁÒËÏ×ÁÎÏ ÑË Ú¦ÐÓÏ×ÁÎÕ ÔÁ ÏÓÔÁÎΤ (Á×ÔÏÍÁÔÉÞÎÅ?) צÄÎÏ×ÌÅÎÎÑ ÎÅ ×ÄÁÌÏÓÑ", "úÁÓÔÅÒÅÖÅÎÎÑ: äÅÑ˦ ÎÅÔÒÁÎÚÁËæÊΦ ÚͦÎÉ ÔÁÂÌÉÃØ ÎÅ ÍÏÖÎÁ ÂÕÄÅ ÐÏ×ÅÒÎÕÔÉ", "ôÒÁÎÚÁËÃ¦Ñ Ú ÂÁÇÁÔØÍÁ ×ÉÒÁÚÁÍÉ ×ÉÍÁÇÁ¤ ¦ÌØÛÅ Î¦Ö 'max_binlog_cache_size' ÂÁÊÔ¦× ÄÌÑ ÚÂÅÒ¦ÇÁÎÎÑ. ú¦ÌØÛÔÅ ÃÀ ÚͦÎÎÕ mysqld ÔÁ ÓÐÒÏÂÕÊÔÅ ÚÎÏ×Õ', -"ïÐÅÒÁÃ¦Ñ ÎÅ ÍÏÖÅ ÂÕÔÉ ×ÉËÏÎÁÎÁ Ú ÚÁÐÕÝÅÎÉÍ Ð¦ÄÌÅÇÌÉÍ, ÓÐÏÞÁÔËÕ ×ÉËÏÎÁÊÔÅ SLAVE STOP", -"ïÐÅÒÁÃ¦Ñ ×ÉÍÁÇÁ¤ ÚÁÐÕÝÅÎÏÇÏ Ð¦ÄÌÅÇÌÏÇÏ, ÚËÏÎƦÇÕÒÕÊÔŠЦÄÌÅÇÌÏÇÏ ÔÁ ×ÉËÏÎÁÊÔÅ SLAVE START", +"ïÐÅÒÁÃ¦Ñ ÎÅ ÍÏÖÅ ÂÕÔÉ ×ÉËÏÎÁÎÁ Ú ÚÁÐÕÝÅÎÉÍ Ð¦ÄÌÅÇÌÉÍ, ÓÐÏÞÁÔËÕ ×ÉËÏÎÁÊÔÅ STOP SLAVE", +"ïÐÅÒÁÃ¦Ñ ×ÉÍÁÇÁ¤ ÚÁÐÕÝÅÎÏÇÏ Ð¦ÄÌÅÇÌÏÇÏ, ÚËÏÎƦÇÕÒÕÊÔŠЦÄÌÅÇÌÏÇÏ ÔÁ ×ÉËÏÎÁÊÔÅ START SLAVE", "óÅÒ×ÅÒ ÎÅ ÚËÏÎƦÇÕÒÏ×ÁÎÏ ÑË Ð¦ÄÌÅÇÌÉÊ, ×ÉÐÒÁ×ÔÅ ÃÅ Õ ÆÁÊ̦ ËÏÎƦÇÕÒÁæ§ ÁÂÏ Ú CHANGE MASTER TO", "îÅ ÍÏÖÕ ¦Î¦Ã¦Á̦ÚÕ×ÁÔÉ ÓÔÒÕËÔÕÒÕ ÉÎÆÏÒÍÁæ§ ÇÏÌÏ×ÎÏÇÏ, ÐÅÒÅצÒÔÅ ÐÒÁ×Á ÄÏÓÔÕÐÕ ÎÁ master.info", "îÅ ÍÏÖÕ ÓÔ×ÏÒÉÔÉ Ð¦ÄÌÅÇÌÕ Ç¦ÌËÕ, ÐÅÒÅצÒÔÅ ÓÉÓÔÅÍΦ ÒÅÓÕÒÓÉ", @@ -255,3 +255,4 @@ "Every derived table must have it's own alias" "Select %u was ÓËÁÓÏ×ÁÎÏ ÐÒÉ ÏÐÔÉÍiÚÁÃii", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client"
\ No newline at end of file diff --git a/sql/slave.cc b/sql/slave.cc index 0fbf4f67846..3e28c21c9cc 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -416,6 +416,7 @@ int terminate_slave_threads(MASTER_INFO* mi,int thread_mask,bool skip_lock) } if ((thread_mask & (SLAVE_IO|SLAVE_FORCE_ALL)) && mi->slave_running) { + DBUG_PRINT("info",("Terminating IO thread")); mi->abort_slave=1; if ((error=terminate_slave_thread(mi->io_thd,io_lock, io_cond_lock, @@ -426,6 +427,7 @@ int terminate_slave_threads(MASTER_INFO* mi,int thread_mask,bool skip_lock) } if ((thread_mask & (SLAVE_SQL|SLAVE_FORCE_ALL)) && mi->rli.slave_running) { + DBUG_PRINT("info",("Terminating SQL thread")); DBUG_ASSERT(mi->rli.sql_thd != 0) ; mi->rli.abort_slave=1; if ((error=terminate_slave_thread(mi->rli.sql_thd,sql_lock, @@ -1750,7 +1752,7 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type) VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals)); #endif - if ((ulong) thd->variables.max_join_size == (ulong) HA_POS_ERROR) + if (thd->variables.max_join_size == HA_POS_ERROR) thd->options |= OPTION_BIG_SELECTS; if (thd_type == SLAVE_THD_SQL) @@ -2575,12 +2577,6 @@ static int process_io_rotate(MASTER_INFO *mi, Rotate_log_event *rev) memcpy(mi->master_log_name, rev->new_log_ident, rev->ident_len+1); mi->master_log_pos= rev->pos; - - pthread_mutex_lock(&mi->rli.data_lock); - memcpy(mi->rli.master_log_name, rev->new_log_ident, rev->ident_len+1); - mi->rli.master_log_pos= rev->pos; - pthread_mutex_unlock(&mi->rli.data_lock); - DBUG_PRINT("info", ("master_log_pos: '%s' %d", mi->master_log_name, (ulong) mi->master_log_pos)); #ifndef DBUG_OFF @@ -2968,7 +2964,12 @@ static IO_CACHE *reopen_relay_log(RELAY_LOG_INFO *rli, const char **errmsg) if ((rli->cur_log_fd=open_binlog(cur_log,rli->relay_log_name, errmsg)) <0) DBUG_RETURN(0); - my_b_seek(cur_log,rli->relay_log_pos); + /* + We want to start exactly where we was before: + relay_log_pos Current log pos + pending Number of bytes already processed from the event + */ + my_b_seek(cur_log,rli->relay_log_pos + rli->pending); DBUG_RETURN(cur_log); } diff --git a/sql/slave.h b/sql/slave.h index 358762306e2..8122975a809 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -188,11 +188,13 @@ typedef struct st_relay_log_info volatile bool abort_slave, slave_running; bool log_pos_current; bool skip_log_purge; - + bool inside_transaction; + st_relay_log_info() - :info_fd(-1),cur_log_fd(-1), cur_log_old_open_count(0), abort_pos_wait(0), - slave_run_id(0), inited(0), abort_slave(0), slave_running(0), - log_pos_current(0), skip_log_purge(0) + :info_fd(-1),cur_log_fd(-1), cur_log_old_open_count(0), abort_pos_wait(0), + slave_run_id(0), inited(0), abort_slave(0), slave_running(0), + log_pos_current(0), skip_log_purge(0), + inside_transaction(0) /* the default is autocommit=1 */ { relay_log_name[0] = master_log_name[0] = 0; bzero(&info_file,sizeof(info_file)); diff --git a/sql/spatial.cc b/sql/spatial.cc index b21d30e4b53..5c6be3c221c 100644 --- a/sql/spatial.cc +++ b/sql/spatial.cc @@ -44,7 +44,7 @@ static Geometry::GClassInfo ci_collection[] = IMPLEMENT_GEOM(GGeometryCollection, wkbGeometryCollection, "GEOMETRYCOLLECTION") }; -static Geometry::GClassInfo *ci_collection_end = ci_collection + sizeof(ci_collection); +static Geometry::GClassInfo *ci_collection_end = ci_collection + sizeof(ci_collection)/sizeof(ci_collection[0]); /***************************** Geometry *******************************/ @@ -66,7 +66,7 @@ Geometry::GClassInfo *Geometry::find_class(const char *name, size_t len) cur_rt < ci_collection_end; ++cur_rt) { if ((cur_rt->m_name[len] == 0) && - (strncmp(cur_rt->m_name, name, len) == 0)) + (strncasecmp(cur_rt->m_name, name, len) == 0)) { return cur_rt; } @@ -506,7 +506,7 @@ int GPolygon::get_data_as_text(String *txt) const for (; n_linear_rings>0; --n_linear_rings) { - if(no_data(data, 4)) + if (no_data(data, 4)) return 1; uint32 n_points = uint4korr(data); data += 4; @@ -593,7 +593,7 @@ int GPolygon::area(double *ar) const data += (8+8); } lr_area=fabs(lr_area)/2; - if(result==-1) result=lr_area; + if (result==-1) result=lr_area; else result-=lr_area; } *ar=fabs(result); @@ -1344,7 +1344,7 @@ int GGeometryCollection::get_mbr(MBR *mbr) const data += 4; for (; n_objects>0; --n_objects) { - if(no_data(data, WKB_HEADER_SIZE)) + if (no_data(data, WKB_HEADER_SIZE)) return 1; uint32 wkb_type = uint4korr(data + sizeof(char)); data += WKB_HEADER_SIZE; diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index e2ddd2cba81..b87f620901d 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -1936,7 +1936,7 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table, ulong rights, ulong col_rights, bool revoke_grant) { - char grantor[HOSTNAME_LENGTH+1+USERNAME_LENGTH]; + char grantor[HOSTNAME_LENGTH+USERNAME_LENGTH+2]; int old_row_exists = 1; int error=0; ulong store_table_rights, store_col_rights; diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc index c1d49fdab51..a424d877919 100644 --- a/sql/sql_analyse.cc +++ b/sql/sql_analyse.cc @@ -403,7 +403,6 @@ void field_real::add() length= my_sprintf(buff, (buff, "%-.*f", (int) decs, num)); #endif - // We never need to check further than this end = buff + length - 1 - decs + max_notzero_dec_len; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index f7a0c6960d4..47cbaf088a3 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -19,6 +19,7 @@ #include "mysql_priv.h" #include "sql_acl.h" +#include "sql_select.h" #include <m_ctype.h> #include <my_dir.h> #include <hash.h> @@ -306,7 +307,8 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh, close_old_data_files(thd,thd->open_tables,1,1); bool found=1; /* Wait until all threads has closed all the tables we had locked */ - DBUG_PRINT("info", ("Waiting for others threads to close their open tables")); + DBUG_PRINT("info", + ("Waiting for others threads to close their open tables")); while (found && ! thd->killed) { found=0; @@ -347,12 +349,40 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh, } -/* Put all tables used by thread in free list */ +/* + Close all tables used by thread + + SYNOPSIS + close_thread_tables() + thd Thread handler + lock_in_use Set to 1 (0 = default) if caller has a lock on + LOCK_open + skip_derived Set to 1 (0 = default) if we should not free derived + tables. + + IMPLEMENTATION + Unlocks tables and frees derived tables. + Put all normal tables used by thread in free list. +*/ -void close_thread_tables(THD *thd, bool locked) +void close_thread_tables(THD *thd, bool lock_in_use, bool skip_derived) { DBUG_ENTER("close_thread_tables"); + if (thd->derived_tables && !skip_derived) + { + TABLE *table, *next; + /* + Close all derived tables generated from questions like + SELECT * from (select * from t1)) + */ + for (table= thd->derived_tables ; table ; table= next) + { + next= table->next; + free_tmp_table(thd, table); + } + thd->derived_tables= 0; + } if (thd->locked_tables) { ha_commit_stmt(thd); // If select statement @@ -363,10 +393,11 @@ void close_thread_tables(THD *thd, bool locked) if (thd->lock) { - mysql_unlock_tables(thd, thd->lock); thd->lock=0; + mysql_unlock_tables(thd, thd->lock); + thd->lock=0; } /* VOID(pthread_sigmask(SIG_SETMASK,&thd->block_signals,NULL)); */ - if (!locked) + if (!lock_in_use) VOID(pthread_mutex_lock(&LOCK_open)); safe_mutex_assert_owner(&LOCK_open); @@ -385,7 +416,7 @@ void close_thread_tables(THD *thd, bool locked) /* Tell threads waiting for refresh that something has happened */ VOID(pthread_cond_broadcast(&COND_refresh)); } - if (!locked) + if (!lock_in_use) VOID(pthread_mutex_unlock(&LOCK_open)); /* VOID(pthread_sigmask(SIG_SETMASK,&thd->signals,NULL)); */ DBUG_VOID_RETURN; @@ -553,7 +584,7 @@ TABLE **find_temporary_table(THD *thd, const char *db, const char *table_name) uint key_length= (uint) (strmov(strmov(key,db)+1,table_name)-key)+1; TABLE *table,**prev; - int4store(key+key_length,thd->slave_proxy_id); + int4store(key+key_length,thd->variables.pseudo_thread_id); key_length += 4; prev= &thd->temporary_tables; @@ -593,7 +624,7 @@ bool rename_temporary_table(THD* thd, TABLE *table, const char *db, (strmov((table->real_name=strmov(table->table_cache_key=key, db)+1), table_name) - table->table_cache_key)+1; - int4store(key+table->key_length,thd->slave_proxy_id); + int4store(key+table->key_length,thd->variables.pseudo_thread_id); table->key_length += 4; return 0; } @@ -715,7 +746,7 @@ TABLE *reopen_name_locked_table(THD* thd, TABLE_LIST* table_list) table->tablenr=thd->current_tablenr++; table->used_fields=0; table->const_table=0; - table->outer_join=table->null_row=table->maybe_null=0; + table->outer_join= table->null_row= table->maybe_null= table->force_index= 0; table->status=STATUS_NO_RECORD; table->keys_in_use_for_query= table->keys_in_use; table->used_keys= table->keys_for_keyread; @@ -747,7 +778,7 @@ TABLE *open_table(THD *thd,const char *db,const char *table_name, if (thd->killed) DBUG_RETURN(0); key_length= (uint) (strmov(strmov(key,db)+1,table_name)-key)+1; - int4store(key + key_length, thd->slave_proxy_id); + int4store(key + key_length, thd->variables.pseudo_thread_id); for (table=thd->temporary_tables; table ; table=table->next) { @@ -761,6 +792,7 @@ TABLE *open_table(THD *thd,const char *db,const char *table_name, DBUG_RETURN(0); } table->query_id=thd->query_id; + thd->lex.tmp_table_used= 1; goto reset; } } @@ -873,7 +905,7 @@ TABLE *open_table(THD *thd,const char *db,const char *table_name, table->tablenr=thd->current_tablenr++; table->used_fields=0; table->const_table=0; - table->outer_join=table->null_row=table->maybe_null=0; + table->outer_join= table->null_row= table->maybe_null= table->force_index= 0; table->status=STATUS_NO_RECORD; table->keys_in_use_for_query= table->keys_in_use; table->used_keys= table->keys_for_keyread; @@ -944,6 +976,7 @@ bool reopen_table(TABLE *table,bool locked) tmp.status= table->status; tmp.keys_in_use_for_query= tmp.keys_in_use; tmp.used_keys= tmp.keys_for_keyread; + tmp.force_index= tmp.force_index; /* Get state */ tmp.key_length= table->key_length; @@ -1561,7 +1594,7 @@ TABLE *open_temporary_table(THD *thd, const char *path, const char *db, +1), table_name) - tmp_table->table_cache_key)+1; int4store(tmp_table->table_cache_key + tmp_table->key_length, - thd->slave_proxy_id); + thd->variables.pseudo_thread_id); tmp_table->key_length += 4; if (link_in_list) @@ -1653,6 +1686,7 @@ const Field *not_found_field= (Field*) 0x1; thd - pointer to current thread structure item - field item that should be found tables - tables for scaning + where - table where field found will be returned via this parameter report_error - if FALSE then do not report error if item not found and return not_found_field; @@ -1666,7 +1700,7 @@ const Field *not_found_field= (Field*) 0x1; Field * find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables, - bool report_error) + TABLE_LIST **where, bool report_error) { Field *found=0; const char *db=item->db_name; @@ -1687,6 +1721,7 @@ find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables, grant_option && !thd->master_access,1); if (find) { + (*where)= tables; if (find == WRONG_GRANT) return (Field*) 0; if (db || !thd->where) @@ -1706,19 +1741,15 @@ find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables, if (!found_table && report_error) { char buff[NAME_LEN*2+1]; - if (db) + if (db && db[0]) { strxnmov(buff,sizeof(buff)-1,db,".",table_name,NullS); table_name=buff; } if (report_error) { - if (thd->lex.current_select->get_master()->order_list.elements) - my_printf_error(ER_TABLENAME_NOT_ALLOWED_HERE, ER(ER_TABLENAME_NOT_ALLOWED_HERE), - MYF(0), table_name, thd->where); - else - my_printf_error(ER_UNKNOWN_TABLE, ER(ER_UNKNOWN_TABLE), MYF(0), - table_name, thd->where); + my_printf_error(ER_UNKNOWN_TABLE, ER(ER_UNKNOWN_TABLE), MYF(0), + table_name, thd->where); } else return (Field*) not_found_field; @@ -1734,6 +1765,14 @@ find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables, bool allow_rowid= tables && !tables->next; // Only one table for (; tables ; tables=tables->next) { + if (!tables->table) + { + if (report_error) + my_printf_error(ER_BAD_FIELD_ERROR,ER(ER_BAD_FIELD_ERROR),MYF(0), + item->full_name(),thd->where); + return (Field*) not_found_field; + } + Field *field=find_field_in_table(thd,tables->table,name,length, grant_option && !thd->master_access, allow_rowid); @@ -1741,6 +1780,7 @@ find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables, { if (field == WRONG_GRANT) return (Field*) 0; + (*where)= tables; if (found) { if (!thd->where) // Returns first found @@ -1925,6 +1965,7 @@ bool setup_tables(TABLE_LIST *tables) table->maybe_null=test(table->outer_join=table_list->outer_join); table->tablenr=tablenr; table->map= (table_map) 1 << tablenr; + table->force_index= table_list->force_index; if (table_list->use_index) { key_map map= get_key_map_from_key_list(table, diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index f0c16369ef9..dc112343844 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -1064,6 +1064,8 @@ void Query_cache::invalidate(THD *thd, TABLE_LIST *tables_used, for (; tables_used; tables_used=tables_used->next) { DBUG_ASSERT(!using_transactions || tables_used->table!=0); + if (tables_used->derived) + continue; if (using_transactions && tables_used->table->file->has_transactions()) /* diff --git a/sql/sql_class.cc b/sql/sql_class.cc index e43fb0d3a0b..d2dc8ce5a42 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -90,7 +90,7 @@ THD::THD():user_time(0), fatal_error(0), db_length=query_length=col_access=0; query_error=0; next_insert_id=last_insert_id=0; - open_tables=temporary_tables=handler_tables=0; + open_tables= temporary_tables= handler_tables= derived_tables= 0; current_tablenr=0; handler_items=0; tmp_table=0; @@ -100,7 +100,7 @@ THD::THD():user_time(0), fatal_error(0), start_time=(time_t) 0; current_linfo = 0; slave_thread = 0; - slave_proxy_id = 0; + variables.pseudo_thread_id= 0; file_id = 0; cond_count=0; warn_id= 0; @@ -532,7 +532,7 @@ bool select_send::send_data(List<Item> &items) List_iterator_fast<Item> li(items); Protocol *protocol= thd->protocol; char buff[MAX_FIELD_WIDTH]; - String buffer(buff, sizeof(buff), system_charset_info); + String buffer(buff, sizeof(buff), my_charset_bin); DBUG_ENTER("send_data"); protocol->prepare_for_resend(); @@ -656,7 +656,7 @@ bool select_export::send_data(List<Item> &items) DBUG_ENTER("send_data"); char buff[MAX_FIELD_WIDTH],null_buff[2],space[MAX_FIELD_WIDTH]; bool space_inited=0; - String tmp(buff,sizeof(buff),default_charset_info),*res; + String tmp(buff,sizeof(buff),my_charset_bin),*res; tmp.length(0); if (unit->offset_limit_cnt) @@ -717,10 +717,11 @@ bool select_export::send_data(List<Item> &items) pos++) { #ifdef USE_MB - if (use_mb(default_charset_info)) + CHARSET_INFO *res_charset=res->charset(); + if (use_mb(res_charset)) { int l; - if ((l=my_ismbchar(default_charset_info, pos, end))) + if ((l=my_ismbchar(res_charset, pos, end))) { pos += l-1; continue; @@ -863,7 +864,7 @@ bool select_dump::send_data(List<Item> &items) { List_iterator_fast<Item> li(items); char buff[MAX_FIELD_WIDTH]; - String tmp(buff,sizeof(buff),default_charset_info),*res; + String tmp(buff,sizeof(buff),my_charset_bin),*res; tmp.length(0); Item *item; DBUG_ENTER("send_data"); @@ -923,10 +924,10 @@ select_subselect::select_subselect(Item_subselect *item) this->item=item; } -bool select_singleval_subselect::send_data(List<Item> &items) +bool select_singlerow_subselect::send_data(List<Item> &items) { - DBUG_ENTER("select_singleval_subselect::send_data"); - Item_singleval_subselect *it= (Item_singleval_subselect *)item; + DBUG_ENTER("select_singlerow_subselect::send_data"); + Item_singlerow_subselect *it= (Item_singlerow_subselect *)item; if (it->assigned()) { my_message(ER_SUBSELECT_NO_1_ROW, ER(ER_SUBSELECT_NO_1_ROW), MYF(0)); @@ -938,32 +939,9 @@ bool select_singleval_subselect::send_data(List<Item> &items) DBUG_RETURN(0); } List_iterator_fast<Item> li(items); - Item *val_item= li++; // Only one (single value subselect) - /* - Following val() call have to be first, because function AVG() & STD() - calculate value on it & determinate "is it NULL?". - */ - it->real_value= val_item->val_result(); - if ((it->null_value= val_item->null_value)) - { - it->reset(); - } - else - { - it->max_length= val_item->max_length; - it->decimals= val_item->decimals; - it->set_charset(val_item->charset()); - it->int_value= val_item->val_int_result(); - String *s= val_item->str_result(&it->string_value); - if (s != &it->string_value) - { - it->string_value.set(*s, 0, s->length()); - } - // TODO: remove when correct charset handling appeared for Item - it->str_value.set(*s, 0, s->length()); // store charset - - it->res_type= val_item->result_type(); - } + Item *val_item; + for (uint i= 0; (val_item= li++); i++) + it->store(i, val_item); it->assigned(1); DBUG_RETURN(0); } diff --git a/sql/sql_class.h b/sql/sql_class.h index 346b6e7851f..5acbb622a14 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -351,8 +351,8 @@ struct system_variables { ulonglong myisam_max_extra_sort_file_size; ulonglong myisam_max_sort_file_size; - ulonglong select_limit; - ulonglong max_join_size; + ha_rows select_limit; + ha_rows max_join_size; ulong bulk_insert_buff_size; ulong join_buff_size; ulong long_query_time; @@ -377,6 +377,12 @@ struct system_variables ulong tmp_table_size; ulong tx_isolation; + /* + In slave thread we need to know in behalf of which + thread the query is being run to replicate temp tables properly + */ + ulong pseudo_thread_id; + my_bool log_warnings; my_bool low_priority_updates; @@ -435,7 +441,7 @@ public: uint client_capabilities; /* What the client supports */ /* Determines if which non-standard SQL behaviour should be enabled */ uint sql_mode; - uint max_client_packet_length; + ulong max_client_packet_length; ulong master_access; /* Global privileges from mysql.user */ ulong db_access; /* Privileges for current db */ @@ -445,7 +451,7 @@ public: handler_tables - list of tables that were opened with HANDLER OPEN and are still in use by this thread */ - TABLE *open_tables,*temporary_tables, *handler_tables; + TABLE *open_tables,*temporary_tables, *handler_tables, *derived_tables; // TODO: document the variables below MYSQL_LOCK *lock; /* Current locks */ MYSQL_LOCK *locked_tables; /* Tables locked with LOCK */ @@ -534,11 +540,6 @@ public: each thread that is using LOG_INFO needs to adjust the pointer to it */ LOG_INFO* current_linfo; - /* - In slave thread we need to know in behalf of which - thread the query is being run to replicate temp tables properly - */ - ulong slave_proxy_id; NET* slave_net; // network connection from slave -> m. my_off_t log_pos; /* Used by the sys_var class to store temporary values */ @@ -839,10 +840,10 @@ public: }; /* Single value subselect interface class */ -class select_singleval_subselect :public select_subselect +class select_singlerow_subselect :public select_subselect { public: - select_singleval_subselect(Item_subselect *item):select_subselect(item){} + select_singlerow_subselect(Item_subselect *item):select_subselect(item){} bool send_data(List<Item> &items); }; diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 311bf29aee7..1c441ea7a26 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -114,10 +114,12 @@ static bool load_db_opt(const char *path, HA_CREATE_INFO *create) { if (!strncmp(buf,"default-character-set", (pos-buf))) { - if (!(create->table_charset=get_charset_by_name(pos+1, MYF(0)))) + if (strcmp(pos+1,"DEFAULT")) { - sql_print_error(ER(ER_UNKNOWN_CHARACTER_SET), - pos+1); + if (!(create->table_charset=get_charset_by_name(pos+1, MYF(0)))) + { + sql_print_error(ER(ER_UNKNOWN_CHARACTER_SET),pos+1); + } } } } @@ -333,7 +335,8 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent) } else { - store_warning(thd,ER_DB_DROP_EXISTS,db); + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, + ER_DB_DROP_EXISTS, ER(ER_DB_DROP_EXISTS), db); if (!silent) send_ok(thd,0); } @@ -468,7 +471,7 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db, my_dirend(dirp); if (thd->killed || - (tot_list && mysql_rm_table_part2_with_lock(thd, tot_list, 1, 1))) + (tot_list && mysql_rm_table_part2_with_lock(thd, tot_list, 1, 0, 1))) DBUG_RETURN(-1); /* @@ -675,9 +678,13 @@ int mysqld_show_create_db(THD *thd, const char *dbname, to=strxmov(to,"`",dbname,"`", NullS); if (create.table_charset) - to= strxmov(to," /*!40100 DEFAULT CHARACTER SET ", - create.table_charset->name,"*/",NullS); - + { + int cl= (create.table_charset->state & MY_CS_PRIMARY) ? 0 : 1; + to= strxmov(to," /*!40100" + " DEFAULT CHARACTER SET ",create.table_charset->csname, + cl ? " COLLATE " : "", cl ? create.table_charset->name : "", + " */",NullS); + } protocol->store(path, (uint) (to-path)); if (protocol->write()) diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 88da3e2505c..cfa7170fd0a 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -536,7 +536,7 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok) table->file->info(HA_STATUS_AUTO | HA_STATUS_NO_LOCK); bzero((char*) &create_info,sizeof(create_info)); create_info.auto_increment_value= table->file->auto_increment_value; - create_info.table_charset=default_charset_info; + create_info.table_charset=table->table_charset; db_type table_type=table->db_type; strmov(path,table->path); @@ -580,7 +580,7 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok) } bzero((char*) &create_info,sizeof(create_info)); - create_info.table_charset=default_charset_info; + create_info.table_charset=table_list->table->table_charset; *fn_ext(path)=0; // Remove the .frm extension error= ha_create_table(path,&create_info,1) ? -1 : 0; diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index f7d845e9e36..0a2e2947add 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (C) 2002-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 @@ -17,7 +17,7 @@ /* Derived tables - These were introduced by Monty and Sinisa <sinisa@mysql.com> + These were introduced by Sinisa <sinisa@mysql.com> */ @@ -38,17 +38,26 @@ static const char *any_db="*any*"; // Special symbol for check_access t TABLE_LIST for the upper SELECT IMPLEMENTATION - - Derived table is resolved with temporary table. It is created based on the - queries defined. After temporary table is created, if this is not EXPLAIN, - then the entire unit / node is deleted. unit is deleted if UNION is used - for derived table and node is deleted is it is a simple SELECT. + Derived table is resolved with temporary table. It is created based on the + queries defined. After temporary table is created, if this is not EXPLAIN, + then the entire unit / node is deleted. unit is deleted if UNION is used + for derived table and node is deleted is it is a simple SELECT. + + After table creation, the above TABLE_LIST is updated with a new table. - After table creation, the above TABLE_LIST is updated with a new table. + This function is called before any command containing derived table + is executed. - This function is called before any command containing derived table is executed. + Derived tables is stored in thd->derived_tables and freed in + close_thread_tables() - TODO: To move creation of derived tables IN open_and_lock_tables() + TODO + Move creation of derived tables in open_and_lock_tables() + + RETURN + 0 ok + 1 Error + -1 Error and error message given */ @@ -57,20 +66,21 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t) SELECT_LEX *sl= unit->first_select(); List<Item> item_list; TABLE *table; - int res= 0; + int res; select_union *derived_result; TABLE_LIST *tables= (TABLE_LIST *)sl->table_list.first; TMP_TABLE_PARAM tmp_table_param; bool is_union=sl->next_select() && sl->next_select()->linkage == UNION_TYPE; + SELECT_LEX_NODE *save_current_select= lex->current_select; DBUG_ENTER("mysql_derived"); - -/* - In create_total_list, derived tables have to be treated in case of EXPLAIN, - This is because unit/node is not deleted in that case. Current code in this - function has to be improved to recognize better when this function is called - from derived tables and when from other functions. -*/ + /* + In create_total_list, derived tables have to be treated in case of + EXPLAIN, This is because unit/node is not deleted in that + case. Current code in this function has to be improved to + recognize better when this function is called from derived tables + and when from other functions. + */ if (is_union && unit->create_total_list(thd, lex, &tables)) DBUG_RETURN(-1); @@ -91,40 +101,33 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t) { if (is_union) { -/* - The following code is a re-do of fix_tables_pointers() found in sql_select.cc - for UNION's within derived tables. The only difference is in navigation, as in - derived tables we care for this level only. - - fix_tables_pointers makes sure that in UNION's we do not open single table twice - if found in different SELECT's. - -*/ - for (SELECT_LEX *sel= sl; - sel; - sel= sel->next_select()) - { - for (TABLE_LIST *cursor= (TABLE_LIST *)sel->table_list.first; - cursor; - cursor=cursor->next) - cursor->table= cursor->table_list->table; - } + /* + The following code is a re-do of fix_tables_pointers() found + in sql_select.cc for UNION's within derived tables. The only + difference is in navigation, as in derived tables we care for + this level only. + + */ + for (SELECT_LEX *sel= sl; sel; sel= sel->next_select()) + relink_tables(sel); } + lex->current_select= sl; if (setup_fields(thd,tables,item_list,0,0,1)) { - res=-1; + res= -1; goto exit; } bzero((char*) &tmp_table_param,sizeof(tmp_table_param)); tmp_table_param.field_count=item_list.elements; if (!(table=create_tmp_table(thd, &tmp_table_param, item_list, - (ORDER*) 0, is_union && !unit->union_option, 1, + (ORDER*) 0, + is_union && !unit->union_option, 1, (sl->options | thd->options | TMP_TABLE_ALL_COLUMNS), HA_POS_ERROR))) { - res=-1; + res= -1; goto exit; } @@ -138,10 +141,8 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t) if (unit->select_limit_cnt == HA_POS_ERROR) sl->options&= ~OPTION_FOUND_ROWS; - SELECT_LEX_NODE *save_current_select= lex->current_select; - lex->current_select= sl; if (is_union) - res=mysql_union(thd,lex,derived_result,unit); + res= mysql_union(thd,lex,derived_result,unit); else res= mysql_select(thd, tables, sl->item_list, sl->where, (ORDER *) sl->order_list.first, @@ -149,13 +150,15 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t) sl->having, (ORDER*) NULL, sl->options | thd->options | SELECT_NO_UNLOCK, derived_result, unit, sl, 0); - lex->current_select= save_current_select; if (!res) { -// Here we entirely fix both TABLE_LIST and list of SELECT's as there were no derived tables + /* + Here we entirely fix both TABLE_LIST and list of SELECT's as + there were no derived tables + */ if (derived_result->flush()) - res=1; + res= 1; else { t->real_name=table->real_name; @@ -164,27 +167,29 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t) table->tmp_table=TMP_TABLE; if (lex->describe) { + // to fix a problem in EXPLAIN if (tables) - tables->table_list->table=tables->table; // to fix a problem in EXPLAIN + tables->table_list->table=tables->table; } else - { - if (is_union) - unit->exclude(); - else - sl->exclude(); - } - t->db=(char *)""; - t->derived=(SELECT_LEX *)0; // just in case ... + unit->exclude(); + t->db= (char *)""; + t->derived=(SELECT_LEX *) 1; // just in case ... table->file->info(HA_STATUS_VARIABLE); } } delete derived_result; } if (res) - free_tmp_table(thd,table); + free_tmp_table(thd, table); + else + { + table->next= thd->derived_tables; + thd->derived_tables= table; + } exit: - close_thread_tables(thd); + lex->current_select= save_current_select; + close_thread_tables(thd, 0, 1); } DBUG_RETURN(res); } diff --git a/sql/sql_error.cc b/sql/sql_error.cc index c9684855b86..5508be5167a 100644 --- a/sql/sql_error.cc +++ b/sql/sql_error.cc @@ -105,31 +105,29 @@ void push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level, uint code, } /* - Store warning to the list + Push the warning/error to error list if there is still room in the list + + SYNOPSIS + push_warning_printf() + thd Thread handle + level Severity of warning (note, warning, error ...) + code Error number + msg Clear error message */ -void store_warning(THD *thd, uint errcode, ...) +void push_warning_printf(THD *thd, MYSQL_ERROR::enum_warning_level level, + uint code, const char *format, ...) { -#if TESTS_TO_BE_FIXED va_list args; - const char *format; char warning[ERRMSGSIZE+20]; - DBUG_ENTER("store_warning"); - DBUG_PRINT("enter",("warning: %u",errcode)); + DBUG_ENTER("push_warning_printf"); + DBUG_PRINT("enter",("warning: %u", code)); - va_start(args,errcode); - if (errcode) - format= ER(errcode); - else - { - format=va_arg(args,char*); - errcode= ER_UNKNOWN_ERROR; - } - (void) vsprintf (warning,format,args); + va_start(args,format); + my_vsnprintf(warning, sizeof(warning), format, args); va_end(args); - push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, errcode, warning); + push_warning(thd, level, code, warning); DBUG_VOID_RETURN; -#endif } diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index 97703cd6b20..0d8af46dbf6 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -109,6 +109,10 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables, if (cond && (cond->check_cols(1) || cond->fix_fields(thd, tables, &cond))) return -1; + /* InnoDB needs to know that this table handle is used in the HANDLER */ + + table->file->init_table_handle_for_HANDLER(); + if (keyname) { if ((keyno=find_type(keyname, &table->keynames, 1+2)-1)<0) @@ -131,8 +135,6 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables, insert_fields(thd,tables,tables->db,tables->alias,&it); - table->file->init_table_handle_for_HANDLER(); // Only InnoDB requires it - select_limit+=offset_limit; protocol->send_fields(&list,1); @@ -142,6 +144,12 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables, if (!lock) goto err0; // mysql_lock_tables() printed error message already + /* In ::external_lock InnoDB resets the fields which tell it that + the handle is used in the HANDLER interface. Tell it again that + we are using it for HANDLER. */ + + table->file->init_table_handle_for_HANDLER(); + for (num_rows=0; num_rows < select_limit; ) { switch (mode) { diff --git a/sql/sql_help.cc b/sql/sql_help.cc index db28823a43d..013101a0ecc 100644 --- a/sql/sql_help.cc +++ b/sql/sql_help.cc @@ -22,6 +22,8 @@ ** Get help on string ***************************************************************************/ +#define help_charset my_charset_latin1 + MI_INFO *open_help_file(THD *thd, const char *name) { char path[FN_REFLEN]; @@ -94,7 +96,7 @@ int search_functions(MI_INFO *file_leafs, const char *mask, DBUG_ENTER("search_functions"); int count= 0; - if(mi_scan_init(file_leafs)) + if (mi_scan_init(file_leafs)) DBUG_RETURN(-1); help_leaf leaf; @@ -104,21 +106,21 @@ int search_functions(MI_INFO *file_leafs, const char *mask, leaf.prepare_fields(); const char *lname= leaf.get_name(); - if (wild_case_compare(system_charset_info,lname,mask)) + if (wild_case_compare(help_charset,lname,mask)) continue; count++; if (count>2) { - String *s= new String(lname,system_charset_info); + String *s= new String(lname,help_charset); if (!s->copy()) names->push_back(s); } else if (count==1) { - *description= new String(leaf.get_description(),system_charset_info); - *example= new String(leaf.get_example(),system_charset_info); - *name= new String(lname,system_charset_info); + *description= new String(leaf.get_description(),help_charset); + *example= new String(leaf.get_example(),help_charset); + *name= new String(lname,help_charset); (*description)->copy(); (*example)->copy(); (*name)->copy(); @@ -132,7 +134,7 @@ int search_functions(MI_INFO *file_leafs, const char *mask, *description= 0; *example= 0; - String *s= new String(lname,system_charset_info); + String *s= new String(lname,help_charset); if (!s->copy()) names->push_back(s); } @@ -189,7 +191,7 @@ int search_categories(THD *thd, if (!(file_categories= open_help_file(thd,"function_category_name"))) DBUG_RETURN(-1); - if(mi_scan_init(file_categories)) + if (mi_scan_init(file_categories)) { mi_close(file_categories); DBUG_RETURN(-1); @@ -203,14 +205,14 @@ int search_categories(THD *thd, category.prepare_fields(); const char *lname= category.get_name(); - if (mask && wild_case_compare(system_charset_info,lname,mask)) + if (mask && wild_case_compare(help_charset,lname,mask)) continue; count++; if (count==1 && res_id) *res_id= category.get_cat_id(); - String *s= new String(lname,system_charset_info); + String *s= new String(lname,help_charset); if (!s->copy()) names->push_back(s); } @@ -282,7 +284,7 @@ int get_all_names_for_category(THD *thd,MI_INFO *file_leafs, (const byte*)&leaf_id,4,HA_READ_KEY_EXACT)) { leaf.prepare_fields(); - String *s= new String(leaf.get_name(),system_charset_info); + String *s= new String(leaf.get_name(),help_charset); if (!s->copy()) res->push_back(s); } @@ -391,11 +393,11 @@ int mysqld_help(THD *thd, const char *mask) description->ptr(), example->ptr()))) goto end; } - else if((res= send_header_2(protocol)) || - (res= send_variant_2_list(protocol,&function_list,false)) || - (search_categories(thd, mask, &categories_list, 0)<0 && - (res=1)) || - (res= send_variant_2_list(protocol,&categories_list,true))) + else if ((res= send_header_2(protocol)) || + (res= send_variant_2_list(protocol,&function_list,false)) || + (search_categories(thd, mask, &categories_list, 0)<0 && + (res=1)) || + (res= send_variant_2_list(protocol,&categories_list,true))) { goto end; } diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index f45e09cf0bf..e76e982adea 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -109,7 +109,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, int error; bool log_on= ((thd->options & OPTION_UPDATE_LOG) || !(thd->master_access & SUPER_ACL)); - bool transactional_table, log_delayed, bulk_insert=0; + bool transactional_table, log_delayed, bulk_insert; uint value_count; ulong counter = 1; ulonglong id; @@ -217,21 +217,17 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, thd->proc_info="update"; if (duplic != DUP_ERROR) table->file->extra(HA_EXTRA_IGNORE_DUP_KEY); - if ((bulk_insert= (values_list.elements >= MIN_ROWS_TO_USE_BULK_INSERT && - lock_type != TL_WRITE_DELAYED && - !(specialflag & SPECIAL_SAFE_MODE)))) + if ((lock_type != TL_WRITE_DELAYED && !(specialflag & SPECIAL_SAFE_MODE)) && + values_list.elements >= MIN_ROWS_TO_USE_BULK_INSERT) { table->file->extra_opt(HA_EXTRA_WRITE_CACHE, min(thd->variables.read_buff_size, table->avg_row_length*values_list.elements)); - if (thd->variables.bulk_insert_buff_size) - table->file->extra_opt(HA_EXTRA_BULK_INSERT_BEGIN, - min(thd->variables.bulk_insert_buff_size, - (table->total_key_length + - table->keys * TREE_ELEMENT_EXTRA_SIZE)* - values_list.elements)); - table->bulk_insert= 1; + table->file->deactivate_non_unique_index(values_list.elements); + bulk_insert=1; } + else + bulk_insert=0; while ((values= its++)) { @@ -309,7 +305,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, error=1; } } - if (table->file->extra(HA_EXTRA_BULK_INSERT_END)) + if (table->file->activate_all_index(thd)) { if (!error) { @@ -317,7 +313,6 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, error=1; } } - table->bulk_insert= 0; } if (id && values_list.elements != 1) thd->insert_id(id); // For update log diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 99e465f79c0..b656f698e89 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -165,11 +165,13 @@ LEX *lex_start(THD *thd, uchar *buf,uint length) lex->select_lex.ftfunc_list= &lex->select_lex.ftfunc_list_alloc; lex->current_select= &lex->select_lex; lex->convert_set= (lex->thd= thd)->variables.convert_set; + lex->thd_charset= lex->thd->variables.thd_charset; lex->yacc_yyss=lex->yacc_yyvs=0; lex->ignore_space=test(thd->sql_mode & MODE_IGNORE_SPACE); lex->slave_thd_opt=0; lex->sql_command=SQLCOM_END; lex->safe_to_cache_query= 1; + lex->tmp_table_used= 0; bzero(&lex->mi,sizeof(lex->mi)); return lex; } @@ -556,7 +558,7 @@ int yylex(void *arg, void *yythd) */ if ((yylval->lex_str.str[0]=='_') && - (lex->charset=get_charset_by_name(yylval->lex_str.str+1,MYF(0)))) + (lex->charset=get_charset_by_csname(yylval->lex_str.str+1,MYF(0)))) return(UNDERSCORE_CHARSET); else return(IDENT); @@ -941,7 +943,7 @@ int yylex(void *arg, void *yythd) void st_select_lex_node::init_query() { - dependent= 0; + no_table_names_allowed= dependent= 0; } void st_select_lex_node::init_select() @@ -1035,7 +1037,7 @@ void st_select_lex_node::include_global(st_select_lex_node **plink) //excluding from global list (internal function) void st_select_lex_node::fast_exclude() { - if(link_prev) + if (link_prev) { if ((*link_prev= link_next)) link_next->link_prev= link_prev; @@ -1067,7 +1069,7 @@ void st_select_lex_node::exclude() void st_select_lex_unit::exclude_level() { SELECT_LEX_UNIT *units= 0, **units_last= &units; - for(SELECT_LEX *sl= first_select(); sl; sl= sl->next_select()) + for (SELECT_LEX *sl= first_select(); sl; sl= sl->next_select()) { if (sl->link_prev && (*sl->link_prev= sl->link_next)) sl->link_next->link_prev= sl->link_prev; @@ -1141,7 +1143,7 @@ void st_select_lex_node::mark_as_dependent(SELECT_LEX *last) for (SELECT_LEX_NODE *s= this; s &&s != last; s= s->outer_select()) - if( !s->dependent ) + if ( !s->dependent ) { // Select is dependent of outer select s->dependent= 1; @@ -1169,13 +1171,14 @@ List<String>* st_select_lex_node::get_use_index() { return 0; } List<String>* st_select_lex_node::get_ignore_index() { return 0; } TABLE_LIST *st_select_lex_node::add_table_to_list(THD *thd, Table_ident *table, LEX_STRING *alias, - bool updating, + ulong table_join_options, thr_lock_type flags, List<String> *use_index, List<String> *ignore_index) { return 0; } +ulong st_select_lex_node::get_table_join_options() { return 0; } /* This is used for UNION & subselect to create a new table list of all used @@ -1332,6 +1335,11 @@ List<String>* st_select_lex::get_ignore_index() return ignore_index_ptr; } +ulong st_select_lex::get_table_join_options() +{ + return table_join_options; +} + /* There are st_select_lex::add_table_to_list & st_select_lex::set_lock_for_tables in sql_parse.cc diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 927b806a082..e4a17838cd2 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -212,6 +212,7 @@ public: bool with_sum_func; bool create_refs; bool dependent; /* dependent from outer select subselect */ + bool no_table_names_allowed; /* used for global order by */ static void *operator new(size_t size) { @@ -243,9 +244,10 @@ public: virtual List<Item>* get_item_list(); virtual List<String>* get_use_index(); virtual List<String>* get_ignore_index(); + virtual ulong get_table_join_options(); virtual TABLE_LIST *add_table_to_list(THD *thd, Table_ident *table, LEX_STRING *alias, - bool updating, + ulong table_options, thr_lock_type flags= TL_UNLOCK, List<String> *use_index= 0, List<String> *ignore_index= 0); @@ -336,6 +338,7 @@ public: List<Item_func_match> ftfunc_list_alloc; JOIN *join; /* after JOIN::prepare it is pointer to corresponding JOIN */ const char *type; /* type of select for EXPLAIN */ + ulong table_join_options; uint in_sum_expr; uint select_number; /* number of select (used for EXPLAIN) */ bool braces; /* SELECT ... UNION (SELECT ... ) <- this braces */ @@ -373,9 +376,10 @@ public: List<Item>* get_item_list(); List<String>* get_use_index(); List<String>* get_ignore_index(); + ulong get_table_join_options(); TABLE_LIST* add_table_to_list(THD *thd, Table_ident *table, LEX_STRING *alias, - bool updating, + ulong table_options, thr_lock_type flags= TL_UNLOCK, List<String> *use_index= 0, List<String> *ignore_index= 0); @@ -432,7 +436,7 @@ typedef struct st_lex create_field *last_field; Item *default_value, *comment; CONVERT *convert_set; - CONVERT *thd_convert_set; // Set with SET CHAR SET + CHARSET_INFO *thd_charset; LEX_USER *grant_user; gptr yacc_yyss,yacc_yyvs; THD *thd; @@ -461,6 +465,7 @@ typedef struct st_lex uint slave_thd_opt; CHARSET_INFO *charset; char *help_arg; + bool tmp_table_used; } LEX; diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 3e281e6e916..0a4c6330154 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -273,11 +273,6 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY); table->time_stamp=save_time_stamp; table->next_number_field=0; - if (thd->lock) - { - mysql_unlock_tables(thd, thd->lock); - thd->lock=0; - } } if (file >= 0) my_close(file,MYF(0)); free_blobs(table); /* if pack_blob was used */ @@ -296,7 +291,8 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, mysql_bin_log.write(&d); } } - DBUG_RETURN(-1); // Error on read + error= -1; // Error on read + goto err; } sprintf(name,ER(ER_LOAD_INFO),info.records,info.deleted, info.records-info.copied,thd->cuted_fields); @@ -330,6 +326,13 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, } if (transactional_table) error=ha_autocommit_or_rollback(thd,error); + +err: + if (thd->lock) + { + mysql_unlock_tables(thd, thd->lock); + thd->lock=0; + } DBUG_RETURN(error); } diff --git a/sql/sql_olap.cc b/sql/sql_olap.cc index 6eb4fbcaaf6..1f22073f556 100644 --- a/sql/sql_olap.cc +++ b/sql/sql_olap.cc @@ -62,7 +62,7 @@ static int make_new_olap_select(LEX *lex, SELECT_LEX *select_lex, List<Item> new List_iterator<Item> list_it(select_lex->item_list); List_iterator<Item> new_it(new_fields); - while((item=list_it++)) + while ((item=list_it++)) { bool not_found=true; if (item->type()==Item::FIELD_ITEM) @@ -109,15 +109,15 @@ static int olap_combos(List<Item> old_fields, List<Item> new_fields, Item *item int num_new_fields) { int sl_return = 0; - if(position == num_new_fields) + if (position == num_new_fields) { - if(item) + if (item) new_fields.push_front(item); sl_return = make_new_olap_select(lex, select_lex, new_fields); } else { - if(item) + if (item) new_fields.push_front(item); while ((num_fields - num_new_fields >= selection - position) && !sl_return) { @@ -170,12 +170,12 @@ int handle_olaps(LEX *lex, SELECT_LEX *select_lex) if (select_lex->olap == CUBE_TYPE) { - for( int i=count-1; i>=0 && !sl_return; i--) + for ( int i=count-1; i>=0 && !sl_return; i--) sl_return=olap_combos(item_list_copy, new_item_list, (Item *)0, lex, select_lex, 0, 0, count, i); } else if (select_lex->olap == ROLLUP_TYPE) { - for( int i=count-1; i>=0 && !sl_return; i--) + for ( int i=count-1; i>=0 && !sl_return; i--) { Item *item; item_list_copy.pop(); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 7d9dc05b4cf..d71db58ed32 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -74,7 +74,8 @@ const char *command_name[]={ "Drop DB", "Refresh", "Shutdown", "Statistics", "Processlist", "Connect","Kill","Debug","Ping","Time","Delayed_insert","Change user", "Binlog Dump","Table Dump", "Connect Out", "Register Slave", - "Prepare", "Prepare Execute", "Long Data", "Close stmt" + "Prepare", "Prepare Execute", "Long Data", "Close stmt", + "Error" // Last command number }; static char empty_c_string[1]= {0}; // Used for not defined 'db' @@ -189,9 +190,9 @@ end: static int check_user(THD *thd,enum_server_command command, const char *user, const char *passwd, const char *db, bool check_count, - bool do_send_error, char* crypted_scramble, - bool had_password,uint *cur_priv_version, - ACL_USER** hint_user) + bool simple_connect, bool do_send_error, + char* crypted_scramble, bool had_password, + uint *cur_priv_version, ACL_USER** hint_user) { thd->db=0; thd->db_length=0; @@ -211,7 +212,7 @@ static int check_user(THD *thd,enum_server_command command, const char *user, cur_priv_version,hint_user); DBUG_PRINT("info", - ("Capabilities: %d packet_length: %d Host: '%s' User: '%s' Using password: %s Access: %u db: '%s'", + ("Capabilities: %d packet_length: %ld Host: '%s' User: '%s' Using password: %s Access: %u db: '%s'", thd->client_capabilities, thd->max_client_packet_length, thd->host_or_ip, thd->priv_user, had_password ? "yes": "no", @@ -222,14 +223,23 @@ static int check_user(THD *thd,enum_server_command command, const char *user, { if (do_send_error) { - net_printf(thd, ER_ACCESS_DENIED_ERROR, - thd->user, - thd->host_or_ip, - had_password ? ER(ER_YES) : ER(ER_NO)); - mysql_log.write(thd,COM_CONNECT,ER(ER_ACCESS_DENIED_ERROR), - thd->user, - thd->host_or_ip, - had_password ? ER(ER_YES) : ER(ER_NO)); + /* Old client should get nicer error message if password version is not supported*/ + if (simple_connect && *hint_user && (*hint_user)->pversion) + { + net_printf(thd, ER_NOT_SUPPORTED_AUTH_MODE); + mysql_log.write(thd,COM_CONNECT,ER(ER_NOT_SUPPORTED_AUTH_MODE)); + } + else + { + net_printf(thd, ER_ACCESS_DENIED_ERROR, + thd->user, + thd->host_or_ip, + had_password ? ER(ER_YES) : ER(ER_NO)); + mysql_log.write(thd,COM_CONNECT,ER(ER_ACCESS_DENIED_ERROR), + thd->user, + thd->host_or_ip, + had_password ? ER(ER_YES) : ER(ER_NO)); + } return(1); // Error already given } else @@ -508,6 +518,9 @@ check_connections(THD *thd) { vio_in_addr(net->vio,&thd->remote.sin_addr); thd->host=ip_to_hostname(&thd->remote.sin_addr,&connect_errors); + /* Cut very long hostnames to avoid possible overflows */ + if (thd->host) + thd->host[min(strlen(thd->host), HOSTNAME_LENGTH)]= 0; if (connect_errors > max_connect_errors) return(ER_HOST_IS_BLOCKED); } @@ -524,6 +537,7 @@ check_connections(THD *thd) thd->ip=0; bzero((char*) &thd->remote,sizeof(struct sockaddr)); } + /* Ensure that wrong hostnames doesn't cause buffer overflows */ vio_keepalive(net->vio, TRUE); ulong pkt_len=0; @@ -639,8 +653,9 @@ check_connections(THD *thd) /* Store information if we used password. passwd will be dammaged */ bool using_password=test(passwd[0]); /* Check user permissions. If password failure we'll get scramble back */ - if (check_user(thd,COM_CONNECT, user, passwd, db, 1, simple_connect, - prepared_scramble,using_password,&cur_priv_version,&cached_user)<0) + if (check_user(thd, COM_CONNECT, user, passwd, db, 1, simple_connect, + simple_connect, prepared_scramble, using_password, &cur_priv_version, + &cached_user)<0) { /* If The client is old we just have to return error */ if (simple_connect) @@ -680,7 +695,7 @@ check_connections(THD *thd) } /* Final attempt to check the user based on reply */ if (check_user(thd,COM_CONNECT, tmp_user, (char*)net->read_pos, - tmp_db, 1, 1,prepared_scramble,using_password,&cur_priv_version, + tmp_db, 1, 0, 1, prepared_scramble, using_password, &cur_priv_version, &cached_user)) return -1; } @@ -753,7 +768,7 @@ pthread_handler_decl(handle_one_connection,arg) goto end_thread; } - if ((ulong) thd->variables.max_join_size == (ulonglong) HA_POS_ERROR) + if (thd->variables.max_join_size == HA_POS_ERROR) thd->options |= OPTION_BIG_SELECTS; if (thd->client_capabilities & CLIENT_COMPRESS) net->compress=1; // Use compression @@ -829,7 +844,7 @@ extern "C" pthread_handler_decl(handle_bootstrap,arg) #endif - if ((ulong) thd->variables.max_join_size == (ulonglong) HA_POS_ERROR) + if (thd->variables.max_join_size == HA_POS_ERROR) thd->options |= OPTION_BIG_SELECTS; thd->proc_info=0; @@ -961,14 +976,22 @@ bool do_command(THD *thd) net_new_transaction(net); if ((packet_length=my_net_read(net)) == packet_error) { - DBUG_PRINT("info",("Got error reading command from socket %s", - vio_description(net->vio) )); - return TRUE; + DBUG_PRINT("info",("Got error %d reading command from socket %s", + net->error, + vio_description(net->vio))); + /* Check if we can continue without closing the connection */ + if (net->error != 3) + DBUG_RETURN(TRUE); // We have to close it. + send_error(thd,net->last_errno,NullS); + net->error= 0; + DBUG_RETURN(FALSE); } else { packet=(char*) net->read_pos; command = (enum enum_server_command) (uchar) packet[0]; + if (command >= COM_END) + command= COM_END; // Wrong command DBUG_PRINT("info",("Command on %s = %d (%s)", vio_description(net->vio), command, command_name[command])); @@ -1087,7 +1110,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd, Do not retry if we already have sent error (result>0) */ if (check_user(thd,COM_CHANGE_USER, user, passwd, db, 0, simple_connect, - prepared_scramble,using_password,&cur_priv_version,&cached_user)<0) + simple_connect, prepared_scramble, using_password, &cur_priv_version, + &cached_user)<0) { /* If The client is old we just have to have auth failure */ if (simple_connect) @@ -1122,7 +1146,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, /* Final attempt to check the user based on reply */ if (check_user(thd,COM_CHANGE_USER, tmp_user, (char*)net->read_pos, - tmp_db, 0, 1,prepared_scramble,using_password,&cur_priv_version, + tmp_db, 0, 0, 1, prepared_scramble, using_password, &cur_priv_version, &cached_user)) goto restore_user; } @@ -1175,7 +1199,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, if (alloc_query(thd, packet, packet_length)) break; // fatal error is set mysql_log.write(thd,command,"%s",thd->query); - DBUG_PRINT("query",("%s",thd->query)); + DBUG_PRINT("query",("%-.4096s",thd->query)); mysql_parse(thd,thd->query, thd->query_length); if (!(specialflag & SPECIAL_NO_PRIOR)) my_pthread_setprio(pthread_self(),WAIT_PRIOR); @@ -1253,6 +1277,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd, } if (lower_case_table_names) my_casedn_str(files_charset_info, db); + if (check_access(thd,DROP_ACL,db,0,1)) + break; if (thd->locked_tables || thd->active_transaction()) { send_error(thd,ER_LOCK_OR_ACTIVE_TRANSACTION); @@ -1295,10 +1321,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd, if (check_global_access(thd,RELOAD_ACL)) break; mysql_log.write(thd,command,NullS); - if (reload_acl_and_cache(thd, options, (TABLE_LIST*) 0)) - send_error(thd,0); - else - send_eof(thd); + /* error sending is deferred to reload_acl_and_cache */ + reload_acl_and_cache(thd, options, (TABLE_LIST*) 0) ; break; } #ifndef EMBEDDED_LIBRARY @@ -1377,11 +1401,12 @@ bool dispatch_command(enum enum_server_command command, THD *thd, case COM_CONNECT: // Impossible here case COM_TIME: // Impossible from client case COM_DELAYED_INSERT: + case COM_END: default: send_error(thd, ER_UNKNOWN_COM_ERROR); break; } - if (thd->lock || thd->open_tables) + if (thd->lock || thd->open_tables || thd->derived_tables) { thd->proc_info="closing tables"; close_thread_tables(thd); /* Free tables */ @@ -1476,7 +1501,6 @@ mysql_execute_command(THD *thd) int res= 0; LEX *lex= &thd->lex; TABLE_LIST *tables= (TABLE_LIST*) lex->select_lex.table_list.first; - TABLE_LIST *cursor; SELECT_LEX *select_lex= &lex->select_lex; SELECT_LEX_UNIT *unit= &lex->unit; DBUG_ENTER("mysql_execute_command"); @@ -1527,9 +1551,11 @@ mysql_execute_command(THD *thd) for (SELECT_LEX *sl= lex->all_selects_list; sl; sl= sl->next_select_in_list()) + { for (TABLE_LIST *cursor= sl->get_table_list(); cursor; cursor= cursor->next) + { if (cursor->derived && (res=mysql_derived(thd, lex, (SELECT_LEX_UNIT *) cursor->derived, @@ -1539,6 +1565,8 @@ mysql_execute_command(THD *thd) send_error(thd,thd->killed ? ER_SERVER_SHUTDOWN : 0); DBUG_VOID_RETURN; } + } + } } if ((&lex->select_lex != lex->all_selects_list && lex->unit.create_total_list(thd, lex, &tables)) @@ -1619,7 +1647,14 @@ mysql_execute_command(THD *thd) break; } case SQLCOM_DO: - res=mysql_do(thd, *lex->insert_list); + if (tables && ((res= check_table_access(thd, SELECT_ACL, tables)) || + (res= open_and_lock_tables(thd,tables)))) + break; + + fix_tables_pointers(lex->all_selects_list); + res= mysql_do(thd, *lex->insert_list); + if (thd->net.report_error) + res= -1; break; case SQLCOM_EMPTY_QUERY: @@ -1644,7 +1679,9 @@ mysql_execute_command(THD *thd) { res= mysqld_show_warnings(thd, (ulong) ((1L << (uint) MYSQL_ERROR::WARN_LEVEL_NOTE) | - (1L << (uint) MYSQL_ERROR::WARN_LEVEL_WARN))); + (1L << (uint) MYSQL_ERROR::WARN_LEVEL_WARN) | + (1L << (uint) MYSQL_ERROR::WARN_LEVEL_ERROR) + )); break; } case SQLCOM_SHOW_ERRORS: @@ -1836,7 +1873,6 @@ mysql_execute_command(THD *thd) } if (tables->next) { - TABLE_LIST *table; if (check_table_access(thd, SELECT_ACL, tables->next)) goto error; // Error message is given } @@ -1863,10 +1899,14 @@ mysql_execute_command(THD *thd) } else // regular create { - res = mysql_create_table(thd,tables->db ? tables->db : thd->db, - tables->real_name, &lex->create_info, - lex->create_list, - lex->key_list,0,0,0); // do logging + if (lex->name) + res= mysql_create_like_table(thd, tables, &lex->create_info, + (Table_ident *)lex->name); + else + res= mysql_create_table(thd,tables->db ? tables->db : thd->db, + tables->real_name, &lex->create_info, + lex->create_list, + lex->key_list,0,0,0); // do logging if (!res) send_ok(thd); } @@ -1894,6 +1934,24 @@ mysql_execute_command(THD *thd) break; } case SQLCOM_SLAVE_STOP: + /* + If the client thread has locked tables, a deadlock is possible. + Assume that + - the client thread does LOCK TABLE t READ. + - then the master updates t. + - then the SQL slave thread wants to update t, + so it waits for the client thread because t is locked by it. + - then the client thread does SLAVE STOP. + SLAVE STOP waits for the SQL slave thread to terminate its + update t, which waits for the client thread because t is locked by it. + To prevent that, refuse SLAVE STOP if the + client thread has locked tables + */ + if (thd->locked_tables || thd->active_transaction()) + { + send_error(thd,ER_LOCK_OR_ACTIVE_TRANSACTION); + break; + } { LOCK_ACTIVE_MI; stop_slave(thd,active_mi,1/* net report*/); @@ -2272,6 +2330,7 @@ mysql_execute_command(THD *thd) for (auxi=(TABLE_LIST*) aux_tables ; auxi ; auxi=auxi->next) auxi->table= auxi->table_list->table; if (&lex->select_lex != lex->all_selects_list) + { for (TABLE_LIST *t= select_lex->get_table_list(); t; t= t->next) { @@ -2282,6 +2341,7 @@ mysql_execute_command(THD *thd) break; } } + } fix_tables_pointers(lex->all_selects_list); if (!thd->fatal_error && (result= new multi_delete(thd,aux_tables, table_count))) @@ -2305,12 +2365,17 @@ mysql_execute_command(THD *thd) } case SQLCOM_DROP_TABLE: { - if (check_table_access(thd,DROP_ACL,tables)) - goto error; /* purecov: inspected */ - if (end_active_trans(thd)) - res= -1; - else - res = mysql_rm_table(thd,tables,lex->drop_if_exists); + if (!lex->drop_temporary) + { + if (check_table_access(thd,DROP_ACL,tables)) + goto error; /* purecov: inspected */ + if (end_active_trans(thd)) + { + res= -1; + break; + } + } + res= mysql_rm_table(thd,tables,lex->drop_if_exists, lex->drop_temporary); } break; case SQLCOM_DROP_INDEX: @@ -2490,9 +2555,16 @@ mysql_execute_command(THD *thd) } #endif /* EMBEDDED_LIBRARY */ case SQLCOM_SET_OPTION: - if (!(res=sql_set_variables(thd, &lex->var_list))) + if (tables && ((res= check_table_access(thd, SELECT_ACL, tables)) || + (res= open_and_lock_tables(thd,tables)))) + break; + fix_tables_pointers(lex->all_selects_list); + if (!(res= sql_set_variables(thd, &lex->var_list))) send_ok(thd); + if (thd->net.report_error) + res= -1; break; + case SQLCOM_UNLOCK_TABLES: unlock_locked_tables(thd); if (thd->options & OPTION_TABLE_LOCK) @@ -2693,10 +2765,8 @@ mysql_execute_command(THD *thd) case SQLCOM_RESET: if (check_global_access(thd,RELOAD_ACL) || check_db_used(thd, tables)) goto error; - if (reload_acl_and_cache(thd, lex->type, tables)) - send_error(thd,0); - else - send_ok(thd); + /* error sending is deferred to reload_acl_and_cache */ + reload_acl_and_cache(thd, lex->type, tables) ; break; case SQLCOM_KILL: kill_one_thread(thd,lex->thread_id); @@ -3043,6 +3113,7 @@ mysql_init_query(THD *thd) lex->select_lex.link_prev= (st_select_lex_node**)&(lex->all_selects_list); lex->olap=lex->describe=0; lex->derived_tables= false; + lex->lock_option=TL_READ; thd->check_loops_counter= thd->select_number= lex->select_lex.select_number= 1; thd->free_list= 0; @@ -3572,11 +3643,30 @@ bool add_to_list(THD *thd, SQL_LIST &list,Item *item,bool asc) } +/* + Add a table to list of used tables + + SYNOPSIS + add_table_to_list() + table Table to add + alias alias for table (or null if no alias) + table_options A set of the following bits: + TL_OPTION_UPDATING Table will be updated + TL_OPTION_FORCE_INDEX Force usage of index + lock_type How table should be locked + use_index List of indexed used in USE INDEX + ignore_index List of indexed used in IGNORE INDEX + + RETURN + 0 Error + # Pointer to TABLE_LIST element added to the total table list +*/ + TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, Table_ident *table, LEX_STRING *alias, - bool updating, - thr_lock_type flags, + ulong table_options, + thr_lock_type lock_type, List<String> *use_index, List<String> *ignore_index) { @@ -3633,8 +3723,9 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, } ptr->real_name=table->table.str; ptr->real_name_length=table->table.length; - ptr->lock_type=flags; - ptr->updating=updating; + ptr->lock_type= lock_type; + ptr->updating= test(table_options & TL_OPTION_UPDATING); + ptr->force_index= test(table_options & TL_OPTION_FORCE_INDEX); ptr->derived= (SELECT_LEX_UNIT *) table->sel; if (use_index) ptr->use_index=(List<String> *) thd->memdup((gptr) use_index, @@ -3644,7 +3735,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, sizeof(*ignore_index)); /* check that used name is unique */ - if (flags != TL_IGNORE) + if (lock_type != TL_IGNORE) { for (TABLE_LIST *tables=(TABLE_LIST*) table_list.first ; tables ; @@ -3714,10 +3805,15 @@ void add_join_natural(TABLE_LIST *a,TABLE_LIST *b) b->natural_join=a; } + +/* + Reload/resets privileges and the different caches +*/ + bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables) { bool result=0; - + bool error_already_sent=0; select_errors=0; /* Write if more errors */ if (options & REFRESH_GRANT) { @@ -3778,12 +3874,30 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables) { LOCK_ACTIVE_MI; if (reset_slave(thd, active_mi)) + { result=1; + /* + reset_slave() sends error itself. + If it didn't, one would either change reset_slave()'s prototype, to + pass *errorcode and *errmsg to it when it's called or + change reset_slave to use my_error() to register the error. + */ + error_already_sent=1; + } UNLOCK_ACTIVE_MI; } #endif if (options & REFRESH_USER_RESOURCES) reset_mqh(thd,(LEX_USER *) NULL); + + if (thd && !error_already_sent) + { + if (result) + send_error(thd,0); + else + send_ok(thd); + } + return result; } diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index fde81ad9044..3a5bf8ebaad 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -331,9 +331,12 @@ static bool setup_params_data(PREP_STMT *stmt) if (!param->long_data_supplied) { if (IS_PARAM_NULL(pos,param_no)) - param->maybe_null=param->null_value=1; + param->maybe_null= param->null_value= 1; else + { + param->maybe_null= param->null_value= 0; param->setup_param_func(param,&read_pos); + } } param_no++; } @@ -450,10 +453,9 @@ static bool mysql_test_upd_fields(PREP_STMT *stmt, TABLE_LIST *table_list, COND *conds) { THD *thd= stmt->thd; - TABLE *table; DBUG_ENTER("mysql_test_upd_fields"); - if (!(table = open_ltable(thd,table_list,table_list->lock_type))) + if (open_and_lock_tables(thd, table_list)) DBUG_RETURN(1); if (setup_tables(table_list) || setup_fields(thd,table_list,fields,1,0,0) || @@ -487,13 +489,12 @@ static bool mysql_test_select_fields(PREP_STMT *stmt, TABLE_LIST *tables, COND *conds, ORDER *order, ORDER *group, Item *having) { - TABLE *table; bool hidden_group_fields; THD *thd= stmt->thd; List<Item> all_fields(fields); DBUG_ENTER("mysql_test_select_fields"); - if (!(table = open_ltable(thd,tables,TL_READ))) + if (open_and_lock_tables(thd, tables)) DBUG_RETURN(1); thd->used_tables=0; // Updated by setup_fields @@ -522,7 +523,7 @@ static bool mysql_test_select_fields(PREP_STMT *stmt, TABLE_LIST *tables, sending any info on where clause. */ if (send_prep_stmt(stmt, fields.elements) || - thd->protocol_prep.send_fields(&fields,0) || + thd->protocol_simple.send_fields(&fields,0) || send_item_params(stmt)) DBUG_RETURN(1); DBUG_RETURN(0); @@ -636,19 +637,40 @@ static bool parse_prepare_query(PREP_STMT *stmt, /* Initialize parameter items in statement */ -static bool init_param_items(THD *thd, PREP_STMT *stmt) + +static bool init_param_items(PREP_STMT *stmt) { + List<Item> ¶ms= stmt->thd->lex.param_list; Item_param **to; + if (!(stmt->param= to= (Item_param **) my_malloc(sizeof(Item_param *)*(stmt->param_count+1), MYF(MY_WME)))) return 1; - List_iterator<Item> param_iterator(thd->lex.param_list); + List_iterator<Item> param_iterator(params); while ((*(to++) = (Item_param *)param_iterator++)); return 0; } /* + Initialize stmt execution +*/ + +static void init_stmt_execute(PREP_STMT *stmt) +{ + THD *thd= stmt->thd; + TABLE_LIST *tables=(TABLE_LIST*) thd->lex.select_lex.table_list.first; + + /* + TODO: When the new table structure is ready, then have a status bit + to indicate the table is altered, and re-do the setup_* + and open the tables back. + */ + if (tables) + tables->table=0; //safety - nasty init +} + +/* Parse the query and send the total number of parameters and resultset metadata information back to client (if any), without executing the query i.e. with out any log/disk @@ -669,29 +691,32 @@ bool mysql_stmt_prepare(THD *thd, char *packet, uint packet_length) DBUG_ENTER("mysql_stmt_prepare"); bzero((char*) &stmt, sizeof(stmt)); - stmt.thd= thd; + stmt.stmt_id= ++thd->current_stmt_id; init_sql_alloc(&stmt.mem_root, 8192, 8192); + + stmt.thd= thd; + stmt.thd->mem_root= stmt.mem_root; - thd->mem_root= stmt.mem_root; - if (alloc_query(thd, packet, packet_length)) + if (alloc_query(stmt.thd, packet, packet_length)) goto err; + if (parse_prepare_query(&stmt, thd->query, thd->query_length)) goto err; if (!(specialflag & SPECIAL_NO_PRIOR)) my_pthread_setprio(pthread_self(),WAIT_PRIOR); - if (init_param_items(thd, &stmt)) + if (init_param_items(&stmt)) goto err; - stmt.mem_root= thd->mem_root; + stmt.mem_root= stmt.thd->mem_root; tree_insert(&thd->prepared_statements, (void *)&stmt, 0, (void *)0); thd->mem_root= thd_root; // restore main mem_root DBUG_RETURN(0); err: - stmt.mem_root= thd->mem_root; + stmt.mem_root= stmt.thd->mem_root; free_prep_stmt(&stmt, free_free, (void*) 0); thd->mem_root = thd_root; // restore main mem_root DBUG_RETURN(1); @@ -725,6 +750,8 @@ void mysql_stmt_execute(THD *thd, char *packet) DBUG_VOID_RETURN; } + init_stmt_execute(stmt); + if (stmt->param_count && setup_params_data(stmt)) DBUG_VOID_RETURN; @@ -737,9 +764,9 @@ void mysql_stmt_execute(THD *thd, char *packet) mysql_delete(), mysql_update() and mysql_select() to not to have re-check on setup_* and other things .. */ - thd->protocol= &thd->protocol_prep; // Switch to binary protocol + stmt->thd->protocol= &thd->protocol_prep; // Switch to binary protocol mysql_execute_command(stmt->thd); - thd->protocol= &thd->protocol_simple; // Use normal protocol + stmt->thd->protocol= &thd->protocol_simple; // Use normal protocol if (!(specialflag & SPECIAL_NO_PRIOR)) my_pthread_setprio(pthread_self(), WAIT_PRIOR); diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 7c247302e02..a4a1cbd4ad6 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -698,20 +698,48 @@ int stop_slave(THD* thd, MASTER_INFO* mi, bool net_report ) return 0; } + +/* + Remove all relay logs and start replication from the start + + SYNOPSIS + reset_slave() + thd Thread handler + mi Master info for the slave + + + NOTES + We don't send ok in this functions as this is called from + reload_acl_and_cache() which may have done other tasks, which may + have failed for which we want to send and error. + + RETURN + 0 ok + 1 error + In this case error is sent to the client with send_error() +*/ + + int reset_slave(THD *thd, MASTER_INFO* mi) { MY_STAT stat_area; char fname[FN_REFLEN]; - int restart_thread_mask = 0,error=0; + int thread_mask= 0, error= 0; + uint sql_errno=0; const char* errmsg=0; DBUG_ENTER("reset_slave"); lock_slave_threads(mi); - init_thread_mask(&restart_thread_mask,mi,0 /* not inverse */); - if ((error=terminate_slave_threads(mi,restart_thread_mask,1 /*skip lock*/)) - || (error=purge_relay_logs(&mi->rli, thd, - 1 /* just reset */, - &errmsg))) + init_thread_mask(&thread_mask,mi,0 /* not inverse */); + if (thread_mask) // We refuse if any slave thread is running + { + sql_errno= ER_SLAVE_MUST_STOP; + error=1; + goto err; + } + if ((error= purge_relay_logs(&mi->rli, thd, + 1 /* just reset */, + &errmsg))) goto err; end_master_info(mi); @@ -727,17 +755,15 @@ int reset_slave(THD *thd, MASTER_INFO* mi) error=1; goto err; } - if (restart_thread_mask) - error=start_slave_threads(0 /* mutex not needed */, - 1 /* wait for start*/, - mi,master_info_file,relay_log_info_file, - restart_thread_mask); - // TODO: fix error messages so they get to the client + err: unlock_slave_threads(mi); + if (thd && error) + send_error(thd, sql_errno, errmsg); DBUG_RETURN(error); } + void kill_zombie_dump_threads(uint32 slave_server_id) { pthread_mutex_lock(&LOCK_thread_count); @@ -769,23 +795,20 @@ void kill_zombie_dump_threads(uint32 slave_server_id) int change_master(THD* thd, MASTER_INFO* mi) { - int error=0,restart_thread_mask; + int thread_mask; const char* errmsg=0; bool need_relay_log_purge=1; DBUG_ENTER("change_master"); - // kill slave thread lock_slave_threads(mi); - init_thread_mask(&restart_thread_mask,mi,0 /*not inverse*/); - if (restart_thread_mask && - (error=terminate_slave_threads(mi, - restart_thread_mask, - 1 /*skip lock*/))) + init_thread_mask(&thread_mask,mi,0 /*not inverse*/); + if (thread_mask) // We refuse if any slave thread is running { - send_error(thd,error); + net_printf(thd,ER_SLAVE_MUST_STOP); unlock_slave_threads(mi); DBUG_RETURN(1); } + thd->proc_info = "changing master"; LEX_MASTER_INFO* lex_mi = &thd->lex.mi; // TODO: see if needs re-write @@ -854,6 +877,7 @@ int change_master(THD* thd, MASTER_INFO* mi) &errmsg)) { net_printf(thd, 0, "Failed purging old relay logs: %s",errmsg); + unlock_slave_threads(mi); DBUG_RETURN(1); } } @@ -884,18 +908,9 @@ int change_master(THD* thd, MASTER_INFO* mi) pthread_cond_broadcast(&mi->data_cond); pthread_mutex_unlock(&mi->rli.data_lock); - thd->proc_info = "starting slave"; - if (restart_thread_mask) - error=start_slave_threads(0 /* mutex not needed*/, - 1 /* wait for start*/, - mi,master_info_file,relay_log_info_file, - restart_thread_mask); unlock_slave_threads(mi); thd->proc_info = 0; - if (error) - send_error(thd,error); - else - send_ok(thd); + send_ok(thd); DBUG_RETURN(0); } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index c7ab438ba97..f6f7c473b07 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -184,6 +184,16 @@ int handle_select(THD *thd, LEX *lex, select_result *result) return res; } + +void relink_tables(SELECT_LEX *select_lex) +{ + for (TABLE_LIST *cursor= (TABLE_LIST *) select_lex->table_list.first; + cursor; + cursor=cursor->next) + cursor->table= cursor->table_list->table; +} + + void fix_tables_pointers(SELECT_LEX *select_lex) { if (select_lex->next_select_in_list()) @@ -192,18 +202,15 @@ void fix_tables_pointers(SELECT_LEX *select_lex) for (SELECT_LEX *sl= select_lex; sl; sl= sl->next_select_in_list()) - { - for (TABLE_LIST *cursor= (TABLE_LIST *)sl->table_list.first; - cursor; - cursor=cursor->next) - cursor->table= cursor->table_list->table; - } + relink_tables(sl); } } + /* - Inline function to setup clauses without sum functions + Function to setup clauses without sum functions */ + inline int setup_without_group(THD *thd, TABLE_LIST *tables, List<Item> &fields, List<Item> &all_fields, @@ -1160,7 +1167,7 @@ mysql_select(THD *thd, TABLE_LIST *tables, List<Item> &fields, COND *conds, if (thd->possible_loops) { Item *item; - while(thd->possible_loops->elements) + while (thd->possible_loops->elements) { item= thd->possible_loops->pop(); if (item->check_loop(thd->check_loops_counter++)) @@ -1507,7 +1514,7 @@ make_join_statistics(JOIN *join,TABLE_LIST *tables,COND *conds, select->quick=0; if (records != HA_POS_ERROR) { - s->records=s->found_records=records; + s->found_records=records; s->read_time= (ha_rows) (s->quick ? s->quick->read_time : 0.0); } } @@ -2298,7 +2305,8 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count, !(s->quick && best_key && s->quick->index == best_key->key && best_max_key_part >= s->table->quick_key_parts[best_key->key]) && !((s->table->file->table_flags() & HA_TABLE_SCAN_ON_INDEX) && - s->table->used_keys && best_key)) + s->table->used_keys && best_key) && + !(s->table->force_index && best_key)) { // Check full join if (s->on_expr) { @@ -4980,7 +4988,10 @@ join_read_const(JOIN_TAB *tab) empty_record(table); if (error != HA_ERR_KEY_NOT_FOUND) { - sql_print_error("read_const: Got error %d when reading table %s", + /* Locking reads can legally return also these errors, do not + print them to the .err log */ + if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT) + sql_print_error("read_const: Got error %d when reading table %s", error, table->path); table->file->print_error(error,MYF(0)); return 1; @@ -5043,7 +5054,8 @@ join_read_always_key(JOIN_TAB *tab) { if (error != HA_ERR_KEY_NOT_FOUND) { - sql_print_error("read_const: Got error %d when reading table %s",error, + if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT) + sql_print_error("read_const: Got error %d when reading table %s",error, table->path); table->file->print_error(error,MYF(0)); return 1; @@ -5072,7 +5084,8 @@ join_read_last_key(JOIN_TAB *tab) { if (error != HA_ERR_KEY_NOT_FOUND) { - sql_print_error("read_const: Got error %d when reading table %s",error, + if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT) + sql_print_error("read_const: Got error %d when reading table %s",error, table->path); table->file->print_error(error,MYF(0)); return 1; @@ -5104,7 +5117,8 @@ join_read_next_same(READ_RECORD *info) { if (error != HA_ERR_END_OF_FILE) { - sql_print_error("read_next: Got error %d when reading table %s",error, + if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT) + sql_print_error("read_next: Got error %d when reading table %s",error, table->path); table->file->print_error(error,MYF(0)); return 1; @@ -5126,7 +5140,8 @@ join_read_prev_same(READ_RECORD *info) { if (error != HA_ERR_END_OF_FILE) { - sql_print_error("read_next: Got error %d when reading table %s",error, + if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT) + sql_print_error("read_next: Got error %d when reading table %s",error, table->path); table->file->print_error(error,MYF(0)); error= 1; @@ -5197,7 +5212,8 @@ join_read_first(JOIN_TAB *tab) { if (error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE) { - sql_print_error("read_first_with_key: Got error %d when reading table", + if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT) + sql_print_error("read_first_with_key: Got error %d when reading table", error); table->file->print_error(error,MYF(0)); return 1; @@ -5216,7 +5232,9 @@ join_read_next(READ_RECORD *info) { if (error != HA_ERR_END_OF_FILE) { - sql_print_error("read_next_with_key: Got error %d when reading table %s", + if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT) + sql_print_error( + "read_next_with_key: Got error %d when reading table %s", error, info->table->path); info->file->print_error(error,MYF(0)); return 1; @@ -5248,7 +5266,8 @@ join_read_last(JOIN_TAB *tab) { if (error != HA_ERR_END_OF_FILE) { - sql_print_error("read_last_with_key: Got error %d when reading table", + if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT) + sql_print_error("read_last_with_key: Got error %d when reading table", error, table->path); table->file->print_error(error,MYF(0)); return 1; @@ -5267,7 +5286,9 @@ join_read_prev(READ_RECORD *info) { if (error != HA_ERR_END_OF_FILE) { - sql_print_error("read_prev_with_key: Got error %d when reading table: %s", + if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT) + sql_print_error( + "read_prev_with_key: Got error %d when reading table: %s", error,info->table->path); info->file->print_error(error,MYF(0)); return 1; @@ -5295,7 +5316,8 @@ join_ft_read_first(JOIN_TAB *tab) { if (error != HA_ERR_END_OF_FILE) { - sql_print_error("ft_read_first: Got error %d when reading table %s", + if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT) + sql_print_error("ft_read_first: Got error %d when reading table %s", error, table->path); table->file->print_error(error,MYF(0)); return 1; @@ -5313,7 +5335,8 @@ join_ft_read_next(READ_RECORD *info) { if (error != HA_ERR_END_OF_FILE) { - sql_print_error("ft_read_next: Got error %d when reading table %s", + if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT) + sql_print_error("ft_read_next: Got error %d when reading table %s", error, info->table->path); info->file->print_error(error,MYF(0)); return 1; @@ -5938,6 +5961,69 @@ static uint find_shortest_key(TABLE *table, key_map usable_keys) return best; } +/* + SYNOPSIS + is_subkey() + key_part - first key parts + ref_key_part - second key parts + ref_key_part_end - last+1 part of the second key + DESCRIPTION + Test if a second key is the subkey of the first one. + NOTE + Second key MUST be shorter than the first one. + RETURN + 1 - is the subkey + 0 - otherwise +*/ + +inline bool +is_subkey(KEY_PART_INFO *key_part, KEY_PART_INFO *ref_key_part, + KEY_PART_INFO *ref_key_part_end) +{ + for (; ref_key_part < ref_key_part_end; key_part++, ref_key_part++) + if (!key_part->field->eq(ref_key_part->field)) + return 0; + return 1; +} + +/* + SYNOPSIS + test_if_subkey() + ref - number of key, used for WHERE clause + usable_keys - keys for testing + DESCRIPTION + Test if we can use one of the 'usable_keys' instead of 'ref' key. + RETURN + MAX_KEY - if we can't use other key + the number of found key - otherwise +*/ + +static uint +test_if_subkey(ORDER *order, TABLE *table, uint ref, key_map usable_keys) +{ + uint nr; + uint min_length= (uint) ~0; + uint best= MAX_KEY; + uint not_used; + KEY_PART_INFO *ref_key_part= table->key_info[ref].key_part; + uint ref_key_parts= table->key_info[ref].key_parts; + KEY_PART_INFO *ref_key_part_end= ref_key_part + ref_key_parts; + + for (nr= 0; usable_keys; usable_keys>>= 1, nr++) + { + if ((usable_keys & 1) && + table->key_info[nr].key_length < min_length && + table->key_info[nr].key_parts >= ref_key_parts && + is_subkey(table->key_info[nr].key_part, ref_key_part, + ref_key_part_end) && + test_if_order_by_key(order, table, nr, ¬_used)) + { + min_length= table->key_info[nr].key_length; + best= nr; + } + } + return best; +} /* Test if we can skip the ORDER BY by using an index. @@ -5985,6 +6071,27 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, */ int order_direction; uint used_key_parts; + if (!(usable_keys & ((key_map) 1 << ref_key))) + { + /* + We come here when ref_key is not among usable_keys + */ + uint a; + if ((a= test_if_subkey(order, table, ref_key, usable_keys)) < MAX_KEY) + { + if (tab->ref.key >= 0) + { + tab->ref.key= a; + table->file->index_init(a); + } + else + { + select->quick->index= a; + select->quick->init(); + } + ref_key= a; + } + } /* Check if we get the rows in requested sorted order by using the key */ if ((usable_keys & ((key_map) 1 << ref_key)) && (order_direction = test_if_order_by_key(order,table,ref_key, @@ -6650,12 +6757,14 @@ store_record_in_cache(JOIN_CACHE *cache) { if (last_record) { - copy->blob_field->get_image((char*) pos,copy->length+sizeof(char*)); + copy->blob_field->get_image((char*) pos,copy->length+sizeof(char*), + copy->blob_field->charset()); pos+=copy->length+sizeof(char*); } else { - copy->blob_field->get_image((char*) pos,copy->length); // blob length + copy->blob_field->get_image((char*) pos,copy->length, // blob length + copy->blob_field->charset()); memcpy(pos+copy->length,copy->str,copy->blob_length); // Blob data pos+=copy->length+copy->blob_length; } @@ -6712,7 +6821,8 @@ read_cached_record(JOIN_TAB *tab) { if (last_record) { - copy->blob_field->set_image((char*) pos,copy->length+sizeof(char*)); + copy->blob_field->set_image((char*) pos,copy->length+sizeof(char*), + copy->blob_field->charset()); pos+=copy->length+sizeof(char*); } else @@ -7517,7 +7627,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, item_list.push_back(new Item_string(message,strlen(message), default_charset_info)); if (result->send_data(item_list)) - result->send_error(0,NullS); + join->error= 1; } else { @@ -7527,7 +7637,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, JOIN_TAB *tab=join->join_tab+i; TABLE *table=tab->table; char buff[512],*buff_ptr=buff; - char buff1[512], buff2[512], buff3[512]; + char buff1[512], buff2[512]; String tmp1(buff1,sizeof(buff1),default_charset_info); String tmp2(buff2,sizeof(buff2),default_charset_info); tmp1.length(0); @@ -7658,7 +7768,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, // For next iteration used_tables|=table->map; if (result->send_data(item_list)) - result->send_error(0,NullS); + join->error= 1; } } for (SELECT_LEX_UNIT *unit= join->select_lex->first_inner_unit(); diff --git a/sql/sql_select.h b/sql/sql_select.h index 1fbe2052831..e30bba830eb 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -374,3 +374,4 @@ public: bool cp_buffer_from_ref(TABLE_REF *ref); bool error_if_full_join(JOIN *join); +void relink_tables(SELECT_LEX *select_lex); diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 78bae8d29dc..168dbe4cfa3 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -675,6 +675,7 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild, List<Item> field_list; field_list.push_back(new Item_empty_string("Field",NAME_LEN)); field_list.push_back(new Item_empty_string("Type",40)); + field_list.push_back(new Item_empty_string("Collation",40)); field_list.push_back(new Item_empty_string("Null",1)); field_list.push_back(new Item_empty_string("Key",3)); field_list.push_back(item=new Item_empty_string("Default",NAME_LEN)); @@ -721,6 +722,7 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild, protocol->store(field->field_name); field->sql_type(type); protocol->store(type.ptr(), type.length()); + protocol->store(field->charset()->name); pos=(byte*) ((flags & NOT_NULL_FLAG) && field->type() != FIELD_TYPE_TIMESTAMP ? @@ -841,7 +843,6 @@ int mysqld_show_keys(THD *thd, TABLE_LIST *table_list) { TABLE *table; - char buff[256]; Protocol *protocol= thd->protocol; DBUG_ENTER("mysqld_show_keys"); DBUG_PRINT("enter",("db: %s table: %s",table_list->db, @@ -1055,6 +1056,16 @@ store_create_info(THD *thd, TABLE *table, String *packet) bool has_default = (field->type() != FIELD_TYPE_BLOB && field->type() != FIELD_TYPE_TIMESTAMP && field->unireg_check != Field::NEXT_NUMBER); + + /* + For string types dump collation name only if + collation is not primary for the given charset + */ + if (!field->binary() && !(field->charset()->state & MY_CS_PRIMARY)) + { + packet->append(" collate ",9); + packet->append(field->charset()->name); + } if (flags & NOT_NULL_FLAG) packet->append(" NOT NULL", 9); @@ -1117,8 +1128,8 @@ store_create_info(THD *thd, TABLE *table, String *packet) packet->append(" USING BTREE", 12); // +BAR: send USING only in non-default case: non-spatial rtree - if((key_info->algorithm == HA_KEY_ALG_RTREE) && - !(key_info->flags & HA_SPATIAL)) + if ((key_info->algorithm == HA_KEY_ALG_RTREE) && + !(key_info->flags & HA_SPATIAL)) packet->append(" USING RTREE",12); packet->append(" (", 2); @@ -1167,7 +1178,12 @@ store_create_info(THD *thd, TABLE *table, String *packet) if (table->table_charset) { packet->append(" CHARSET="); - packet->append(table->table_charset->name); + packet->append(table->table_charset->csname); + if (!(table->table_charset->state & MY_CS_PRIMARY)) + { + packet->append(" COLLATE="); + packet->append(table->table_charset->name); + } } if (table->min_rows) @@ -1273,6 +1289,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose) THD *tmp; while ((tmp=it++)) { + struct st_my_thread_var *mysys_var; #ifndef EMBEDDED_LIBRARY if ((tmp->net.vio || tmp->system_thread) && (!user || (tmp->user && !strcmp(tmp->user,user)))) @@ -1294,8 +1311,8 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose) if ((thd_info->db=tmp->db)) // Safe test thd_info->db=thd->strdup(thd_info->db); thd_info->command=(int) tmp->command; - if (tmp->mysys_var) - pthread_mutex_lock(&tmp->mysys_var->mutex); + if ((mysys_var= tmp->mysys_var)) + pthread_mutex_lock(&mysys_var->mutex); thd_info->proc_info= (char*) (tmp->killed ? "Killed" : 0); #ifndef EMBEDDED_LIBRARY thd_info->state_info= (char*) (tmp->locked ? "Locked" : @@ -1311,8 +1328,8 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose) #else thd_info->state_info= (char*)"Writing to net"; #endif - if (tmp->mysys_var) - pthread_mutex_unlock(&tmp->mysys_var->mutex); + if (mysys_var) + pthread_mutex_unlock(&mysys_var->mutex); #if !defined(DONT_USE_THR_ALARM) && ! defined(SCO) if (pthread_kill(tmp->real_id,0)) @@ -1341,7 +1358,6 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose) time_t now= time(0); while ((thd_info=thread_infos.get())) { - char buff[20],*end; protocol->prepare_for_resend(); protocol->store((ulonglong) thd_info->thread_id); protocol->store(thd_info->user); @@ -1375,10 +1391,14 @@ int mysqld_show_charsets(THD *thd, const char *wild) List<Item> field_list; CHARSET_INFO **cs; Protocol *protocol= thd->protocol; + char flags[64]; + DBUG_ENTER("mysqld_show_charsets"); - field_list.push_back(new Item_empty_string("Name",30)); + field_list.push_back(new Item_empty_string("CS_Name",30)); + field_list.push_back(new Item_empty_string("COL_Name",30)); field_list.push_back(new Item_return_int("Id",11, FIELD_TYPE_SHORT)); + field_list.push_back(new Item_empty_string("Flags",30)); field_list.push_back(new Item_return_int("strx_maxlen",3, FIELD_TYPE_TINY)); field_list.push_back(new Item_return_int("mb_maxlen",3, FIELD_TYPE_TINY)); @@ -1387,14 +1407,17 @@ int mysqld_show_charsets(THD *thd, const char *wild) for (cs=all_charsets ; cs < all_charsets+255 ; cs++ ) { - if (!cs[0]) - continue; - if (!(wild && wild[0] && + if (cs[0] && !(wild && wild[0] && wild_case_compare(system_charset_info,cs[0]->name,wild))) { protocol->prepare_for_resend(); + protocol->store(cs[0]->csname); protocol->store(cs[0]->name); protocol->store_short((longlong) cs[0]->number); + flags[0]='\0'; + if (cs[0]->state & MY_CS_PRIMARY) + strcat(flags,"pri"); + protocol->store(flags); protocol->store_tiny((longlong) cs[0]->strxfrm_multiply); protocol->store_tiny((longlong) cs[0]->mbmaxlen); if (protocol->write()) @@ -1450,6 +1473,9 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables, break; case SHOW_LONGLONG: end= longlong10_to_str(*(longlong*) value, buff, 10); + break; + case SHOW_HA_ROWS: + end= longlong10_to_str((longlong) *(ha_rows*) value, buff, 10); break; case SHOW_BOOL: end= strmov(buff, *(bool*) value ? "ON" : "OFF"); @@ -1481,7 +1507,7 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables, break; #ifndef EMBEDDED_LIBRARY case SHOW_RPL_STATUS: - end= int10_to_str((long) rpl_status_type[(int)rpl_status], buff, 10); + end= strmov(buff, rpl_status_type[(int)rpl_status]); break; case SHOW_SLAVE_RUNNING: { diff --git a/sql/sql_string.cc b/sql/sql_string.cc index 51b2386ae62..4c499af8f9e 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -30,6 +30,9 @@ extern gptr sql_alloc(unsigned size); extern void sql_element_free(void *ptr); +static uint32 +copy_and_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs, + const char *from, uint32 from_length, CHARSET_INFO *from_cs); #include "sql_string.h" @@ -223,55 +226,51 @@ bool String::copy(const char *str,uint32 arg_length, CHARSET_INFO *cs) return FALSE; } -/* Copy with charset convertion */ -bool String::copy(const char *str,uint32 arg_length, CHARSET_INFO *from, CHARSET_INFO *to) -{ - uint32 new_length=to->mbmaxlen*arg_length; - int cnvres; - my_wc_t wc; - const uchar *s=(const uchar *)str; - const uchar *se=s+arg_length; - uchar *d, *de; + /* Copy with charset convertion */ +bool String::copy(const char *str, uint32 arg_length, + CHARSET_INFO *from_cs, CHARSET_INFO *to_cs) +{ + uint32 new_length= to_cs->mbmaxlen*arg_length; if (alloc(new_length)) return TRUE; + str_length=copy_and_convert((char*) Ptr, new_length, to_cs, + str, arg_length, from_cs); + str_charset=to_cs; + return FALSE; +} - d=(uchar *)Ptr; - de=d+new_length; + +/* + Set a string to the value of a latin1-string, keeping the original charset - for (str_length=new_length ; s < se && d < de ; ) - { - if ((cnvres=from->mb_wc(from,&wc,s,se)) > 0 ) - { - s+=cnvres; - } - else if (cnvres==MY_CS_ILSEQ) - { - s++; - wc='?'; - } - else - break; + SYNOPSIS + copy_or_set() + str String of a simple charset (latin1) + arg_length Length of string -outp: - if((cnvres=to->wc_mb(to,wc,d,de)) >0 ) - { - d+=cnvres; - } - else if (cnvres==MY_CS_ILUNI && wc!='?') - { - wc='?'; - goto outp; - } - else - break; + IMPLEMENTATION + If string object is of a simple character set, set it to point to the + given string. + If not, make a copy and convert it to the new character set. + + RETURN + 0 ok + 1 Could not allocate result buffer + +*/ + +bool String::set_latin1(const char *str, uint32 arg_length) +{ + if (str_charset->mbmaxlen == 1) + { + set(str, arg_length, str_charset); + return 0; } - Ptr[new_length]=0; - length((uint32) (d-(uchar *)Ptr)); - str_charset=to; - return FALSE; + return copy(str, arg_length, my_charset_latin1, str_charset); } + /* This is used by mysql.cc */ bool String::fill(uint32 max_length,char fill_char) @@ -306,11 +305,26 @@ bool String::append(const String &s) return FALSE; } + +/* + Append a latin1 string to the a string of the current character set +*/ + + bool String::append(const char *s,uint32 arg_length) { if (!arg_length) // Default argument if (!(arg_length= (uint32) strlen(s))) return FALSE; + if (str_charset->mbmaxlen > 1) + { + uint32 add_length=arg_length * str_charset->mbmaxlen; + 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); + return FALSE; + } if (realloc(str_length+arg_length)) return TRUE; memcpy(Ptr+str_length,s,arg_length); @@ -318,6 +332,7 @@ bool String::append(const char *s,uint32 arg_length) return FALSE; } + #ifdef TO_BE_REMOVED bool String::append(FILE* file, uint32 arg_length, myf my_flags) { @@ -658,4 +673,61 @@ String *copy_if_not_alloced(String *to,String *from,uint32 from_length) } +/**************************************************************************** + Help functions +****************************************************************************/ + +/* + copy a string from one character set to another + + SYNOPSIS + copy_and_convert() + to Store result here + to_cs Character set of result string + from Copy from here + from_length Length of from string + from_cs From character set + + NOTES + 'to' must be big enough as form_length * to_cs->mbmaxlen + + RETURN + length of bytes copied to 'to' +*/ + +static uint32 +copy_and_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs, + const char *from, uint32 from_length, CHARSET_INFO *from_cs) +{ + int cnvres; + my_wc_t wc; + const uchar *from_end= (const uchar*) from+from_length; + char *to_start= to; + uchar *to_end= (uchar*) to+to_length; + + while ((uchar*) from < from_end) + { + if ((cnvres=from_cs->mb_wc(from_cs, &wc, (uchar*) from, from_end)) > 0) + from+= cnvres; + else if (cnvres == MY_CS_ILSEQ) + { + from++; + wc= '?'; + } + else + break; // Impossible char. + +outp: + if ((cnvres= to_cs->wc_mb(to_cs, wc, (uchar*) to, to_end)) > 0) + to+= cnvres; + else if (cnvres == MY_CS_ILUNI && wc != '?') + { + wc= '?'; + goto outp; + } + else + break; + } + return (uint32) (to - to_start); +} diff --git a/sql/sql_string.h b/sql/sql_string.h index d7447dd6ed6..ad91b20f18c 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -115,6 +115,7 @@ public: Ptr=(char*) str; str_length=arg_length; Alloced_length=0 ; alloced=0; str_charset=cs; } + bool String::set_latin1(const char *str, uint32 arg_length); inline void set_quick(char *str,uint32 arg_length, CHARSET_INFO *cs) { if (!alloced) @@ -225,7 +226,7 @@ public: { Ptr[str_length++] = c; } - void q_append(const uint32 &n) + void q_append(const uint32 n) { int4store(Ptr + str_length, n); str_length += 4; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 49e84db62c9..291976fe154 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -46,7 +46,8 @@ static int copy_data_between_tables(TABLE *from,TABLE *to, ** This will wait for all users to free the table before dropping it *****************************************************************************/ -int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists) +int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists, + my_bool drop_temporary) { int error; DBUG_ENTER("mysql_rm_table"); @@ -57,7 +58,7 @@ int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists) thd->mysys_var->current_cond= &COND_refresh; VOID(pthread_mutex_lock(&LOCK_open)); - if (global_read_lock) + if (!drop_temporary && global_read_lock) { if (thd->global_read_lock) { @@ -72,7 +73,7 @@ int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists) } } - error=mysql_rm_table_part2(thd,tables,if_exists,0); + error=mysql_rm_table_part2(thd,tables, if_exists, drop_temporary, 0); err: pthread_mutex_unlock(&LOCK_open); @@ -91,14 +92,15 @@ int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists) int mysql_rm_table_part2_with_lock(THD *thd, TABLE_LIST *tables, bool if_exists, - bool dont_log_query) + bool drop_temporary, bool dont_log_query) { int error; thd->mysys_var->current_mutex= &LOCK_open; thd->mysys_var->current_cond= &COND_refresh; VOID(pthread_mutex_lock(&LOCK_open)); - error=mysql_rm_table_part2(thd,tables, if_exists, dont_log_query); + error=mysql_rm_table_part2(thd,tables, if_exists, drop_temporary, + dont_log_query); pthread_mutex_unlock(&LOCK_open); VOID(pthread_cond_broadcast(&COND_refresh)); // Signal to refresh @@ -111,6 +113,17 @@ int mysql_rm_table_part2_with_lock(THD *thd, } /* + Execute the drop of a normal or temporary table + + SYNOPSIS + mysql_rm_table_part2() + thd Thread handler + tables Tables to drop + if_exists If set, don't give an error if table doesn't exists. + In this case we give an warning of level 'NOTE' + drop_temporary Only drop temporary tables + dont_log_query Don't log the query + TODO: When logging to the binary log, we should log tmp_tables and transactional tables as separate statements if we @@ -120,10 +133,15 @@ int mysql_rm_table_part2_with_lock(THD *thd, The current code only writes DROP statements that only uses temporary tables to the cache binary log. This should be ok on most cases, but not all. + + RETURN + 0 ok + 1 Error + -1 Thread was killed */ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, - bool dont_log_query) + bool drop_temporary, bool dont_log_query) { TABLE_LIST *table; char path[FN_REFLEN]; @@ -142,29 +160,33 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, continue; // removed temporary table } - abort_locked_tables(thd,db,table->real_name); - while (remove_table_from_cache(thd,db,table->real_name) && !thd->killed) - { - dropping_tables++; - (void) pthread_cond_wait(&COND_refresh,&LOCK_open); - dropping_tables--; - } - drop_locked_tables(thd,db,table->real_name); - if (thd->killed) - DBUG_RETURN(-1); - - /* remove form file and isam files */ - strxmov(path, mysql_data_home, "/", db, "/", table->real_name, reg_ext, - NullS); - (void) unpack_filename(path,path); error=0; + if (!drop_temporary) + { + abort_locked_tables(thd,db,table->real_name); + while (remove_table_from_cache(thd,db,table->real_name) && !thd->killed) + { + dropping_tables++; + (void) pthread_cond_wait(&COND_refresh,&LOCK_open); + dropping_tables--; + } + drop_locked_tables(thd,db,table->real_name); + if (thd->killed) + DBUG_RETURN(-1); - table_type=get_table_type(path); + /* remove form file and isam files */ + strxmov(path, mysql_data_home, "/", db, "/", table->real_name, reg_ext, + NullS); + (void) unpack_filename(path,path); - if (access(path,F_OK)) + table_type=get_table_type(path); + } + if (drop_temporary || access(path,F_OK)) { if (if_exists) - store_warning(thd, ER_BAD_TABLE_ERROR, table->real_name); + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, + ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR), + table->real_name); else error= 1; } @@ -190,6 +212,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, wrong_tables.append(String(table->real_name,default_charset_info)); } } + thd->lex.tmp_table_used= tmp_table_deleted; if (some_tables_deleted || tmp_table_deleted) { query_cache_invalidate3(thd, tables, 0); @@ -398,7 +421,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, it.rewind(); while ((sql_field=it++)) { - if(!sql_field->charset) + if (!sql_field->charset) sql_field->charset = create_info->table_charset ? create_info->table_charset : thd->db_charset? thd->db_charset : @@ -824,6 +847,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, (void) rm_temporary_table(create_info->db_type, path); goto end; } + thd->lex.tmp_table_used= 1; } if (!tmp_table && !no_log) { @@ -1392,6 +1416,127 @@ int mysql_optimize_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt) } +/* + Create a table identical to the specified table + + SYNOPSIS + mysql_create_like_table() + thd Thread object + table Table list (one table only) + create_info Create info + table_ident Src table_ident + + RETURN VALUES + 0 ok + -1 error +*/ + +int mysql_create_like_table(THD* thd, TABLE_LIST* table, + HA_CREATE_INFO *create_info, + Table_ident *table_ident) +{ + TABLE **tmp_table; + char src_path[FN_REFLEN], dst_path[FN_REFLEN]; + char *db= table->db; + char *table_name= table->real_name; + char *src_db= thd->db; + char *src_table= table_ident->table.str; + int err; + + DBUG_ENTER("mysql_create_like_table"); + + /* + Validate the source table + */ + if (table_ident->table.length > NAME_LEN || + (table_ident->table.length && + check_table_name(src_table,table_ident->table.length)) || + table_ident->db.str && check_db_name((src_db= table_ident->db.str))) + { + my_error(ER_WRONG_TABLE_NAME, MYF(0), src_table); + DBUG_RETURN(-1); + } + + if ((tmp_table= find_temporary_table(thd, src_db, src_table))) + strxmov(src_path, (*tmp_table)->path, reg_ext, NullS); + else + { + strxmov(src_path, mysql_data_home, "/", src_db, "/", src_table, + reg_ext, NullS); + if (access(src_path, F_OK)) + { + my_error(ER_BAD_TABLE_ERROR, MYF(0), src_table); + DBUG_RETURN(-1); + } + } + + /* + Validate the destination table + + skip the destination table name checking as this is already + validated. + */ + if (create_info->options & HA_LEX_CREATE_TMP_TABLE) + { + if (find_temporary_table(thd, db, table_name)) + goto table_exists; + sprintf(dst_path,"%s%s%lx_%lx_%x%s",mysql_tmpdir,tmp_file_prefix, + current_pid, thd->thread_id, thd->tmp_table++,reg_ext); + create_info->table_options|= HA_CREATE_DELAY_KEY_WRITE; + } + else + { + strxmov(dst_path, mysql_data_home, "/", db, "/", table_name, + reg_ext, NullS); + if (!access(dst_path, F_OK)) + goto table_exists; + } + + /* + Create a new table by copying from source table + */ + if (my_copy(src_path, dst_path, MYF(MY_WME))) + DBUG_RETURN(-1); + + /* + As mysql_truncate don't work on a new table at this stage of + creation, instead create the table directly (for both normal + and temporary tables). + */ + *fn_ext(dst_path)= 0; + err= ha_create_table(dst_path, create_info, 1); + + if (create_info->options & HA_LEX_CREATE_TMP_TABLE) + { + if (err || !open_temporary_table(thd, dst_path, db, table_name, 1)) + { + (void) rm_temporary_table(create_info->db_type, + dst_path); /* purecov: inspected */ + DBUG_RETURN(-1); /* purecov: inspected */ + } + } + else if (err) + { + (void) quick_rm_table(create_info->db_type, db, + table_name); /* purecov: inspected */ + DBUG_RETURN(-1); /* purecov: inspected */ + } + DBUG_RETURN(0); + +table_exists: + if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS) + { + char warn_buff[MYSQL_ERRMSG_SIZE]; + sprintf(warn_buff,ER(ER_TABLE_EXISTS_ERROR),table_name); + push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_TABLE_EXISTS_ERROR,warn_buff); + DBUG_RETURN(0); + } + my_error(ER_TABLE_EXISTS_ERROR, MYF(0), table_name); + DBUG_RETURN(-1); +} + + int mysql_analyze_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt) { #ifdef OS2 diff --git a/sql/sql_test.cc b/sql/sql_test.cc index 3fbeaa753db..758778ecfa8 100644 --- a/sql/sql_test.cc +++ b/sql/sql_test.cc @@ -276,6 +276,7 @@ static void display_table_locks (void) VOID(pthread_mutex_unlock(&lock->mutex)); } VOID(pthread_mutex_unlock(&THR_LOCK_lock)); + uint i; if (!saved_table_locks.elements) goto end; qsort((gptr) dynamic_element(&saved_table_locks,0,TABLE_LOCK_INFO *),saved_table_locks.elements,sizeof(TABLE_LOCK_INFO),(qsort_cmp) dl_compare); @@ -283,7 +284,7 @@ static void display_table_locks (void) puts("\nThread database.table_name Locked/Waiting Lock_type\n"); - for (uint i=0 ; i < saved_table_locks.elements ; i++) + for (i=0 ; i < saved_table_locks.elements ; i++) { TABLE_LOCK_INFO *dl_ptr=dynamic_element(&saved_table_locks,i,TABLE_LOCK_INFO*); printf("%-8ld%-28.28s%-22s%s\n", diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc index 51d43b41833..324befcb59e 100644 --- a/sql/sql_udf.cc +++ b/sql/sql_udf.cc @@ -33,6 +33,7 @@ #endif #include "mysql_priv.h" +#include <my_pthread.h> #ifdef HAVE_DLOPEN extern "C" @@ -70,7 +71,7 @@ extern "C" static bool initialized = 0; static MEM_ROOT mem; static HASH udf_hash; -static pthread_mutex_t THR_LOCK_udf; +static rw_lock_t THR_LOCK_udf; static udf_func *add_udf(char *name, Item_result ret, char *dl, @@ -122,8 +123,8 @@ void udf_init() if (initialized) DBUG_VOID_RETURN; - pthread_mutex_init(&THR_LOCK_udf,MY_MUTEX_INIT_SLOW); - + my_rwlock_init(&THR_LOCK_udf,NULL); + init_sql_alloc(&mem, 1024,0); THD *new_thd = new THD; if (!new_thd || @@ -262,7 +263,7 @@ static void del_udf(udf_func *udf) void free_udf(udf_func *udf) { DBUG_ENTER("free_udf"); - pthread_mutex_lock(&THR_LOCK_udf); + rw_wrlock(&THR_LOCK_udf); if (!--udf->usage_count) { /* @@ -274,7 +275,7 @@ void free_udf(udf_func *udf) if (!find_udf_dl(udf->dl)) dlclose(udf->dlhandle); } - pthread_mutex_unlock(&THR_LOCK_udf); + rw_unlock(&THR_LOCK_udf); DBUG_VOID_RETURN; } @@ -287,7 +288,7 @@ udf_func *find_udf(const char *name,uint length,bool mark_used) DBUG_ENTER("find_udf"); /* TODO: This should be changed to reader locks someday! */ - pthread_mutex_lock(&THR_LOCK_udf); + rw_rdlock(&THR_LOCK_udf); if ((udf=(udf_func*) hash_search(&udf_hash,(byte*) name, length ? length : (uint) strlen(name)))) { @@ -296,7 +297,7 @@ udf_func *find_udf(const char *name,uint length,bool mark_used) else if (mark_used) udf->usage_count++; } - pthread_mutex_unlock(&THR_LOCK_udf); + rw_unlock(&THR_LOCK_udf); DBUG_RETURN(udf); } @@ -375,7 +376,7 @@ int mysql_create_function(THD *thd,udf_func *udf) DBUG_RETURN(1); } - pthread_mutex_lock(&THR_LOCK_udf); + rw_wrlock(&THR_LOCK_udf); if ((hash_search(&udf_hash,(byte*) udf->name, udf->name_length))) { net_printf(thd, ER_UDF_EXISTS, udf->name); @@ -438,13 +439,13 @@ int mysql_create_function(THD *thd,udf_func *udf) del_udf(u_d); goto err; } - pthread_mutex_unlock(&THR_LOCK_udf); + rw_unlock(&THR_LOCK_udf); DBUG_RETURN(0); err: if (new_dl) dlclose(dl); - pthread_mutex_unlock(&THR_LOCK_udf); + rw_unlock(&THR_LOCK_udf); DBUG_RETURN(1); } @@ -460,7 +461,7 @@ int mysql_drop_function(THD *thd,const char *udf_name) send_error(thd, ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES)); DBUG_RETURN(1); } - pthread_mutex_lock(&THR_LOCK_udf); + rw_wrlock(&THR_LOCK_udf); if (!(udf=(udf_func*) hash_search(&udf_hash,(byte*) udf_name, (uint) strlen(udf_name)))) { @@ -490,10 +491,10 @@ int mysql_drop_function(THD *thd,const char *udf_name) } close_thread_tables(thd); - pthread_mutex_unlock(&THR_LOCK_udf); + rw_unlock(&THR_LOCK_udf); DBUG_RETURN(0); err: - pthread_mutex_unlock(&THR_LOCK_udf); + rw_unlock(&THR_LOCK_udf); DBUG_RETURN(1); } diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 10175bfe345..cdd34977e5a 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -279,9 +279,10 @@ int st_select_lex_unit::exec() } if (!thd->fatal_error) // Check if EOM { - offset_limit_cnt= global_parameters->offset_limit; - select_limit_cnt= global_parameters->select_limit+ - global_parameters->offset_limit; + SELECT_LEX *sl=thd->lex.current_select->master_unit()->first_select(); + offset_limit_cnt= (sl->braces) ? global_parameters->offset_limit : 0; + select_limit_cnt= (sl->braces) ? global_parameters->select_limit+ + global_parameters->offset_limit : HA_POS_ERROR; if (select_limit_cnt < global_parameters->select_limit) select_limit_cnt= HA_POS_ERROR; // no limit if (select_limit_cnt == HA_POS_ERROR) diff --git a/sql/sql_update.cc b/sql/sql_update.cc index de5cb9ef45b..3aae6f6f411 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -233,6 +233,7 @@ int mysql_update(THD *thd, } } end_read_record(&info); + if (table->key_read) { table->key_read=0; @@ -416,8 +417,6 @@ int mysql_multi_update(THD *thd, (ORDER *)NULL, options | SELECT_NO_JOIN_CACHE, result, unit, select_lex, 0); - -end: delete result; DBUG_RETURN(res); } @@ -631,7 +630,6 @@ bool multi_update::send_data(List<Item> ¬_used_values) TABLE_LIST *cur_table; DBUG_ENTER("multi_update::send_data"); - found++; for (cur_table= update_tables; cur_table ; cur_table= cur_table->next) { TABLE *table= cur_table->table; @@ -647,6 +645,7 @@ bool multi_update::send_data(List<Item> ¬_used_values) store_record(table,1); if (fill_record(*fields_for_table[offset], *values_for_table[offset])) DBUG_RETURN(1); + found++; if (compare_record(table, thd->query_id)) { int error; @@ -673,7 +672,7 @@ bool multi_update::send_data(List<Item> ¬_used_values) int error; TABLE *tmp_table= tmp_tables[offset]; fill_record(tmp_table->field+1, *values_for_table[offset]); - + found++; /* Store pointer to row */ memcpy((char*) tmp_table->field[0]->ptr, (char*) table->file->ref, table->file->ref_length); @@ -772,7 +771,6 @@ int multi_update::do_updates(bool from_send_error) continue; // May happen on dup key goto err; } - found++; if ((local_error= table->file->rnd_pos(table->record[0], ref_pos))) goto err; table->status|= STATUS_UPDATED; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 55f165c0739..318d563b88a 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2001 MySQL AB +/* Copyright (C) 2000-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 @@ -222,6 +222,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); %token FIRST_SYM %token FIXED_SYM %token FLOAT_NUM +%token FORCE_SYM %token FOREIGN %token FROM %token FULL @@ -587,7 +588,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); simple_ident select_item2 expr opt_expr opt_else sum_expr in_sum_expr table_wild opt_pad no_in_expr expr_expr simple_expr no_and_expr using_list expr_or_default set_expr_or_default - param_marker singleval_subselect singleval_subselect_init + param_marker singlerow_subselect singlerow_subselect_init exists_subselect exists_subselect_init %type <item_list> @@ -633,7 +634,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); %type <charset> charset_name charset_name_or_default - opt_db_default_character_set + collation_name + collation_name_or_default %type <variable> internal_variable_name @@ -822,7 +824,8 @@ create: ($2 & HA_LEX_CREATE_TMP_TABLE ? &tmp_table_alias : - (LEX_STRING*) 0),1, + (LEX_STRING*) 0), + TL_OPTION_UPDATING, ((using_update_log)? TL_READ_NO_INSERT: TL_READ))) @@ -835,6 +838,7 @@ create: lex->create_info.options=$2 | $4; lex->create_info.db_type= (enum db_type) lex->thd->variables.table_type; lex->create_info.table_charset=thd->db_charset?thd->db_charset:default_charset_info; + lex->name=0; } create2 {} @@ -842,7 +846,8 @@ create: { LEX *lex=Lex; lex->sql_command= SQLCOM_CREATE_INDEX; - if (!lex->current_select->add_table_to_list(lex->thd, $7,NULL,1)) + if (!lex->current_select->add_table_to_list(lex->thd, $7, NULL, + TL_OPTION_UPDATING)) YYABORT; lex->create_list.empty(); lex->key_list.empty(); @@ -856,13 +861,14 @@ create: lex->key_list.push_back(new Key($2,$4.str, $5, lex->col_list)); lex->col_list.empty(); } - | CREATE DATABASE opt_if_not_exists ident opt_db_default_character_set + | CREATE DATABASE opt_if_not_exists ident + { Lex->create_info.table_charset=NULL; } + opt_create_database_options { LEX *lex=Lex; lex->sql_command=SQLCOM_CREATE_DB; lex->name=$4.str; lex->create_info.options=$3; - lex->create_info.table_charset=$5; } | CREATE udf_func_type UDF_SYM ident { @@ -883,7 +889,13 @@ create: create2: '(' field_list ')' opt_create_table_options create3 {} | opt_create_table_options create3 {} - ; + | LIKE table_ident + { + LEX *lex=Lex; + if (!(lex->name= (char *)$2)) + YYABORT; + } + ; create3: /* empty */ {} @@ -900,6 +912,22 @@ opt_as: /* empty */ {} | AS {}; +opt_create_database_options: + /* empty */ {} + | create_database_options {}; + +create_database_options: + create_database_option {} + | create_database_options create_database_option {}; + +create_database_option: + COLLATE_SYM collation_name_or_default + { Lex->create_info.table_charset=$2; } + | opt_default CHAR_SYM SET charset_name_or_default + { Lex->create_info.table_charset=$4; } + | opt_default CHARSET charset_name_or_default + { Lex->create_info.table_charset=$3; }; + opt_table_options: /* empty */ { $$= 0; } | table_options { $$= $1;}; @@ -967,6 +995,11 @@ create_table_option: Lex->create_info.table_charset= $5; Lex->create_info.used_fields|= HA_CREATE_USED_CHARSET; } + | COLLATE_SYM opt_equal collation_name_or_default + { + Lex->create_info.table_charset= $3; + Lex->create_info.used_fields|= HA_CREATE_USED_CHARSET; + } | INSERT_METHOD opt_equal merge_insert_types { Lex->create_info.merge_insert_method= $3; Lex->create_info.used_fields|= HA_CREATE_USED_INSERT_METHOD;} | DATA_SYM DIRECTORY_SYM opt_equal TEXT_STRING { Lex->create_info.data_file_name= $4.str; } | INDEX DIRECTORY_SYM opt_equal TEXT_STRING { Lex->create_info.index_file_name= $4.str; }; @@ -997,6 +1030,7 @@ merge_insert_types: opt_select_from: opt_limit_clause {} + | FROM DUAL_SYM {} | select_from select_lock_type; udf_func_type: @@ -1223,19 +1257,26 @@ attribute: | opt_primary KEY_SYM { Lex->type|= PRI_KEY_FLAG | NOT_NULL_FLAG; } | UNIQUE_SYM { Lex->type|= UNIQUE_FLAG; } | UNIQUE_SYM KEY_SYM { Lex->type|= UNIQUE_KEY_FLAG; } - | COMMENT_SYM text_literal { Lex->comment= $2; }; + | COMMENT_SYM text_literal { Lex->comment= $2; } + | COLLATE_SYM collation_name { Lex->charset=$2; }; charset_name: - BINARY + ident { - if (!($$=get_charset_by_name("binary",MYF(0)))) + if (!($$=get_charset_by_csname($1.str,MYF(0)))) { - net_printf(YYTHD,ER_UNKNOWN_CHARACTER_SET,"binary"); + net_printf(YYTHD,ER_UNKNOWN_CHARACTER_SET,$1.str); YYABORT; } - } - | ident + }; + +charset_name_or_default: + charset_name { $$=$1; } + | DEFAULT { $$=NULL; } ; + +collation_name: + ident { if (!($$=get_charset_by_name($1.str,MYF(0)))) { @@ -1244,19 +1285,14 @@ charset_name: } }; -charset_name_or_default: - charset_name { $$=$1; } +collation_name_or_default: + collation_name { $$=$1; } | DEFAULT { $$=NULL; } ; opt_default: /* empty */ {} | DEFAULT {}; -opt_db_default_character_set: - /* empty */ { $$=default_charset_info; } - | opt_default CHAR_SYM SET charset_name_or_default { $$=$4; } - | opt_default CHARSET charset_name_or_default { $$=$3; }; - opt_binary: /* empty */ { Lex->charset=NULL; } | ASCII_SYM { Lex->charset=my_charset_latin1; } @@ -1270,7 +1306,6 @@ opt_binary: YYABORT; } } - | COLLATE_SYM charset_name { Lex->charset=$2; } | CHAR_SYM SET charset_name { Lex->charset=$3; } ; opt_primary: @@ -1347,7 +1382,8 @@ opt_unique_or_fulltext: key_alg: /* empty */ { $$= HA_KEY_ALG_UNDEF; } - | USING opt_btree_or_rtree { $$= $2; }; + | USING opt_btree_or_rtree { $$= $2; } + | TYPE_SYM opt_btree_or_rtree { $$= $2; }; opt_btree_or_rtree: BTREE_SYM { $$= HA_KEY_ALG_BTREE; } @@ -1381,7 +1417,8 @@ alter: LEX *lex=&thd->lex; lex->sql_command = SQLCOM_ALTER_TABLE; lex->name=0; - if (!lex->select_lex.add_table_to_list(thd, $4, NULL,1)) + if (!lex->select_lex.add_table_to_list(thd, $4, NULL, + TL_OPTION_UPDATING)) YYABORT; lex->drop_primary=0; lex->create_list.empty(); @@ -1400,12 +1437,11 @@ alter: } alter_list {} - | ALTER DATABASE ident opt_db_default_character_set + | ALTER DATABASE ident opt_create_database_options { LEX *lex=Lex; lex->sql_command=SQLCOM_ALTER_DB; lex->name=$3.str; - lex->create_info.table_charset=$4; }; @@ -1648,8 +1684,10 @@ table_to_table: { LEX *lex=Lex; SELECT_LEX_NODE *sl= lex->current_select; - if (!sl->add_table_to_list(lex->thd, $1,NULL,1,TL_IGNORE) || - !sl->add_table_to_list(lex->thd, $3,NULL,1,TL_IGNORE)) + if (!sl->add_table_to_list(lex->thd, $1,NULL,TL_OPTION_UPDATING, + TL_IGNORE) || + !sl->add_table_to_list(lex->thd, $3,NULL,TL_OPTION_UPDATING, + TL_IGNORE)) YYABORT; }; @@ -1668,12 +1706,17 @@ select_init: '(' SELECT_SYM select_part2 ')' { LEX *lex= Lex; - SELECT_LEX_NODE * sel= lex->current_select; + SELECT_LEX * sel= lex->current_select->select_lex(); if (sel->set_braces(1)) { send_error(lex->thd, ER_SYNTAX_ERROR); YYABORT; } + if (sel->linkage == UNION_TYPE && !sel->master_unit()->first_select()->braces) + { + send_error(lex->thd, ER_SYNTAX_ERROR); + YYABORT; + } /* select in braces, can't contain global parameters */ sel->master_unit()->global_parameters= sel->master_unit(); @@ -1683,11 +1726,17 @@ select_init2: select_part2 { LEX *lex= Lex; + SELECT_LEX * sel= lex->current_select->select_lex(); if (lex->current_select->set_braces(0)) { send_error(lex->thd, ER_SYNTAX_ERROR); YYABORT; } + if (sel->linkage == UNION_TYPE && sel->master_unit()->first_select()->braces) + { + send_error(lex->thd, ER_SYNTAX_ERROR); + YYABORT; + } } union_clause ; @@ -1695,6 +1744,7 @@ select_init2: select_part2: { LEX *lex=Lex; + SELECT_LEX * sel= lex->current_select->select_lex(); if (lex->current_select == &lex->select_lex) lex->lock_option= TL_READ; /* Only for global SELECT */ mysql_init_select(lex); @@ -1880,7 +1930,7 @@ expr_expr: { $$= new Item_date_add_interval($1,$4,$5,0); } | expr '-' INTERVAL_SYM expr interval { $$= new Item_date_add_interval($1,$4,$5,1); } - | expr COLLATE_SYM charset_name + | expr COLLATE_SYM collation_name { $$= new Item_func_set_collation($1,$3); }; /* expressions that begin with 'expr' that do NOT follow IN_SYM */ @@ -2017,7 +2067,7 @@ simple_expr: $$= new Item_row(*$5); } | EXISTS exists_subselect { $$= $2; } - | singleval_subselect { $$= $1; } + | singlerow_subselect { $$= $1; } | '{' ident expr '}' { $$= $3; } | MATCH ident_list_arg AGAINST '(' expr ')' { Select->add_ftfunc_to_list((Item_func_match *) @@ -2201,9 +2251,9 @@ simple_expr: | NOW_SYM '(' expr ')' { $$= new Item_func_now($3); Lex->safe_to_cache_query=0;} | PASSWORD '(' expr ')' - { - $$= new Item_func_password($3); - } + { $$= new Item_func_password($3); } + | PASSWORD '(' expr ',' expr ')' + { $$= new Item_func_password($3,$5); } | POINTFROMTEXT '(' expr ')' { $$= new Item_func_geometry_from_text($3); } | POINTFROMTEXT '(' expr ',' expr ')' @@ -2489,12 +2539,14 @@ join_table: { SELECT_LEX *sel= Select->select_lex(); sel->use_index_ptr=sel->ignore_index_ptr=0; + sel->table_join_options= 0; } table_ident opt_table_alias opt_key_definition { LEX *lex= Lex; SELECT_LEX_NODE *sel= lex->current_select; - if (!($$= sel->add_table_to_list(lex->thd, $2, $3, 0, + if (!($$= sel->add_table_to_list(lex->thd, $2, $3, + sel->get_table_join_options(), lex->lock_option, sel->get_use_index(), sel->get_ignore_index()))) @@ -2509,7 +2561,9 @@ join_table: lex->current_select= unit->outer_select(); if (!($$= lex->current_select-> add_table_to_list(lex->thd, new Table_ident(unit), $5, 0, - lex->lock_option))) + TL_READ,(List<String> *)0, + (List<String> *)0))) + YYABORT; }; @@ -2538,6 +2592,13 @@ opt_key_definition: sel->use_index= *$2; sel->use_index_ptr= &sel->use_index; } + | FORCE_SYM key_usage_list + { + SELECT_LEX *sel= Select->select_lex(); + sel->use_index= *$2; + sel->use_index_ptr= &sel->use_index; + sel->table_join_options|= TL_OPTION_FORCE_INDEX; + } | IGNORE_SYM key_usage_list { SELECT_LEX *sel= Select->select_lex(); @@ -2547,8 +2608,14 @@ opt_key_definition: key_usage_list: key_or_index { Select->select_lex()->interval_list.empty(); } - '(' key_usage_list2 ')' - { $$= &Select->select_lex()->interval_list; }; + '(' key_list_or_empty ')' + { $$= &Select->select_lex()->interval_list; } + ; + +key_list_or_empty: + /* empty */ {} + | key_usage_list2 {} + ; key_usage_list2: key_usage_list2 ',' ident @@ -2909,7 +2976,8 @@ drop: lex->drop_list.empty(); lex->drop_list.push_back(new Alter_drop(Alter_drop::KEY, $3.str)); - if (!lex->current_select->add_table_to_list(lex->thd, $5,NULL, 1)) + if (!lex->current_select->add_table_to_list(lex->thd, $5, NULL, + TL_OPTION_UPDATING)) YYABORT; } | DROP DATABASE if_exists ident @@ -2933,7 +3001,11 @@ table_list: table_name: table_ident - { if (!Select->add_table_to_list(YYTHD, $1, NULL, 1)) YYABORT; }; + { + if (!Select->add_table_to_list(YYTHD, $1, NULL, TL_OPTION_UPDATING)) + YYABORT; + } + ; if_exists: /* empty */ { $$= 0; } @@ -3168,7 +3240,8 @@ delete: single_multi: FROM table_ident { - if (!Select->add_table_to_list(YYTHD, $2, NULL, 1, Lex->lock_option)) + if (!Select->add_table_to_list(YYTHD, $2, NULL, TL_OPTION_UPDATING, + Lex->lock_option)) YYABORT; } where_clause opt_order_clause @@ -3187,16 +3260,17 @@ table_wild_list: | table_wild_list ',' table_wild_one {}; table_wild_one: - ident opt_wild + ident opt_wild opt_table_alias { - if (!Select->add_table_to_list(YYTHD, new Table_ident($1), NULL, 1, - Lex->lock_option)) + if (!Select->add_table_to_list(YYTHD, new Table_ident($1), $3, + TL_OPTION_UPDATING, Lex->lock_option)) YYABORT; } - | ident '.' ident opt_wild + | ident '.' ident opt_wild opt_table_alias { if (!Select->add_table_to_list(YYTHD, new Table_ident($1, $3, 0), - NULL, 1, Lex->lock_option)) + $5, TL_OPTION_UPDATING, + Lex->lock_option)) YYABORT; } ; @@ -3360,7 +3434,7 @@ show_param: | CREATE TABLE_SYM table_ident { Lex->sql_command = SQLCOM_SHOW_CREATE; - if(!Select->add_table_to_list(YYTHD, $3, NULL,0)) + if (!Select->add_table_to_list(YYTHD, $3, NULL,0)) YYABORT; } | MASTER_SYM STATUS_SYM @@ -3529,14 +3603,14 @@ load: LOAD DATA_SYM load_data_lock opt_local INFILE TEXT_STRING opt_duplicate INTO TABLE_SYM table_ident opt_field_term opt_line_term opt_ignore_lines opt_field_spec { - if (!Select->add_table_to_list(YYTHD, $11, NULL, 1)) + if (!Select->add_table_to_list(YYTHD, $11, NULL, TL_OPTION_UPDATING)) YYABORT; } | LOAD TABLE_SYM table_ident FROM MASTER_SYM { Lex->sql_command = SQLCOM_LOAD_MASTER_TABLE; - if (!Select->add_table_to_list(YYTHD, $3, NULL, 1)) + if (!Select->add_table_to_list(YYTHD, $3, NULL, TL_OPTION_UPDATING)) YYABORT; } @@ -3666,17 +3740,41 @@ simple_ident: } | ident '.' ident { - SELECT_LEX_NODE *sel=Select; + THD *thd= YYTHD; + LEX *lex= &thd->lex; + SELECT_LEX_NODE *sel= lex->current_select; + if (sel->no_table_names_allowed) + { + my_printf_error(ER_TABLENAME_NOT_ALLOWED_HERE, + ER(ER_TABLENAME_NOT_ALLOWED_HERE), + MYF(0), $1.str, thd->where); + } $$ = !sel->create_refs || sel->get_in_sum_expr() > 0 ? (Item*) new Item_field(NullS,$1.str,$3.str) : (Item*) new Item_ref(NullS,$1.str,$3.str); } | '.' ident '.' ident { - SELECT_LEX_NODE *sel=Select; + THD *thd= YYTHD; + LEX *lex= &thd->lex; + SELECT_LEX_NODE *sel= lex->current_select; + if (sel->no_table_names_allowed) + { + my_printf_error(ER_TABLENAME_NOT_ALLOWED_HERE, + ER(ER_TABLENAME_NOT_ALLOWED_HERE), + MYF(0), $2.str, thd->where); + } $$ = !sel->create_refs || sel->get_in_sum_expr() > 0 ? (Item*) new Item_field(NullS,$2.str,$4.str) : (Item*) new Item_ref(NullS,$2.str,$4.str); } | ident '.' ident '.' ident { - SELECT_LEX_NODE *sel=Select; + THD *thd= YYTHD; + LEX *lex= &thd->lex; + SELECT_LEX_NODE *sel= lex->current_select; + if (sel->no_table_names_allowed) + { + my_printf_error(ER_TABLENAME_NOT_ALLOWED_HERE, + ER(ER_TABLENAME_NOT_ALLOWED_HERE), + MYF(0), $3.str, thd->where); + } $$ = !sel->create_refs || sel->get_in_sum_expr() > 0 ? (Item*) new Item_field((YYTHD->client_capabilities & CLIENT_NO_SCHEMA ? NullS :$1.str),$3.str,$5.str) : (Item*) new Item_ref((YYTHD->client_capabilities & CLIENT_NO_SCHEMA ? NullS :$1.str),$3.str,$5.str); }; @@ -4461,7 +4559,8 @@ optional_order_or_limit: /* Empty */ {} | { - LEX *lex=Lex; + THD *thd= YYTHD; + LEX *lex= &thd->lex; if (!lex->current_select->linkage == GLOBAL_OPTIONS_TYPE) { send_error(lex->thd, ER_SYNTAX_ERROR); @@ -4473,8 +4572,15 @@ optional_order_or_limit: lex->current_select= sel->master_unit(); lex->current_select->select_limit= lex->thd->variables.select_limit; + lex->current_select->no_table_names_allowed= 1; + thd->where= "global ORDER clause"; } order_or_limit + { + THD *thd= YYTHD; + thd->lex.current_select->no_table_names_allowed= 0; + thd->where= ""; + } ; order_or_limit: @@ -4487,17 +4593,17 @@ union_option: /* empty */ {} | ALL {Select->master_unit()->union_option= 1;}; -singleval_subselect: - subselect_start singleval_subselect_init +singlerow_subselect: + subselect_start singlerow_subselect_init subselect_end { $$= $2; }; -singleval_subselect_init: +singlerow_subselect_init: select_init2 { - $$= new Item_singleval_subselect(YYTHD, + $$= new Item_singlerow_subselect(YYTHD, Lex->current_select->master_unit()-> first_select()); }; diff --git a/sql/stacktrace.c b/sql/stacktrace.c index f5c0a59b572..762c45e7184 100644 --- a/sql/stacktrace.c +++ b/sql/stacktrace.c @@ -38,7 +38,7 @@ void safe_print_str(const char* name, const char* val, int max_len) } fprintf(stderr, "= "); - for(; max_len && PTR_SANE(val) && *val; --max_len) + for (; max_len && PTR_SANE(val) && *val; --max_len) fputc(*val++, stderr); fputc('\n', stderr); } @@ -59,7 +59,7 @@ void safe_print_str(const char* name, const char* val, int max_len) inline uchar** find_prev_fp(uint32* pc, uchar** fp) { int i; - for(i = 0; i < MAX_INSTR_IN_FUNC; ++i,--pc) + for (i = 0; i < MAX_INSTR_IN_FUNC; ++i,--pc) { uchar* p = (uchar*)pc; if (p[2] == 222 && p[3] == 35) @@ -73,7 +73,7 @@ inline uchar** find_prev_fp(uint32* pc, uchar** fp) inline uint32* find_prev_pc(uint32* pc, uchar** fp) { int i; - for(i = 0; i < MAX_INSTR_IN_FUNC; ++i,--pc) + for (i = 0; i < MAX_INSTR_IN_FUNC; ++i,--pc) { char* p = (char*)pc; if (p[1] == 0 && p[2] == 94 && p[3] == -73) diff --git a/sql/structs.h b/sql/structs.h index 604be6fcc6e..59b9335a5c4 100644 --- a/sql/structs.h +++ b/sql/structs.h @@ -130,7 +130,7 @@ enum SHOW_TYPE SHOW_UNDEF, SHOW_LONG, SHOW_LONGLONG, SHOW_INT, SHOW_CHAR, SHOW_CHAR_PTR, SHOW_BOOL, SHOW_MY_BOOL, SHOW_OPENTABLES, SHOW_STARTTIME, SHOW_QUESTION, - SHOW_LONG_CONST, SHOW_INT_CONST, SHOW_HAVE, SHOW_SYS, + SHOW_LONG_CONST, SHOW_INT_CONST, SHOW_HAVE, SHOW_SYS, SHOW_HA_ROWS, #ifdef HAVE_OPENSSL SHOW_SSL_CTX_SESS_ACCEPT, SHOW_SSL_CTX_SESS_ACCEPT_GOOD, SHOW_SSL_GET_VERSION, SHOW_SSL_CTX_GET_SESSION_CACHE_MODE, diff --git a/sql/table.cc b/sql/table.cc index 84a072c886d..72f0143115f 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -146,7 +146,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, bzero((char*) keyinfo,n_length); outparam->key_info=keyinfo; outparam->max_key_length= outparam->total_key_length= 0; - key_part= (KEY_PART_INFO*) (keyinfo+keys); + key_part= my_reinterpret_cast(KEY_PART_INFO*) (keyinfo+keys); strpos=disk_buff+6; ulong *rec_per_key; diff --git a/sql/table.h b/sql/table.h index d24e4e1e422..6291b250787 100644 --- a/sql/table.h +++ b/sql/table.h @@ -91,6 +91,7 @@ struct st_table { my_bool copy_blobs; /* copy_blobs when storing */ my_bool null_row; /* All columns are null */ my_bool maybe_null,outer_join; /* Used with OUTER JOIN */ + my_bool force_index; my_bool distinct,const_table,no_rows; my_bool key_read, bulk_insert; my_bool crypted; @@ -168,6 +169,7 @@ typedef struct st_table_list bool straight; /* optimize with prev table */ bool updating; /* for replicate-do/ignore table */ bool do_redirect; /* To get the struct in UNION's */ + bool force_index; /* Prefer index over table scan */ } TABLE_LIST; typedef struct st_changed_table_list diff --git a/strings/Makefile.am b/strings/Makefile.am index ac0b6d7f1e0..dea9effdfeb 100644 --- a/strings/Makefile.am +++ b/strings/Makefile.am @@ -22,19 +22,19 @@ pkglib_LIBRARIES = libmystrings.a # Exact one of ASSEMBLER_X if ASSEMBLER_x86 ASRCS = strings-x86.s longlong2str-x86.s -CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-latin1_de.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype-bin.c +CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-latin1_de.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype-bin.c my_vsnprintf.c xml.c else if ASSEMBLER_sparc32 # These file MUST all be on the same line!! Otherwise automake # generats a very broken makefile ASRCS = bmove_upp-sparc.s strappend-sparc.s strend-sparc.s strinstr-sparc.s strmake-sparc.s strmov-sparc.s strnmov-sparc.s strstr-sparc.s -CSRCS = strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c strxmov.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-latin1_de.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype-bin.c +CSRCS = strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c strxmov.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-latin1_de.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype-bin.c my_vsnprintf.c xml.c else #no assembler ASRCS = # These file MUST all be on the same line!! Otherwise automake # generats a very broken makefile -CSRCS = strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend.c is_prefix.c strstr.c strinstr.c strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-latin1_de.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype-bin.c +CSRCS = strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend.c is_prefix.c strstr.c strinstr.c strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-latin1_de.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype-bin.c my_vsnprintf.c xml.c endif endif @@ -44,7 +44,7 @@ noinst_PROGRAMS = conf_to_src EXTRA_DIST = ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-win1250ch.c \ ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-utf8.c \ ctype-tis620.c ctype-ujis.c ctype-latin1_de.c \ - strto.c strings-x86.s \ + xml.c strto.c strings-x86.s \ longlong2str.c longlong2str-x86.s \ strxmov.c bmove_upp.c strappend.c strcont.c strend.c \ strfill.c strcend.c is_prefix.c strstr.c strinstr.c \ diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c index 573c3c67db0..408c7f8fe35 100644 --- a/strings/ctype-big5.c +++ b/strings/ctype-big5.c @@ -6218,7 +6218,8 @@ my_mb_wc_big5(CHARSET_INFO *cs __attribute__((unused)), CHARSET_INFO my_charset_big5 = { 1, /* number */ - MY_CS_COMPILED, /* state */ + MY_CS_COMPILED|MY_CS_PRIMARY, /* state */ + "big5", /* cs name */ "big5", /* name */ "", /* comment */ ctype_big5, diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c index 7848862a0db..e20afff1470 100644 --- a/strings/ctype-bin.c +++ b/strings/ctype-bin.c @@ -47,8 +47,8 @@ static int my_strnncoll_binary(CHARSET_INFO * cs __attribute__((unused)), const uchar *s, uint slen, const uchar *t, uint tlen) { - int len = ( slen > tlen ) ? tlen : slen; - return memcmp(s,t,len); + int cmp= memcmp(s,t,min(slen,tlen)); + return cmp ? cmp : (int) (slen - tlen); } static void my_caseup_str_bin(CHARSET_INFO *cs __attribute__((unused)), @@ -259,7 +259,8 @@ static int my_wildcmp_bin(CHARSET_INFO *cs, static CHARSET_INFO my_charset_bin_st = { 63, /* number */ - MY_CS_COMPILED|MY_CS_BINSORT,/* state */ + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_PRIMARY,/* state */ + "binary", /* cs name */ "binary", /* name */ "", /* comment */ ctype_bin, /* ctype */ diff --git a/strings/ctype-czech.c b/strings/ctype-czech.c index d309ddc80c8..bb0afe98032 100644 --- a/strings/ctype-czech.c +++ b/strings/ctype-czech.c @@ -597,6 +597,7 @@ CHARSET_INFO my_charset_czech = { 2, /* number */ MY_CS_COMPILED, /* state */ + "latin2", /* cs name */ "czech", /* name */ "", /* comment */ ctype_czech, diff --git a/strings/ctype-euc_kr.c b/strings/ctype-euc_kr.c index 2fe8db85369..814f43166c4 100644 --- a/strings/ctype-euc_kr.c +++ b/strings/ctype-euc_kr.c @@ -8636,8 +8636,9 @@ my_mb_wc_euc_kr(CHARSET_INFO *cs __attribute__((unused)), CHARSET_INFO my_charset_euc_kr = { 19, /* number */ - MY_CS_COMPILED, /* state */ - "euc_kr", /* name */ + MY_CS_COMPILED|MY_CS_PRIMARY, /* state */ + "euckr", /* cs name */ + "euckr", /* name */ "", /* comment */ ctype_euc_kr, to_lower_euc_kr, diff --git a/strings/ctype-gb2312.c b/strings/ctype-gb2312.c index c06b70011df..d575e48a59a 100644 --- a/strings/ctype-gb2312.c +++ b/strings/ctype-gb2312.c @@ -5686,7 +5686,8 @@ my_mb_wc_gb2312(CHARSET_INFO *cs __attribute__((unused)), CHARSET_INFO my_charset_gb2312 = { 24, /* number */ - MY_CS_COMPILED, /* state */ + MY_CS_COMPILED|MY_CS_PRIMARY, /* state */ + "gb2312", /* cs name */ "gb2312", /* name */ "", /* comment */ ctype_gb2312, diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c index 82a75188c24..0094a93e5f8 100644 --- a/strings/ctype-gbk.c +++ b/strings/ctype-gbk.c @@ -9873,7 +9873,8 @@ my_mb_wc_gbk(CHARSET_INFO *cs __attribute__((unused)), CHARSET_INFO my_charset_gbk = { 28, /* number */ - MY_CS_COMPILED, /* state */ + MY_CS_COMPILED|MY_CS_PRIMARY, /* state */ + "gbk", /* cs name */ "gbk", /* name */ "", /* comment */ ctype_gbk, diff --git a/strings/ctype-latin1_de.c b/strings/ctype-latin1_de.c index 49acd3fa8a8..166e059ef42 100644 --- a/strings/ctype-latin1_de.c +++ b/strings/ctype-latin1_de.c @@ -415,6 +415,7 @@ CHARSET_INFO my_charset_latin1_de = { 31, /* number */ MY_CS_COMPILED, /* state */ + "latin1", /* cs name */ "latin1_de", /* name */ "", /* comment */ ctype_latin1_de, diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c index 092b7aa4f0f..5b963e74db9 100644 --- a/strings/ctype-mb.c +++ b/strings/ctype-mb.c @@ -201,7 +201,7 @@ int my_wildcmp_mb(CHARSET_INFO *cs, { // Found w_many uchar cmp; const char* mb = wildstr; - int mblen; + int mblen=0; wildstr++; /* Remove any '%' and '_' from the wild search string */ diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c index fa1ece20b3e..9bcafa9f164 100644 --- a/strings/ctype-simple.c +++ b/strings/ctype-simple.c @@ -110,88 +110,40 @@ int my_mb_wc_8bit(CHARSET_INFO *cs,my_wc_t *wc, } int my_wc_mb_8bit(CHARSET_INFO *cs,my_wc_t wc, - unsigned char *s, - unsigned char *e __attribute__((unused))) + unsigned char *str, + unsigned char *end __attribute__((unused))) { MY_UNI_IDX *idx; - for(idx=cs->tab_from_uni; idx->tab ; idx++){ - if(idx->from<=wc && idx->to>=wc){ - s[0]=idx->tab[wc-idx->from]; - return (!s[0] && wc) ? MY_CS_ILUNI : 1; + for (idx=cs->tab_from_uni; idx->tab ; idx++) + { + if (idx->from <= wc && idx->to >= wc) + { + str[0]= idx->tab[wc - idx->from]; + return (!str[0] && wc) ? MY_CS_ILUNI : 1; } } return MY_CS_ILUNI; } -#ifdef NOT_USED -static int my_vsnprintf_8bit(char *to, size_t n, const char* fmt, va_list ap) -{ - char *start=to, *end=to+n-1; - for (; *fmt ; fmt++) - { - if (fmt[0] != '%') - { - if (to == end) /* End of buffer */ - break; - *to++= *fmt; /* Copy ordinary char */ - continue; - } - /* Skip if max size is used (to be compatible with printf) */ - fmt++; - while (my_isdigit(system_charset_info,*fmt) || *fmt == '.' || *fmt == '-') - fmt++; - if (*fmt == 'l') - fmt++; - if (*fmt == 's') /* String parameter */ - { - reg2 char *par = va_arg(ap, char *); - uint plen,left_len = (uint)(end-to); - if (!par) par = (char*)"(null)"; - plen = (uint) strlen(par); - if (left_len <= plen) - plen = left_len - 1; - to=strnmov(to,par,plen); - continue; - } - else if (*fmt == 'd' || *fmt == 'u') /* Integer parameter */ - { - register int iarg; - if ((uint) (end-to) < 16) - break; - iarg = va_arg(ap, int); - if (*fmt == 'd') - to=int10_to_str((long) iarg,to, -10); - else - to=int10_to_str((long) (uint) iarg,to,10); - continue; - } - /* We come here on '%%', unknown code or too long parameter */ - if (to == end) - break; - *to++='%'; /* % used as % or unknown code */ - } - DBUG_ASSERT(to <= end); - *to='\0'; /* End of errmessage */ - return (uint) (to - start); -} -#endif +/* + We can't use vsprintf here as it's not guaranteed to return + the length on all operating systems. + This function is also not called in a safe environment, so the + end buffer must be checked. +*/ int my_snprintf_8bit(CHARSET_INFO *cs __attribute__((unused)), char* to, uint n __attribute__((unused)), const char* fmt, ...) { va_list args; + int result; va_start(args,fmt); -#ifdef NOT_USED - return my_vsnprintf_8bit(to, n, fmt, args); -#endif - /* - FIXME: generally not safe, but it is OK for now - FIXME: as far as it's not called unsafely in the current code - */ - return vsprintf(to,fmt,args); /* FIXME */ + result= my_vsnprintf(to, n, fmt, args); + va_end(args); + return result; } @@ -432,7 +384,7 @@ ulong my_strntoul_8bit(CHARSET_INFO *cs, c -= '0'; else if (c>='A' && c<='F') c = c - 'A' + 10; - else if (c>='a' && c<='a') + else if (c>='a' && c<='f') c = c - 'a' + 10; else break; @@ -690,28 +642,48 @@ noconv: return 0L; } -double my_strntod_8bit(CHARSET_INFO *cs __attribute__((unused)), - const char *s, uint l, char **e) +/* + Read double from string + + SYNOPSIS: + my_strntod_8bit() + cs Character set information + str String to convert to double + length Optional length for string. + end pointer to end of converted string + + NOTES: + If length is not INT_MAX32 or str[length] != 0 then the given str must + be writeable + If length == INT_MAX32 the str must be \0 terminated. + + It's implemented this way to save a buffer allocation and a memory copy. + + RETURN + value of number in string +*/ + + +double my_strntod_8bit(CHARSET_INFO *cs __attribute__((unused)), + char *str, uint length, char **end) { - char buf[256]; - double res; - if((l+1)>sizeof(buf)) - { - if (e) - memcpy(*e,s,sizeof(s)); - return 0; - } - strncpy(buf,s,l); - buf[l]='\0'; - res=strtod(buf,e); - if (e) - memcpy(*e,*e-buf+s,sizeof(s)); - return res; + char end_char; + double result; + + if (length == INT_MAX32 || str[length] == 0) + return strtod(str, end); + end_char= str[length]; + str[length]= 0; + result= strtod(str, end); + str[length]= end_char; /* Restore end char */ + return result; } /* This is a fast version optimized for the case of radix 10 / -10 + + Assume len >= 1 */ int my_l10tostr_8bit(CHARSET_INFO *cs __attribute__((unused)), @@ -720,18 +692,19 @@ int my_l10tostr_8bit(CHARSET_INFO *cs __attribute__((unused)), char buffer[66]; register char *p, *e; long int new_val; - int sl=0; - uint l; - + uint sign=0; + e = p = &buffer[sizeof(buffer)-1]; - *e='\0'; + *p= 0; if (radix < 0) { if (val < 0) { - sl = 1; - val = -val; + val= -val; + *dst++= '-'; + len--; + sign= 1; } } @@ -746,41 +719,38 @@ int my_l10tostr_8bit(CHARSET_INFO *cs __attribute__((unused)), val= new_val; } - if (sl) - { - *--p='-'; - } - - l=e-p; - l=(l>len)?len:l; - memcpy(dst,p,l); - return (int)l; + len= min(len, (uint) (e-p)); + memcpy(dst, p, len); + return (int) len+sign; } + int my_ll10tostr_8bit(CHARSET_INFO *cs __attribute__((unused)), char *dst, uint len, int radix, longlong val) { char buffer[65]; register char *p, *e; long long_val; - int sl=0; - uint l; + uint sign= 0; if (radix < 0) { if (val < 0) { - sl=1; val = -val; + *dst++= '-'; + len--; + sign= 1; } } e = p = &buffer[sizeof(buffer)-1]; - *p='\0'; + *p= 0; if (val == 0) { - *--p='0'; + *--p= '0'; + len= 1; goto cnv; } @@ -800,16 +770,10 @@ int my_ll10tostr_8bit(CHARSET_INFO *cs __attribute__((unused)), long_val= quo; } + len= min(len, (uint) (e-p)); cnv: - if (sl) - { - *--p='-'; - } - - l=e-p; - l=(l>len)?len:l; - memcpy(dst,p,l); - return (int)(e-p); + memcpy(dst, p, len); + return len+sign; } diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c index 43db7ebc24a..3949be5e215 100644 --- a/strings/ctype-sjis.c +++ b/strings/ctype-sjis.c @@ -4460,7 +4460,8 @@ my_mb_wc_sjis(CHARSET_INFO *cs __attribute__((unused)), CHARSET_INFO my_charset_sjis = { 13, /* number */ - MY_CS_COMPILED, /* state */ + MY_CS_COMPILED|MY_CS_PRIMARY, /* state */ + "sjis", /* cs name */ "sjis", /* name */ "", /* comment */ ctype_sjis, diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c index 2dae3036426..7168026eea5 100644 --- a/strings/ctype-tis620.c +++ b/strings/ctype-tis620.c @@ -688,7 +688,8 @@ void ThNormalize(uchar* ptr, uint field_length, const uchar* from, uint length) CHARSET_INFO my_charset_tis620 = { 18, /* number */ - MY_CS_COMPILED, /* state */ + MY_CS_COMPILED|MY_CS_PRIMARY, /* state */ + "tis620", /* cs name */ "tis620", /* name */ "", /* comment */ ctype_tis620, diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c index 9d970005c85..0a0024594e4 100644 --- a/strings/ctype-ujis.c +++ b/strings/ctype-ujis.c @@ -8430,7 +8430,8 @@ my_wc_mb_euc_jp(CHARSET_INFO *c,my_wc_t wc, unsigned char *s, unsigned char *e) CHARSET_INFO my_charset_ujis = { 12, /* number */ - MY_CS_COMPILED, /* state */ + MY_CS_COMPILED|MY_CS_PRIMARY, /* state */ + "ujis", /* cs name */ "ujis", /* name */ "", /* comment */ ctype_ujis, diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c index c32592dafec..4f72a4c2334 100644 --- a/strings/ctype-utf8.c +++ b/strings/ctype-utf8.c @@ -1958,7 +1958,8 @@ static int my_mbcharlen_utf8(CHARSET_INFO *cs __attribute__((unused)) , uint c) CHARSET_INFO my_charset_utf8 = { 33, /* number */ - MY_CS_COMPILED, /* state */ + MY_CS_COMPILED|MY_CS_PRIMARY, /* state */ + "utf8", /* cs name */ "utf8", /* name */ "", /* comment */ ctype_utf8, /* ctype */ @@ -2873,37 +2874,31 @@ bs: double my_strntod_ucs2(CHARSET_INFO *cs __attribute__((unused)), - const char *nptr, uint l, char **endptr) + char *nptr, uint length, char **endptr) { char buf[256]; double res; register char *b=buf; register const char *s=nptr; - register const char *e=nptr+l; + register const char *end; my_wc_t wc; int cnv; - if((l+1)>sizeof(buf)) - { - if (endptr) - *endptr=(char*)nptr; - my_errno=ERANGE; - return 0; - } - - while ((cnv=cs->mb_wc(cs,&wc,s,e))>0) + /* Cut too long strings */ + if (length >= sizeof(buf)) + length= sizeof(buf)-1; + end=nptr+length; + + while ((cnv=cs->mb_wc(cs,&wc,s,end)) > 0) { s+=cnv; - if (wc < 128) - { - *b++=wc; - } - else - break; + if (wc > (int) (uchar) 'e' || !wc) + break; /* Can't be part of double */ + *b++=wc; } - *b='\0'; + *b= 0; - res=strtod(buf,endptr); + res=strtod(buf, endptr); if (endptr) *endptr=(char*) (*endptr-buf+nptr); return res; @@ -3024,7 +3019,8 @@ cnv: CHARSET_INFO my_charset_ucs2 = { 35, /* number */ - MY_CS_COMPILED, /* state */ + MY_CS_COMPILED|MY_CS_PRIMARY, /* state */ + "ucs2", /* cs name */ "ucs2", /* name */ "", /* comment */ ctype_ucs2, /* ctype */ diff --git a/strings/ctype-win1250ch.c b/strings/ctype-win1250ch.c index b7a6b21cf4a..358cede442c 100644 --- a/strings/ctype-win1250ch.c +++ b/strings/ctype-win1250ch.c @@ -623,7 +623,8 @@ CHARSET_INFO my_charset_win1250ch = { 34, /* number */ MY_CS_COMPILED, /* state */ - "win1250ch", /* name */ + "cp1250", /* cs name */ + "cp1250_czech", /* name */ "", /* comment */ ctype_win1250ch, to_lower_win1250ch, diff --git a/strings/ctype.c b/strings/ctype.c index 8e7d8ad939c..c2a7e928493 100644 --- a/strings/ctype.c +++ b/strings/ctype.c @@ -16,6 +16,7 @@ #include <my_global.h> #include <m_ctype.h> +#include <my_xml.h> #ifndef SCO #include <m_string.h> #endif @@ -2810,7 +2811,8 @@ static CHARSET_INFO compiled_charsets[] = { #ifdef HAVE_CHARSET_latin1 { 8, /* number */ - MY_CS_COMPILED, /* state */ + MY_CS_COMPILED|MY_CS_PRIMARY, /* state */ + "latin1", /* cs name */ "latin1", /* name */ "", /* comment */ ctype_latin1, @@ -2856,6 +2858,7 @@ static CHARSET_INFO compiled_charsets[] = { { 14, /* number */ MY_CS_COMPILED, /* state */ + "cp1251", /* cs name */ "cp1251", /* name */ "", /* comment */ ctype_cp1251, @@ -2900,6 +2903,7 @@ static CHARSET_INFO compiled_charsets[] = { { 29, /* number */ MY_CS_COMPILED, /* state */ + "cp1257", /* cs name */ "cp1257", /* name */ "", /* comment */ ctype_cp1257, @@ -2944,6 +2948,7 @@ static CHARSET_INFO compiled_charsets[] = { { 27, /* number */ MY_CS_COMPILED, /* state */ + "latin2", /* cs name */ "croat", /* name */ "", /* comment */ ctype_croat, @@ -2989,6 +2994,7 @@ static CHARSET_INFO compiled_charsets[] = { { 15, /* number */ MY_CS_COMPILED, /* state */ + "latin1", /* cs name */ "danish", /* name */ "", /* comment */ ctype_danish, @@ -3033,6 +3039,7 @@ static CHARSET_INFO compiled_charsets[] = { { 3, /* number */ MY_CS_COMPILED, /* state */ + "dec8", /* cs name */ "dec8", /* name */ "", /* comment */ ctype_dec8, @@ -3077,6 +3084,7 @@ static CHARSET_INFO compiled_charsets[] = { { 4, /* number */ MY_CS_COMPILED, /* state */ + "cp850", /* cs name */ "dos", /* name */ "", /* comment */ ctype_dos, @@ -3121,6 +3129,7 @@ static CHARSET_INFO compiled_charsets[] = { { 20, /* number */ MY_CS_COMPILED, /* state */ + "latin7", /* cs name */ "estonia", /* name */ "", /* comment */ ctype_estonia, @@ -3166,6 +3175,7 @@ static CHARSET_INFO compiled_charsets[] = { { 5, /* number */ MY_CS_COMPILED, /* state */ + "latin1", /* cs name */ "german1", /* name */ "", /* comment */ ctype_german1, @@ -3210,6 +3220,7 @@ static CHARSET_INFO compiled_charsets[] = { { 25, /* number */ MY_CS_COMPILED, /* state */ + "greek", /* cs name */ "greek", /* name */ "", /* comment */ ctype_greek, @@ -3254,6 +3265,7 @@ static CHARSET_INFO compiled_charsets[] = { { 16, /* number */ MY_CS_COMPILED, /* state */ + "hebrew", /* cs name */ "hebrew", /* name */ "", /* comment */ ctype_hebrew, @@ -3298,6 +3310,7 @@ static CHARSET_INFO compiled_charsets[] = { { 6, /* number */ MY_CS_COMPILED, /* state */ + "hp8", /* cs name */ "hp8", /* name */ "", /* comment */ ctype_hp8, @@ -3342,6 +3355,7 @@ static CHARSET_INFO compiled_charsets[] = { { 21, /* number */ MY_CS_COMPILED, /* state */ + "latin2", /* cs name */ "hungarian", /* name */ "", /* comment */ ctype_hungarian, @@ -3386,7 +3400,8 @@ static CHARSET_INFO compiled_charsets[] = { { 7, /* number */ MY_CS_COMPILED, /* state */ - "koi8_ru", /* name */ + "koi8r", /* cs name */ + "koi8r", /* name */ "", /* comment */ ctype_koi8_ru, to_lower_koi8_ru, @@ -3430,7 +3445,8 @@ static CHARSET_INFO compiled_charsets[] = { { 22, /* number */ MY_CS_COMPILED, /* state */ - "koi8_ukr", /* name */ + "koi8u", /* cs name */ + "koi8u", /* name */ "", /* comment */ ctype_koi8_ukr, to_lower_koi8_ukr, @@ -3475,6 +3491,7 @@ static CHARSET_INFO compiled_charsets[] = { { 9, /* number */ MY_CS_COMPILED, /* state */ + "latin2", /* cs name */ "latin2", /* name */ "", /* comment */ ctype_latin2, @@ -3519,6 +3536,7 @@ static CHARSET_INFO compiled_charsets[] = { { 30, /* number */ MY_CS_COMPILED, /* state */ + "latin5", /* cs name */ "latin5", /* name */ "", /* comment */ ctype_latin5, @@ -3564,6 +3582,7 @@ static CHARSET_INFO compiled_charsets[] = { { 10, /* number */ MY_CS_COMPILED, /* state */ + "swe7", /* cs name */ "swe7", /* name */ "", /* comment */ ctype_swe7, @@ -3609,7 +3628,8 @@ static CHARSET_INFO compiled_charsets[] = { { 11, /* number */ MY_CS_COMPILED, /* state */ - "usa7", /* name */ + "ascii", /* cs name */ + "ascii", /* name */ "", /* comment */ ctype_usa7, to_lower_usa7, @@ -3653,7 +3673,8 @@ static CHARSET_INFO compiled_charsets[] = { { 26, /* number */ MY_CS_COMPILED, /* state */ - "win1250", /* name */ + "cp1250", /* cs name */ + "cp1250", /* name */ "", /* comment */ ctype_win1250, to_lower_win1250, @@ -3697,6 +3718,7 @@ static CHARSET_INFO compiled_charsets[] = { { 23, /* number */ MY_CS_COMPILED, /* state */ + "cp1251", /* cs name */ "win1251ukr", /* name */ "", /* comment */ ctype_win1251ukr, @@ -3741,6 +3763,7 @@ static CHARSET_INFO compiled_charsets[] = { { 32, /* number */ MY_CS_COMPILED, /* state */ + "armscii8", /* cs name */ "armscii8", /* name */ "", /* comment */ ctype_armscii8, @@ -3785,6 +3808,7 @@ static CHARSET_INFO compiled_charsets[] = { { 17, /* number */ MY_CS_COMPILED, /* state */ + "cp1251", /* cs name */ "win1251", /* name */ "", /* comment */ ctype_win1251, @@ -3828,6 +3852,7 @@ static CHARSET_INFO compiled_charsets[] = { { 0, /* end-of-list marker */ 0, /* state */ + NullS, /* cs name */ NullS, /* name */ NullS, /* comment */ NULL, @@ -3871,6 +3896,228 @@ static CHARSET_INFO compiled_charsets[] = { }; +static char *mstr(char *str,const char *src,uint l1,uint l2) +{ + l1= l1<l2 ? l1 : l2; + memcpy(str,src,l1); + str[l1]='\0'; + return str; +} + + +struct my_cs_file_section_st +{ + int state; + const char *str; +}; + +#define _CS_MISC 1 +#define _CS_ID 2 +#define _CS_CSNAME 3 +#define _CS_FAMILY 4 +#define _CS_ORDER 5 +#define _CS_COLNAME 6 +#define _CS_FLAG 7 +#define _CS_CHARSET 8 +#define _CS_COLLATION 9 +#define _CS_UPPERMAP 10 +#define _CS_LOWERMAP 11 +#define _CS_UNIMAP 12 +#define _CS_COLLMAP 13 +#define _CS_CTYPEMAP 14 + +static struct my_cs_file_section_st sec[] = +{ + {_CS_MISC, "xml"}, + {_CS_MISC, "xml.version"}, + {_CS_MISC, "xml.encoding"}, + {_CS_MISC, "charsets"}, + {_CS_MISC, "charsets.max-id"}, + {_CS_MISC, "charsets.description"}, + {_CS_CHARSET, "charsets.charset"}, + {_CS_CSNAME, "charsets.charset.name"}, + {_CS_FAMILY, "charsets.charset.family"}, + {_CS_MISC, "charsets.charset.alias"}, + {_CS_MISC, "charsets.charset.ctype"}, + {_CS_CTYPEMAP, "charsets.charset.ctype.map"}, + {_CS_MISC, "charsets.charset.upper"}, + {_CS_UPPERMAP, "charsets.charset.upper.map"}, + {_CS_MISC, "charsets.charset.lower"}, + {_CS_LOWERMAP, "charsets.charset.lower.map"}, + {_CS_MISC, "charsets.charset.unicode"}, + {_CS_UNIMAP, "charsets.charset.unicode.map"}, + {_CS_COLLATION, "charsets.charset.collation"}, + {_CS_COLNAME, "charsets.charset.collation.name"}, + {_CS_ID, "charsets.charset.collation.id"}, + {_CS_ORDER, "charsets.charset.collation.order"}, + {_CS_FLAG, "charsets.charset.collation.flag"}, + {_CS_COLLMAP, "charsets.charset.collation.map"}, + {0, NULL} +}; + +static struct my_cs_file_section_st * cs_file_sec(const char *attr, uint len) +{ + struct my_cs_file_section_st *s; + for (s=sec; s->str; s++) + { + if (!strncmp(attr,s->str,len)) + return s; + } + return NULL; +} + +typedef struct my_cs_file_info +{ + char csname[MY_CS_NAME_SIZE]; + char name[MY_CS_NAME_SIZE]; + uchar ctype[MY_CS_CTYPE_TABLE_SIZE]; + uchar to_lower[MY_CS_TO_LOWER_TABLE_SIZE]; + uchar to_upper[MY_CS_TO_UPPER_TABLE_SIZE]; + uchar sort_order[MY_CS_SORT_ORDER_TABLE_SIZE]; + uint16 tab_to_uni[MY_CS_TO_UNI_TABLE_SIZE]; + CHARSET_INFO cs; + int (*add_collation)(CHARSET_INFO *cs); +} MY_CHARSET_LOADER; + + + +static int fill_uchar(uchar *a,uint size,const char *str, uint len) +{ + uint i= 0; + const char *s, *b, *e=str+len; + + for (s=str ; s < e ; i++) + { + for ( ; (s < e) && strchr(" \t\r\n",s[0]); s++) ; + b=s; + for ( ; (s < e) && !strchr(" \t\r\n",s[0]); s++) ; + if (s == b || i > size) + break; + a[i]= my_strntoul(my_charset_latin1,b,s-b,NULL,16); + } + return 0; +} + +static int fill_uint16(uint16 *a,uint size,const char *str, uint len) +{ + uint i= 0; + const char *s, *b, *e=str+len; + for (s=str ; s < e ; i++) + { + for ( ; (s < e) && strchr(" \t\r\n",s[0]); s++) ; + b=s; + for ( ; (s < e) && !strchr(" \t\r\n",s[0]); s++) ; + if (s == b || i > size) + break; + a[i]= my_strntol(my_charset_latin1,b,s-b,NULL,16); + } + return 0; +} + + +static int cs_enter(MY_XML_PARSER *st,const char *attr, uint len) +{ + struct my_cs_file_info *i= (struct my_cs_file_info *)st->user_data; + struct my_cs_file_section_st *s= cs_file_sec(attr,len); + + if ( s && (s->state == _CS_CHARSET)) + { + bzero(&i->cs,sizeof(i->cs)); + } + return MY_XML_OK; +} + + +static int cs_leave(MY_XML_PARSER *st,const char *attr, uint len) +{ + struct my_cs_file_info *i= (struct my_cs_file_info *)st->user_data; + struct my_cs_file_section_st *s= cs_file_sec(attr,len); + int state= s ? s->state : 0; + int rc; + + switch(state){ + case _CS_COLLATION: + rc= i->add_collation ? i->add_collation(&i->cs) : MY_XML_OK; + break; + default: + rc=MY_XML_OK; + } + return rc; +} + + +static int cs_value(MY_XML_PARSER *st,const char *attr, uint len) +{ + struct my_cs_file_info *i= (struct my_cs_file_info *)st->user_data; + struct my_cs_file_section_st *s; + int state= (s=cs_file_sec(st->attr,strlen(st->attr))) ? s->state : 0; + +#ifndef DBUG_OFF + if(0){ + char str[1024]; + mstr(str,attr,len,sizeof(str)-1); + printf("VALUE %d %s='%s'\n",state,st->attr,str); + } +#endif + + switch (state) { + case _CS_ID: + i->cs.number= my_strntoul(my_charset_latin1,attr,len,(char**)NULL,0); + break; + case _CS_COLNAME: + i->cs.name=mstr(i->name,attr,len,MY_CS_NAME_SIZE-1); + break; + case _CS_CSNAME: + i->cs.csname=mstr(i->csname,attr,len,MY_CS_NAME_SIZE-1); + break; + case _CS_FLAG: + if (!strncmp("primary",attr,len)) + i->cs.state|= MY_CS_PRIMARY; + break; + case _CS_UPPERMAP: + fill_uchar(i->to_upper,MY_CS_TO_UPPER_TABLE_SIZE,attr,len); + i->cs.to_upper=i->to_upper; + break; + case _CS_LOWERMAP: + fill_uchar(i->to_lower,MY_CS_TO_LOWER_TABLE_SIZE,attr,len); + i->cs.to_lower=i->to_lower; + break; + case _CS_UNIMAP: + fill_uint16(i->tab_to_uni,MY_CS_TO_UNI_TABLE_SIZE,attr,len); + i->cs.tab_to_uni=i->tab_to_uni; + break; + case _CS_COLLMAP: + fill_uchar(i->sort_order,MY_CS_SORT_ORDER_TABLE_SIZE,attr,len); + i->cs.sort_order=i->sort_order; + break; + case _CS_CTYPEMAP: + fill_uchar(i->ctype,MY_CS_CTYPE_TABLE_SIZE,attr,len); + i->cs.ctype=i->ctype; + break; + } + return MY_XML_OK; +} + + +my_bool my_parse_charset_xml(const char *buf, uint len, + int (*add_collation)(CHARSET_INFO *cs)) +{ + MY_XML_PARSER p; + struct my_cs_file_info i; + my_bool rc; + + my_xml_parser_create(&p); + my_xml_set_enter_handler(&p,cs_enter); + my_xml_set_value_handler(&p,cs_value); + my_xml_set_leave_handler(&p,cs_leave); + i.add_collation= add_collation; + my_xml_set_user_data(&p,(void*)&i); + rc= (my_xml_parse(&p,buf,len) == MY_XML_OK) ? FALSE : TRUE; + my_xml_parser_free(&p); + return rc; +} + + CHARSET_INFO *my_charset_latin1 = &compiled_charsets[0]; CHARSET_INFO *all_charsets[256]; CHARSET_INFO *default_charset_info = &compiled_charsets[0]; diff --git a/mysys/my_vsnprintf.c b/strings/my_vsnprintf.c index 2af5bf8903d..a67523af7bc 100644 --- a/mysys/my_vsnprintf.c +++ b/strings/my_vsnprintf.c @@ -14,23 +14,41 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "mysys_priv.h" -#include "mysys_err.h" +#include <my_global.h> #include <m_string.h> #include <stdarg.h> #include <m_ctype.h> #include <assert.h> +/* + Limited snprintf() implementations + + IMPLEMENTION: + Supports following formats: + %#d + %#u + %#.#s Note #.# is skiped + + RETURN + length of result string +*/ + int my_snprintf(char* to, size_t n, const char* fmt, ...) { va_list args; + int result; va_start(args,fmt); - return my_vsnprintf(to, n, fmt, args); + result= my_vsnprintf(to, n, fmt, args); + va_end(args); + return result; } + int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) { char *start=to, *end=to+n-1; + uint length, num_state, pre_zero; + for (; *fmt ; fmt++) { if (fmt[0] != '%') @@ -40,10 +58,27 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) *to++= *fmt; /* Copy ordinary char */ continue; } - /* Skip if max size is used (to be compatible with printf) */ - fmt++; - while (my_isdigit(system_charset_info,*fmt) || *fmt == '.' || *fmt == '-') + fmt++; /* skip '%' */ + /* Read max fill size (only used with %d and %u) */ + if (*fmt == '-') fmt++; + length= num_state= pre_zero= 0; + for (;; fmt++) + { + if (my_isdigit(system_charset_info,*fmt)) + { + if (!num_state) + { + length=length*10+ (uint) (*fmt-'0'); + if (!length) + pre_zero= 1; /* first digit was 0 */ + } + continue; + } + if (*fmt != '.' || num_state) + break; + num_state= 1; + } if (*fmt == 'l') fmt++; if (*fmt == 's') /* String parameter */ @@ -60,13 +95,26 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) else if (*fmt == 'd' || *fmt == 'u') /* Integer parameter */ { register int iarg; - if ((uint) (end-to) < 16) + char *to_start= to; + if ((uint) (end-to) < max(16,length)) break; iarg = va_arg(ap, int); if (*fmt == 'd') to=int10_to_str((long) iarg,to, -10); else to=int10_to_str((long) (uint) iarg,to,10); + /* If %#d syntax was used, we have to pre-zero/pre-space the string */ + if (length) + { + uint res_length= (uint) (to - to_start); + if (res_length < length) + { + uint diff= (length- res_length); + bmove_upp(to+diff, to, res_length); + bfill(to-res_length, diff, pre_zero ? '0' : ' '); + to+= diff; + } + } continue; } /* We come here on '%%', unknown code or too long parameter */ diff --git a/strings/xml.c b/strings/xml.c new file mode 100644 index 00000000000..4f6301249ae --- /dev/null +++ b/strings/xml.c @@ -0,0 +1,374 @@ +/* Copyright (C) 2000 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "my_global.h" +#include "m_string.h" +#include "my_xml.h" + + +#define MY_XML_EOF 'E' +#define MY_XML_STRING 'S' +#define MY_XML_IDENT 'I' +#define MY_XML_EQ '=' +#define MY_XML_LT '<' +#define MY_XML_GT '>' +#define MY_XML_SLASH '/' +#define MY_XML_COMMENT 'C' +#define MY_XML_TEXT 'T' +#define MY_XML_QUESTION '?' +#define MY_XML_EXCLAM '!' + +typedef struct xml_attr_st +{ + const char *beg; + const char *end; +} MY_XML_ATTR; + +static const char *lex2str(int lex) +{ + switch(lex) + { + case MY_XML_EOF: return "EOF"; + case MY_XML_STRING: return "STRING"; + case MY_XML_IDENT: return "IDENT"; + case MY_XML_EQ: return "'='"; + case MY_XML_LT: return "'<'"; + case MY_XML_GT: return "'>'"; + case MY_XML_SLASH: return "'/'"; + case MY_XML_COMMENT: return "COMMENT"; + case MY_XML_TEXT: return "TEXT"; + case MY_XML_QUESTION: return "'?'"; + case MY_XML_EXCLAM: return "'!'"; + } + return "UNKNOWN"; +} + +static void my_xml_norm_text(MY_XML_ATTR *a) +{ + for ( ; (a->beg < a->end) && strchr(" \t\r\n",a->beg[0]) ; a->beg++ ); + for ( ; (a->beg < a->end) && strchr(" \t\r\n",a->end[-1]) ; a->end-- ); +} + + +static int my_xml_scan(MY_XML_PARSER *p,MY_XML_ATTR *a) +{ + int lex; + + for( ; ( p->cur < p->end) && strchr(" \t\r\n",p->cur[0]) ; p->cur++); + + if (p->cur >= p->end) + { + a->beg=p->end; + a->end=p->end; + lex=MY_XML_EOF; + goto ret; + } + + a->beg=p->cur; + a->end=p->cur; + + if (!memcmp(p->cur,"<!--",4)) + { + for( ; (p->cur < p->end) && memcmp(p->cur, "-->", 3); p->cur++); + if(!memcmp(p->cur, "-->", 3)) + p->cur+=3; + a->end=p->cur; + lex=MY_XML_COMMENT; + } + else if (strchr("?=/<>!",p->cur[0])) + { + p->cur++; + a->end=p->cur; + lex=a->beg[0]; + } + else if ( (p->cur[0]=='"') || (p->cur[0]=='\'') ) + { + p->cur++; + for( ; ( p->cur < p->end ) && (p->cur[0]!=a->beg[0]); p->cur++); + a->end=p->cur; + if (a->beg[0]==p->cur[0])p->cur++; + a->beg++; + my_xml_norm_text(a); + lex=MY_XML_STRING; + } + else + { + for( ; (p->cur < p->end) && !strchr("?'\"=/<> \t\r\n", p->cur[0]); p->cur++); + a->end=p->cur; + my_xml_norm_text(a); + lex=MY_XML_IDENT; + } + +#if 0 + printf("LEX=%s[%d]\n",lex2str(lex),a->end-a->beg); +#endif + +ret: + return lex; +} + + +static int my_xml_value(MY_XML_PARSER *st, const char *str, uint len) +{ + return (st->value) ? (st->value)(st,str,len) : MY_XML_OK; +} + + +static int my_xml_enter(MY_XML_PARSER *st, const char *str, uint len) +{ + if ( (st->attrend-st->attr+len+1)>sizeof(st->attr)) + { + sprintf(st->errstr,"To deep XML"); + return MY_XML_ERROR; + } + if (st->attrend > st->attr) + { + st->attrend[0]='.'; + st->attrend++; + } + memcpy(st->attrend,str,len); + st->attrend+=len; + st->attrend[0]='\0'; + return st->enter ? st->enter(st,st->attr,st->attrend-st->attr) : MY_XML_OK; +} + +static void mstr(char *s,const char *src,uint l1, uint l2) +{ + l1 = l1<l2 ? l1 : l2; + memcpy(s,src,l1); + s[l1]='\0'; +} + +static int my_xml_leave(MY_XML_PARSER *p, const char *str, uint slen) +{ + char *e; + uint glen; + char s[32]; + char g[32]; + int rc; + + /* Find previous '.' or beginning */ + for( e=p->attrend; (e>p->attr) && (e[0]!='.') ; e--); + glen = (e[0]=='.') ? (p->attrend-e-1) : p->attrend-e; + + if (str && (slen != glen)) + { + mstr(s,str,sizeof(s)-1,slen); + mstr(g,e+1,sizeof(g)-1,glen), + sprintf(p->errstr,"'</%s>' unexpected ('</%s>' wanted)",s,g); + return MY_XML_ERROR; + } + + rc = p->leave ? p->leave(p,p->attr,p->attrend-p->attr) : MY_XML_OK; + + *e='\0'; + p->attrend=e; + + return rc; +} + + +int my_xml_parse(MY_XML_PARSER *p,const char *str, uint len) +{ + p->attrend=p->attr; + p->beg=str; + p->cur=str; + p->end=str+len; + + while ( p->cur < p->end ) + { + MY_XML_ATTR a; + if(p->cur[0]=='<') + { + int lex; + int question=0; + int exclam=0; + + lex=my_xml_scan(p,&a); + + if (MY_XML_COMMENT==lex) + { + continue; + } + + lex=my_xml_scan(p,&a); + + if (MY_XML_SLASH==lex) + { + if(MY_XML_IDENT!=(lex=my_xml_scan(p,&a))) + { + sprintf(p->errstr,"1: %s unexpected (ident wanted)",lex2str(lex)); + return MY_XML_ERROR; + } + if(MY_XML_OK!=my_xml_leave(p,a.beg,a.end-a.beg)) + return MY_XML_ERROR; + lex=my_xml_scan(p,&a); + goto gt; + } + + if (MY_XML_EXCLAM==lex) + { + lex=my_xml_scan(p,&a); + exclam=1; + } + else if (MY_XML_QUESTION==lex) + { + lex=my_xml_scan(p,&a); + question=1; + } + + if (MY_XML_IDENT==lex) + { + if(MY_XML_OK!=my_xml_enter(p,a.beg,a.end-a.beg)) + return MY_XML_ERROR; + } + else + { + sprintf(p->errstr,"3: %s unexpected (ident or '/' wanted)",lex2str(lex)); + return MY_XML_ERROR; + } + + while ((MY_XML_IDENT==(lex=my_xml_scan(p,&a))) || (MY_XML_STRING==lex)) + { + MY_XML_ATTR b; + if(MY_XML_EQ==(lex=my_xml_scan(p,&b))) + { + lex=my_xml_scan(p,&b); + if ( (lex==MY_XML_IDENT) || (lex=MY_XML_STRING) ) + { + if((MY_XML_OK!=my_xml_enter(p,a.beg,a.end-a.beg)) || + (MY_XML_OK!=my_xml_value(p,b.beg,b.end-b.beg)) || + (MY_XML_OK!=my_xml_leave(p,a.beg,a.end-a.beg))) + return MY_XML_ERROR; + } + else + { + sprintf(p->errstr,"4: %s unexpected (ident or string wanted)",lex2str(lex)); + return MY_XML_ERROR; + } + } + else if ( (MY_XML_STRING==lex) || (MY_XML_IDENT==lex) ) + { + if((MY_XML_OK!=my_xml_enter(p,a.beg,a.end-a.beg)) || + (MY_XML_OK!=my_xml_leave(p,a.beg,a.end-a.beg))) + return MY_XML_ERROR; + } + else + break; + } + + if (lex==MY_XML_SLASH) + { + if(MY_XML_OK!=my_xml_leave(p,NULL,0)) + return MY_XML_ERROR; + lex=my_xml_scan(p,&a); + } + +gt: + if (question) + { + if (lex!=MY_XML_QUESTION) + { + sprintf(p->errstr,"6: %s unexpected ('?' wanted)",lex2str(lex)); + return MY_XML_ERROR; + } + if(MY_XML_OK!=my_xml_leave(p,NULL,0)) + return MY_XML_ERROR; + lex=my_xml_scan(p,&a); + } + + if (exclam) + { + if(MY_XML_OK!=my_xml_leave(p,NULL,0)) + return MY_XML_ERROR; + } + + if (lex!=MY_XML_GT) + { + sprintf(p->errstr,"5: %s unexpected ('>' wanted)",lex2str(lex)); + return MY_XML_ERROR; + } + } + else + { + a.beg=p->cur; + for ( ; (p->cur < p->end) && (p->cur[0]!='<') ; p->cur++); + a.end=p->cur; + + my_xml_norm_text(&a); + if (a.beg!=a.end) + { + my_xml_value(p,a.beg,a.end-a.beg); + } + } + } + return MY_XML_OK; +} + +void my_xml_parser_create(MY_XML_PARSER *p) +{ + bzero((void*)p,sizeof(p[0])); +} + +void my_xml_parser_free(MY_XML_PARSER *p __attribute__((unused))) +{ +} + +void my_xml_set_value_handler(MY_XML_PARSER *p, int (*action)(MY_XML_PARSER *p, const char *s, uint l)) +{ + p->value=action; +} + +void my_xml_set_enter_handler(MY_XML_PARSER *p, int (*action)(MY_XML_PARSER *p, const char *s, uint l)) +{ + p->enter=action; +} + +void my_xml_set_leave_handler(MY_XML_PARSER *p, int (*action)(MY_XML_PARSER *p, const char *s, uint l)) +{ + p->leave=action; +} + +void my_xml_set_user_data(MY_XML_PARSER *p, void *user_data) +{ + p->user_data=user_data; +} + +const char *my_xml_error_string(MY_XML_PARSER *p) +{ + return p->errstr; +} + + +uint my_xml_error_pos(MY_XML_PARSER *p) +{ + const char *beg=p->beg; + const char *s; + for ( s=p->beg ; s<p->cur; s++) + if (s[0]=='\n') + beg=s; + return p->cur-beg; +} + +uint my_xml_error_lineno(MY_XML_PARSER *p) +{ + uint res=0; + const char *s; + for ( s=p->beg ; s<p->cur; s++) + if (s[0]=='\n') + res++; + return res; +} diff --git a/support-files/mysql.server.sh b/support-files/mysql.server.sh index d52ade03836..7340cff9cad 100644 --- a/support-files/mysql.server.sh +++ b/support-files/mysql.server.sh @@ -174,9 +174,16 @@ case "$mode" in fi ;; + 'restart') + # Stop the service and regardless of whether it was + # running or not, start it again. + $0 stop + $0 start + ;; + *) # usage - echo "usage: $0 start|stop" + echo "Usage: $0 start|stop|restart" exit 1 ;; esac diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index dcff17dee03..978e04e3268 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -71,7 +71,7 @@ Este pacote contém os clientes padrão para o MySQL. %package bench Release: %{release} -Requires: %{name}-client MySQL-DBI-perl-bin perl +Requires: %{name}-client perl-DBI perl Summary: MySQL - Benchmarks and test system Group: Applications/Databases Summary(pt_BR): MySQL - Medições de desempenho @@ -269,7 +269,7 @@ RBR=$RPM_BUILD_ROOT MBD=$RPM_BUILD_DIR/mysql-%{mysql_version} # Ensure that needed directories exists -install -d $RBR/etc/{logrotate.d,rc.d/init.d} +install -d $RBR/etc/{logrotate.d,init.d} install -d $RBR/var/lib/mysql/mysql install -d $RBR/usr/share/{sql-bench,mysql-test} install -d $RBR%{_mandir} @@ -290,14 +290,20 @@ install -m644 $MBD/sql/mysqld.sym $RBR/usr/lib/mysql/mysqld.sym # Install logrotate and autostart install -m644 $MBD/support-files/mysql-log-rotate $RBR/etc/logrotate.d/mysql -install -m755 $MBD/support-files/mysql.server $RBR/etc/rc.d/init.d/mysql +install -m755 $MBD/support-files/mysql.server $RBR/etc/init.d/mysql # Create symbolic compatibility link safe_mysqld -> mysqld_safe # (safe_mysqld will be gone in MySQL 4.1) ln -sf ./mysqld_safe $RBR/usr/bin/safe_mysqld %pre -if test -x /etc/rc.d/init.d/mysql +# Shut down a previously installed server first +if test -x /etc/init.d/mysql +then + /etc/init.d/mysql stop > /dev/null 2>&1 + echo "Giving mysqld a couple of seconds to exit nicely" + sleep 5 +elif test -x /etc/rc.d/init.d/mysql then /etc/rc.d/init.d/mysql stop > /dev/null 2>&1 echo "Giving mysqld a couple of seconds to exit nicely" @@ -313,7 +319,15 @@ if test ! -d $mysql_datadir/mysql; then mkdir $mysql_datadir/mysql; fi if test ! -d $mysql_datadir/test; then mkdir $mysql_datadir/test; fi # Make MySQL start/shutdown automatically when the machine does it. -/sbin/chkconfig --add mysql +# use insserv for older SuSE Linux versions +if test -x /sbin/insserv +then + /sbin/insserv /etc/init.d/mysql +# use chkconfig on Red Hat and newer SuSE releases +elif test -x /sbin/chkconfig +then + /sbin/chkconfig --add mysql +fi # Create a MySQL user. Do not report any problems if it already # exists. This is redhat specific and should be handled more portable @@ -334,31 +348,37 @@ chown -R mysql $mysql_datadir chmod -R og-rw $mysql_datadir/mysql # Restart in the same way that mysqld will be started normally. -/etc/rc.d/init.d/mysql start +/etc/init.d/mysql start # Allow safe_mysqld to start mysqld and print a message before we exit sleep 2 %post Max # Restart mysqld, to use the new binary. -# There may be a better way to handle this. -/etc/rc.d/init.d/mysql stop > /dev/null 2>&1 -echo "Giving mysqld a couple of seconds to restart" -sleep 5 -/etc/rc.d/init.d/mysql start -sleep 2 +echo "Restarting mysqld." +/etc/init.d/mysql restart > /dev/null 2>&1 %preun if test $1 = 0 then - if test -x /etc/rc.d/init.d/mysql + # Stop MySQL before uninstalling it + if test -x /etc/init.d/mysql then - /etc/rc.d/init.d/mysql stop > /dev/null + /etc/init.d/mysql stop > /dev/null fi # Remove autostart of mysql - /sbin/chkconfig --del mysql + # for older SuSE Linux versions + if test -x /sbin/insserv + then + /sbin/insserv -r /etc/init.d/mysql + # use chkconfig on Red Hat and newer SuSE releases + elif test -x /sbin/chkconfig + then + /sbin/chkconfig --del mysql + fi fi + # We do not remove the mysql user since it may still own a lot of # database files. @@ -412,7 +432,7 @@ fi %attr(644, root, root) /usr/lib/mysql/mysqld.sym %attr(644, root, root) /etc/logrotate.d/mysql -%attr(755, root, root) /etc/rc.d/init.d/mysql +%attr(755, root, root) /etc/init.d/mysql %attr(755, root, root) /usr/share/mysql/ @@ -482,6 +502,17 @@ fi %changelog +* Wed Nov 27 2002 Lenz Grimmer <lenz@mysql.com> + +- moved init script from /etc/rc.d/init.d to /etc/init.d (the majority of + Linux distributions now support this scheme as proposed by the LSB either + directly or via a compatibility symlink) +- Use new "restart" init script action instead of starting and stopping + separately +- Be more flexible in activating the automatic bootup - use insserv (on + older SuSE versions) or chkconfig (Red Hat, newer SuSE versions and + others) to create the respective symlinks + * Wed Sep 25 2002 Lenz Grimmer <lenz@mysql.com> - MySQL-Max now requires MySQL >= 4.0 to avoid version mismatches diff --git a/tests/big_record.pl b/tests/big_record.pl index 52d3dca5f7b..08547b50823 100755 --- a/tests/big_record.pl +++ b/tests/big_record.pl @@ -1,58 +1,69 @@ #!/usr/bin/perl -# This is a test with stores big records in a blob +# This is a test with stores big records in a blob. # Note that for the default test the mysql server should have been -# started with at least 'mysqld -O max_allowed_packet=200k' - -$host= shift || ""; -$test_db="test"; -$opt_user=$opt_password=""; +# started with at least 'mysqld -O max_allowed_packet=30M' and you should have +# at least 256M memory in your computer. use DBI; -$|= 1; # Autoflush +use Getopt::Long; + +$opt_host=""; +$opt_user=$opt_password=""; +$opt_db="test"; +$opt_rows=200; # Test of blobs up to ($rows-1)*100000+1 bytes +$opt_compress=0; +$opt_table="test_big_record"; -$table="test_big_record"; -$rows=20; # Test of blobs up to ($rows-1)*10000+1 bytes +GetOptions("host=s","db=s","user=s", "password=s", "table=s", "rows=i", + "compress") || die "Aborted"; print "Connection to database $test_db\n"; -$dbh = DBI->connect("DBI:mysql:$test_db:$host",$opt_user,$opt_password) || die "Can't connect: $DBI::errstr\n"; +$extra_options=""; +$extra_options.=":mysql_compression=1" if ($opt_compress); -$dbh->do("drop table if exists $table"); +$dbh = DBI->connect("DBI:mysql:$opt_db:$host$extra_options",$opt_user,$opt_password) || die "Can't connect: $DBI::errstr\n"; -print "Creating table $table\n"; +$dbh->do("drop table if exists $opt_table"); + +print "Creating table $opt_table\n"; ($dbh->do("\ -CREATE TABLE $table ( +CREATE TABLE $opt_table ( auto int(5) unsigned NOT NULL DEFAULT '0' auto_increment, - test mediumblob, + test longblob, PRIMARY KEY (auto))")) or die $DBI::errstr; -print "Inserting $rows records\n"; +print "Inserting $opt_rows records\n"; + +$|=1; # Flush output to stdout to be able to monitor process -for ($i=0 ; $i < $rows ; $i++) +for ($i=0 ; $i < $opt_rows ; $i++) { - $tmp= chr(65+$i) x ($i*10000+1); + $tmp= chr(65+($i % 16)) x ($i*100000+1); + print $i," ",length($tmp),"\n"; $tmp= $dbh->quote($tmp); - $dbh->do("insert into $table (test) values ($tmp)") or die $DBI::errstr; + $dbh->do("insert into $opt_table (test) values ($tmp)") or die $DBI::errstr; } -print "Testing records\n"; +print "Reading records\n"; + +$sth=$dbh->prepare("select * from $opt_table", { "mysql_use_result" => 1}) or die $dbh->errstr; -$sth=$dbh->prepare("select * from $table") or die $dbh->errstr; $sth->execute() or die $sth->errstr; $i=0; while (($row = $sth->fetchrow_arrayref)) { print $row->[0]," ",length($row->[1]),"\n"; - die "Record $i had wrong data in blob" if ($row->[1] ne (chr(65+$i)) x ($i*10000+1)); + die "Record $i had wrong data in blob" if ($row->[1] ne (chr(65+($i % 16)) x ($i*100000+1))); $i++; } -die "Didn't get all rows from server" if ($i != $rows); +die "Didn't get all rows from server" if ($i != $opt_rows); -$dbh->do("drop table $table") or die $DBI::errstr; +$dbh->do("drop table $opt_table") or die $DBI::errstr; print "Test ok\n"; exit 0; diff --git a/tests/client_test.c b/tests/client_test.c index 280df2bf717..6f7473cf4b5 100644 --- a/tests/client_test.c +++ b/tests/client_test.c @@ -2,7 +2,7 @@ client_test.c - description ------------------------- begin : Sun Feb 3 2002 - copyright : (C) MySQL AB 1995-2002, www.mysql.com + copyright : (C) MySQL AB 1995-2003, www.mysql.com author : venu ( venu@mysql.com ) ***************************************************************************/ @@ -32,14 +32,13 @@ #include <stdio.h> #include <string.h> -#include <assert.h> - - /* mysql client headers */ #include <my_sys.h> #include <mysql.h> #include <my_getopt.h> +#include <assert.h> + #ifndef true #define true 1 #endif @@ -58,100 +57,110 @@ static char *opt_user=0; static char *opt_password=0; static char *opt_host=0; static char *opt_unix_socket=0; -static uint opt_port; +static unsigned int opt_port; static my_bool tty_password=0; static MYSQL *mysql=0; -static char query[255]; +static char query[255]; +static char current_db[]= "client_test_db"; -#define myheader(str) { printf("\n\n#######################\n"); \ - printf("%s",str); \ - printf("\n#######################\n"); \ +#define myheader(str) { fprintf(stdout,"\n\n#######################\n"); \ + fprintf(stdout,"%s",str); \ + fprintf(stdout,"\n#######################\n"); \ } #define init_bind(x) (bzero(x,sizeof(x))) -void print_error(const char *msg) +#ifndef mysql_param_result +#define mysql_param_result mysql_prepare_result +#endif + +static void print_error(const char *msg) { if (mysql) { - fprintf(stderr,"\n [MySQL]%s \n",mysql_error(mysql)); + if (mysql->server_version) + fprintf(stderr,"\n [MySQL-%s]",mysql->server_version); + else + fprintf(stderr,"\n [MySQL]"); + fprintf(stderr,"[%d] %s\n",mysql_errno(mysql),mysql_error(mysql)); } - else if(msg) fprintf(stderr, "%s\n", msg); + else if(msg) fprintf(stderr, " [MySQL] %s\n", msg); } -void print_st_error(MYSQL_STMT *stmt, const char *msg) +static void print_st_error(MYSQL_STMT *stmt, const char *msg) { if (stmt) { - fprintf(stderr,"\n [MySQL]%s \n",mysql_stmt_error(stmt)); + if (stmt->mysql && stmt->mysql->server_version) + fprintf(stderr,"\n [MySQL-%s]",stmt->mysql->server_version); + else + fprintf(stderr,"\n [MySQL]"); + + fprintf(stderr,"[%d] %s\n",mysql_stmt_errno(stmt), + mysql_stmt_error(stmt)); } - else if(msg) fprintf(stderr, "%s\n", msg); + else if(msg) fprintf(stderr, " [MySQL] %s\n", msg); } +static void client_disconnect(); #define myerror(msg) print_error(msg) #define mysterror(stmt, msg) print_st_error(stmt, msg) -#define myassert(x) if(x) {\ - fprintf(stderr,"ASSERTION FAILED AT %d@%s\n",__LINE__, __FILE__);\ - exit(1);\ -} -#define myassert_r(x) if(!x) {\ - fprintf(stderr,"ASSERTION FAILED AT %d@%s\n",__LINE__, __FILE__);\ - exit(1);\ -} +#define myassert(exp) assert(exp) +#define myassert_r(exp) assert(!(exp)) #define myquery(r) \ -if( r != 0) \ { \ +if( r || r == -1) \ myerror(NULL); \ - myassert(true);\ + myassert(r == 0); \ } #define myquery_r(r) \ -if( r != 0) \ { \ +if( r || r == -1) \ myerror(NULL); \ - myassert_r(true);\ +myassert_r(r == 0); \ } #define mystmt(stmt,r) \ -if( r != 0) \ { \ +if( r || r == -1) \ mysterror(stmt,NULL); \ - myassert(true);\ +myassert(r == 0);\ } -#define myxquery(stmt) \ -if( stmt == 0) \ +#define mystmt_r(stmt,r) \ { \ - myerror(NULL); \ - myassert(true);\ +if( r || r == -1) \ + mysterror(stmt,NULL); \ +myassert_r(r == 0);\ } -#define myxquery_r(stmt) \ -if( stmt == 0) \ +#define mystmt_init(stmt) \ { \ +if( stmt == 0) \ myerror(NULL); \ - myassert_r(true);\ -} \ -else myassert(true); +myassert(stmt != 0); \ +} -#define mystmt_r(stmt,r) \ -if( r != 0) \ +#define mystmt_init_r(stmt) \ { \ - mysterror(stmt,NULL); \ - myassert_r(true);\ -} +myassert(stmt == 0);\ +} #define mytest(x) if(!x) {myerror(NULL);myassert(true);} #define mytest_r(x) if(x) {myerror(NULL);myassert(true);} +#define PREPARE(A,B) mysql_prepare(A,B,strlen(B)) + /******************************************************** * connect to the server * *********************************************************/ static void client_connect() { + char buff[255]; myheader("client_connect"); if(!(mysql = mysql_init(NULL))) @@ -163,28 +172,37 @@ static void client_connect() opt_password, opt_db ? opt_db:"test", opt_port, opt_unix_socket, 0))) { - myerror("connection failed"); + myerror("connection failed"); + mysql_close(mysql); exit(0); } /* set AUTOCOMMIT to ON*/ mysql_autocommit(mysql, true); + sprintf(buff,"CREATE DATABASE IF NOT EXISTS %s", current_db); + mysql_query(mysql, buff); + sprintf(buff,"USE %s", current_db); + mysql_query(mysql, buff); } /******************************************************** * close the connection * *********************************************************/ -void client_disconnect() +static void client_disconnect() { - myheader("client_disconnect"); - - mysql_close(mysql); + if (mysql) + { + char buff[255]; + sprintf(buff,"DROP DATABASE IF EXISTS %s", current_db); + mysql_query(mysql, buff); + mysql_close(mysql); + } } /******************************************************** * query processing * *********************************************************/ -void client_query() +static void client_query() { int rc; @@ -212,6 +230,9 @@ void client_query() rc = mysql_query(mysql,"INSERT INTO myclient_test(name) VALUES('deleted')"); myquery(rc); + rc = mysql_query(mysql,"INSERT INTO myclient_test(name) VALUES('deleted')"); + myquery(rc); + rc = mysql_query(mysql,"UPDATE myclient_test SET name='updated' WHERE name='deleted'"); myquery(rc); @@ -222,7 +243,7 @@ void client_query() /******************************************************** * print dashes * *********************************************************/ -void my_print_dashes(MYSQL_RES *result) +static void my_print_dashes(MYSQL_RES *result) { MYSQL_FIELD *field; unsigned int i,j; @@ -244,7 +265,7 @@ void my_print_dashes(MYSQL_RES *result) /******************************************************** * print resultset metadata information * *********************************************************/ -void my_print_result_metadata(MYSQL_RES *result) +static void my_print_result_metadata(MYSQL_RES *result) { MYSQL_FIELD *field; unsigned int i,j; @@ -287,6 +308,9 @@ int my_process_result_set(MYSQL_RES *result) MYSQL_FIELD *field; unsigned int i; unsigned int row_count=0; + + if (!result) + return 0; my_print_result_metadata(result); @@ -315,48 +339,180 @@ int my_process_result_set(MYSQL_RES *result) if (mysql_errno(mysql) != 0) fprintf(stderr, "\n\tmysql_fetch_row() failed\n"); else - fprintf(stdout,"\n\t%d rows returned\n", row_count); - return(row_count); + fprintf(stdout,"\n\t%d %s returned\n", row_count, + row_count == 1 ? "row" : "rows"); + return row_count; } -static void verify_col_data(const char *table, const char *col, const char *exp_data) +/******************************************************** +* process the stmt result set * +*********************************************************/ +uint my_process_stmt_result(MYSQL_STMT *stmt) { - MYSQL_STMT *stmt; - MYSQL_BIND bind[1]; - char data[255]; - int rc; - - init_bind(bind); + int field_count; + uint row_count= 0; + MYSQL_BIND buffer[50]; + MYSQL_FIELD *field; + MYSQL_RES *result; + char data[50][255]; + long length[50]; + int rc, i; + + if (!(result= mysql_prepare_result(stmt))) + { + while (!mysql_fetch(stmt)); + return 0; + } - bind[0].buffer_type=FIELD_TYPE_STRING; - bind[0].buffer= (char *)data; - bind[0].buffer_length= sizeof(data); + field_count= mysql_num_fields(result); + for(i=0; i < field_count; i++) + { + buffer[i].buffer_type= MYSQL_TYPE_STRING; + buffer[i].buffer_length=50; + buffer[i].length=(long *)&length[i]; + buffer[i].buffer=(gptr)data[i]; + } - sprintf(query, "SELECT `%s` FROM `%s`", col, table); + my_print_result_metadata(result); - printf("\n %s", query); - stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + rc= mysql_bind_result(stmt,buffer); + mystmt(stmt,rc); - rc = mysql_bind_result(stmt,bind); - mystmt(stmt, rc); + mysql_field_seek(result, 0); + while (mysql_fetch(stmt) == 0) + { + fputc('\t',stdout); + fputc('|',stdout); + + mysql_field_seek(result,0); + for (i=0; i < field_count; i++) + { + field = mysql_fetch_field(result); + if(length[i] == MYSQL_NULL_DATA) + fprintf(stdout, " %-*s |", (int) field->max_length, "NULL"); + else if (length[i] == 0) + data[i][0]='\0'; /* unmodified buffer */ + 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); + 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; +} - rc = mysql_execute(stmt); - mystmt(stmt, rc); +/******************************************************** +* process the stmt result set * +*********************************************************/ +uint my_stmt_result(const char *query, unsigned long length) +{ + MYSQL_STMT *stmt; + uint row_count; + int rc; - rc = mysql_fetch(stmt); - mystmt(stmt,rc); + stmt= mysql_prepare(mysql,query,length); + mystmt_init(stmt); - printf("\n data : %s (expected: %s)",data, exp_data); - assert(strcmp(data,exp_data)==0); + rc = mysql_execute(stmt); + mystmt(stmt,rc); + row_count= my_process_stmt_result(stmt); mysql_stmt_close(stmt); + + return row_count; +} + +/* + Utility function to verify a particular column data +*/ +static void verify_col_data(const char *table, const char *col, + const char *exp_data) +{ + MYSQL_RES *result; + MYSQL_ROW row; + char query[255]; + int rc, field= 1; + + if (table && col) + { + sprintf(query, "SELECT %s FROM %s LIMIT 1", col, table); + + fprintf(stdout,"\n %s", query); + rc = mysql_query(mysql, query); + myquery(rc); + + field= 0; + } + + result = mysql_use_result(mysql); + mytest(result); + + if (!(row= mysql_fetch_row(result)) || !row[field]) + { + fprintf(stdout,"\n *** ERROR: FAILED TO GET THE RESULT ***"); + exit(1); + } + fprintf(stdout,"\n obtained: `%s` (expected: `%s`)", + row[field], exp_data); + myassert(strcmp(row[field],exp_data) == 0); + mysql_free_result(result); +} + +/* + 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) +{ + MYSQL_FIELD *field; + + if (!(field= mysql_fetch_field_direct(result,no))) + { + 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"); + myassert(strcmp(field->name,name) == 0); + myassert(strcmp(field->org_name,org_name) == 0); + myassert(field->type == type); + myassert(strcmp(field->table,table) == 0); + myassert(strcmp(field->org_table,org_table) == 0); + myassert(strcmp(field->db,db) == 0); } +/* + Utility function to verify the parameter count +*/ +static void verify_param_count(MYSQL_STMT *stmt, long exp_count) +{ + long param_count= mysql_param_count(stmt); + fprintf(stdout,"\n total parameters in stmt: %ld (expected: %ld)", + param_count, exp_count); + myassert(param_count == exp_count); +} + + /******************************************************** * store result processing * *********************************************************/ -void client_store_result() +static void client_store_result() { MYSQL_RES *result; int rc; @@ -375,9 +531,9 @@ void client_store_result() } /******************************************************** -* use result processing * +* fetch the results *********************************************************/ -void client_use_result() +static void client_use_result() { MYSQL_RES *result; int rc; @@ -398,7 +554,7 @@ void client_use_result() /******************************************************** * query processing * *********************************************************/ -void test_debug_example() +static void test_debug_example() { int rc; MYSQL_RES *result; @@ -418,7 +574,7 @@ void test_debug_example() rc = mysql_query(mysql,"UPDATE test_debug_example SET name='updated' WHERE name='deleted'"); myquery(rc); - rc = mysql_query(mysql,"SELECT * FROM test_debug_example"); + rc = mysql_query(mysql,"SELECT * FROM test_debug_example where name='mysql'"); myquery(rc); result = mysql_use_result(mysql); @@ -434,7 +590,7 @@ void test_debug_example() /******************************************************** * to test autocommit feature * *********************************************************/ -void test_tran_bdb() +static void test_tran_bdb() { MYSQL_RES *result; MYSQL_ROW row; @@ -512,7 +668,7 @@ void test_tran_bdb() /******************************************************** * to test autocommit feature * *********************************************************/ -void test_tran_innodb() +static void test_tran_innodb() { MYSQL_RES *result; MYSQL_ROW row; @@ -591,10 +747,10 @@ void test_tran_innodb() To test simple prepares of all DML statements *********************************************************/ -void test_prepare_simple() +static void test_prepare_simple() { MYSQL_STMT *stmt; - int rc,param_count; + int rc; myheader("test_prepare_simple"); @@ -610,41 +766,33 @@ void test_prepare_simple() /* alter table */ strcpy(query,"ALTER TABLE test_prepare_simple ADD new char(20)"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout,"\n total parameters in alter:%d\n", param_count); - assert(param_count == 0); + verify_param_count(stmt,0); mysql_stmt_close(stmt); /* insert */ strcpy(query,"INSERT INTO test_prepare_simple VALUES(?,?)"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout,"\n total parameters in insert:%d\n", param_count); - assert(param_count == 2); + verify_param_count(stmt,2); mysql_stmt_close(stmt); /* update */ strcpy(query,"UPDATE test_prepare_simple SET id=? WHERE id=? AND name= ?"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout,"\n total parameters in update:%d\n", param_count); - assert(param_count == 3); + verify_param_count(stmt,3); mysql_stmt_close(stmt); /* delete */ strcpy(query,"DELETE FROM test_prepare_simple WHERE id=10"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout,"\n total parameters in delete:%d\n", param_count); - assert(param_count == 0); + verify_param_count(stmt,0); rc = mysql_execute(stmt); mystmt(stmt, rc); @@ -653,11 +801,9 @@ void test_prepare_simple() /* delete */ strcpy(query,"DELETE FROM test_prepare_simple WHERE id=?"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout,"\n total parameters in delete:%d\n", param_count); - assert(param_count == 1); + verify_param_count(stmt,1); rc = mysql_execute(stmt); mystmt_r(stmt, rc); @@ -666,11 +812,9 @@ void test_prepare_simple() /* select */ strcpy(query,"SELECT * FROM test_prepare_simple WHERE id=? AND name= ?"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout,"\n total parameters in select:%d\n", param_count); - assert(param_count == 2); + verify_param_count(stmt,2); mysql_stmt_close(stmt); @@ -683,9 +827,10 @@ void test_prepare_simple() /******************************************************** * to test simple prepare field results * *********************************************************/ -void test_prepare_field_result() +static void test_prepare_field_result() { MYSQL_STMT *stmt; + MYSQL_RES *result; int rc,param_count; myheader("test_prepare_field_result"); @@ -696,29 +841,47 @@ void test_prepare_field_result() rc = mysql_commit(mysql); myquery(rc); - rc = mysql_query(mysql,"CREATE TABLE test_prepare_field_result(id int, name varchar(50), extra int)"); + rc = mysql_query(mysql,"CREATE TABLE test_prepare_field_result(int_c int, \ + var_c varchar(50), ts_c timestamp(14),\ + char_c char(3), date_c date,extra tinyint)"); myquery(rc); /* insert */ - strcpy(query,"SELECT id,name FROM test_prepare_field_result WHERE id=?"); + strcpy(query,"SELECT int_c,var_c,date_c as date,ts_c,char_c FROM \ + test_prepare_field_result as t1 WHERE int_c=?"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout,"\n total parameters in insert:%d\n", param_count); - assert(param_count == 1); - mysql_stmt_close(stmt); + verify_param_count(stmt,1); - /* now fetch the results ..*/ - rc = mysql_commit(mysql); - myquery(rc); + result = mysql_prepare_result(stmt); + mytest(result); + + my_print_result_metadata(result); + + 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); + verify_prepare_field(result,1,"var_c","var_c",MYSQL_TYPE_VAR_STRING, + "t1","test_prepare_field_result",current_db); + verify_prepare_field(result,2,"date","date_c",MYSQL_TYPE_DATE, + "t1","test_prepare_field_result",current_db); + verify_prepare_field(result,3,"ts_c","ts_c",MYSQL_TYPE_TIMESTAMP, + "t1","test_prepare_field_result",current_db); + verify_prepare_field(result,4,"char_c","char_c",MYSQL_TYPE_STRING, + "t1","test_prepare_field_result",current_db); + + param_count= mysql_num_fields(result); + fprintf(stdout,"\n\n total fields: `%d` (expected: `5`)", param_count); + myassert(param_count == 5); + mysql_stmt_close(stmt); } /******************************************************** * to test simple prepare field results * *********************************************************/ -void test_prepare_syntax() +static void test_prepare_syntax() { MYSQL_STMT *stmt; int rc; @@ -736,11 +899,11 @@ void test_prepare_syntax() strcpy(query,"INSERT INTO test_prepare_syntax VALUES(?"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery_r(stmt); + mystmt_init_r(stmt); strcpy(query,"SELECT id,name FROM test_prepare_syntax WHERE id=? AND WHERE"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery_r(stmt); + mystmt_init_r(stmt); /* now fetch the results ..*/ rc = mysql_commit(mysql); @@ -751,10 +914,10 @@ void test_prepare_syntax() /******************************************************** * to test simple prepare * *********************************************************/ -void test_prepare() +static void test_prepare() { MYSQL_STMT *stmt; - int rc,param_count; + int rc; char query[200]; int int_data; char str_data[50]; @@ -779,7 +942,7 @@ void test_prepare() myquery(rc); rc = mysql_query(mysql,"CREATE TABLE my_prepare(col1 tinyint,\ - col2 varchar(50), col3 int,\ + col2 varchar(15), col3 int,\ col4 smallint, col5 bigint, \ col6 float, col7 double )"); myquery(rc); @@ -787,11 +950,9 @@ void test_prepare() /* insert by prepare */ strcpy(query,"INSERT INTO my_prepare VALUES(?,?,?,?,?,?,?)"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout," total parameters in insert:%d\n", param_count); - assert(param_count == 7); + verify_param_count(stmt,7); /* tinyint */ bind[0].buffer_type=FIELD_TYPE_TINY; @@ -852,7 +1013,7 @@ void test_prepare() result = mysql_store_result(mysql); mytest(result); - assert((int)tiny_data == my_process_result_set(result)); + myassert((int)tiny_data == my_process_result_set(result)); mysql_free_result(result); } @@ -860,10 +1021,10 @@ void test_prepare() /******************************************************** * to test double comparision * *********************************************************/ -void test_double_compare() +static void test_double_compare() { MYSQL_STMT *stmt; - int rc,param_count; + int rc; char query[200],real_data[10], tiny_data; double double_data; MYSQL_RES *result; @@ -890,10 +1051,9 @@ void test_double_compare() strcpy(query, "UPDATE test_double_compare SET col1=100 WHERE col1 = ? AND col2 = ? AND COL3 = ?"); stmt = mysql_prepare(mysql,query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout," total parameters in update:%d\n", param_count); + verify_param_count(stmt,3); /* tinyint */ bind[0].buffer_type=FIELD_TYPE_TINY; @@ -916,7 +1076,7 @@ void test_double_compare() mystmt(stmt, rc); rc = (int)mysql_affected_rows(mysql); - printf("\n total affected rows:%d",rc); + fprintf(stdout,"\n total affected rows:%d",rc); mysql_stmt_close(stmt); @@ -932,21 +1092,17 @@ void test_double_compare() result = mysql_store_result(mysql); mytest(result); - assert((int)tiny_data == my_process_result_set(result)); + myassert((int)tiny_data == my_process_result_set(result)); mysql_free_result(result); - } - - - /******************************************************** * to test simple null * *********************************************************/ -void test_null() +static void test_null() { MYSQL_STMT *stmt; - int rc,param_count; + int rc; int nData=1; MYSQL_RES *result; MYSQL_BIND bind[2]; @@ -966,15 +1122,13 @@ void test_null() /* insert by prepare, wrong column name */ strcpy(query,"INSERT INTO test_null(col3,col2) VALUES(?,?)"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery_r(stmt); + mystmt_init_r(stmt); strcpy(query,"INSERT INTO test_null(col1,col2) VALUES(?,?)"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout," total parameters in insert:%d\n", param_count); - assert(param_count == 2); + verify_param_count(stmt,2); bind[0].is_null=1; bind[0].buffer_type=MYSQL_TYPE_NULL; @@ -1003,49 +1157,174 @@ void test_null() result = mysql_store_result(mysql); mytest(result); - assert(nData == my_process_result_set(result)); + myassert(nData == my_process_result_set(result)); mysql_free_result(result); } +/******************************************************** +* to test fetch null * +*********************************************************/ +static void test_fetch_null() +{ + MYSQL_STMT *stmt; + int rc; + const char query[100]; + int length[11], i, nData; + MYSQL_BIND bind[11]; + + myheader("test_fetch_null"); + + init_bind(bind); + rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_fetch_null"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"CREATE TABLE test_fetch_null(col1 tinyint, col2 smallint, \ + col3 int, col4 bigint, \ + col5 float, col6 double, \ + col7 date, col8 time, \ + col9 varbinary(10), \ + col10 varchar(50),\ + col11 char(20))"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"INSERT INTO test_fetch_null(col11) VALUES(1000),(88),(389789)"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + /* fetch */ + for (i=0; i <= 10; i++) + { + bind[i].buffer_type=FIELD_TYPE_LONG; + length[i]=99; + bind[i].length= (long *)&length[i]; + } + bind[i-1].buffer=(gptr)&nData; + + strcpy((char *)query , "SELECT * FROM test_fetch_null"); + + myassert(3 == my_stmt_result(query,50)); + + stmt = mysql_prepare(mysql, query, 50); + mystmt_init(stmt); + + rc = mysql_bind_result(stmt,bind); + mystmt(stmt, rc); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + + rc= 0; + while (mysql_fetch(stmt) != MYSQL_NO_DATA) + { + rc++; + for (i=0; i < 10; i++) + { + fprintf(stdout, "\n data[%d] : %s", i, + length[i] == MYSQL_NULL_DATA ? "NULL" : "NOT NULL"); + myassert(length[i] == MYSQL_NULL_DATA); + } + fprintf(stdout, "\n data[%d]: %d", i, nData); + myassert(nData == 1000 || nData == 88 || nData == 389789); + myassert(length[i] == 4); + } + myassert(rc == 3); + mysql_stmt_close(stmt); +} /******************************************************** * to test simple select * *********************************************************/ -void test_select_simple() +static void test_select_version() { MYSQL_STMT *stmt; - int rc,length; + int rc; + const char query[100]; + + myheader("test_select_version"); + + strcpy((char *)query , "SELECT @@version"); + stmt = PREPARE(mysql, query); + mystmt_init(stmt); + + verify_param_count(stmt,0); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + + my_process_stmt_result(stmt); + mysql_stmt_close(stmt); +} + +/******************************************************** +* to test simple select * +*********************************************************/ +static void test_select_simple() +{ + MYSQL_STMT *stmt; + int rc; const char query[100]; - MYSQL_RES *result; myheader("test_select_simple"); /* insert by prepare */ strcpy((char *)query, "SHOW TABLES FROM mysql"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - length = mysql_param_count(stmt); - fprintf(stdout," total parameters in select:%d\n", length); - assert(length == 0); + verify_param_count(stmt,0); rc = mysql_execute(stmt); mystmt(stmt, rc); - /* get the result */ - result = mysql_store_result(mysql); - mytest(result); + my_process_stmt_result(stmt); + mysql_stmt_close(stmt); +} - my_process_result_set(result); - mysql_free_result(result); +/******************************************************** +* to test simple select to debug * +*********************************************************/ +static void test_select_direct() +{ + int rc; + MYSQL_RES *result; - mysql_stmt_close(stmt); + myheader("test_select_direct"); + + rc = mysql_autocommit(mysql,true); + myquery(rc); -#if 0 - strcpy((char *)query , "SELECT @@ VERSION"); - length = strlen(query); - rc = mysql_query(mysql,query); + rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_select"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"CREATE TABLE test_select(id int, id1 tinyint, \ + id2 float, \ + id3 double, \ + name varchar(50))"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + /* insert a row and commit the transaction */ + rc = mysql_query(mysql,"INSERT INTO test_select VALUES(10,5,2.3,4.5,'venu')"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"SELECT * FROM test_select"); myquery(rc); /* get the result */ @@ -1054,22 +1333,88 @@ void test_select_simple() my_process_result_set(result); mysql_free_result(result); -#endif } +/******************************************************** +* to test simple select with prepare * +*********************************************************/ +static void test_select_prepare() +{ + int rc, count; + MYSQL_STMT *stmt; + + myheader("test_select_prepare"); + + rc = mysql_autocommit(mysql,true); + myquery(rc); + + rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_select"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"CREATE TABLE test_select(id int, name varchar(50))"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + /* insert a row and commit the transaction */ + rc = mysql_query(mysql,"INSERT INTO test_select VALUES(10,'venu')"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + stmt = mysql_prepare(mysql,"SELECT * FROM test_select",50); + mystmt_init(stmt); + + rc = mysql_execute(stmt); + mystmt(stmt,rc); + + count= my_process_stmt_result(stmt); + + rc = mysql_query(mysql,"DROP TABLE test_select"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"CREATE TABLE test_select(id tinyint, id1 int, \ + id2 float, id3 float, \ + name varchar(50))"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + /* insert a row and commit the transaction */ + rc = mysql_query(mysql,"INSERT INTO test_select(id,id1,id2,name) VALUES(10,5,2.3,'venu')"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + stmt = mysql_prepare(mysql,"SELECT * FROM test_select",25); + mystmt_init(stmt); + + rc = mysql_execute(stmt); + mystmt(stmt,rc); + + my_process_stmt_result(stmt); +} /******************************************************** * to test simple select * *********************************************************/ -void test_select() +static void test_select() { MYSQL_STMT *stmt; - int rc,param_count=0; - char *szData=(char *)"updated-value"; + int rc; + char szData[25]; int nData=1; MYSQL_BIND bind[2]; - MYSQL_RES *result; - myheader("test_select"); @@ -1105,15 +1450,13 @@ void test_select() strcpy(query,"SELECT * FROM test_select WHERE id=? AND name=?"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout," total parameters in select:%d\n", param_count); - assert(param_count == 2); + verify_param_count(stmt,2); /* string data */ nData=10; - szData=(char *)"venu"; + strcpy(szData,(char *)"venu"); bind[1].buffer_type=FIELD_TYPE_STRING; bind[1].buffer=szData; bind[1].buffer_length=4; @@ -1126,28 +1469,50 @@ void test_select() rc = mysql_execute(stmt); mystmt(stmt, rc); + myassert( 1 == my_process_stmt_result(stmt)); + + mysql_stmt_close(stmt); +} + +/******************************************************** +* to test simple select show * +*********************************************************/ +static void test_select_show() +{ + MYSQL_STMT *stmt; + int rc; + MYSQL_RES *result; + + myheader("test_select_show"); + + mysql_autocommit(mysql,true); + + strcpy(query,"SELECT * FROM mysql.host"); + stmt = mysql_prepare(mysql, query, strlen(query)); + mystmt_init(stmt); + + verify_param_count(stmt,0); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + /* get the result */ result = mysql_store_result(mysql); mytest(result); - assert( 1 == my_process_result_set(result)); + my_process_result_set(result); mysql_free_result(result); mysql_stmt_close(stmt); - - /* bit complicated SELECT */ } - - - /******************************************************** * to test simple update * *********************************************************/ -void test_simple_update() +static void test_simple_update() { MYSQL_STMT *stmt; - int rc,param_count; + int rc; char szData[25]; int nData=1; MYSQL_RES *result; @@ -1175,7 +1540,7 @@ void test_simple_update() rc = mysql_query(mysql,"INSERT INTO test_update VALUES(1,'MySQL',100)"); myquery(rc); - assert(1 == mysql_affected_rows(mysql)); + myassert(1 == mysql_affected_rows(mysql)); rc = mysql_commit(mysql); myquery(rc); @@ -1183,11 +1548,9 @@ void test_simple_update() /* insert by prepare */ strcpy(query,"UPDATE test_update SET col2=? WHERE col1=?"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout," total parameters in update:%d\n", param_count); - assert(param_count == 2); + verify_param_count(stmt,2); nData=1; bind[0].buffer_type=FIELD_TYPE_STRING; @@ -1201,7 +1564,7 @@ void test_simple_update() rc = mysql_execute(stmt); mystmt(stmt, rc); - assert(1 == mysql_affected_rows(mysql)); + myassert(1 == mysql_affected_rows(mysql)); mysql_stmt_close(stmt); @@ -1217,7 +1580,7 @@ void test_simple_update() result = mysql_store_result(mysql); mytest(result); - assert(1 == my_process_result_set(result)); + myassert(1 == my_process_result_set(result)); mysql_free_result(result); } @@ -1225,11 +1588,12 @@ void test_simple_update() /******************************************************** * to test simple long data handling * *********************************************************/ -void test_long_data() +static void test_long_data() { MYSQL_STMT *stmt; - int rc,param_count, int_data=10; + int rc, int_data; char *data=NullS; + long length; MYSQL_RES *result; MYSQL_BIND bind[3]; @@ -1255,24 +1619,23 @@ void test_long_data() strcpy(query,"INSERT INTO test_long_data(col1,col2) VALUES(?)"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery_r(stmt); + mystmt_init_r(stmt); strcpy(query,"INSERT INTO test_long_data(col1,col2,col3) VALUES(?,?,?)"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout," total parameters in insert:%d\n", param_count); - assert(param_count == 3); + verify_param_count(stmt,3); bind[0].buffer=(char *)&int_data; bind[0].buffer_type=FIELD_TYPE_LONG; - bind[1].is_long_data=1; /* specify long data suppy during run-time */ /* Non string or binary type, error */ bind[1].buffer_type=FIELD_TYPE_LONG; + bind[1].length=&length; + length= MYSQL_LONG_DATA; /* specify long data suppy during run-time */ rc = mysql_bind_param(stmt,bind); - fprintf(stdout,"mysql_bind_param() returned %d\n",rc); + fprintf(stdout," mysql_bind_param() returned: %d\n",rc); mystmt_r(stmt, rc); bind[1].buffer_type=FIELD_TYPE_STRING; @@ -1280,36 +1643,37 @@ void test_long_data() rc = mysql_bind_param(stmt,bind); mystmt(stmt, rc); + int_data= 999; rc = mysql_execute(stmt); - fprintf(stdout,"mysql_execute() returned %d\n",rc); - assert(rc == MYSQL_NEED_DATA); + fprintf(stdout," mysql_execute() returned %d\n",rc); + myassert(rc == MYSQL_NEED_DATA); data = (char *)"Micheal"; /* supply data in pieces */ - rc = mysql_send_long_data(stmt,1,data,7,1); + rc = mysql_send_long_data(stmt,1,data,7,0); mystmt(stmt, rc); /* try to execute mysql_execute() now, it should return MYSQL_NEED_DATA as the long data supply is not yet over */ rc = mysql_execute(stmt); - fprintf(stdout,"mysql_execute() returned %d\n",rc); - assert(rc == MYSQL_NEED_DATA); + fprintf(stdout," mysql_execute() returned %d\n",rc); + myassert(rc == MYSQL_NEED_DATA); /* append data again ..*/ /* Indicate end of data */ - data = (char *)" 'monty' widenius"; + data = (char *)" 'monty' Widenius"; rc = mysql_send_long_data(stmt,1,data,17,1); mystmt(stmt, rc); - rc = mysql_send_long_data(stmt,2,"Venu (venu@mysql.com",4,1); + rc = mysql_send_long_data(stmt,2,"Venu (venu@mysql.com)",4,1); mystmt(stmt, rc); /* execute */ rc = mysql_execute(stmt); - fprintf(stdout,"mysql_execute() returned %d\n",rc); + fprintf(stdout," mysql_execute() returned %d\n",rc); mystmt(stmt,rc); rc = mysql_commit(mysql); @@ -1323,19 +1687,23 @@ void test_long_data() result = mysql_store_result(mysql); mytest(result); - assert(1 == my_process_result_set(result)); + myassert(1 == my_process_result_set(result)); mysql_free_result(result); + + verify_col_data("test_long_data","col1","999"); + verify_col_data("test_long_data","col2","Micheal 'monty' Widenius"); + verify_col_data("test_long_data","col3","Venu"); } /******************************************************** * to test long data (string) handling * *********************************************************/ -void test_long_data_str() +static void test_long_data_str() { MYSQL_STMT *stmt; - int rc,param_count; + int rc, i; char data[255]; - long length; + long length, length1; MYSQL_RES *result; MYSQL_BIND bind[2]; @@ -1360,45 +1728,40 @@ void test_long_data_str() strcpy(query,"INSERT INTO test_long_data_str VALUES(?,?)"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout," total parameters in insert:%d\n", param_count); - assert(param_count == 2); + verify_param_count(stmt,2); bind[0].buffer = (gptr)&length; bind[0].buffer_type = FIELD_TYPE_LONG; bind[1].buffer=data; /* string data */ - bind[1].is_long_data=1; /* specify long data suppy during run-time */ bind[1].buffer_type=FIELD_TYPE_STRING; + bind[1].length= &length1; + length1= MYSQL_LONG_DATA; rc = mysql_bind_param(stmt,bind); mystmt(stmt, rc); length = 10; rc = mysql_execute(stmt); - fprintf(stdout,"mysql_execute() returned %d\n",rc); - assert(rc == MYSQL_NEED_DATA); + fprintf(stdout," mysql_execute() returned %d\n",rc); + myassert(rc == MYSQL_NEED_DATA); length = 40; sprintf(data,"MySQL AB"); /* supply data in pieces */ + for(i=0; i < 4; i++) { - int i; - for(i=0; i < 4; i++) - { - rc = mysql_send_long_data(stmt,1,(char *)data,5,0); - mystmt(stmt, rc); - } - - /* try to execute mysql_execute() now, it should return - MYSQL_NEED_DATA as the long data supply is not yet over - */ - rc = mysql_execute(stmt); - fprintf(stdout,"mysql_execute() returned %d\n",rc); - assert(rc == MYSQL_NEED_DATA); + rc = mysql_send_long_data(stmt,1,(char *)data,5,0); + mystmt(stmt, rc); } + /* try to execute mysql_execute() now, it should return + MYSQL_NEED_DATA as the long data supply is not yet over + */ + rc = mysql_execute(stmt); + fprintf(stdout," mysql_execute() returned %d\n",rc); + myassert(rc == MYSQL_NEED_DATA); /* Indiate end of data supply */ rc = mysql_send_long_data(stmt,1,0,0,1); @@ -1406,7 +1769,7 @@ void test_long_data_str() /* execute */ rc = mysql_execute(stmt); - fprintf(stdout,"mysql_execute() returned %d\n",rc); + fprintf(stdout," mysql_execute() returned %d\n",rc); mystmt(stmt,rc); mysql_stmt_close(stmt); @@ -1422,20 +1785,27 @@ void test_long_data_str() result = mysql_store_result(mysql); mytest(result); - assert(1 == my_process_result_set(result)); + myassert(1 == my_process_result_set(result)); mysql_free_result(result); + + sprintf(data,"%d", i*5); + verify_col_data("test_long_data_str","LENGTH(longstr)", data); + data[0]='\0'; + while (i--) + sprintf(data,"%s%s", data,"MySQL"); + verify_col_data("test_long_data_str","longstr", data); } /******************************************************** * to test long data (string) handling * *********************************************************/ -void test_long_data_str1() +static void test_long_data_str1() { MYSQL_STMT *stmt; - int rc,param_count; - char *data=(char *)"MySQL AB"; - int length; + int rc, i; + char data[255]; + long length, length1; MYSQL_RES *result; MYSQL_BIND bind[2]; @@ -1460,15 +1830,14 @@ void test_long_data_str1() strcpy(query,"INSERT INTO test_long_data_str VALUES(?,?)"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout," total parameters in insert:%d\n", param_count); - assert(param_count == 2); + verify_param_count(stmt,2); bind[0].buffer=data; /* string data */ - bind[0].is_long_data=1; /* specify long data suppy during run-time */ + bind[0].length= &length1; bind[0].buffer_type=FIELD_TYPE_STRING; + length1= MYSQL_LONG_DATA; bind[1] = bind[0]; bind[1].buffer_type=FIELD_TYPE_BLOB; @@ -1478,44 +1847,41 @@ void test_long_data_str1() length = 10; rc = mysql_execute(stmt); - fprintf(stdout,"mysql_execute() returned %d\n",rc); - assert(rc == MYSQL_NEED_DATA); + fprintf(stdout," mysql_execute() returned %d\n",rc); + myassert(rc == MYSQL_NEED_DATA); - length = strlen(data); + length = sprintf(data,"MySQL AB"); /* supply data in pieces */ + for(i=0; i < 3; i++) { - int i; - for(i=0; i < 2; i++) - { - rc = mysql_send_long_data(stmt,0,data,length,0); - mystmt(stmt, rc); + rc = mysql_send_long_data(stmt,0,data,length,0); + mystmt(stmt, rc); - rc = mysql_send_long_data(stmt,1,data,2,0); - mystmt(stmt, rc); - } - /* try to execute mysql_execute() now, it should return - MYSQL_NEED_DATA as the long data supply is not yet over - */ - rc = mysql_execute(stmt); - fprintf(stdout,"mysql_execute() returned %d\n",rc); - assert(rc == MYSQL_NEED_DATA); + rc = mysql_send_long_data(stmt,1,data,2,0); + mystmt(stmt, rc); } - + /* try to execute mysql_execute() now, it should return + MYSQL_NEED_DATA as the long data supply is not yet over + */ + rc = mysql_execute(stmt); + fprintf(stdout," mysql_execute() returned %d\n",rc); + myassert(rc == MYSQL_NEED_DATA); + /* Indiate end of data supply */ rc = mysql_send_long_data(stmt,1,0,0,1); mystmt(stmt, rc); rc = mysql_execute(stmt); - fprintf(stdout,"mysql_execute() returned %d\n",rc); - assert(rc == MYSQL_NEED_DATA); + fprintf(stdout," mysql_execute() returned %d\n",rc); + myassert(rc == MYSQL_NEED_DATA); rc = mysql_send_long_data(stmt,0,0,0,1); mystmt(stmt, rc); /* execute */ rc = mysql_execute(stmt); - fprintf(stdout,"mysql_execute() returned %d\n",rc); + fprintf(stdout," mysql_execute() returned %d\n",rc); mystmt(stmt,rc); mysql_stmt_close(stmt); @@ -1531,20 +1897,26 @@ void test_long_data_str1() result = mysql_store_result(mysql); mytest(result); - assert(1 == my_process_result_set(result)); + myassert(1 == my_process_result_set(result)); mysql_free_result(result); + + sprintf(data,"%ld",(long)i*length); + verify_col_data("test_long_data_str","length(longstr)",data); + + sprintf(data,"%d",i*2); + verify_col_data("test_long_data_str","length(blb)",data); } /******************************************************** * to test long data (binary) handling * *********************************************************/ -void test_long_data_bin() +static void test_long_data_bin() { MYSQL_STMT *stmt; - int rc,param_count; + int rc; char data[255]; - int length; + long length, length1; MYSQL_RES *result; MYSQL_BIND bind[2]; @@ -1569,25 +1941,24 @@ void test_long_data_bin() strcpy(query,"INSERT INTO test_long_data_bin VALUES(?,?)"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout," total parameters in insert:%d\n", param_count); - assert(param_count == 2); + verify_param_count(stmt,2); bind[0].buffer = (gptr)&length; bind[0].buffer_type = FIELD_TYPE_LONG; bind[1].buffer=data; /* string data */ - bind[1].is_long_data=1; /* specify long data suppy during run-time */ bind[1].buffer_type=FIELD_TYPE_LONG_BLOB; + bind[1].length= &length1; + length1= MYSQL_LONG_DATA; rc = mysql_bind_param(stmt,bind); mystmt(stmt, rc); length = 10; rc = mysql_execute(stmt); - fprintf(stdout,"mysql_execute() returned %d\n",rc); - assert(rc == MYSQL_NEED_DATA); + fprintf(stdout," mysql_execute() returned %d\n",rc); + myassert(rc == MYSQL_NEED_DATA); sprintf(data,"MySQL AB"); @@ -1604,8 +1975,8 @@ void test_long_data_bin() MYSQL_NEED_DATA as the long data supply is not yet over */ rc = mysql_execute(stmt); - fprintf(stdout,"mysql_execute() returned %d\n",rc); - assert(rc == MYSQL_NEED_DATA); + fprintf(stdout," mysql_execute() returned %d\n",rc); + myassert(rc == MYSQL_NEED_DATA); } /* Indiate end of data supply */ @@ -1614,7 +1985,7 @@ void test_long_data_bin() /* execute */ rc = mysql_execute(stmt); - fprintf(stdout,"mysql_execute() returned %d\n",rc); + fprintf(stdout," mysql_execute() returned %d\n",rc); mystmt(stmt,rc); mysql_stmt_close(stmt); @@ -1630,7 +2001,7 @@ void test_long_data_bin() result = mysql_store_result(mysql); mytest(result); - assert(1 == my_process_result_set(result)); + myassert(1 == my_process_result_set(result)); mysql_free_result(result); } @@ -1638,10 +2009,10 @@ void test_long_data_bin() /******************************************************** * to test simple delete * *********************************************************/ -void test_simple_delete() +static void test_simple_delete() { MYSQL_STMT *stmt; - int rc,param_count; + int rc; char szData[30]={0}; int nData=1; MYSQL_RES *result; @@ -1670,7 +2041,7 @@ void test_simple_delete() rc = mysql_query(mysql,"INSERT INTO test_simple_delete VALUES(1,'MySQL',100)"); myquery(rc); - assert(1 == mysql_affected_rows(mysql)); + myassert(1 == mysql_affected_rows(mysql)); rc = mysql_commit(mysql); myquery(rc); @@ -1678,11 +2049,9 @@ void test_simple_delete() /* insert by prepare */ strcpy(query,"DELETE FROM test_simple_delete WHERE col1=? AND col2=? AND col3=100"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout," total parameters in delete:%d\n", param_count); - assert(param_count == 2); + verify_param_count(stmt,2); nData=1; strcpy(szData,"MySQL"); @@ -1697,7 +2066,7 @@ void test_simple_delete() rc = mysql_execute(stmt); mystmt(stmt, rc); - assert(1 == mysql_affected_rows(mysql)); + myassert(1 == mysql_affected_rows(mysql)); mysql_stmt_close(stmt); @@ -1713,7 +2082,7 @@ void test_simple_delete() result = mysql_store_result(mysql); mytest(result); - assert(0 == my_process_result_set(result)); + myassert(0 == my_process_result_set(result)); mysql_free_result(result); } @@ -1722,10 +2091,10 @@ void test_simple_delete() /******************************************************** * to test simple update * *********************************************************/ -void test_update() +static void test_update() { MYSQL_STMT *stmt; - int rc,param_count; + int rc; char szData[25]; int nData=1; MYSQL_RES *result; @@ -1753,11 +2122,9 @@ void test_update() strcpy(query,"INSERT INTO test_update(col2,col3) VALUES(?,?)"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout," total parameters in insert:%d\n", param_count); - assert(param_count == 2); + verify_param_count(stmt,2); /* string data */ bind[0].buffer_type=FIELD_TYPE_STRING; @@ -1773,16 +2140,14 @@ void test_update() rc = mysql_execute(stmt); mystmt(stmt, rc); - assert(1 == mysql_affected_rows(mysql)); + myassert(1 == mysql_affected_rows(mysql)); mysql_stmt_close(stmt); strcpy(query,"UPDATE test_update SET col2=? WHERE col3=?"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout," total parameters in update:%d\n", param_count); - assert(param_count == 2); + verify_param_count(stmt,2); nData=100; @@ -1797,7 +2162,7 @@ void test_update() rc = mysql_execute(stmt); mystmt(stmt, rc); - assert(1 == mysql_affected_rows(mysql)); + myassert(1 == mysql_affected_rows(mysql)); mysql_stmt_close(stmt); @@ -1813,7 +2178,7 @@ void test_update() result = mysql_store_result(mysql); mytest(result); - assert(1 == my_process_result_set(result)); + myassert(1 == my_process_result_set(result)); mysql_free_result(result); } @@ -1821,13 +2186,13 @@ void test_update() /******************************************************** * to test simple prepare * *********************************************************/ -void test_init_prepare() +static void test_prepare_noparam() { MYSQL_STMT *stmt; - int param_count, rc; + int rc; MYSQL_RES *result; - myheader("test_init_prepare"); + myheader("test_prepare_noparam"); rc = mysql_query(mysql,"DROP TABLE IF EXISTS my_prepare"); myquery(rc); @@ -1842,11 +2207,9 @@ void test_init_prepare() /* insert by prepare */ strcpy(query,"INSERT INTO my_prepare VALUES(10,'venu')"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout," total parameters in insert:%d\n", param_count); - assert(param_count == 0); + verify_param_count(stmt,0); rc = mysql_execute(stmt); mystmt(stmt, rc); @@ -1865,7 +2228,7 @@ void test_init_prepare() result = mysql_store_result(mysql); mytest(result); - assert(1 == my_process_result_set(result)); + myassert(1 == my_process_result_set(result)); mysql_free_result(result); } @@ -1873,12 +2236,12 @@ void test_init_prepare() /******************************************************** * to test simple bind result * *********************************************************/ -void test_bind_result() +static void test_bind_result() { MYSQL_STMT *stmt; int rc; const char query[100]; - int nData; + int nData, length, length1; char szData[100]; MYSQL_BIND bind[2]; @@ -1903,6 +2266,9 @@ void test_bind_result() rc = mysql_query(mysql,"INSERT INTO test_bind_result VALUES(20,'MySQL')"); myquery(rc); + rc = mysql_query(mysql,"INSERT INTO test_bind_result(col2) VALUES('monty')"); + myquery(rc); + rc = mysql_commit(mysql); myquery(rc); @@ -1910,13 +2276,247 @@ void test_bind_result() bind[0].buffer_type=FIELD_TYPE_LONG; bind[0].buffer= (gptr) &nData; /* integer data */ + bind[0].length= (long *)&length; bind[1].buffer_type=FIELD_TYPE_STRING; bind[1].buffer=szData; /* string data */ bind[1].buffer_length=sizeof(szData); + bind[1].length=(long *)&length1; + + strcpy((char *)query , "SELECT * FROM test_bind_result"); + stmt = mysql_prepare(mysql, query, strlen(query)); + mystmt_init(stmt); + + rc = mysql_bind_result(stmt,bind); + mystmt(stmt, rc); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + + rc = mysql_fetch(stmt); + mystmt(stmt,rc); + + fprintf(stdout,"\n row 1: %d,%s(%d)",nData, szData, length1); + myassert(nData == 10); + myassert(strcmp(szData,"venu")==0); + myassert(length1 == 4); + + rc = mysql_fetch(stmt); + mystmt(stmt,rc); + + fprintf(stdout,"\n row 2: %d,%s(%d)",nData, szData, length1); + myassert(nData == 20); + myassert(strcmp(szData,"MySQL")==0); + myassert(length1 == 5); + + length=99; + rc = mysql_fetch(stmt); + mystmt(stmt,rc); + + if (length == MYSQL_NULL_DATA) + fprintf(stdout,"\n row 3: NULL,%s(%d)", szData, length1); + else + fprintf(stdout,"\n row 3: %d,%s(%d)", nData, szData, length1); + myassert(length == MYSQL_NULL_DATA); + myassert(strcmp(szData,"monty")==0); + myassert(length1 == 5); + + rc = mysql_fetch(stmt); + myassert(rc == MYSQL_NO_DATA); + + mysql_stmt_close(stmt); +} + + +/******************************************************** +* to test ext bind result * +*********************************************************/ +static void test_bind_result_ext() +{ + MYSQL_STMT *stmt; + int rc; + const char query[100]; + uchar t_data; + short s_data; + int i_data; + longlong b_data; + float f_data; + double d_data; + char szData[20], bData[20]; + int szLength, bLength; + MYSQL_BIND bind[8]; + + myheader("test_bind_result_ext"); + + init_bind(bind); + rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_bind_result"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"CREATE TABLE test_bind_result(c1 tinyint, c2 smallint, \ + c3 int, c4 bigint, \ + c5 float, c6 double, \ + c7 varbinary(10), \ + c8 varchar(50))"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"INSERT INTO test_bind_result VALUES(19,2999,3999,4999999,\ + 2345.6,5678.89563,\ + 'venu','mysql')"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + bind[0].buffer_type=MYSQL_TYPE_TINY; + bind[0].buffer=(gptr)&t_data; + + bind[1].buffer_type=MYSQL_TYPE_SHORT; + bind[2].buffer_type=MYSQL_TYPE_LONG; + + bind[3].buffer_type=MYSQL_TYPE_LONGLONG; + bind[1].buffer=(gptr)&s_data; + + bind[2].buffer=(gptr)&i_data; + bind[3].buffer=(gptr)&b_data; + + bind[4].buffer_type=MYSQL_TYPE_FLOAT; + bind[4].buffer=(gptr)&f_data; + + bind[5].buffer_type=MYSQL_TYPE_DOUBLE; + bind[5].buffer=(gptr)&d_data; + + bind[6].buffer_type=MYSQL_TYPE_STRING; + bind[6].buffer=(gptr)&szData; + bind[6].length=(long *)&szLength; + + bind[7].buffer_type=MYSQL_TYPE_TINY_BLOB; + bind[7].buffer=(gptr)&bData; + bind[7].length=(long *)&bLength; + + strcpy((char *)query , "SELECT * FROM test_bind_result"); + stmt = mysql_prepare(mysql, query, strlen(query)); + mystmt_init(stmt); + + rc = mysql_bind_result(stmt,bind); + mystmt(stmt, rc); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + + rc = mysql_fetch(stmt); + mystmt(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); + + fprintf(stdout, "\n data (str) : %s(%d)", szData, szLength); + fprintf(stdout, "\n data (bin) : %s(%d)", bData, bLength); + + + myassert(t_data == 19); + myassert(s_data == 2999); + myassert(i_data == 3999); + myassert(b_data == 4999999); + /*myassert(f_data == 2345.60);*/ + /*myassert(d_data == 5678.89563);*/ + myassert(strcmp(szData,"venu")==0); + myassert(strcmp(bData,"mysql")==0); + myassert(szLength == 4); + myassert(bLength == 5); + + rc = mysql_fetch(stmt); + myassert(rc == MYSQL_NO_DATA); + + mysql_stmt_close(stmt); +} + + +/******************************************************** +* to test ext bind result * +*********************************************************/ +static void test_bind_result_ext1() +{ + MYSQL_STMT *stmt; + int rc; + const char query[100]; + char t_data[20]; + float s_data; + short i_data; + short b_data; + int f_data; + long bData; + long length[11]; + char d_data[20]; + double szData; + MYSQL_BIND bind[8]; + + myheader("test_bind_result_ext1"); + + init_bind(bind); + rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_bind_result"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"CREATE TABLE test_bind_result(c1 tinyint, c2 smallint, \ + c3 int, c4 bigint, \ + c5 float, c6 double, \ + c7 varbinary(10), \ + c8 varchar(10))"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"INSERT INTO test_bind_result VALUES(120,2999,3999,54,\ + 2.6,58.89,\ + '206','6.7')"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + bind[0].buffer_type=MYSQL_TYPE_STRING; + bind[0].buffer=(gptr)t_data; + + for (rc=0; rc <= 7; rc++) + bind[rc].length= &length[rc]; + + bind[1].buffer_type=MYSQL_TYPE_FLOAT; + bind[1].buffer=(gptr)&s_data; + + bind[2].buffer_type=MYSQL_TYPE_SHORT; + bind[2].buffer=(gptr)&i_data; + + bind[3].buffer_type=MYSQL_TYPE_TINY; + bind[3].buffer=(gptr)&b_data; + + bind[4].buffer_type=MYSQL_TYPE_LONG; + bind[4].buffer=(gptr)&f_data; + + bind[5].buffer_type=MYSQL_TYPE_STRING; + bind[5].buffer=(gptr)d_data; + + bind[6].buffer_type=MYSQL_TYPE_LONG; + bind[6].buffer=(gptr)&bData; + + bind[7].buffer_type=MYSQL_TYPE_DOUBLE; + bind[7].buffer=(gptr)&szData; strcpy((char *)query , "SELECT * FROM test_bind_result"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); rc = mysql_bind_result(stmt,bind); mystmt(stmt, rc); @@ -1927,19 +2527,1092 @@ void test_bind_result() rc = mysql_fetch(stmt); mystmt(stmt,rc); - printf("\n row 1:%d,%s",nData, szData); - assert(nData == 10); - assert(strcmp(szData,"venu")==0); + fprintf(stdout, "\n data (tiny) : %s(%ld)", t_data, length[0]); + fprintf(stdout, "\n data (short) : %f(%ld)", s_data, length[1]); + fprintf(stdout, "\n data (int) : %d(%ld)", i_data, length[2]); + fprintf(stdout, "\n data (big) : %d(%ld)", b_data, length[3]); + + fprintf(stdout, "\n data (float) : %d(%ld)", f_data, length[4]); + fprintf(stdout, "\n data (double) : %s(%ld)", d_data, length[5]); + + fprintf(stdout, "\n data (bin) : %ld(%ld)", bData, length[6]); + fprintf(stdout, "\n data (str) : %g(%ld)", szData, length[7]); + + myassert(strcmp(t_data,"120")==0); + myassert(i_data == 3999); + myassert(f_data == 2); + myassert(strcmp(d_data,"58.89")==0); + + myassert(length[0] == 3); + myassert(length[1] == 4); + myassert(length[2] == 2); + myassert(length[3] == 1); + myassert(length[4] == 4); + myassert(length[5] == 5); + myassert(length[6] == 4); + myassert(length[7] == 8); + + rc = mysql_fetch(stmt); + myassert(rc == MYSQL_NO_DATA); + + mysql_stmt_close(stmt); +} + +/******************************************************** +* to test fetching of date, time and ts * +*********************************************************/ +static void test_fetch_date() +{ + MYSQL_STMT *stmt; + int rc, year; + char date[25], time[25], ts[25], ts_4[15], ts_6[20], dt[20]; + int d_length, t_length, ts_length, ts4_length, ts6_length, + dt_length, y_length; + + MYSQL_BIND bind[3]; + + myheader("test_fetch_date"); + + init_bind(bind); + rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_bind_result"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"CREATE TABLE test_bind_result(c1 date, c2 time, \ + c3 timestamp(14), \ + c4 year, \ + c5 datetime, \ + c6 timestamp(4), \ + c7 timestamp(6))"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"INSERT INTO test_bind_result VALUES('2002-01-02',\ + '12:49:00',\ + '2002-01-02 17:46:59', \ + 2010,\ + '2010-07-10', \ + '2020','1999-12-29')"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + bind[0].buffer_type=MYSQL_TYPE_STRING; + bind[1]=bind[2]=bind[0]; + + bind[0].buffer=(gptr)&date; + bind[0].length=(long *)&d_length; + + bind[1].buffer=(gptr)&time; + bind[1].length=(long *)&t_length; + + bind[2].buffer=(gptr)&ts; + bind[2].length=(long *)&ts_length; + + bind[3].buffer_type=MYSQL_TYPE_LONG; + bind[3].buffer=(gptr)&year; + bind[3].length=(long *)&y_length; + + bind[4].buffer_type=MYSQL_TYPE_STRING; + bind[4].buffer=(gptr)&dt; + bind[4].length=(long *)&dt_length; + + bind[5].buffer_type=MYSQL_TYPE_STRING; + bind[5].buffer=(gptr)&ts_4; + bind[5].length=(long *)&ts4_length; + + bind[6].buffer_type=MYSQL_TYPE_STRING; + bind[6].buffer=(gptr)&ts_6; + bind[6].length=(long *)&ts6_length; + + myassert(1 == my_stmt_result("SELECT * FROM test_bind_result",50)); + + stmt = mysql_prepare(mysql, "SELECT * FROM test_bind_result", 50); + mystmt_init(stmt); + + rc = mysql_bind_result(stmt,bind); + mystmt(stmt, rc); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + + ts_4[0]='\0'; + rc = mysql_fetch(stmt); + mystmt(stmt,rc); + + fprintf(stdout, "\n date : %s(%d)", date, d_length); + fprintf(stdout, "\n time : %s(%d)", time, t_length); + fprintf(stdout, "\n ts : %s(%d)", ts, ts_length); + fprintf(stdout, "\n year : %d(%d)", year, y_length); + fprintf(stdout, "\n dt : %s(%d)", dt, dt_length); + fprintf(stdout, "\n ts(4) : %s(%d)", ts_4, ts4_length); + fprintf(stdout, "\n ts(6) : %s(%d)", ts_6, ts6_length); + + myassert(strcmp(date,"2002-01-02")==0); + myassert(d_length == 10); + + myassert(strcmp(time,"12:49:00")==0); + myassert(t_length == 8); + + myassert(strcmp(ts,"2002-01-02 17:46:59")==0); + myassert(ts_length == 19); + + myassert(year == 2010); + myassert(y_length == 4); + + myassert(strcmp(dt,"2010-07-10")==0); + myassert(dt_length == 10); + + myassert(ts_4[0] == '\0'); + myassert(ts4_length == 0); + + myassert(strcmp(ts_6,"1999-12-29")==0); + myassert(ts6_length == 10); + + rc = mysql_fetch(stmt); + myassert(rc == MYSQL_NO_DATA); + + mysql_stmt_close(stmt); +} + +/******************************************************** +* to test fetching of str to all types * +*********************************************************/ +static void test_fetch_str() +{ + MYSQL_STMT *stmt; + int rc, i, round, bit; + long data[10], length[10]; + float f_data; + double d_data; + char s_data[10]; + MYSQL_BIND bind[7]; + + myheader("test_fetch_str"); + + init_bind(bind); + rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_bind_str"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"CREATE TABLE test_bind_str(c1 char(10),\ + c2 char(10),\ + c3 char(20),\ + c4 char(20),\ + c5 char(30),\ + c6 char(40),\ + c7 char(20))"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + stmt = mysql_prepare(mysql,"INSERT INTO test_bind_str VALUES(?,?,?,?,?,?,?)",100); + myquery(rc); + + verify_param_count(stmt, 7); + + round= 0; + for (i=0; i < 7; i++) + { + bind[i].buffer_type= MYSQL_TYPE_LONG; + bind[i].buffer= (void *)&data[i]; + data[i]= round+i+1; + round= (round +10)*10; + } + rc = mysql_bind_param(stmt, bind); + mystmt(stmt,rc); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + + rc = mysql_commit(mysql); + myquery(rc); + + mysql_stmt_close(stmt); + + myassert(1 == my_stmt_result("SELECT * FROM test_bind_str",50)); + + stmt = mysql_prepare(mysql,"SELECT * FROM test_bind_str",50); + myquery(rc); + + for (i=0; i < 7; i++) + { + bind[i].buffer= (void *)&data[i]; + bind[i].length= (long *)&length[i]; + } + bind[0].buffer_type= MYSQL_TYPE_TINY; + bind[1].buffer_type= MYSQL_TYPE_SHORT; + bind[2].buffer_type= MYSQL_TYPE_LONG; + bind[3].buffer_type= MYSQL_TYPE_LONGLONG; + + bind[4].buffer_type= MYSQL_TYPE_FLOAT; + bind[4].buffer= (void *)&f_data; + + bind[5].buffer_type= MYSQL_TYPE_DOUBLE; + bind[5].buffer= (void *)&d_data; + + bind[6].buffer_type= MYSQL_TYPE_STRING; + bind[6].buffer= (void *)&s_data; + + rc = mysql_bind_result(stmt, bind); + mystmt(stmt, rc); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + + rc = mysql_fetch(stmt); + mystmt(stmt,rc); + + fprintf(stdout, "\n tiny : %ld(%ld)", data[0], length[0]); + fprintf(stdout, "\n short : %ld(%ld)", data[1], length[1]); + fprintf(stdout, "\n int : %ld(%ld)", data[2], length[2]); + fprintf(stdout, "\n longlong : %ld(%ld)", data[3], length[3]); + fprintf(stdout, "\n float : %f(%ld)", f_data, length[4]); + fprintf(stdout, "\n double : %g(%ld)", d_data, length[5]); + fprintf(stdout, "\n char : %s(%ld)", s_data, length[6]); + + round= 0; + bit= 1; + + for (i=0; i < 4; i++) + { + myassert(data[i] == round+i+1); + myassert(length[i] == bit); + round= (round+10)*10; + bit<<= 1; + } + + /* FLOAT */ + myassert((int)f_data == round+1+i); + myassert(length[4] == 4); + + /* DOUBLE */ + round= (round+10)*10; + myassert((int)d_data == round+2+i); + myassert(length[5] == 8); + + /* CHAR */ + round= (round+10)*10; + { + char buff[20]; + int len= sprintf(buff,"%d", round+3+i); + myassert(strcmp(s_data,buff)==0); + myassert(length[6] == len); + } + + rc = mysql_fetch(stmt); + myassert(rc == MYSQL_NO_DATA); + + mysql_stmt_close(stmt); +} + +/******************************************************** +* to test fetching of long to all types * +*********************************************************/ +static void test_fetch_long() +{ + MYSQL_STMT *stmt; + int rc, i, round, bit; + long data[10], length[10]; + float f_data; + double d_data; + char s_data[10]; + MYSQL_BIND bind[7]; + + myheader("test_fetch_long"); + + init_bind(bind); + rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_bind_long"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"CREATE TABLE test_bind_long(c1 int unsigned,\ + c2 int unsigned,\ + c3 int,\ + c4 int,\ + c5 int,\ + c6 int unsigned,\ + c7 int)"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + stmt = mysql_prepare(mysql,"INSERT INTO test_bind_long VALUES(?,?,?,?,?,?,?)",100); + myquery(rc); + + verify_param_count(stmt, 7); + + round= 0; + for (i=0; i < 7; i++) + { + bind[i].buffer_type= MYSQL_TYPE_LONG; + bind[i].buffer= (void *)&data[i]; + data[i]= round+i+1; + round= (round +10)*10; + } + rc = mysql_bind_param(stmt, bind); + mystmt(stmt,rc); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + + rc = mysql_commit(mysql); + myquery(rc); + + mysql_stmt_close(stmt); + + myassert(1 == my_stmt_result("SELECT * FROM test_bind_long",50)); + + stmt = mysql_prepare(mysql,"SELECT * FROM test_bind_long",50); + myquery(rc); + + for (i=0; i < 7; i++) + { + bind[i].buffer= (void *)&data[i]; + bind[i].length= (long *)&length[i]; + } + bind[0].buffer_type= MYSQL_TYPE_TINY; + bind[1].buffer_type= MYSQL_TYPE_SHORT; + bind[2].buffer_type= MYSQL_TYPE_LONG; + bind[3].buffer_type= MYSQL_TYPE_LONGLONG; + + bind[4].buffer_type= MYSQL_TYPE_FLOAT; + bind[4].buffer= (void *)&f_data; + + bind[5].buffer_type= MYSQL_TYPE_DOUBLE; + bind[5].buffer= (void *)&d_data; + + bind[6].buffer_type= MYSQL_TYPE_STRING; + bind[6].buffer= (void *)&s_data; + + rc = mysql_bind_result(stmt, bind); + mystmt(stmt, rc); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + + rc = mysql_fetch(stmt); + mystmt(stmt,rc); + + fprintf(stdout, "\n tiny : %ld(%ld)", data[0], length[0]); + fprintf(stdout, "\n short : %ld(%ld)", data[1], length[1]); + fprintf(stdout, "\n int : %ld(%ld)", data[2], length[2]); + fprintf(stdout, "\n longlong : %ld(%ld)", data[3], length[3]); + fprintf(stdout, "\n float : %f(%ld)", f_data, length[4]); + fprintf(stdout, "\n double : %g(%ld)", d_data, length[5]); + fprintf(stdout, "\n char : %s(%ld)", s_data, length[6]); + + round= 0; + bit= 1; + + for (i=0; i < 4; i++) + { + myassert(data[i] == round+i+1); + myassert(length[i] == bit); + round= (round+10)*10; + bit<<= 1; + } + + /* FLOAT */ + myassert((int)f_data == round+1+i); + myassert(length[4] == 4); + + /* DOUBLE */ + round= (round+10)*10; + myassert((int)d_data == round+2+i); + myassert(length[5] == 8); + + /* CHAR */ + round= (round+10)*10; + { + char buff[20]; + int len= sprintf(buff,"%d", round+3+i); + myassert(strcmp(s_data,buff)==0); + myassert(length[6] == len); + } + + rc = mysql_fetch(stmt); + myassert(rc == MYSQL_NO_DATA); + + mysql_stmt_close(stmt); +} + +/******************************************************** +* to test fetching of short to all types * +*********************************************************/ +static void test_fetch_short() +{ + MYSQL_STMT *stmt; + int rc, i, round, bit; + long data[10], length[10]; + float f_data; + double d_data; + char s_data[10]; + MYSQL_BIND bind[7]; + + myheader("test_fetch_short"); + + init_bind(bind); + rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_bind_long"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"CREATE TABLE test_bind_long(c1 smallint unsigned,\ + c2 smallint,\ + c3 smallint unsigned,\ + c4 smallint,\ + c5 smallint,\ + c6 smallint,\ + c7 smallint unsigned)"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + stmt = mysql_prepare(mysql,"INSERT INTO test_bind_long VALUES(?,?,?,?,?,?,?)",100); + myquery(rc); + + verify_param_count(stmt, 7); + + round= 0; + for (i=0; i < 7; i++) + { + bind[i].buffer_type= MYSQL_TYPE_LONG; + bind[i].buffer= (void *)&data[i]; + data[i]= round+i+1; + round= (round +10)*2; + } + rc = mysql_bind_param(stmt, bind); + mystmt(stmt,rc); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + + rc = mysql_commit(mysql); + myquery(rc); + + mysql_stmt_close(stmt); + + myassert(1 == my_stmt_result("SELECT * FROM test_bind_long",50)); + + stmt = mysql_prepare(mysql,"SELECT * FROM test_bind_long",50); + myquery(rc); + + for (i=0; i < 7; i++) + { + bind[i].buffer= (void *)&data[i]; + bind[i].length= (long *)&length[i]; + } + bind[0].buffer_type= MYSQL_TYPE_TINY; + bind[1].buffer_type= MYSQL_TYPE_SHORT; + bind[2].buffer_type= MYSQL_TYPE_LONG; + bind[3].buffer_type= MYSQL_TYPE_LONGLONG; + + bind[4].buffer_type= MYSQL_TYPE_FLOAT; + bind[4].buffer= (void *)&f_data; + + bind[5].buffer_type= MYSQL_TYPE_DOUBLE; + bind[5].buffer= (void *)&d_data; + + bind[6].buffer_type= MYSQL_TYPE_STRING; + bind[6].buffer= (void *)&s_data; + + rc = mysql_bind_result(stmt, bind); + mystmt(stmt, rc); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + + rc = mysql_fetch(stmt); + mystmt(stmt,rc); + + fprintf(stdout, "\n tiny : %ld(%ld)", data[0], length[0]); + fprintf(stdout, "\n short : %ld(%ld)", data[1], length[1]); + fprintf(stdout, "\n int : %ld(%ld)", data[2], length[2]); + fprintf(stdout, "\n longlong : %ld(%ld)", data[3], length[3]); + fprintf(stdout, "\n float : %f(%ld)", f_data, length[4]); + fprintf(stdout, "\n double : %g(%ld)", d_data, length[5]); + fprintf(stdout, "\n char : %s(%ld)", s_data, length[6]); + + round= 0; + bit= 1; + + for (i=0; i < 4; i++) + { + myassert(data[i] == round+i+1); + myassert(length[i] == bit); + round= (round+10)*2; + bit<<= 1; + } + + /* FLOAT */ + myassert((int)f_data == round+1+i); + myassert(length[4] == 4); + + /* DOUBLE */ + round= (round+10)*2; + myassert((int)d_data == round+2+i); + myassert(length[5] == 8); + + /* CHAR */ + round= (round+10)*2; + { + char buff[20]; + int len= sprintf(buff,"%d", round+3+i); + myassert(strcmp(s_data,buff)==0); + myassert(length[6] == len); + } + + rc = mysql_fetch(stmt); + myassert(rc == MYSQL_NO_DATA); + + mysql_stmt_close(stmt); +} + +/******************************************************** +* to test fetching of tiny to all types * +*********************************************************/ +static void test_fetch_tiny() +{ + MYSQL_STMT *stmt; + int rc, i, bit; + long data[10], length[10]; + float f_data; + double d_data; + char s_data[10]; + MYSQL_BIND bind[7]; + + myheader("test_fetch_tiny"); + + init_bind(bind); + rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_bind_long"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"CREATE TABLE test_bind_long(c1 tinyint unsigned,\ + c2 tinyint,\ + c3 tinyint unsigned,\ + c4 tinyint,\ + c5 tinyint,\ + c6 tinyint,\ + c7 tinyint unsigned)"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + stmt = mysql_prepare(mysql,"INSERT INTO test_bind_long VALUES(?,?,?,?,?,?,?)",100); + myquery(rc); + + verify_param_count(stmt, 7); + + rc= 10; + for (i=0; i < 7; i++) + { + bind[i].buffer_type= MYSQL_TYPE_LONG; + bind[i].buffer= (void *)&data[i]; + data[i]= rc+i; + rc+= 10; + } + rc = mysql_bind_param(stmt, bind); + mystmt(stmt,rc); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + + rc = mysql_commit(mysql); + myquery(rc); + + mysql_stmt_close(stmt); + + myassert(1 == my_stmt_result("SELECT * FROM test_bind_long",50)); + + stmt = mysql_prepare(mysql,"SELECT * FROM test_bind_long",50); + myquery(rc); + + for (i=0; i < 7; i++) + { + bind[i].buffer= (void *)&data[i]; + bind[i].length= (long *)&length[i]; + } + bind[0].buffer_type= MYSQL_TYPE_TINY; + bind[1].buffer_type= MYSQL_TYPE_SHORT; + bind[2].buffer_type= MYSQL_TYPE_LONG; + bind[3].buffer_type= MYSQL_TYPE_LONGLONG; + + bind[4].buffer_type= MYSQL_TYPE_FLOAT; + bind[4].buffer= (void *)&f_data; + + bind[5].buffer_type= MYSQL_TYPE_DOUBLE; + bind[5].buffer= (void *)&d_data; + + bind[6].buffer_type= MYSQL_TYPE_STRING; + bind[6].buffer= (void *)&s_data; + + rc = mysql_bind_result(stmt, bind); + mystmt(stmt, rc); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + + rc = mysql_fetch(stmt); + mystmt(stmt,rc); + + fprintf(stdout, "\n tiny : %ld(%ld)", data[0], length[0]); + fprintf(stdout, "\n short : %ld(%ld)", data[1], length[1]); + fprintf(stdout, "\n int : %ld(%ld)", data[2], length[2]); + fprintf(stdout, "\n longlong : %ld(%ld)", data[3], length[3]); + fprintf(stdout, "\n float : %f(%ld)", f_data, length[4]); + fprintf(stdout, "\n double : %g(%ld)", d_data, length[5]); + fprintf(stdout, "\n char : %s(%ld)", s_data, length[6]); + + bit= 1; + rc= 10; + for (i=0; i < 4; i++) + { + myassert(data[i] == rc+i); + myassert(length[i] == bit); + bit<<= 1; + rc+= 10; + } + + /* FLOAT */ + rc+= i; + myassert((int)f_data == rc); + myassert(length[4] == 4); + + /* DOUBLE */ + rc+= 11; + myassert((int)d_data == rc); + myassert(length[5] == 8); + + /* CHAR */ + rc+= 11; + { + char buff[20]; + int len= sprintf(buff,"%d", rc); + myassert(strcmp(s_data,buff)==0); + myassert(length[6] == len); + } + + rc = mysql_fetch(stmt); + myassert(rc == MYSQL_NO_DATA); + + mysql_stmt_close(stmt); +} + +/******************************************************** +* to test fetching of longlong to all types * +*********************************************************/ +static void test_fetch_bigint() +{ + MYSQL_STMT *stmt; + int rc, i, round, bit; + long data[10], length[10]; + float f_data; + double d_data; + char s_data[10]; + MYSQL_BIND bind[7]; + + myheader("test_fetch_bigint"); + + init_bind(bind); + rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_bind_long"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"CREATE TABLE test_bind_long(c1 bigint,\ + c2 bigint,\ + c3 bigint unsigned,\ + c4 bigint unsigned,\ + c5 bigint unsigned,\ + c6 bigint unsigned,\ + c7 bigint unsigned)"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + stmt = mysql_prepare(mysql,"INSERT INTO test_bind_long VALUES(?,?,?,?,?,?,?)",100); + myquery(rc); + + verify_param_count(stmt, 7); + + round= 0; + for (i=0; i < 7; i++) + { + bind[i].buffer_type= MYSQL_TYPE_LONG; + bind[i].buffer= (void *)&data[i]; + data[i]= round+i+1; + round= (round +10)*10; + } + rc = mysql_bind_param(stmt, bind); + mystmt(stmt,rc); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + + rc = mysql_commit(mysql); + myquery(rc); + + mysql_stmt_close(stmt); + + myassert(1 == my_stmt_result("SELECT * FROM test_bind_long",50)); + + stmt = mysql_prepare(mysql,"SELECT * FROM test_bind_long",50); + myquery(rc); + + for (i=0; i < 7; i++) + { + bind[i].buffer= (void *)&data[i]; + bind[i].length= (long *)&length[i]; + } + bind[0].buffer_type= MYSQL_TYPE_TINY; + bind[1].buffer_type= MYSQL_TYPE_SHORT; + bind[2].buffer_type= MYSQL_TYPE_LONG; + bind[3].buffer_type= MYSQL_TYPE_LONGLONG; + + bind[4].buffer_type= MYSQL_TYPE_FLOAT; + bind[4].buffer= (void *)&f_data; + + bind[5].buffer_type= MYSQL_TYPE_DOUBLE; + bind[5].buffer= (void *)&d_data; + + bind[6].buffer_type= MYSQL_TYPE_STRING; + bind[6].buffer= (void *)&s_data; + + rc = mysql_bind_result(stmt, bind); + mystmt(stmt, rc); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + + rc = mysql_fetch(stmt); + mystmt(stmt,rc); + + fprintf(stdout, "\n tiny : %ld(%ld)", data[0], length[0]); + fprintf(stdout, "\n short : %ld(%ld)", data[1], length[1]); + fprintf(stdout, "\n int : %ld(%ld)", data[2], length[2]); + fprintf(stdout, "\n longlong : %ld(%ld)", data[3], length[3]); + fprintf(stdout, "\n float : %f(%ld)", f_data, length[4]); + fprintf(stdout, "\n double : %g(%ld)", d_data, length[5]); + fprintf(stdout, "\n char : %s(%ld)", s_data, length[6]); + + round= 0; + bit= 1; + + for (i=0; i < 4; i++) + { + myassert(data[i] == round+i+1); + myassert(length[i] == bit); + round= (round+10)*10; + bit<<= 1; + } + + /* FLOAT */ + myassert((int)f_data == round+1+i); + myassert(length[4] == 4); + + /* DOUBLE */ + round= (round+10)*10; + myassert((int)d_data == round+2+i); + myassert(length[5] == 8); + + /* CHAR */ + round= (round+10)*10; + { + char buff[20]; + int len= sprintf(buff,"%d", round+3+i); + myassert(strcmp(s_data,buff)==0); + myassert(length[6] == len); + } + + rc = mysql_fetch(stmt); + myassert(rc == MYSQL_NO_DATA); + + mysql_stmt_close(stmt); +} + +/******************************************************** +* to test fetching of float to all types * +*********************************************************/ +static void test_fetch_float() +{ + MYSQL_STMT *stmt; + int rc, i, round, bit; + long data[10], length[10]; + float f_data; + double d_data; + char s_data[10]; + MYSQL_BIND bind[7]; + + myheader("test_fetch_float"); + + init_bind(bind); + rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_bind_long"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"CREATE TABLE test_bind_long(c1 float(3),\ + c2 float,\ + c3 float unsigned,\ + c4 float,\ + c5 float,\ + c6 float,\ + c7 float(10) unsigned)"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + stmt = mysql_prepare(mysql,"INSERT INTO test_bind_long VALUES(?,?,?,?,?,?,?)",100); + myquery(rc); + + verify_param_count(stmt, 7); + + round= 0; + for (i=0; i < 7; i++) + { + bind[i].buffer_type= MYSQL_TYPE_LONG; + bind[i].buffer= (void *)&data[i]; + data[i]= round+i+1; + round= (round +10)*2; + } + rc = mysql_bind_param(stmt, bind); + mystmt(stmt,rc); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + + rc = mysql_commit(mysql); + myquery(rc); + + mysql_stmt_close(stmt); + + myassert(1 == my_stmt_result("SELECT * FROM test_bind_long",50)); + + stmt = mysql_prepare(mysql,"SELECT * FROM test_bind_long",50); + myquery(rc); + + for (i=0; i < 7; i++) + { + bind[i].buffer= (void *)&data[i]; + bind[i].length= (long *)&length[i]; + } + bind[0].buffer_type= MYSQL_TYPE_TINY; + bind[1].buffer_type= MYSQL_TYPE_SHORT; + bind[2].buffer_type= MYSQL_TYPE_LONG; + bind[3].buffer_type= MYSQL_TYPE_LONGLONG; + + bind[4].buffer_type= MYSQL_TYPE_FLOAT; + bind[4].buffer= (void *)&f_data; + + bind[5].buffer_type= MYSQL_TYPE_DOUBLE; + bind[5].buffer= (void *)&d_data; + + bind[6].buffer_type= MYSQL_TYPE_STRING; + bind[6].buffer= (void *)&s_data; + + rc = mysql_bind_result(stmt, bind); + mystmt(stmt, rc); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + + rc = mysql_fetch(stmt); + mystmt(stmt,rc); + + fprintf(stdout, "\n tiny : %ld(%ld)", data[0], length[0]); + fprintf(stdout, "\n short : %ld(%ld)", data[1], length[1]); + fprintf(stdout, "\n int : %ld(%ld)", data[2], length[2]); + fprintf(stdout, "\n longlong : %ld(%ld)", data[3], length[3]); + fprintf(stdout, "\n float : %f(%ld)", f_data, length[4]); + fprintf(stdout, "\n double : %g(%ld)", d_data, length[5]); + fprintf(stdout, "\n char : %s(%ld)", s_data, length[6]); + + round= 0; + bit= 1; + + for (i=0; i < 4; i++) + { + myassert(data[i] == round+i+1); + myassert(length[i] == bit); + round= (round+10)*2; + bit<<= 1; + } + + /* FLOAT */ + myassert((int)f_data == round+1+i); + myassert(length[4] == 4); + + /* DOUBLE */ + round= (round+10)*2; + myassert((int)d_data == round+2+i); + myassert(length[5] == 8); + + /* CHAR */ + round= (round+10)*2; + { + char buff[20]; + int len= sprintf(buff,"%d", round+3+i); + myassert(strcmp(s_data,buff)==0); + myassert(length[6] == len); + } + + rc = mysql_fetch(stmt); + myassert(rc == MYSQL_NO_DATA); + + mysql_stmt_close(stmt); +} + +/******************************************************** +* to test fetching of double to all types * +*********************************************************/ +static void test_fetch_double() +{ + MYSQL_STMT *stmt; + int rc, i, round, bit; + long data[10], length[10]; + float f_data; + double d_data; + char s_data[10]; + MYSQL_BIND bind[7]; + + myheader("test_fetch_double"); + + init_bind(bind); + rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_bind_long"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"CREATE TABLE test_bind_long(c1 double(5,2),\ + c2 double unsigned,\ + c3 double unsigned,\ + c4 double unsigned,\ + c5 double unsigned,\ + c6 double unsigned,\ + c7 double unsigned)"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + stmt = mysql_prepare(mysql,"INSERT INTO test_bind_long VALUES(?,?,?,?,?,?,?)",100); + myquery(rc); + + verify_param_count(stmt, 7); + + round= 0; + for (i=0; i < 7; i++) + { + bind[i].buffer_type= MYSQL_TYPE_LONG; + bind[i].buffer= (void *)&data[i]; + data[i]= round+i+1; + round= (round +10)*10; + } + rc = mysql_bind_param(stmt, bind); + mystmt(stmt,rc); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + + rc = mysql_commit(mysql); + myquery(rc); + + mysql_stmt_close(stmt); + + myassert(1 == my_stmt_result("SELECT * FROM test_bind_long",50)); + + stmt = mysql_prepare(mysql,"SELECT * FROM test_bind_long",50); + myquery(rc); + + for (i=0; i < 7; i++) + { + bind[i].buffer= (void *)&data[i]; + bind[i].length= (long *)&length[i]; + } + bind[0].buffer_type= MYSQL_TYPE_TINY; + bind[1].buffer_type= MYSQL_TYPE_SHORT; + bind[2].buffer_type= MYSQL_TYPE_LONG; + bind[3].buffer_type= MYSQL_TYPE_LONGLONG; + + bind[4].buffer_type= MYSQL_TYPE_STRING; + bind[4].buffer= (void *)&s_data; + + bind[5].buffer_type= MYSQL_TYPE_FLOAT; + bind[5].buffer= (void *)&f_data; + + bind[6].buffer_type= MYSQL_TYPE_DOUBLE; + bind[6].buffer= (void *)&d_data; + + rc = mysql_bind_result(stmt, bind); + mystmt(stmt, rc); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); rc = mysql_fetch(stmt); mystmt(stmt,rc); - printf("\n row 2:%d,%s",nData, szData); - assert(nData == 20); - assert(strcmp(szData,"MySQL")==0); + fprintf(stdout, "\n tiny : %ld(%ld)", data[0], length[0]); + fprintf(stdout, "\n short : %ld(%ld)", data[1], length[1]); + fprintf(stdout, "\n int : %ld(%ld)", data[2], length[2]); + fprintf(stdout, "\n longlong : %ld(%ld)", data[3], length[3]); + fprintf(stdout, "\n float : %f(%ld)", f_data, length[5]); + fprintf(stdout, "\n double : %g(%ld)", d_data, length[6]); + fprintf(stdout, "\n char : %s(%ld)", s_data, length[4]); + + round= 0; + bit= 1; + + for (i=0; i < 4; i++) + { + myassert(data[i] == round+i+1); + myassert(length[i] == bit); + round= (round+10)*10; + bit<<= 1; + } + /* CHAR */ + { + char buff[20]; + int len= sprintf(buff,"%d", round+1+i); + myassert(strcmp(s_data,buff)==0); + myassert(length[4] == len); + } + + /* FLOAT */ + round= (round+10)*10; + myassert((int)f_data == round+2+i); + myassert(length[5] == 4); + + /* DOUBLE */ + round= (round+10)*10; + myassert((int)d_data == round+3+i); + myassert(length[6] == 8); rc = mysql_fetch(stmt); - assert(rc == MYSQL_NO_DATA); + myassert(rc == MYSQL_NO_DATA); mysql_stmt_close(stmt); } @@ -1947,10 +3620,10 @@ void test_bind_result() /******************************************************** * to test simple prepare with all possible types * *********************************************************/ -void test_prepare_ext() +static void test_prepare_ext() { MYSQL_STMT *stmt; - int rc,param_count; + int rc; char *sql; int nData=1; MYSQL_RES *result; @@ -2012,9 +3685,7 @@ void test_prepare_ext() stmt = mysql_prepare(mysql,query, strlen(query)); myquery(rc); - param_count = mysql_param_count(stmt); - fprintf(stdout," total parameters in insert:%d\n", param_count); - assert(param_count == 6); + verify_param_count(stmt,6); /*tinyint*/ bind_int[0].buffer_type=FIELD_TYPE_TINY; @@ -2065,7 +3736,7 @@ void test_prepare_ext() result = mysql_store_result(mysql); mytest(result); - assert(nData == my_process_result_set(result)); + myassert(nData == my_process_result_set(result)); mysql_free_result(result); } @@ -2075,14 +3746,14 @@ void test_prepare_ext() /******************************************************** * to test real and alias names * *********************************************************/ -void test_field_names() +static void test_field_names() { int rc; MYSQL_RES *result; myheader("test_field_names"); - printf("\n%d,%d,%d",MYSQL_TYPE_DECIMAL,MYSQL_TYPE_NEWDATE,MYSQL_TYPE_ENUM); + 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); @@ -2108,7 +3779,7 @@ void test_field_names() result = mysql_use_result(mysql); mytest(result); - assert(0 == my_process_result_set(result)); + myassert(0 == my_process_result_set(result)); mysql_free_result(result); /* with table name included with true column name */ @@ -2118,23 +3789,20 @@ void test_field_names() result = mysql_use_result(mysql); mytest(result); - assert(0 == my_process_result_set(result)); + myassert(0 == my_process_result_set(result)); mysql_free_result(result); } /******************************************************** * to test warnings * *********************************************************/ -void test_warnings() +static void test_warnings() { int rc; MYSQL_RES *result; myheader("test_warnings"); - rc = mysql_query(mysql,"USE test"); - myquery(rc); - rc = mysql_query(mysql,"SHOW WARNINGS"); myquery(rc); @@ -2148,7 +3816,7 @@ void test_warnings() /******************************************************** * to test errors * *********************************************************/ -void test_errors() +static void test_errors() { int rc; MYSQL_RES *result; @@ -2170,10 +3838,10 @@ void test_errors() /******************************************************** * to test simple prepare-insert * *********************************************************/ -void test_insert() +static void test_insert() { MYSQL_STMT *stmt; - int rc,param_count, length; + int rc, length; char query[200]; char str_data[50]; char tiny_data; @@ -2199,11 +3867,9 @@ void test_insert() bzero(bind, sizeof(bind)); strcpy(query,"INSERT INTO test_prep_insert VALUES(?,?)"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout," total parameters in insert:%d\n", param_count); - assert(param_count == 2); + verify_param_count(stmt,2); /* tinyint */ bind[0].buffer_type=FIELD_TYPE_TINY; @@ -2238,7 +3904,7 @@ void test_insert() result = mysql_store_result(mysql); mytest(result); - assert((int)tiny_data == my_process_result_set(result)); + myassert((int)tiny_data == my_process_result_set(result)); mysql_free_result(result); } @@ -2246,10 +3912,10 @@ void test_insert() /******************************************************** * to test simple prepare-resultset info * *********************************************************/ -void test_prepare_resultset() +static void test_prepare_resultset() { MYSQL_STMT *stmt; - int rc,param_count; + int rc; char query[200]; MYSQL_RES *result; @@ -2268,38 +3934,15 @@ void test_prepare_resultset() name varchar(50),extra double)"); myquery(rc); - /* insert by prepare */ - strcpy(query,"INSERT INTO test_prepare_resultset(id,name) VALUES(?,?)"); - stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); - - param_count = mysql_param_count(stmt); - fprintf(stdout," total parameters in insert:%d\n", param_count); - assert(param_count == 2); + strcpy(query,"SELECT * FROM test_prepare_resultset"); + stmt = PREPARE(mysql, query); + mystmt_init(stmt); - rc = mysql_query(mysql,"SELECT * FROM test_prepare_resultset"); - myquery(rc); + verify_param_count(stmt,0); - /* get the prepared-result */ result = mysql_prepare_result(stmt); - assert( result != 0); - - my_print_result_metadata(result); - mysql_free_result(result); - - result = mysql_store_result(mysql); mytest(result); - - assert(0 == my_process_result_set(result)); - mysql_free_result(result); - - /* get the prepared-result */ - result = mysql_prepare_result(stmt); - assert( result != 0); - my_print_result_metadata(result); - mysql_free_result(result); - mysql_stmt_close(stmt); } @@ -2307,7 +3950,7 @@ void test_prepare_resultset() * to test field flags (verify .NET provider) * *********************************************************/ -void test_field_flags() +static void test_field_flags() { int rc; MYSQL_RES *result; @@ -2348,22 +3991,614 @@ void test_field_flags() for(i=0; i< mysql_num_fields(result); i++) { field = mysql_fetch_field(result); - printf("\nfield:%d",i); + fprintf(stdout,"\n field:%d",i); if(field->flags & NOT_NULL_FLAG) - printf("\n NOT_NULL_FLAG"); + fprintf(stdout,"\n NOT_NULL_FLAG"); if(field->flags & PRI_KEY_FLAG) - printf("\n PRI_KEY_FLAG"); + fprintf(stdout,"\n PRI_KEY_FLAG"); if(field->flags & UNIQUE_KEY_FLAG) - printf("\n UNIQUE_KEY_FLAG"); + fprintf(stdout,"\n UNIQUE_KEY_FLAG"); if(field->flags & MULTIPLE_KEY_FLAG) - printf("\n MULTIPLE_KEY_FLAG"); + fprintf(stdout,"\n MULTIPLE_KEY_FLAG"); if(field->flags & AUTO_INCREMENT_FLAG) - printf("\n AUTO_INCREMENT_FLAG"); + fprintf(stdout,"\n AUTO_INCREMENT_FLAG"); } mysql_free_result(result); } +/************************************************************** + * Test mysql_stmt_close for open stmts * +**************************************************************/ +static void test_stmt_close() +{ + MYSQL *lmysql; + MYSQL_STMT *stmt1, *stmt2, *stmt3, *stmt_x; + MYSQL_BIND param[1]; + MYSQL_RES *result; + char query[100]; + unsigned int count; + int rc; + + myheader("test_stmt_close"); + + init_bind(param); + if(!(lmysql = mysql_init(NULL))) + { + myerror("mysql_init() failed"); + exit(0); + } + if (!(mysql_real_connect(lmysql,opt_host,opt_user, + opt_password, opt_db ? opt_db:"inter_client_test_db", opt_port, + opt_unix_socket, 0))) + { + myerror("connection failed"); + exit(0); + } + if (opt_db) + strcpy(current_db,opt_db); + + /* set AUTOCOMMIT to ON*/ + mysql_autocommit(lmysql, true); + mysql_query(lmysql,"DROP TABLE IF EXISTS test_stmt_close"); + mysql_query(lmysql,"CREATE TABLE test_stmt_close(id int)"); + + strcpy(query,"ALTER TABLE test_stmt_close ADD name varchar(20)"); + stmt1= PREPARE(lmysql, query); + mystmt_init(stmt1); + count= mysql_param_count(stmt1); + fprintf(stdout,"\n total params in alter: %d", count); + myassert(count == 0); + strcpy(query,"INSERT INTO test_stmt_close(id) VALUES(?)"); + stmt_x= PREPARE(mysql, query); + mystmt_init(stmt_x); + count= mysql_param_count(stmt_x); + fprintf(stdout,"\n total params in insert: %d", count); + myassert(count == 1); + strcpy(query,"UPDATE test_stmt_close SET id=? WHERE id=?"); + stmt3= PREPARE(lmysql, query); + mystmt_init(stmt3); + count= mysql_param_count(stmt3); + fprintf(stdout,"\n total params in update: %d", count); + myassert(count == 2); + strcpy(query,"SELECT * FROM test_stmt_close WHERE id=?"); + stmt2= PREPARE(lmysql, query); + mystmt_init(stmt2); + count= mysql_param_count(stmt2); + fprintf(stdout,"\n total params in select: %d", count); + myassert(count == 1); + + rc= mysql_stmt_close(stmt1); + fprintf(stdout,"\n mysql_close_stmt(1) returned: %d", rc); + myassert(rc == 0); + mysql_close(lmysql); /* it should free all stmts */ +#if NOT_VALID + rc= mysql_stmt_close(stmt3); + fprintf(stdout,"\n mysql_close_stmt(3) returned: %d", rc); + myassert( rc == 1); + rc= mysql_stmt_close(stmt2); + fprintf(stdout,"\n mysql_close_stmt(2) returned: %d", rc); + myassert( rc == 1); +#endif + + count= 100; + param[0].buffer=(gptr)&count; + param[0].buffer_type=MYSQL_TYPE_LONG; + rc = mysql_bind_param(stmt_x, param); + mystmt(stmt_x, rc); + rc = mysql_execute(stmt_x); + mystmt(stmt_x, rc); + + rc= (ulong)mysql_affected_rows(stmt_x->mysql); + fprintf(stdout,"\n total rows affected: %d", rc); + myassert (rc == 1); + + rc= mysql_stmt_close(stmt_x); + fprintf(stdout,"\n mysql_close_stmt(x) returned: %d", rc); + myassert( rc == 0); + + /*verify_col_data("test_stmt_close", "id", "100");*/ + rc = mysql_query(mysql,"SELECT id FROM test_stmt_close"); + myquery(rc); + + result = mysql_store_result(mysql); + mytest(result); + + myassert(1 == my_process_result_set(result)); + mysql_free_result(result); +} + +/******************************************************** + * To test simple set-variable prepare * +*********************************************************/ +static void test_set_variable() +{ + MYSQL_STMT *stmt; + int rc, select_limit=88; + char query[200]; + MYSQL_BIND bind[1]; + MYSQL_RES *result; + + + myheader("test_set_variable"); + + rc = mysql_autocommit(mysql, true); + myquery(rc); + + strcpy(query,"SET GLOBAL delayed_insert_limit=?"); + stmt = mysql_prepare(mysql, query, strlen(query)); + mystmt_init(stmt); + + verify_param_count(stmt,1); + + result= mysql_param_result(stmt); + mytest_r(result); + + init_bind(bind); + + bind[0].buffer_type= MYSQL_TYPE_LONG; + bind[0].buffer=(gptr)&select_limit; + + rc = mysql_bind_param(stmt, bind); + mystmt(stmt,rc); + + rc= mysql_execute(stmt); + mystmt(stmt,rc); + + mysql_store_result(mysql); + + strcpy(query,"show variables like 'delayed_insert_limit'"); + rc = mysql_query(mysql,query); + myquery(rc); + + verify_col_data(NullS, NullS, "88"); + +#if TO_BE_FIXED + + select_limit= 100;/* reset to default */ + rc= mysql_execute(stmt); + mystmt(stmt,rc); + + mysql_store_result(mysql); + mysql_stmt_close(stmt); + + rc = mysql_query(mysql,query); + myquery(rc); + + verify_col_data(NullS, NullS, "100"); +#endif + mysql_stmt_close(stmt); +} +#if NOT_USED +/* Insert meta info .. */ +static void test_insert_meta() +{ + MYSQL_STMT *stmt; + int rc; + char query[200]; + MYSQL_RES *result; + MYSQL_FIELD *field; + + myheader("test_insert_meta"); + + rc = mysql_autocommit(mysql, true); + myquery(rc); + + rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_prep_insert"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"CREATE TABLE test_prep_insert(col1 tinyint,\ + col2 varchar(50), col3 varchar(30))"); + myquery(rc); + + strcpy(query,"INSERT INTO test_prep_insert VALUES(10,'venu1','test')"); + stmt = mysql_prepare(mysql, query, strlen(query)); + mystmt_init(stmt); + + verify_param_count(stmt,0); + + result= mysql_param_result(stmt); + mytest_r(result); + + strcpy(query,"INSERT INTO test_prep_insert VALUES(?,'venu',?)"); + stmt = mysql_prepare(mysql, query, strlen(query)); + mystmt_init(stmt); + + verify_param_count(stmt,2); + + result= mysql_param_result(stmt); + mytest(result); + + my_print_result_metadata(result); + + mysql_field_seek(result, 0); + field= mysql_fetch_field(result); + mytest(field); + fprintf(stdout, "\n obtained: `%s` (expected: `%s`)", field->name, "col1"); + myassert(strcmp(field->name,"col1")==0); + + field= mysql_fetch_field(result); + mytest(field); + fprintf(stdout, "\n obtained: `%s` (expected: `%s`)", field->name, "col3"); + myassert(strcmp(field->name,"col3")==0); + + field= mysql_fetch_field(result); + mytest_r(field); + + mysql_free_result(result); + mysql_stmt_close(stmt); +} + +/* Update meta info .. */ +static void test_update_meta() +{ + MYSQL_STMT *stmt; + int rc; + char query[200]; + MYSQL_RES *result; + MYSQL_FIELD *field; + + myheader("test_update_meta"); + + rc = mysql_autocommit(mysql, true); + myquery(rc); + + rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_prep_update"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"CREATE TABLE test_prep_update(col1 tinyint,\ + col2 varchar(50), col3 varchar(30))"); + myquery(rc); + + strcpy(query,"UPDATE test_prep_update SET col1=10, col2='venu1' WHERE col3='test'"); + stmt = mysql_prepare(mysql, query, strlen(query)); + mystmt_init(stmt); + + verify_param_count(stmt,0); + + result= mysql_param_result(stmt); + mytest_r(result); + + strcpy(query,"UPDATE test_prep_update SET col1=?, col2='venu' WHERE col3=?"); + stmt = mysql_prepare(mysql, query, strlen(query)); + mystmt_init(stmt); + + verify_param_count(stmt,2); + + result= mysql_param_result(stmt); + mytest(result); + + my_print_result_metadata(result); + + 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"); + myassert(strcmp(field->name,"col1")==0); + myassert(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"); + myassert(strcmp(field->name,"col3")==0); + myassert(strcmp(field->table,"test_prep_update")==0); + + field= mysql_fetch_field(result); + mytest_r(field); + + mysql_free_result(result); + mysql_stmt_close(stmt); +} + +/* Select meta info .. */ +static void test_select_meta() +{ + MYSQL_STMT *stmt; + int rc; + char query[200]; + MYSQL_RES *result; + MYSQL_FIELD *field; + + myheader("test_select_meta"); + + rc = mysql_autocommit(mysql, true); + myquery(rc); + + rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_prep_select"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"CREATE TABLE test_prep_select(col1 tinyint,\ + col2 varchar(50), col3 varchar(30))"); + myquery(rc); + + strcpy(query,"SELECT * FROM test_prep_select WHERE col1=10"); + stmt = mysql_prepare(mysql, query, strlen(query)); + mystmt_init(stmt); + + verify_param_count(stmt,0); + + result= mysql_param_result(stmt); + mytest_r(result); + + strcpy(query,"SELECT col1, col3 from test_prep_select WHERE col1=? AND col3='test' AND col2= ?"); + stmt = mysql_prepare(mysql, query, strlen(query)); + mystmt_init(stmt); + + verify_param_count(stmt,2); + + result= mysql_param_result(stmt); + mytest(result); + + my_print_result_metadata(result); + + 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"); + myassert(strcmp(field->name,"col1")==0); + myassert(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"); + myassert(strcmp(field->name,"col2")==0); + myassert(strcmp(field->table,"test_prep_select")==0); + + field= mysql_fetch_field(result); + mytest_r(field); + + mysql_free_result(result); + mysql_stmt_close(stmt); +} +#endif + +/* Test FUNCTION field info / DATE_FORMAT() table_name . */ +static void test_func_fields() +{ + int rc; + MYSQL_RES *result; + MYSQL_FIELD *field; + + myheader("test_func_fields"); + + rc = mysql_autocommit(mysql, true); + myquery(rc); + + rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_dateformat"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"CREATE TABLE test_dateformat(id int, \ + ts timestamp)"); + myquery(rc); + + rc = mysql_query(mysql, "INSERT INTO test_dateformat(id) values(10)"); + myquery(rc); + + rc = mysql_query(mysql, "SELECT ts FROM test_dateformat"); + myquery(rc); + + result = mysql_store_result(mysql); + mytest(result); + + field = mysql_fetch_field(result); + mytest(field); + fprintf(stdout,"\n table name: `%s` (expected: `%s`)", field->table, + "test_dateformat"); + myassert(strcmp(field->table, "test_dateformat")==0); + + field = mysql_fetch_field(result); + mytest_r(field); /* no more fields */ + + mysql_free_result(result); + + /* DATE_FORMAT */ + rc = mysql_query(mysql, "SELECT DATE_FORMAT(ts,'%Y') AS 'venu' FROM test_dateformat"); + myquery(rc); + + result = mysql_store_result(mysql); + mytest(result); + + field = mysql_fetch_field(result); + mytest(field); + fprintf(stdout,"\n table name: `%s` (expected: `%s`)", field->table, ""); + myassert(field->table[0] == '\0'); + + field = mysql_fetch_field(result); + mytest_r(field); /* no more fields */ + + mysql_free_result(result); + + /* FIELD ALIAS TEST */ + rc = mysql_query(mysql, "SELECT DATE_FORMAT(ts,'%Y') AS 'YEAR' FROM test_dateformat"); + myquery(rc); + + result = mysql_store_result(mysql); + mytest(result); + + 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,""); + myassert(strcmp(field->name, "YEAR")==0); + myassert(field->org_name[0] == '\0'); + + field = mysql_fetch_field(result); + mytest_r(field); /* no more fields */ + + mysql_free_result(result); +} + +/* Multiple stmts .. */ +static void test_multi_stmt() +{ +} + +/******************************************************** +* to test simple sample - manual * +*********************************************************/ +static void test_manual_sample() +{ + unsigned int param_count; + MYSQL_BIND bind[3]; + MYSQL_STMT *stmt; + short small_data; + int int_data; + char str_data[50], query[255]; + long length; + ulonglong affected_rows; + + myheader("test_manual_sample"); + + /* + Sample which is incorporated directly in the manual under Prepared + statements section (Example from mysql_execute() + */ + + mysql_autocommit(mysql, 1); + if (mysql_query(mysql,"DROP TABLE IF EXISTS test_table")) + { + fprintf(stderr, "\n drop table failed"); + fprintf(stderr, "\n %s", mysql_error(mysql)); + exit(0); + } + if (mysql_query(mysql,"CREATE TABLE test_table(col1 int, col2 varchar(50), \ + col3 smallint,\ + col4 timestamp(14))")) + { + fprintf(stderr, "\n create table failed"); + fprintf(stderr, "\n %s", mysql_error(mysql)); + exit(0); + } + + /* Prepare a insert query with 3 parameters */ + strcpy(query, "INSERT INTO test_table(col1,col2,col3) values(?,?,?)"); + if(!(stmt = mysql_prepare(mysql,query,strlen(query)))) + { + fprintf(stderr, "\n prepare, insert failed"); + fprintf(stderr, "\n %s", mysql_error(mysql)); + exit(0); + } + fprintf(stdout, "\n prepare, insert successful"); + + /* Get the parameter count from the statement */ + param_count= mysql_param_count(stmt); + + 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"); + exit(0); + } + + /* Bind the data for the parameters */ + + /* INTEGER PART */ + memset(bind,0,sizeof(bind)); + bind[0].buffer_type= MYSQL_TYPE_LONG; + bind[0].buffer= (void *)&int_data; + + /* STRING PART */ + bind[1].buffer_type= MYSQL_TYPE_VAR_STRING; + bind[1].buffer= (void *)str_data; + bind[1].buffer_length= sizeof(str_data); + + /* SMALLINT PART */ + bind[2].buffer_type= MYSQL_TYPE_SHORT; + bind[2].buffer= (void *)&small_data; + bind[2].length= (long *)&length; + + /* Bind the buffers */ + if (mysql_bind_param(stmt, bind)) + { + fprintf(stderr, "\n param bind failed"); + fprintf(stderr, "\n %s", mysql_stmt_error(stmt)); + exit(0); + } + + /* Specify the data */ + int_data= 10; /* integer */ + strcpy(str_data,"MySQL"); /* string */ + /* INSERT SMALLINT data as NULL */ + length= MYSQL_NULL_DATA; + + /* Execute the insert statement - 1*/ + if (mysql_execute(stmt)) + { + fprintf(stderr, "\n execute 1 failed"); + fprintf(stderr, "\n %s", mysql_stmt_error(stmt)); + exit(0); + } + + /* Get the total rows affected */ + affected_rows= mysql_stmt_affected_rows(stmt); + + fprintf(stdout, "\n total affected rows: %lld", affected_rows); + if (affected_rows != 1) /* validate affected rows */ + { + fprintf(stderr, "\n invalid affected rows by MySQL"); + exit(0); + } + + /* Re-execute the insert, by changing the values */ + int_data= 1000; + strcpy(str_data,"The most popular open source database"); + small_data= 1000; /* smallint */ + length= 0; + + /* Execute the insert statement - 2*/ + if (mysql_execute(stmt)) + { + fprintf(stderr, "\n execute 2 failed"); + fprintf(stderr, "\n %s", mysql_stmt_error(stmt)); + exit(0); + } + + /* Get the total rows affected */ + affected_rows= mysql_stmt_affected_rows(stmt); + + fprintf(stdout, "\n total affected rows: %lld", affected_rows); + if (affected_rows != 1) /* validate affected rows */ + { + fprintf(stderr, "\n invalid affected rows by MySQL"); + exit(0); + } + + /* Close the statement */ + if (mysql_stmt_close(stmt)) + { + fprintf(stderr, "\n failed while closing the statement"); + fprintf(stderr, "\n %s", mysql_stmt_error(stmt)); + exit(0); + } + myassert(2 == my_stmt_result("SELECT * FROM test_table",50)); + + /* DROP THE TABLE */ + if (mysql_query(mysql,"DROP TABLE test_table")) + { + fprintf(stderr, "\n drop table failed"); + fprintf(stderr, "\n %s", mysql_error(mysql)); + exit(0); + } + fprintf(stdout, "Success !!!"); +} + + static struct my_option myctest_long_options[] = { {"help", '?', "Display this help and exit", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, @@ -2398,24 +4633,24 @@ static void usage(void) puts("and you are welcome to modify and redistribute it under the GPL license\n"); puts(" Copyright (C) 1995-2002 MySQL AB "); puts("-----------------------------------------------------------------------\n"); - printf("usage: %s [OPTIONS]\n\n", my_progname); - printf("\ + fprintf(stdout,"usage: %s [OPTIONS]\n\n", my_progname); + fprintf(stdout,"\ -?, --help Display this help message and exit.\n\ -D --database=... Database name to be used for test.\n\ -h, --host=... Connect to host.\n\ -p, --password[=...] Password to use when connecting to server.\n"); #ifdef __WIN__ - printf("\ + fprintf(stdout,"\ -W, --pipe Use named pipes to connect to server.\n"); #endif - printf("\ + fprintf(stdout,"\ -P, --port=... Port number to use for connection.\n\ -S, --socket=... Socket file to use for connection.\n"); #ifndef DONT_ALLOW_USER_CHANGE - printf("\ + fprintf(stdout,"\ -u, --user=# User for login if not current user.\n"); #endif - printf("*********************************************************************\n"); + fprintf(stdout,"*********************************************************************\n"); } static my_bool @@ -2471,24 +4706,53 @@ int main(int argc, char **argv) MY_INIT(argv[0]); get_options(argc,argv); - client_connect(); /* connect to server */ - + client_connect(); /* connect to server */ + client_query(); /* simple client query test */ + test_manual_sample(); /* sample in the manual */ + test_bind_result(); /* result bind test */ + test_fetch_null(); /* to fetch null data */ + test_fetch_date(); /* to fetch date,time and timestamp */ + test_fetch_str(); /* to fetch string to all types */ + test_fetch_long(); /* to fetch long to all types */ + test_fetch_short(); /* to fetch short to all types */ + test_fetch_tiny(); /* to fetch tiny to all types */ + test_fetch_bigint(); /* to fetch bigint to all types */ + test_fetch_float(); /* to fetch float to all types */ + test_fetch_double(); /* to fetch double to all types */ + test_bind_result_ext(); /* result bind test - extension */ + test_bind_result_ext1(); /* result bind test - extension */ + test_select_direct(); /* direct select - protocol_simple debug */ + test_select_prepare(); /* prepare select - protocol_prep debug */ + test_select_direct(); /* direct select - protocol_simple debug */ + test_select(); /* simple select test */ + test_select_version(); /* select with variables */ + test_set_variable(); /* set variable prepare */ +#if NOT_USED + test_select_meta(); /* select param meta information */ + test_update_meta(); /* update param meta information */ + test_insert_meta(); /* insert param meta information */ +#endif + test_simple_update(); /* simple update test */ + test_func_fields(); /* test for new 4.1 MYSQL_FIELD members */ + test_long_data(); /* test for sending text data in chunks */ + test_insert(); /* simple insert test - prepare */ + test_set_variable(); /* prepare with set variables */ + test_tran_innodb(); /* test for mysql_commit(), rollback() and autocommit() */ + test_select_show(); /* prepare - show test */ test_null(); /* test null data handling */ - test_simple_update(); - //test_select_simple(); - //test_prepare_resultset(); - //test_select(); /* simple prepare-select */ + test_simple_update(); /* simple prepare - update */ + test_prepare_noparam();/* prepare without parameters */ + test_select(); /* simple prepare-select */ test_insert(); /* prepare with insert */ - //test_bind_result(); /* result bind test */ - //test_long_data(); /* long data handling in pieces */ + test_bind_result(); /* result bind test */ + test_long_data(); /* long data handling in pieces */ test_prepare_simple();/* simple prepare */ test_prepare(); /* prepare test */ - test_prepare_simple();/* simple prepare */ test_null(); /* test null data handling */ test_debug_example(); /* some debugging case */ test_update(); /* prepare-update test */ test_simple_update(); /* simple prepare with update */ - //test_long_data(); /* long data handling in pieces */ + test_long_data(); /* long data handling in pieces */ test_simple_delete(); /* prepare with delete */ test_field_names(); /* test for field names */ test_double_compare();/* float comparision */ @@ -2499,20 +4763,24 @@ int main(int argc, char **argv) test_tran_innodb(); /* transaction test on InnoDB table type */ test_prepare_ext(); /* test prepare with all types conversion -- TODO */ test_prepare_syntax();/* syntax check for prepares */ - //test_prepare_field_result(); /* prepare meta info */ + test_prepare_field_result(); /* prepare meta info */ + test_prepare_resultset(); /* prepare meta info test */ test_field_names(); /* test for field names */ test_field_flags(); /* test to help .NET provider team */ - //test_long_data_str(); /* long data handling */ - //test_long_data_str1();/* yet another long data handling */ - //test_long_data_bin(); /* long binary insertion */ + test_long_data_str(); /* long data handling */ + test_long_data_str1();/* yet another long data handling */ + test_long_data_bin(); /* long binary insertion */ test_warnings(); /* show warnings test */ test_errors(); /* show errors test */ - //test_select_simple(); /* simple select prepare */ - //test_prepare_resultset();/* prepare meta info test */ - + test_select_simple(); /* simple select prepare */ + test_prepare_resultset();/* prepare meta info test */ + test_func_fields(); /* FUNCTION field info */ + /*test_stmt_close(); */ /* mysql_stmt_close() test -- hangs */ + test_prepare_field_result(); /* prepare meta info */ + test_multi_stmt(); /* multi stmt test */ client_disconnect(); /* disconnect from server */ - - fprintf(stdout,"\ndone !!!\n"); + + fprintf(stdout,"\n\nSUCCESS !!!\n"); return(0); } diff --git a/tools/mysqlmanager.c b/tools/mysqlmanager.c index 6a246f096c8..4f2deeb0052 100644 --- a/tools/mysqlmanager.c +++ b/tools/mysqlmanager.c @@ -1241,7 +1241,7 @@ static void handle_child(int __attribute__((unused)) sig) signal(SIGCHLD,handle_child); } -struct manager_thd* manager_thd_new(Vio* vio) +static struct manager_thd* manager_thd_new(Vio* vio) { struct manager_thd* tmp; if (!(tmp=(struct manager_thd*)my_malloc(sizeof(*tmp), |