Merge work:/home/bk/mysql-4.0 into mashka.mysql.fi:/home/my/mysql-4.0

This commit is contained in:
monty@mashka.mysql.fi 2002-07-24 19:58:16 +03:00
commit b71b26d1a1
58 changed files with 504 additions and 541 deletions

View file

@ -779,7 +779,7 @@ insert of many rows.
@item Locking -- Gamma @item Locking -- Gamma
This is very system-dependent. On some systems there are big problems This is very system-dependent. On some systems there are big problems
using standard OS locking (@code{fcntl()}). In these cases, you should using standard OS locking (@code{fcntl()}). In these cases, you should
run @code{mysqld} with the @code{--skip-locking} flag. run @code{mysqld} with the @code{--skip-external-locking} flag.
Problems are known to occur on some Linux systems, and on SunOS when Problems are known to occur on some Linux systems, and on SunOS when
using NFS-mounted filesystems. using NFS-mounted filesystems.
@ -7300,7 +7300,9 @@ programs.
@item @item
When MySQL is compiled using MIT-pthreads, system locking is When MySQL is compiled using MIT-pthreads, system locking is
disabled by default for performance reasons. You can tell the server to use disabled by default for performance reasons. You can tell the server to use
system locking with the @code{--use-locking} option. system locking with the @code{--external-locking} option. This is only
needed if you want to be able to run two MySQL server against the same
data files (not recommended).
@item @item
Sometimes the pthread @code{bind()} command fails to bind to a socket without Sometimes the pthread @code{bind()} command fails to bind to a socket without
@ -8130,6 +8132,9 @@ before. In particular, you will need @code{REPLICATION SLAVE}
The startup parameters @code{myisam_max_extra_sort_file_size} and The startup parameters @code{myisam_max_extra_sort_file_size} and
@code{myisam_max_extra_sort_file_size} are now given in bytes @code{myisam_max_extra_sort_file_size} are now given in bytes
(was megabytes before 4.0.3). (was megabytes before 4.0.3).
External system locking of MyISAM/ISAM files is now turned of by default.
One can turn this one by doing @code{--external-locking}. (For most users
this is never needed).
@item @item
The following startup variables/options have been renamed: The following startup variables/options have been renamed:
@multitable @columnfractions .50 .50 @multitable @columnfractions .50 .50
@ -8142,7 +8147,8 @@ The following startup variables/options have been renamed:
@item @code{warnings} @tab @code{log-warnings} @item @code{warnings} @tab @code{log-warnings}
@end multitable @end multitable
The startup options @code{record_buffer}, @code{sort_buffer} and @code{warnings} will still work in MySQL 4.0 but are deprecated. The startup options @code{record_buffer}, @code{sort_buffer} and
@code{warnings} will still work in MySQL 4.0 but are deprecated.
@item @item
The following SQL variables have changed name. The following SQL variables have changed name.
@multitable @columnfractions .50 .50 @multitable @columnfractions .50 .50
@ -8157,6 +8163,10 @@ The old names still work in MySQL 4.0 but are depricated.
You have to use @code{SET GLOBAL SQL_SLAVE_SKIP_COUNTER=#} instead of You have to use @code{SET GLOBAL SQL_SLAVE_SKIP_COUNTER=#} instead of
@code{SET SQL_SLAVE_SKIP_COUNTER=#}. @code{SET SQL_SLAVE_SKIP_COUNTER=#}.
@item @item
Renamed mysqld startup options @code{--skip-locking} to
@code{--skip-external-locking} and @code{--enable-locking} to
@code{--external-locking}.
@item
@code{DOUBLE} and @code{FLOAT} columns now honour the @code{DOUBLE} and @code{FLOAT} columns now honour the
@code{UNSIGNED} flag on storage (before, @code{UNSIGNED} was ignored for @code{UNSIGNED} flag on storage (before, @code{UNSIGNED} was ignored for
these columns). these columns).
@ -14174,7 +14184,7 @@ Don't flush key buffers between writes for any @code{MyISAM} table.
Read the default keys used by @code{DES_ENCRYPT()} and @code{DES_DECRYPT()} Read the default keys used by @code{DES_ENCRYPT()} and @code{DES_DECRYPT()}
from this file. from this file.
@item --enable-locking @item --enable-external-locking (was --enable-locking)
Enable system locking. Note that if you use this option on a system on Enable system locking. Note that if you use this option on a system on
which @code{lockd} does not fully work (as on Linux), you will easily get which @code{lockd} does not fully work (as on Linux), you will easily get
mysqld to deadlock. mysqld to deadlock.
@ -14243,7 +14253,7 @@ also set this explicitly to @code{""} if you want to disable this
option. If this option is used, @code{mysqld} will on open check if the option. If this option is used, @code{mysqld} will on open check if the
table is marked as crashed or if the table wasn't closed properly. table is marked as crashed or if the table wasn't closed properly.
(The last option only works if you are running with (The last option only works if you are running with
@code{--skip-locking}.) If this is the case @code{mysqld} will run @code{--skip-external-locking}.) If this is the case @code{mysqld} will run
check on the table. If the table was corrupted, @code{mysqld} will check on the table. If the table was corrupted, @code{mysqld} will
attempt to repair it. attempt to repair it.
@ -14334,7 +14344,7 @@ flush-privileges} or @code{mysqladmin reload}.)
Never use host name cache for faster name-ip resolution, but query DNS server Never use host name cache for faster name-ip resolution, but query DNS server
on every connect instead. @xref{DNS}. on every connect instead. @xref{DNS}.
@item --skip-locking @item --skip-extrnal-locking (was --skip-locking)
Don't use system locking. To use @code{isamchk} or @code{myisamchk} you must Don't use system locking. To use @code{isamchk} or @code{myisamchk} you must
shut down the server. @xref{Stability}. Note that in MySQL Version shut down the server. @xref{Stability}. Note that in MySQL Version
3.23 you can use @code{REPAIR} and @code{CHECK} to repair/check @code{MyISAM} 3.23 you can use @code{REPAIR} and @code{CHECK} to repair/check @code{MyISAM}
@ -18084,7 +18094,7 @@ Print the @code{myisamchk} version and exit.
@item -w or, --wait @item -w or, --wait
Instead of giving an error if the table is locked, wait until the table Instead of giving an error if the table is locked, wait until the table
is unlocked before continuing. Note that if you are running @code{mysqld} is unlocked before continuing. Note that if you are running @code{mysqld}
on the table with @code{--skip-locking}, the table can only be locked on the table with @code{--skip-external-locking}, the table can only be locked
by another @code{myisamchk} command. by another @code{myisamchk} command.
@end table @end table
@ -18125,11 +18135,11 @@ Should, however, be good enough for most cases.
Store in the @file{.MYI} file when the table was checked and if the table crashed. This should be used to get full benefit of the Store in the @file{.MYI} file when the table was checked and if the table crashed. This should be used to get full benefit of the
@code{--check-only-changed} option, but you shouldn't use this @code{--check-only-changed} option, but you shouldn't use this
option if the @code{mysqld} server is using the table and you are option if the @code{mysqld} server is using the table and you are
running @code{mysqld} with @code{--skip-locking}. running @code{mysqld} with @code{--skip-external-locking}.
@item -T or --read-only @item -T or --read-only
Don't mark table as checked. This is useful if you use @code{myisamchk} Don't mark table as checked. This is useful if you use @code{myisamchk}
to check a table that is in use by some other application that doesn't to check a table that is in use by some other application that doesn't
use locking (like @code{mysqld --skip-locking}). use locking (like @code{mysqld --skip-external-locking}).
@end table @end table
@ -18289,9 +18299,9 @@ If you have a problem with disk space during repair, you can try to use
@cindex crash, recovery @cindex crash, recovery
@cindex recovery, from crash @cindex recovery, from crash
If you run @code{mysqld} with @code{--skip-locking} (which is the default on If you run @code{mysqld} with @code{--skip-external-locking} (which is the
some systems, like Linux), you can't reliably use @code{myisamchk} to default on some systems, like Linux), you can't reliably use @code{myisamchk}
check a table when @code{mysqld} is using the same table. If you to check a table when @code{mysqld} is using the same table. If you
can be sure that no one is accessing the tables through @code{mysqld} can be sure that no one is accessing the tables through @code{mysqld}
while you run @code{myisamchk}, you only have to do @code{mysqladmin while you run @code{myisamchk}, you only have to do @code{mysqladmin
flush-tables} before you start checking the tables. If you can't flush-tables} before you start checking the tables. If you can't
@ -18300,14 +18310,14 @@ check the tables. If you run @code{myisamchk} while @code{mysqld} is updating
the tables, you may get a warning that a table is corrupt even if it the tables, you may get a warning that a table is corrupt even if it
isn't. isn't.
If you are not using @code{--skip-locking}, you can use @code{myisamchk} If you are not using @code{--skip-external-locking}, you can use
to check tables at any time. While you do this, all clients that try @code{myisamchk} to check tables at any time. While you do this, all clients
to update the table will wait until @code{myisamchk} is ready before that try to update the table will wait until @code{myisamchk} is ready before
continuing. continuing.
If you use @code{myisamchk} to repair or optimise tables, you If you use @code{myisamchk} to repair or optimise tables, you
@strong{must} always ensure that the @code{mysqld} server is not using @strong{must} always ensure that the @code{mysqld} server is not using
the table (this also applies if you are using @code{--skip-locking}). the table (this also applies if you are using @code{--skip-external-locking}).
If you don't take down @code{mysqld} you should at least do a If you don't take down @code{mysqld} you should at least do a
@code{mysqladmin flush-tables} before you run @code{myisamchk}. @code{mysqladmin flush-tables} before you run @code{myisamchk}.
Your tables @strong{may be corrupted} if the server and @code{myisamchk} Your tables @strong{may be corrupted} if the server and @code{myisamchk}
@ -18688,8 +18698,8 @@ here. We explain some of the information in more detail later:
@item myisamchk -d tbl_name @item myisamchk -d tbl_name
Runs @code{myisamchk} in ``describe mode'' to produce a description of Runs @code{myisamchk} in ``describe mode'' to produce a description of
your table. If you start the MySQL server using the your table. If you start the MySQL server using the
@code{--skip-locking} option, @code{myisamchk} may report an error for a @code{--skip-external-locking} option, @code{myisamchk} may report an error
table that is updated while it runs. However, because @code{myisamchk} for a table that is updated while it runs. However, because @code{myisamchk}
doesn't change the table in describe mode, there isn't any risk of doesn't change the table in describe mode, there isn't any risk of
destroying data. destroying data.
@ -20333,7 +20343,7 @@ The thread is wating for the client to send a new command to it.
The thread is waiting for getting to get a external system lock for the The thread is waiting for getting to get a external system lock for the
table. If you are not using multiple mysqld servers that are accessing table. If you are not using multiple mysqld servers that are accessing
the same tables, you can disable system locks with the the same tables, you can disable system locks with the
@code{--skip-locking} option. @code{--skip-external-locking} option.
@item @code{Upgrading lock} @item @code{Upgrading lock}
The @code{INSERT DELAYED} handler is trying to get a lock for the table The @code{INSERT DELAYED} handler is trying to get a lock for the table
to insert rows. to insert rows.
@ -21352,8 +21362,8 @@ Display version information and exit.
@item -w, --wait @item -w, --wait
Wait and retry if table is in use. If the @code{mysqld} server was Wait and retry if table is in use. If the @code{mysqld} server was
invoked with the @code{--skip-locking} option, it is not a good idea to invoked with the @code{--skip-external-locking} option, it is not a good idea
invoke @code{myisampack} if the table might be updated during the to invoke @code{myisampack} if the table might be updated during the
packing process. packing process.
@end table @end table
@ -27195,25 +27205,25 @@ If you have enough RAM, you could remove all swap devices. Some
operating systems will use a swap device in some contexts even if you operating systems will use a swap device in some contexts even if you
have free memory. have free memory.
@item @item
Use the @code{--skip-locking} MySQL option to avoid external Use the @code{--skip-external-locking} MySQL option to avoid external
locking. Note that this will not impact MySQL's functionality as locking. Note that this will not impact MySQL's functionality as
long as you only run one server. Just remember to take down the server (or long as you only run one server. Just remember to take down the server (or
lock relevant parts) before you run @code{myisamchk}. On some system lock relevant parts) before you run @code{myisamchk}. On some system
this switch is mandatory because the external locking does not work in any this switch is mandatory because the external locking does not work in any
case. case.
The @code{--skip-locking} option is on by default when compiling with The @code{--skip-external-locking} option is on by default when compiling with
MIT-pthreads, because @code{flock()} isn't fully supported by MIT-pthreads, because @code{flock()} isn't fully supported by
MIT-pthreads on all platforms. It's also on default for Linux MIT-pthreads on all platforms. It's also on default for Linux
as Linux file locking are not yet safe. as Linux file locking are not yet safe.
The only case when you can't use @code{--skip-locking} is if you run The only case when you can't use @code{--skip-external-locking} is if you run
multiple MySQL @emph{servers} (not clients) on the same data, multiple MySQL @emph{servers} (not clients) on the same data,
or run @code{myisamchk} on the table without first flushing and locking or run @code{myisamchk} on the table without first flushing and locking
the @code{mysqld} server tables first. the @code{mysqld} server tables first.
You can still use @code{LOCK TABLES}/@code{UNLOCK TABLES} even if you You can still use @code{LOCK TABLES}/@code{UNLOCK TABLES} even if you
are using @code{--skip-locking} are using @code{--skip-external-locking}
@end itemize @end itemize
@ -33832,7 +33842,6 @@ SELECT [STRAIGHT_JOIN]
[FROM table_references [FROM table_references
[WHERE where_definition] [WHERE where_definition]
[GROUP BY @{unsigned_integer | col_name | formula@} [ASC | DESC], ... [GROUP BY @{unsigned_integer | col_name | formula@} [ASC | DESC], ...
[WITH @{CUBE | ROLLUP@}] ]
[HAVING where_definition] [HAVING where_definition]
[ORDER BY @{unsigned_integer | col_name | formula@} [ASC | DESC] ,...] [ORDER BY @{unsigned_integer | col_name | formula@} [ASC | DESC] ,...]
[LIMIT [offset,] rows] [LIMIT [offset,] rows]
@ -34041,10 +34050,6 @@ If you are not getting the results you expect from your query, please
read the @code{GROUP BY} description. read the @code{GROUP BY} description.
@xref{Group by functions}. @xref{Group by functions}.
@item
Since Version 3.23.12 MySQL supports @code{CUBE} and @code{ROLLUP}
clauses. @xref{CUBE and ROLLUP}.
@item @item
@cindex hints @cindex hints
@code{STRAIGHT_JOIN} forces the optimiser to join the tables in the order in @code{STRAIGHT_JOIN} forces the optimiser to join the tables in the order in
@ -34154,7 +34159,6 @@ the examined rows will be write locked.
@menu @menu
* JOIN:: @code{JOIN} Syntax * JOIN:: @code{JOIN} Syntax
* UNION:: @code{UNION} Syntax * UNION:: @code{UNION} Syntax
* CUBE and ROLLUP @code{CUBE} and @code{ROLLUP} Syntax
@end menu @end menu
@node JOIN, UNION, SELECT, SELECT @node JOIN, UNION, SELECT, SELECT
@ -34319,7 +34323,7 @@ mysql> SELECT * FROM table1 IGNORE INDEX (key3)
@xref{LEFT JOIN optimisation, , @code{LEFT JOIN} optimisation}. @xref{LEFT JOIN optimisation, , @code{LEFT JOIN} optimisation}.
@node UNION, CUBE and ROLLUP, JOIN, SELECT @node UNION, , JOIN, SELECT
@subsubsection @code{UNION} Syntax @subsubsection @code{UNION} Syntax
@findex UNION @findex UNION
@ -34337,9 +34341,10 @@ SELECT ...
@code{UNION} is used to combine the result from many @code{SELECT} @code{UNION} is used to combine the result from many @code{SELECT}
statements into one result set. statements into one result set.
The columns listed in the select_expression portion of the @code{SELECT} should The columns listed in the select_expression portion of the @code{SELECT}
have the same type. The column names used in the first @code{SELECT} query will be should have the same type. The column names used in the first
used as the column names for the results returned. @code{SELECT} query will be used as the column names for the results
returned.
The @code{SELECT} commands are normal select commands, but with the following The @code{SELECT} commands are normal select commands, but with the following
restrictions: restrictions:
@ -34364,141 +34369,6 @@ UNION
ORDER BY a; ORDER BY a;
@end example @end example
@node CUBE and ROLLUP, , UNION, SELECT
@subsubsection @code{CUBE} and @code{ROLLUP} Syntax
Documentation for OLAP extension
Introduction
------------
MySQL will first support CUBE and ROLLUP operators from entire OLAP
functionality.
The CUBE and ROLLUP extensions to SQL make querying and reporting
easier in data warehousing environments. ROLLUP creates subtotals at
increasing levels of aggregation, from the most detailed up to a grand
total. CUBE is an extension similar to ROLLUP, enabling a single
statement to calculate all possible combinations of subtotals.
Syntax:
------
The syntax supported by the enhanced mysql for CUBE and ROLLUP
operators.
CUBE
----
SELECT field1, field2, ... AGGR(fieldn) FROM
table GROUP BY field1, field2 field(n-1) WITH CUBE
This would generate the aggregates with group bys of all the
combinations of dimensions.
ROLLUP:
-----
SELECT field1, field2, ... AGGR(fieldn) FROM table
GROUP BY field1, field2 field(n-1) WITH ROLLUP
Example:
-------
mysql> select * from sales;
+------------+---------------+------+--------+
| product | country | year | profit |
+------------+---------------+------+--------+
| Computer | India | 2000 | 1200 |
| TV | United States | 1999 | 150 |
| Calculator | United States | 1999 | 50 |
| Computer | United States | 1999 | 1500 |
| Computer | United States | 2000 | 1500 |
| TV | United States | 2000 | 150 |
| TV | India | 2000 | 100 |
| TV | India | 2000 | 100 |
| Calculator | United States | 2000 | 75 |
| Calculator | India | 2000 | 75 |
| TV | India | 1999 | 100 |
| Computer | India | 1999 | 1200 |
| Computer | United States | 2000 | 1500 |
| Calculator | United States | 2000 | 75 |
+------------+---------------+------+--------+
14 rows in set (0.00 sec)
mysql> Select sales.product, sales.country , sales.year, sum(profit) from
sales group by product, country, year with cube;
+------------+---------------+------+-------------+
| product | country | year | sum(profit) |
+------------+---------------+------+-------------+
| Calculator | India | 2000 | 75 |
| Calculator | United States | 1999 | 50 |
| Calculator | United States | 2000 | 150 |
| Computer | India | 1999 | 1200 |
| Computer | India | 2000 | 1200 |
| Computer | United States | 1999 | 1500 |
| Computer | United States | 2000 | 3000 |
| TV | India | 1999 | 100 |
| TV | India | 2000 | 200 |
| TV | United States | 1999 | 150 |
| TV | United States | 2000 | 150 |
| ALL | India | 1999 | 1300 |
| ALL | India | 2000 | 1475 |
| ALL | United States | 1999 | 1700 |
| ALL | United States | 2000 | 3300 |
| Calculator | ALL | 1999 | 50 |
| Calculator | ALL | 2000 | 225 |
| Computer | ALL | 1999 | 2700 |
| Computer | ALL | 2000 | 4200 |
| TV | ALL | 1999 | 250 |
| TV | ALL | 2000 | 350 |
| Calculator | India | 0 | 75 |
| Calculator | United States | 0 | 200 |
| Computer | India | 0 | 2400 |
| Computer | United States | 0 | 4500 |
| TV | India | 0 | 300 |
| TV | United States | 0 | 300 |
| ALL | ALL | 1999 | 3000 |
| ALL | ALL | 2000 | 4775 |
| ALL | India | 0 | 2775 |
| ALL | United States | 0 | 5000 |
| Calculator | ALL | 0 | 275 |
| Computer | ALL | 0 | 6900 |
| TV | ALL | 0 | 600 |
| ALL | ALL | 0 | 7775 |
+------------+---------------+------+-------------+
35 rows in set (0.00 sec)
MySQL supports now CUBE and ROLLUP extensions, with all functions
that one wishes to use with them.
Those extensions already work in all tested combinations. They work
with UNION's, should work with sub-selects in 4.1 and derived tables.
TODO
----
For the moment, ORDER and LIMIT are disabled for CUBE and ROLLUP. This
however remains to be added later.
Another feature that has to be added later is grouping of select list
itmes in order to alleviate user errors. For the moment, missing
(hidden) columns are not used at all.
Third feature to be done is to make SQL SET OPTION to set values for
all values of the column optionally to:
* ALL (as it is now)
* NULL
* blank
-------------------------------------------------------------------------
@findex HANDLER @findex HANDLER
@node HANDLER, INSERT, SELECT, Data Manipulation @node HANDLER, INSERT, SELECT, Data Manipulation
@subsection @code{HANDLER} Syntax @subsection @code{HANDLER} Syntax
@ -37781,7 +37651,8 @@ The automatic recovery is activated if you start @code{mysqld} with
@code{--myisam-recover=#}. @xref{Command-line options}. @code{--myisam-recover=#}. @xref{Command-line options}.
On open, the table is checked if it's marked as crashed or if the open On open, the table is checked if it's marked as crashed or if the open
count variable for the table is not 0 and you are running with count variable for the table is not 0 and you are running with
@code{--skip-locking}. If either of the above is true the following happens. @code{--skip-external-locking}. If either of the above is true the following
happens.
@itemize @bullet @itemize @bullet
@item @item
@ -47832,7 +47703,7 @@ without locking the table properly.
If you are running many @code{mysqld} servers on the same data on a If you are running many @code{mysqld} servers on the same data on a
system that doesn't support good filesystem locks (normally handled by system that doesn't support good filesystem locks (normally handled by
the @code{lockd} daemon ) or if you are running the @code{lockd} daemon ) or if you are running
multiple servers with @code{--skip-locking} multiple servers with @code{--skip-external-locking}
@item @item
You have a crashed index/datafile that contains very wrong data that You have a crashed index/datafile that contains very wrong data that
got @code{mysqld} confused. got @code{mysqld} confused.
@ -47901,12 +47772,12 @@ what is happening.
Have you applied the latest patches for your operating system? Have you applied the latest patches for your operating system?
@item @item
Use the @code{--skip-locking} option to @code{mysqld}. On some systems, the Use the @code{--skip-external-locking} option to @code{mysqld}. On some
@code{lockd} lock manager does not work properly; the @code{--skip-locking} systems, the @code{lockd} lock manager does not work properly; the
option tells @code{mysqld} not to use external locking. (This means that you @code{--skip-external-locking} option tells @code{mysqld} not to use external
cannot run 2 @code{mysqld} servers on the same data and that you must be locking. (This means that you cannot run 2 @code{mysqld} servers on the same
careful if you use @code{myisamchk}, but it may be instructive to try the data and that you must be careful if you use @code{myisamchk}, but it may be
option as a test.) instructive to try the option as a test.)
@item @item
Have you tried @code{mysqladmin -u root processlist} when @code{mysqld} Have you tried @code{mysqladmin -u root processlist} when @code{mysqld}
@ -50142,6 +50013,14 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}.
The startup parameters @code{myisam_max_extra_sort_file_size} and The startup parameters @code{myisam_max_extra_sort_file_size} and
@code{myisam_max_extra_sort_file_size} are now given in bytes, not megabytes. @code{myisam_max_extra_sort_file_size} are now given in bytes, not megabytes.
@item @item
External system locking of MyISAM/ISAM files is now turned off by default.
One can turn this one by doing @code{--external-locking}. (For most users
this is never needed).
@item
Fixed core dump bug with @code{INSERT ... SET db_name.table_name.colname=''}.
@item
Fixed client hangup bug when using some SQL commands with wrong syntax.
@item
Fixed a timing bug in @code{DROP DATABASE} Fixed a timing bug in @code{DROP DATABASE}
@item @item
New @code{SET [GLOBAL | SESSION]} syntax to change thread specific and global New @code{SET [GLOBAL | SESSION]} syntax to change thread specific and global
@ -50155,14 +50034,14 @@ Renamed variable @code{query_cache_startup_type} to @code{query_cache_type},
Renamed some sql variables, but old names will still work until 5.0. Renamed some sql variables, but old names will still work until 5.0.
@xref{Upgrading-from-3.23}. @xref{Upgrading-from-3.23}.
@item @item
Renamed @code{--skip-locking} to @code{--skip-external-locking}.
@item
Removed not used variable @code{query_buffer_size}. Removed not used variable @code{query_buffer_size}.
@item @item
Fixed a bug that made the pager option in the @code{mysql} client Fixed a bug that made the pager option in the @code{mysql} client
non-functional. non-functional.
@item @item
Added full @code{AUTO_INCREMENT} support to @code{MERGE} tables. Added full @code{AUTO_INCREMENT} support to @code{MERGE} tables.
@item
Added support for @code{CUBE} and @code{ROLLUP}.
@end itemize @end itemize
@node News-4.0.2, News-4.0.1, News-4.0.3, News-4.0.x @node News-4.0.2, News-4.0.1, News-4.0.3, News-4.0.x
@ -50179,6 +50058,7 @@ Don't allow database names that contain @samp{\}.
@item @item
Added @code{XOR} operator (logical and bitwise @code{XOR}) with @code{^} Added @code{XOR} operator (logical and bitwise @code{XOR}) with @code{^}
as a synonym for bitwise @code{XOR}. as a synonym for bitwise @code{XOR}.
@item
Added function @code{IS_FREE_LOCK("lock_name")}. Added function @code{IS_FREE_LOCK("lock_name")}.
Based on code contributed by Hartmut Holzgraefe @email{hartmut@@six.de}. Based on code contributed by Hartmut Holzgraefe @email{hartmut@@six.de}.
@item @item
@ -54493,7 +54373,7 @@ Added optimisation to remove const reference tables from @code{ORDER BY} and
@item @item
@code{mysqld} now automatically disables system locking on Linux and Windows, @code{mysqld} now automatically disables system locking on Linux and Windows,
and for systems that use MIT-pthreads. You can force the use of locking and for systems that use MIT-pthreads. You can force the use of locking
with the @code{--enable-locking} option. with the @code{--enable-external-locking} option.
@item @item
Added @code{--console} option to @code{mysqld}, to force a console window Added @code{--console} option to @code{mysqld}, to force a console window
(for error messages) when using Windows. (for error messages) when using Windows.
@ -54794,7 +54674,7 @@ index file and cause error 126 or 138.
@item @item
Fixed fatal bug in @code{refresh()} when running with the Fixed fatal bug in @code{refresh()} when running with the
@code{--skip-locking} option. There was a ``very small'' time gap after @code{--skip-external-locking} option. There was a ``very small'' time gap after
a @code{mysqladmin refresh} when a table could be corrupted if one a @code{mysqladmin refresh} when a table could be corrupted if one
thread updated a table while another thread did @code{mysqladmin thread updated a table while another thread did @code{mysqladmin
refresh} and another thread started a new update ont the same table refresh} and another thread started a new update ont the same table

View file

@ -250,4 +250,6 @@
#define ER_WRONG_VALUE_FOR_VAR 1231 #define ER_WRONG_VALUE_FOR_VAR 1231
#define ER_WRONG_TYPE_FOR_VAR 1232 #define ER_WRONG_TYPE_FOR_VAR 1232
#define ER_VAR_CANT_BE_READ 1233 #define ER_VAR_CANT_BE_READ 1233
#define ER_ERROR_MESSAGES 234 #define ER_CANT_USE_OPTION_HERE 1234
#define ER_NOT_SUPPORTED_YET 1235
#define ER_ERROR_MESSAGES 236

View file

@ -181,7 +181,8 @@ void _ftb_parse_query(FTB *ftb, byte **start, byte *end,
return; return;
} }
static int _ftb_no_dupes_cmp(void* not_used, const void *a,const void *b) static int _ftb_no_dupes_cmp(void* not_used __attribute__((unused)),
const void *a,const void *b)
{ {
return CMP_NUM((*((my_off_t*)a)), (*((my_off_t*)b))); return CMP_NUM((*((my_off_t*)a)), (*((my_off_t*)b)));
} }

View file

@ -840,7 +840,9 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
} }
if (info->s->base.blobs) if (info->s->base.blobs)
{ {
if (!(to=mi_fix_rec_buff_for_blob(info,block_info.rec_len))) if (!(to= mi_alloc_rec_buff(info, block_info.rec_len,
&info->rec_buff,
&info->alloced_rec_buff_length)))
{ {
mi_check_print_error(param,"Not enough memory for blob at %s", mi_check_print_error(param,"Not enough memory for blob at %s",
llstr(start_recpos,llbuff)); llstr(start_recpos,llbuff));
@ -2791,8 +2793,8 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param)
if (share->base.blobs) if (share->base.blobs)
{ {
if (!(to=mi_alloc_rec_buff(info,block_info.rec_len, if (!(to=mi_alloc_rec_buff(info,block_info.rec_len,
&(sort_param->rec_buff), &(sort_param->rec_buff),
&(sort_param->alloced_rec_buff_length)))) &(sort_param->alloced_rec_buff_length))))
{ {
mi_check_print_error(param,"Not enough memory for blob at %s", mi_check_print_error(param,"Not enough memory for blob at %s",
llstr(sort_param->start_recpos,llbuff)); llstr(sort_param->start_recpos,llbuff));

View file

@ -60,10 +60,10 @@ int _mi_write_blob_record(MI_INFO *info, const byte *record)
int error; int error;
ulong reclength,extra; ulong reclength,extra;
extra=ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER)+MI_SPLIT_LENGTH+ extra= (ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER)+MI_SPLIT_LENGTH+
MI_DYN_DELETE_BLOCK_HEADER+1; MI_DYN_DELETE_BLOCK_HEADER+1);
reclength=info->s->base.pack_reclength+ reclength= (info->s->base.pack_reclength+
_my_calc_total_blob_length(info,record)+ extra; _my_calc_total_blob_length(info,record)+ extra);
#ifdef NOT_USED /* We now support big rows */ #ifdef NOT_USED /* We now support big rows */
if (reclength > MI_DYN_MAX_ROW_LENGTH) if (reclength > MI_DYN_MAX_ROW_LENGTH)
{ {
@ -91,10 +91,10 @@ int _mi_update_blob_record(MI_INFO *info, my_off_t pos, const byte *record)
int error; int error;
ulong reclength,extra; ulong reclength,extra;
extra=ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER)+MI_SPLIT_LENGTH+ extra= (ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER)+MI_SPLIT_LENGTH+
MI_DYN_DELETE_BLOCK_HEADER; MI_DYN_DELETE_BLOCK_HEADER);
reclength=info->s->base.pack_reclength+ reclength= (info->s->base.pack_reclength+
_my_calc_total_blob_length(info,record)+ extra; _my_calc_total_blob_length(info,record)+ extra);
#ifdef NOT_USED /* We now support big rows */ #ifdef NOT_USED /* We now support big rows */
if (reclength > MI_DYN_MAX_ROW_LENGTH) if (reclength > MI_DYN_MAX_ROW_LENGTH)
{ {
@ -1059,7 +1059,9 @@ int _mi_read_dynamic_record(MI_INFO *info, my_off_t filepos, byte *buf)
goto panic; goto panic;
if (info->s->base.blobs) if (info->s->base.blobs)
{ {
if (!(to=mi_fix_rec_buff_for_blob(info,block_info.rec_len))) if (!(to=mi_alloc_rec_buff(info, block_info.rec_len,
&info->rec_buff,
&info->alloced_rec_buff_length)))
goto err; goto err;
} }
else else
@ -1328,7 +1330,9 @@ int _mi_read_rnd_dynamic_record(MI_INFO *info, byte *buf,
info->lastpos=filepos; info->lastpos=filepos;
if (share->base.blobs) if (share->base.blobs)
{ {
if (!(to=mi_fix_rec_buff_for_blob(info,block_info.rec_len))) if (!(to= mi_alloc_rec_buff(info, block_info.rec_len,
&info->rec_buff,
&info->alloced_rec_buff_length)))
goto err; goto err;
} }
else else

View file

@ -344,7 +344,8 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
} }
} }
if (share->base.blobs) if (share->base.blobs)
mi_fix_rec_buff_for_blob(info, -1); mi_alloc_rec_buff(info, -1, &info->rec_buff,
&info->alloced_rec_buff_length);
break; break;
case HA_EXTRA_NORMAL: /* Theese isn't in use */ case HA_EXTRA_NORMAL: /* Theese isn't in use */
info->quick_mode=0; info->quick_mode=0;

View file

@ -250,7 +250,9 @@ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr,
if (info->blobs && info->s->keyinfo[keynr].flag & HA_VAR_LENGTH_KEY) if (info->blobs && info->s->keyinfo[keynr].flag & HA_VAR_LENGTH_KEY)
{ {
if (!(blob_ptr= if (!(blob_ptr=
mi_fix_rec_buff_for_blob(info, info->s->keyinfo[keynr].keylength))) mi_alloc_rec_buff(info, info->s->keyinfo[keynr].keylength,
&info->rec_buff,
&info->alloced_rec_buff_length)))
goto err; goto err;
} }
key=(byte*) info->lastkey; key=(byte*) info->lastkey;

View file

@ -507,7 +507,8 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
/* Allocate buffer for one record */ /* Allocate buffer for one record */
/* prerequisites: bzero(info) && info->s=share; are met. */ /* prerequisites: bzero(info) && info->s=share; are met. */
if (!mi_fix_rec_buff_for_blob(&info, -1)) if (!mi_alloc_rec_buff(&info, -1, &info.rec_buff,
&info.alloced_rec_buff_length))
goto err; goto err;
bzero(info.rec_buff, info.alloced_rec_buff_length); bzero(info.rec_buff, info.alloced_rec_buff_length);
@ -559,6 +560,7 @@ err:
DBUG_RETURN (NULL); DBUG_RETURN (NULL);
} /* mi_open */ } /* mi_open */
gptr mi_get_rec_buff_ptr(MI_INFO *info, byte *buf) gptr mi_get_rec_buff_ptr(MI_INFO *info, byte *buf)
{ {
if (info->s->options & HA_OPTION_PACK_RECORD && buf) if (info->s->options & HA_OPTION_PACK_RECORD && buf)
@ -567,6 +569,7 @@ gptr mi_get_rec_buff_ptr(MI_INFO *info, byte *buf)
return buf; return buf;
} }
byte *mi_alloc_rec_buff(MI_INFO *info, ulong length, byte **buf, uint *buf_len) byte *mi_alloc_rec_buff(MI_INFO *info, ulong length, byte **buf, uint *buf_len)
{ {
uint extra; uint extra;
@ -576,23 +579,24 @@ byte *mi_alloc_rec_buff(MI_INFO *info, ulong length, byte **buf, uint *buf_len)
byte *newptr = *buf; byte *newptr = *buf;
/* to simplify initial init of info->rec_buf in mi_open and mi_extra */ /* to simplify initial init of info->rec_buf in mi_open and mi_extra */
if (length == (ulong)-1) if (length == (ulong) -1)
length=max(info->s->base.pack_reclength,info->s->base.max_key_length); length= max(info->s->base.pack_reclength,info->s->base.max_key_length);
extra= ((info->s->options & HA_OPTION_PACK_RECORD) ? extra= ((info->s->options & HA_OPTION_PACK_RECORD) ?
ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER)+MI_SPLIT_LENGTH+ ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER)+MI_SPLIT_LENGTH+
MI_REC_BUFF_OFFSET : 0); MI_REC_BUFF_OFFSET : 0);
if (extra && newptr) if (extra && newptr)
newptr-=MI_REC_BUFF_OFFSET; newptr-=MI_REC_BUFF_OFFSET;
if (!(newptr=(byte*) my_realloc((gptr)newptr, length+extra+8, if (!(newptr=(byte*) my_realloc((gptr)newptr, length+extra+8,
MYF(MY_ALLOW_ZERO_PTR)))) MYF(MY_ALLOW_ZERO_PTR))))
return 0; return 0;
*buf=newptr+(extra ? MI_REC_BUFF_OFFSET : 0); *buf= newptr+(extra ? MI_REC_BUFF_OFFSET : 0);
*buf_len=length; *buf_len= length;
} }
return *buf; return *buf;
} }
ulonglong mi_safe_mul(ulonglong a, ulonglong b) ulonglong mi_safe_mul(ulonglong a, ulonglong b)
{ {
ulonglong max_val= ~ (ulonglong) 0; /* my_off_t is unsigned */ ulonglong max_val= ~ (ulonglong) 0; /* my_off_t is unsigned */

View file

@ -1057,7 +1057,9 @@ uint _mi_pack_get_block_info(MI_INFO *myisam, MI_BLOCK_INFO *info, File file,
info->blob_len=uint3korr(header+head_length+1); info->blob_len=uint3korr(header+head_length+1);
head_length+=4; head_length+=4;
} }
if (!(mi_fix_rec_buff_for_blob(myisam,info->rec_len + info->blob_len))) if (!(mi_alloc_rec_buff(myisam,info->rec_len + info->blob_len,
&myisam->rec_buff,
&myisam->alloced_rec_buff_length)))
return BLOCK_FATAL_ERROR; /* not enough memory */ return BLOCK_FATAL_ERROR; /* not enough memory */
myisam->bit_buff.blob_pos=(uchar*) myisam->rec_buff+info->rec_len; myisam->bit_buff.blob_pos=(uchar*) myisam->rec_buff+info->rec_len;
myisam->blob_length=info->blob_len; myisam->blob_length=info->blob_len;
@ -1231,8 +1233,10 @@ static uchar *_mi_mempack_get_block_info(MI_INFO *myisam,MI_BLOCK_INFO *info,
info->blob_len=uint3korr(header+1); info->blob_len=uint3korr(header+1);
header+=4; header+=4;
} }
/* mi_fix_rec_buff_for_blob sets my_errno on error */ /* mi_alloc_rec_buff sets my_errno on error */
if (!(mi_fix_rec_buff_for_blob(myisam,info->blob_len))) if (!(mi_alloc_rec_buff(myisam, info->blob_len,
&myisam->rec_buff,
&myisam->alloced_rec_buff_length)))
return 0; /* not enough memory */ return 0; /* not enough memory */
myisam->bit_buff.blob_pos=(uchar*) myisam->rec_buff; myisam->bit_buff.blob_pos=(uchar*) myisam->rec_buff;
} }

