diff options
author | unknown <monty@hundin.mysql.fi> | 2001-11-07 00:14:43 +0200 |
---|---|---|
committer | unknown <monty@hundin.mysql.fi> | 2001-11-07 00:14:43 +0200 |
commit | 228408a8c54e34922832082c0e36c1e87f224873 (patch) | |
tree | 159482f3548d082a75cf857a65f76395451f47da | |
parent | 8547d05ccc9c00450ae8b226cb38f53f90162958 (diff) | |
parent | e49cf66e07b2b3abdceb63beed09ea9045c2dbb8 (diff) | |
download | mariadb-git-228408a8c54e34922832082c0e36c1e87f224873.tar.gz |
Merge work:/home/bk/mysql-4.0 into hundin.mysql.fi:/my/bk/mysql-4.0
Docs/manual.texi:
Auto merged
sql/item_strfunc.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
71 files changed, 1342 insertions, 917 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi index 7f0e8bd77e2..ce5933ae6d3 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -2,7 +2,7 @@ @c Copyright 1997-2001 TcX AB, Detron HB and MySQL Finland AB @c @c ********************************************************* -@c Note that @node names are used on our Website. +@c Note that @node names are used on our website. @c So do not change node names without checking @c Makefile.am and SitePages first. @c ********************************************************* @@ -122,7 +122,7 @@ distribution for that version. * Environment variables:: MySQL environment variables * Regexp:: Description of MySQL regular expression syntax * GPL license:: GNU General Public License -* LGPL license:: GNU Library General Public License +* LGPL license:: GNU Lesser General Public License * Function Index:: SQL command, type and function index * Concept Index:: Concept Index @end menu @@ -134,17 +134,21 @@ distribution for that version. @cindex overview @cindex general information -MySQL is a very fast, multi-threaded, multi-user, and robust SQL -(Structured Query Language) database server. - -You can use MySQL free of charge under the -@strong{GNU GENERAL PUBLIC LICENSE} @uref{http://www.gnu.org/licenses/}. -You can also purchase commercial MySQL licenses from MySQL AB if you -do not wish to be bound by the terms of the GPL. +@code{MySQL (TM)} is a very fast, multi-threaded, multi-user, and robust +@code{SQL} (@code{Structured Query Language}) database server. +MySQL is intended for mission-critical, heavy load production systems +as well as for embedding into mass-deployed software. +@code{MySQL} is a trademark of @code{MySQL AB}. + +MySQL has @code{Dual licensing}, you can use MySQL free of charge +under the @code{GNU GENERAL PUBLIC LICENSE} +(@uref{http://www.gnu.org/licenses/}). +You can also purchase commercial MySQL licenses from @code{MySQL AB} +if you do not wish to be bound by the terms of the GPL. @xref{Licensing and Support}. -@uref{http://www.mysql.com/, The MySQL website} -provides the latest information about MySQL. +The MySQL website (@uref{http://www.mysql.com/}) provides the latest +information about MySQL. The following list describes some useful sections of the manual: @@ -259,7 +263,8 @@ This manual is written and maintained by David Axmark, Michael (Monty) Widenius, Jeremy Cole, Arjen Lentz, and Paul DuBois. For other contributors, see @ref{Credits}. -The copyright is owned by @code{MySQL AB}. @xref{What is MySQL AB}. +The copyright (2001) to this manual is owned by the Swedish company +@code{MySQL AB}. @xref{What is MySQL AB}. @menu * Manual conventions:: Conventions Used in This Manual @@ -401,7 +406,7 @@ and provided by @code{MySQL AB}. MySQL AB is a commercial company that builds its business providing services around the MySQL database. @xref{What is MySQL AB}. -@uref{http://www.mysql.com/, The MySQL website} +The MySQL website (@uref{http://www.mysql.com/}) provides the latest information about MySQL and MySQL AB. @table @asis @@ -482,7 +487,7 @@ language already supports MySQL. @cindex MySQL, pronunciation @cindex goals of MySQL The official way to pronounce MySQL is ``My Ess Que Ell'' (not -MY-SEQUEL), but we don't mind if you pronounce it as MY-SEQUEL +``my sequel''), but we don't mind if you pronounce it as ``my sequel'' or in some other localised way. @@ -689,76 +694,85 @@ options to obtain online assistance. @cindex stability -This section addresses the questions ``How stable is MySQL?'' and -``Can I depend on MySQL in this project?'' We will try to clarify -some issues and to answer some of the more important questions that seem to -concern many people. This section has been put together from information -gathered from the mailing list (which is very active in reporting bugs). - -At TcX, the predecessor of MySQL AB, MySQL has worked without any problems in -projects since mid-1996. Original code stems back from the early 80s, -providing a table code base, and the ISAM table format remains backwards -compatible. When MySQL was released to a wider public, we noticed that there -were some pieces of ``untested code'' that were quickly found by the new users -who made queries in a manner different than our own. Each new release has had -fewer portability problems than the previous one (even though each has had -many new features). - -Each release of MySQL has been usable, and there have been problems -only when users start to use code from the ``gray zones.'' Naturally, outside -users don't know what the gray zones are; this section attempts to indicate -those that are currently known. The descriptions deal with Version 3.23 -of MySQL. All known and reported bugs are fixed in the latest -version, with the exception of the bugs listed in the bugs section, which -are things that are design-related. @xref{Bugs}. - -MySQL is written in multiple layers and different independent modules. -Some of the new modules are listed below with an indication of how -well-tested each of them is: +This section addresses the questions ``@emph{How stable is MySQL?}'' +and ``@emph{Can I depend on MySQL in this project?}'' +We will try to clarify these issues and answer some important +questions that concern many potential users. The information in this +section is based on data gathered from the mailing list, which is +very active in identifying problems as well as reporting types of use. + +Original code stems back from the early 80s, providing a stable code +base, and the ISAM table format remains backwards compatible. +At TcX, the predecessor of MySQL AB, MySQL has worked in projects +since mid-1996, without any problems. +When MySQL was released to a wider public, we noticed that there were +some pieces of ``untested code'' that were quickly found by the new +users who made different types of queries from us. Each new release +has had fewer portability problems (even though each new release has +had many new features). + +Each release of MySQL has been usable. There have only been problems +when users try code from the ``gray zones.'' Naturally, new users +don't know what the gray zones are; this section attempts to indicate +those that are currently known. +The descriptions mostly deal with Version 3.23 of MySQL. +All known and reported bugs are fixed in the latest version, with the +exception of those listed in the bugs section, which are things that +are design-related. @xref{Bugs}. + +MySQL design is multi-layered with independent modules. Some of the +newer modules are listed below with an indication of how well-tested +each of them is: @cindex modules, list of @table @strong -@item Locking --- Gamma -This is very system-dependent. On some systems there are big problems -using standard OS locking (@code{fcntl()}). In these cases, you should run the -MySQL daemon with the @code{--skip-locking} flag. Problems are known -to occur on some Linux systems, and on SunOS when using NFS-mounted file -systems. - -@item @strong{MyODBC 2.50} (uses ODBC SDK 2.5) --- Gamma -It seems to work well with some programs. - @item Replication -- Gamma -We are still working on replication, so don't expect this to be rock -solid yet. On the other hand, some MySQL users are already -using this with good results. - -@item BDB Tables -- Gamma -The Berkeley DB code is very stable, but we are still improving the interface -between MySQL and BDB tables, so it will take some time before this -is tested as well as the other table types. - -@item InnoDB Tables -- Gamma -This is a recent addition to @code{MySQL}. They appear to work well and -can be used after some initial testing. - -@item Automatic recovery of MyISAM tables - Gamma -This only affects the new code that checks if the table was closed properly -on open and executes an automatic check/repair of the table if it wasn't. - -@item FULLTEXT -- Beta -Text search seems to work, but is still not widely used. - -@item Bulk-insert - Alpha +Large server clusters using replication are in production use, with +good results. Work on enhanced replication features is continuing +in MySQL 4.0. + +@item @code{InnoDB} tables -- Gamma +While the @code{InnoDB} transactional table handler is a fairly recent +addition to @code{MySQL}, it appears to work well and is already being +used in some large, heavy load production systems. + +@item @code{BDB} tables -- Gamma +The @code{Berkeley DB} code is very stable, but we are still improving +the @code{BDB} transactional table handler interface in MySQL, so it +will take some time before this is as well tested as the other table +types. + +@item @code{FULLTEXT} -- Beta +Full text search works but is not yet widely used. +Important enhancements are being implemented for MySQL 4.0. + +@item @code{MyODBC 2.50} (uses ODBC SDK 2.5) -- Gamma +Increasingly in wide use. Some issues brought up appear to be +application related and independent of the ODBC driver or underlying +database server. + +@item Automatic recovery of @code{MyISAM} tables -- Gamma +This status only regards the new code in the @code{MyISAM} table +handler that checks if the table was closed properly on open and +executes an automatic check/repair of the table if it wasn't. + +@item Bulk-insert -- Alpha New feature in MyISAM in MySQL 4.0 for faster insert of many rows. +@item Locking -- Gamma +This is very system-dependent. On some systems there are big problems +using standard OS locking (@code{fcntl()}). In these cases, you should +run @code{mysqld} with the @code{--skip-locking} flag. +Problems are known to occur on some Linux systems, and on SunOS when +using NFS-mounted file systems. + @end table MySQL AB provides high-quality support for paying customers, but the MySQL mailing list usually provides answers to common questions. -Bugs are usually fixed right away with a patch; for serious bugs, there is -almost always a new release. +Bugs are usually fixed right away with a patch; for serious bugs, +there is almost always a new release. @node Table size, Year 2000 compliance, Stability, What-is @@ -976,7 +990,7 @@ Are a virtual company, networking with others. Work against software patents. @end itemize -@uref{http://www.mysql.com/, The MySQL website} +The MySQL website (@uref{http://www.mysql.com/}) provides the latest information about MySQL and MySQL AB. @@ -1133,7 +1147,7 @@ founders have built over the years. @node Business Services Advertising, , Business Services Partnering, MySQL AB business model and services @subsubsection Advertising -The MySQL website (@uref{http://www.mysql.com/}) immensely popular among +The MySQL website (@uref{http://www.mysql.com/}) is immensely popular among developers and users. In October 2001, we served 10 million page views. Our visitors represent a group that makes purchase decisions and recommendations for both software and hardware. Twelve per cent of our @@ -1142,8 +1156,9 @@ involved in purchase decisions at all. More than 65% have made one or more online business purchase within the last half-year, and 70% plan to make one in the next months. -If you are interested in placing banner ads on our website, please send -an email to @email{advertising@@mysql.com}. +If you are interested in placing banner ads on our website +@uref{http://www.mysql.com/}, please send an email to +@email{advertising@@mysql.com}. @node Contact information, , MySQL AB business model and services, What is MySQL AB @@ -1156,7 +1171,7 @@ an email to @email{advertising@@mysql.com}. @cindex employment with MySQL @cindex jobs at MySQL -@uref{http://www.mysql.com/, The MySQL website} +The MySQL website (@uref{http://www.mysql.com/}) provides the latest information about MySQL and MySQL AB. For press service and inquiries not covered in our News releases @@ -1192,7 +1207,8 @@ Commercial licenses may be purchased online at @uref{https://order.mysql.com/}. There you will also find information on how to fax your purchase order to MySQL AB. If you have questions regarding licensing or you want a quote for a high-volume license -deal, please fill in the contact form on our website or send an email +deal, please fill in the contact form on our website +(@uref{http://www.mysql.com/}) or send an email to @email{licensing@@mysql.com} (for licensing questions) or to @email{sales@@mysql.com} (for sales inquiries). @xref{MySQL server licenses}. @@ -1228,10 +1244,15 @@ security bug in MySQL, you should send an e-mail to @email{security@@mysql.com}. @xref{Bug reports}. +If you have benchmark results that we can publish, please +contact us at @email{benchmarks@@mysql.com}. +@xref{Comparisons}. + If you have any suggestions concerning additions or corrections to this manual, please send them to the manual team at @email{docs@@mysql.com}. -For questions or comments about the workings or content of the Website, +For questions or comments about the workings or content of the +MySQL website (@uref{http://www.mysql.com/}), please send e-mail to @email{webmaster@@mysql.com}. MySQL AB has a privacy policy, which can be read at @@ -1251,20 +1272,60 @@ For all other inquires, please send e-mail to @email{info@@mysql.com}. This section describes MySQL support and licensing arrangements: @menu -* Copyright:: Copyrights used by MySQL -* Support:: -* MySQL server licenses:: -* MySQL AB Logos and Trademarks:: +* Support:: Support Offered by MySQL AB +* Copyright:: Copyrights and Licenses Used by MySQL +* MySQL server licenses:: MySQL Server Licenses +* MySQL AB Logos and Trademarks:: MySQL AB Logos and Trademarks @end menu -@node Copyright, Support, Licensing and Support, Licensing and Support -@subsection Copyrights Used by MySQL +@node Support, Copyright, Licensing and Support, Licensing and Support +@subsection Support Offered by MySQL AB + +@cindex support, types +@cindex types, of support +@cindex commercial support, types +@cindex costs, support +@cindex licensing costs +@cindex support costs +@cindex prices, support + +Technical support from MySQL AB means individualised answers to your +unique problems direct from the software engineers who code the MySQL +database engine. + +We try to take a broad and inclusive view of technical support. Almost +any problem involving MySQL is important to us if it's important to you. +Typically customers seek help on how to get different commands and +utilities to work, remove performance bottlenecks, restore crashed +systems, understand operating system or networking impacts on MySQL, +set-up best practices for backup and recovery, utilise APIs, etc. +Our support covers only the MySQL server and our own utilities, not +third-party products that access MySQL, though we try to help with +these where we can. + +Detailed information about our various support options is given at +@uref{https://order.mysql.com/} where support contracts can also be +ordered online. If you have restricted access to the Internet, contact +our sales staff at @email{sales@@mysql.com}. + +Technical support is like life insurance. You can live happily +without it for years, but when your hour arrives it becomes +critically important, yet it's too late to buy it! +If you use MySQL for important applications and encounter sudden +troubles, it might take too long to figure out all the answers +yourself. You may need immediate access to the most experienced +MySQL troubleshooters available, those employed by MySQL AB. + + +@node Copyright, MySQL server licenses, Support, Licensing and Support +@subsection Copyrights and Licenses Used by MySQL @cindex copyrights +@cindex licenses @code{MySQL AB} owns the copyright to the MySQL source code, -the MySQL logo and trademark and this manual. +the MySQL logos and trademarks and this manual. @xref{What is MySQL AB}. There are several different licenses relevant to the MySQL distribution: @@ -1278,7 +1339,7 @@ at the beginning which license it is under. @item The client library, and the GNU @code{getopt} library, are covered -by the ``GNU LIBRARY GENERAL PUBLIC LICENSE.'' @xref{LGPL license}. +by the ``GNU LESSER GENERAL PUBLIC LICENSE.'' @xref{LGPL license}. The aim of this is to make it possible to add MySQL support (client side, i.e. the ability to connect to a MySQL server) into commercial products without a license. @@ -1299,51 +1360,12 @@ Older versions of MySQL (3.22 and earlier) are subject to a more See the documentation of the specific version for information. @end enumerate -For information about how the MySQL licenses work in practise, +For information about how the MySQL licenses work in practice, please refer to @ref{MySQL server licenses}. Also see @ref{MySQL AB Logos and Trademarks}. -@node Support, MySQL server licenses, Copyright, Licensing and Support -@subsection Support offered by MySQL AB - -@cindex support, types -@cindex types, of support -@cindex commercial support, types -@cindex costs, support -@cindex licensing costs -@cindex support costs -@cindex prices, support - -Technical support from MySQL AB means individualised answers to your -unique problems direct from the software engineers who code the MySQL -database engine. - -We try to take a broad and inclusive view of technical support. Almost -any problem involving MySQL is important to us if it's important to you. -Typically customers seek help on how to get different commands and -utilities to work, remove performance bottlenecks, restore crashed -systems, understand operating system or networking impacts on MySQL, -set-up best practises for backup and recovery, utilise APIs, etc. -Our support covers only the MySQL server and our own utilities, not -third-party products that access MySQL, though we try to help with -these where we can. - -Detailed information about our various support options is given at -@uref{https://order.mysql.com/} where support contracts can also be -ordered online. If you have restricted access to the Internet, contact -our sales staff at @email{sales@@mysql.com}. - -Technical support is like life insurance. You can live happily -without it for years, but when your hour arrives it becomes -critically important, yet it's too late to buy it! -If you use MySQL for important applications and encounter sudden -troubles, it might take too long to figure out all the answers -yourself. You may need immediate access to the most experienced -MySQL troubleshooters available, those employed by MySQL AB. - - -@node MySQL server licenses, MySQL AB Logos and Trademarks, Support, Licensing and Support +@node MySQL server licenses, MySQL AB Logos and Trademarks, Copyright, Licensing and Support @subsection MySQL Server Licenses @cindex licensing policy @@ -1360,8 +1382,8 @@ of the GPL license can be found at @uref{http://www.gnu.org/licenses/}. See also @uref{http://www.gnu.org/licenses/gpl-faq.html}. Since the MySQL server is released under the GPL, it may often be used -for free, but for certain uses you need to buy commercial licenses from -MySQL AB at @uref{http://www.mysql.com/}. +for free, but for certain uses you may want or need to buy commercial +licenses from MySQL AB at @uref{https://order.mysql.com/}. Older versions of MySQL (3.22 and earlier) are subject to a more @uref{http://www.mysql.com/support/arrangements/mypl.html, strict license}. @@ -1407,7 +1429,7 @@ source code as required under the GPL license. @item When you want to support the further development of the MySQL database -even if you don't formally need a commercial license. Purchasing suppport +even if you don't formally need a commercial license. Purchasing support directly from MySQL AB is another good way of contributing to the development of MySQL, with immediate advantages for you. @xref{Support}. @@ -1448,7 +1470,7 @@ When using the MySQL server internally in your company. @item When include the MySQL client code in a commercial program. The client part of MySQL is licensed under the LGPL -@code{GNU Library General Public License}. The formal terms of the +@code{GNU Lesser General Public License}. The formal terms of the LGPL license can be found at @uref{http://www.gnu.org/licenses/}. However, the @code{mysql} command-line client does include code @@ -1564,7 +1586,7 @@ use the MySQL AB trademark. @item If you use the trademark on a website, make it clickable, leading directly -to @uref{http://www.mysql.com/} +to @uref{http://www.mysql.com/}. @item If you are using the MySQL database under GPL in an application, your @@ -1864,7 +1886,7 @@ the electronic mail address @email{mysql-unsubscribe@@lists.mysql.com}. Only the address to which you send your messages is significant. The subject line and the body of the message are ignored. -@c the last two addresses in this paragraph are NOT @email because they +@c the last two addresses in this paragraph are not @email because they @c shouldn't be live links. If your reply address is not valid, you can specify your address explicitly. Adding a hyphen to the subscribe or unsubscribe command @@ -1876,7 +1898,7 @@ address replaced by a @samp{=}. For example, to subscribe Mail to @email{mysql-subscribe@@lists.mysql.com} or @email{mysql-unsubscribe@@lists.mysql.com} is handled automatically by the ezmlm mailing list processor. Information about ezmlm is available at -@uref{http://www.ezmlm.org, The ezmlm Website}. +@uref{http://www.ezmlm.org, The ezmlm website}. To post a message to the list itself, send your message to @code{mysql@@lists.mysql.com}. However, please @emph{do not} send mail about @@ -2305,20 +2327,20 @@ try repairing your tables with @code{myisamchk} or @code{CHECK TABLE} and @item If you often get corrupted tables you should try to find out when and why this -happens! In this case, the @file{mysql-data-directory/'hostname'.err} file +happens. In this case, the @file{mysql-data-directory/'hostname'.err} file may contain some information about what happened. @xref{Error log}. Please -include any relevant information from this file in your bug report! Normally -@code{mysqld} should @strong{NEVER} crash a table if nothing killed it in the +include any relevant information from this file in your bug report. Normally +@code{mysqld} should @strong{never} crash a table if nothing killed it in the middle of an update! If you can find the cause of @code{mysqld} dying, -it's much easier for us to provide you with a fix for the problem! +it's much easier for us to provide you with a fix for the problem. @xref{What is crashing}. @item If possible, download and install the most recent version of MySQL and check whether or not it solves your problem. All versions of -MySQL are thoroughly tested and should work without problems! We +MySQL are thoroughly tested and should work without problems. We believe in making everything as backward compatible as possible, and you -should be able to switch MySQL versions in minutes! +should be able to switch MySQL versions without any hassle. @xref{Which version}. @end itemize @@ -2482,7 +2504,7 @@ can be retrieved via the Web. Sams' @emph{Teach Yourself MySQL in 21 Days} is a practical, step-by-step tutorial. The reader will learn to design and employ this open source -database technology into his or her Website using practical, hands-on +database technology into his or her website using practical, hands-on examples to follow. @* @@ -2782,6 +2804,16 @@ PHP/MySQL Tutorial. Hands on tutorial for MySQL. @end table +@subheading MySQL Discussion Forums + +@table @asis +@item @uref{http://www.weberdev.com/} +Examples using MySQL; (check Top 20) + +@item @uref{http://futurerealm.com/forum/futureforum.htm} +FutureForum Web Discussion Software. +@end table + @subheading Porting MySQL/Using MySQL on Different Systems @table @asis @@ -2815,16 +2847,6 @@ MySQL for Amiga Perl DBI with MySQL FAQ. @end table -@subheading MySQL Discussion Forums - -@table @asis -@item @uref{http://www.weberdev.com/} -Examples using MySQL; (check Top 20) - -@item @uref{http://futurerealm.com/forum/futureforum.htm} -FutureForum Web Discussion Software. -@end table - @c FIX We should get longer descriptions for things in this category! @subheading Commercial Applications that Support MySQL @@ -3263,11 +3285,11 @@ for any usage. Even if we don't have the resources to do development for every possible use, we are always willing to help and offer suggestions to people that is trying to use MySQL in new territories. -One of our main goals with the product is to continue to work against -getting to be ANSI 99 compliant, but without sacrificing speed or -reliability. We are not afraid to add extensions to SQL or support for -non-SQL features if this greatly increase the usability of MySQL for a -big part of our users. (The new @code{HANDLER} interface in MySQL 4.0 +One of our main goals with the product is to continue to work towards +ANSI 99 compliancy, but without sacrificing speed or reliability. +We are not afraid to add extensions to SQL or support for non-SQL +features if this greatly increase the usability of MySQL for a big +part of our users. (The new @code{HANDLER} interface in MySQL 4.0 is an example of this strategy. @xref{HANDLER}.) We will continue to support transactional and not transactional @@ -4403,16 +4425,20 @@ For platform-specific bugs, see the sections about compiling and porting. * Compare PostgreSQL:: How MySQL compares with PostgreSQL @end menu -This section compares MySQL to other databases. +Our users have successfully run their own benchmarks against a number +of @code{Open Source} and traditional database servers. We are aware of +tests against @code{Oracle}, @code{DB/2}, @code{Microsoft SQL Server} +and other commercial products. Due to legal reasons we are restricted +from publishing some of those benchmarks in our reference manual. -This section has been written by the MySQL developers, so it -should be read with that in mind. There are no factual errors contained -in this section that we know of. If you find something which you believe -to be an error, please contact us about it at @email{docs@@mysql.com}. +This section includes a comparison with @code{mSQL} for historical +reasons and with @code{PostgreSQL} as it is also an Open Source +database. If you have benchmark results that we can publish, please +contact us at @email{benchmarks@@mysql.com}. -@c FIX this is bad lingo: "supported limits", etc. -For a list of all supported limits, functions, and types, see the -@code{crash-me} Web page at +For comparative lists of all supported functions and types as well +as measured operational limits of many different database systems, +see the @code{crash-me} web page at @uref{http://www.mysql.com/information/crash-me.php}. @@ -5298,7 +5324,7 @@ benchmark page. Before going to the other benchmarks we know of, we would like to give some background on benchmarks: -It's very easy to write a test that shows ANY database to be the best +It's very easy to write a test that shows @strong{any} database to be the best database in the world, by just restricting the test to something the database is very good at and not testing anything that the database is not good at. If one, after doing this, summarises the result with as @@ -5336,12 +5362,12 @@ conduct. This was not only tuned to only test what PostgreSQL is absolutely best at, it was also totally unfair against every other database involved in the test. -@strong{NOTE}: We know that not even some of the main PostgreSQL -developers did like the way Great Bridge conducted the benchmark, so we -don't blame them for the way the benchmark was done. +@strong{Note}: We know that even some of the main PostgreSQL +developers did not like the way Great Bridge conducted the benchmark, so we +don't blame the PostgreSQL team for the way the benchmark was done. This benchmark has been condemned in a lot of postings and newsgroups so -we will here just shortly repeat some things that where wrong with it. +we will here just shortly repeat some things that were wrong with it. @itemize @bullet @item @@ -5527,13 +5553,19 @@ this without sacrifying the speed or compromise the code. @subsection Things That Should be in 4.0 We have now shifted development to MySQL Version 4.0. Most of the basic -things we want to have in 4.0 is already done. The target is to quickly +things we want to have in 4.0 are already done. The target is to quickly implement the rest of the following features and then shift development to MySQL 4.1. @xref{MySQL 4.0 In A Nutshell}. The news section for 4.0 includes a list of the features we have already implemented in the 4.0 tree. @xref{News-4.0.x}. +This section lists features not yet implemented in the current +version of MySQL 4.0, which will however be implemented in +later versions of MySQL 4.0. This being very volatile information, +please consider this list valid only if you are reading it from +the MySQL website (@uref{http://www.mysql.com/}). + @itemize @bullet @item Allow users to change startup options without taking down the server. @@ -5730,7 +5762,7 @@ Added @code{LOAD DATE INFILE.. UPDATE} syntax. @item For tables with primary keys, if the data contains the primary key, entries matching that primary key are updated from the remainder of the -columns. However, columns MISSING from the incoming data feed are not +columns. However, columns @strong{missing} from the incoming data feed are not touched. @item For tables tables with primary keys that are missing some part of the key @@ -5799,15 +5831,15 @@ Add support for UNICODE. @code{NATURAL JOIN} and @code{UNION JOIN} @item Allow @code{select a from crash_me left join crash_me2 using (a)}; In this -case a is assumed to come from the crash_me table. +case @code{a} is assumed to come from the @code{crash_me} table. @item Fix that @code{ON} and @code{USING} works with the @code{JOIN} join type. @item Oracle like @code{CONNECT BY PRIOR ...} to search hierarchy structures. @item -@code{mysqladmin copy database new-database}. -- Requires COPY command to be -added to @code{mysqld} +@code{mysqladmin copy database new-database}; Requires @code{COPY} +command to be added to @code{mysqld} @item Processlist should show number of queries/thread. @item @@ -5910,8 +5942,8 @@ in function. @item Use of full calculation names in the order part. (For ACCESS97) @item -@code{UNION}, @code{MINUS}, @code{INTERSECT} and @code{FULL OUTER JOIN}. -(Currently only @code{LEFT OUTER JOIN} is supported) +@code{MINUS}, @code{INTERSECT} and @code{FULL OUTER JOIN}. +(Currently @code{UNION} (in 4.0) and @code{LEFT OUTER JOIN} are supported) @item Allow @code{UNIQUE} on fields that can be @code{NULL}. @item @@ -6345,7 +6377,7 @@ see @ref{Windows}. @cindex mirror sites @cindex URLS for downloading MySQL -Check the @uref{http://www.mysql.com/, MySQL home page} for +Check the MySQL homepage (@uref{http://www.mysql.com/}) for information about the current version and for downloading instructions. Our main download mirror is located at: @@ -7407,7 +7439,7 @@ install the standard @code{MySQL} RPM. @item If you want to configure @code{mysqld} with some extra features that are -NOT in the standard binary distributions. Here is a list of the most +not in the standard binary distributions. Here is a list of the most common extra options that you may want to use: @itemize @bullet @@ -7749,7 +7781,7 @@ An alternative installation method under Linux is to use RPM (RedHat Package Manager) distributions. @xref{Linux-RPM}. @c texi2html fails to split chapters if I use strong for all of this. -If you run into problems, @strong{PLEASE ALWAYS USE} @code{mysqlbug} when +If you run into problems, @strong{please always use @code{mysqlbug}} when posting questions to @email{mysql@@lists.mysql.com}. Even if the problem isn't a bug, @code{mysqlbug} gathers system information that will help others solve your problem. By not using @code{mysqlbug}, you lessen the likelihood @@ -7981,7 +8013,7 @@ sometimes required. If you have problems, we recommend trying GNU @end itemize If you are using a recent version of @strong{gcc}, recent enough to understand -@code{-fno-exceptions} option, it is @strong{VERY IMPORTANT} that you use +@code{-fno-exceptions} option, it is @strong{very important} that you use it. Otherwise, you may compile a binary that crashes randomly. We also recommend that you use @code{-felide-contructors} and @code{-fno-rtti} along with @code{-fno-exceptions}. When in doubt, do the following: @@ -7995,7 +8027,7 @@ CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtt On most systems this will give you a fast and stable binary. @c texi2html fails to split chapters if I use strong for all of this. -If you run into problems, @strong{PLEASE ALWAYS USE @code{mysqlbug}} when +If you run into problems, @strong{please always use @code{mysqlbug}} when posting questions to @email{mysql@@lists.mysql.com}. Even if the problem isn't a bug, @code{mysqlbug} gathers system information that will help others solve your problem. By not using @code{mysqlbug}, you lessen the likelihood @@ -8201,8 +8233,8 @@ running. @xref{Multiple servers}. @cindex applying, patches Sometimes patches appear on the mailing list or are placed in the -@uref{http://www.mysql.com/Downloads/Patches, patches area} of the -MySQL website. +patches area of the MySQL website +(@uref{http://www.mysql.com/Downloads/Patches}). To apply a patch from the mailing list, save the message in which the patch appears in a file, change into the top-level directory of your MySQL @@ -8382,7 +8414,7 @@ CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro -felide-constructor @end example The binaries we provide on the MySQL website at -@uref{http://www.mysql.com} are all compiled with full optimisation and +@uref{http://www.mysql.com/} are all compiled with full optimisation and should be perfect for most users. @xref{MySQL binaries}. There are some things you can tweak to make an even faster binary, but this is only for advanced users. @xref{Compile and link options}. @@ -8475,7 +8507,7 @@ system-specific section of this manual. @cindex BitKeeper tree @cindex cvs tree -@strong{CAUTION:} You should read this section only if you are interested +@strong{Caution:} You should read this section only if you are interested in helping us test our new code. If you just want to get MySQL up and running on your system, you should use a standard release distribution (either a source or binary distribution will do). @@ -9848,7 +9880,7 @@ return any server error, only @code{CR_UNKNOWN_ERROR} (but it works for client errors), and the server uses the old @code{password()} checking rather than the new one. -If you are @strong{NOT} using the @code{--old-protocol} option to +If you are @strong{not} using the @code{--old-protocol} option to @code{mysqld}, you will need to make the following changes: @itemize @bullet @@ -10048,10 +10080,10 @@ Linux version that doesn't have @code{glibc2}, you must install LinuxThreads before trying to compile MySQL. You can get LinuxThreads at @uref{http://www.mysql.com/Downloads/Linux}. -@strong{NOTE:} We have seen some strange problems with Linux 2.2.14 and +@strong{Note:} We have seen some strange problems with Linux 2.2.14 and MySQL on SMP systems; If you have a SMP system, we recommend -you to upgrade to Linux 2.4 ASAP! Your system will be faster and more -stable by doing this! +you to upgrade to Linux 2.4 as soon as possible! Your system will be +faster and more stable by doing this! Note that @code{glibc} versions before and including Version 2.1.1 have a fatal bug in @code{pthread_mutex_timedwait} handling, which is used @@ -10487,7 +10519,7 @@ Debugging threaded applications like MySQL will not work with @item If you try linking @code{mysqld} statically when using @code{gcc}, the -resulting image will core dump at start. In other words, @strong{DON'T} +resulting image will core dump at start. In other words, @strong{don't} use @code{--with-mysqld-ldflags=-all-static} with @code{gcc}. @end itemize @@ -10820,7 +10852,7 @@ On your Windows machine, start some ODBC application (such as Access). @item Create a new file in Windows and link to MySQL using the ODBC -driver the same way you normally do, EXCEPT type in @code{localhost} +driver the same way you normally do, except type in @code{localhost} for the MySQL host server --- not @code{yourmysqlservername}. @end itemize @@ -11934,7 +11966,7 @@ you must also remove the @code{-qstrict} option (this is a limitation in the IBM C compiler). If you are using @code{gcc} or @code{egcs} to compile MySQL, you -@strong{MUST} use the @code{-fno-exceptions} flag, as the exception +@strong{must} use the @code{-fno-exceptions} flag, as the exception handling in @code{gcc}/@code{egcs} is not thread safe! (This is tested with @code{egcs} 1.1.) There are also some known problems with IBM's assembler, which may cause it to generate bad code when used with gcc. @@ -12788,7 +12820,7 @@ to $sysliblist .= " -lm -lz"; @end example -After this, you MUST run 'make realclean' and then proceed with the +After this, you @strong{must} run 'make realclean' and then proceed with the installation from the beginning. If you want to use the Perl module on a system that doesn't support dynamic @@ -16008,16 +16040,16 @@ files to @code{safe_mysqld} with @code{--log}, @code{--log-update}, or @code{--log-slow-queries}. Otherwise, both servers may be trying to write to the same log file. -@strong{WARNING}: Normally you should never have two servers that update +@strong{Warning}: Normally you should never have two servers that update data in the same database! If your OS doesn't support fault-free system locking, this may lead to unpleasant surprises! If you want to use another database directory for the second server, you can use the @code{--datadir=path} option to @code{safe_mysqld}. -@strong{NOTE} also that starting several MySQL servers +@strong{Note} also that starting several MySQL servers (@code{mysqlds}) in different machines and letting them access one data -directory over @code{NFS} is generally a @strong{BAD IDEA}! The problem +directory over @code{NFS} is generally a @strong{bad idea}! The problem is that the @code{NFS} will become the bottleneck with the speed. It is not meant for such use. And last but not least, you would still have to come up with a solution how to make sure that two or more @code{mysqlds} @@ -16120,11 +16152,12 @@ When running MySQL, follow these guidelines whenever possible: @itemize @bullet @item -DON'T EVER GIVE ANYONE (EXCEPT THE MySQL ROOT USER) ACCESS TO THE -@code{user} TABLE IN THE @code{mysql} DATABASE! The encrypted password -is the real password in MySQL. If you know the password listed in -the @code{user} table for a given user, you can easily log in as that -user if you have access to the host listed for that account. +@strong{Do not ever give anyone (except the mysql root user) access to the +@code{user} table in the @code{mysql} database!} This is critical. +@strong{The encrypted password is the real password in MySQL.} +Anyone who knows the password which is listed in the @code{user} table +and has access to the host listed for the account @strong{can easily log +in as that user}. @item Learn the MySQL access privilege system. The @code{GRANT} and @@ -16854,7 +16887,7 @@ Alternate forms of the @code{-h}, @code{-u}, and @code{-p} options are @code{--password=your_pass}. Note that there is @emph{no space} between @code{-p} or @code{--password=} and the password following it. -@strong{NOTE:} Specifying a password on the command line is not secure! +@strong{Note:} Specifying a password on the command line is not secure! Any user on your system may then find out your password by typing a command like: @code{ps auxww}. @xref{Option files}. @@ -17749,7 +17782,7 @@ you use a @code{column_list} clause) are @code{SELECT}, @code{INSERT}, and You can set global privileges by using @code{ON *.*} syntax. You can set database privileges by using @code{ON db_name.*} syntax. If you specify @code{ON *} and you have a current database, you will set the privileges for -that database. (@strong{WARNING:} If you specify @code{ON *} and you +that database. (@strong{Warning:} If you specify @code{ON *} and you @emph{don't} have a current database, you will affect the global privileges!) In order to accommodate granting rights to users from arbitrary hosts, @@ -17765,7 +17798,7 @@ You can specify wild cards in the hostname. For example, for any host in the @code{144.155.166} class C subnet. The simple form @code{user} is a synonym for @code{user@@"%"}. -@strong{NOTE:} If you allow anonymous users to connect to the MySQL +@strong{Note:} If you allow anonymous users to connect to the MySQL server (which is the default), you should also add all local users as @code{user@@localhost} because otherwise the anonymous user entry for the local host in the @code{mysql.user} table will be used when the user tries to @@ -17815,7 +17848,7 @@ password will be set to the password specified by the @code{IDENTIFIED BY} clause, if one is given. If the user already had a password, it is replaced by the new one. -@strong{WARNING:} If you create a new user but do not specify an +@strong{Warning:} If you create a new user but do not specify an @code{IDENTIFIED BY} clause, the user has no password. This is insecure. Passwords can also be set with the @code{SET PASSWORD} command. @@ -17968,7 +18001,7 @@ or the short form: mysql -u monty -p database_name @end example -Note that in the last example the password is @strong{NOT} 'database_name'. +Note that in the last example the password is @strong{not} 'database_name'. If you want to use the @code{-p} option to supply a password you should do so like this: @@ -18039,7 +18072,7 @@ of privileges: The MySQL @code{root} user is created as a superuser who can do anything. Connections must be made from the local host. -@strong{NOTE:} +@strong{Note:} The initial @code{root} password is empty, so anyone can connect as @code{root} @emph{without a password} and be granted all privileges. @@ -18055,7 +18088,7 @@ Other privileges are denied. For example, normal users can't use @code{mysqladmin shutdown} or @code{mysqladmin processlist}. @end itemize -@strong{NOTE:} The default privileges are different for Windows. +@strong{Note:} The default privileges are different for Windows. @xref{Windows running}. Because your installation is initially wide open, one of the first things you @@ -18116,8 +18149,8 @@ the database directory, which is listed when you run @code{mysqld --help}.) Then run the @code{mysql_install_db} script, possibly after editing it first to have the privileges you want. -@strong{NOTE:} For MySQL versions older than Version 3.22.10, -you should NOT delete the @file{.frm} files. If you accidentally do this, +@strong{Note:} For MySQL versions older than Version 3.22.10, +you should not delete the @file{.frm} files. If you accidentally do this, you should copy them back from your MySQL distribution before running @code{mysql_install_db}. @@ -18312,9 +18345,8 @@ mysql> FLUSH PRIVILEGES; You can also use @code{xmysqladmin}, @code{mysql_webadmin}, and even @code{xmysql} to insert, change, and update values in the grant tables. -You can find these utilities in the -@uref{http://www.mysql.com/Downloads/Contrib/,Contrib directory of the MySQL -Website}. +You can find these utilities in the Contrib directory of the +MySQL website (@uref{http://www.mysql.com/Downloads/Contrib/}). @node Passwords, Password security, Adding users, User Account Management @@ -18893,7 +18925,7 @@ CHECK TABLE test_table FAST QUICK; Which only would do a quick check on the table if it wasn't closed properly. -@strong{NOTE:} that in some case @code{CHECK TABLE} will change the +@strong{Note:} that in some case @code{CHECK TABLE} will change the table! This happens if the table is marked as 'corrupted' or 'not closed properly' but @code{CHECK TABLE} didn't find any problems in the table. In this case @code{CHECK TABLE} will mark the table as ok. @@ -18918,7 +18950,7 @@ bug you have found a bug in the @code{MyISAM} code.) @code{EXTENDED} is only to be used after you have run a normal check but still get strange errors from a table when MySQL tries to -update a row or find a row by key (this is VERY unlikely to happen if a +update a row or find a row by key (this is very unlikely if a normal check has succeeded!). Some things reported by check table, can't be corrected automatically: @@ -19204,7 +19236,7 @@ Check table for errors. This is the default operation if you are not giving @code{myisamchk} any options that override this. @item -e or --extend-check -Check the table VERY thoroughly (which is quite slow if you have many +Check the table very thoroughly (which is quite slow if you have many indexes). This option should only be used in extreme cases. Normally, @code{myisamchk} or @code{myisamchk --medium-check} should, in most cases, be able to find out if there are any errors in the table. @@ -19328,7 +19360,7 @@ This will optimise seeks and will make table scanning by key faster. @item -R or --sort-records=# Sorts records according to an index. This makes your data much more localised and may speed up ranged @code{SELECT} and @code{ORDER BY} operations on -this index. (It may be VERY slow to do a sort the first time!) +this index. (It may be very slow to do a sort the first time!) To find out a table's index numbers, use @code{SHOW INDEX}, which shows a table's indexes in the same order that @code{myisamchk} sees them. Indexes are numbered beginning with 1. @@ -19410,13 +19442,15 @@ to update the table will wait until @code{myisamchk} is ready before continuing. 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}). If you don't take down @code{mysqld} you should at least do a @code{mysqladmin flush-tables} before you run @code{myisamchk}. +Your tables @strong{may be corrupted} if the server and @code{myisamchk} +access the tables simultaneously. This chapter describes how to check for and deal with data corruption -in MySQL databases. If your tables get corrupted a lot you should +in MySQL databases. If your tables get corrupted frequently you should try to find the reason for this! @xref{Crashing}. The @code{MyISAM} table section contains reason for why a table could be @@ -19464,7 +19498,7 @@ To check a MyISAM table, use the following commands: @table @code @item myisamchk tbl_name This finds 99.99% of all errors. What it can't find is corruption that -involves @strong{ONLY} the data file (which is very unusual). If you want +involves @strong{only} the data file (which is very unusual). If you want to check a table, you should normally run @code{myisamchk} without options or with either the @code{-s} or @code{--silent} option. @@ -19477,7 +19511,7 @@ in the index tree. @item myisamchk -e tbl_name This does a complete and thorough check of all data (@code{-e} means ``extended check''). It does a check-read of every key for each row to verify -that they indeed point to the correct row. This may take a LONG time on a +that they indeed point to the correct row. This may take a long time on a big table with many keys. @code{myisamchk} will normally stop after the first error it finds. If you want to obtain more information, you can add the @code{--verbose} (@code{-v}) option. This causes @code{myisamchk} to keep @@ -19589,7 +19623,7 @@ memory} errors), or if @code{myisamchk} crashes, go to Stage 3. @noindent @strong{Stage 2: Easy safe repair} -NOTE: If you want repairing to go much faster, you should add: @code{-O +Note: If you want repairing to go much faster, you should add: @code{-O sort_buffer=# -O key_buffer=#} (where # is about 1/4 of the available memory) to all @code{isamchk/myisamchk} commands. @@ -20405,7 +20439,7 @@ host. You can also get this list using the @code{mysqlshow} command. @code{SHOW TABLES} lists the tables in a given database. You can also get this list using the @code{mysqlshow db_name} command. -@strong{NOTE:} If a user doesn't have any privileges for a table, the table +@strong{Note:} If a user doesn't have any privileges for a table, the table will not show up in the output from @code{SHOW TABLES} or @code{mysqlshow db_name}. @@ -20779,7 +20813,7 @@ Is @code{ON} if @code{mysqld} was started with @code{--ansi}. @item @code{back_log} The number of outstanding connection requests MySQL can have. This -comes into play when the main MySQL thread gets @strong{VERY} +comes into play when the main MySQL thread gets @strong{very} many connection requests in a very short time. It then takes some time (although very little) for the main thread to check the connection and start a new thread. The @code{back_log} value indicates how many requests can be @@ -20954,7 +20988,7 @@ Increase this to get better index handling (for all reads and multiple writes) to as much as you can afford; 64M on a 256M machine that mainly runs MySQL is quite common. If you, however, make this too big (more than 50% of your total memory?) your system may start to page and -become REALLY slow. Remember that because MySQL does not cache +become extremely slow. Remember that because MySQL does not cache data read, that you will have to leave some room for the OS filesystem cache. @@ -21371,7 +21405,7 @@ use this character set for this connection. One should use @code{mysql_real_escape_string()} when escaping strings for a SQL query. @code{mysql_real_escape_string()} is identical to the -old @code{mysql_escape_string()} function, except that it takes the MYSQL +old @code{mysql_escape_string()} function, except that it takes the @code{MYSQL} connection handle as the first parameter. If the client is compiled with different paths than where the server is @@ -21617,7 +21651,7 @@ the discussion of string collating below. @xref{String collating}. @code{ctype[]} is an array of bit values, with one element for one character. (Note that @code{to_lower[]}, @code{to_upper[]}, and @code{sort_order[]} are indexed by character value, but @code{ctype[]} is indexed by character -value + 1. This is an old legacy to be able to handle EOF.) +value + 1. This is an old legacy to be able to handle @code{EOF}.) You can find the following bitmask definitions in @file{m_ctype.h}: @@ -21972,7 +22006,7 @@ edited version that you can reinstall. @cindex @code{mysqld_multi} @code{mysqld_multi} is meant for managing several @code{mysqld} -processes running in different UNIX sockets and TCP/IP ports. +processes running in different Unix sockets and TCP/IP ports. The program will search for group(s) named [mysqld#] from my.cnf (or the given --config-file=...), where # can be any positive number starting @@ -22002,7 +22036,7 @@ list. Anything after a white space is ignored. @itemize @cindex config-file option @item --config-file=... -Alternative config file. NOTE: This will not affect this program's own +Alternative config file. Note: This will not affect this program's own options (group @code{[mysqld_multi]}), but only groups [mysqld#]. Without this option everything will be searched from the ordinary my.cnf file. @@ -22014,7 +22048,7 @@ Give an example of a config file. Print this help and exit. @cindex log option @item --log=... -Log file. Full path to and the name for the log file. NOTE: If the file +Log file. Full path to and the name for the log file. Note: If the file exists, everything will be appended. @cindex mysqladmin option @item --mysqladmin=... @@ -22035,9 +22069,9 @@ Password for user for @code{mysqladmin}. @cindex tcp-ip option @item --tcp-ip Connect to the MySQL server(s) via the TCP/IP port instead of -the UNIX socket. This affects stopping and reporting. If a socket file +the Unix socket. This affects stopping and reporting. If a socket file is missing, the server may still be running, but can be accessed only -via the TCP/IP port. By default connecting is done via the UNIX socket. +via the TCP/IP port. By default connecting is done via the Unix socket. @cindex user option @item --user=... MySQL user for @code{mysqladmin}. @@ -22074,7 +22108,7 @@ should have its own @code{pid-file}. The advantage using it, if a @code{mysqld} process fails due to signal kill -9, or similar. (Like segmentation fault, which MySQL should never do, of course ;) Please note that @code{safe_mysqld} script may require that -you start it from a certain place. This means that you may have to CD to +you start it from a certain place. This means that you may have to @code{cd} to a certain directory, before you start the @code{mysqld_multi}. If you have problems starting, please see the @code{safe_mysqld} script. Check especially the lines: @@ -22089,7 +22123,7 @@ release) if test -d /data/mysql -a -f ./share/mysql/english/errmsg.sys The above test should be successful, or you may encounter problems. @item Beware of the dangers starting multiple @code{mysqlds} in the same data -directory. Use separate data directories, unless you @strong{KNOW} what +directory. Use separate data directories, unless you @strong{know} what you are doing! @item The socket file and the TCP/IP port must be different for every @code{mysqld}. @@ -22106,17 +22140,17 @@ You may want to use option '--user' for @code{mysqld}, but in order to do this you need to be root when you start the @code{mysqld_multi} script. Having the option in the config file doesn't matter; you will just get a warning, if you are not the superuser and the @code{mysqlds} -are started under @strong{YOUR} UNIX account. @strong{IMPORTANT}: Make +are started under @strong{your} Unix account. @strong{Important}: Make sure that the @code{pid-file} and the data directory are -read+write(+execute for the latter one) accessible for @strong{THAT} -UNIX user, who the specific @code{mysqld} process is started -as. @strong{DON'T} use the UNIX root account for this, unless you -@strong{KNOW} what you are doing! -@item -@strong{MOST IMPORTANT}: Make sure that you understand the meanings of -the options that are passed to the @code{mysqlds} and why @strong{WOULD -YOU WANT} to have separate @code{mysqld} processes. Starting multiple -@code{mysqlds} in one data directory @strong{WILL NOT} give you extra +read+write(+execute for the latter one) accessible for @strong{that} +Unix user, who the specific @code{mysqld} process is started +as. @strong{Do not} use the Unix root account for this, unless you +@strong{know} what you are doing! +@item +@strong{Most important}: Make sure that you understand the meanings of +the options that are passed to the @code{mysqld}s and @strong{why one +would want} to have separate @code{mysqld} processes. Starting multiple +@code{mysqld}s in one data directory @strong{will not} give you extra performance in a threaded system! @end itemize @@ -22239,7 +22273,7 @@ Display a help message and exit. @item -j big_tbl_name, --join=big_tbl_name Join all tables named on the command line into a single table @code{big_tbl_name}. All tables that are to be combined -MUST be identical (same column names and types, same indexes, etc.). +@strong{must} be identical (same column names and types, same indexes, etc.). @item -p #, --packlength=# Specify the record length storage size, in bytes. The value should be 1, 2, @@ -22600,12 +22634,12 @@ The meaning of the values are: @multitable @columnfractions .3 .7 @item @strong{Value} @tab @strong{Meaning}. -@item YES @tab The option is activated and usable. -@item NO @tab MySQL is not compiled with support for this option. -@item DISABLED @tab The xxxx option is disabled because one started @code{mysqld} with @code{--skip-xxxx} or because one didn't start @code{mysqld} with all needed options to enable the option. In this case the @code{hostname.err} file should contain a reason for why the option is disabled. +@item @code{YES} @tab The option is activated and usable. +@item @code{NO} @tab MySQL is not compiled with support for this option. +@item @code{DISABLED} @tab The xxxx option is disabled because one started @code{mysqld} with @code{--skip-xxxx} or because one didn't start @code{mysqld} with all needed options to enable the option. In this case the @code{hostname.err} file should contain a reason for why the option is disabled. @end multitable -@strong{NOTE}: To be able to create InnoDB tables you @strong{MUST} edit +@strong{Note}: To be able to create InnoDB tables you @strong{must} edit your startup options to include at least the @code{innodb_data_file_path} option. @xref{InnoDB start}. @@ -22872,7 +22906,7 @@ Continue even if we get a SQL error. @item -g, --no-named-commands Named commands are disabled. Use \* form only, or use named commands only in the beginning of a line ending with a semicolon (@samp{;}). Since -Version 10.9, the client now starts with this option ENABLED by default! +Version 10.9, the client now starts with this option @strong{enabled} by default! With the -g option, long format commands will still work from the first line, however. @@ -22927,7 +22961,7 @@ other database in the update log. @item @code{--pager[=...]} Output type. Default is your @code{ENV} variable @code{PAGER}. Valid pagers are less, more, cat [> filename], etc. See interactive help (\h) -also. This option does not work in batch mode. Pager works only in UNIX. +also. This option does not work in batch mode. Pager works only in Unix. @cindex @code{password}, @code{mysql} option @item -p[password], --password[=...] @@ -23039,7 +23073,7 @@ tee (\T) Set outfile [to_outfile]. Append everything into given outfile. use (\u) Use another database. Takes database name as argument. @end example -From the above, pager only works in UNIX. +From the above, pager only works in Unix. @cindex status command The @code{status} command gives you some information about the @@ -23126,7 +23160,7 @@ each command, just before the command line appears again waiting for the next command. @item -Browsing, or searching the results in the interactive mode in UNIX less, +Browsing, or searching the results in the interactive mode in Unix less, more, or any other similar program, is now possible with option @code{--pager[=...]}. Without argument, @code{mysql} client will look for environment variable PAGER and set @code{pager} to that. @@ -23135,7 +23169,7 @@ command @code{pager} and disabled with command @code{nopager}. The command takes an argument optionally and the @code{pager} will be set to that. Command @code{pager} can be called without an argument, but this requires that the option @code{--pager} was used, or the @code{pager} -will default to stdout. @code{pager} works only in UNIX, since it uses +will default to stdout. @code{pager} works only in Unix, since it uses the popen() function, which doesn't exist in Windows. In Windows, the @code{tee} option can be used instead, although it may not be as handy as @code{pager} can be in some situations. @@ -23174,11 +23208,11 @@ mysql> pager cat | tee /dr1/tmp/res.txt | tee /dr2/tmp/res2.txt | less -n -i -S You can also combine the two functions above; have the @code{tee} enabled, @code{pager} set to 'less' and you will be able to browse the results in unix 'less' and still have everything appended into a file -the same time. The difference between @code{UNIX tee} used with the +the same time. The difference between Unix @code{tee} used with the @code{pager} and the @code{mysql} client in-built @code{tee}, is that -the in-built @code{tee} works even if you don't have the @code{UNIX tee} +the in-built @code{tee} works even if you don't have the Unix @code{tee} available. The in-built @code{tee} also logs everything that is printed -on the screen, where the @code{UNIX tee} used with @code{pager} doesn't +on the screen, where the Unix @code{tee} used with @code{pager} doesn't log quite that much. Last, but not least, the interactive @code{tee} is more handy to switch on and off, when you want to log something into a file, but want to be able to turn the feature off sometimes. @@ -23569,7 +23603,7 @@ Verbose mode. Print out more information on what the program does. @item -V, --version Print version information and exit. @item -w, --where='where-condition' -Dump only selected records. Note that QUOTES are mandatory: +Dump only selected records. Note that quotes are mandatory: @example "--where=user='jimf'" "-wuserid>1" "-wuserid<1" @@ -23764,7 +23798,7 @@ is @code{localhost}. See the description for the @code{--replace} option. @item -l, --lock-tables -Lock @strong{ALL} tables for writing before processing any text files. This +Lock @strong{all} tables for writing before processing any text files. This ensures that all tables are synchronised on the server. @item -L, --local @@ -24029,7 +24063,7 @@ after the query is executed, but before any locks are released. @cindex update log @cindex files, update log -@strong{NOTE}: The update log is replaced by the binary +@strong{Note}: The update log is replaced by the binary log. @xref{Binary log}. With this you can do anything that you can do with the update log. @@ -24043,7 +24077,7 @@ extension, @code{mysqld} will create log file names like so: time you execute @code{mysqladmin refresh}, execute @code{mysqladmin flush-logs}, execute the @code{FLUSH LOGS} statement, or restart the server. -@strong{NOTE:} For the above scheme to work, you should NOT create +@strong{Note:} For the above scheme to work, you must not create your own files with the same filename as the update log + some extensions that may be regarded as a number, in the directory used by the update log! @@ -25467,7 +25501,7 @@ is, they have different design compromises that lead to different behavior. If you strive for database independence, you need to get a good feeling -for each SQL server's bottlenecks. MySQL is VERY fast in +for each SQL server's bottlenecks. MySQL is very fast in retrieving and updating things, but will have a problem in mixing slow readers/writers on the same table. Oracle, on the other hand, has a big problem when you try to access rows that you have recently updated @@ -25488,11 +25522,11 @@ MySQL-specific keywords to a query. The code inside @code{/**/} will be treated as a comment (ignored) by most other SQL servers. -If REAL high performance is more important than exactness, as in some -Web applications, a possibility is to create an application layer that +If high performance is more important than exactness, as in some +Web applications, it is possibile to create an application layer that caches all results to give you even higher performance. By letting old results 'expire' after a while, you can keep the cache reasonably -fresh. This is quite nice in case of extremely high load, in which case +fresh. This provides a method to handle high load spikes, in which case you can dynamically increase the cache and set the expire timeout higher until things get back to normal. @@ -25618,7 +25652,7 @@ We have gather some more benchmark results at Note that Oracle is not included because they asked to be removed. All Oracle benchmarks have to be passed by Oracle! We believe that makes -Oracle benchmarks @strong{VERY} biased because the above benchmarks are +Oracle benchmarks @strong{very} biased because the above benchmarks are supposed to show what a standard installation can do for a single client. @@ -25680,8 +25714,8 @@ It is very common that some problems only occur when the system is very heavily loaded. We have had many customers who contact us when they have a (tested) system in production and have encountered load problems. In every one of these cases so far, it has been problems with basic design -(table scans are NOT good at high load) or OS/Library issues. Most of -this would be a @strong{LOT} easier to fix if the systems were not +(table scans are @strong{not good} at high load) or OS/Library issues. Most of +this would be a @strong{lot} easier to fix if the systems were not already in production. To avoid problems like this, you should put some effort into benchmarking @@ -26756,7 +26790,7 @@ Try to keep the names simple (use @code{name} instead of @code{customer_name} in the customer table). To make your names portable to other SQL servers you should keep them shorter than 18 characters. @item -If you need REALLY high speed, you should take a look at the low-level +If you need really high speed, you should take a look at the low-level interfaces for data storage that the different SQL servers support! For example, by accessing the MySQL @code{MyISAM} directly, you could get a speed increase of 2-5 times compared to using the SQL interface. @@ -26870,7 +26904,7 @@ The table locking code in MySQL is deadlock free. MySQL uses table locking (instead of row locking or column locking) on all table types, except @code{BDB} tables, to achieve a very -high lock speed. For large tables, table locking is MUCH better than +high lock speed. For large tables, table locking is much better than row locking for most applications, but there are, of course, some pitfalls. @@ -27022,7 +27056,7 @@ You lose a lot of space, as you must duplicate indexes from the nodes Deletes will degenerate the table over time (as indexes in nodes are usually not updated on delete). @item -It's harder to cache ONLY the index data. +It's harder to cache only the index data. @end itemize @@ -27082,7 +27116,7 @@ Only create the indexes that you really need. Indexes are good for retrieval but bad when you need to store things fast. If you mostly access a table by searching on a combination of columns, make an index on them. The first index part should be the most used column. If you are -ALWAYS using many columns, you should use the column with more duplicates +@strong{always} using many columns, you should use the column with more duplicates first to get better compression of the index. @item @@ -28089,7 +28123,7 @@ for replication of tables with fancy column names to work. @item TIMESTAMP = timestamp_value | DEFAULT Set the time for this client. This is used to get the original timestamp if you use the update log to restore rows. @code{timestamp_value} should be a -UNIX Epoch timestamp, not a MySQL timestamp. +Unix epoch timestamp, not a MySQL timestamp. @item LAST_INSERT_ID = # Set the value to be returned from @code{LAST_INSERT_ID()}. This is stored in @@ -28318,7 +28352,7 @@ will be created in the same directory where the data/index file is. @item When you drop a table that is using symlinks, both the symlink and the file the symlink points to is dropped. This is a good reason to why you -should NOT run @code{mysqld} as root and not allow persons to have write +should @strong{not} run @code{mysqld} as root and not allow persons to have write access to the MySQL database directories. @item @@ -28948,7 +28982,7 @@ A few are reserved because MySQL needs them and is @c START_OF_RESERVED_WORDS @multitable @columnfractions .25 .25 .25 .25 -@c Reserved word list updated Thu Oct 18 21:44:01 2001 by jcole. +@c Reserved word list updated Tue Nov 6 08:50:27 2001 by arjen. @c To regenerate, use Support/update-reserved-words.pl. @item @code{ADD} @tab @code{ALL} @@ -28956,86 +28990,85 @@ A few are reserved because MySQL needs them and is @item @code{AND} @tab @code{AS} @tab @code{ASC} @tab @code{BETWEEN} @item @code{BIGINT} @tab @code{BINARY} - @tab @code{BINLOG} @tab @code{BLOB} -@item @code{BOTH} @tab @code{BY} - @tab @code{CASCADE} @tab @code{CASE} -@item @code{CHANGE} @tab @code{CHARACTER} - @tab @code{COLUMN} @tab @code{CONSTRAINT} -@item @code{CREATE} @tab @code{CROSS} - @tab @code{CURRENT_DATE} @tab @code{CURRENT_TIME} -@item @code{CURRENT_TIMESTAMP} @tab @code{DATABASE} - @tab @code{DATABASES} @tab @code{DAY_HOUR} -@item @code{DAY_MINUTE} @tab @code{DAY_SECOND} - @tab @code{DECIMAL} @tab @code{DEFAULT} -@item @code{DELAYED} @tab @code{DELETE} - @tab @code{DESC} @tab @code{DISTINCTROW} -@item @code{DOUBLE} @tab @code{DROP} - @tab @code{ELSE} @tab @code{ENCLOSED} -@item @code{ESCAPED} @tab @code{EVENTS} - @tab @code{EXISTS} @tab @code{EXPLAIN} -@item @code{FIELDS} @tab @code{FLOAT} - @tab @code{FOR} @tab @code{FOREIGN} -@item @code{FROM} @tab @code{FULLTEXT} - @tab @code{GRANT} @tab @code{GROUP} -@item @code{HAVING} @tab @code{HIGH_PRIORITY} - @tab @code{HOUR_MINUTE} @tab @code{HOUR_SECOND} -@item @code{IF} @tab @code{IGNORE} - @tab @code{IN} @tab @code{INDEX} -@item @code{INFILE} @tab @code{INNER} - @tab @code{INSERT} @tab @code{INSERT_ID} -@item @code{INTEGER} @tab @code{INTERVAL} - @tab @code{INTO} @tab @code{IS} -@item @code{JOIN} @tab @code{KEY} - @tab @code{KEYS} @tab @code{KILL} -@item @code{LAST_INSERT_ID} @tab @code{LEADING} - @tab @code{LEFT} @tab @code{LIKE} -@item @code{LIMIT} @tab @code{LINES} - @tab @code{LOAD} @tab @code{LOCK} -@item @code{LONG} @tab @code{LONGBLOB} - @tab @code{LONGTEXT} @tab @code{LOW_PRIORITY} -@item @code{MASTER_LOG_SEQ} @tab @code{MASTER_SERVER_ID} - @tab @code{MATCH} @tab @code{MEDIUMBLOB} -@item @code{MEDIUMTEXT} @tab @code{MIDDLEINT} - @tab @code{MINUTE_SECOND} @tab @code{NATURAL} -@item @code{NOT} @tab @code{NULL} - @tab @code{NUMERIC} @tab @code{ON} -@item @code{OPTIMIZE} @tab @code{OPTION} - @tab @code{OPTIONALLY} @tab @code{OR} -@item @code{ORDER} @tab @code{OUTER} - @tab @code{OUTFILE} @tab @code{PARTIAL} -@item @code{PRECISION} @tab @code{PRIMARY} - @tab @code{PRIVILEGES} @tab @code{PROCEDURE} -@item @code{PURGE} @tab @code{READ} - @tab @code{REAL} @tab @code{REFERENCES} -@item @code{RENAME} @tab @code{REPLACE} - @tab @code{REQUIRE} @tab @code{RESTRICT} -@item @code{RETURNS} @tab @code{REVOKE} - @tab @code{RIGHT} @tab @code{RLIKE} -@item @code{SELECT} @tab @code{SET} - @tab @code{SHOW} @tab @code{SMALLINT} -@item @code{SONAME} @tab @code{SQL_AUTO_IS_NULL} - @tab @code{SQL_BIG_RESULT} @tab @code{SQL_BIG_SELECTS} -@item @code{SQL_BIG_TABLES} @tab @code{SQL_BUFFER_RESULT} - @tab @code{SQL_CALC_FOUND_ROWS} @tab @code{SQL_LOG_BIN} -@item @code{SQL_LOG_OFF} @tab @code{SQL_LOG_UPDATE} - @tab @code{SQL_LOW_PRIORITY_UPDATES} @tab @code{SQL_SAFE_UPDATES} -@item @code{SQL_SELECT_LIMIT} @tab @code{SQL_SLAVE_SKIP_COUNTER} - @tab @code{SQL_SMALL_RESULT} @tab @code{SQL_WARNINGS} -@item @code{SSL} @tab @code{STARTING} - @tab @code{STRAIGHT_JOIN} @tab @code{TABLE} -@item @code{TABLES} @tab @code{TERMINATED} - @tab @code{THEN} @tab @code{TINYBLOB} -@item @code{TINYINT} @tab @code{TINYTEXT} - @tab @code{TO} @tab @code{TRAILING} -@item @code{UNION} @tab @code{UNIQUE} - @tab @code{UNLOCK} @tab @code{UNSIGNED} -@item @code{UPDATE} @tab @code{USAGE} - @tab @code{USE} @tab @code{USING} -@item @code{VALUES} @tab @code{VARBINARY} - @tab @code{VARCHAR} @tab @code{VARYING} -@item @code{WHEN} @tab @code{WHERE} - @tab @code{WITH} @tab @code{WRITE} -@item @code{YEAR_MONTH} @tab @code{ZEROFILL} + @tab @code{BLOB} @tab @code{BOTH} +@item @code{BY} @tab @code{CASCADE} + @tab @code{CASE} @tab @code{CHANGE} +@item @code{CHARACTER} @tab @code{COLUMN} + @tab @code{CONSTRAINT} @tab @code{CREATE} +@item @code{CROSS} @tab @code{CURRENT_DATE} + @tab @code{CURRENT_TIME} @tab @code{CURRENT_TIMESTAMP} +@item @code{DATABASE} @tab @code{DATABASES} + @tab @code{DAY_HOUR} @tab @code{DAY_MINUTE} +@item @code{DAY_SECOND} @tab @code{DECIMAL} + @tab @code{DEFAULT} @tab @code{DELAYED} +@item @code{DELETE} @tab @code{DESC} + @tab @code{DISTINCTROW} @tab @code{DOUBLE} +@item @code{DROP} @tab @code{ELSE} + @tab @code{ENCLOSED} @tab @code{ESCAPED} +@item @code{EXISTS} @tab @code{EXPLAIN} + @tab @code{FIELDS} @tab @code{FLOAT} +@item @code{FOR} @tab @code{FOREIGN} + @tab @code{FROM} @tab @code{FULLTEXT} +@item @code{GRANT} @tab @code{GROUP} + @tab @code{HAVING} @tab @code{HIGH_PRIORITY} +@item @code{HOUR_MINUTE} @tab @code{HOUR_SECOND} + @tab @code{IF} @tab @code{IGNORE} +@item @code{IN} @tab @code{INDEX} + @tab @code{INFILE} @tab @code{INNER} +@item @code{INSERT} @tab @code{INSERT_ID} + @tab @code{INTEGER} @tab @code{INTERVAL} +@item @code{INTO} @tab @code{IS} + @tab @code{JOIN} @tab @code{KEY} +@item @code{KEYS} @tab @code{KILL} + @tab @code{LAST_INSERT_ID} @tab @code{LEADING} +@item @code{LEFT} @tab @code{LIKE} + @tab @code{LIMIT} @tab @code{LINES} +@item @code{LOAD} @tab @code{LOCK} + @tab @code{LONG} @tab @code{LONGBLOB} +@item @code{LONGTEXT} @tab @code{LOW_PRIORITY} + @tab @code{MASTER_LOG_SEQ} @tab @code{MASTER_SERVER_ID} +@item @code{MATCH} @tab @code{MEDIUMBLOB} + @tab @code{MEDIUMTEXT} @tab @code{MIDDLEINT} +@item @code{MINUTE_SECOND} @tab @code{NATURAL} + @tab @code{NOT} @tab @code{NULL} +@item @code{NUMERIC} @tab @code{ON} + @tab @code{OPTIMIZE} @tab @code{OPTION} +@item @code{OPTIONALLY} @tab @code{OR} + @tab @code{ORDER} @tab @code{OUTER} +@item @code{OUTFILE} @tab @code{PARTIAL} + @tab @code{PRECISION} @tab @code{PRIMARY} +@item @code{PRIVILEGES} @tab @code{PROCEDURE} + @tab @code{PURGE} @tab @code{READ} +@item @code{REAL} @tab @code{REFERENCES} + @tab @code{RENAME} @tab @code{REPLACE} +@item @code{REQUIRE} @tab @code{RESTRICT} + @tab @code{RETURNS} @tab @code{REVOKE} +@item @code{RIGHT} @tab @code{RLIKE} + @tab @code{SELECT} @tab @code{SET} +@item @code{SHOW} @tab @code{SMALLINT} + @tab @code{SONAME} @tab @code{SQL_AUTO_IS_NULL} +@item @code{SQL_BIG_RESULT} @tab @code{SQL_BIG_SELECTS} + @tab @code{SQL_BIG_TABLES} @tab @code{SQL_BUFFER_RESULT} +@item @code{SQL_CALC_FOUND_ROWS} @tab @code{SQL_LOG_BIN} + @tab @code{SQL_LOG_OFF} @tab @code{SQL_LOG_UPDATE} +@item @code{SQL_LOW_PRIORITY_UPDATES} @tab @code{SQL_SAFE_UPDATES} + @tab @code{SQL_SELECT_LIMIT} @tab @code{SQL_SLAVE_SKIP_COUNTER} +@item @code{SQL_SMALL_RESULT} @tab @code{SQL_WARNINGS} + @tab @code{SSL} @tab @code{STARTING} +@item @code{STRAIGHT_JOIN} @tab @code{TABLE} + @tab @code{TABLES} @tab @code{TERMINATED} +@item @code{THEN} @tab @code{TINYBLOB} + @tab @code{TINYINT} @tab @code{TINYTEXT} +@item @code{TO} @tab @code{TRAILING} + @tab @code{UNION} @tab @code{UNIQUE} +@item @code{UNLOCK} @tab @code{UNSIGNED} + @tab @code{UPDATE} @tab @code{USAGE} +@item @code{USE} @tab @code{USING} + @tab @code{VALUES} @tab @code{VARBINARY} +@item @code{VARCHAR} @tab @code{VARYING} + @tab @code{WHEN} @tab @code{WHERE} +@item @code{WITH} @tab @code{WRITE} + @tab @code{YEAR_MONTH} @tab @code{ZEROFILL} @end multitable @@ -29347,7 +29380,7 @@ These three are synonyms for @code{CHAR(1)}. @tindex VARCHAR @item [NATIONAL] VARCHAR(M) [BINARY] -A variable-length string. @strong{NOTE:} Trailing spaces are removed when +A variable-length string. @strong{Note:} Trailing spaces are removed when the value is stored (this differs from the ANSI SQL specification). The range of @code{M} is 1 to 255 characters. @code{VARCHAR} values are sorted and compared in case-insensitive fashion unless the @code{BINARY} keyword is @@ -30569,7 +30602,7 @@ An expression that contains @code{NULL} always produces a @code{NULL} value unless otherwise indicated in the documentation for the operators and functions involved in the expression. -@strong{NOTE:} There must be no whitespace between a function name and the +@strong{Note:} There must be no whitespace between a function name and the parenthesis following it. This helps the MySQL parser distinguish between function calls and references to tables or columns that happen to have the same name as a function. Spaces around arguments are permitted, @@ -32426,6 +32459,9 @@ mysql> select WEEK('1998-12-31',1); -> 53 @end example +Note: in Version 4.0, @code{WEEK(#,0)} was changed to match the +calendar in the USA. + @findex YEAR() @item YEAR(date) Returns the year for @code{date}, in the range @code{1000} to @code{9999}: @@ -33638,7 +33674,7 @@ the @code{ESCAPED BY} character: Additionally, @code{ASCII 0} is converted to @code{ESCAPED BY} followed by 0 (@code{ASCII 48}). -The reason for the above is that you MUST escape any @code{FIELDS +The reason for the above is that you @strong{must} escape any @code{FIELDS TERMINATED BY}, @code{ESCAPED BY}, or @code{LINES TERMINATED BY} characters to reliably be able to read the file back. @code{ASCII 0} is escaped to make it easier to view with some pagers. @@ -33792,6 +33828,12 @@ with a @code{USING} clause that names all columns that exist in both tables. @item +@cindex hints +@code{INNER JOIN} and @code{,} (comma) are semantically equivalent. +Both do a full join between the tables used. Normally, you specify +how the tables should be linked in the WHERE condition. + +@item @code{RIGHT JOIN} works analogously as @code{LEFT JOIN}. To keep code portable across databases, it's recommended to use @code{LEFT JOIN} instead of @code{RIGHT JOIN}. @@ -34315,7 +34357,7 @@ all rows, and are willing to suffer a speed penalty, you can use a mysql> DELETE FROM table_name WHERE 1>0; @end example -Note that this is MUCH slower than @code{DELETE FROM table_name} with no +Note that this is much slower than @code{DELETE FROM table_name} with no @code{WHERE} clause, because it deletes rows one at a time. If you specify the keyword @code{LOW_PRIORITY}, execution of the @@ -34334,7 +34376,7 @@ TABLE} statement or the @code{myisamchk} utility to reorganise tables. The multi table delete format is supported starting from MySQL 4.0.0. -The idea is that only matching rows from the tables listed BEFORE the +The idea is that only matching rows from the tables listed @strong{before} the @code{FROM} clause is deleted. The effect is that you can delete rows from many tables at the same time and also have additional tables that are used for searching. @@ -35893,7 +35935,7 @@ exist. @code{RESTRICT} and @code{CASCADE} are allowed to make porting easier. For the moment they don't do anything. -@strong{NOTE}: @code{DROP TABLE} is not transaction-safe and will +@strong{Note}: @code{DROP TABLE} is not transaction-safe and will automatically commit any active transactions. @@ -36191,7 +36233,7 @@ tables to transactions safe tables. You can safely kill a thread that is waiting for a table lock with @code{KILL}. @xref{KILL}. -Note that you should @strong{NOT} lock any tables that you are using with +Note that you should @strong{not} lock any tables that you are using with @code{INSERT DELAYED}. This is because that in this case the @code{INSERT} is done by a separate thread. @@ -36743,9 +36785,9 @@ The following options to @code{mysqld} can be used to change the behavior of @item @code{--myisam-recover=#} @tab Automatic recover of crashed tables. @item @code{-O myisam_sort_buffer_size=#} @tab Buffer used when recovering tables. @item @code{--delay-key-write-for-all-tables} @tab Don't flush key buffers between writes for any MyISAM table -@item @code{-O myisam_max_extra_sort_file_size=#} @tab Used to help MySQL to decide when to use the slow but safe key cache index create method. @strong{NOTE} that this parameter is given in megabytes! -@item @code{-O myisam_max_sort_file_size=#} @tab Don't use the fast sort index method to created index if the temporary file would get bigger than this. @strong{NOTE} that this paramter is given in megabytes! -@item @code{-O myisam_bulk_insert_tree_size=#} @tab Size of tree cache used in bulk insert optimisation. @strong{NOTE} that this is a limit @strong{per thread}! +@item @code{-O myisam_max_extra_sort_file_size=#} @tab Used to help MySQL to decide when to use the slow but safe key cache index create method. @strong{Note} that this parameter is given in megabytes! +@item @code{-O myisam_max_sort_file_size=#} @tab Don't use the fast sort index method to created index if the temporary file would get bigger than this. @strong{Note} that this paramter is given in megabytes! +@item @code{-O myisam_bulk_insert_tree_size=#} @tab Size of tree cache used in bulk insert optimisation. @strong{Note} that this is a limit @strong{per thread}! @end multitable The automatic recovery is activated if you start @code{mysqld} with @@ -37485,7 +37527,7 @@ MySQL and MySQL -Max differ only in the server executable. To compile MySQL with InnoDB support, download MySQL-3.23.34a or newer version from -@uref{http://www.mysql.com} +@uref{http://www.mysql.com/} and configure MySQL with the @code{--with-innodb} option. See the MySQL manual @@ -38876,7 +38918,7 @@ file size in @code{innodb_data_file_path}. The partition must be innodb_data_file_path=hdd1:5Gnewraw;hdd2:2Gnewraw @end example -When you start the database again you MUST change the keyword +When you start the database again you @strong{must} change the keyword to @code{raw}. Otherwise InnoDB will write over your partition! @@ -39072,8 +39114,8 @@ the maximum size for a table. The minimum tablespace size is 10 MB. @subsection InnoDB Contact Information Contact information of Innobase Oy, producer of the InnoDB engine. -Website: @uref{http://www.innodb.com}. Email: -@email{Heikki.Tuuri@@innodb.com} +Website: @uref{http://www.innodb.com/}. +Email: @email{Heikki.Tuuri@@innodb.com} @example phone: 358-9-6969 3250 (office) 358-40-5617367 (mobile) @@ -39245,7 +39287,7 @@ stored as the key data + the @code{PRIMARY KEY}, it's important to keep the @code{PRIMARY KEY} as short as possible to save disk and get better speed. @item @code{LOCK TABLES} works on @code{BDB} tables as with other tables. If -you don't use @code{LOCK TABLE}, MYSQL will issue an internal +you don't use @code{LOCK TABLE}, MySQL will issue an internal multiple-write lock on the table to ensure that the table will be properly locked if another thread issues a table lock. @item @@ -39420,8 +39462,8 @@ create dynamic Web pages. It contains support for accessing several databases, including MySQL. PHP may be run as a separate program or compiled as a module for use with the Apache Web server. -The distribution and documentation are available at the -@uref{http://www.php.net/, PHP website}. +The distribution and documentation are available at the PHP website +(@uref{http://www.php.net/}). @menu * PHP problems:: Common problems with MySQL and PHP @@ -39683,7 +39725,7 @@ $rv = $dbh->do($statement) or die "Can't execute $statement: $dbh- >errstr\n"; @end example -Generally the 'do' statement is MUCH faster (and is preferable) +Generally the 'do' statement is much faster (and is preferable) than prepare/execute for statements that don't contain parameters. @findex DBI->quote() @@ -42568,7 +42610,7 @@ else // query succeeded, process any data returned by it @} @end example -An alternative (if you KNOW that your query should have returned a result set) +An alternative (if you know that your query should have returned a result set) is to replace the @code{mysql_errno(&mysql)} call with a check if @code{mysql_field_count(&mysql)} is = 0. This will only happen if something went wrong. @@ -43703,11 +43745,11 @@ have your own alarm that can break a long read to a server. If you install interrupt handlers for the @code{SIGPIPE} interrupt, the socket handling should be thread safe. -In the older binaries we distribute on our website, the client -libraries are not normally compiled with the thread-safe option (the -Windows binaries are by default compiled to be thread safe). -Newer binary distributions should have both a normal and a -thread-safe client library. +In the older binaries we distribute on our website +(@uref{http://www.mysql.com/}), the client libraries are not normally +compiled with the thread-safe option (the Windows binaries are by +default compiled to be thread safe). Newer binary distributions should +have both a normal and a thread-safe client library. To get a threaded client where you can interrupt the client from other threads and set timeouts when talking with the MySQL server, you should @@ -44948,7 +44990,7 @@ parameter to @code{1}: If @code{xxx()} sets @code{*error} to @code{1} for any row, the function value is @code{NULL} for the current row and for any subsequent rows processed by the statement in which @code{XXX()} was invoked. (@code{xxx()} -will not even be called for subsequent rows.) @strong{NOTE:} In +will not even be called for subsequent rows.) @strong{Note:} In MySQL versions prior to 3.22.10, you should set both @code{*error} and @code{*is_null}: @@ -45264,7 +45306,7 @@ The machine doesn't answer to a remote machine's pings. Different, unrelated programs don't behave correctly. @item If your system rebooted unexpectedly (a faulty user level program should -NEVER be able to take down your system). +@strong{never} be able to take down your system). @end itemize In this case you should start by checking all your cables and run some @@ -46009,10 +46051,10 @@ symbols that start with @code{mysql_}, like the following: @end example you should be able to solve this by adding @code{-Lpath-to-the-mysql-library --lmysqlclient} @strong{LAST} on your link line. +-lmysqlclient} @strong{last} on your link line. If you get @code{undefined reference} errors for the @code{uncompress} -or @code{compress} function, add @code{-lz} @strong{LAST} on your link +or @code{compress} function, add @code{-lz} @strong{last} on your link line and try again! If you get @code{undefined reference} errors for functions that should @@ -46953,9 +46995,9 @@ SELECT col_name1, col_name3, col_name2 FROM tbl_name; will return columns in the order @code{col_name1}, @code{col_name3}, @code{col_name2}. -You should @strong{NEVER}, in an application, use @code{SELECT *} and +You should @strong{never}, in an application, use @code{SELECT *} and retrieve the columns based on their position, because the order in which -columns are returned @strong{CANNOT} be guaranteed over time. A simple +columns are returned @strong{cannot} be guaranteed over time. A simple change to your database may cause your application to fail rather dramatically. @@ -48856,7 +48898,7 @@ A new @code{HANDLER} interface to @code{MyISAM} tables. Added support for @code{INSERT} on @code{MERGE} tables. Patch from Benjamin Pflugmann. @item -Changed @code{WEEK(#,0)} to match the calender in the USA. +Changed @code{WEEK(#,0)} to match the calendar in the USA. @item @code{COUNT(DISTINCT)} is about 30% faster. @item @@ -49455,7 +49497,7 @@ Initialise signals early to avoid problem with signals in InnoDB. @item Applied patch for the @code{tis620} character set to make comparisons case-independent and to fix a bug in @code{LIKE} for this character set. -@strong{NOTE}: All tables that uses the @code{tis620} character set must be +@strong{Note}: All tables that uses the @code{tis620} character set must be fixed with @code{myisamchk -r} or @code{REPAIR TABLE} ! @item Added @code{--skip-safemalloc} option to @code{mysqld}. @@ -49471,7 +49513,7 @@ Fixed a bug that allowed you to use database names containing a @samp{.} character. This fixes a serious security issue when @code{mysqld} is run as root. @item -Fixed bug when thread creation failed (could happen when doing a LOT +Fixed bug when thread creation failed (could happen when doing a @strong{lot} of connections in a short time). @item Fixed some problems with @code{FLUSH TABLES} and @code{TEMPORARY} tables. @@ -50002,7 +50044,7 @@ and the interactive help for more information. Fixed crash when automatic repair of @code{MyISAM} table failed. @item Fixed a major performance bug in the table locking code when one -constantly had a LOT of @code{SELECT}, @code{UPDATE} and @code{INSERT} +constantly had a lot of @code{SELECT}, @code{UPDATE} and @code{INSERT} statements running. The symptom was that the @code{UPDATE} and @code{INSERT} queries were locked for a long time while new @code{SELECT} statements were executed before the updates. @@ -51524,7 +51566,7 @@ Added @code{mysqld} option @code{--default-table-type}. The 3.22 version has faster and safer connect code than version 3.21, as well as a lot of new nice enhancements. The reason for not including these changes -As there aren't really any MAJOR changes, upgrading from 3.21 to 3.22 should +As there aren't really any major changes, upgrading from 3.21 to 3.22 should be very easy and painless. @xref{Upgrading-from-3.21}. @menu @@ -52063,7 +52105,7 @@ Fix for @code{isamchk} for tables which need big temporary files. @itemize @bullet @item -@strong{IMPORTANT}: You must run the @code{mysql_fix_privilege_tables} script +@strong{Important}: You must run the @code{mysql_fix_privilege_tables} script when you upgrade to this version! This is needed because of the new @code{GRANT} system. If you don't do this, you will get @code{Access denied} when you try to use @code{ALTER TABLE}, @code{CREATE INDEX} or @@ -52144,7 +52186,7 @@ Added @code{maybe_null} to the UDF structure. Added option @code{IGNORE} to @code{INSERT} statements with many rows. @item Fixed some problems with sorting of the koi8 character sets; Users of koi8 -@strong{MUST} run @code{isamchk -rq} on each table that has an index on +@strong{must} run @code{isamchk -rq} on each table that has an index on a @code{CHAR} or @code{VARCHAR} column. @item New script @code{mysql_setpermission}, by Luuk de Boer, allows one @@ -52193,7 +52235,7 @@ Added a lot more output to @code{mysqladmin debug}. @item You can now start @code{mysqld} on Windows with the @code{--flush} option. This will flush all tables to disk after each update. This makes things -much safer on NT/Win98 but also @strong{MUCH} slower. +much safer on NT/Win98 but also @strong{much} slower. @end itemize @@ -52396,13 +52438,13 @@ trailing @samp{;}. @item Fix for corrupted fixed-format output generated by @code{SELECT INTO OUTFILE}. @item -@strong{WARNING: INCOMPATIBLE CHANGE!!} +@strong{Warning: Incompatible change!} Added Oracle @code{GREATEST()} and @code{LEAST()} functions. You must now use these instead of the @code{MAX()} and @code{MIN()} functions to get the largest/smallest value from a list of values. These can now handle @code{REAL}, @code{BIGINT} and string (@code{CHAR} or @code{VARCHAR}) values. @item -@strong{WARNING: INCOMPATIBLE CHANGE!!} +@strong{Warning: Incompatible change!} @code{DAYOFWEEK()} had offset 0 for Sunday. Changed the offset to 1. @item Give an error for queries that mix @code{GROUP BY} columns and fields when @@ -53222,7 +53264,7 @@ Added ODBC 2.0 & 3.0 functions @code{POWER()}, @code{SPACE()}, @code{COT()}, @code{DEGREES()}, @code{RADIANS()}, @code{ROUND(2 arg)} and @code{TRUNCATE()}. @item -@strong{WARNING: INCOMPATIBLE CHANGE!!} @code{LOCATE()} parameters were +@strong{Warning: Incompatible change!} @code{LOCATE()} parameters were swapped according to ODBC standard. Fixed. @item Added function @code{TIME_TO_SEC()}. @@ -53241,14 +53283,14 @@ be compatible with @code{mysqldump}. @itemize @bullet @item -@strong{WARNING: INCOMPATIBLE CHANGE!!} @code{mysqlperl} is now from +@strong{Warning: Incompatible change!} @code{mysqlperl} is now from Msql-Mysql-modules. This means that @code{connect()} now takes @code{host}, @code{database}, @code{user}, @code{password} arguments! The old version took @code{host}, @code{database}, @code{password}, @code{user}. @item Allow @code{DATE '1997-01-01'}, @code{TIME '12:10:10'} and @code{TIMESTAMP '1997-01-01 12:10:10'} formats required by ANSI SQL. -@strong{WARNING: INCOMPATIBLE CHANGE!!} This has the unfortunate +@strong{Warning: Incompatible change!} This has the unfortunate side-effect that you no longer can have columns named @code{DATE}, @code{TIME} or @code{TIMESTAMP}. :( Old columns can still be accessed through @code{tablename.columnname}!) @@ -54525,7 +54567,8 @@ This appendix will help you port MySQL to other operationg systems. Do check the list of currently supported operating systems first. @xref{Which OS}. If you have created a new port of MySQL, please let us know so that -we can list it here and on our website, recommending it to other users. +we can list it here and on our website (@uref{http://www.mysql.com/}), +recommending it to other users. Note: If you create a new port of MySQL, you are free to copy and distribute it under the GPL license, but it does not make you a @@ -54732,7 +54775,7 @@ After this you can use the @code{mysql.exe} command line tool in a second DOS window to reproduce the problem. You can take down the above @code{mysqld} server with @code{mysqladmin shutdown}. -Note that the trace file will get very @emph{BIG}! +Note that the trace file will get @strong{very big}! If you want to have a smaller trace file, you can use something like: @code{mysqld --debug=d,info,error,query,general,where:O,/tmp/mysqld.trace} @@ -54841,7 +54884,7 @@ setting the @code{DBI_TRACE} environment variable. On some operating systems, the error log will contain a stack trace if @code{mysqld} dies unexpectedly. You can use this to find out where (and maybe why) @code{mysqld} died. @xref{Error log}. To get a stack trace, -you should NOT compile @code{mysqld} with the @code{-fomit-frame-pointer} +you must not compile @code{mysqld} with the @code{-fomit-frame-pointer} option to gcc. @xref{Compiling for debugging}. If the error file contains something like the following: @@ -55209,7 +55252,7 @@ Here are some tips about locking in MySQL: On web application most applications do lots of selects, very few deletes, updates mainly on keys and inserts in some specific tables. -The base MySQL setup is VERY tuned for this. +The base MySQL setup is very well tuned for this. Concurrent users is not a problem if one doesn't mix updates and selects that needs to examine many rows in the same table. diff --git a/client/mysql.cc b/client/mysql.cc index 653f6bc9f44..d62e3bfe3cf 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -38,7 +38,7 @@ #include <signal.h> #include <violite.h> -const char *VER="11.16"; +const char *VER="11.18"; /* Don't try to make a nice table if the data is too big */ #define MAX_COLUMN_LENGTH 1024 @@ -129,6 +129,7 @@ static String glob_buffer,old_buffer; static int wait_time = 5; static STATUS status; static ulong select_limit,max_join_size,opt_connect_timeout=0; +char mysql_charsets_dir[FN_REFLEN+1]; static const char *xmlmeta[] = { "&", "&", "<", "<", @@ -158,7 +159,7 @@ static int com_quit(String *str,char*), com_connect(String *str,char*), com_status(String *str,char*), com_use(String *str,char*), com_source(String *str, char*), com_rehash(String *str, char*), com_tee(String *str, char*), - com_notee(String *str, char*); + com_notee(String *str, char*), com_shell(String *str, char *); #ifndef __WIN__ static int com_nopager(String *str, char*), com_pager(String *str, char*), @@ -216,6 +217,9 @@ static COMMANDS commands[] = { { "source", '.', com_source, 1, "Execute a SQL script file. Takes a file name as an argument."}, { "status", 's', com_status, 0, "Get status information from the server."}, +#ifndef __WIN__ + { "system", '!', com_shell, 1, "Execute a system shell command."}, +#endif { "tee", 'T', com_tee, 1, "Set outfile [to_outfile]. Append everything into given outfile." }, { "use", 'u', com_use, 1, @@ -609,7 +613,8 @@ static int get_options(int argc, char **argv) default_charset= optarg; break; case OPT_CHARSETS_DIR: - charsets_dir= optarg; + strmov(mysql_charsets_dir, optarg); + charsets_dir = mysql_charsets_dir; break; case OPT_TEE: if (!opt_outfile && strlen(optarg)) @@ -2051,6 +2056,29 @@ com_rehash(String *buffer __attribute__((unused)), return 0; } + +#ifndef __WIN__ +static int +com_shell(String *buffer, char *line __attribute__((unused))) +{ + char *shell_cmd; + if (!(shell_cmd = strchr(line, ' '))) + { + put_info("Usage: \\! shell-command", INFO_ERROR); + return -1; + } + /* The output of the shell command does not + get directed to the pager or the outfile */ + if(system(shell_cmd) == -1) + { + put_info(strerror(errno), INFO_ERROR, errno); + return -1; + } + return 0; +} +#endif + + static int com_print(String *buffer,char *line __attribute__((unused))) { diff --git a/client/mysqldump.c b/client/mysqldump.c index 117c070a936..3741b61d3e0 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -31,7 +31,9 @@ ** SSL by ** Andrei Errapart <andreie@no.spam.ee> ** Tõnu Samuel <tonu@please.do.not.remove.this.spam.ee> -**/ +** XML by Gary Huntress <ghuntress@mediaone.net> 10/10/01, cleaned up +** and adapted to mysqldump 05/11/01 by Jani Tolonen +*/ #define DUMP_VERSION "8.18" @@ -70,7 +72,8 @@ static my_bool verbose=0,tFlag=0,cFlag=0,dFlag=0,quick=0, extended_insert = 0, lock_tables=0,ignore_errors=0,flush_logs=0,replace=0, ignore=0,opt_drop=0,opt_keywords=0,opt_lock=0,opt_compress=0, opt_delayed=0,create_options=0,opt_quoted=0,opt_databases=0, - opt_alldbs=0,opt_create_db=0,opt_first_slave=0, opt_autocommit=0, opt_master_data; + opt_alldbs=0,opt_create_db=0,opt_first_slave=0, + opt_autocommit=0, opt_master_data, opt_xml=0; static MYSQL mysql_connection,*sock=0; static char insert_pat[12 * 1024],*opt_password=0,*current_user=0, *current_host=0,*path=0,*fields_terminated=0, @@ -135,6 +138,7 @@ static struct option long_options[] = {"verbose", no_argument, 0, 'v'}, {"version", no_argument, 0, 'V'}, {"where", required_argument, 0, 'w'}, + {"xml", no_argument, 0, 'X'}, {0, 0, 0, 0} }; @@ -248,6 +252,7 @@ puts("\ -v, --verbose Print info about the various stages.\n\ -V, --version Output version information and exit.\n\ -w, --where= dump only selected records; QUOTES mandatory!\n\ + -X, --xml dump a database as well formed XML\n\ -x, --first-slave Locks all tables across all databases.\n\ EXAMPLES: \"--where=user=\'jimf\'\" \"-wuserid>1\" \"-wuserid<1\"\n\ Use -T (--tab=...) with --fields-...\n\ @@ -274,13 +279,18 @@ puts("\ static void write_heder(FILE *sql_file, char *db_name) { - fprintf(sql_file, "-- MySQL dump %s\n--\n", DUMP_VERSION); - fprintf(sql_file, "-- Host: %s Database: %s\n", - current_host ? current_host : "localhost", db_name ? db_name : ""); - fputs("---------------------------------------------------------\n", - sql_file); - fprintf(sql_file, "-- Server version\t%s\n", - mysql_get_server_info(&mysql_connection)); + if (opt_xml) + fprintf(sql_file,"<?xml version=\"1.0\"?>\n"); + else + { + fprintf(sql_file, "-- MySQL dump %s\n--\n", DUMP_VERSION); + fprintf(sql_file, "-- Host: %s Database: %s\n", + current_host ? current_host : "localhost", db_name ? db_name : ""); + fputs("---------------------------------------------------------\n", + sql_file); + fprintf(sql_file, "-- Server version\t%s\n", + mysql_get_server_info(&mysql_connection)); + } return; } /* write_heder */ @@ -294,7 +304,7 @@ static int get_options(int *argc,char ***argv) load_defaults("my",load_default_groups,argc,argv); set_all_changeable_vars(md_changeable_vars); while ((c=getopt_long(*argc,*argv, - "#::p::h:u:O:P:r:S:T:EBaAcCdefFlnqtvVw:?Ix", + "#::p::h:u:O:P:r:S:T:EBaAcCdefFlnqtvVw:?IxX", long_options, &option_index)) != EOF) { switch(c) { @@ -397,6 +407,7 @@ static int get_options(int *argc,char ***argv) case 'w': where=optarg; break; + case 'X': opt_xml = 1; break; case 'x': opt_first_slave=1; break; @@ -563,7 +574,7 @@ static void unescape(FILE *file,char *pos,uint length) ignore_errors=0; /* Fatal error */ safe_exit(EX_MYSQLERR); /* Force exit */ } - mysql_real_escape_string(&mysql_connection,tmp, pos, length); + mysql_real_escape_string(&mysql_connection, tmp, pos, length); fputc('\'', file); fputs(tmp, file); fputc('\'', file); @@ -649,13 +660,16 @@ static uint getTableStructure(char *table, char* db) } write_heder(sql_file, db); } - fprintf(sql_file, "\n--\n-- Table structure for table '%s'\n--\n\n",table); + if (!opt_xml) + fprintf(sql_file, "\n--\n-- Table structure for table '%s'\n--\n\n", + table); if (opt_drop) fprintf(sql_file, "DROP TABLE IF EXISTS %s;\n",table_name); tableRes=mysql_store_result(sock); row=mysql_fetch_row(tableRes); - fprintf(sql_file, "%s;\n", row[1]); + if (!opt_xml) + fprintf(sql_file, "%s;\n", row[1]); mysql_free_result(tableRes); } sprintf(insert_pat,"show fields from %s",table_name); @@ -721,7 +735,9 @@ static uint getTableStructure(char *table, char* db) } write_heder(sql_file, db); } - fprintf(sql_file, "\n--\n-- Table structure for table '%s'\n--\n\n",table); + if (!opt_xml) + fprintf(sql_file, "\n--\n-- Table structure for table '%s'\n--\n\n", + table); if (opt_drop) fprintf(sql_file, "DROP TABLE IF EXISTS %s;\n",table_name); fprintf(sql_file, "CREATE TABLE %s (\n", table_name); @@ -760,7 +776,7 @@ static uint getTableStructure(char *table, char* db) if (row[SHOW_DEFAULT]) { fputs(" DEFAULT ", sql_file); - unescape(sql_file,row[SHOW_DEFAULT],lengths[SHOW_DEFAULT]); + unescape(sql_file, row[SHOW_DEFAULT], lengths[SHOW_DEFAULT]); } if (!row[SHOW_NULL][0]) fputs(" NOT NULL", sql_file); @@ -977,14 +993,18 @@ static void dumpTable(uint numFields, char *table) } else { - fprintf(md_result_file,"\n--\n-- Dumping data for table '%s'\n--\n", table); + if (!opt_xml) + fprintf(md_result_file,"\n--\n-- Dumping data for table '%s'\n--\n", + table); sprintf(query, "SELECT * FROM %s", quote_name(table,table_buff)); if (where) { - fprintf(md_result_file,"-- WHERE: %s\n",where); + if (!opt_xml) + fprintf(md_result_file,"-- WHERE: %s\n",where); strxmov(strend(query), " WHERE ",where,NullS); } - fputs("\n\n", md_result_file); + if (!opt_xml) + fputs("\n\n", md_result_file); if (mysql_query(sock, query)) { DBerror(sock, "when retrieving data from server"); @@ -1017,6 +1037,8 @@ static void dumpTable(uint numFields, char *table) row_break=0; rownr=0; init_length=(uint) strlen(insert_pat)+4; + if (opt_xml) + fprintf(md_result_file, "\t<%s>\n", table); if (opt_autocommit) fprintf(md_result_file, "set autocommit=0;\n"); @@ -1026,7 +1048,7 @@ static void dumpTable(uint numFields, char *table) uint i; ulong *lengths=mysql_fetch_lengths(res); rownr++; - if (!extended_insert) + if (!extended_insert && !opt_xml) fputs(insert_pat,md_result_file); mysql_field_seek(res,0); @@ -1085,22 +1107,36 @@ static void dumpTable(uint numFields, char *table) } else { - if (i) - fputc(',',md_result_file); + if (i && !opt_xml) + fputc(',', md_result_file); if (row[i]) { if (!IS_NUM_FIELD(field)) - unescape(md_result_file, row[i], lengths[i]); + { + if (opt_xml) + fprintf(md_result_file, "\t\t<%s>%s</%s>\n", + field->name, row[i], field->name); + else + unescape(md_result_file, row[i], lengths[i]); + } else { /* change any strings ("inf","nan",..) into NULL */ char *ptr = row[i]; - fputs((!isalpha(*ptr)) ? ptr : "NULL", md_result_file); + if (opt_xml) + fprintf(md_result_file, "\t\t<%s>%s</%s>\n", + field->name,!isalpha(*ptr) ?ptr: "NULL",field->name); + else + fputs((!isalpha(*ptr)) ? ptr : "NULL", md_result_file); } } else { - fputs("NULL",md_result_file); + if (opt_xml) + fprintf(md_result_file, "\t\t<%s>%s</%s>\n", + field->name, "NULL", field->name); + else + fputs("NULL", md_result_file); } } } @@ -1118,18 +1154,26 @@ static void dumpTable(uint numFields, char *table) } else { - if (row_break) + if (row_break && !opt_xml) fputs(";\n", md_result_file); row_break=1; /* This is first row */ - fputs(insert_pat,md_result_file); - fputs(extended_row.str,md_result_file); + + if (!opt_xml) + { + fputs(insert_pat,md_result_file); + fputs(extended_row.str,md_result_file); + } total_length = row_length+init_length; } } - else + else if (!opt_xml) fputs(");\n", md_result_file); } - if (extended_insert && row_break) + + //XML - close table tag and supress regular output + if (opt_xml) + fprintf(md_result_file, "\t</%s>\n", table); + else if (extended_insert && row_break) fputs(";\n", md_result_file); /* If not empty table */ fflush(md_result_file); if (mysql_errno(sock)) @@ -1204,9 +1248,14 @@ static int dump_databases(char **db_names) { int result=0; for ( ; *db_names ; db_names++) - { + { + //XML edit - add database element + if (opt_xml) + fprintf(md_result_file, "<%s>\n", *db_names); if (dump_all_tables_in_db(*db_names)) result=1; + if (opt_xml) + fprintf(md_result_file, "</%s>\n", *db_names); } return result; } /* dump_databases */ diff --git a/include/ft_global.h b/include/ft_global.h index f08b6cea6ab..9870e0854c1 100644 --- a/include/ft_global.h +++ b/include/ft_global.h @@ -35,7 +35,6 @@ struct _ft_vft { float (*find_relevance)(FT_INFO *, my_off_t, byte *); void (*close_search)(FT_INFO *); float (*get_relevance)(FT_INFO *); - my_off_t (*get_docid)(FT_INFO *); void (*reinit_search)(FT_INFO *); }; diff --git a/include/queues.h b/include/queues.h index 66125e650ca..d9d8091c9ef 100644 --- a/include/queues.h +++ b/include/queues.h @@ -53,6 +53,7 @@ void delete_queue(QUEUE *queue); void queue_insert(QUEUE *queue,byte *element); byte *queue_remove(QUEUE *queue,uint idx); void _downheap(QUEUE *queue,uint idx); +void queue_fix(QUEUE *queue); #define is_queue_inited(queue) ((queue)->root != 0) #ifdef __cplusplus diff --git a/include/sslopt-case.h b/include/sslopt-case.h index b801e5e73c7..61e0846ab86 100644 --- a/include/sslopt-case.h +++ b/include/sslopt-case.h @@ -36,7 +36,7 @@ break; case OPT_SSL_CAPATH: opt_use_ssl = 1; /* true */ - my_free(opt_ssl_ca, MYF(MY_ALLOW_ZERO_PTR)); + my_free(opt_ssl_capath, MYF(MY_ALLOW_ZERO_PTR)); opt_ssl_capath = my_strdup(optarg, MYF(0)); break; case OPT_SSL_CIPHER: diff --git a/innobase/btr/btr0btr.c b/innobase/btr/btr0btr.c index 33a3ac70c90..9cfd1806c5f 100644 --- a/innobase/btr/btr0btr.c +++ b/innobase/btr/btr0btr.c @@ -837,7 +837,7 @@ btr_parse_page_reorganize( /*======================*/ /* out: end of log record or NULL */ byte* ptr, /* in: buffer */ - byte* end_ptr,/* in: buffer end */ + byte* end_ptr __attribute__((unused)), /* in: buffer end */ page_t* page, /* in: page or NULL */ mtr_t* mtr) /* in: mtr or NULL */ { @@ -1438,7 +1438,7 @@ btr_page_split_and_insert( page_t* insert_page; page_cur_t* page_cursor; rec_t* first_rec; - byte* buf; + byte* buf = 0; /* remove warning */ rec_t* move_limit; ibool insert_will_fit; ulint n_iterations = 0; @@ -1616,7 +1616,7 @@ static void btr_level_list_remove( /*==================*/ - dict_tree_t* tree, /* in: index tree */ + dict_tree_t* tree __attribute__((unused)), /* in: index tree */ page_t* page, /* in: page to remove */ mtr_t* mtr) /* in: mtr */ { @@ -2338,7 +2338,7 @@ btr_validate_level( { ulint space; page_t* page; - page_t* right_page; + page_t* right_page = 0; /* remove warning */ page_t* father_page; page_t* right_father_page; rec_t* node_ptr; diff --git a/innobase/btr/btr0cur.c b/innobase/btr/btr0cur.c index a64ed8b6fe1..c553bcacf7f 100644 --- a/innobase/btr/btr0cur.c +++ b/innobase/btr/btr0cur.c @@ -94,7 +94,7 @@ static void btr_cur_latch_leaves( /*=================*/ - dict_tree_t* tree, /* in: index tree */ + dict_tree_t* tree __attribute__((unused)), /* in: index tree */ page_t* page, /* in: leaf page where the search converged */ ulint space, /* in: space id */ @@ -219,7 +219,7 @@ btr_cur_search_to_nth_level( ulint insert_planned; ulint buf_mode; ulint estimate; - ulint root_height; + ulint root_height = 0; /* remove warning */ #ifdef BTR_CUR_ADAPT btr_search_t* info; #endif @@ -488,7 +488,7 @@ btr_cur_open_at_index_side( ulint page_no; ulint space; ulint height; - ulint root_height; + ulint root_height = 0; /* remove warning */ rec_t* node_ptr; ulint estimate; @@ -2907,8 +2907,9 @@ btr_store_big_rec_extern_fields( rec_t* rec, /* in: record */ big_rec_t* big_rec_vec, /* in: vector containing fields to be stored externally */ - mtr_t* local_mtr) /* in: mtr containing the latch to - rec and to the tree */ + mtr_t* local_mtr __attribute__((unused))) /* in: mtr + containing the latch to rec and to the + tree */ { byte* data; ulint local_len; @@ -3069,9 +3070,9 @@ btr_free_externally_stored_field( ibool do_not_free_inherited,/* in: TRUE if called in a rollback and we do not want to free inherited fields */ - mtr_t* local_mtr) /* in: mtr containing the latch to - data an an X-latch to the index - tree */ + mtr_t* local_mtr __attribute__((unused))) /* in: mtr + containing the latch to data an an + X-latch to the index tree */ { page_t* page; page_t* rec_page; diff --git a/innobase/btr/btr0sea.c b/innobase/btr/btr0sea.c index 31ef8ce573b..2e08941894c 100644 --- a/innobase/btr/btr0sea.c +++ b/innobase/btr/btr0sea.c @@ -1245,7 +1245,7 @@ btr_search_update_hash_on_insert( dulint tree_id; ulint fold; ulint ins_fold; - ulint next_fold; + ulint next_fold = 0; /* remove warning (??? bug ???) */ ulint n_fields; ulint n_bytes; ulint side; diff --git a/innobase/buf/buf0buf.c b/innobase/buf/buf0buf.c index 7d9cbf24948..b9dfa3df82a 100644 --- a/innobase/buf/buf0buf.c +++ b/innobase/buf/buf0buf.c @@ -280,7 +280,7 @@ buf_page_print( ut_sprintf_buf(buf, read_buf, UNIV_PAGE_SIZE); fprintf(stderr, - "InnoDB: Page dump in ascii and hex (%lu bytes):\n%s", + "InnoDB: Page dump in ascii and hex (%u bytes):\n%s", UNIV_PAGE_SIZE, buf); fprintf(stderr, "InnoDB: End of page dump\n"); diff --git a/innobase/buf/buf0lru.c b/innobase/buf/buf0lru.c index c3118544492..a3bb673dfc8 100644 --- a/innobase/buf/buf0lru.c +++ b/innobase/buf/buf0lru.c @@ -103,9 +103,10 @@ ibool buf_LRU_search_and_free_block( /*==========================*/ /* out: TRUE if freed */ - ulint n_iterations) /* in: how many times this has been called - repeatedly without result: a high value - means that we should search farther */ + ulint n_iterations __attribute__((unused))) /* in: how many times + this has been called repeatedly without + result: a high value means that we should + search farther */ { buf_block_t* block; ibool freed; @@ -199,7 +200,7 @@ buf_LRU_get_free_block(void) buf_block_t* block = NULL; ibool freed; ulint n_iterations = 0; - ibool mon_value_was; + ibool mon_value_was = 0; /* remove bug */ ibool started_monitor = FALSE; loop: mutex_enter(&(buf_pool->mutex)); diff --git a/innobase/data/data0data.c b/innobase/data/data0data.c index 2254dcb6ae6..03abcb9b6e0 100644 --- a/innobase/data/data0data.c +++ b/innobase/data/data0data.c @@ -572,7 +572,7 @@ from entry with dtuple_convert_big_rec. */ void dtuple_convert_back_big_rec( /*========================*/ - dict_index_t* index, /* in: index */ + dict_index_t* index __attribute__((unused)), /* in: index */ dtuple_t* entry, /* in: entry whose data was put to vector */ big_rec_t* vector) /* in, own: big rec vector; it is freed in this function */ diff --git a/innobase/dict/dict0boot.c b/innobase/dict/dict0boot.c index 206fbe32940..374c567c3ca 100644 --- a/innobase/dict/dict0boot.c +++ b/innobase/dict/dict0boot.c @@ -254,27 +254,29 @@ dict_boot(void) /* Insert into the dictionary cache the descriptions of the basic system tables */ /*-------------------------*/ - table = dict_mem_table_create("SYS_TABLES", DICT_HDR_SPACE, 8); - - dict_mem_table_add_col(table, "NAME", DATA_BINARY, 0, 0, 0); - dict_mem_table_add_col(table, "ID", DATA_BINARY, 0, 0, 0); - dict_mem_table_add_col(table, "N_COLS", DATA_INT, 0, 4, 0); - dict_mem_table_add_col(table, "TYPE", DATA_INT, 0, 4, 0); - dict_mem_table_add_col(table, "MIX_ID", DATA_BINARY, 0, 0, 0); - dict_mem_table_add_col(table, "MIX_LEN", DATA_INT, 0, 4, 0); - dict_mem_table_add_col(table, "CLUSTER_NAME", DATA_BINARY, 0, 0, 0); - dict_mem_table_add_col(table, "SPACE", DATA_INT, 0, 4, 0); + table = dict_mem_table_create((char *) "SYS_TABLES", DICT_HDR_SPACE,8); + + dict_mem_table_add_col(table, (char *) "NAME", DATA_BINARY, 0, 0, 0); + dict_mem_table_add_col(table, (char *) "ID", DATA_BINARY, 0, 0, 0); + dict_mem_table_add_col(table, (char *) "N_COLS", DATA_INT, 0, 4, 0); + dict_mem_table_add_col(table, (char *) "TYPE", DATA_INT, 0, 4, 0); + dict_mem_table_add_col(table, (char *) "MIX_ID", DATA_BINARY, 0, 0, 0); + dict_mem_table_add_col(table, (char *) "MIX_LEN", DATA_INT, 0, 4, 0); + dict_mem_table_add_col(table, (char *) "CLUSTER_NAME", DATA_BINARY, + 0, 0, 0); + dict_mem_table_add_col(table, (char *) "SPACE", DATA_INT, 0, 4, 0); table->id = DICT_TABLES_ID; dict_table_add_to_cache(table); dict_sys->sys_tables = table; - index = dict_mem_index_create("SYS_TABLES", "CLUST_IND", - DICT_HDR_SPACE, - DICT_UNIQUE | DICT_CLUSTERED, 1); + index = dict_mem_index_create((char *) "SYS_TABLES", (char *) + "CLUST_IND", + DICT_HDR_SPACE, + DICT_UNIQUE | DICT_CLUSTERED, 1); - dict_mem_index_add_field(index, "NAME", 0); + dict_mem_index_add_field(index, (char *) "NAME", 0); index->page_no = mtr_read_ulint(dict_hdr + DICT_HDR_TABLES, MLOG_4BYTES, &mtr); @@ -282,51 +284,52 @@ dict_boot(void) ut_a(dict_index_add_to_cache(table, index)); /*-------------------------*/ - index = dict_mem_index_create("SYS_TABLES", "ID_IND", DICT_HDR_SPACE, - DICT_UNIQUE, 1); - dict_mem_index_add_field(index, "ID", 0); + index = dict_mem_index_create((char *) "SYS_TABLES", + (char *) "ID_IND", DICT_HDR_SPACE, + DICT_UNIQUE, 1); + dict_mem_index_add_field(index, (char *) "ID", 0); index->page_no = mtr_read_ulint(dict_hdr + DICT_HDR_TABLE_IDS, MLOG_4BYTES, &mtr); index->id = DICT_TABLE_IDS_ID; ut_a(dict_index_add_to_cache(table, index)); /*-------------------------*/ - table = dict_mem_table_create("SYS_COLUMNS", DICT_HDR_SPACE, 7); - - dict_mem_table_add_col(table, "TABLE_ID", DATA_BINARY, 0, 0, 0); - dict_mem_table_add_col(table, "POS", DATA_INT, 0, 4, 0); - dict_mem_table_add_col(table, "NAME", DATA_BINARY, 0, 0, 0); - dict_mem_table_add_col(table, "MTYPE", DATA_INT, 0, 4, 0); - dict_mem_table_add_col(table, "PRTYPE", DATA_INT, 0, 4, 0); - dict_mem_table_add_col(table, "LEN", DATA_INT, 0, 4, 0); - dict_mem_table_add_col(table, "PREC", DATA_INT, 0, 4, 0); + table = dict_mem_table_create((char *) "SYS_COLUMNS",DICT_HDR_SPACE,7); + + dict_mem_table_add_col(table, (char *) "TABLE_ID", DATA_BINARY,0,0,0); + dict_mem_table_add_col(table, (char *) "POS", DATA_INT, 0, 4, 0); + dict_mem_table_add_col(table, (char *) "NAME", DATA_BINARY, 0, 0, 0); + dict_mem_table_add_col(table, (char *) "MTYPE", DATA_INT, 0, 4, 0); + dict_mem_table_add_col(table, (char *) "PRTYPE", DATA_INT, 0, 4, 0); + dict_mem_table_add_col(table, (char *) "LEN", DATA_INT, 0, 4, 0); + dict_mem_table_add_col(table, (char *) "PREC", DATA_INT, 0, 4, 0); table->id = DICT_COLUMNS_ID; dict_table_add_to_cache(table); dict_sys->sys_columns = table; - index = dict_mem_index_create("SYS_COLUMNS", "CLUST_IND", - DICT_HDR_SPACE, - DICT_UNIQUE | DICT_CLUSTERED, 2); + index = dict_mem_index_create((char *) "SYS_COLUMNS", + (char *) "CLUST_IND", DICT_HDR_SPACE, + DICT_UNIQUE | DICT_CLUSTERED, 2); - dict_mem_index_add_field(index, "TABLE_ID", 0); - dict_mem_index_add_field(index, "POS", 0); + dict_mem_index_add_field(index, (char *) "TABLE_ID", 0); + dict_mem_index_add_field(index, (char *) "POS", 0); index->page_no = mtr_read_ulint(dict_hdr + DICT_HDR_COLUMNS, MLOG_4BYTES, &mtr); index->id = DICT_COLUMNS_ID; ut_a(dict_index_add_to_cache(table, index)); /*-------------------------*/ - table = dict_mem_table_create("SYS_INDEXES", DICT_HDR_SPACE, 7); + table = dict_mem_table_create((char *) "SYS_INDEXES",DICT_HDR_SPACE,7); - dict_mem_table_add_col(table, "TABLE_ID", DATA_BINARY, 0, 0, 0); - dict_mem_table_add_col(table, "ID", DATA_BINARY, 0, 0, 0); - dict_mem_table_add_col(table, "NAME", DATA_BINARY, 0, 0, 0); - dict_mem_table_add_col(table, "N_FIELDS", DATA_INT, 0, 4, 0); - dict_mem_table_add_col(table, "TYPE", DATA_INT, 0, 4, 0); - dict_mem_table_add_col(table, "SPACE", DATA_INT, 0, 4, 0); - dict_mem_table_add_col(table, "PAGE_NO", DATA_INT, 0, 4, 0); + dict_mem_table_add_col(table, (char *) "TABLE_ID", DATA_BINARY, 0,0,0); + dict_mem_table_add_col(table, (char *) "ID", DATA_BINARY, 0, 0, 0); + dict_mem_table_add_col(table, (char *) "NAME", DATA_BINARY, 0, 0, 0); + dict_mem_table_add_col(table, (char *) "N_FIELDS", DATA_INT, 0, 4, 0); + dict_mem_table_add_col(table, (char *) "TYPE", DATA_INT, 0, 4, 0); + dict_mem_table_add_col(table, (char *) "SPACE", DATA_INT, 0, 4, 0); + dict_mem_table_add_col(table, (char *) "PAGE_NO", DATA_INT, 0, 4, 0); /* The '+ 2' below comes from the 2 system fields */ ut_ad(DICT_SYS_INDEXES_PAGE_NO_FIELD == 6 + 2); @@ -336,34 +339,34 @@ dict_boot(void) dict_table_add_to_cache(table); dict_sys->sys_indexes = table; - index = dict_mem_index_create("SYS_INDEXES", "CLUST_IND", - DICT_HDR_SPACE, - DICT_UNIQUE | DICT_CLUSTERED, 2); + index = dict_mem_index_create((char *) "SYS_INDEXES", + (char *) "CLUST_IND", DICT_HDR_SPACE, + DICT_UNIQUE | DICT_CLUSTERED, 2); - dict_mem_index_add_field(index, "TABLE_ID", 0); - dict_mem_index_add_field(index, "ID", 0); + dict_mem_index_add_field(index, (char *) "TABLE_ID", 0); + dict_mem_index_add_field(index, (char *) "ID", 0); index->page_no = mtr_read_ulint(dict_hdr + DICT_HDR_INDEXES, MLOG_4BYTES, &mtr); index->id = DICT_INDEXES_ID; ut_a(dict_index_add_to_cache(table, index)); /*-------------------------*/ - table = dict_mem_table_create("SYS_FIELDS", DICT_HDR_SPACE, 3); + table = dict_mem_table_create((char *) "SYS_FIELDS", DICT_HDR_SPACE,3); - dict_mem_table_add_col(table, "INDEX_ID", DATA_BINARY, 0, 0, 0); - dict_mem_table_add_col(table, "POS", DATA_INT, 0, 4, 0); - dict_mem_table_add_col(table, "COL_NAME", DATA_BINARY, 0, 0, 0); + dict_mem_table_add_col(table, (char *) "INDEX_ID", DATA_BINARY, 0,0,0); + dict_mem_table_add_col(table, (char *) "POS", DATA_INT, 0, 4, 0); + dict_mem_table_add_col(table, (char *) "COL_NAME", DATA_BINARY, 0,0,0); table->id = DICT_FIELDS_ID; dict_table_add_to_cache(table); dict_sys->sys_fields = table; - index = dict_mem_index_create("SYS_FIELDS", "CLUST_IND", - DICT_HDR_SPACE, - DICT_UNIQUE | DICT_CLUSTERED, 2); + index = dict_mem_index_create((char *) "SYS_FIELDS", + (char *) "CLUST_IND", DICT_HDR_SPACE, + DICT_UNIQUE | DICT_CLUSTERED, 2); - dict_mem_index_add_field(index, "INDEX_ID", 0); - dict_mem_index_add_field(index, "POS", 0); + dict_mem_index_add_field(index, (char *) "INDEX_ID", 0); + dict_mem_index_add_field(index, (char *) "POS", 0); index->page_no = mtr_read_ulint(dict_hdr + DICT_HDR_FIELDS, MLOG_4BYTES, &mtr); diff --git a/innobase/dict/dict0crea.c b/innobase/dict/dict0crea.c index b3bf9157e18..906683ca643 100644 --- a/innobase/dict/dict0crea.c +++ b/innobase/dict/dict0crea.c @@ -1044,8 +1044,8 @@ dict_create_or_check_foreign_constraint_tables(void) mutex_enter(&(dict_sys->mutex)); - table1 = dict_table_get_low("SYS_FOREIGN"); - table2 = dict_table_get_low("SYS_FOREIGN_COLS"); + table1 = dict_table_get_low((char *) "SYS_FOREIGN"); + table2 = dict_table_get_low((char *) "SYS_FOREIGN_COLS"); if (table1 && table2 && UT_LIST_GET_LEN(table1->indexes) == 3 @@ -1061,18 +1061,18 @@ dict_create_or_check_foreign_constraint_tables(void) trx = trx_allocate_for_mysql(); - trx->op_info = "creating foreign key sys tables"; + trx->op_info = (char *) "creating foreign key sys tables"; if (table1) { fprintf(stderr, "InnoDB: dropping incompletely created SYS_FOREIGN table\n"); - row_drop_table_for_mysql("SYS_FOREIGN", trx, TRUE); + row_drop_table_for_mysql((char *) "SYS_FOREIGN", trx, TRUE); } if (table2) { fprintf(stderr, "InnoDB: dropping incompletely created SYS_FOREIGN_COLS table\n"); - row_drop_table_for_mysql("SYS_FOREIGN_COLS", trx, TRUE); + row_drop_table_for_mysql((char *) "SYS_FOREIGN_COLS",trx,TRUE); } fprintf(stderr, @@ -1082,7 +1082,7 @@ dict_create_or_check_foreign_constraint_tables(void) there are 2 secondary indexes on SYS_FOREIGN, and they are defined just like below */ - str = + str = (char *) "PROCEDURE CREATE_FOREIGN_SYS_TABLES_PROC () IS\n" "BEGIN\n" "CREATE TABLE\n" @@ -1121,15 +1121,15 @@ dict_create_or_check_foreign_constraint_tables(void) fprintf(stderr, "InnoDB: dropping incompletely created SYS_FOREIGN tables\n"); - row_drop_table_for_mysql("SYS_FOREIGN", trx, TRUE); - row_drop_table_for_mysql("SYS_FOREIGN_COLS", trx, TRUE); + row_drop_table_for_mysql((char *) "SYS_FOREIGN", trx, TRUE); + row_drop_table_for_mysql((char *) "SYS_FOREIGN_COLS",trx,TRUE); error = DB_MUST_GET_MORE_FILE_SPACE; } que_graph_free(graph); - trx->op_info = ""; + trx->op_info = (char *) ""; trx_free_for_mysql(trx); @@ -1165,7 +1165,7 @@ dict_create_add_foreigns_to_dictionary( ut_ad(mutex_own(&(dict_sys->mutex))); - if (NULL == dict_table_get_low("SYS_FOREIGN")) { + if (NULL == dict_table_get_low((char *) "SYS_FOREIGN")) { fprintf(stderr, "InnoDB: table SYS_FOREIGN not found from internal data dictionary\n"); return(DB_ERROR); diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c index 07a9b472d66..0079ff08057 100644 --- a/innobase/dict/dict0dict.c +++ b/innobase/dict/dict0dict.c @@ -492,15 +492,19 @@ dict_table_add_to_cache( The clustered index will not always physically contain all system columns. */ - dict_mem_table_add_col(table, "DB_ROW_ID", DATA_SYS, DATA_ROW_ID, 0, 0); + dict_mem_table_add_col(table, (char *) "DB_ROW_ID", DATA_SYS, + DATA_ROW_ID, 0, 0); ut_ad(DATA_ROW_ID == 0); - dict_mem_table_add_col(table, "DB_TRX_ID", DATA_SYS, DATA_TRX_ID, 0, 0); + dict_mem_table_add_col(table, (char *) "DB_TRX_ID", DATA_SYS, + DATA_TRX_ID, 0, 0); ut_ad(DATA_TRX_ID == 1); - dict_mem_table_add_col(table, "DB_ROLL_PTR", DATA_SYS, DATA_ROLL_PTR, + dict_mem_table_add_col(table, (char *) "DB_ROLL_PTR", DATA_SYS, + DATA_ROLL_PTR, 0, 0); ut_ad(DATA_ROLL_PTR == 2); - dict_mem_table_add_col(table, "DB_MIX_ID", DATA_SYS, DATA_MIX_ID, 0, 0); + dict_mem_table_add_col(table, (char *) "DB_MIX_ID", DATA_SYS, + DATA_MIX_ID, 0, 0); ut_ad(DATA_MIX_ID == 3); ut_ad(DATA_N_SYS_COLS == 4); /* This assert reminds that if a new system column is added to the program, @@ -1908,7 +1912,7 @@ dict_create_foreign_constraints( return(DB_ERROR); } loop: - ptr = dict_scan_to(ptr, "FOREIGN"); + ptr = dict_scan_to(ptr, (char *) "FOREIGN"); if (*ptr == '\0' || dict_bracket_count(sql_string, ptr) != 1) { @@ -1920,19 +1924,19 @@ loop: return(error); } - ptr = dict_accept(ptr, "FOREIGN", &success); + ptr = dict_accept(ptr, (char *) "FOREIGN", &success); if (!isspace(*ptr)) { return(DB_CANNOT_ADD_CONSTRAINT); } - ptr = dict_accept(ptr, "KEY", &success); + ptr = dict_accept(ptr, (char *) "KEY", &success); if (!success) { goto loop; } - ptr = dict_accept(ptr, "(", &success); + ptr = dict_accept(ptr, (char *) "(", &success); if (!success) { goto loop; @@ -1950,13 +1954,13 @@ col_loop1: i++; - ptr = dict_accept(ptr, ",", &success); + ptr = dict_accept(ptr, (char *) ",", &success); if (success) { goto col_loop1; } - ptr = dict_accept(ptr, ")", &success); + ptr = dict_accept(ptr, (char *) ")", &success); if (!success) { return(DB_CANNOT_ADD_CONSTRAINT); @@ -1971,7 +1975,7 @@ col_loop1: return(DB_CANNOT_ADD_CONSTRAINT); } - ptr = dict_accept(ptr, "REFERENCES", &success); + ptr = dict_accept(ptr, (char *) "REFERENCES", &success); if (!success || !isspace(*ptr)) { return(DB_CANNOT_ADD_CONSTRAINT); @@ -2002,7 +2006,7 @@ col_loop1: return(DB_CANNOT_ADD_CONSTRAINT); } - ptr = dict_accept(ptr, "(", &success); + ptr = dict_accept(ptr, (char *) "(", &success); if (!success) { dict_foreign_free(foreign); @@ -2022,13 +2026,13 @@ col_loop2: return(DB_CANNOT_ADD_CONSTRAINT); } - ptr = dict_accept(ptr, ",", &success); + ptr = dict_accept(ptr, (char *) ",", &success); if (success) { goto col_loop2; } - ptr = dict_accept(ptr, ")", &success); + ptr = dict_accept(ptr, (char *) ")", &success); if (!success || foreign->n_fields != i) { dict_foreign_free(foreign); @@ -2554,7 +2558,8 @@ void dict_update_statistics_low( /*=======================*/ dict_table_t* table, /* in: table */ - ibool has_dict_mutex) /* in: TRUE if the caller has the + ibool has_dict_mutex __attribute__((unused))) + /* in: TRUE if the caller has the dictionary mutex */ { dict_index_t* index; diff --git a/innobase/dict/dict0load.c b/innobase/dict/dict0load.c index dcdc9ee01cd..d803d28963d 100644 --- a/innobase/dict/dict0load.c +++ b/innobase/dict/dict0load.c @@ -75,7 +75,7 @@ dict_get_first_table_name_in_db( mtr_start(&mtr); - sys_tables = dict_table_get_low("SYS_TABLES"); + sys_tables = dict_table_get_low((char *) "SYS_TABLES"); sys_index = UT_LIST_GET_FIRST(sys_tables->indexes); tuple = dtuple_create(heap, 1); @@ -154,7 +154,7 @@ dict_print(void) mtr_start(&mtr); - sys_tables = dict_table_get_low("SYS_TABLES"); + sys_tables = dict_table_get_low((char *) "SYS_TABLES"); sys_index = UT_LIST_GET_FIRST(sys_tables->indexes); btr_pcur_open_at_index_side(TRUE, sys_index, BTR_SEARCH_LEAF, &pcur, @@ -241,7 +241,7 @@ dict_load_table( mtr_start(&mtr); - sys_tables = dict_table_get_low("SYS_TABLES"); + sys_tables = dict_table_get_low((char *) "SYS_TABLES"); sys_index = UT_LIST_GET_FIRST(sys_tables->indexes); tuple = dtuple_create(heap, 1); @@ -277,7 +277,7 @@ dict_load_table( return(NULL); } - ut_a(0 == ut_strcmp("SPACE", + ut_a(0 == ut_strcmp((char *) "SPACE", dict_field_get_col( dict_index_get_nth_field( dict_table_get_first_index(sys_tables), 9))->name)); @@ -285,7 +285,7 @@ dict_load_table( field = rec_get_nth_field(rec, 9, &len); space = mach_read_from_4(field); - ut_a(0 == ut_strcmp("N_COLS", + ut_a(0 == ut_strcmp((char *) "N_COLS", dict_field_get_col( dict_index_get_nth_field( dict_table_get_first_index(sys_tables), 4))->name)); @@ -295,7 +295,7 @@ dict_load_table( table = dict_mem_table_create(name, space, n_cols); - ut_a(0 == ut_strcmp("ID", + ut_a(0 == ut_strcmp((char *) "ID", dict_field_get_col( dict_index_get_nth_field( dict_table_get_first_index(sys_tables), 3))->name)); @@ -498,7 +498,7 @@ dict_load_columns( mtr_start(&mtr); - sys_columns = dict_table_get_low("SYS_COLUMNS"); + sys_columns = dict_table_get_low((char *) "SYS_COLUMNS"); sys_index = UT_LIST_GET_FIRST(sys_columns->indexes); tuple = dtuple_create(heap, 1); @@ -528,7 +528,7 @@ dict_load_columns( ut_ad(len == 4); ut_a(i == mach_read_from_4(field)); - ut_a(0 == ut_strcmp("NAME", + ut_a(0 == ut_strcmp((char *) "NAME", dict_field_get_col( dict_index_get_nth_field( dict_table_get_first_index(sys_columns), 4))->name)); @@ -550,7 +550,7 @@ dict_load_columns( field = rec_get_nth_field(rec, 7, &len); col_len = mach_read_from_4(field); - ut_a(0 == ut_strcmp("PREC", + ut_a(0 == ut_strcmp((char *) "PREC", dict_field_get_col( dict_index_get_nth_field( dict_table_get_first_index(sys_columns), 8))->name)); @@ -608,7 +608,7 @@ dict_load_indexes( mtr_start(&mtr); - sys_indexes = dict_table_get_low("SYS_INDEXES"); + sys_indexes = dict_table_get_low((char *) "SYS_INDEXES"); sys_index = UT_LIST_GET_FIRST(sys_indexes->indexes); tuple = dtuple_create(heap, 1); @@ -643,7 +643,7 @@ dict_load_indexes( ut_ad(len == 8); id = mach_read_from_8(field); - ut_a(0 == ut_strcmp("NAME", + ut_a(0 == ut_strcmp((char *) "NAME", dict_field_get_col( dict_index_get_nth_field( dict_table_get_first_index(sys_indexes), 4))->name)); @@ -663,7 +663,7 @@ dict_load_indexes( field = rec_get_nth_field(rec, 7, &len); space = mach_read_from_4(field); - ut_a(0 == ut_strcmp("PAGE_NO", + ut_a(0 == ut_strcmp((char *) "PAGE_NO", dict_field_get_col( dict_index_get_nth_field( dict_table_get_first_index(sys_indexes), 8))->name)); @@ -674,8 +674,8 @@ dict_load_indexes( if (is_sys_table && ((type & DICT_CLUSTERED) || ((table == dict_sys->sys_tables) - && (name_len == ut_strlen("ID_IND")) - && (0 == ut_memcmp(name_buf, "ID_IND", + && (name_len == ut_strlen((char *) "ID_IND")) + && (0 == ut_memcmp(name_buf, (char *) "ID_IND", name_len))))) { /* The index was created in memory already in @@ -727,7 +727,7 @@ dict_load_fields( mtr_start(&mtr); - sys_fields = dict_table_get_low("SYS_FIELDS"); + sys_fields = dict_table_get_low((char *) "SYS_FIELDS"); sys_index = UT_LIST_GET_FIRST(sys_fields->indexes); tuple = dtuple_create(heap, 1); @@ -756,7 +756,7 @@ dict_load_fields( ut_ad(len == 4); ut_a(i == mach_read_from_4(field)); - ut_a(0 == ut_strcmp("COL_NAME", + ut_a(0 == ut_strcmp((char *) "COL_NAME", dict_field_get_col( dict_index_get_nth_field( dict_table_get_first_index(sys_fields), 4))->name)); @@ -807,7 +807,7 @@ dict_load_foreign_cols( foreign->n_fields * sizeof(void*)); mtr_start(&mtr); - sys_foreign_cols = dict_table_get_low("SYS_FOREIGN_COLS"); + sys_foreign_cols = dict_table_get_low((char *) "SYS_FOREIGN_COLS"); sys_index = UT_LIST_GET_FIRST(sys_foreign_cols->indexes); tuple = dtuple_create(foreign->heap, 1); @@ -885,7 +885,7 @@ dict_load_foreign( mtr_start(&mtr); - sys_foreign = dict_table_get_low("SYS_FOREIGN"); + sys_foreign = dict_table_get_low((char *) "SYS_FOREIGN"); sys_index = UT_LIST_GET_FIRST(sys_foreign->indexes); tuple = dtuple_create(heap2, 1); @@ -999,7 +999,7 @@ dict_load_foreigns( ut_ad(mutex_own(&(dict_sys->mutex))); - sys_foreign = dict_table_get_low("SYS_FOREIGN"); + sys_foreign = dict_table_get_low((char *) "SYS_FOREIGN"); if (sys_foreign == NULL) { /* No foreign keys defined yet in this database */ diff --git a/innobase/eval/eval0eval.c b/innobase/eval/eval0eval.c index 110387d8373..157d4e4f98d 100644 --- a/innobase/eval/eval0eval.c +++ b/innobase/eval/eval0eval.c @@ -164,8 +164,8 @@ eval_logical( que_node_t* arg1; que_node_t* arg2; ibool val1; - ibool val2; - ibool val; + ibool val2 = 0; /* remove warning */ + ibool val = 0; /* remove warning */ int func; ut_ad(que_node_get_type(logical_node) == QUE_NODE_FUNC); @@ -205,7 +205,7 @@ eval_arith( que_node_t* arg1; que_node_t* arg2; lint val1; - lint val2; + lint val2 = 0; /* remove warning */ lint val; int func; @@ -283,7 +283,7 @@ eval_predefined_2( { que_node_t* arg; que_node_t* arg1; - que_node_t* arg2; + que_node_t* arg2 = 0; /* remove warning (??? bug ???) */ lint int_val; byte* data; ulint len1; diff --git a/innobase/fil/fil0fil.c b/innobase/fil/fil0fil.c index 62389c8394c..f1f2bc4fa17 100644 --- a/innobase/fil/fil0fil.c +++ b/innobase/fil/fil0fil.c @@ -1209,7 +1209,7 @@ fil_aio_wait( ut_ad(fil_validate()); if (os_aio_use_native_aio) { - srv_io_thread_op_info[segment] = "native aio handle"; + srv_io_thread_op_info[segment] = (char *) "native aio handle"; #ifdef WIN_ASYNC_IO ret = os_aio_windows_handle(segment, 0, &fil_node, &message, &type); @@ -1220,7 +1220,7 @@ fil_aio_wait( ut_a(0); #endif } else { - srv_io_thread_op_info[segment] = "simulated aio handle"; + srv_io_thread_op_info[segment] =(char *)"simulated aio handle"; ret = os_aio_simulated_handle(segment, (void**) &fil_node, &message, &type); @@ -1228,7 +1228,7 @@ fil_aio_wait( ut_a(ret); - srv_io_thread_op_info[segment] = "complete io for fil node"; + srv_io_thread_op_info[segment] = (char *) "complete io for fil node"; mutex_enter(&(system->mutex)); @@ -1241,10 +1241,11 @@ fil_aio_wait( /* Do the i/o handling */ if (buf_pool_is_block(message)) { - srv_io_thread_op_info[segment] = "complete io for buf page"; + srv_io_thread_op_info[segment] = + (char *) "complete io for buf page"; buf_page_io_complete(message); } else { - srv_io_thread_op_info[segment] = "complete io for log"; + srv_io_thread_op_info[segment] =(char *) "complete io for log"; log_io_complete(message); } } diff --git a/innobase/fsp/fsp0fsp.c b/innobase/fsp/fsp0fsp.c index ccc13f15fde..25fc2891e76 100644 --- a/innobase/fsp/fsp0fsp.c +++ b/innobase/fsp/fsp0fsp.c @@ -803,7 +803,7 @@ fsp_parse_init_file_page( /*=====================*/ /* out: end of log record or NULL */ byte* ptr, /* in: buffer */ - byte* end_ptr,/* in: buffer end */ + byte* end_ptr __attribute__((unused)), /* in: buffer end */ page_t* page) /* in: page or NULL */ { ut_ad(ptr && end_ptr); @@ -1252,7 +1252,7 @@ fsp_seg_inode_page_get_nth_inode( /* out: segment inode */ page_t* page, /* in: segment inode page */ ulint i, /* in: inode index on page */ - mtr_t* mtr) /* in: mini-transaction handle */ + mtr_t* mtr __attribute__((unused))) /* in: mini-transaction handle */ { ut_ad(i < FSP_SEG_INODES_PER_PAGE); ut_ad(mtr_memo_contains(mtr, buf_block_align(page), @@ -1494,7 +1494,7 @@ fseg_get_nth_frag_page_no( /* out: page number, FIL_NULL if not in use */ fseg_inode_t* inode, /* in: segment inode */ ulint n, /* in: slot index */ - mtr_t* mtr) /* in: mtr handle */ + mtr_t* mtr __attribute__((unused))) /* in: mtr handle */ { ut_ad(inode && mtr); ut_ad(n < FSEG_FRAG_ARR_N_SLOTS); @@ -1632,7 +1632,7 @@ fseg_create_general( fsp_header_t* space_header; fseg_inode_t* inode; dulint seg_id; - fseg_header_t* header; + fseg_header_t* header = 0; /* remove warning */ rw_lock_t* latch; ibool success; page_t* ret = NULL; diff --git a/innobase/ibuf/ibuf0ibuf.c b/innobase/ibuf/ibuf0ibuf.c index bd1f0e6e1d8..a6355ce7ca5 100644 --- a/innobase/ibuf/ibuf0ibuf.c +++ b/innobase/ibuf/ibuf0ibuf.c @@ -292,6 +292,7 @@ ibuf_count_get( /********************************************************************** Sets the ibuf count for a given page. */ +#ifdef UNIV_IBUF_DEBUG static void ibuf_count_set( @@ -306,6 +307,7 @@ ibuf_count_set( *(ibuf_counts[space] + page_no) = val; } +#endif /********************************************************************** Creates the insert buffer data structure at a database startup and @@ -472,19 +474,18 @@ ibuf_data_init_for_space( table = dict_mem_table_create(buf, space, 2); - dict_mem_table_add_col(table, "PAGE_NO", DATA_BINARY, 0, 0, 0); - dict_mem_table_add_col(table, "TYPES", DATA_BINARY, 0, 0, 0); + dict_mem_table_add_col(table,(char *) "PAGE_NO", DATA_BINARY, 0, 0, 0); + dict_mem_table_add_col(table,(char *) "TYPES", DATA_BINARY, 0, 0, 0); table->id = ut_dulint_add(DICT_IBUF_ID_MIN, space); dict_table_add_to_cache(table); - index = dict_mem_index_create(buf, "CLUST_IND", space, - DICT_CLUSTERED | DICT_UNIVERSAL | DICT_IBUF, - 2); + index = dict_mem_index_create(buf, (char *) "CLUST_IND", space, + DICT_CLUSTERED | DICT_UNIVERSAL | DICT_IBUF,2); - dict_mem_index_add_field(index, "PAGE_NO", 0); - dict_mem_index_add_field(index, "TYPES", 0); + dict_mem_index_add_field(index, (char *) "PAGE_NO", 0); + dict_mem_index_add_field(index, (char *) "TYPES", 0); index->page_no = FSP_IBUF_TREE_ROOT_PAGE_NO; @@ -538,7 +539,7 @@ ibuf_parse_bitmap_init( /*===================*/ /* out: end of log record or NULL */ byte* ptr, /* in: buffer */ - byte* end_ptr,/* in: buffer end */ + byte* end_ptr __attribute__((unused)), /* in: buffer end */ page_t* page, /* in: page or NULL */ mtr_t* mtr) /* in: mtr or NULL */ { @@ -561,7 +562,8 @@ ibuf_bitmap_page_get_bits( page_t* page, /* in: bitmap page */ ulint page_no,/* in: page whose bits to get */ ulint bit, /* in: IBUF_BITMAP_FREE, IBUF_BITMAP_BUFFERED, ... */ - mtr_t* mtr) /* in: mtr containing an x-latch to the bitmap page */ + mtr_t* mtr __attribute__((unused))) /* in: mtr containing an x-latch + to the bitmap page */ { ulint byte_offset; ulint bit_offset; diff --git a/innobase/include/btr0btr.ic b/innobase/include/btr0btr.ic index 5c1c89e9840..09006828cc9 100644 --- a/innobase/include/btr0btr.ic +++ b/innobase/include/btr0btr.ic @@ -89,7 +89,7 @@ btr_page_get_level( /*===============*/ /* out: level, leaf level == 0 */ page_t* page, /* in: index page */ - mtr_t* mtr) /* in: mini-transaction handle */ + mtr_t* mtr __attribute__((unused))) /* in: mini-transaction handle */ { ut_ad(page && mtr); @@ -121,7 +121,7 @@ btr_page_get_next( /*==============*/ /* out: next page number */ page_t* page, /* in: index page */ - mtr_t* mtr) /* in: mini-transaction handle */ + mtr_t* mtr __attribute__((unused))) /* in: mini-transaction handle */ { ut_ad(page && mtr); ut_ad(mtr_memo_contains(mtr, buf_block_align(page), @@ -155,7 +155,7 @@ btr_page_get_prev( /*==============*/ /* out: prev page number */ page_t* page, /* in: index page */ - mtr_t* mtr) /* in: mini-transaction handle */ + mtr_t* mtr __attribute__((unused))) /* in: mini-transaction handle */ { ut_ad(page && mtr); diff --git a/innobase/include/buf0buf.ic b/innobase/include/buf0buf.ic index 3d88d087e63..49f6dc59503 100644 --- a/innobase/include/buf0buf.ic +++ b/innobase/include/buf0buf.ic @@ -625,9 +625,10 @@ UNIV_INLINE void buf_page_dbg_add_level( /*===================*/ - buf_frame_t* frame, /* in: buffer page where we have acquired - a latch */ - ulint level) /* in: latching order level */ + buf_frame_t* frame __attribute__((unused)), /* in: buffer page + where we have acquired latch */ + ulint level __attribute__((unused))) /* in: latching order + level */ { #ifdef UNIV_SYNC_DEBUG sync_thread_add_level(&(buf_block_align(frame)->lock), level); diff --git a/innobase/include/dict0dict.ic b/innobase/include/dict0dict.ic index 821465f96a8..71ea67117a7 100644 --- a/innobase/include/dict0dict.ic +++ b/innobase/include/dict0dict.ic @@ -106,7 +106,7 @@ dict_table_get_n_sys_cols( /*======================*/ /* out: number of system (e.g., ROW_ID) columns of a table */ - dict_table_t* table) /* in: table */ + dict_table_t* table __attribute__((unused))) /* in: table */ { ut_ad(table); ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); diff --git a/innobase/include/ha0ha.ic b/innobase/include/ha0ha.ic index 7b4c624c653..9d344bca04c 100644 --- a/innobase/include/ha0ha.ic +++ b/innobase/include/ha0ha.ic @@ -59,7 +59,7 @@ ha_node_t* ha_chain_get_next( /*==============*/ /* out: next node, NULL if none */ - hash_table_t* table, /* in: hash table */ + hash_table_t* table __attribute__((unused)), /* in: hash table */ ha_node_t* node) /* in: hash chain node */ { ut_ad(table); diff --git a/innobase/include/row0mysql.ic b/innobase/include/row0mysql.ic index 6096e5771f7..e9d493da8b5 100644 --- a/innobase/include/row0mysql.ic +++ b/innobase/include/row0mysql.ic @@ -15,7 +15,8 @@ row_mysql_store_var_len( /*====================*/ /* out: dest + 2 */ byte* dest, /* in: where to store */ - ulint len) /* in: length, must fit in two bytes */ + ulint len __attribute__((unused))) /* in: length, must fit in two + bytes */ { ut_ad(len < 256 * 256); /* diff --git a/innobase/include/row0vers.ic b/innobase/include/row0vers.ic index aa7a7aa2299..5ece47c35d1 100644 --- a/innobase/include/row0vers.ic +++ b/innobase/include/row0vers.ic @@ -60,7 +60,7 @@ row_vers_sec_rec_may_see_older( /*===========================*/ /* out: FALSE if can be read immediately */ rec_t* rec, /* in: record which should be read or passed */ - dict_index_t* index, /* in: secondary index */ + dict_index_t* index __attribute__((unused)),/* in: secondary index */ read_view_t* view) /* in: read view */ { page_t* page; diff --git a/innobase/include/sync0rw.ic b/innobase/include/sync0rw.ic index 2a02cfb6a53..09580cfc497 100644 --- a/innobase/include/sync0rw.ic +++ b/innobase/include/sync0rw.ic @@ -126,7 +126,8 @@ rw_lock_s_lock_low( /*===============*/ /* out: TRUE if success */ rw_lock_t* lock, /* in: pointer to rw-lock */ - ulint pass, /* in: pass value; != 0, if the lock will be + ulint pass __attribute__((unused)), + /* in: pass value; != 0, if the lock will be passed to another thread to unlock */ char* file_name, /* in: file name where lock requested */ ulint line) /* in: line where requested */ diff --git a/innobase/lock/lock0lock.c b/innobase/lock/lock0lock.c index 0b2b85d0337..f2309a5c562 100644 --- a/innobase/lock/lock0lock.c +++ b/innobase/lock/lock0lock.c @@ -539,7 +539,8 @@ lock_sec_rec_cons_read_sees( index record */ rec_t* rec, /* in: user record which should be read or passed over by a read cursor */ - dict_index_t* index, /* in: non-clustered index */ + dict_index_t* index __attribute__((unused)), + /* in: non-clustered index */ read_view_t* view) /* in: consistent read view */ { dulint max_trx_id; @@ -2292,7 +2293,7 @@ list start is moved to another page. */ void lock_move_rec_list_start( /*=====================*/ - page_t* new_page, /* in: index page to move to */ + page_t* new_page __attribute__((unused)),/*in: index page to move to */ page_t* page, /* in: index page */ rec_t* rec, /* in: record on page: this is the first record NOT copied */ @@ -2736,7 +2737,7 @@ lock_deadlock_recursive( we return TRUE */ { lock_t* lock; - ulint bit_no; + ulint bit_no = 0; /* remove warning */ trx_t* lock_trx; ut_a(trx && start && wait_lock); diff --git a/innobase/mem/mem0dbg.c b/innobase/mem/mem0dbg.c index 0d71708b906..571674a506b 100644 --- a/innobase/mem/mem0dbg.c +++ b/innobase/mem/mem0dbg.c @@ -372,7 +372,8 @@ void mem_heap_validate_or_print( /*=======================*/ mem_heap_t* heap, /* in: memory heap */ - byte* top, /* in: calculate and validate only until + byte* top __attribute__((unused)), + /* in: calculate and validate only until this top pointer in the heap is reached, if this pointer is NULL, ignored */ ibool print, /* in: if TRUE, prints the contents @@ -578,7 +579,8 @@ static void mem_print_info_low( /*===============*/ - ibool print_all) /* in: if TRUE, all heaps are printed, + ibool print_all __attribute__((unused))) + /* in: if TRUE, all heaps are printed, else only the heaps allocated after the previous call of this function */ { diff --git a/innobase/mtr/mtr0mtr.c b/innobase/mtr/mtr0mtr.c index f38aa6793b9..6aa1f3509d4 100644 --- a/innobase/mtr/mtr0mtr.c +++ b/innobase/mtr/mtr0mtr.c @@ -469,7 +469,8 @@ mtr_read_ulint( /* out: value read */ byte* ptr, /* in: pointer from where to read */ ulint type, /* in: MLOG_1BYTE, MLOG_2BYTES, MLOG_4BYTES */ - mtr_t* mtr) /* in: mini-transaction handle */ + mtr_t* mtr __attribute__((unused))) + /* in: mini-transaction handle */ { ut_ad(mtr->state == MTR_ACTIVE); ut_ad(mtr_memo_contains(mtr, buf_block_align(ptr), @@ -494,8 +495,9 @@ mtr_read_dulint( /*===========*/ /* out: value read */ byte* ptr, /* in: pointer from where to read */ - ulint type, /* in: MLOG_8BYTES */ - mtr_t* mtr) /* in: mini-transaction handle */ + ulint type __attribute__((unused)), /* in: MLOG_8BYTES */ + mtr_t* mtr __attribute__((unused))) + /* in: mini-transaction handle */ { ut_ad(mtr->state == MTR_ACTIVE); ut_ad(ptr && mtr); diff --git a/innobase/odbc/odbc0odbc.c b/innobase/odbc/odbc0odbc.c index 640a88a2503..0deb17c6714 100644 --- a/innobase/odbc/odbc0odbc.c +++ b/innobase/odbc/odbc0odbc.c @@ -421,7 +421,7 @@ SQLError( } *pfNativeError = 0; - ut_memcpy(szSqlState, "S1000", 6); + ut_memcpy(szSqlState, (char *) "S1000", 6); len = (ulint)cbErrorMsgMax - 1; diff --git a/innobase/os/os0thread.c b/innobase/os/os0thread.c index 11bff73608a..49d4c8518fb 100644 --- a/innobase/os/os0thread.c +++ b/innobase/os/os0thread.c @@ -58,7 +58,8 @@ os_thread_create( #endif void* arg, /* in: argument to start function */ - os_thread_id_t* thread_id) /* out: id of created + os_thread_id_t* thread_id __attribute__((unused))) + /* out: id of created thread */ { #ifdef __WIN__ @@ -204,7 +205,8 @@ ulint os_thread_get_priority( /*===================*/ /* out: priority */ - os_thread_t handle) /* in: OS handle to the thread */ + os_thread_t handle __attribute__((unused))) + /* in: OS handle to the thread */ { #ifdef __WIN__ int os_pri; diff --git a/innobase/page/page0cur.c b/innobase/page/page0cur.c index 0b233b4dd72..85beffbcc94 100644 --- a/innobase/page/page0cur.c +++ b/innobase/page/page0cur.c @@ -510,14 +510,14 @@ page_cur_parse_insert_rec( mtr_t* mtr) /* in: mtr or NULL */ { ulint extra_info_yes; - ulint offset; + ulint offset = 0; /* remove warning */ ulint origin_offset; ulint end_seg_len; ulint mismatch_index; rec_t* cursor_rec; byte buf1[1024]; byte* buf; - ulint info_bits; + ulint info_bits = 0; /* remove warning */ page_cur_t cursor; if (!is_short) { @@ -835,9 +835,9 @@ page_copy_rec_list_end_to_created_page( rec_t* rec, /* in: first record to copy */ mtr_t* mtr) /* in: mtr */ { - page_dir_slot_t* slot; + page_dir_slot_t* slot = 0; /* remove warning */ byte* heap_top; - rec_t* insert_rec; + rec_t* insert_rec = 0; /* remove warning */ rec_t* prev_rec; ulint count; ulint n_recs; @@ -882,6 +882,7 @@ page_copy_rec_list_end_to_created_page( slot_index = 0; n_recs = 0; + /* should be do ... until, comment by Jani */ while (rec != page_get_supremum_rec(page)) { insert_rec = rec_copy(heap_top, rec); diff --git a/innobase/page/page0page.c b/innobase/page/page0page.c index a75a7279fb5..bf8af45a00a 100644 --- a/innobase/page/page0page.c +++ b/innobase/page/page0page.c @@ -210,7 +210,7 @@ page_parse_create( /*==============*/ /* out: end of log record or NULL */ byte* ptr, /* in: buffer */ - byte* end_ptr,/* in: buffer end */ + byte* end_ptr __attribute__((unused)), /* in: buffer end */ page_t* page, /* in: page or NULL */ mtr_t* mtr) /* in: mtr or NULL */ { @@ -283,7 +283,7 @@ page_create( tuple = dtuple_create(heap, 1); field = dtuple_get_nth_field(tuple, 0); - dfield_set_data(field, "infimum", strlen("infimum") + 1); + dfield_set_data(field,(char *) "infimum", strlen("infimum") + 1); dtype_set(dfield_get_type(field), DATA_VARCHAR, DATA_ENGLISH, 20, 0); /* Set the corresponding physical record to its place in the page @@ -305,7 +305,7 @@ page_create( tuple = dtuple_create(heap, 1); field = dtuple_get_nth_field(tuple, 0); - dfield_set_data(field, "supremum", strlen("supremum") + 1); + dfield_set_data(field, (char *) "supremum", strlen("supremum") + 1); dtype_set(dfield_get_type(field), DATA_VARCHAR, DATA_ENGLISH, 20, 0); supremum_rec = rec_convert_dtuple_to_rec(heap_top, tuple); diff --git a/innobase/pars/pars0opt.c b/innobase/pars/pars0opt.c index 6f4957f96ee..35d39caad00 100644 --- a/innobase/pars/pars0opt.c +++ b/innobase/pars/pars0opt.c @@ -528,7 +528,7 @@ opt_search_plan_for_table( ulint goodness; ulint last_op; ulint best_goodness; - ulint best_last_op; + ulint best_last_op = 0; /* remove warning */ ulint mix_id_pos; que_node_t* index_plan[128]; que_node_t* best_index_plan[128]; @@ -546,6 +546,7 @@ opt_search_plan_for_table( best_index = index; /* Eliminate compiler warning */ best_goodness = 0; + /* should be do ... until ? comment by Jani */ while (index) { goodness = opt_calc_index_goodness(index, sel_node, i, index_plan, &last_op); diff --git a/innobase/pars/pars0pars.c b/innobase/pars/pars0pars.c index 8ffbca579b8..664f498ef3e 100644 --- a/innobase/pars/pars0pars.c +++ b/innobase/pars/pars0pars.c @@ -1942,7 +1942,7 @@ Called by yyparse on error. */ void yyerror( /*====*/ - char* s) /* in: error message string */ + char* s __attribute__((unused))) /* in: error message string */ { ut_ad(s); diff --git a/innobase/que/que0que.c b/innobase/que/que0que.c index 96e505f8b80..b43e8ea48bc 100644 --- a/innobase/que/que0que.c +++ b/innobase/que/que0que.c @@ -393,7 +393,7 @@ graph so that the graph can communicate an error message to the client.) */ void que_fork_error_handle( /*==================*/ - trx_t* trx, /* in: trx */ + trx_t* trx __attribute__((unused)), /* in: trx */ que_t* fork) /* in: query graph which was run before signal handling started, NULL not allowed */ { @@ -1130,47 +1130,47 @@ que_node_print_info( addr = (ulint)node; if (type == QUE_NODE_SELECT) { - str = "SELECT"; + str = (char *) "SELECT"; } else if (type == QUE_NODE_INSERT) { - str = "INSERT"; + str = (char *) "INSERT"; } else if (type == QUE_NODE_UPDATE) { - str = "UPDATE"; + str = (char *) "UPDATE"; } else if (type == QUE_NODE_WHILE) { - str = "WHILE"; + str = (char *) "WHILE"; } else if (type == QUE_NODE_ASSIGNMENT) { - str = "ASSIGNMENT"; + str = (char *) "ASSIGNMENT"; } else if (type == QUE_NODE_IF) { - str = "IF"; + str = (char *) "IF"; } else if (type == QUE_NODE_FETCH) { - str = "FETCH"; + str = (char *) "FETCH"; } else if (type == QUE_NODE_OPEN) { - str = "OPEN"; + str = (char *) "OPEN"; } else if (type == QUE_NODE_PROC) { - str = "STORED PROCEDURE"; + str = (char *) "STORED PROCEDURE"; } else if (type == QUE_NODE_FUNC) { - str = "FUNCTION"; + str = (char *) "FUNCTION"; } else if (type == QUE_NODE_LOCK) { - str = "LOCK"; + str = (char *) "LOCK"; } else if (type == QUE_NODE_THR) { - str = "QUERY THREAD"; + str = (char *) "QUERY THREAD"; } else if (type == QUE_NODE_COMMIT) { - str = "COMMIT"; + str = (char *) "COMMIT"; } else if (type == QUE_NODE_UNDO) { - str = "UNDO ROW"; + str = (char *) "UNDO ROW"; } else if (type == QUE_NODE_PURGE) { - str = "PURGE ROW"; + str = (char *) "PURGE ROW"; } else if (type == QUE_NODE_ROLLBACK) { - str = "ROLLBACK"; + str = (char *) "ROLLBACK"; } else if (type == QUE_NODE_CREATE_TABLE) { - str = "CREATE TABLE"; + str = (char *) "CREATE TABLE"; } else if (type == QUE_NODE_CREATE_INDEX) { - str = "CREATE INDEX"; + str = (char *) "CREATE INDEX"; } else if (type == QUE_NODE_FOR) { - str = "FOR LOOP"; + str = (char *) "FOR LOOP"; } else if (type == QUE_NODE_RETURN) { - str = "RETURN"; + str = (char *) "RETURN"; } else { - str = "UNKNOWN NODE TYPE"; + str = (char *) "UNKNOWN NODE TYPE"; } printf("Node type %lu: %s, address %lx\n", type, str, addr); diff --git a/innobase/rem/rem0cmp.c b/innobase/rem/rem0cmp.c index f3d9d579aa0..1f2987f0182 100644 --- a/innobase/rem/rem0cmp.c +++ b/innobase/rem/rem0cmp.c @@ -79,7 +79,7 @@ ulint cmp_collate( /*========*/ /* out: collation order position */ - dtype_t* type, /* in: type */ + dtype_t* type __attribute__((unused)) , /* in: type */ ulint code) /* in: code of a character stored in database record */ { diff --git a/innobase/rem/rem0rec.c b/innobase/rem/rem0rec.c index 749e19575bc..f3b949ca06f 100644 --- a/innobase/rem/rem0rec.c +++ b/innobase/rem/rem0rec.c @@ -517,9 +517,9 @@ rec_print( ut_ad(rec); if (rec_get_1byte_offs_flag(rec)) { - offs = "TRUE"; + offs = (char *) "TRUE"; } else { - offs = "FALSE"; + offs = (char *) "FALSE"; } n = rec_get_n_fields(rec); diff --git a/innobase/row/row0ins.c b/innobase/row/row0ins.c index 2c6d3b0ed00..c5174adee37 100644 --- a/innobase/row/row0ins.c +++ b/innobase/row/row0ins.c @@ -384,7 +384,7 @@ row_ins_check_foreign_constraint( dictionary cache if they exist at all */ dict_table_t* table, /* in: if check_ref is TRUE, then the foreign table, else the referenced table */ - dict_index_t* index, /* in: index in table */ + dict_index_t* index __attribute__((unused)),/* in: index in table */ dtuple_t* entry, /* in: index entry for index */ que_thr_t* thr) /* in: query thread */ { @@ -825,7 +825,7 @@ row_ins_index_entry_low( que_thr_t* thr) /* in: query thread */ { btr_cur_t cursor; - ulint modify; + ulint modify = 0; /* remove warning */ rec_t* insert_rec; rec_t* rec; ulint err; diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c index 19d2fb744c9..45de25437e1 100644 --- a/innobase/row/row0mysql.c +++ b/innobase/row/row0mysql.c @@ -489,7 +489,7 @@ row_lock_table_autoinc_for_mysql( ut_ad(trx); ut_ad(trx->mysql_thread_id == os_thread_get_curr_id()); - trx->op_info = "setting auto-inc lock"; + trx->op_info = (char *) "setting auto-inc lock"; if (node == NULL) { row_get_prebuilt_insert_row(prebuilt); @@ -525,14 +525,14 @@ run_again: goto run_again; } - trx->op_info = ""; + trx->op_info = (char *) ""; return(err); } que_thr_stop_for_mysql_no_error(thr, trx); - trx->op_info = ""; + trx->op_info = (char *) ""; return((int) err); } @@ -569,7 +569,7 @@ row_insert_for_mysql( return(DB_ERROR); } - trx->op_info = "inserting"; + trx->op_info = (char *) "inserting"; trx_start_if_not_started(trx); @@ -610,7 +610,7 @@ run_again: goto run_again; } - trx->op_info = ""; + trx->op_info = (char *) ""; return(err); } @@ -627,7 +627,7 @@ run_again: } row_update_statistics_if_needed(prebuilt); - trx->op_info = ""; + trx->op_info = (char *) ""; return((int) err); } @@ -754,7 +754,7 @@ row_update_for_mysql( return(DB_ERROR); } - trx->op_info = "updating or deleting"; + trx->op_info = (char *) "updating or deleting"; trx_start_if_not_started(trx); @@ -831,7 +831,7 @@ run_again: if (err == DB_RECORD_NOT_FOUND) { trx->error_state = DB_SUCCESS; - trx->op_info = ""; + trx->op_info = (char *) ""; return((int) err); } @@ -842,7 +842,7 @@ run_again: goto run_again; } - trx->op_info = ""; + trx->op_info = (char *) ""; return(err); } @@ -861,7 +861,7 @@ run_again: row_update_statistics_if_needed(prebuilt); - trx->op_info = ""; + trx->op_info = (char *) ""; return((int) err); } @@ -949,17 +949,17 @@ row_create_table_for_mysql( return(DB_ERROR); } - trx->op_info = "creating table"; + trx->op_info = (char *) "creating table"; trx_start_if_not_started(trx); namelen = ut_strlen(table->name); - keywordlen = ut_strlen("innodb_monitor"); + keywordlen = ut_strlen((char *) "innodb_monitor"); if (namelen >= keywordlen && 0 == ut_memcmp(table->name + namelen - keywordlen, - "innodb_monitor", keywordlen)) { + (char *) "innodb_monitor", keywordlen)) { /* Table name ends to characters innodb_monitor: start monitor prints */ @@ -972,32 +972,34 @@ row_create_table_for_mysql( os_event_set(srv_lock_timeout_thread_event); } - keywordlen = ut_strlen("innodb_lock_monitor"); + keywordlen = ut_strlen((char *) "innodb_lock_monitor"); if (namelen >= keywordlen && 0 == ut_memcmp(table->name + namelen - keywordlen, - "innodb_lock_monitor", keywordlen)) { + (char *) "innodb_lock_monitor", keywordlen)) { srv_print_innodb_monitor = TRUE; srv_print_innodb_lock_monitor = TRUE; os_event_set(srv_lock_timeout_thread_event); } - keywordlen = ut_strlen("innodb_tablespace_monitor"); + keywordlen = ut_strlen((char *) "innodb_tablespace_monitor"); if (namelen >= keywordlen && 0 == ut_memcmp(table->name + namelen - keywordlen, - "innodb_tablespace_monitor", keywordlen)) { + (char *) "innodb_tablespace_monitor", + keywordlen)) { srv_print_innodb_tablespace_monitor = TRUE; os_event_set(srv_lock_timeout_thread_event); } - keywordlen = ut_strlen("innodb_table_monitor"); + keywordlen = ut_strlen((char *) "innodb_table_monitor"); if (namelen >= keywordlen && 0 == ut_memcmp(table->name + namelen - keywordlen, - "innodb_table_monitor", keywordlen)) { + (char *) "innodb_table_monitor", + keywordlen)) { srv_print_innodb_table_monitor = TRUE; os_event_set(srv_lock_timeout_thread_event); @@ -1057,7 +1059,7 @@ row_create_table_for_mysql( mutex_exit(&(dict_sys->mutex)); que_graph_free((que_t*) que_node_get_parent(thr)); - trx->op_info = ""; + trx->op_info = (char *) ""; return((int) err); } @@ -1081,7 +1083,7 @@ row_create_index_for_mysql( ut_ad(trx->mysql_thread_id == os_thread_get_curr_id()); - trx->op_info = "creating index"; + trx->op_info = (char *) "creating index"; trx_start_if_not_started(trx); @@ -1121,7 +1123,7 @@ row_create_index_for_mysql( que_graph_free((que_t*) que_node_get_parent(thr)); - trx->op_info = ""; + trx->op_info = (char *) ""; return((int) err); } @@ -1152,7 +1154,7 @@ row_table_add_foreign_constraints( ut_a(sql_string); - trx->op_info = "adding foreign keys"; + trx->op_info = (char *) "adding foreign keys"; trx_start_if_not_started(trx); @@ -1226,16 +1228,16 @@ row_drop_table_for_mysql( return(DB_ERROR); } - trx->op_info = "dropping table"; + trx->op_info = (char *) "dropping table"; trx_start_if_not_started(trx); namelen = ut_strlen(name); - keywordlen = ut_strlen("innodb_monitor"); + keywordlen = ut_strlen((char *) "innodb_monitor"); if (namelen >= keywordlen && 0 == ut_memcmp(name + namelen - keywordlen, - "innodb_monitor", keywordlen)) { + (char *) "innodb_monitor", keywordlen)) { /* Table name ends to characters innodb_monitor: stop monitor prints */ @@ -1244,30 +1246,33 @@ row_drop_table_for_mysql( srv_print_innodb_lock_monitor = FALSE; } - keywordlen = ut_strlen("innodb_lock_monitor"); + keywordlen = ut_strlen((char *) "innodb_lock_monitor"); if (namelen >= keywordlen && 0 == ut_memcmp(name + namelen - keywordlen, - "innodb_lock_monitor", keywordlen)) { + (char *) "innodb_lock_monitor", + keywordlen)) { srv_print_innodb_monitor = FALSE; srv_print_innodb_lock_monitor = FALSE; } - keywordlen = ut_strlen("innodb_tablespace_monitor"); + keywordlen = ut_strlen((char *) "innodb_tablespace_monitor"); if (namelen >= keywordlen && 0 == ut_memcmp(name + namelen - keywordlen, - "innodb_tablespace_monitor", keywordlen)) { + (char *) "innodb_tablespace_monitor", + keywordlen)) { srv_print_innodb_tablespace_monitor = FALSE; } - keywordlen = ut_strlen("innodb_table_monitor"); + keywordlen = ut_strlen((char *) "innodb_table_monitor"); if (namelen >= keywordlen && 0 == ut_memcmp(name + namelen - keywordlen, - "innodb_table_monitor", keywordlen)) { + (char *) "innodb_table_monitor", + keywordlen)) { srv_print_innodb_table_monitor = FALSE; } @@ -1277,7 +1282,7 @@ row_drop_table_for_mysql( tables in Innobase. Deleting a row from SYS_INDEXES table also frees the file segments of the B-tree associated with the index. */ - str1 = + str1 = (char *) "PROCEDURE DROP_TABLE_PROC () IS\n" "table_name CHAR;\n" "sys_foreign_id CHAR;\n" @@ -1288,7 +1293,7 @@ row_drop_table_for_mysql( "BEGIN\n" "table_name := '"; - str2 = + str2 = (char *) "';\n" "SELECT ID INTO table_id\n" "FROM SYS_TABLES\n" @@ -1423,7 +1428,7 @@ funct_exit: que_graph_free(graph); - trx->op_info = ""; + trx->op_info = (char *) ""; return((int) err); } @@ -1445,13 +1450,13 @@ row_drop_database_for_mysql( ut_a(name != NULL); ut_a(name[strlen(name) - 1] == '/'); - trx->op_info = "dropping database"; + trx->op_info = (char *) "dropping database"; trx_start_if_not_started(trx); mutex_enter(&(dict_sys->mutex)); - while (table_name = dict_get_first_table_name_in_db(name)) { + while ((table_name = dict_get_first_table_name_in_db(name))) { ut_a(memcmp(table_name, name, strlen(name)) == 0); err = row_drop_table_for_mysql(table_name, trx, TRUE); @@ -1470,7 +1475,7 @@ row_drop_database_for_mysql( trx_commit_for_mysql(trx); - trx->op_info = ""; + trx->op_info = (char *) ""; return(err); } @@ -1511,20 +1516,20 @@ row_rename_table_for_mysql( return(DB_ERROR); } - trx->op_info = "renaming table"; + trx->op_info = (char *) "renaming table"; trx_start_if_not_started(trx); - str1 = + str1 = (char *) "PROCEDURE RENAME_TABLE_PROC () IS\n" "new_table_name CHAR;\n" "old_table_name CHAR;\n" "BEGIN\n" "new_table_name :='"; - str2 = + str2 = (char *) "';\nold_table_name := '"; - str3 = + str3 = (char *) "';\n" "UPDATE SYS_TABLES SET NAME = new_table_name\n" "WHERE NAME = old_table_name;\n" @@ -1591,7 +1596,7 @@ funct_exit: que_graph_free(graph); - trx->op_info = ""; + trx->op_info = (char *) ""; return((int) err); } @@ -1718,7 +1723,7 @@ row_check_table_for_mysql( ulint n_rows_in_table = ULINT_UNDEFINED; ulint ret = DB_SUCCESS; - prebuilt->trx->op_info = "checking table"; + prebuilt->trx->op_info = (char *) "checking table"; index = dict_table_get_first_index(table); @@ -1751,7 +1756,7 @@ row_check_table_for_mysql( index = dict_table_get_next_index(index); } - prebuilt->trx->op_info = ""; + prebuilt->trx->op_info = (char *) ""; return(ret); } diff --git a/innobase/row/row0purge.c b/innobase/row/row0purge.c index 390f1b59a4d..1dca017c349 100644 --- a/innobase/row/row0purge.c +++ b/innobase/row/row0purge.c @@ -204,7 +204,7 @@ row_purge_remove_sec_if_poss_low( btr_pcur_t pcur; btr_cur_t* btr_cur; ibool success; - ibool old_has; + ibool old_has = 0; /* remove warning */ ibool found; ulint err; mtr_t mtr; diff --git a/innobase/row/row0sel.c b/innobase/row/row0sel.c index 2cccc217621..44cba9e3af4 100644 --- a/innobase/row/row0sel.c +++ b/innobase/row/row0sel.c @@ -64,7 +64,8 @@ row_sel_sec_rec_is_for_clust_rec( rec_t* sec_rec, /* in: secondary index record */ dict_index_t* sec_index, /* in: secondary index */ rec_t* clust_rec, /* in: clustered index record */ - dict_index_t* clust_index) /* in: clustered index */ + dict_index_t* clust_index __attribute__((unused))) + /* in: clustered index */ { dict_col_t* col; byte* sec_field; @@ -2498,7 +2499,7 @@ row_search_for_mysql( printf("N tables locked %lu\n", trx->mysql_n_tables_locked); */ if (direction == 0) { - trx->op_info = "starting index read"; + trx->op_info = (char *) "starting index read"; prebuilt->n_rows_fetched = 0; prebuilt->n_fetch_cached = 0; @@ -2509,7 +2510,7 @@ row_search_for_mysql( row_prebuild_sel_graph(prebuilt); } } else { - trx->op_info = "fetching rows"; + trx->op_info = (char *) "fetching rows"; if (prebuilt->n_rows_fetched == 0) { prebuilt->fetch_direction = direction; @@ -2534,7 +2535,7 @@ row_search_for_mysql( prebuilt->n_rows_fetched++; srv_n_rows_read++; - trx->op_info = ""; + trx->op_info = (char *) ""; return(DB_SUCCESS); } @@ -2546,7 +2547,7 @@ row_search_for_mysql( cache, but the cache was not full at the time of the popping: no more rows can exist in the result set */ - trx->op_info = ""; + trx->op_info = (char *) ""; return(DB_RECORD_NOT_FOUND); } @@ -2578,7 +2579,7 @@ row_search_for_mysql( /* printf("%s record not found 1\n", index->name); */ - trx->op_info = ""; + trx->op_info = (char *) ""; return(DB_RECORD_NOT_FOUND); } @@ -2638,7 +2639,7 @@ row_search_for_mysql( trx->has_search_latch = FALSE; } - trx->op_info = ""; + trx->op_info = (char *) ""; return(DB_SUCCESS); } else if (shortcut == SEL_EXHAUSTED) { @@ -2657,7 +2658,7 @@ row_search_for_mysql( trx->has_search_latch = FALSE; } - trx->op_info = ""; + trx->op_info = (char *) ""; return(DB_RECORD_NOT_FOUND); } @@ -3029,7 +3030,7 @@ lock_wait_or_error: /* printf("Using index %s cnt %lu ret value %lu err\n", index->name, cnt, err); */ - trx->op_info = ""; + trx->op_info = (char *) ""; return(err); @@ -3050,7 +3051,7 @@ normal_return: srv_n_rows_read++; } - trx->op_info = ""; + trx->op_info = (char *) ""; return(ret); } diff --git a/innobase/row/row0uins.c b/innobase/row/row0uins.c index 27d1fbcb9ba..9990f893432 100644 --- a/innobase/row/row0uins.c +++ b/innobase/row/row0uins.c @@ -234,7 +234,7 @@ void row_undo_ins_parse_undo_rec( /*========================*/ undo_node_t* node, /* in: row undo node */ - que_thr_t* thr) /* in: query thread */ + que_thr_t* thr __attribute__((unused))) /* in: query thread */ { dict_index_t* clust_index; byte* ptr; diff --git a/innobase/row/row0umod.c b/innobase/row/row0umod.c index 9e8ba87fc2f..631f238a72d 100644 --- a/innobase/row/row0umod.c +++ b/innobase/row/row0umod.c @@ -139,7 +139,7 @@ row_undo_mod_remove_clust_low( /* out: DB_SUCCESS, DB_FAIL, or error code: we may run out of file space */ undo_node_t* node, /* in: row undo node */ - que_thr_t* thr, /* in: query thread */ + que_thr_t* thr __attribute__((unused)), /* in: query thread */ mtr_t* mtr, /* in: mtr */ ulint mode) /* in: BTR_MODIFY_LEAF or BTR_MODIFY_TREE */ { diff --git a/innobase/row/row0upd.c b/innobase/row/row0upd.c index 435cfa3485e..31d58dd04a2 100644 --- a/innobase/row/row0upd.c +++ b/innobase/row/row0upd.c @@ -388,7 +388,7 @@ row_upd_write_sys_vals_to_log( dulint roll_ptr,/* in: roll ptr of the undo log record */ byte* log_ptr,/* pointer to a buffer of size > 20 opened in mlog */ - mtr_t* mtr) /* in: mtr */ + mtr_t* mtr __attribute__((unused))) /* in: mtr */ { ut_ad(index->type & DICT_CLUSTERED); ut_ad(mtr); diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c index a00f5c95c7c..a9de3418eb7 100644 --- a/innobase/srv/srv0srv.c +++ b/innobase/srv/srv0srv.c @@ -57,7 +57,7 @@ ulint srv_activity_count = 0; ibool srv_lock_timeout_and_monitor_active = FALSE; ibool srv_error_monitor_active = FALSE; -char* srv_main_thread_op_info = ""; +char* srv_main_thread_op_info = (char *) ""; /* Server parameters which are read from the initfile */ @@ -929,6 +929,7 @@ srv_communication_init( /************************************************************************* Implements the recovery utility. */ +#ifdef NOT_USED static ulint srv_recovery_thread( @@ -966,7 +967,7 @@ srv_recovery_thread( return(0); } - +#endif /************************************************************************* Implements the purge utility. */ @@ -1018,6 +1019,7 @@ srv_create_utility_threads(void) /************************************************************************* Implements the communication threads. */ +#ifdef NOT_USED static ulint srv_com_thread( @@ -1065,7 +1067,7 @@ srv_com_thread( return(0); } - +#endif /************************************************************************* Creates the communication threads. */ @@ -1087,6 +1089,7 @@ srv_create_com_threads(void) /************************************************************************* Implements the worker threads. */ +#ifdef NOT_USED static ulint srv_worker_thread( @@ -1129,7 +1132,7 @@ srv_worker_thread( return(0); } - +#endif /************************************************************************* Creates the worker threads. */ @@ -2283,7 +2286,7 @@ srv_master_thread( os_event_set(srv_sys->operational); loop: - srv_main_thread_op_info = "reserving kernel mutex"; + srv_main_thread_op_info = (char *) "reserving kernel mutex"; n_ios_very_old = log_sys->n_log_ios + buf_pool->n_pages_read + buf_pool->n_pages_written; @@ -2299,7 +2302,7 @@ loop: for (i = 0; i < 10; i++) { n_ios_old = log_sys->n_log_ios + buf_pool->n_pages_read + buf_pool->n_pages_written; - srv_main_thread_op_info = "sleeping"; + srv_main_thread_op_info = (char *) "sleeping"; os_thread_sleep(1000000); if (srv_force_recovery >= SRV_FORCE_NO_BACKGROUND) { @@ -2311,7 +2314,7 @@ loop: is issued or the we have specified in my.cnf no flush at transaction commit */ - srv_main_thread_op_info = "flushing log"; + srv_main_thread_op_info = (char *) "flushing log"; log_flush_up_to(ut_dulint_max, LOG_WAIT_ONE_GROUP); /* If there were less than 10 i/os during the @@ -2324,10 +2327,11 @@ loop: n_ios = log_sys->n_log_ios + buf_pool->n_pages_read + buf_pool->n_pages_written; if (n_pend_ios < 3 && (n_ios - n_ios_old < 10)) { - srv_main_thread_op_info = "doing insert buffer merge"; + srv_main_thread_op_info = + (char *) "doing insert buffer merge"; ibuf_contract_for_n_pages(TRUE, 5); - srv_main_thread_op_info = "flushing log"; + srv_main_thread_op_info = (char *) "flushing log"; log_flush_up_to(ut_dulint_max, LOG_WAIT_ONE_GROUP); } @@ -2359,20 +2363,20 @@ loop: + buf_pool->n_pages_written; if (n_pend_ios < 3 && (n_ios - n_ios_very_old < 200)) { - srv_main_thread_op_info = "flushing buffer pool pages"; + srv_main_thread_op_info =(char *) "flushing buffer pool pages"; buf_flush_batch(BUF_FLUSH_LIST, 50, ut_dulint_max); - srv_main_thread_op_info = "flushing log"; + srv_main_thread_op_info = (char *) "flushing log"; log_flush_up_to(ut_dulint_max, LOG_WAIT_ONE_GROUP); } /* We run a batch of insert buffer merge every 10 seconds, even if the server were active */ - srv_main_thread_op_info = "doing insert buffer merge"; + srv_main_thread_op_info = (char *) "doing insert buffer merge"; ibuf_contract_for_n_pages(TRUE, 5); - srv_main_thread_op_info = "flushing log"; + srv_main_thread_op_info = (char *) "flushing log"; log_flush_up_to(ut_dulint_max, LOG_WAIT_ONE_GROUP); /* We run a full purge every 10 seconds, even if the server @@ -2389,13 +2393,13 @@ loop: goto background_loop; } - srv_main_thread_op_info = "purging"; + srv_main_thread_op_info = (char *) "purging"; n_pages_purged = trx_purge(); current_time = time(NULL); if (difftime(current_time, last_flush_time) > 1) { - srv_main_thread_op_info = "flushing log"; + srv_main_thread_op_info = (char *) "flushing log"; log_flush_up_to(ut_dulint_max, LOG_WAIT_ONE_GROUP); last_flush_time = current_time; @@ -2406,7 +2410,7 @@ background_loop: /* In this loop we run background operations when the server is quiet */ - srv_main_thread_op_info = "reserving kernel mutex"; + srv_main_thread_op_info = (char *) "reserving kernel mutex"; mutex_enter(&kernel_mutex); if (srv_activity_count != old_activity_count) { @@ -2419,11 +2423,11 @@ background_loop: /* The server has been quiet for a while: start running background operations */ - srv_main_thread_op_info = "purging"; + srv_main_thread_op_info = (char *) "purging"; n_pages_purged = trx_purge(); - srv_main_thread_op_info = "reserving kernel mutex"; + srv_main_thread_op_info = (char *) "reserving kernel mutex"; mutex_enter(&kernel_mutex); if (srv_activity_count != old_activity_count) { @@ -2432,10 +2436,10 @@ background_loop: } mutex_exit(&kernel_mutex); - srv_main_thread_op_info = "doing insert buffer merge"; + srv_main_thread_op_info = (char *) "doing insert buffer merge"; n_bytes_merged = ibuf_contract_for_n_pages(TRUE, 20); - srv_main_thread_op_info = "reserving kernel mutex"; + srv_main_thread_op_info = (char *) "reserving kernel mutex"; mutex_enter(&kernel_mutex); if (srv_activity_count != old_activity_count) { @@ -2444,10 +2448,10 @@ background_loop: } mutex_exit(&kernel_mutex); - srv_main_thread_op_info = "flushing buffer pool pages"; + srv_main_thread_op_info = (char *) "flushing buffer pool pages"; n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, 100, ut_dulint_max); - srv_main_thread_op_info = "reserving kernel mutex"; + srv_main_thread_op_info = (char *) "reserving kernel mutex"; mutex_enter(&kernel_mutex); if (srv_activity_count != old_activity_count) { @@ -2456,14 +2460,15 @@ background_loop: } mutex_exit(&kernel_mutex); - srv_main_thread_op_info = "waiting for buffer pool flush to end"; + srv_main_thread_op_info = + (char *) "waiting for buffer pool flush to end"; buf_flush_wait_batch_end(BUF_FLUSH_LIST); - srv_main_thread_op_info = "making checkpoint"; + srv_main_thread_op_info = (char *) "making checkpoint"; log_checkpoint(TRUE, FALSE); - srv_main_thread_op_info = "reserving kernel mutex"; + srv_main_thread_op_info = (char *) "reserving kernel mutex"; mutex_enter(&kernel_mutex); if (srv_activity_count != old_activity_count) { @@ -2472,7 +2477,8 @@ background_loop: } mutex_exit(&kernel_mutex); - srv_main_thread_op_info = "archiving log (if log archive is on)"; + srv_main_thread_op_info = + (char *) "archiving log (if log archive is on)"; log_archive_do(FALSE, &n_bytes_archived); @@ -2496,7 +2502,7 @@ background_loop: master thread to wait for more server activity */ suspend_thread: - srv_main_thread_op_info = "suspending"; + srv_main_thread_op_info = (char *) "suspending"; mutex_enter(&kernel_mutex); @@ -2504,7 +2510,7 @@ suspend_thread: mutex_exit(&kernel_mutex); - srv_main_thread_op_info = "waiting for server activity"; + srv_main_thread_op_info = (char *) "waiting for server activity"; os_event_wait(event); diff --git a/innobase/srv/srv0start.c b/innobase/srv/srv0start.c index 7a429bdfed5..a6e11364d67 100644 --- a/innobase/srv/srv0start.c +++ b/innobase/srv/srv0start.c @@ -131,7 +131,8 @@ static void srv_normalize_path_for_win( /*=======================*/ - char* str) /* in/out: null-terminated character string */ + char* str __attribute__((unused))) + /* in/out: null-terminated character string */ { #ifdef __WIN__ ulint i; @@ -311,7 +312,8 @@ open_or_create_log_file( if (k == 0 && i == 0) { arch_space_id = 2 * k + 1 + SRV_LOG_SPACE_FIRST_ID; - fil_space_create("arch_log_space", arch_space_id, FIL_LOG); + fil_space_create((char *) "arch_log_space", arch_space_id, + FIL_LOG); } else { arch_space_id = ULINT_UNDEFINED; } @@ -509,6 +511,7 @@ open_or_create_data_files( /********************************************************************* This thread is used to measure contention of latches. */ +#ifdef NOT_USED static ulint test_measure_cont( @@ -578,7 +581,7 @@ test_measure_cont( return(0); } - +#endif /******************************************************************** Starts InnoDB and creates a new database if database files are not found and the user wants. Server parameters are @@ -610,18 +613,21 @@ innobase_start_or_create_for_mysql(void) srv_is_being_started = TRUE; srv_startup_is_before_trx_rollback_phase = TRUE; - if (0 == ut_strcmp(srv_unix_file_flush_method_str, "fdatasync")) { - srv_unix_file_flush_method = SRV_UNIX_FDATASYNC; + if (0 == ut_strcmp(srv_unix_file_flush_method_str, + (char *) "fdatasync")) { + srv_unix_file_flush_method = SRV_UNIX_FDATASYNC; - } else if (0 == ut_strcmp(srv_unix_file_flush_method_str, "O_DSYNC")) { - srv_unix_file_flush_method = SRV_UNIX_O_DSYNC; + } else if (0 == ut_strcmp(srv_unix_file_flush_method_str, + (char *) "O_DSYNC")) { + srv_unix_file_flush_method = SRV_UNIX_O_DSYNC; } else if (0 == ut_strcmp(srv_unix_file_flush_method_str, - "littlesync")) { - srv_unix_file_flush_method = SRV_UNIX_LITTLESYNC; + (char *) "littlesync")) { + srv_unix_file_flush_method = SRV_UNIX_LITTLESYNC; - } else if (0 == ut_strcmp(srv_unix_file_flush_method_str, "nosync")) { - srv_unix_file_flush_method = SRV_UNIX_NOSYNC; + } else if (0 == ut_strcmp(srv_unix_file_flush_method_str, + (char *) "nosync")) { + srv_unix_file_flush_method = SRV_UNIX_NOSYNC; } else { fprintf(stderr, "InnoDB: Unrecognized value %s for innodb_flush_method\n", diff --git a/innobase/sync/sync0arr.c b/innobase/sync/sync0arr.c index b82c2a4a2df..66d711671dd 100644 --- a/innobase/sync/sync0arr.c +++ b/innobase/sync/sync0arr.c @@ -446,7 +446,7 @@ sync_array_cell_print( { mutex_t* mutex; rw_lock_t* rwlock; - char* str = NULL; + char* str __attribute__((unused)) = NULL; ulint type; type = cell->request_type; diff --git a/innobase/sync/sync0rw.c b/innobase/sync/sync0rw.c index 1ef2920618f..86ffed7ca95 100644 --- a/innobase/sync/sync0rw.c +++ b/innobase/sync/sync0rw.c @@ -115,8 +115,8 @@ rw_lock_create_func( lock->cfile_name = cfile_name; lock->cline = cline; - lock->last_s_file_name = "not yet reserved"; - lock->last_x_file_name = "not yet reserved"; + lock->last_s_file_name = (char *) "not yet reserved"; + lock->last_x_file_name = (char *) "not yet reserved"; lock->last_s_line = 0; lock->last_x_line = 0; @@ -789,7 +789,7 @@ Prints debug info of an rw-lock. */ void rw_lock_print( /*==========*/ - rw_lock_t* lock) /* in: rw-lock */ + rw_lock_t* lock __attribute__((unused))) /* in: rw-lock */ { #ifndef UNIV_SYNC_DEBUG printf( diff --git a/innobase/sync/sync0sync.c b/innobase/sync/sync0sync.c index 8b2a39e15eb..3f40aa166ee 100644 --- a/innobase/sync/sync0sync.c +++ b/innobase/sync/sync0sync.c @@ -229,7 +229,7 @@ mutex_create_func( mutex_set_waiters(mutex, 0); mutex->magic_n = MUTEX_MAGIC_N; mutex->line = 0; - mutex->file_name = "not yet reserved"; + mutex->file_name = (char *) "not yet reserved"; mutex->thread_id = ULINT_UNDEFINED; mutex->level = SYNC_LEVEL_NONE; mutex->cfile_name = cfile_name; diff --git a/innobase/trx/trx0purge.c b/innobase/trx/trx0purge.c index a91ac135f81..31a0c20ad14 100644 --- a/innobase/trx/trx0purge.c +++ b/innobase/trx/trx0purge.c @@ -674,9 +674,9 @@ trx_purge_choose_next_log(void) trx_rseg_t* rseg; trx_rseg_t* min_rseg; dulint min_trx_no; - ulint space; - ulint page_no; - ulint offset; + ulint space = 0; /* remove warning (??? bug ???) */ + ulint page_no = 0; /* remove warning (??? bug ???) */ + ulint offset = 0; /* remove warning (??? bug ???) */ mtr_t mtr; ut_ad(mutex_own(&(purge_sys->mutex))); diff --git a/innobase/trx/trx0rec.c b/innobase/trx/trx0rec.c index abce470bd1c..05e179e06a5 100644 --- a/innobase/trx/trx0rec.c +++ b/innobase/trx/trx0rec.c @@ -989,7 +989,7 @@ trx_undo_parse_erase_page_end( /*==========================*/ /* out: end of log record or NULL */ byte* ptr, /* in: buffer */ - byte* end_ptr,/* in: buffer end */ + byte* end_ptr __attribute__((unused)), /* in: buffer end */ page_t* page, /* in: page or NULL */ mtr_t* mtr) /* in: mtr or NULL */ { @@ -1263,7 +1263,8 @@ trx_undo_prev_version_build( DB_ERROR if corrupted record */ rec_t* index_rec,/* in: clustered index record in the index tree */ - mtr_t* index_mtr,/* in: mtr which contains the latch to + mtr_t* index_mtr __attribute__((unused)), + /* in: mtr which contains the latch to index_rec page and purge_view */ rec_t* rec, /* in: version of a clustered index record */ dict_index_t* index, /* in: clustered index */ diff --git a/innobase/trx/trx0roll.c b/innobase/trx/trx0roll.c index 47fffea5e40..97cc2dbff1a 100644 --- a/innobase/trx/trx0roll.c +++ b/innobase/trx/trx0roll.c @@ -101,7 +101,7 @@ trx_rollback_for_mysql( return(DB_SUCCESS); } - trx->op_info = "rollback"; + trx->op_info = (char *) "rollback"; /* Tell Innobase server that there might be work for utility threads: */ @@ -117,7 +117,7 @@ trx_rollback_for_mysql( srv_active_wake_master_thread(); - trx->op_info = ""; + trx->op_info = (char *) ""; return(err); } @@ -138,7 +138,7 @@ trx_rollback_last_sql_stat_for_mysql( return(DB_SUCCESS); } - trx->op_info = "rollback of SQL statement"; + trx->op_info = (char *) "rollback of SQL statement"; /* Tell Innobase server that there might be work for utility threads: */ @@ -154,7 +154,7 @@ trx_rollback_last_sql_stat_for_mysql( srv_active_wake_master_thread(); - trx->op_info = ""; + trx->op_info = (char *) ""; return(err); } @@ -180,7 +180,7 @@ trx_rollback_all_without_sess(void) if (!trx_dummy_sess) { trx_dummy_sess = sess_open(NULL, (byte*)"Dummy sess", - ut_strlen("Dummy sess")); + ut_strlen((char *) "Dummy sess")); } mutex_exit(&kernel_mutex); diff --git a/innobase/trx/trx0trx.c b/innobase/trx/trx0trx.c index 18c80819245..5f696d9c01a 100644 --- a/innobase/trx/trx0trx.c +++ b/innobase/trx/trx0trx.c @@ -64,7 +64,7 @@ trx_create( trx = mem_alloc(sizeof(trx_t)); - trx->op_info = ""; + trx->op_info = (char *) ""; trx->type = TRX_USER; trx->conc_state = TRX_NOT_STARTED; @@ -135,7 +135,7 @@ trx_allocate_for_mysql(void) if (!trx_dummy_sess) { trx_dummy_sess = sess_open(NULL, (byte*)"Dummy sess", - ut_strlen("Dummy sess")); + ut_strlen((char *) "Dummy sess")); } trx = trx_create(trx_dummy_sess); @@ -991,7 +991,7 @@ trx_sig_send( ut_a(0); sess_raise_error_low(trx, 0, 0, NULL, NULL, NULL, NULL, - "Signal from another session, or a break execution signal"); + (char *) "Signal from another session, or a break execution signal"); } /* If there were no other signals ahead in the queue, try to start @@ -1292,7 +1292,7 @@ trx_commit_for_mysql( ut_a(trx); - trx->op_info = "committing"; + trx->op_info = (char *) "committing"; trx_start_if_not_started(trx); @@ -1302,7 +1302,7 @@ trx_commit_for_mysql( mutex_exit(&kernel_mutex); - trx->op_info = ""; + trx->op_info = (char *) ""; return(0); } diff --git a/innobase/trx/trx0undo.c b/innobase/trx/trx0undo.c index 8b83163bfc2..d53f8bd73de 100644 --- a/innobase/trx/trx0undo.c +++ b/innobase/trx/trx0undo.c @@ -374,7 +374,7 @@ trx_undo_seg_create( /*================*/ /* out: segment header page x-latched, NULL if no space left */ - trx_rseg_t* rseg, /* in: rollback segment */ + trx_rseg_t* rseg __attribute__((unused)),/* in: rollback segment */ trx_rsegf_t* rseg_hdr,/* in: rollback segment header, page x-latched */ ulint type, /* in: type of the segment: TRX_UNDO_INSERT or @@ -657,7 +657,7 @@ trx_undo_parse_discard_latest( /*==========================*/ /* out: end of log record or NULL */ byte* ptr, /* in: buffer */ - byte* end_ptr,/* in: buffer end */ + byte* end_ptr __attribute__((unused)), /* in: buffer end */ page_t* page, /* in: page or NULL */ mtr_t* mtr) /* in: mtr or NULL */ { @@ -844,7 +844,7 @@ static void trx_undo_free_page_in_rollback( /*===========================*/ - trx_t* trx, /* in: transaction */ + trx_t* trx __attribute__((unused)), /* in: transaction */ trx_undo_t* undo, /* in: undo log memory copy */ ulint page_no,/* in: page number to free: must not be the header page */ @@ -1560,7 +1560,7 @@ trx_undo_set_state_at_finish( /*=========================*/ /* out: undo log segment header page, x-latched */ - trx_t* trx, /* in: transaction */ + trx_t* trx __attribute__((unused)), /* in: transaction */ trx_undo_t* undo, /* in: undo log memory copy */ mtr_t* mtr) /* in: mtr */ { diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 3a76998b655..02921480abd 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -1712,7 +1712,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, charset_name=charset_name_buff; sprintf(charset_name,"%d",mysql->server_language); /* In case of errors */ if (!(mysql->charset = - get_charset((uint8) mysql->server_language, MYF(MY_WME)))) + get_charset((uint8) mysql->server_language, MYF(0)))) mysql->charset = default_charset_info; /* shouldn't be fatal */ } diff --git a/myisam/ft_boolean_search.c b/myisam/ft_boolean_search.c index b8417152909..bda76cb09a8 100644 --- a/myisam/ft_boolean_search.c +++ b/myisam/ft_boolean_search.c @@ -16,6 +16,8 @@ /* Written by Sergei A. Golubchik, who has a shared copyright to this code */ +/* TODO: add caching - pre-read several index entries at once */ + #define FT_CORE #include "ftdefs.h" #include <queues.h> @@ -78,7 +80,7 @@ typedef struct st_ft_info { struct _ft_vft *please; MI_INFO *info; uint keynr; - int ok; + enum { UNINITIALIZED, READY, INDEX_SEARCH, INDEX_DONE, SCAN } state; FTB_EXPR *root; QUEUE queue; MEM_ROOT mem_root; @@ -101,13 +103,9 @@ void _ftb_parse_query(FTB *ftb, byte **start, byte *end, FT_WORD w; FTB_WORD *ftbw; FTB_EXPR *ftbe; - MI_INFO *info=ftb->info; - int r; - MI_KEYDEF *keyinfo=info->s->keyinfo+ftb->keynr; - my_off_t keyroot=info->s->state.key_root[ftb->keynr]; - uint extra=HA_FT_WLEN+info->s->rec_reflength; /* just a shortcut */ + uint extra=HA_FT_WLEN+ftb->info->s->rec_reflength; /* just a shortcut */ - if (! ftb->ok) + if (ftb->state != UNINITIALIZED) return; param.prev=' '; @@ -132,7 +130,7 @@ void _ftb_parse_query(FTB *ftb, byte **start, byte *end, case 1: ftbw=(FTB_WORD *)alloc_root(&ftb->mem_root, sizeof(FTB_WORD) + (param.trunc ? MI_MAX_KEY_BUFF : w.len+extra)); - ftbw->len=w.len + !param.trunc; + ftbw->len=w.len+1; ftbw->yesno=param.yesno; ftbw->trunc=param.trunc; /* 0 or 1 */ ftbw->weight=weight; @@ -142,37 +140,55 @@ void _ftb_parse_query(FTB *ftb, byte **start, byte *end, memcpy(ftbw->word+1, w.pos, w.len); ftbw->word[0]=w.len; if (ftbw->yesno > 0) up->ythresh++; - /*****************************************/ - r=_mi_search(info, keyinfo, ftbw->word, ftbw->len, - SEARCH_FIND | SEARCH_PREFIX, keyroot); - if (!r) - { - r=_mi_compare_text(default_charset_info, - info->lastkey+ftbw->trunc,ftbw->len, - ftbw->word+ftbw->trunc,ftbw->len,0); - } - if (r) /* not found */ - { - if (ftbw->yesno>0 && ftbw->up->up==0) - { /* this word MUST BE present in every document returned, - so we can abort the search right now */ - ftb->ok=0; - return; - } - } - else - { - memcpy(ftbw->word, info->lastkey, info->lastkey_length); - ftbw->docid=info->lastpos; - queue_insert(& ftb->queue, (byte *)ftbw); - } - /*****************************************/ + queue_insert(& ftb->queue, (byte *)ftbw); break; } } return; } +void _ftb_init_index_search(FT_INFO *ftb) +{ + int i, r; + FTB_WORD *ftbw; + MI_INFO *info=ftb->info; + MI_KEYDEF *keyinfo=info->s->keyinfo+ftb->keynr; + my_off_t keyroot=info->s->state.key_root[ftb->keynr]; + + if (ftb->state != READY) + return; + ftb->state=INDEX_SEARCH; + + for (i=ftb->queue.elements; i; i--) + { + ftbw=(FTB_WORD *)(ftb->queue.root[i]); + + r=_mi_search(info, keyinfo, ftbw->word, ftbw->len, + SEARCH_FIND | SEARCH_PREFIX, keyroot); + if (!r) + { + r=_mi_compare_text(default_charset_info, + info->lastkey+ftbw->trunc,ftbw->len-ftbw->trunc, + ftbw->word+ftbw->trunc,ftbw->len-ftbw->trunc,0); + } + if (r) /* not found */ + { + if (ftbw->yesno>0 && ftbw->up->up==0) + { /* this word MUST BE present in every document returned, + so we can abort the search right now */ + ftb->state=INDEX_DONE; + return; + } + } + else + { + memcpy(ftbw->word, info->lastkey, info->lastkey_length); + ftbw->docid=info->lastpos; + } + } + queue_fix(& ftb->queue); +} + FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query, uint query_len, my_bool presort __attribute__((unused))) { @@ -183,7 +199,7 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query, if (!(ftb=(FTB *)my_malloc(sizeof(FTB), MYF(MY_WME)))) return 0; ftb->please= (struct _ft_vft *) & _ft_vft_boolean; - ftb->ok=1; + ftb->state=UNINITIALIZED; ftb->info=info; ftb->keynr=keynr; @@ -202,9 +218,63 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query, ftbe->docid=HA_POS_ERROR; ftb->root=ftbe; _ftb_parse_query(ftb, &query, query+query_len, ftbe, 0, 0); + ftb->state=READY; return ftb; } +void _ftb_climb_the_tree(FTB_WORD *ftbw, my_off_t curdoc) +{ + FTB_EXPR *ftbe; + float weight=ftbw->weight; + int yn=ftbw->yesno; + + for (ftbe=ftbw->up; ftbe; ftbe=ftbe->up) + { + if (ftbe->docid != curdoc) + { + ftbe->cur_weight=ftbe->yesses=ftbe->nos=0; + ftbe->docid=curdoc; + } + if (yn>0) + { + ftbe->cur_weight+=weight; + if (++ftbe->yesses >= ftbe->ythresh && !ftbe->nos) + { + yn=ftbe->yesno; + weight=ftbe->cur_weight*ftbe->weight; + } + else + break; + } + else + if (yn<0) + { + /* NOTE: special sort function of queue assures that all yn<0 + * events for every particular subexpression will + * "auto-magically" happen BEFORE all yn>=0 events. So no + * already matched expression can become not-matched again. + */ + ++ftbe->nos; + break; + } + else + /* if (yn==0) */ + { + if (ftbe->yesses >= ftbe->ythresh && !ftbe->nos) + { + yn=ftbe->yesno; + ftbe->cur_weight=weight; + weight*=ftbe->weight; + } + else + { + ftbe->cur_weight+=weight; + break; + } + } + } +} + int ft_boolean_read_next(FT_INFO *ftb, char *record) { FTB_EXPR *ftbe, *up; @@ -215,6 +285,9 @@ int ft_boolean_read_next(FT_INFO *ftb, char *record) my_off_t curdoc; int r; + if (ftb->state != INDEX_SEARCH && ftb->state != INDEX_DONE) + return -1; + /* black magic ON */ if ((int) _mi_check_index(info, ftb->keynr) < 0) return my_errno; @@ -225,66 +298,21 @@ int ft_boolean_read_next(FT_INFO *ftb, char *record) if (!ftb->queue.elements) return my_errno=HA_ERR_END_OF_FILE; - while(ftb->ok && + while(ftb->state == INDEX_SEARCH && (curdoc=((FTB_WORD *)queue_top(& ftb->queue))->docid) != HA_POS_ERROR) { while (curdoc==(ftbw=(FTB_WORD *)queue_top(& ftb->queue))->docid) { - float weight=ftbw->weight; - int yn=ftbw->yesno; - for (ftbe=ftbw->up; ftbe; ftbe=ftbe->up) - { - if (ftbe->docid != curdoc) - { - ftbe->cur_weight=ftbe->yesses=ftbe->nos=0; - ftbe->docid=curdoc; - } - if (yn>0) - { - ftbe->cur_weight+=weight; - if (++ftbe->yesses >= ftbe->ythresh && !ftbe->nos) - { - yn=ftbe->yesno; - weight=ftbe->cur_weight*ftbe->weight; - } - else - break; - } - else - if (yn<0) - { - /* NOTE: special sort function of queue assures that all yn<0 - * events for every particular subexpression will - * "auto-magically" happen BEFORE all yn>=0 events. So no - * already matched expression can become not-matched again. - */ - ++ftbe->nos; - break; - } - else - /* if (yn==0) */ - { - if (ftbe->yesses >= ftbe->ythresh && !ftbe->nos) - { - yn=ftbe->yesno; - ftbe->cur_weight=weight; - weight*=ftbe->weight; - } - else - { - ftbe->cur_weight+=weight; - break; - } - } - } + _ftb_climb_the_tree(ftbw, curdoc); + /* update queue */ - r=_mi_search(info, keyinfo, ftbw->word, USE_WHOLE_KEY, /*ftbw->len,*/ + r=_mi_search(info, keyinfo, ftbw->word, USE_WHOLE_KEY, SEARCH_BIGGER , keyroot); if (!r) { r=_mi_compare_text(default_charset_info, - info->lastkey+ftbw->trunc,ftbw->len, - ftbw->word+ftbw->trunc,ftbw->len,0); + info->lastkey+ftbw->trunc,ftbw->len-ftbw->trunc, + ftbw->word+ftbw->trunc,ftbw->len-ftbw->trunc,0); } if (r) /* not found */ { @@ -292,7 +320,7 @@ int ft_boolean_read_next(FT_INFO *ftb, char *record) if (ftbw->yesno>0 && ftbw->up->up==0) { /* this word MUST BE present in every document returned, so we can stop the search right now */ - ftb->ok=0; + ftb->state=INDEX_DONE; } } else @@ -304,7 +332,8 @@ int ft_boolean_read_next(FT_INFO *ftb, char *record) } ftbe=ftb->root; - if (ftbe->cur_weight>0 && ftbe->yesses>=ftbe->ythresh && !ftbe->nos) + if (ftbe->docid==curdoc && ftbe->cur_weight>0 && + ftbe->yesses>=ftbe->ythresh && !ftbe->nos) { /* curdoc matched ! */ info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED); /* why is this ? */ @@ -321,10 +350,56 @@ int ft_boolean_read_next(FT_INFO *ftb, char *record) return my_errno=HA_ERR_END_OF_FILE; } -float ft_boolean_find_relevance(FT_INFO *ftb, - my_off_t docid __attribute__((unused)), byte *record) +float ft_boolean_find_relevance(FT_INFO *ftb, my_off_t docid, byte *record) { - return -1.0; /* to be done via str scan */ + TREE ptree; + FT_WORD word; + FTB_WORD *ftbw; + FTB_EXPR *ftbe; + uint i; + + if (ftb->state == READY) + { + queue_fix(& ftb->queue); + ftb->state=SCAN; + } + else if (ftb->state != SCAN) + return -1.0; + + bzero(&ptree, sizeof(ptree)); + if (_mi_ft_parse(& ptree, ftb->info, ftb->keynr, record)) + return -1.0; + + for (i=1; i<=ftb->queue.elements; i++) + { + ftbw=(FTB_WORD *)(ftb->queue.root[i]); + ptree.custom_arg=(void *)(ftbw->trunc); + word.pos=ftbw->word+1; + word.len=ftbw->len-1; + if (tree_search(& ptree, & word)) + { /* found! */ + _ftb_climb_the_tree(ftbw, docid); + } + else + { /* not found! */ + if (ftbw->yesno>0 && ftbw->up->up==0) + { /* but this word MUST BE present in every document matched, + so we can stop the search right now */ + break; + } + } + } + delete_tree(& ptree); + ftbe=ftb->root; + if (ftbe->docid==docid && ftbe->cur_weight>0 && + ftbe->yesses>=ftbe->ythresh && !ftbe->nos) + { /* row matched ! */ + return ftbe->cur_weight; + } + else + { /* match failed ! */ + return 0.0; + } } void ft_boolean_close_search(FT_INFO *ftb) @@ -338,13 +413,8 @@ float ft_boolean_get_relevance(FT_INFO *ftb) return ftb->root->cur_weight; } -my_off_t ft_boolean_get_docid(FT_INFO *ftb) -{ - return HA_POS_ERROR; -} - void ft_boolean_reinit_search(FT_INFO *ftb) { - fprintf(stderr, "ft_boolean_reinit_search called!\n"); + _ftb_init_index_search(ftb); } diff --git a/myisam/ft_nlq_search.c b/myisam/ft_nlq_search.c index a806361fc0a..75249a1432a 100644 --- a/myisam/ft_nlq_search.c +++ b/myisam/ft_nlq_search.c @@ -278,11 +278,6 @@ float ft_nlq_get_relevance(FT_INFO *handler) return handler->doc[handler->curdoc].weight; } -my_off_t ft_nlq_get_docid(FT_INFO *handler) -{ - return handler->doc[handler->curdoc].dpos; -} - void ft_nlq_reinit_search(FT_INFO *handler) { handler->curdoc=-1; diff --git a/myisam/ft_parser.c b/myisam/ft_parser.c index 466f1dfe021..def49d17b74 100644 --- a/myisam/ft_parser.c +++ b/myisam/ft_parser.c @@ -33,17 +33,16 @@ typedef struct st_ft_docstat { double max, nsum, nsum2; #endif /* EVAL_RUN */ - MI_INFO *info; - uint keynr; - byte *keybuf; +// MI_INFO *info; +// uint keynr; +// byte *keybuf; } FT_DOCSTAT; -static int FT_WORD_cmp(void* cmp_arg __attribute__((unused)), - FT_WORD *w1, FT_WORD *w2) +static int FT_WORD_cmp(void* cmp_arg, FT_WORD *w1, FT_WORD *w2) { return _mi_compare_text(default_charset_info, (uchar*) w1->pos,w1->len, - (uchar*) w2->pos, w2->len,0); + (uchar*) w2->pos, w2->len,(my_bool)cmp_arg); } static int walk_and_copy(FT_WORD *word,uint32 count,FT_DOCSTAT *docstat) @@ -64,7 +63,9 @@ static int walk_and_copy(FT_WORD *word,uint32 count,FT_DOCSTAT *docstat) /* transforms tree of words into the array, applying normalization */ -FT_WORD * ft_linearize(MI_INFO *info, uint keynr, byte *keybuf, TREE *wtree) +FT_WORD * ft_linearize(//MI_INFO *info, uint keynr, + //byte *keybuf, + TREE *wtree) { FT_WORD *wlist,*p; FT_DOCSTAT docstat; @@ -73,9 +74,9 @@ FT_WORD * ft_linearize(MI_INFO *info, uint keynr, byte *keybuf, TREE *wtree) if ((wlist=(FT_WORD *) my_malloc(sizeof(FT_WORD)* (1+wtree->elements_in_tree),MYF(0)))) { - docstat.info=info; - docstat.keynr=keynr; - docstat.keybuf=keybuf; +// docstat.info=info; +// docstat.keynr=keynr; +// docstat.keybuf=keybuf; docstat.list=wlist; docstat.uniq=wtree->elements_in_tree; #ifdef EVAL_RUN @@ -207,19 +208,6 @@ byte ft_simple_get_word(byte **start, byte *end, FT_WORD *word) return 0; } -int is_boolean(byte *q, uint len) -{ - if (!len) return 0; - if (*q == FTB_YES || *q == FTB_NO) return 1; - - for (++q; --len; ++q) - { - if ((*q == FTB_YES || *q == FTB_NO) && q[-1] == ' ' && true_word_char(q[1])) - return 1; - } - return 0; -} - TREE * ft_parse(TREE *wtree, byte *doc, int doclen) { byte *end=doc+doclen; diff --git a/myisam/ft_static.c b/myisam/ft_static.c index c9666ea5a65..2bf10c72414 100644 --- a/myisam/ft_static.c +++ b/myisam/ft_static.c @@ -49,11 +49,11 @@ const MI_KEYSEG ft_keysegs[FT_SEGS]={ const struct _ft_vft _ft_vft_nlq = { ft_nlq_read_next, ft_nlq_find_relevance, ft_nlq_close_search, - ft_nlq_get_relevance, ft_nlq_get_docid, ft_nlq_reinit_search + ft_nlq_get_relevance, ft_nlq_reinit_search }; const struct _ft_vft _ft_vft_boolean = { ft_boolean_read_next, ft_boolean_find_relevance, ft_boolean_close_search, - ft_boolean_get_relevance, ft_boolean_get_docid, ft_boolean_reinit_search + ft_boolean_get_relevance, ft_boolean_reinit_search }; FT_INFO *(*_ft_init_vft[2])(MI_INFO *, uint, byte *, uint, my_bool) = diff --git a/myisam/ft_update.c b/myisam/ft_update.c index 1e53b2d7775..89da06e673f 100644 --- a/myisam/ft_update.c +++ b/myisam/ft_update.c @@ -29,17 +29,12 @@ /* parses a document i.e. calls _mi_ft_parse for every keyseg */ -FT_WORD * _mi_ft_parserecord(MI_INFO *info, uint keynr, byte *keybuf, - const byte *record) +uint _mi_ft_parse(TREE *parsed, MI_INFO *info, uint keynr, const byte *record) { - TREE *parsed, ptree; - MI_KEYSEG *keyseg; byte *pos; uint i; + MI_KEYSEG *keyseg=info->s->keyinfo[keynr].seg; - bzero(parsed=&ptree, sizeof(ptree)); - - keyseg=info->s->keyinfo[keynr].seg; for (i=info->s->keyinfo[keynr].keysegs-FT_SEGS ; i-- ; ) { uint len; @@ -62,13 +57,26 @@ FT_WORD * _mi_ft_parserecord(MI_INFO *info, uint keynr, byte *keybuf, } else len=keyseg->length; - if (!(parsed=ft_parse(parsed, pos, len))) - return NULL; + if (!(ft_parse(parsed, pos, len))) + return 1; } /* Handle the case where all columns are NULL */ - if (!is_tree_inited(parsed) && !(parsed=ft_parse(parsed, (byte*) "", 0))) + if (!is_tree_inited(parsed) && !(ft_parse(parsed, (byte*) "", 0))) + return 1; + else + return 0; +} + +FT_WORD * _mi_ft_parserecord(MI_INFO *info, uint keynr, byte *keybuf, + const byte *record) +{ + TREE ptree; + + bzero(&ptree, sizeof(ptree)); + if (_mi_ft_parse(& ptree, info, keynr, record)) return NULL; - return ft_linearize(info, keynr, keybuf, parsed); + + return ft_linearize(/*info, keynr, keybuf, */ & ptree); } static int _mi_ft_store(MI_INFO *info, uint keynr, byte *keybuf, @@ -158,7 +166,7 @@ int _mi_ft_cmp(MI_INFO *info, uint keynr, const byte *rec1, const byte *rec2) } /* update a document entry */ -int _mi_ft_update(MI_INFO *info, uint keynr, byte *keybuf, +int _mi_ft_update(MI_INFO *info, uint keynr, byte *keybuf, const byte *oldrec, const byte *newrec, my_off_t pos) { int error= -1; diff --git a/myisam/ftdefs.h b/myisam/ftdefs.h index 0d5aaf931e3..112540a13b5 100644 --- a/myisam/ftdefs.h +++ b/myisam/ftdefs.h @@ -120,8 +120,8 @@ byte ft_get_word(byte **, byte *, FT_WORD *, FTB_PARAM *); byte ft_simple_get_word(byte **, byte *, FT_WORD *); TREE * ft_parse(TREE *, byte *, int); -FT_WORD * ft_linearize(MI_INFO *, uint, byte *, TREE *); -FT_WORD * _mi_ft_parserecord(MI_INFO *, uint , byte *, const byte *); +FT_WORD * ft_linearize(/*MI_INFO *, uint, byte *, */TREE *); +FT_WORD * _mi_ft_parserecord(MI_INFO *, uint, byte *, const byte *); const struct _ft_vft _ft_vft_nlq; FT_INFO *ft_init_nlq_search(MI_INFO *, uint, byte *, uint, my_bool); diff --git a/mysql-test/r/fulltext_cache.result b/mysql-test/r/fulltext_cache.result index 29395520791..c489bdefeb8 100644 --- a/mysql-test/r/fulltext_cache.result +++ b/mysql-test/r/fulltext_cache.result @@ -21,8 +21,8 @@ INSERT INTO t2 VALUES (5,2,'um copo de Vodka'); INSERT INTO t2 VALUES (6,2,'um chocolate Snickers'); INSERT INTO t2 VALUES (7,1,'Bife'); INSERT INTO t2 VALUES (8,1,'Pizza de Salmao'); -SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi') as x FROM t1, t2 -WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id; +SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi') +as x FROM t1, t2 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id; q item id x aaaaaaaaa dsaass de sushi 1 1.92378664016724 aaaaaaaaa dsaass de Bolo de Chocolate 2 0 @@ -32,8 +32,19 @@ ssde df s fsda sad er um copo de Vodka 5 0 ssde df s fsda sad er um chocolate Snickers 6 0 aaaaaaaaa dsaass de Bife 7 0 aaaaaaaaa dsaass de Pizza de Salmao 8 0 -SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi') as x FROM t2, t1 -WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id; +SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi' IN BOOLEAN MODE) +as x FROM t1, t2 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id; +q item id x +aaaaaaaaa dsaass de sushi 1 1 +aaaaaaaaa dsaass de Bolo de Chocolate 2 0 +aaaaaaaaa dsaass de Feijoada 3 0 +aaaaaaaaa dsaass de Mousse de Chocolate 4 0 +ssde df s fsda sad er um copo de Vodka 5 0 +ssde df s fsda sad er um chocolate Snickers 6 0 +aaaaaaaaa dsaass de Bife 7 0 +aaaaaaaaa dsaass de Pizza de Salmao 8 0 +SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi') +as x FROM t2, t1 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id; q item id x aaaaaaaaa dsaass de sushi 1 1.92378664016724 aaaaaaaaa dsaass de Bolo de Chocolate 2 0 @@ -43,4 +54,15 @@ ssde df s fsda sad er um copo de Vodka 5 0 ssde df s fsda sad er um chocolate Snickers 6 0 aaaaaaaaa dsaass de Bife 7 0 aaaaaaaaa dsaass de Pizza de Salmao 8 0 +SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi' IN BOOLEAN MODE) +as x FROM t2, t1 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id; +q item id x +aaaaaaaaa dsaass de sushi 1 1 +aaaaaaaaa dsaass de Bolo de Chocolate 2 0 +aaaaaaaaa dsaass de Feijoada 3 0 +aaaaaaaaa dsaass de Mousse de Chocolate 4 0 +ssde df s fsda sad er um copo de Vodka 5 0 +ssde df s fsda sad er um chocolate Snickers 6 0 +aaaaaaaaa dsaass de Bife 7 0 +aaaaaaaaa dsaass de Pizza de Salmao 8 0 drop table t1, t2; diff --git a/mysql-test/t/fulltext_cache.test b/mysql-test/t/fulltext_cache.test index fc5f0e266b3..0b15e57a97b 100644 --- a/mysql-test/t/fulltext_cache.test +++ b/mysql-test/t/fulltext_cache.test @@ -26,10 +26,16 @@ INSERT INTO t2 VALUES (6,2,'um chocolate Snickers'); INSERT INTO t2 VALUES (7,1,'Bife'); INSERT INTO t2 VALUES (8,1,'Pizza de Salmao'); -SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi') as x FROM t1, t2 -WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id; +SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi') +as x FROM t1, t2 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id; -SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi') as x FROM t2, t1 -WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id; +SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi' IN BOOLEAN MODE) +as x FROM t1, t2 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id; + +SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi') +as x FROM t2, t1 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id; + +SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi' IN BOOLEAN MODE) +as x FROM t2, t1 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id; drop table t1, t2; diff --git a/mysys/charset.c b/mysys/charset.c index 47eaf3587d5..70f3f2902f1 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -296,7 +296,7 @@ static CHARSET_INFO *find_charset_by_name(CHARSET_INFO **table, return NULL; } -static CHARSET_INFO *add_charset(uint cs_number, const char *cs_name) +static CHARSET_INFO *add_charset(uint cs_number, const char *cs_name, myf flags) { CHARSET_INFO tmp_cs,*cs; uchar tmp_ctype[CTYPE_TABLE_SIZE]; @@ -311,11 +311,11 @@ static CHARSET_INFO *add_charset(uint cs_number, const char *cs_name) cs->to_lower=tmp_to_lower; cs->to_upper=tmp_to_upper; cs->sort_order=tmp_sort_order; - if (read_charset_file(cs_number, cs, MYF(MY_WME))) + if (read_charset_file(cs_number, cs, flags)) return NULL; cs = (CHARSET_INFO*) my_once_alloc(sizeof(CHARSET_INFO), - MYF(MY_WME)); + MYF(MY_WME)); *cs=tmp_cs; cs->name = (char *) my_once_alloc((uint) strlen(cs_name)+1, MYF(MY_WME)); cs->ctype = (uchar*) my_once_alloc(CTYPE_TABLE_SIZE, MYF(MY_WME)); @@ -333,7 +333,7 @@ static CHARSET_INFO *add_charset(uint cs_number, const char *cs_name) return cs; } -static CHARSET_INFO *get_internal_charset(uint cs_number) +static CHARSET_INFO *get_internal_charset(uint cs_number, myf flags) { CHARSET_INFO *cs; /* @@ -344,13 +344,13 @@ static CHARSET_INFO *get_internal_charset(uint cs_number) if (!(cs = find_charset((CHARSET_INFO**) cs_info_table.buffer, cs_number, cs_info_table.elements))) if (!(cs = find_compiled_charset(cs_number))) - cs=add_charset(cs_number, get_charset_name(cs_number)); + cs=add_charset(cs_number, get_charset_name(cs_number), flags); pthread_mutex_unlock(&THR_LOCK_charset); return cs; } -static CHARSET_INFO *get_internal_charset_by_name(const char *name) +static CHARSET_INFO *get_internal_charset_by_name(const char *name, myf flags) { CHARSET_INFO *cs; /* @@ -361,7 +361,7 @@ static CHARSET_INFO *get_internal_charset_by_name(const char *name) if (!(cs = find_charset_by_name((CHARSET_INFO**) cs_info_table.buffer, name, cs_info_table.elements))) if (!(cs = find_compiled_charset_by_name(name))) - cs=add_charset(get_charset_number(name), name); + cs=add_charset(get_charset_number(name), name, flags); pthread_mutex_unlock(&THR_LOCK_charset); return cs; } @@ -371,7 +371,7 @@ CHARSET_INFO *get_charset(uint cs_number, myf flags) { CHARSET_INFO *cs; (void) init_available_charsets(MYF(0)); /* If it isn't initialized */ - cs=get_internal_charset(cs_number); + cs=get_internal_charset(cs_number, flags); if (!cs && (flags & MY_WME)) { @@ -403,7 +403,7 @@ CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags) { CHARSET_INFO *cs; (void) init_available_charsets(MYF(0)); /* If it isn't initialized */ - cs=get_internal_charset_by_name(cs_name); + cs=get_internal_charset_by_name(cs_name, flags); if (!cs && (flags & MY_WME)) { diff --git a/mysys/queues.c b/mysys/queues.c index 1c7a1a4a618..3deee86c23a 100644 --- a/mysys/queues.c +++ b/mysys/queues.c @@ -124,7 +124,6 @@ byte *queue_remove(register QUEUE *queue, uint idx) } } - /* Fix when element on top has been replaced */ #ifndef queue_replaced @@ -166,3 +165,19 @@ void _downheap(register QUEUE *queue, uint idx) } queue->root[idx]=element; } + + +static int queue_fix_cmp(QUEUE *queue, void *a, void *b) +{ + return queue->compare(queue->first_cmp_arg, + a+queue->offset_to_key, + b+queue->offset_to_key); +} + + /* Fix heap when every element was changed */ +void queue_fix(QUEUE *queue) +{ + qsort2(queue->root+1,queue->elements, sizeof(void *), + (qsort2_cmp)queue_fix_cmp, queue); +} + diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 6413170198d..b0da0892ea3 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -30,6 +30,9 @@ #ifdef HAVE_CRYPT_H #include <crypt.h> #endif +#ifdef HAVE_OPENSSL +#include <openssl/des.h> +#endif /* HAVE_OPENSSL */ #include "md5.h" String empty_string(""); @@ -198,6 +201,135 @@ void Item_func_concat::fix_length_and_dec() } } +#define bin_to_ascii(c) ((c)>=38?((c)-38+'a'):(c)>=12?((c)-12+'A'):(c)+'.') + +String *Item_func_des_encrypt::val_str(String *str) +{ + String *res =args[0]->val_str(str); + +#ifdef HAVE_OPENSSL + des_key_schedule ks1, ks2, ks3; + des_cblock ivec={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + union { + des_cblock allkeys[3]; + des_cblock key1; + des_cblock key2; + des_cblock key3; + } key; + + + + if ((null_value=args[0]->null_value)) + return 0; + if (res->length() == 0) + return &empty_string; + String *in_str=args[1]->val_str(&tmp_value); + char *tmp=my_malloc(res->length()+8, MYF(0)); + DBUG_PRINT("info",("DES: key string='%s'",in_str->c_ptr())); + DBUG_PRINT("info",("DES: data string='%s'",res->c_ptr())); + DBUG_PRINT("info",("DES: cipher pointer='%x'",EVP_get_cipherbyname("DES-EDE3-CBC"))); + EVP_BytesToKey(EVP_get_cipherbyname("DES-EDE3-CBC"),EVP_md5(),NULL, + (unsigned char *)in_str->c_ptr(), + in_str->length(),1,(uchar *)&key.allkeys,ivec); + des_set_key_unchecked(&key.key1,ks1); + des_set_key_unchecked(&key.key2,ks2); + des_set_key_unchecked(&key.key3,ks3); + DBUG_PRINT("info",("DES: checkpoint")); + des_ede3_cbc_encrypt( + (const unsigned char*)(res->c_ptr()) , + (uchar*)tmp, + res->length(), + ks1, ks2, ks3, &ivec, TRUE); + res->length(res->length()+8-(res->length() % 8)); + DBUG_PRINT("info",("DES: checkpoint")); + DBUG_PRINT("info",("DES: string length='%d' versus '%d'",res->length(),strlen(res->c_ptr()))); + DBUG_PRINT("info",("DES: crypted data string='%s'",tmp)); + str->set((const char*)0,(uint)0); + for(uint i=0 ; i < res->length() ; ++i) + { + str->append(tmp[i]); +// str->append(bin_to_ascii(tmp[i] & 0x3f)); +// str->append(bin_to_ascii((tmp[i] >> 5) & 0x3f)); + } + DBUG_PRINT("info",("DES: crypted data plain string='%s'",str->c_ptr())); + str->copy(); + DBUG_PRINT("info",("DES: crypted data plain string='%s'",str->c_ptr())); + my_free(tmp,MYF(0)); + return str; +#else + null_value=1; + return 0; +#endif /* HAVE_OPENSSL */ +} + + +String *Item_func_des_decrypt::val_str(String *str) +{ + String *res =args[0]->val_str(str); + +#ifdef HAVE_OPENSSL + des_key_schedule ks1, ks2, ks3; + des_cblock ivec={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + union { + des_cblock allkeys[3]; + des_cblock key1; + des_cblock key2; + des_cblock key3; + } key; + + + if ((null_value=args[0]->null_value)) + return 0; + if (res->length() == 0) + return &empty_string; + String *in_str=args[1]->val_str(&tmp_value); + char *tmp=my_malloc(res->length()+8, MYF(0)); + DBUG_PRINT("info",("DES: key string='%s'",in_str->c_ptr())); + DBUG_PRINT("info",("DES: data string='%s'",res->c_ptr())); +/* int EVP_BytesToKey(const EVP_CIPHER *type, EVP_MD *md, + const unsigned char *salt, const unsigned char *data, int datal, + int count, unsigned char *key, unsigned char *iv) +*/ + EVP_BytesToKey(EVP_get_cipherbyname("DES-EDE3-CBC"),EVP_md5(),NULL, + (unsigned char *)in_str->c_ptr(), + in_str->length(),1,(uchar *)&key.allkeys,ivec); + des_set_key_unchecked(&key.key1,ks1); + des_set_key_unchecked(&key.key2,ks2); + des_set_key_unchecked(&key.key3,ks3); + DBUG_PRINT("info",("DES: cipher pointer='%x'",EVP_get_cipherbyname("DES-EDE3-CBC"))); + EVP_BytesToKey(EVP_get_cipherbyname("DES-EDE3-CBC"),EVP_md5(),NULL, + (unsigned char *)in_str->c_ptr(), + in_str->length(),1,(uchar *)&key.allkeys,ivec); + + DBUG_PRINT("info",("DES: checkpoint")); + des_ede3_cbc_encrypt( + (const unsigned char*)(res->c_ptr()) , + (uchar*)tmp, + res->length(), + ks1, ks2, ks3, &ivec, FALSE); + + DBUG_PRINT("info",("DES: checkpoint")); + DBUG_PRINT("info",("DES: string length='%d' versus '%d'",res->length(),strlen(res->c_ptr()))); + DBUG_PRINT("info",("DES: crypted data string='%s'",tmp)); + str->set((const char*)0,(uint)0); + for(uint i=0 ; i < res->length() ; ++i) + { + str->append(tmp[i]); +// str->append(bin_to_ascii(tmp[i] & 0x3f)); +// str->append(bin_to_ascii((tmp[i] >> 5) & 0x3f)); + } + DBUG_PRINT("info",("DES: crypted data plain string='%s'",str->c_ptr())); + str->copy(); + DBUG_PRINT("info",("DES: crypted data plain string='%s'",str->c_ptr())); + my_free(tmp,MYF(0)); + return str; +#else + null_value=1; + return 0; +#endif /* HAVE_OPENSSL */ +} + + /* @@ -992,7 +1124,6 @@ String *Item_func_password::val_str(String *str) return str; } -#define bin_to_ascii(c) ((c)>=38?((c)-38+'a'):(c)>=12?((c)-12+'A'):(c)+'.') String *Item_func_encrypt::val_str(String *str) { diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index 59bb815f0c3..7bd587e44a9 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -222,6 +222,26 @@ public: const char *func_name() const { return "password"; } }; +class Item_func_des_encrypt :public Item_str_func +{ + String tmp_value; +public: + Item_func_des_encrypt(Item *a) :Item_str_func(a) {} + Item_func_des_encrypt(Item *a, Item *b): Item_str_func(a,b) {} + String *val_str(String *); + void fix_length_and_dec() { maybe_null=1; max_length = 13; } +}; + +class Item_func_des_decrypt :public Item_str_func +{ + String tmp_value; +public: + Item_func_des_decrypt(Item *a) :Item_str_func(a) {} + Item_func_des_decrypt(Item *a, Item *b): Item_str_func(a,b) {} + String *val_str(String *); + void fix_length_and_dec() { maybe_null=1; max_length = 13; } +}; + class Item_func_encrypt :public Item_str_func { String tmp_value; diff --git a/sql/lex.h b/sql/lex.h index 07fbfda229a..37fe38b76a1 100644 --- a/sql/lex.h +++ b/sql/lex.h @@ -405,6 +405,8 @@ static SYMBOL sql_functions[] = { { "DAYOFYEAR", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_dayofyear)}, { "DECODE", SYM(DECODE_SYM),0,0}, { "DEGREES", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_degrees)}, + { "DES_ENCRYPT", SYM(DES_ENCRYPT),0,0}, + { "DES_DECRYPT", SYM(DES_DECRYPT),0,0}, { "ELT", SYM(ELT_FUNC),0,0}, { "ENCODE", SYM(ENCODE_SYM),0,0}, { "ENCRYPT", SYM(ENCRYPT),0,0}, diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index bf7167ce391..e34f42bdfde 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -376,6 +376,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); %token DAY_SECOND_SYM %token DAY_SYM %token DECODE_SYM +%token DES_ENCRYPT +%token DES_DECRYPT %token ELSE %token ELT_FUNC %token ENCODE_SYM @@ -1613,6 +1615,8 @@ simple_expr: { $$= new Item_func_decode($3,$5.str); } | ENCODE_SYM '(' expr ',' TEXT_STRING ')' { $$= new Item_func_encode($3,$5.str); } + | DES_ENCRYPT '(' expr ',' expr ')' { $$= new Item_func_des_encrypt($3,$5); } + | DES_DECRYPT '(' expr ',' expr ')' { $$= new Item_func_des_decrypt($3,$5); } | EXPORT_SET '(' expr ',' expr ',' expr ')' { $$= new Item_func_export_set($3, $5, $7); } | EXPORT_SET '(' expr ',' expr ',' expr ',' expr ')' |