Loading Docs/manual.texi +69 −19 Original line number Diff line number Diff line Loading @@ -10794,7 +10794,12 @@ other contexts, however. @strong{MySQL} doesn't yet support the Oracle SQL extension: @code{SELECT ... INTO TABLE ...}. @strong{MySQL} supports instead the ANSI SQL syntax @code{INSERT INTO ... SELECT ...}, which is basically the same thing. the same thing. @xref{INSERT}. @example INSERT INTO tblTemp2 (fldID) SELECT tblTemp1.fldOrder_ID FROM tblTemp1 WHERE tblTemp1.fldOrder_ID > 100; @end example Alternatively, you can use @code{SELECT INTO OUTFILE...} or @code{CREATE TABLE ... SELECT} to solve your problem. Loading Loading @@ -11041,7 +11046,22 @@ constraints for application that can't easily be coded to avoid them. @subsection Views @cindex views @strong{MySQL} doesn't support views, but this is on the TODO. @strong{MySQL} doesn't yet support views, but we plan to implement these to about 4.1. Views are mostly useful in letting user access a set of relations as one table (in read-only mode). Many SQL databases doesn't allow one to update any rows in a view, but you have to do the updates in the separate tables. As @strong{MySQL} is mostly used in applications and on web system where the application write has full control on the database usage, most of our users haven't regarded views to be very important. (At least no one has been interested enough of this to be prepared to finance the implementation of views). One doesn't need views in @strong{MySQL} to restrict access to columns as @strong{MySQL} has a very sophisticated privilege system. @xref{Privilege system}. @node Missing comments, , Missing Views, Missing functions @subsection @samp{--} as the Start of a Comment Loading Loading @@ -19539,15 +19559,18 @@ or INSERT [LOW_PRIORITY | DELAYED] [IGNORE] or INSERT [LOW_PRIORITY | DELAYED] [IGNORE] [INTO] tbl_name SET col_name=expression, col_name=expression, ... or INSERT [LOW_PRIORITY] [IGNORE] [INTO] tbl_name SELECT ... @end example @code{INSERT} inserts new rows into an existing table. The @code{INSERT ... VALUES} form of the statement inserts rows based on explicitly specified values. The @code{INSERT ... SELECT} form inserts rows selected from another table or tables. The @code{INSERT ... VALUES} form with multiple value lists is supported in @strong{MySQL} Version 3.22.5 or later. The @code{col_name=expression} syntax is supported in @strong{MySQL} Version 3.22.10 or later. @code{INSERT} inserts new rows into an existing table. The @code{INSERT ... VALUES} form of the statement inserts rows based on explicitly specified values. The @code{INSERT ... SELECT} form inserts rows selected from another table or tables. The @code{INSERT ... VALUES} form with multiple value lists is supported in @strong{MySQL} Version 3.22.5 or later. The @code{col_name=expression} syntax is supported in @strong{MySQL} Version 3.22.10 or later. @code{tbl_name} is the table into which rows should be inserted. The column name list or the @code{SET} clause indicates which columns the statement Loading Loading @@ -19607,9 +19630,17 @@ specify values for all columns that require a non-@code{NULL} value. You can find the value used for an @code{AUTO_INCREMENT} column with the @code{mysql_insert_id} function. @xref{mysql_insert_id, , @code{mysql_insert_id()}}. @end itemize @item The following conditions hold for an @code{INSERT INTO ... SELECT} statement: With @code{INSERT ... SELECT} statement you can quickly insert many rows into a table from one or many tables. @example INSERT INTO tblTemp2 (fldID) SELECT tblTemp1.fldOrder_ID FROM tblTemp1 WHERE tblTemp1.fldOrder_ID > 100; @end example The following conditions hold for an @code{INSERT ... SELECT} statement: @itemize @minus @item Loading @@ -19626,7 +19657,6 @@ sub-select clauses, the situation could easily be very confusing!) @item @code{AUTO_INCREMENT} columns work as usual. @end itemize @end itemize @findex mysql_info() If you use @code{INSERT ... SELECT} or an @code{INSERT ... VALUES} Loading Loading @@ -29385,16 +29415,16 @@ going. Hopefully this will be better handled in future Linux Kernels. This should contain a technical description of the @strong{MySQL} benchmark suite (and @code{crash-me}), but that description is not written yet. Currently, you should look at the code and results in the @file{sql-bench} directory in the distribution (and of course on the Web page at @uref{http://www.mysql.com/information/crash-me.php} and (normally found in the @file{sql-bench} directory in the @strong{MySQL} distribution)). written yet. Currently, you can get a good idea of the benchmark by looking at the code and results in the @file{sql-bench} directory in any @strong{MySQL} source distributions. It is meant to be a benchmark that will tell any user what things a given SQL implementation performs well or poorly at. This benchmark suite is meant to be a benchmark that will tell any user what things a given SQL implementation performs well or poorly at. Note that this benchmark is single threaded, so it measures the minimum time for the operations. time for the operations. We plan to in the future add a lot of multi-threaded tests to the benchmark suite. For example, (run on the same NT 4.0 machine): Loading Loading @@ -29424,12 +29454,28 @@ For example, (run on the same NT 4.0 machine): In the above test @strong{MySQL} was run with a 8M index cache. We have gather some more benchmark results at @uref{http://www.mysql.com/information/benchmarks.html}. 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 supposed to show what a standard installation can do for a single client. To run the benchmark suite, you have to download a MySQL source distribution install the perl DBI driver, the perl DBD driver for the database you want to test and then do: @example cd sql-bench perl run-all-tests --server=# @end example where # is one of supported servers. You can get a list of all options and supported servers by doing @code{run-all-tests --help}. @cindex crash-me @code{crash-me} tries to determine what features a database supports and what it's capabilities and limitations are by actually running queries. For example, it determines: Loading @@ -29447,6 +29493,9 @@ How big a query can be How big a @code{VARCHAR} column can be @end itemize We can find the result from crash-me on a lot of different databases at @uref{http://www.mysql.com/information/crash-me.php}. @cindex utilities @node Tools, Maintenance, MySQL Benchmarks, Top @chapter MySQL Utilites Loading Loading @@ -39011,6 +39060,7 @@ You can also find this at: There are 2 supported JDBC drivers for @strong{MySQL} (the mm driver and the Reisin JDBC driver). You can find a copy of the mm driver at @uref{http://mmmysql.sourceforge.net/} or @uref{http://www.mysql.com/Downloads/Contrib/} and the Reisin driver at @uref{http://www.caucho.com/projects/jdbc-mysql/index.xtp} For documentation consult any JDBC documentation and the driver's own bdb/log/log_rec.c +26 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ static const char revid[] = "$Id: log_rec.c,v 11.48 2001/01/11 18:19:53 bostic E #include "db_am.h" #include "log.h" static int __log_check_master __P((DB_ENV *, u_int8_t *, char *)); static int __log_do_open __P((DB_ENV *, DB_LOG *, u_int8_t *, char *, DBTYPE, int32_t, db_pgno_t)); static int __log_open_file __P((DB_ENV *, DB_LOG *, __log_register_args *)); Loading Loading @@ -341,6 +342,9 @@ __log_do_open(dbenv, lp, uid, name, ftype, ndx, meta_pgno) * Verify that we are opening the same file that we were * referring to when we wrote this log record. */ if (meta_pgno != PGNO_BASE_MD && __log_check_master(dbenv, uid, name) != 0) goto not_right; if (memcmp(uid, dbp->fileid, DB_FILE_ID_LEN) != 0) { memset(zeroid, 0, DB_FILE_ID_LEN); if (memcmp(dbp->fileid, zeroid, DB_FILE_ID_LEN) != 0) Loading @@ -361,6 +365,28 @@ __log_do_open(dbenv, lp, uid, name, ftype, ndx, meta_pgno) return (ENOENT); } static int __log_check_master(dbenv, uid, name) DB_ENV *dbenv; u_int8_t *uid; char *name; { DB *dbp; int ret; ret = 0; if ((ret = db_create(&dbp, dbenv, 0)) != 0) return (ret); dbp->type = DB_BTREE; ret = __db_dbopen(dbp, name, 0, __db_omode("rw----"), PGNO_BASE_MD); if (ret == 0 && memcmp(uid, dbp->fileid, DB_FILE_ID_LEN) != 0) ret = EINVAL; (void) dbp->close(dbp, 0); return (ret); } /* * __log_add_logid -- * Adds a DB entry to the log's DB entry table. Loading bdb/patches/log-corruption.patch 0 → 100644 +62 −0 Original line number Diff line number Diff line # This patch fixes a bug caused mysqld to get a core dump while # bdb tries to resolve the log file after mysqld was killed with kill -9. # # Author: Michael Ubell, Sleepycat Software # Mon, 26 Feb 2001 12:56:23 -0500 (EST) # *** log/log_rec.c 2001/02/08 03:05:01 11.50 --- log/log_rec.c 2001/02/24 00:42:46 11.51 *************** *** 50,55 **** --- 50,56 ---- #include "db_am.h" #include "log.h" + static int __log_check_master __P((DB_ENV *, u_int8_t *, char *)); static int __log_do_open __P((DB_ENV *, DB_LOG *, u_int8_t *, char *, DBTYPE, int32_t, db_pgno_t)); static int __log_open_file __P((DB_ENV *, DB_LOG *, __log_register_args *)); *************** *** 341,346 **** --- 342,350 ---- * Verify that we are opening the same file that we were * referring to when we wrote this log record. */ + if (meta_pgno != PGNO_BASE_MD && + __log_check_master(dbenv, uid, name) != 0) + goto not_right; if (memcmp(uid, dbp->fileid, DB_FILE_ID_LEN) != 0) { memset(zeroid, 0, DB_FILE_ID_LEN); if (memcmp(dbp->fileid, zeroid, DB_FILE_ID_LEN) != 0) *************** *** 359,364 **** --- 363,390 ---- (void)__log_add_logid(dbenv, lp, NULL, ndx); return (ENOENT); + } + + static int + __log_check_master(dbenv, uid, name) + DB_ENV *dbenv; + u_int8_t *uid; + char *name; + { + DB *dbp; + int ret; + + ret = 0; + if ((ret = db_create(&dbp, dbenv, 0)) != 0) + return (ret); + dbp->type = DB_BTREE; + ret = __db_dbopen(dbp, name, 0, __db_omode("rw----"), PGNO_BASE_MD); + + if (ret == 0 && memcmp(uid, dbp->fileid, DB_FILE_ID_LEN) != 0) + ret = EINVAL; + + (void) dbp->close(dbp, 0); + return (ret); } /* innobase/ibuf/Makefile.am +3 −0 Original line number Diff line number Diff line Loading @@ -22,3 +22,6 @@ libs_LIBRARIES = libibuf.a libibuf_a_SOURCES = ibuf0ibuf.c EXTRA_PROGRAMS = # Don't update the files from bitkeeper %::SCCS/s.% innobase/include/Makefile.am +3 −0 Original line number Diff line number Diff line Loading @@ -54,3 +54,6 @@ noinst_HEADERS = btr0btr.h btr0btr.ic btr0cur.h btr0cur.ic \ usr0sess.h usr0sess.ic usr0types.h ut0byte.h ut0byte.ic \ ut0dbg.h ut0lst.h ut0mem.h ut0mem.ic ut0rnd.h ut0rnd.ic \ ut0sort.h ut0ut.h ut0ut.ic # Don't update the files from bitkeeper %::SCCS/s.% Loading
Docs/manual.texi +69 −19 Original line number Diff line number Diff line Loading @@ -10794,7 +10794,12 @@ other contexts, however. @strong{MySQL} doesn't yet support the Oracle SQL extension: @code{SELECT ... INTO TABLE ...}. @strong{MySQL} supports instead the ANSI SQL syntax @code{INSERT INTO ... SELECT ...}, which is basically the same thing. the same thing. @xref{INSERT}. @example INSERT INTO tblTemp2 (fldID) SELECT tblTemp1.fldOrder_ID FROM tblTemp1 WHERE tblTemp1.fldOrder_ID > 100; @end example Alternatively, you can use @code{SELECT INTO OUTFILE...} or @code{CREATE TABLE ... SELECT} to solve your problem. Loading Loading @@ -11041,7 +11046,22 @@ constraints for application that can't easily be coded to avoid them. @subsection Views @cindex views @strong{MySQL} doesn't support views, but this is on the TODO. @strong{MySQL} doesn't yet support views, but we plan to implement these to about 4.1. Views are mostly useful in letting user access a set of relations as one table (in read-only mode). Many SQL databases doesn't allow one to update any rows in a view, but you have to do the updates in the separate tables. As @strong{MySQL} is mostly used in applications and on web system where the application write has full control on the database usage, most of our users haven't regarded views to be very important. (At least no one has been interested enough of this to be prepared to finance the implementation of views). One doesn't need views in @strong{MySQL} to restrict access to columns as @strong{MySQL} has a very sophisticated privilege system. @xref{Privilege system}. @node Missing comments, , Missing Views, Missing functions @subsection @samp{--} as the Start of a Comment Loading Loading @@ -19539,15 +19559,18 @@ or INSERT [LOW_PRIORITY | DELAYED] [IGNORE] or INSERT [LOW_PRIORITY | DELAYED] [IGNORE] [INTO] tbl_name SET col_name=expression, col_name=expression, ... or INSERT [LOW_PRIORITY] [IGNORE] [INTO] tbl_name SELECT ... @end example @code{INSERT} inserts new rows into an existing table. The @code{INSERT ... VALUES} form of the statement inserts rows based on explicitly specified values. The @code{INSERT ... SELECT} form inserts rows selected from another table or tables. The @code{INSERT ... VALUES} form with multiple value lists is supported in @strong{MySQL} Version 3.22.5 or later. The @code{col_name=expression} syntax is supported in @strong{MySQL} Version 3.22.10 or later. @code{INSERT} inserts new rows into an existing table. The @code{INSERT ... VALUES} form of the statement inserts rows based on explicitly specified values. The @code{INSERT ... SELECT} form inserts rows selected from another table or tables. The @code{INSERT ... VALUES} form with multiple value lists is supported in @strong{MySQL} Version 3.22.5 or later. The @code{col_name=expression} syntax is supported in @strong{MySQL} Version 3.22.10 or later. @code{tbl_name} is the table into which rows should be inserted. The column name list or the @code{SET} clause indicates which columns the statement Loading Loading @@ -19607,9 +19630,17 @@ specify values for all columns that require a non-@code{NULL} value. You can find the value used for an @code{AUTO_INCREMENT} column with the @code{mysql_insert_id} function. @xref{mysql_insert_id, , @code{mysql_insert_id()}}. @end itemize @item The following conditions hold for an @code{INSERT INTO ... SELECT} statement: With @code{INSERT ... SELECT} statement you can quickly insert many rows into a table from one or many tables. @example INSERT INTO tblTemp2 (fldID) SELECT tblTemp1.fldOrder_ID FROM tblTemp1 WHERE tblTemp1.fldOrder_ID > 100; @end example The following conditions hold for an @code{INSERT ... SELECT} statement: @itemize @minus @item Loading @@ -19626,7 +19657,6 @@ sub-select clauses, the situation could easily be very confusing!) @item @code{AUTO_INCREMENT} columns work as usual. @end itemize @end itemize @findex mysql_info() If you use @code{INSERT ... SELECT} or an @code{INSERT ... VALUES} Loading Loading @@ -29385,16 +29415,16 @@ going. Hopefully this will be better handled in future Linux Kernels. This should contain a technical description of the @strong{MySQL} benchmark suite (and @code{crash-me}), but that description is not written yet. Currently, you should look at the code and results in the @file{sql-bench} directory in the distribution (and of course on the Web page at @uref{http://www.mysql.com/information/crash-me.php} and (normally found in the @file{sql-bench} directory in the @strong{MySQL} distribution)). written yet. Currently, you can get a good idea of the benchmark by looking at the code and results in the @file{sql-bench} directory in any @strong{MySQL} source distributions. It is meant to be a benchmark that will tell any user what things a given SQL implementation performs well or poorly at. This benchmark suite is meant to be a benchmark that will tell any user what things a given SQL implementation performs well or poorly at. Note that this benchmark is single threaded, so it measures the minimum time for the operations. time for the operations. We plan to in the future add a lot of multi-threaded tests to the benchmark suite. For example, (run on the same NT 4.0 machine): Loading Loading @@ -29424,12 +29454,28 @@ For example, (run on the same NT 4.0 machine): In the above test @strong{MySQL} was run with a 8M index cache. We have gather some more benchmark results at @uref{http://www.mysql.com/information/benchmarks.html}. 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 supposed to show what a standard installation can do for a single client. To run the benchmark suite, you have to download a MySQL source distribution install the perl DBI driver, the perl DBD driver for the database you want to test and then do: @example cd sql-bench perl run-all-tests --server=# @end example where # is one of supported servers. You can get a list of all options and supported servers by doing @code{run-all-tests --help}. @cindex crash-me @code{crash-me} tries to determine what features a database supports and what it's capabilities and limitations are by actually running queries. For example, it determines: Loading @@ -29447,6 +29493,9 @@ How big a query can be How big a @code{VARCHAR} column can be @end itemize We can find the result from crash-me on a lot of different databases at @uref{http://www.mysql.com/information/crash-me.php}. @cindex utilities @node Tools, Maintenance, MySQL Benchmarks, Top @chapter MySQL Utilites Loading Loading @@ -39011,6 +39060,7 @@ You can also find this at: There are 2 supported JDBC drivers for @strong{MySQL} (the mm driver and the Reisin JDBC driver). You can find a copy of the mm driver at @uref{http://mmmysql.sourceforge.net/} or @uref{http://www.mysql.com/Downloads/Contrib/} and the Reisin driver at @uref{http://www.caucho.com/projects/jdbc-mysql/index.xtp} For documentation consult any JDBC documentation and the driver's own
bdb/log/log_rec.c +26 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ static const char revid[] = "$Id: log_rec.c,v 11.48 2001/01/11 18:19:53 bostic E #include "db_am.h" #include "log.h" static int __log_check_master __P((DB_ENV *, u_int8_t *, char *)); static int __log_do_open __P((DB_ENV *, DB_LOG *, u_int8_t *, char *, DBTYPE, int32_t, db_pgno_t)); static int __log_open_file __P((DB_ENV *, DB_LOG *, __log_register_args *)); Loading Loading @@ -341,6 +342,9 @@ __log_do_open(dbenv, lp, uid, name, ftype, ndx, meta_pgno) * Verify that we are opening the same file that we were * referring to when we wrote this log record. */ if (meta_pgno != PGNO_BASE_MD && __log_check_master(dbenv, uid, name) != 0) goto not_right; if (memcmp(uid, dbp->fileid, DB_FILE_ID_LEN) != 0) { memset(zeroid, 0, DB_FILE_ID_LEN); if (memcmp(dbp->fileid, zeroid, DB_FILE_ID_LEN) != 0) Loading @@ -361,6 +365,28 @@ __log_do_open(dbenv, lp, uid, name, ftype, ndx, meta_pgno) return (ENOENT); } static int __log_check_master(dbenv, uid, name) DB_ENV *dbenv; u_int8_t *uid; char *name; { DB *dbp; int ret; ret = 0; if ((ret = db_create(&dbp, dbenv, 0)) != 0) return (ret); dbp->type = DB_BTREE; ret = __db_dbopen(dbp, name, 0, __db_omode("rw----"), PGNO_BASE_MD); if (ret == 0 && memcmp(uid, dbp->fileid, DB_FILE_ID_LEN) != 0) ret = EINVAL; (void) dbp->close(dbp, 0); return (ret); } /* * __log_add_logid -- * Adds a DB entry to the log's DB entry table. Loading
bdb/patches/log-corruption.patch 0 → 100644 +62 −0 Original line number Diff line number Diff line # This patch fixes a bug caused mysqld to get a core dump while # bdb tries to resolve the log file after mysqld was killed with kill -9. # # Author: Michael Ubell, Sleepycat Software # Mon, 26 Feb 2001 12:56:23 -0500 (EST) # *** log/log_rec.c 2001/02/08 03:05:01 11.50 --- log/log_rec.c 2001/02/24 00:42:46 11.51 *************** *** 50,55 **** --- 50,56 ---- #include "db_am.h" #include "log.h" + static int __log_check_master __P((DB_ENV *, u_int8_t *, char *)); static int __log_do_open __P((DB_ENV *, DB_LOG *, u_int8_t *, char *, DBTYPE, int32_t, db_pgno_t)); static int __log_open_file __P((DB_ENV *, DB_LOG *, __log_register_args *)); *************** *** 341,346 **** --- 342,350 ---- * Verify that we are opening the same file that we were * referring to when we wrote this log record. */ + if (meta_pgno != PGNO_BASE_MD && + __log_check_master(dbenv, uid, name) != 0) + goto not_right; if (memcmp(uid, dbp->fileid, DB_FILE_ID_LEN) != 0) { memset(zeroid, 0, DB_FILE_ID_LEN); if (memcmp(dbp->fileid, zeroid, DB_FILE_ID_LEN) != 0) *************** *** 359,364 **** --- 363,390 ---- (void)__log_add_logid(dbenv, lp, NULL, ndx); return (ENOENT); + } + + static int + __log_check_master(dbenv, uid, name) + DB_ENV *dbenv; + u_int8_t *uid; + char *name; + { + DB *dbp; + int ret; + + ret = 0; + if ((ret = db_create(&dbp, dbenv, 0)) != 0) + return (ret); + dbp->type = DB_BTREE; + ret = __db_dbopen(dbp, name, 0, __db_omode("rw----"), PGNO_BASE_MD); + + if (ret == 0 && memcmp(uid, dbp->fileid, DB_FILE_ID_LEN) != 0) + ret = EINVAL; + + (void) dbp->close(dbp, 0); + return (ret); } /*
innobase/ibuf/Makefile.am +3 −0 Original line number Diff line number Diff line Loading @@ -22,3 +22,6 @@ libs_LIBRARIES = libibuf.a libibuf_a_SOURCES = ibuf0ibuf.c EXTRA_PROGRAMS = # Don't update the files from bitkeeper %::SCCS/s.%
innobase/include/Makefile.am +3 −0 Original line number Diff line number Diff line Loading @@ -54,3 +54,6 @@ noinst_HEADERS = btr0btr.h btr0btr.ic btr0cur.h btr0cur.ic \ usr0sess.h usr0sess.ic usr0types.h ut0byte.h ut0byte.ic \ ut0dbg.h ut0lst.h ut0mem.h ut0mem.ic ut0rnd.h ut0rnd.ic \ ut0sort.h ut0ut.h ut0ut.ic # Don't update the files from bitkeeper %::SCCS/s.%