View file

@ -525,9 +525,6 @@ extern int _mi_read_cache(IO_CACHE *info,byte *buff,my_off_t pos,
extern void update_auto_increment(MI_INFO *info,const byte *record); extern void update_auto_increment(MI_INFO *info,const byte *record);
extern byte *mi_alloc_rec_buff(MI_INFO *,ulong, byte**, uint*); extern byte *mi_alloc_rec_buff(MI_INFO *,ulong, byte**, uint*);
extern gptr mi_get_rec_buff_ptr(MI_INFO *, byte *); extern gptr mi_get_rec_buff_ptr(MI_INFO *, byte *);
#define mi_fix_rec_buff_for_blob(INFO,LENGTH) \
mi_alloc_rec_buff((INFO),(LENGTH), \
&((INFO)->rec_buff), &((INFO)->alloced_rec_buff_length))
extern ulong _mi_rec_unpack(MI_INFO *info,byte *to,byte *from, extern ulong _mi_rec_unpack(MI_INFO *info,byte *to,byte *from,
ulong reclength); ulong reclength);
extern my_bool _mi_rec_check(MI_INFO *info,const char *record, byte *packpos); extern my_bool _mi_rec_check(MI_INFO *info,const char *record, byte *packpos);

View file

@ -283,7 +283,7 @@ pthread_handler_decl(thr_find_all_keys,arg)
int error; int error;
uint memavl,old_memavl,keys,sort_length; uint memavl,old_memavl,keys,sort_length;
uint idx, maxbuffer; uint idx, maxbuffer;
uchar **sort_keys; uchar **sort_keys=0;
error=1; error=1;

View file

@ -1,6 +1,6 @@
drop database if exists a; drop database if exists foo;
create database a; create database foo;
use a; use foo;
create table b (c int); create table b (c int);
insert into a.b set a.b.c = '1'; insert into foo.b set foo.b.c = '1';
drop database a; drop database foo;

View file

@ -15,124 +15,13 @@ insert into sales values ( 'Computer', 'India',2000, 1200),
( 'Computer', 'United States', 2000,1500), ( 'Computer', 'United States', 2000,1500),
( 'Calculator', 'United States', 2000,75); ( '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 sales group by product, country, year with cube;
product country year sum(profit) This version of MySQL doesn't yet support 'CUBE',
Calculator India 2000 75
Calculator United States 1999 50
Calculator United States 2000 150
Computer India 1999 1200
Computer India 2000 1200
Computer United States 1999 1500
Computer United States 2000 3000
TV India 1999 100
TV India 2000 200
TV United States 1999 150
TV United States 2000 150
Calculator India 0 75
Calculator United States 0 200
Computer India 0 2400
Computer United States 0 4500
TV India 0 300
TV United States 0 300
Calculator ALL 1999 50
Calculator ALL 2000 225
Computer ALL 1999 2700
Computer ALL 2000 4200
TV ALL 1999 250
TV ALL 2000 350
ALL India 1999 1300
ALL India 2000 1475
ALL United States 1999 1700
ALL United States 2000 3300
Calculator ALL 0 275
Computer ALL 0 6900
TV ALL 0 600
ALL India 0 2775
ALL United States 0 5000
ALL ALL 1999 3000
ALL ALL 2000 4775
ALL ALL 0 7775
explain select product, country , year, sum(profit) from sales group by product, country, year with cube; explain select product, country , year, sum(profit) from sales group by product, country, year with cube;
table type possible_keys key key_len ref rows Extra This version of MySQL doesn't yet support 'CUBE',
sales ALL NULL NULL NULL NULL 14 Using temporary; Using filesort
sales ALL NULL NULL NULL NULL 14 Using temporary; Using filesort
sales ALL NULL NULL NULL NULL 14 Using temporary; Using filesort
sales ALL NULL NULL NULL NULL 14 Using temporary; Using filesort
sales ALL NULL NULL NULL NULL 14 Using temporary; Using filesort
sales ALL NULL NULL NULL NULL 14 Using temporary; Using filesort
sales ALL NULL NULL NULL NULL 14 Using temporary; Using filesort
sales ALL NULL NULL NULL NULL 14
select product, country , year, sum(profit) from sales group by product, country, year with rollup; select product, country , year, sum(profit) from sales group by product, country, year with rollup;
product country year sum(profit) This version of MySQL doesn't yet support 'ROLLUP',
Calculator India 2000 75
Calculator United States 1999 50
Calculator United States 2000 150
Computer India 1999 1200
Computer India 2000 1200
Computer United States 1999 1500
Computer United States 2000 3000
TV India 1999 100
TV India 2000 200
TV United States 1999 150
TV United States 2000 150
ALL India 1999 1300
ALL India 2000 1475
ALL United States 1999 1700
ALL United States 2000 3300
ALL ALL 1999 3000
ALL ALL 2000 4775
ALL ALL 0 7775
explain select product, country , year, sum(profit) from sales group by product, country, year with rollup; explain select product, country , year, sum(profit) from sales group by product, country, year with rollup;
table type possible_keys key key_len ref rows Extra This version of MySQL doesn't yet support 'ROLLUP',
sales ALL NULL NULL NULL NULL 14 Using temporary; Using filesort
sales ALL NULL NULL NULL NULL 14 Using temporary; Using filesort
sales ALL NULL NULL NULL NULL 14 Using temporary; Using filesort
sales ALL NULL NULL NULL NULL 14
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 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;
product country year sum(profit) This version of MySQL doesn't yet support 'CUBE',
Calculator India 2000 75
Calculator United States 1999 50
Calculator United States 2000 150
Computer India 1999 1200
Computer India 2000 1200
Computer United States 1999 1500
Computer United States 2000 3000
TV India 1999 100
TV India 2000 200
TV United States 1999 150
TV United States 2000 150
Calculator India 0 75
Calculator United States 0 200
Computer India 0 2400
Computer United States 0 4500
TV India 0 300
TV United States 0 300
Calculator ALL 1999 50
Calculator ALL 2000 225
Computer ALL 1999 2700
Computer ALL 2000 4200
TV ALL 1999 250
TV ALL 2000 350
ALL India 1999 1300
ALL India 2000 1475
ALL United States 1999 1700
ALL United States 2000 3300
Calculator ALL 0 275
Computer ALL 0 6900
TV ALL 0 600
ALL India 0 2775
ALL United States 0 5000
ALL ALL 1999 3000
ALL ALL 2000 4775
ALL ALL 0 7775
Calculator India 2000 75
Calculator United States 1999 50
Calculator United States 2000 150
Computer India 1999 1200
Computer India 2000 1200
Computer United States 1999 1500
Computer United States 2000 3000
TV India 1999 100
TV India 2000 200
TV United States 1999 150
TV United States 2000 150
drop table sales; drop table sales;

View file

@ -129,6 +129,8 @@ select * from t1 union select a from t2;
The used SELECT statements have a different number of columns The used SELECT statements have a different number of columns
select a from t1 union select * from t2; select a from t1 union select * from t2;
The used SELECT statements have a different number of columns The used SELECT statements have a different number of columns
select * from t1 union select SQL_BUFFER_RESULT * from t2;
Wrong usage/placement of 'SQL_BUFFER_RESULT'
create table t3 select a,b from t1 union all select a,b from t2; create table t3 select a,b from t1 union all select a,b from t2;
insert into t3 select a,b from t1 union all select a,b from t2; insert into t3 select a,b from t1 union all select a,b from t2;
replace into t3 select a,b as c from t1 union all select a,b from t2; replace into t3 select a,b as c from t1 union all select a,b from t2;

View file

@ -2,9 +2,9 @@
# Test of mysqld crash with fully qualified column names # Test of mysqld crash with fully qualified column names
# #
drop database if exists a; drop database if exists foo;
create database a; create database foo;
use a; use foo;
create table b (c int); create table b (c int);
insert into a.b set a.b.c = '1'; insert into foo.b set foo.b.c = '1';
drop database a; drop database foo;

View file

@ -14,9 +14,14 @@ insert into sales values ( 'Computer', 'India',2000, 1200),
( 'Computer', 'India', 1999,1200), ( 'Computer', 'India', 1999,1200),
( 'Computer', 'United States', 2000,1500), ( 'Computer', 'United States', 2000,1500),
( 'Calculator', 'United States', 2000,75); ( '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 sales 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 sales 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 sales 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 sales 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; 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; drop table sales;

View file

@ -23,7 +23,11 @@ select 't1',b,count(*) from t1 group by b UNION select 't2',b,count(*) from t2 g
explain (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc; explain (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc;
(select sql_calc_found_rows a,b from t1 limit 2) union all (select a,b from t2 order by a) limit 2; (select sql_calc_found_rows a,b from t1 limit 2) union all (select a,b from t2 order by a) limit 2;
select found_rows(); select found_rows();
#
# Test some error conditions with UNION # Test some error conditions with UNION
#
explain select a,b from t1 union all select a,b from t2; explain select a,b from t1 union all select a,b from t2;
--error 1054 --error 1054
@ -53,6 +57,9 @@ select * from t1 union select a from t2;
--error 1222 --error 1222
select a from t1 union select * from t2; select a from t1 union select * from t2;
--error 1234
select * from t1 union select SQL_BUFFER_RESULT * from t2;
# Test CREATE, INSERT and REPLACE # Test CREATE, INSERT and REPLACE
create table t3 select a,b from t1 union all select a,b from t2; create table t3 select a,b from t1 union all select a,b from t2;
insert into t3 select a,b from t1 union all select a,b from t2; insert into t3 select a,b from t1 union all select a,b from t2;

View file

@ -82,7 +82,7 @@ public:
virtual bool get_date(TIME *ltime,bool fuzzydate); virtual bool get_date(TIME *ltime,bool fuzzydate);
virtual bool get_time(TIME *ltime); virtual bool get_time(TIME *ltime);
virtual bool is_null() { return 0; } virtual bool is_null() { return 0; }
virtual unsigned int size_of () =0; virtual unsigned int size_of()= 0;
}; };
@ -97,7 +97,7 @@ public:
:db_name(db_name_par),table_name(table_name_par),field_name(field_name_par) :db_name(db_name_par),table_name(table_name_par),field_name(field_name_par)
{ name = (char*) field_name_par; } { name = (char*) field_name_par; }
const char *full_name() const; const char *full_name() const;
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -138,7 +138,7 @@ public:
bool get_date(TIME *ltime,bool fuzzydate); bool get_date(TIME *ltime,bool fuzzydate);
bool get_time(TIME *ltime); bool get_time(TIME *ltime);
bool is_null() { return field->is_null(); } bool is_null() { return field->is_null(); }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -160,7 +160,7 @@ public:
bool basic_const_item() const { return 1; } bool basic_const_item() const { return 1; }
Item *new_item() { return new Item_null(name); } Item *new_item() { return new Item_null(name); }
bool is_null() { return 1; } bool is_null() { return 1; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -190,7 +190,7 @@ public:
bool basic_const_item() const { return 1; } bool basic_const_item() const { return 1; }
Item *new_item() { return new Item_int(name,value,max_length); } Item *new_item() { return new Item_int(name,value,max_length); }
void print(String *str); void print(String *str);
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -205,7 +205,7 @@ public:
void make_field(Send_field *field); void make_field(Send_field *field);
Item *new_item() { return new Item_uint(name,max_length); } Item *new_item() { return new Item_uint(name,max_length); }
void print(String *str); void print(String *str);
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -236,7 +236,7 @@ public:
void make_field(Send_field *field); void make_field(Send_field *field);
bool basic_const_item() const { return 1; } bool basic_const_item() const { return 1; }
Item *new_item() { return new Item_real(name,value,decimals,max_length); } Item *new_item() { return new Item_real(name,value,decimals,max_length); }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -248,7 +248,7 @@ public:
decimals=NOT_FIXED_DEC; decimals=NOT_FIXED_DEC;
max_length=DBL_DIG+8; max_length=DBL_DIG+8;
} }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
class Item_string :public Item class Item_string :public Item
@ -282,7 +282,7 @@ public:
String *const_string() { return &str_value; } String *const_string() { return &str_value; }
inline void append(char *str,uint length) { str_value.append(str,length); } inline void append(char *str,uint length) { str_value.append(str,length); }
void print(String *str); void print(String *str);
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
/* for show tables */ /* for show tables */
@ -293,7 +293,7 @@ public:
Item_datetime(const char *item_name): Item_string(item_name,"",0) Item_datetime(const char *item_name): Item_string(item_name,"",0)
{ max_length=19;} { max_length=19;}
void make_field(Send_field *field); void make_field(Send_field *field);
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
class Item_empty_string :public Item_string class Item_empty_string :public Item_string
@ -301,7 +301,7 @@ class Item_empty_string :public Item_string
public: public:
Item_empty_string(const char *header,uint length) :Item_string("",0) Item_empty_string(const char *header,uint length) :Item_string("",0)
{ name=(char*) header; max_length=length;} { name=(char*) header; max_length=length;}
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
class Item_varbinary :public Item class Item_varbinary :public Item
@ -316,7 +316,7 @@ public:
bool save_in_field(Field *field); bool save_in_field(Field *field);
void make_field(Send_field *field); void make_field(Send_field *field);
enum Item_result result_type () const { return INT_RESULT; } enum Item_result result_type () const { return INT_RESULT; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -329,7 +329,7 @@ public:
Field *tmp_table_field(TABLE *t_arg=(TABLE *)0) { return result_field; } Field *tmp_table_field(TABLE *t_arg=(TABLE *)0) { return result_field; }
table_map used_tables() const { return 1; } table_map used_tables() const { return 1; }
virtual void fix_length_and_dec()=0; virtual void fix_length_and_dec()=0;
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -379,7 +379,7 @@ public:
void save_org_in_field(Field *field) { (*ref)->save_org_in_field(field); } void save_org_in_field(Field *field) { (*ref)->save_org_in_field(field); }
enum Item_result result_type () const { return (*ref)->result_type(); } enum Item_result result_type () const { return (*ref)->result_type(); }
table_map used_tables() const { return (*ref)->used_tables(); } table_map used_tables() const { return (*ref)->used_tables(); }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -399,7 +399,7 @@ public:
{ {
return ref->save_in_field(field); return ref->save_in_field(field);
} }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -434,7 +434,7 @@ public:
table_map used_tables() const { return (table_map) 1L; } table_map used_tables() const { return (table_map) 1L; }
bool const_item() const { return 0; } bool const_item() const { return 0; }
bool is_null() { return null_value; } bool is_null() { return null_value; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -445,7 +445,7 @@ public:
Item_buff() :null_value(0) {} Item_buff() :null_value(0) {}
virtual bool cmp(void)=0; virtual bool cmp(void)=0;
virtual ~Item_buff(); /*line -e1509 */ virtual ~Item_buff(); /*line -e1509 */
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
class Item_str_buff :public Item_buff class Item_str_buff :public Item_buff
@ -456,7 +456,7 @@ public:
Item_str_buff(Item *arg) :item(arg),value(arg->max_length) {} Item_str_buff(Item *arg) :item(arg),value(arg->max_length) {}
bool cmp(void); bool cmp(void);
~Item_str_buff(); // Deallocate String:s ~Item_str_buff(); // Deallocate String:s
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -467,7 +467,7 @@ class Item_real_buff :public Item_buff
public: public:
Item_real_buff(Item *item_par) :item(item_par),value(0.0) {} Item_real_buff(Item *item_par) :item(item_par),value(0.0) {}
bool cmp(void); bool cmp(void);
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
class Item_int_buff :public Item_buff class Item_int_buff :public Item_buff
@ -477,7 +477,7 @@ class Item_int_buff :public Item_buff
public: public:
Item_int_buff(Item *item_par) :item(item_par),value(0) {} Item_int_buff(Item *item_par) :item(item_par),value(0) {}
bool cmp(void); bool cmp(void);
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -494,7 +494,7 @@ public:
buff= (char*) sql_calloc(length=field->pack_length()); buff= (char*) sql_calloc(length=field->pack_length());
} }
bool cmp(void); bool cmp(void);
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
extern Item_buff *new_Item_buff(Item *item); extern Item_buff *new_Item_buff(Item *item);

View file

@ -28,7 +28,7 @@ public:
Item_bool_func(Item *a) :Item_int_func(a) {} Item_bool_func(Item *a) :Item_int_func(a) {}
Item_bool_func(Item *a,Item *b) :Item_int_func(a,b) {} Item_bool_func(Item *a,Item *b) :Item_int_func(a,b) {}
void fix_length_and_dec() { decimals=0; max_length=1; } void fix_length_and_dec() { decimals=0; max_length=1; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
class Item_bool_func2 :public Item_int_func class Item_bool_func2 :public Item_int_func
@ -48,7 +48,7 @@ public:
bool have_rev_func() const { return rev_functype() != UNKNOWN_FUNC; } bool have_rev_func() const { return rev_functype() != UNKNOWN_FUNC; }
void print(String *str) { Item_func::print_op(str); } void print(String *str) { Item_func::print_op(str); }
bool is_null() { return test(args[0]->is_null() || args[1]->is_null()); } bool is_null() { return test(args[0]->is_null() || args[1]->is_null()); }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -82,7 +82,7 @@ public:
enum Functype rev_functype() const { return EQUAL_FUNC; } enum Functype rev_functype() const { return EQUAL_FUNC; }
cond_result eq_cmp_result() const { return COND_TRUE; } cond_result eq_cmp_result() const { return COND_TRUE; }
const char *func_name() const { return "<=>"; } const char *func_name() const { return "<=>"; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -188,7 +188,7 @@ public:
~Item_func_interval() { delete item; } ~Item_func_interval() { delete item; }
const char *func_name() const { return "interval"; } const char *func_name() const { return "interval"; }
void update_used_tables(); void update_used_tables();
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -203,7 +203,7 @@ public:
enum Item_result result_type () const { return cached_result_type; } enum Item_result result_type () const { return cached_result_type; }
void fix_length_and_dec(); void fix_length_and_dec();
const char *func_name() const { return "ifnull"; } const char *func_name() const { return "ifnull"; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -218,7 +218,7 @@ public:
enum Item_result result_type () const { return cached_result_type; } enum Item_result result_type () const { return cached_result_type; }
void fix_length_and_dec(); void fix_length_and_dec();
const char *func_name() const { return "if"; } const char *func_name() const { return "if"; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -233,7 +233,7 @@ public:
enum Item_result result_type () const { return cached_result_type; } enum Item_result result_type () const { return cached_result_type; }
void fix_length_and_dec(); void fix_length_and_dec();
const char *func_name() const { return "nullif"; } const char *func_name() const { return "nullif"; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -248,7 +248,7 @@ public:
void fix_length_and_dec(); void fix_length_and_dec();
enum Item_result result_type () const { return cached_result_type; } enum Item_result result_type () const { return cached_result_type; }
const char *func_name() const { return "coalesce"; } const char *func_name() const { return "coalesce"; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
class Item_func_case :public Item_func class Item_func_case :public Item_func
@ -269,7 +269,7 @@ public:
void print(String *str); void print(String *str);
bool fix_fields(THD *thd,struct st_table_list *tlist); bool fix_fields(THD *thd,struct st_table_list *tlist);
Item *find_item(String *str); Item *find_item(String *str);
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -431,7 +431,7 @@ class Item_func_in :public Item_int_func
enum Functype functype() const { return IN_FUNC; } enum Functype functype() const { return IN_FUNC; }
const char *func_name() const { return " IN "; } const char *func_name() const { return " IN "; }
void update_used_tables(); void update_used_tables();
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -469,7 +469,7 @@ public:
} }
} }
optimize_type select_optimize() const { return OPTIMIZE_NULL; } optimize_type select_optimize() const { return OPTIMIZE_NULL; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
class Item_func_isnotnull :public Item_bool_func class Item_func_isnotnull :public Item_bool_func
@ -484,7 +484,7 @@ public:
} }
const char *func_name() const { return "isnotnull"; } const char *func_name() const { return "isnotnull"; }
optimize_type select_optimize() const { return OPTIMIZE_NULL; } optimize_type select_optimize() const { return OPTIMIZE_NULL; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
class Item_func_like :public Item_bool_func2 class Item_func_like :public Item_bool_func2
@ -518,7 +518,7 @@ public:
const char *func_name() const { return "like"; } const char *func_name() const { return "like"; }
void fix_length_and_dec(); void fix_length_and_dec();
bool fix_fields(THD *thd,struct st_table_list *tlist); bool fix_fields(THD *thd,struct st_table_list *tlist);
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
#ifdef USE_REGEX #ifdef USE_REGEX
@ -538,7 +538,7 @@ public:
longlong val_int(); longlong val_int();
bool fix_fields(THD *thd,struct st_table_list *tlist); bool fix_fields(THD *thd,struct st_table_list *tlist);
const char *func_name() const { return "regex"; } const char *func_name() const { return "regex"; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
#else #else
@ -575,7 +575,7 @@ public:
void print(String *str); void print(String *str);
void split_sum_func(List<Item> &fields); void split_sum_func(List<Item> &fields);
friend int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds); friend int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds);
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };

View file

@ -121,7 +121,7 @@ public:
} }
bool is_null() { (void) val_int(); return null_value; } bool is_null() { (void) val_int(); return null_value; }
friend class udf_handler; friend class udf_handler;
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -141,7 +141,7 @@ public:
if (!t_arg) return result_field; if (!t_arg) return result_field;
return new Field_double(max_length, maybe_null, name,t_arg,decimals); return new Field_double(max_length, maybe_null, name,t_arg,decimals);
} }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
class Item_num_func :public Item_func class Item_num_func :public Item_func
@ -156,7 +156,7 @@ public:
enum Item_result result_type () const { return hybrid_type; } enum Item_result result_type () const { return hybrid_type; }
void fix_length_and_dec() { fix_num_length_and_dec(); } void fix_length_and_dec() { fix_num_length_and_dec(); }
bool is_null() { (void) val(); return null_value; } bool is_null() { (void) val(); return null_value; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -190,7 +190,7 @@ class Item_num_op :public Item_func
res= new Field_double(max_length, maybe_null, name, t_arg, decimals); res= new Field_double(max_length, maybe_null, name, t_arg, decimals);
return res; return res;
} }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -463,7 +463,7 @@ public:
const char *func_name() const { return truncate ? "truncate" : "round"; } const char *func_name() const { return truncate ? "truncate" : "round"; }
double val(); double val();
void fix_length_and_dec(); void fix_length_and_dec();
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -499,7 +499,7 @@ class Item_func_units :public Item_real_func
double val(); double val();
const char *func_name() const { return name; } const char *func_name() const { return name; }
void fix_length_and_dec() { decimals=NOT_FIXED_DEC; max_length=float_length(decimals); } void fix_length_and_dec() { decimals=NOT_FIXED_DEC; max_length=float_length(decimals); }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -516,7 +516,7 @@ public:
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec(); void fix_length_and_dec();
enum Item_result result_type () const { return cmp_type; } enum Item_result result_type () const { return cmp_type; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
class Item_func_min :public Item_func_min_max class Item_func_min :public Item_func_min_max
@ -542,7 +542,7 @@ public:
longlong val_int(); longlong val_int();
const char *func_name() const { return "length"; } const char *func_name() const { return "length"; }
void fix_length_and_dec() { max_length=10; } void fix_length_and_dec() { max_length=10; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
class Item_func_bit_length :public Item_func_length class Item_func_bit_length :public Item_func_length
@ -561,7 +561,7 @@ public:
longlong val_int(); longlong val_int();
const char *func_name() const { return "char_length"; } const char *func_name() const { return "char_length"; }
void fix_length_and_dec() { max_length=10; } void fix_length_and_dec() { max_length=10; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
class Item_func_locate :public Item_int_func class Item_func_locate :public Item_int_func
@ -573,7 +573,7 @@ public:
const char *func_name() const { return "locate"; } const char *func_name() const { return "locate"; }
longlong val_int(); longlong val_int();
void fix_length_and_dec() { maybe_null=0; max_length=11; } void fix_length_and_dec() { maybe_null=0; max_length=11; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -603,7 +603,7 @@ public:
const_item_cache&= item->const_item(); const_item_cache&= item->const_item();
with_sum_func= with_sum_func || item->with_sum_func; with_sum_func= with_sum_func || item->with_sum_func;
} }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -615,7 +615,7 @@ public:
longlong val_int(); longlong val_int();
const char *func_name() const { return "ascii"; } const char *func_name() const { return "ascii"; }
void fix_length_and_dec() { max_length=3; } void fix_length_and_dec() { max_length=3; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
class Item_func_ord :public Item_int_func class Item_func_ord :public Item_int_func
@ -625,7 +625,7 @@ public:
Item_func_ord(Item *a) :Item_int_func(a) {} Item_func_ord(Item *a) :Item_int_func(a) {}
longlong val_int(); longlong val_int();
const char *func_name() const { return "ord"; } const char *func_name() const { return "ord"; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
class Item_func_find_in_set :public Item_int_func class Item_func_find_in_set :public Item_int_func
@ -638,7 +638,7 @@ public:
longlong val_int(); longlong val_int();
const char *func_name() const { return "find_in_set"; } const char *func_name() const { return "find_in_set"; }
void fix_length_and_dec(); void fix_length_and_dec();
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -714,7 +714,7 @@ class Item_func_benchmark :public Item_int_func
longlong val_int(); longlong val_int();
const char *func_name() const { return "benchmark"; } const char *func_name() const { return "benchmark"; }
void fix_length_and_dec() { max_length=1; maybe_null=0; } void fix_length_and_dec() { max_length=1; maybe_null=0; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -739,7 +739,7 @@ public:
return res; return res;
} }
Item_result result_type () const { return udf.result_type(); } Item_result result_type () const { return udf.result_type(); }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -848,7 +848,7 @@ class Item_func_get_lock :public Item_int_func
longlong val_int(); longlong val_int();
const char *func_name() const { return "get_lock"; } const char *func_name() const { return "get_lock"; }
void fix_length_and_dec() { max_length=1; maybe_null=1;} void fix_length_and_dec() { max_length=1; maybe_null=1;}
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
class Item_func_release_lock :public Item_int_func class Item_func_release_lock :public Item_int_func
@ -859,7 +859,7 @@ class Item_func_release_lock :public Item_int_func
longlong val_int(); longlong val_int();
const char *func_name() const { return "release_lock"; } const char *func_name() const { return "release_lock"; }
void fix_length_and_dec() { max_length=1; maybe_null=1;} void fix_length_and_dec() { max_length=1; maybe_null=1;}
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
/* replication functions */ /* replication functions */
@ -872,7 +872,7 @@ class Item_master_pos_wait :public Item_int_func
longlong val_int(); longlong val_int();
const char *func_name() const { return "master_pos_wait"; } const char *func_name() const { return "master_pos_wait"; }
void fix_length_and_dec() { max_length=1; maybe_null=1;} void fix_length_and_dec() { max_length=1; maybe_null=1;}
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -898,7 +898,7 @@ public:
void fix_length_and_dec(); void fix_length_and_dec();
void print(String *str); void print(String *str);
const char *func_name() const { return "set_user_var"; } const char *func_name() const { return "set_user_var"; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -923,7 +923,7 @@ public:
table_map used_tables() const table_map used_tables() const
{ return const_var_flag ? 0 : RAND_TABLE_BIT; } { return const_var_flag ? 0 : RAND_TABLE_BIT; }
bool eq(const Item *item, bool binary_cmp) const; bool eq(const Item *item, bool binary_cmp) const;
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -979,7 +979,7 @@ public:
bool fix_index(); bool fix_index();
void init_search(bool no_order); void init_search(bool no_order);
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -1030,5 +1030,5 @@ public:
longlong val_int(); longlong val_int();
const char *func_name() const { return "check_lock"; } const char *func_name() const { return "check_lock"; }
void fix_length_and_dec() { decimals=0; max_length=1; maybe_null=1;} void fix_length_and_dec() { decimals=0; max_length=1; maybe_null=1;}
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };

View file

@ -40,7 +40,7 @@ public:
if (!t_arg) return result_field; if (!t_arg) return result_field;
return (max_length > 255) ? (Field *)new Field_blob(max_length,maybe_null, name,t_arg, binary) : (Field *) new Field_string(max_length,maybe_null, name,t_arg, binary); return (max_length > 255) ? (Field *)new Field_blob(max_length,maybe_null, name,t_arg, binary) : (Field *) new Field_string(max_length,maybe_null, name,t_arg, binary);
} }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
class Item_func_md5 :public Item_str_func class Item_func_md5 :public Item_str_func
@ -51,7 +51,7 @@ public:
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec(); void fix_length_and_dec();
const char *func_name() const { return "md5"; } const char *func_name() const { return "md5"; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
class Item_func_sha :public Item_str_func class Item_func_sha :public Item_str_func
@ -91,7 +91,7 @@ public:
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec(); void fix_length_and_dec();
const char *func_name() const { return "concat"; } const char *func_name() const { return "concat"; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
class Item_func_concat_ws :public Item_str_func class Item_func_concat_ws :public Item_str_func
@ -112,7 +112,7 @@ public:
|| Item_func::fix_fields(thd,tlist)); || Item_func::fix_fields(thd,tlist));
} }
const char *func_name() const { return "concat_ws"; } const char *func_name() const { return "concat_ws"; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
class Item_func_reverse :public Item_str_func class Item_func_reverse :public Item_str_func
@ -133,7 +133,7 @@ public:
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec(); void fix_length_and_dec();
const char *func_name() const { return "replace"; } const char *func_name() const { return "replace"; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -146,7 +146,7 @@ public:
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec(); void fix_length_and_dec();
const char *func_name() const { return "insert"; } const char *func_name() const { return "insert"; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -193,7 +193,7 @@ public:
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec(); void fix_length_and_dec();
const char *func_name() const { return "right"; } const char *func_name() const { return "right"; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -206,7 +206,7 @@ public:
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec(); void fix_length_and_dec();
const char *func_name() const { return "substr"; } const char *func_name() const { return "substr"; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -218,7 +218,7 @@ public:
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec() { max_length= args[0]->max_length; } void fix_length_and_dec() { max_length= args[0]->max_length; }
const char *func_name() const { return "substr_index"; } const char *func_name() const { return "substr_index"; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -230,7 +230,7 @@ public:
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec() { max_length= args[0]->max_length; } void fix_length_and_dec() { max_length= args[0]->max_length; }
const char *func_name() const { return "ltrim"; } const char *func_name() const { return "ltrim"; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -242,7 +242,7 @@ public:
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec() { max_length= args[0]->max_length; } void fix_length_and_dec() { max_length= args[0]->max_length; }
const char *func_name() const { return "rtrim"; } const char *func_name() const { return "rtrim"; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
class Item_func_trim :public Item_str_func class Item_func_trim :public Item_str_func
@ -253,7 +253,7 @@ public:
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec() { max_length= args[0]->max_length; } void fix_length_and_dec() { max_length= args[0]->max_length; }
const char *func_name() const { return "trim"; } const char *func_name() const { return "trim"; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -265,7 +265,7 @@ public:
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec() { max_length = 16; } void fix_length_and_dec() { max_length = 16; }
const char *func_name() const { return "password"; } const char *func_name() const { return "password"; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
class Item_func_des_encrypt :public Item_str_func class Item_func_des_encrypt :public Item_str_func
@ -278,7 +278,7 @@ public:
void fix_length_and_dec() void fix_length_and_dec()
{ maybe_null=1; max_length = args[0]->max_length+8; } { maybe_null=1; max_length = args[0]->max_length+8; }
const char *func_name() const { return "des_encrypt"; } const char *func_name() const { return "des_encrypt"; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
class Item_func_des_decrypt :public Item_str_func class Item_func_des_decrypt :public Item_str_func
@ -290,7 +290,7 @@ public:
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec() { maybe_null=1; max_length = args[0]->max_length; } void fix_length_and_dec() { maybe_null=1; max_length = args[0]->max_length; }
const char *func_name() const { return "des_decrypt"; } const char *func_name() const { return "des_decrypt"; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
class Item_func_encrypt :public Item_str_func class Item_func_encrypt :public Item_str_func
@ -301,7 +301,7 @@ public:
Item_func_encrypt(Item *a, Item *b): Item_str_func(a,b) {} Item_func_encrypt(Item *a, Item *b): Item_str_func(a,b) {}
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec() { maybe_null=1; max_length = 13; } void fix_length_and_dec() { maybe_null=1; max_length = 13; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
#include "sql_crypt.h" #include "sql_crypt.h"
@ -315,7 +315,7 @@ public:
Item_str_func(a),sql_crypt(seed) {} Item_str_func(a),sql_crypt(seed) {}
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec(); void fix_length_and_dec();
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
class Item_func_decode :public Item_func_encode class Item_func_decode :public Item_func_encode
@ -353,7 +353,7 @@ public:
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec(); void fix_length_and_dec();
const char *func_name() const { return "soundex"; } const char *func_name() const { return "soundex"; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -374,7 +374,7 @@ public:
void fix_length_and_dec(); void fix_length_and_dec();
void update_used_tables(); void update_used_tables();
const char *func_name() const { return "elt"; } const char *func_name() const { return "elt"; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -394,7 +394,7 @@ public:
void fix_length_and_dec(); void fix_length_and_dec();
void update_used_tables(); void update_used_tables();
const char *func_name() const { return "make_set"; } const char *func_name() const { return "make_set"; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -409,7 +409,7 @@ public:
max_length=args[0]->max_length+(args[0]->max_length-args[0]->decimals)/3; max_length=args[0]->max_length+(args[0]->max_length-args[0]->decimals)/3;
} }
const char *func_name() const { return "format"; } const char *func_name() const { return "format"; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -431,7 +431,7 @@ public:
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec(); void fix_length_and_dec();
const char *func_name() const { return "repeat"; } const char *func_name() const { return "repeat"; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -444,7 +444,7 @@ public:
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec(); void fix_length_and_dec();
const char *func_name() const { return "rpad"; } const char *func_name() const { return "rpad"; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -457,7 +457,7 @@ public:
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec(); void fix_length_and_dec();
const char *func_name() const { return "lpad"; } const char *func_name() const { return "lpad"; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -479,7 +479,7 @@ public:
const char *func_name() const { return "hex"; } const char *func_name() const { return "hex"; }
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec() { decimals=0; max_length=args[0]->max_length*2; } void fix_length_and_dec() { decimals=0; max_length=args[0]->max_length*2; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -504,7 +504,7 @@ public:
const char *func_name() const { return "load_file"; } const char *func_name() const { return "load_file"; }
void fix_length_and_dec() void fix_length_and_dec()
{ binary=1; maybe_null=1; max_length=MAX_BLOB_WIDTH;} { binary=1; maybe_null=1; max_length=MAX_BLOB_WIDTH;}
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };

View file

@ -70,7 +70,7 @@ public:
void print(String *str); void print(String *str);
void fix_num_length_and_dec(); void fix_num_length_and_dec();
virtual bool setup(THD *thd) {return 0;} virtual bool setup(THD *thd) {return 0;}
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -85,7 +85,7 @@ public:
longlong val_int() { return (longlong) val(); } /* Real as default */ longlong val_int() { return (longlong) val(); } /* Real as default */
String *val_str(String*str); String *val_str(String*str);
void reset_field(); void reset_field();
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -100,7 +100,7 @@ public:
double val() { return (double) val_int(); } double val() { return (double) val_int(); }
String *val_str(String*str); String *val_str(String*str);
enum Item_result result_type () const { return INT_RESULT; } enum Item_result result_type () const { return INT_RESULT; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -118,7 +118,7 @@ class Item_sum_sum :public Item_sum_num
void reset_field(); void reset_field();
void update_field(int offset); void update_field(int offset);
const char *func_name() const { return "sum"; } const char *func_name() const { return "sum"; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -141,7 +141,7 @@ class Item_sum_count :public Item_sum_int
void reset_field(); void reset_field();
void update_field(int offset); void update_field(int offset);
const char *func_name() const { return "count"; } const char *func_name() const { return "count"; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -193,7 +193,7 @@ class Item_sum_count_distinct :public Item_sum_int
void update_field(int offset) { return ; } // Never called void update_field(int offset) { return ; } // Never called
const char *func_name() const { return "count_distinct"; } const char *func_name() const { return "count_distinct"; }
bool setup(THD *thd); bool setup(THD *thd);
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -213,7 +213,7 @@ public:
String *val_str(String*); String *val_str(String*);
void make_field(Send_field *field); void make_field(Send_field *field);
void fix_length_and_dec() {} void fix_length_and_dec() {}
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -235,7 +235,7 @@ class Item_sum_avg :public Item_sum_num
Item *result_item(Field *field) Item *result_item(Field *field)
{ return new Item_avg_field(this); } { return new Item_avg_field(this); }
const char *func_name() const { return "avg"; } const char *func_name() const { return "avg"; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
class Item_sum_std; class Item_sum_std;
@ -252,7 +252,7 @@ public:
bool is_null() { (void) val_int(); return null_value; } bool is_null() { (void) val_int(); return null_value; }
void make_field(Send_field *field); void make_field(Send_field *field);
void fix_length_and_dec() {} void fix_length_and_dec() {}
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
class Item_sum_std :public Item_sum_num class Item_sum_std :public Item_sum_num
@ -273,7 +273,7 @@ class Item_sum_std :public Item_sum_num
Item *result_item(Field *field) Item *result_item(Field *field)
{ return new Item_std_field(this); } { return new Item_std_field(this); }
const char *func_name() const { return "std"; } const char *func_name() const { return "std"; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -316,7 +316,7 @@ class Item_sum_hybrid :public Item_sum
void min_max_update_str_field(int offset); void min_max_update_str_field(int offset);
void min_max_update_real_field(int offset); void min_max_update_real_field(int offset);
void min_max_update_int_field(int offset); void min_max_update_int_field(int offset);
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -328,7 +328,7 @@ public:
bool add(); bool add();
const char *func_name() const { return "min"; } const char *func_name() const { return "min"; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -340,7 +340,7 @@ public:
bool add(); bool add();
const char *func_name() const { return "max"; } const char *func_name() const { return "max"; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -356,7 +356,7 @@ class Item_sum_bit :public Item_sum_int
void reset(); void reset();
longlong val_int(); longlong val_int();
void reset_field(); void reset_field();
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -367,7 +367,7 @@ class Item_sum_or :public Item_sum_bit
bool add(); bool add();
void update_field(int offset); void update_field(int offset);
const char *func_name() const { return "bit_or"; } const char *func_name() const { return "bit_or"; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -378,7 +378,7 @@ class Item_sum_and :public Item_sum_bit
bool add(); bool add();
void update_field(int offset); void update_field(int offset);
const char *func_name() const { return "bit_and"; } const char *func_name() const { return "bit_and"; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
/* /*
@ -409,7 +409,7 @@ public:
bool add(); bool add();
void reset_field() {}; void reset_field() {};
void update_field(int offset_arg) {}; void update_field(int offset_arg) {};
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };

View file

@ -175,7 +175,7 @@ public:
const char *func_name() const { return "weekday"; } const char *func_name() const { return "weekday"; }
enum Item_result result_type () const { return INT_RESULT; } enum Item_result result_type () const { return INT_RESULT; }
void fix_length_and_dec() { decimals=0; max_length=1; maybe_null=1; } void fix_length_and_dec() { decimals=0; max_length=1; maybe_null=1; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
class Item_func_dayname :public Item_func_weekday class Item_func_dayname :public Item_func_weekday
@ -201,7 +201,7 @@ public:
{ {
decimals=0; max_length=10; decimals=0; max_length=10;
} }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -240,7 +240,7 @@ public:
if (!t_arg) return result_field; if (!t_arg) return result_field;
return new Field_date(maybe_null, name, t_arg); return new Field_date(maybe_null, name, t_arg);
} }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -259,7 +259,7 @@ public:
if (!t_arg) return result_field; if (!t_arg) return result_field;
return new Field_datetime(maybe_null, name, t_arg); return new Field_datetime(maybe_null, name, t_arg);
} }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -287,7 +287,7 @@ public:
if (!t_arg) return result_field; if (!t_arg) return result_field;
return new Field_time(maybe_null, name, t_arg); return new Field_time(maybe_null, name, t_arg);
} }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -301,7 +301,7 @@ public:
const char *func_name() const { return "curdate"; } const char *func_name() const { return "curdate"; }
void fix_length_and_dec(); /* Retrieves curtime */ void fix_length_and_dec(); /* Retrieves curtime */
bool get_date(TIME *res,bool fuzzy_date); bool get_date(TIME *res,bool fuzzy_date);
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -323,7 +323,7 @@ public:
const char *func_name() const { return "now"; } const char *func_name() const { return "now"; }
void fix_length_and_dec(); void fix_length_and_dec();
bool get_date(TIME *res,bool fuzzy_date); bool get_date(TIME *res,bool fuzzy_date);
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -348,7 +348,7 @@ public:
const char *func_name() const { return "date_format"; } const char *func_name() const { return "date_format"; }
void fix_length_and_dec(); void fix_length_and_dec();
uint format_length(const String *format); uint format_length(const String *format);
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -408,7 +408,7 @@ public:
double val() { return (double) val_int(); } double val() { return (double) val_int(); }
longlong val_int(); longlong val_int();
bool get_date(TIME *res,bool fuzzy_date); bool get_date(TIME *res,bool fuzzy_date);
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
class Item_extract :public Item_int_func class Item_extract :public Item_int_func
@ -422,7 +422,7 @@ class Item_extract :public Item_int_func
longlong val_int(); longlong val_int();
const char *func_name() const { return "extract"; } const char *func_name() const { return "extract"; }
void fix_length_and_dec(); void fix_length_and_dec();
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
class Item_typecast :public Item_str_func class Item_typecast :public Item_str_func

View file

@ -29,7 +29,7 @@ public:
:Item_real_func(list) {} :Item_real_func(list) {}
double val() { return 0.0; } double val() { return 0.0; }
void fix_length_and_dec() { decimals=0; max_length=6; } void fix_length_and_dec() { decimals=0; max_length=6; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
class Item_sum_unique_users :public Item_sum_num class Item_sum_unique_users :public Item_sum_num
@ -44,5 +44,5 @@ public:
void reset_field() {} void reset_field() {}
void update_field(int offset) {} void update_field(int offset) {}
bool fix_fields(THD *thd,struct st_table_list *tlist) { return 0;} bool fix_fields(THD *thd,struct st_table_list *tlist) { return 0;}
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };

View file

@ -337,6 +337,7 @@ int mysql_analyze_table(THD* thd, TABLE_LIST* table_list,
HA_CHECK_OPT* check_opt); HA_CHECK_OPT* check_opt);
int mysql_optimize_table(THD* thd, TABLE_LIST* table_list, int mysql_optimize_table(THD* thd, TABLE_LIST* table_list,
HA_CHECK_OPT* check_opt); HA_CHECK_OPT* check_opt);
bool check_simple_select();
/* net_pkg.c */ /* net_pkg.c */
void send_warning(NET *net, uint sql_errno, const char *err=0); void send_warning(NET *net, uint sql_errno, const char *err=0);

View file

@ -256,7 +256,7 @@ ulong back_log, connect_timeout;
char mysql_home[FN_REFLEN], pidfile_name[FN_REFLEN], time_zone[30]; char mysql_home[FN_REFLEN], pidfile_name[FN_REFLEN], time_zone[30];
bool opt_log, opt_update_log, opt_bin_log, opt_slow_log; bool opt_log, opt_update_log, opt_bin_log, opt_slow_log;
bool opt_disable_networking=0, opt_skip_show_db=0; bool opt_disable_networking=0, opt_skip_show_db=0;
my_bool opt_local_infile; my_bool opt_local_infile, opt_external_locking;
static bool opt_do_pstack = 0; static bool opt_do_pstack = 0;
static ulong opt_specialflag=SPECIAL_ENGLISH; static ulong opt_specialflag=SPECIAL_ENGLISH;
@ -2928,8 +2928,10 @@ struct my_option my_long_options[] =
{"delay-key-write-for-all-tables", OPT_DELAY_KEY_WRITE, {"delay-key-write-for-all-tables", OPT_DELAY_KEY_WRITE,
"Don't flush key buffers between writes for any MyISAM table", 0, 0, 0, "Don't flush key buffers between writes for any MyISAM table", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"enable-locking", OPT_ENABLE_LOCK, "Enable system locking", 0, 0, 0, {"enable-locking", OPT_ENABLE_LOCK,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, "Depricated option, use --external-locking instead",
(gptr*) &opt_external_locking, (gptr*) &opt_external_locking,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef __NT__ #ifdef __NT__
{"enable-named-pipe", OPT_HAVE_NAMED_PIPE, "Enable the named pipe (NT)", {"enable-named-pipe", OPT_HAVE_NAMED_PIPE, "Enable the named pipe (NT)",
(gptr*) &opt_enable_named_pipe, (gptr*) &opt_enable_named_pipe, 0, GET_BOOL, (gptr*) &opt_enable_named_pipe, (gptr*) &opt_enable_named_pipe, 0, GET_BOOL,
@ -3198,7 +3200,7 @@ struct my_option my_long_options[] =
{"skip-innodb", OPT_INNODB_SKIP, "Don't use Innodb (will save memory)", {"skip-innodb", OPT_INNODB_SKIP, "Don't use Innodb (will save memory)",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-locking", OPT_SKIP_LOCK, {"skip-locking", OPT_SKIP_LOCK,
"Don't use system locking. To use isamchk one has to shut down the server.", "Depricated option, use --skip-external-locking instead",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-host-cache", OPT_SKIP_HOST_CACHE, "Don't cache host names", 0, 0, 0, {"skip-host-cache", OPT_SKIP_HOST_CACHE, "Don't cache host names", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@ -3257,8 +3259,9 @@ struct my_option my_long_options[] =
"Default transaction isolation level", 0, 0, 0, GET_NO_ARG, REQUIRED_ARG, 0, "Default transaction isolation level", 0, 0, 0, GET_NO_ARG, REQUIRED_ARG, 0,
0, 0, 0, 0, 0, 0,
0, 0}, 0, 0},
{"use-locking", OPT_USE_LOCKING, "Use system (external) locking", {"external-locking", OPT_USE_LOCKING, "Use system (external) locking. With this option enabled you can run myisamchk to test (not repair) tables while the MySQL server is running",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, (gptr*) &opt_external_locking, (gptr*) &opt_external_locking,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef USE_SYMDIR #ifdef USE_SYMDIR
{"use-symbolic-links", 's', "Enable symbolic link support", {"use-symbolic-links", 's', "Enable symbolic link support",
(gptr*) &my_use_symdir, (gptr*) &my_use_symdir, 0, GET_BOOL, NO_ARG, 0, 0, (gptr*) &my_use_symdir, (gptr*) &my_use_symdir, 0, GET_BOOL, NO_ARG, 0, 0,
@ -3835,9 +3838,8 @@ static void set_options(void)
(void) strmake(mysql_home, tmpenv, sizeof(mysql_home)-1); (void) strmake(mysql_home, tmpenv, sizeof(mysql_home)-1);
#endif #endif
#if defined( HAVE_mit_thread ) || defined( __WIN__ ) || defined( HAVE_LINUXTHREADS )
my_disable_locking=myisam_single_user= 1; my_disable_locking=myisam_single_user= 1;
#endif opt_external_locking=0;
my_bind_addr = htonl( INADDR_ANY ); my_bind_addr = htonl( INADDR_ANY );
} }
@ -4060,17 +4062,11 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt_specialflag|= SPECIAL_NO_PRIOR; opt_specialflag|= SPECIAL_NO_PRIOR;
break; break;
case (int) OPT_SKIP_LOCK: case (int) OPT_SKIP_LOCK:
my_disable_locking=myisam_single_user= 1; opt_external_locking=0;
break; break;
case (int) OPT_SKIP_HOST_CACHE: case (int) OPT_SKIP_HOST_CACHE:
opt_specialflag|= SPECIAL_NO_HOST_CACHE; opt_specialflag|= SPECIAL_NO_HOST_CACHE;
break; break;
case (int) OPT_ENABLE_LOCK:
my_disable_locking=myisam_single_user=0;
break;
case (int) OPT_USE_LOCKING:
my_disable_locking=0;
break;
case (int) OPT_SKIP_RESOLVE: case (int) OPT_SKIP_RESOLVE:
opt_specialflag|=SPECIAL_NO_RESOLVE; opt_specialflag|=SPECIAL_NO_RESOLVE;
break; break;
@ -4323,6 +4319,7 @@ static void get_options(int argc,char **argv)
Set some global variables from the global_system_variables Set some global variables from the global_system_variables
In most cases the global variables will not be used In most cases the global variables will not be used
*/ */
my_disable_locking= myisam_single_user= test(opt_external_locking == 0);
my_default_record_cache_size=global_system_variables.read_buff_size; my_default_record_cache_size=global_system_variables.read_buff_size;
myisam_max_temp_length= myisam_max_temp_length=
(my_off_t) min(global_system_variables.myisam_max_sort_file_size, (my_off_t) min(global_system_variables.myisam_max_sort_file_size,

View file

@ -43,7 +43,7 @@ public:
{ {
init_make_field(tmp_field,field_type()); init_make_field(tmp_field,field_type());
} }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
class Item_proc_real :public Item_proc class Item_proc_real :public Item_proc
@ -63,7 +63,7 @@ public:
double val() { return value; } double val() { return value; }
longlong val_int() { return (longlong) value; } longlong val_int() { return (longlong) value; }
String *val_str(String *s) { s->set(value,decimals); return s; } String *val_str(String *s) { s->set(value,decimals); return s; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
class Item_proc_int :public Item_proc class Item_proc_int :public Item_proc
@ -81,7 +81,7 @@ public:
double val() { return (double) value; } double val() { return (double) value; }
longlong val_int() { return value; } longlong val_int() { return value; }
String *val_str(String *s) { s->set(value); return s; } String *val_str(String *s) { s->set(value); return s; }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -101,7 +101,7 @@ public:
{ {
return null_value ? (String*) 0 : (String*) &str_value; return null_value ? (String*) 0 : (String*) &str_value;
} }
virtual unsigned int size_of () { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
/* The procedure class definitions */ /* The procedure class definitions */

View file

@ -475,7 +475,7 @@ struct show_var_st init_vars[]= {
{sys_safe_show_db.name, (char*) &sys_safe_show_db, SHOW_SYS}, {sys_safe_show_db.name, (char*) &sys_safe_show_db, SHOW_SYS},
{sys_server_id.name, (char*) &sys_server_id, SHOW_SYS}, {sys_server_id.name, (char*) &sys_server_id, SHOW_SYS},
{sys_slave_net_timeout.name,(char*) &sys_slave_net_timeout, SHOW_SYS}, {sys_slave_net_timeout.name,(char*) &sys_slave_net_timeout, SHOW_SYS},
{"skip_locking", (char*) &my_disable_locking, SHOW_MY_BOOL}, {"skip_external_locking", (char*) &my_disable_locking, SHOW_MY_BOOL},
{"skip_networking", (char*) &opt_disable_networking, SHOW_BOOL}, {"skip_networking", (char*) &opt_disable_networking, SHOW_BOOL},
{"skip_show_database", (char*) &opt_skip_show_db, SHOW_BOOL}, {"skip_show_database", (char*) &opt_skip_show_db, SHOW_BOOL},
{sys_slow_launch_time.name, (char*) &sys_slow_launch_time, SHOW_SYS}, {sys_slow_launch_time.name, (char*) &sys_slow_launch_time, SHOW_SYS},

View file

@ -244,3 +244,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'", "Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'", "Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read", "Variable '%-.64s' can only be set, not read",
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s',"

View file

@ -238,3 +238,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'", "Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'", "Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read", "Variable '%-.64s' can only be set, not read",
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s',"

View file

@ -244,3 +244,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'", "Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'", "Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read", "Variable '%-.64s' can only be set, not read",
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s',"

View file

@ -235,3 +235,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'", "Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'", "Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read", "Variable '%-.64s' can only be set, not read",
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s',"

View file

@ -240,3 +240,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'", "Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'", "Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read", "Variable '%-.64s' can only be set, not read",
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s',"

View file

@ -235,3 +235,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'", "Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'", "Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read", "Variable '%-.64s' can only be set, not read",
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s',"

View file

@ -238,3 +238,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'", "Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'", "Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read", "Variable '%-.64s' can only be set, not read",
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s',"

View file

@ -235,3 +235,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'", "Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'", "Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read", "Variable '%-.64s' can only be set, not read",
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s',"

View file

@ -237,3 +237,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'", "Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'", "Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read", "Variable '%-.64s' can only be set, not read",
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s',"

View file

@ -235,3 +235,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'", "Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'", "Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read", "Variable '%-.64s' can only be set, not read",
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s',"

View file

@ -237,3 +237,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'", "Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'", "Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read", "Variable '%-.64s' can only be set, not read",
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s',"

View file

@ -235,3 +235,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'", "Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'", "Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read", "Variable '%-.64s' can only be set, not read",
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s',"

View file

@ -237,3 +237,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'", "Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'", "Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read", "Variable '%-.64s' can only be set, not read",
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s',"

View file

@ -237,3 +237,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'", "Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'", "Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read", "Variable '%-.64s' can only be set, not read",
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s',"

View file

@ -239,3 +239,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'", "Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'", "Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read", "Variable '%-.64s' can only be set, not read",
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s',"

View file

@ -235,3 +235,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'", "Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'", "Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read", "Variable '%-.64s' can only be set, not read",
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s',"

View file

@ -239,3 +239,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'", "Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'", "Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read", "Variable '%-.64s' can only be set, not read",
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s',"

View file

@ -238,3 +238,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'", "Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'", "Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read", "Variable '%-.64s' can only be set, not read",
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s',"

View file

@ -243,3 +243,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'", "Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'", "Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read", "Variable '%-.64s' can only be set, not read",
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s',"

View file

@ -236,3 +236,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'", "Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'", "Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read", "Variable '%-.64s' can only be set, not read",
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s',"

View file

@ -235,3 +235,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'", "Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'", "Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read", "Variable '%-.64s' can only be set, not read",
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s',"

View file

@ -240,3 +240,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'", "Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'", "Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read", "Variable '%-.64s' can only be set, not read",
"Wrong usage/placement of '%s'",
"This version of MySQL doesn't yet support '%s',"

View file

@ -1608,7 +1608,7 @@ find_field_in_tables(THD *thd,Item_field *item,TABLE_LIST *tables)
for (; tables ; tables=tables->next) for (; tables ; tables=tables->next)
{ {
if (!strcmp(tables->name,table_name) && if (!strcmp(tables->name,table_name) &&
(!db || !tables->db || !strcmp(db,tables->db))) (!db || !strcmp(db,tables->db)))
{ {
found_table=1; found_table=1;
Field *find=find_field_in_table(thd,tables->table,name,length, Field *find=find_field_in_table(thd,tables->table,name,length,

View file

@ -73,6 +73,7 @@ check_insert_fields(THD *thd,TABLE *table,List<Item> &fields,
} }
TABLE_LIST table_list; TABLE_LIST table_list;
bzero((char*) &table_list,sizeof(table_list)); bzero((char*) &table_list,sizeof(table_list));
table_list.db= table->table_cache_key;
table_list.name=table->table_name; table_list.name=table->table_name;
table_list.table=table; table_list.table=table;
table_list.grant=table->grant; table_list.grant=table->grant;

View file

@ -97,7 +97,7 @@ enum sub_select_type
enum olap_type enum olap_type
{ {
NON_EXISTING_ONE, CUBE_TYPE, ROLLUP_TYPE UNSPECIFIED_OLAP_TYPE, CUBE_TYPE, ROLLUP_TYPE
}; };
/* The state of the lex parsing for selects */ /* The state of the lex parsing for selects */

View file

@ -15,7 +15,18 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* OLAP implementation by Sinisa Milivojevic <sinisa@mysql.com> */ /*
OLAP implementation by Sinisa Milivojevic <sinisa@mysql.com>
Inspired by code submitted by Srilakshmi <lakshmi@gdit.iiit.net>
The ROLLUP code in this file has to be complitely rewritten as it's
not good enough to satisfy the goals of MySQL.
In 4.1 we will replace this with a working, superior implementation
of ROLLUP.
*/
#ifdef DISABLED_UNTIL_REWRITTEN_IN_4_1
#ifdef __GNUC__ #ifdef __GNUC__
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
@ -179,3 +190,5 @@ int handle_olaps(LEX *lex, SELECT_LEX *select_lex)
sl_return=1; // impossible sl_return=1; // impossible
return sl_return; return sl_return;
} }
#endif /* DISABLED_UNTIL_REWRITTEN_IN_4_1 */

View file

@ -2684,6 +2684,7 @@ mysql_init_query(THD *thd)
thd->lex.select_lex.table_list.next= (byte**) &thd->lex.select_lex.table_list.first; thd->lex.select_lex.table_list.next= (byte**) &thd->lex.select_lex.table_list.first;
thd->lex.select_lex.next=0; thd->lex.select_lex.next=0;
thd->lex.olap=0; thd->lex.olap=0;
thd->lex.select->olap= UNSPECIFIED_OLAP_TYPE;
thd->fatal_error=0; // Safety thd->fatal_error=0; // Safety
thd->last_insert_id_used=thd->query_start_used=thd->insert_id_used=0; thd->last_insert_id_used=thd->query_start_used=thd->insert_id_used=0;
thd->sent_row_count=thd->examined_row_count=0; thd->sent_row_count=thd->examined_row_count=0;
@ -2700,7 +2701,7 @@ mysql_init_select(LEX *lex)
select_lex->offset_limit=0; select_lex->offset_limit=0;
select_lex->options=0; select_lex->options=0;
select_lex->linkage=UNSPECIFIED_TYPE; select_lex->linkage=UNSPECIFIED_TYPE;
select_lex->olap= NON_EXISTING_ONE; select_lex->olap= UNSPECIFIED_OLAP_TYPE;
lex->exchange = 0; lex->exchange = 0;
lex->proc_list.first=0; lex->proc_list.first=0;
select_lex->order_list.elements=select_lex->group_list.elements=0; select_lex->order_list.elements=select_lex->group_list.elements=0;
@ -2767,7 +2768,11 @@ mysql_parse(THD *thd,char *inBuf,uint length)
} }
} }
else else
{
DBUG_PRINT("info",("Command aborted. Fatal_error: %d",
thd->fatal_error));
query_cache_abort(&thd->net); query_cache_abort(&thd->net);
}
thd->proc_info="freeing items"; thd->proc_info="freeing items";
free_items(thd); /* Free strings used by items */ free_items(thd); /* Free strings used by items */
lex_end(lex); lex_end(lex);
@ -3441,3 +3446,28 @@ static bool append_file_to_dir(THD *thd, char **filename_ptr, char *table_name)
strxmov(ptr,buff,table_name,NullS); strxmov(ptr,buff,table_name,NullS);
return 0; return 0;
} }
/*
Check if the select is a simple select (not an union)
SYNOPSIS
check_simple_select()
RETURN VALUES
0 ok
1 error ; In this case the error messege is sent to the client
*/
bool check_simple_select()
{
THD *thd= current_thd;
if (thd->lex.select != &thd->lex.select_lex)
{
char command[80];
strmake(command, thd->lex.yylval->symbol.str,
min(thd->lex.yylval->symbol.length, sizeof(command)-1));
net_printf(&thd->net, ER_CANT_USE_OPTION_HERE, command);
return 1;
}
return 0;
}

View file

@ -146,7 +146,7 @@ static bool update_sum_func(Item_sum **func);
static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
bool distinct, const char *message=NullS); bool distinct, const char *message=NullS);
static void describe_info(JOIN *join, const char *info); static void describe_info(JOIN *join, const char *info);
extern int handle_olaps(LEX *lex, SELECT_LEX *select);
/* /*
This handles SELECT with and without UNION This handles SELECT with and without UNION
*/ */
@ -155,23 +155,26 @@ int handle_select(THD *thd, LEX *lex, select_result *result)
{ {
int res; int res;
register SELECT_LEX *select_lex = &lex->select_lex; register SELECT_LEX *select_lex = &lex->select_lex;
#ifdef DISABLED_UNTIL_REWRITTEN_IN_4_1
if (lex->olap) if (lex->olap)
{ {
SELECT_LEX *sl, *last_sl; SELECT_LEX *sl, *sl_next;
int returned; int error;
for (sl= &lex->select_lex;sl;sl=sl->next) for (sl= &select_lex; sl; sl=sl_next)
{ {
if (sl->olap != NON_EXISTING_ONE) sl_next=sl->next; // Save if sl->next changes
if (sl->olap != UNSPECIFIED_OLAP_TYPE)
{ {
last_sl=sl->next; if ((error=handle_olaps(lex,sl)))
if ((returned=handle_olaps(lex,sl))) return error;
return returned; lex->last_selects->next=sl_next;
lex->last_selects->next=sl=last_sl;
if (!sl) break;
} }
} }
lex->select = select_lex; lex->select = select_lex;
} }
#endif DISABLED_UNTIL_REWRITTEN_IN_4_1
if (select_lex->next) if (select_lex->next)
res=mysql_union(thd,lex,result); res=mysql_union(thd,lex,result);
else else

View file

@ -50,7 +50,7 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
cursor; cursor;
cursor=cursor->next) cursor=cursor->next)
{ {
if (cursor->do_redirect) if (cursor->do_redirect) // False if CUBE/ROLLUP
{ {
cursor->table= ((TABLE_LIST*) cursor->table)->table; cursor->table= ((TABLE_LIST*) cursor->table)->table;
cursor->do_redirect=false; cursor->do_redirect=false;

View file

@ -1435,22 +1435,51 @@ select_option_list:
select_option: select_option:
STRAIGHT_JOIN { Select->options|= SELECT_STRAIGHT_JOIN; } STRAIGHT_JOIN { Select->options|= SELECT_STRAIGHT_JOIN; }
| HIGH_PRIORITY { if (Select != &Lex->select_lex) YYABORT; Lex->lock_option= TL_READ_HIGH_PRIORITY; } | HIGH_PRIORITY
{
if (check_simple_select())
YYABORT;
Lex->lock_option= TL_READ_HIGH_PRIORITY;
}
| DISTINCT { Select->options|= SELECT_DISTINCT; } | DISTINCT { Select->options|= SELECT_DISTINCT; }
| SQL_SMALL_RESULT { Select->options|= SELECT_SMALL_RESULT; } | SQL_SMALL_RESULT { Select->options|= SELECT_SMALL_RESULT; }
| SQL_BIG_RESULT { Select->options|= SELECT_BIG_RESULT; } | SQL_BIG_RESULT { Select->options|= SELECT_BIG_RESULT; }
| SQL_BUFFER_RESULT { if (Select != &Lex->select_lex) YYABORT; Select->options|= OPTION_BUFFER_RESULT; } | SQL_BUFFER_RESULT
| SQL_CALC_FOUND_ROWS { if (Select != &Lex->select_lex) YYABORT; Select->options|= OPTION_FOUND_ROWS; } {
| SQL_NO_CACHE_SYM { if (Select != &Lex->select_lex) YYABORT; current_thd->safe_to_cache_query=0; } if (check_simple_select())
| SQL_CACHE_SYM { if (Select != &Lex->select_lex) YYABORT; Select->options |= OPTION_TO_QUERY_CACHE; } YYABORT;
| ALL {}; Select->options|= OPTION_BUFFER_RESULT;
}
| SQL_CALC_FOUND_ROWS
{
if (check_simple_select())
YYABORT;
Select->options|= OPTION_FOUND_ROWS;
}
| SQL_NO_CACHE_SYM { current_thd->safe_to_cache_query=0; }
| SQL_CACHE_SYM { Select->options|= OPTION_TO_QUERY_CACHE; }
| ALL {}
;
select_lock_type: select_lock_type:
/* empty */ /* empty */
| FOR_SYM UPDATE_SYM | FOR_SYM UPDATE_SYM
{ if (Select != &Lex->select_lex) YYABORT; Lex->lock_option= TL_WRITE; current_thd->safe_to_cache_query=0; } {
LEX *lex=Lex;
if (check_simple_select())
YYABORT;
lex->lock_option= TL_WRITE;
lex->thd->safe_to_cache_query=0;
}
| LOCK_SYM IN_SYM SHARE_SYM MODE_SYM | LOCK_SYM IN_SYM SHARE_SYM MODE_SYM
{ if (Select != &Lex->select_lex) YYABORT; Lex->lock_option= TL_READ_WITH_SHARED_LOCKS; current_thd->safe_to_cache_query=0; }; {
LEX *lex=Lex;
if (check_simple_select())
YYABORT;
lex->lock_option= TL_READ_WITH_SHARED_LOCKS;
lex->thd->safe_to_cache_query=0;
}
;
select_item_list: select_item_list:
select_item_list ',' select_item select_item_list ',' select_item
@ -2047,7 +2076,8 @@ join_table:
{ {
SELECT_LEX *sel=Select; SELECT_LEX *sel=Select;
if (!($$=add_table_to_list($2,$3,0,TL_UNLOCK, sel->use_index_ptr, if (!($$=add_table_to_list($2,$3,0,TL_UNLOCK, sel->use_index_ptr,
sel->ignore_index_ptr))) YYABORT; sel->ignore_index_ptr)))
YYABORT;
} }
| '{' ident join_table LEFT OUTER JOIN_SYM join_table ON expr '}' | '{' ident join_table LEFT OUTER JOIN_SYM join_table ON expr '}'
{ add_join_on($7,$9); $7->outer_join|=JOIN_TYPE_LEFT; $$=$7; }; { add_join_on($7,$9); $7->outer_join|=JOIN_TYPE_LEFT; $$=$7; };
@ -2158,14 +2188,21 @@ olap_opt:
/* empty */ {} /* empty */ {}
| WITH CUBE_SYM | WITH CUBE_SYM
{ {
Lex->olap = true; LEX *lex=Lex;
Select->olap= CUBE_TYPE; lex->olap = true;
lex->select->olap= CUBE_TYPE;
net_printf(&lex->thd->net, ER_NOT_SUPPORTED_YET, "CUBE");
YYABORT; /* To be deleted in 4.1 */
} }
| WITH ROLLUP_SYM | WITH ROLLUP_SYM
{ {
Lex->olap = true; LEX *lex=Lex;
Select->olap= ROLLUP_TYPE; lex->olap = true;
lex->select->olap= ROLLUP_TYPE;
net_printf(&lex->thd->net, ER_NOT_SUPPORTED_YET, "ROLLUP");
YYABORT; /* To be deleted in 4.1 */
} }
;
/* /*
Order by statement in select Order by statement in select
@ -2180,9 +2217,17 @@ order_clause:
{ {
LEX *lex=Lex; LEX *lex=Lex;
if (lex->sql_command == SQLCOM_MULTI_UPDATE) if (lex->sql_command == SQLCOM_MULTI_UPDATE)
{
net_printf(&lex->thd->net, ER_WRONG_USAGE, "UPDATE", "ORDER BY");
YYABORT; YYABORT;
if (lex->olap) }
YYABORT; if (lex->select->olap != UNSPECIFIED_OLAP_TYPE)
{
net_printf(&lex->thd->net, ER_WRONG_USAGE,
"CUBE/ROLLUP",
"ORDER BY");
YYABORT;
}
lex->select->sort_default=1; lex->select->sort_default=1;
} order_list; } order_list;
@ -2203,8 +2248,12 @@ limit_clause:
| LIMIT ULONG_NUM | LIMIT ULONG_NUM
{ {
LEX *lex=Lex; LEX *lex=Lex;
if (lex->olap) if (lex->select->olap != UNSPECIFIED_OLAP_TYPE)
{
net_printf(&lex->thd->net, ER_WRONG_USAGE, "CUBE/ROLLUP",
"LIMIT");
YYABORT; YYABORT;
}
SELECT_LEX *sel=Select; SELECT_LEX *sel=Select;
sel->select_limit= $2; sel->select_limit= $2;
sel->offset_limit= 0L; sel->offset_limit= 0L;
@ -2212,9 +2261,13 @@ limit_clause:
| LIMIT ULONG_NUM ',' ULONG_NUM | LIMIT ULONG_NUM ',' ULONG_NUM
{ {
LEX *lex=Lex; LEX *lex=Lex;
if (lex->olap) if (lex->select->olap != UNSPECIFIED_OLAP_TYPE)
{
net_printf(&lex->thd->net, ER_WRONG_USAGE, "CUBE/ROLLUP",
"LIMIT");
YYABORT; YYABORT;
SELECT_LEX *sel=Select; }
SELECT_LEX *sel=lex->select;
sel->select_limit= $4; sel->select_limit= $4;
sel->offset_limit= $2; sel->offset_limit= $2;
}; };
@ -2224,7 +2277,10 @@ delete_limit_clause:
{ {
LEX *lex=Lex; LEX *lex=Lex;
if (lex->sql_command == SQLCOM_MULTI_UPDATE) if (lex->sql_command == SQLCOM_MULTI_UPDATE)
{
net_printf(&lex->thd->net, ER_WRONG_USAGE, "DELETE", "LIMIT");
YYABORT; YYABORT;
}
lex->select->select_limit= HA_POS_ERROR; lex->select->select_limit= HA_POS_ERROR;
} }
| LIMIT ulonglong_num | LIMIT ulonglong_num
@ -3475,8 +3531,8 @@ opt_table:
lex->grant = DB_ACLS & ~GRANT_ACL; lex->grant = DB_ACLS & ~GRANT_ACL;
else if (lex->columns.elements) else if (lex->columns.elements)
{ {
send_error(&lex->thd->net,ER_ILLEGAL_GRANT_FOR_TABLE); send_error(&lex->thd->net,ER_ILLEGAL_GRANT_FOR_TABLE);
YYABORT; YYABORT;
} }
} }
| ident '.' '*' | ident '.' '*'
@ -3514,8 +3570,13 @@ opt_table:
user_list: user_list:
grant_user { if (Lex->users_list.push_back($1)) YYABORT;} grant_user { if (Lex->users_list.push_back($1)) YYABORT;}
| user_list ',' grant_user { if (Lex->users_list.push_back($3)) YYABORT;}; | user_list ',' grant_user
{
if (Lex->users_list.push_back($3))
YYABORT;
}
;
grant_user: grant_user:
@ -3631,42 +3692,55 @@ rollback:
union: union:
/* empty */ {} /* empty */ {}
| union_list; | union_list;
union_list: union_list:
UNION_SYM union_option UNION_SYM union_option
{ {
LEX *lex=Lex; LEX *lex=Lex;
if (lex->exchange) if (lex->exchange)
{ {
/* Only the last SELECT can have INTO...... */ /* Only the last SELECT can have INTO...... */
net_printf(&lex->thd->net, ER_WRONG_USAGE,"UNION","INTO"); net_printf(&lex->thd->net, ER_WRONG_USAGE,"UNION","INTO");
YYABORT; YYABORT;
} }
if (lex->select->linkage == NOT_A_SELECT || mysql_new_select(lex)) if (lex->select->linkage == NOT_A_SELECT)
YYABORT; {
lex->select->linkage=UNION_TYPE; send_error(&lex->thd->net, ER_SYNTAX_ERROR);
} YYABORT;
select_init; }
if (mysql_new_select(lex))
YYABORT;
lex->select->linkage=UNION_TYPE;
}
select_init
;
union_opt: union_opt:
union {} union {}
| optional_order_or_limit {}; | optional_order_or_limit {};
optional_order_or_limit: optional_order_or_limit:
/* empty */ {} /* empty */ {}
| |
{ {
LEX *lex=Lex; LEX *lex=Lex;
if (!lex->select->braces || mysql_new_select(lex)) if (!lex->select->braces)
YYABORT; {
mysql_init_select(lex); send_error(&lex->thd->net, ER_SYNTAX_ERROR);
lex->select->linkage=NOT_A_SELECT; YYABORT;
lex->select->select_limit=lex->thd->variables.select_limit; }
} if (mysql_new_select(lex))
opt_order_clause limit_clause; YYABORT;
mysql_init_select(lex);
lex->select->linkage=NOT_A_SELECT;
lex->select->select_limit=lex->thd->variables.select_limit;
}
opt_order_clause limit_clause
;
union_option: union_option:
/* empty */ {} /* empty */ {}
| ALL {Lex->union_option=1;}; | ALL { Lex->union_option=1; }
;