diff options
Diffstat (limited to 'sql')
48 files changed, 1243 insertions, 3842 deletions
diff --git a/sql/ChangeLog b/sql/ChangeLog deleted file mode 100644 index a75e9761766..00000000000 --- a/sql/ChangeLog +++ /dev/null @@ -1,3307 +0,0 @@ -2000-12-07 Jeremy Cole <jeremy@mysql.com> - -* Added UPDATE ... ORDER BY ... -* Added DELETE ... ORDER BY ... - -2000-11-11 Jeremy Cole <jeremy@mysql.com> - -* Added ALTER TABLE ... ORDER BY ... - -2000-09-17 Michael Widenius <monty@mysql.com> - -* Added option QUICK to DELETE to tell MySQL not to balance the - trees on delete. - -2000-09-15 Michael Widenius <monty@mysql.com> - -* Added a thd argument to log::write() to get more speed. - -2000-09-01 Michael Widenius <monty@mysql.com> - -* Avoid allocation of "localhost" string. -* Changed that TIMESTAMP(X) is sometimes as string -* Release of 3.23.23 - -2000-08-21 Michael Widenius <monty@mysql.com> - -* Added RENAME TABLE. - -2000-08-20 Michael Widenius <monty@mysql.com> - -* Added memory as inline functions to THD to get them a bit faster -* Don't count entries with NULL in COUNT(DISTINCT ..) - -2000-08-08 Michael Widenius <monty@mysql.com> - -* Changed ALTER TABLE and LOAD DATA INFILE to create non unique, small keys - after all rows are inserted. -* Fixed use of UDF function with const arguments in WHERE clause. - -2000-07-11 Michael Widenius <monty@mysql.com> - -* Extended safe_mysqld; Patch by Christian Hammers - -2000-07-04 Michael Widenius <monty@mysql.com> - -* Changed the update log to take the query length argument; This - should make the update log \0 safe. - -2000-06-21 Michael Widenius <monty@mysql.com> - -* Added net_read_timeout and net_write_timeout as startup parameters to mysqld - -2000-06-19 Michael Widenius <monty@mysql.com> - -* Changed the copyright of MySQL to GPL and LGPL. -* Added myisampack and pack_isam to the MySQL distribution. - -2000-06-01 Michael Widenius <monty@mysql.com> - -* Added "FLUSH TABLES WITH READ LOCK" command - -2000-05-31 Michael Widenius <monty@mysql.com> - -* Added table locks to Berkeley DB. - -2000-05-28 Michael Widenius <monty@mysql.com> - -* Allow ON and USING with INNER JOIN. - -2000-05-23 Sasha - -* Fix that USE INDEX with 'PRIMARY' keys works. - -2000-05-20 Michael Widenius <monty@tik.pp.sci.fi> - -* Added symbolic links support for Win32. - -2000-05-19 Michael Widenius <monty@tik.pp.sci.fi> - -* Changed protocol to let client know if the server is in AUTOCOMMIT mode - and if there is a pending transaction. If there is a pending transaction - the client library will give an error before reconnecting to the server to - let the client know that the server did a rollback. - The protocol is still backward compatible with old clients -* 'kill' now works on a thread that is locked on a 'write' to a dead client. - -2000-05-18 Michael Widenius <monty@tik.pp.sci.fi> - -* unlock tables before sending last packet of SELECT ... result to client. - -2000-05-16 Michael Widenius <monty@mysql.com> - -* split Item_bool_func2::compare function into individual functions to get more - speed. -* Small optimizations of do_select() to get more speed. - -2000-05-15 Michael Widenius <monty@mysql.com> - -* CHECK will update the statistics for the keys. -* Fixed bug in REPAIR TABLE when the table was used by other threads. - -2000-05-11 Michael Widenius <monty@mysql.com> - -* put CREATE TEMPORARY TABLE commands in the update log. -* UPDATE IGNORE will not abort if an update gives a DUPLICATE_KEY error. -* Ensure that all fn_format() or unpack_filename() is called for all - generated filenames. - -2000-05-05 Michael Widenius <monty@mysql.com> - -* Added timzone variable to SHOW VARIABLES. - -2000-05-04 Michael Widenius <monty@mysql.com> - -* Don't write INSERT DELAYED to update log if SQL_LOG_UPDATE=0 - -2000-05-03 Michael Widenius <monty@mysql.com> - -* Fixed problem with REPLACE on HEAP tables. - -2000-04-26 Michael Widenius <monty@mysql.com> - -* Added 'Writing to net' and 'Reading from net' as 'status' to - mysqladmin processlist. - -2000-04-23 Michael Widenius <monty@mysql.com> - -* Added CREATE DATABASE and DROP DATABASE to the update log -* Fixed problem when doing a GROUP BY on an enum column with MANY - value combinations. -* Avoid sorting for some simple GROUP BY queries. - -2000-04-22 Michael Widenius <monty@mysql.com> - -* Fixed problems in update log when using LAST_INSERT_ID() to update - an table with an auto_increment key. -* New function: 'NULLIF(expr1,expr2)' - -2000-04-14 Michael Widenius <monty@tik.pp.sci.fi> - -* UPDATE and DELETE on UNIQUE keys, where the whole key is used in the WHERE - part, are now faster than before. - -* Added optimisation to skip ORDER BY parts where the order by column - is a constant expression in the WHERE part. ORDER BY will also - be skipped if ORDER BY matches a key where the key parts that are - missing in the ORDER BY is constants: - - In the following case the ORDER BY will be removed: - SELECT * FROM foo WHERE column=constant ORDER BY column; - - In the following case the first key will be used to solve the ORDER BY: - SELECT * FROM foo WHERE key_part1=const ORDER BY key_part2; - -2000-04-10 Michael Widenius <monty@mysql.com> - -* Changed mysql.server to wait until the pid file is deleted on stop -* Clients will automaticly be set to the same character set as the - server if one hasn't specified a character set with mysql_option() - or in the my.cnf files. - -2000-04-09 Michael Widenius <monty@mysql.com> - -* Release of 3.23.14 -* Fixed bug where complex CONCAT() use returned the wrong result. - -2000-04-07 Michael Widenius <monty@mysql.com> - -* Added some optimization to LIMIT when the used KEY matches almost all - rows in the table. (SELECT * from table where key_column > "a" LIMIT 1). -* REPLACE now honors the LOW_PRIORITY_UPDATES flag. - -2000-04-05 Michael Widenius <monty@mysql.com> - -* Fixed that DROP TABLE is logged in the update log. -* Fixed problem when searching on DECIMAL() key field - where the column data contained pre-zeros. - -2000-04-02 Michael Widenius <monty@mysql.com> - -* Fix bug in myisamchk when the auto_increment isn't the first key. - -2000-03-30 "Thimble Smith" <tim@mysql.com> - -* Allow DATETIME in ISO8601 format: 2000-03-12T12:00:00 - -2000-03-30 Michael Widenius <monty@mysql.com> - -* Added UMASK_DIR environment variable. -* Fixed problem with seek and RAID tables. - -2000-03-29 Michael Widenius <monty@mysql.com> - -* slow_queries log wasn't flushed on FLUSH LOGS. - -2000-03-28 Michael Widenius <monty@mysql.com> - -* Fix that DELETE FROM table_name; works on RAID tables. -* Fix that DROP DATABASE works correctly with RAID tables. - -2000-03-27 Michael Widenius <monty@mysql.com> - -* Added function CONNECTION_ID() - -2000-03-26 Michael Widenius <monty@mysql.com> - -* When using = on BLOB or VARCHAR BINARY keys where only a part of the column - was indexed, the whole column of the result row wasn't compared. - -2000-03-24 takeshi@SoftAgency.co.jp - -* Fix for sjis & order by - -2000-03-23 Michael Widenius <monty@mysql.com> - -* Added patches to allow client library to compile on BEOS. - -2000-03-16 Michael Widenius <monty@monty.pp.sci.fi> - -* Added STDCALL to some functions in libmysql that missed this. -* When running in ANSI mode, don't allow one to use columns that isn't in - the GROUP BY part. - -2000-03-14 Michael Widenius <monty@monty.pp.sci.fi> - -* Release of 3.23.13 -* Removed end space from double/float numbers in results from temporary - tables. - -2000-03-13 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed automatic removal of table locks if doing a DROP TABLE on the last - locked table. - -2000-03-13 Sasha - -* Added CHECK TABLE command. - -2000-03-12 Michael Widenius <monty@monty.pp.sci.fi> - -* Changed int2str and longlong2str to use the optimized - int10_to_str / longlong10_to_str functions. - -2000-03-09 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed bug so that mysqladmin shutdown will wait for the local server to close - down. -* Fixed a possible endless loop when calculating timestamp. - -2000-02-27 Michael Widenius <monty@monty.pp.sci.fi> - -* Release of 3.23.12 -* Changed that mysql_ping() doesn't increment the 'questions' status variable. -* Fixed that mysql -D database doesn't kill 'mysql'. - -2000-02-24 Michael Widenius <monty@monty.pp.sci.fi> - -* Only allow SHOW GRANTS if you have a privilege on the mysql - tables -* Fixed bug when storing 0 into a timestamp. - -2000-02-23 Michael Widenius <monty@monty.pp.sci.fi> - -* When doing mysqladmin shutdown on a local connection, mysqladmin now - waits until the pidfile is gone before doing an shutdown. -* Changed that the pid file is not removed until all threads have died. - -2000-02-23 Matt Wagner - -* When doing mysqladmin shutdown on a local connection, mysqladmin now - waits until the pidfile is gone before doing an shutdown. - -2000-02-23 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed problem with LEFT JOIN and key_field IS NULL. - -2000-02-23 Sasha - -* Fixed core dump with some COUNT(DISTINCT ...) queries. - -2000-02-21 Michael Widenius <monty@monty.pp.sci.fi> - -* Added options USE KEYS (key_list) and IGNORE KEYS (key_list) as - join parameters in SELECT. -* DROP of table is now done through the handler. - -2000-02-17 Michael Widenius <monty@monty.pp.sci.fi> - -* Added ANSI SQL syntax ALTER TABLE ADD (column_def1, column_def2 ...) - -2000-02-16 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed problem with optimizer that could sometimes use wrong keys - -2000-02-15 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed that GRANT/REVOKE ALL PRIVILEGES doesn't affect GRANT OPTION -* Removed extra ) from the output of SHOW GRANTS - -2000-02-13 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed problem when storing numbers in timestamps. -* Fix problem with timezones that has half hour offsets. -* Storage of numbers in timestamp columns are now faster. - -2000-02-11 Michael Widenius <monty@monty.pp.sci.fi> - -* Allow the syntax UNIQUE INDEX in CREATE statements. - -2000-02-10 Michael Widenius <monty@monty.pp.sci.fi> - -* Added options --i-am-a-dummy and --safe-updates to mysql.cc -* Added variables select_limit and max_join_size to mysql.cc -* Added sql variables: SQL_MAX_JOIN_SIZE and SQL_SAFE_UPDATES -* Added READ_LOCAL lock that doesn't lock the table for concurrent inserts -* Changed that LOCK TABLES .. READ doesn't anymore allow concurrent inserts -* Added option --skip-delay-key-write to mysqld. - -2000-02-09 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed security problem in the protocol regarding password checking. - -2000-02-03 Michael Widenius <monty@tik.pp.sci.fi> - -* Allow 'end' as a field name. -* Added _rowid as an alias for an auto_increment column. - -2000-01-28 Michael Widenius <monty@monty.pp.sci.fi> - -* Ignore empty queries in mysql when running in batch mode - (To be able to handle rows with double ';' chars). - -2000-01-27 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed problem with timestamps and INSERT DELAYED - -2000-01-26 Michael Widenius <monty@tik.pp.sci.fi> - -* Fixed problem that affected queries that did arithmetic on GROUP functions. - -2000-01-24 Michael Widenius <monty@tik.pp.sci.fi> - -* Don't give a unnecessary GRANT error when using tables from many - databases in the same query. - -2000-01-20 Michael Widenius <monty@tik.pp.sci.fi> - -* Fixed that 'date_column BETWEEN const_date AND const_date' works. - -2000-01-19 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed problem when only changing a 0 to NULL in a table with BLOB/TEXT - columns. -* Fixed bug in range optimizer when using many key parts and or on the middle - key parts: WHERE K1=1 and K3=2 and (K2=2 and K4=4 or K2=3 and K4=5) -* Added the virtual VIO interface to the mysql connection streams. - (This will make it possible to use SSL through the VIO classe interface) - -2000-01-14 Michael Widenius <monty@monty.pp.sci.fi> - -* Added command 'source' to mysql to allow reading of batch files inside - mysql. Original patch by Matthew Vanecek. - -2000-01-12 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed bug that a change of all VARCHAR columns to CHAR columns didn't change - row type from dynamic to fixed. - -2000-01-11 Michael Widenius <monty@monty.pp.sci.fi> - -* Added print of default arguments options to all clients. -* Added --log-slow-queries to mysqld to log all queries that takes a - long time to a separate log file with a time of how long the query took. -* Fixed critical problem with the WITH GRANT OPTION option. -* Added read-next-on-key to HEAP tables. This should fix all - problems with HEAP tables when using not UNIQUE keys. -* Disabled floating point exceptions for FreeBSD to fix core dump when - doing SELECT floor(pow(2,63)); - -2000-01-07 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed core dump when doing WHERE key_column=RAND(...) - (Note that this query can never use keys as the RAND() function must be - re-evaluated for each row) -2000-01-04 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed optimization bug in SELECT .. LEFT JOIN ... key_column IS NULL, when - key_column could contain NULL values. -* Fixed problem with 8 bit characters as separators in LOAD DATA INFILE. - -2000-01-02 Michael Widenius <monty@monty.pp.sci.fi> - -* Release of 3.23.8 - -1999-12-31 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed GRANT problem when doing 'CREATE TABLE ... SELECT' - -1999-12-30 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed problem with timezones that are < GMT -11 -* Fixed problem with ISAM when doing some ORDER BY .. DESC queries. - -1999-12-28 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed bug when doing a join on a text key which didn't covert the whole key. -* Option --delay-key-write didn't enable delayed key writing -* Fixed update of TEXT column which only involved case changes. - -1999-12-27 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed that INSERT DELAYED doesn't update timestamps that are given. - -1999-12-25 Michael Widenius <monty@monty.pp.sci.fi> - -* Added function yearweek() and options 'x', 'X', 'v' and 'V' to date_format() - -1999-12-22 Michael Widenius <monty@tik.pp.sci.fi> - -* Fixed problem with MAX(indexed_column) and HEAP tables. -* Fixed problem with BLOB NULL keys and LIKE "prefix%". - -1999-12-20 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed problem with MyISAM and fixed length rows < 5 bytes. - -1999-12-10 Michael Widenius <monty@monty.pp.sci.fi> - -* Added RAID support (patch from Tõnu Samuel) - -1999-12-02 Michael Widenius <monty@monty.pp.sci.fi> - -* Added -O interactive_timeout to mysqld. -* Changed the argument of mysql_data_seek to ulonglong from ulong. - -1999-11-30 Michael Widenius <monty@monty.pp.sci.fi> - -Fixed bug in replace() on Alpha. Patch by 'Tom Holroyd' -Fixed bug in LOAD DATA LOCAL INFILE on Alpha. Patch by 'Tom Holroyd' - -1999-11-29 Michael Widenius <monty@monty.pp.sci.fi> - -* Added detection of pthread_attr_stacksize() in configure. -* Added variable net_retry_count (needed for FreeBSD). - -Sun Nov 28 20:55:45 1999 Michael Widenius <monty@bitch.pp.sci.fi> - -* Added option '--verbose' to mysqladmin - -1999-11-28 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed problem when converting heap to myisam. -* Fixed bug in HEAP tables when doing insert + delete + insert + scan the - table. - -1999-11-23 Michael Widenius <monty@monty.pp.sci.fi> - -* Fix core dump when releasing a lock from a non existing table -* Remove locks on tables before starting to remove duplicates. -* Added patch to make most string functions multi-byte safe (by Wei He) -* Added Bytes_recieived/Bytes_sent statistics (by Sasha Pachev) -* Added optimization of read_next() with MyISAM -* Changed MyISAM to use concurrent inserts. - -1999-11-21 Michael Widenius <monty@monty.pp.sci.fi> - -* Inverted flag 'delayed_key_write' on 'show variables' - -1999-11-20 Michael Widenius <monty@monty.pp.sci.fi> - -* Added variable max_write_lock_count - -1999-11-13 Michael Widenius <monty@monty.pp.sci.fi> - -* Release of 3.23.6 -* Made floor() overflow safe on FREEBSD. -* Allow quoting of identifers with ` -* Temporary tables now start with #sql -* Added option --quote-names to mysqldump. -* Added option --ansi to change " to a identifier delimiter and || to - string concatenation. -* Fixed INTO DUMPFILE to give better error messages. NULL is now written - as an empty string. -* Changed Field_double and double->string to use snprintf() to avoid overflows. -* Fixed bug that one could make a part of a PRIMARY KEY not null. -* Fixed encrypt() to be thread safe and not reuse buffer. - -1999-11-11 Michael Widenius <monty@monty.pp.sci.fi> - -* Changed that FLOAT(X) where X <= 24 -> FLOAT and X <= 53 -> DOUBLE. -* Changed DECIMAL(X) to be DECIMAL(X,0) and DECIMAL to be DECIMAL(10,0) - -1999-11-09 Michael Widenius <monty@monty.pp.sci.fi> - -* Added mysqld option -O lower_case_table_names=[0|1] to force table - names to lower case. -* Added mysql_odbc_escape_string() function to support big5 characters in - MyOBC. - -1999-11-08 Michael Widenius <monty@monty.pp.sci.fi> - -* Added patch by Sasha for user defined variables. -* Changed that FLOAT and DOUBLE (without any length modifiers) are - not anymore fixed decimal point numbers. - -1999-10-22 Michael Widenius <monty@tik.pp.sci.fi> - -* Added option ROW_FORMAT=[default, dynamic, static, compressed] to - CREATE_TABLE - -1999-10-20 Michael Widenius <monty@monty.pp.sci.fi> - -* 'DELETE FROM table_name' didn't work on temporary tables - -1999-10-18 Michael Widenius <monty@monty.pp.sci.fi> - -* Release of MySQL 3.23.5 -* Fixed problem with LIKE "%const" - -1999-10-17 Michael Widenius <monty@monty.pp.sci.fi> - -* Added bit function ~ (neg) - -1999-10-14 Michael Widenius <monty@monty.pp.sci.fi> - -* Added support for the GBK Chinese character set (by Wei He) - -1999-10-13 Michael Widenius <monty@monty.pp.sci.fi> - -* Storage of date results is now much faster to date and datetime columns. - -1999-10-12 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed bug when using DISTINCT + ORDER BY RAND() -* new option --relative to mysqladmin. - -1999-10-11 Michael Widenius <monty@monty.pp.sci.fi> - -* Added some error messages in mysqld.cc -* Allow use of NATIONAL and NCHAR when defining character columns. - (They don't do anything) -* Don't allow NULL columns in PRIMARY KEY:s (only in UNIQUE keys) - -1999-10-10 Michael Widenius <monty@monty.pp.sci.fi> - -* Clear LAST_INSERT_ID if in uses this in ODBC context: - WHERE auto_increment_column IS NULL; -* 'SET SQL_AUTO_IS_NULL=0|1' now turns off/on the above handling of - auto_increment columns - -1999-10-09 Michael Widenius <monty@monty.pp.sci.fi> - -* Added parameter 'concurrency' for Solaris. - -1999-10-07 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed problem when using an auto_increment column in two keys - -1999-10-06 Michael Widenius <monty@monty.pp.sci.fi> - -* AS on fieldname with CREATE TABLE table_name SELECT ... didn't work. - -1999-10-01 Michael Widenius <monty@tik.pp.sci.fi> - -* LIKE with many % ("%xxx%yy%zz%") are now much faster. - -1999-09-24 Michael Widenius <monty@monty.pp.sci.fi> - -* Fix privilege check for LOAD DATA REPLACE . - -1999-09-22 Michael Widenius <monty@monty.pp.sci.fi> - -* Added SHOW GRANT FOR user (by Sinisa) -* Added date + INTERVALL # date_interval_type - -1999-09-19 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed problem with index optimzation with 'WHERE index is not null' - -* Allow creation of temporary tables with same name as original table. -* When granting user a grant option for a database, he couldn't grant - privileges to other users. - -1999-09-17 Michael Widenius <monty@monty.pp.sci.fi> - -* Inserting a DATETIME into a TIME column will not anymore try to store 'days' - in it. -* Fixed problem with storage of float/double on low endian machines. - -1999-09-08 Michael Widenius <monty@monty.pp.sci.fi> - -* Release of 3.23.3 -* Added limit to UPDATE -* Added client library function: mysql_change_user() - -1999-09-07 Michael Widenius <monty@monty.pp.sci.fi> - -* Added character set to 'show variables' -* Added support of '--[white-space]' as comment -* Allow 'INSERT into table_name VALUES ();' - -1999-09-03 Michael Widenius <monty@monty.pp.sci.fi> - -* Add mysqld option --delay-key-write to mysqld.cc - -1999-08-30 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed problem with COUNT(DISTINCT) and GROUP BY - -1999-08-29 Michael Widenius <monty@monty.pp.sci.fi> - -* Added /*!version */ -* Fixed core dump with empty blob to reverse() -* Fixed problem with year(now()) and year(curdate()). - -1999-08-28 Michael Widenius <monty@monty.pp.sci.fi> - -* Added construct: - - CASE value WHEN [compare-value] THEN result - [WHEN [compare-value] THEN result ...] - [ELSE result] - END - - CASE WHEN [condition] THEN result - [WHEN [condition] THEN result ...] - [ELSE result] - END -1999-08-19 Michael Widenius <monty@tik.pp.sci.fi> - -* Added check of arguments to acos() and asin(). -* unique_column IS NULL only returned the first row with NULL. - -1999-08-12 Michael Widenius <monty@tik.pp.sci.fi> - -* REGEXP(...,NULL) will not return an error anymore. - -* Removed ifdef mSQL_COMPLIANT when comparing NULL to NULL - -1999-08-05 Michael Widenius <monty@monty.pp.sci.fi> - -* Fix problem with LOCK TABLES and DELETE FROM table. - -1999-08-04 Michael Widenius <monty@monty.pp.sci.fi> - -* Don't pack all keys even if one key is packed when not using PACK_KEYS=1. - -1999-08-03 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed core-dump bug when inserting table or column grant on user name "" - -1999-08-02 Michael Widenius <monty@monty.pp.sci.fi> - -* Fix problem with LOCK TABLES when no database is selected. -* New functions: MD5(), (by Tõnu Samuel) and EXPORT_SET (by Sasha Pachev) -* Changed Socket to my_socket (to avoid conflicts) - -1999-07-29 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed problem with DISTINCT on BLOB column -* new keywords: CASE, THEN, WHEN, ELSE, END -* The CASE operator (by Tõnu Samuel) (not yet working) -* set SQL_LOW_PRIORITY_UPDATES=# didn't work -* Fixed range optimizer bug in - SELECT * FROM table_name WHERE key_part1 >= const AND (key_part2 = const OR key_part2 = const) - -1999-07-26 Michael Widenius <monty@tik.pp.sci.fi> - -* One can now update indexes columns that are used in the WHERE clause. - UPDATE tbl_name SET KEY=KEY+1 WHERE KEY > 100; - -1999-07-25 Michael Widenius <monty@tik.pp.sci.fi> - -* Added get_date() function to all item and fields. This makes date handling - a lot faster! -* Added handling of fuzzy dates (dates where day or month is 0) - -1999-07-21 Michael Widenius <monty@tik.pp.sci.fi> - -* Fixed optimization of SELECT ... WHERE key_part1=const1 and key_part_2=const2 and key_part1=const4 and key_part2=const4 - (indextype should be range instead of ref) - -1999-07-20 Michael Widenius <monty@tik.pp.sci.fi> - -* Changed handling of 'const_item' to allow handling of - ORDER BY RAND(). -* MyISAM tables now allows keys on NULL and BLOB columns. -* Optimize the following LEFT JOIN: - SELECT ... FROM t1 LEFT JOIN t2 ON ... WHERE t2.not_null_column IS NULL - -1999-07-19 Michael Widenius <monty@tik.pp.sci.fi> - -* Added ORDER BY and GROUP BY with functions -* Changed all handling of tables in sql_select.cc to use table_map instead - of table_nr. -* Added use of column_name = formula to use keys -* column_name = column_name2 don't anymore have to have identical packing -* field IS NULL can now use keys - -1999-07-16 Michael Widenius <monty@tik.pp.sci.fi> - -* Changed heap tables to be stored in low_byte_first order (to make it easy - to convert to MyISAM tables) -* Automatic change of HEAP temporary tables to MYISAM tables in case of - 'table is full' errors. -* Added option --init-file=file_name to mysqld - -1999-07-15 Michael Widenius <monty@tik.pp.sci.fi> - -* Added COUNT(DISTINCT value,[value,...]) - -1999-07-14 Michael Widenius <monty@tik.pp.sci.fi> - -* changed name of temporary table to include getpid(). -* Added full support for CREATE TEMPORARY - -1999-07-04 Michael Widenius <monty@monty.pp.sci.fi> - -* Added CREATE TABLE options 'CHECKSUM' and 'PACK_KEYS' -* Added mysqld option --default-table-type -* Added column 'packed' to 'show index' -* Added pack_keys and checksum to show table status - -1999-07-01 Michael Widenius <monty@monty.pp.sci.fi> - -* Release of 3.23.0 -* Show NULL as the default value for AUTO_INCREMENT columns. -* Fixed optimizer bug with tables with only one row. -* Fixed bug when using LOCK TABLES table_name READ; FLUSH TABLES; - -1999-06-30 Michael Widenius <monty@monty.pp.sci.fi> - -* Added use of LIBWRAP (by "Henning P . Schmiedehausen" <hps@tanstaafl.de>) - -1999-06-28 Michael Widenius <monty@monty.pp.sci.fi> - -* Don't allow AUTO_INCREMENT for other than numerical columns -* Using AUTO_INCREMENT will now automaticly make the column NOT NULL. - -1999-06-22 Michael Widenius <monty@tik.pp.sci.fi> - -* Added privilege column to 'show columns' - -1999-07-13 Michael Widenius <monty@tik.pp.sci.fi> - -* Added SQL_BIG_RESULT (SQL_SMALL_RESULT is now default) -* Use the MYISAM UNIQUE constraint to solve SELECT DISTINCT faster. - -1999-06-06 Michael Widenius <monty@monty.pp.sci.fi> - -* Changed most macros in the libmysql library to functions to avoid many - versions of shared libraries. - -1999-05-16 Michael Widenius <monty@tik.pp.sci.fi> - -* Added "Row_type" to SHOW TABLE STATUS. - -1999-05-15 Michael Widenius <monty@monty.pp.sci.fi> - -* Added option IF NOT EXISTS to CREATE TABLE -* Allow creation of CHAR(0) columns. - -1999-05-14 Michael Widenius <monty@monty.pp.sci.fi> - -* Added more error checking of errors from the table handler. - -1999-05-13 Michael Widenius <monty@monty.pp.sci.fi> - -* Added the '<=>' operator which will act as '=' but will return TRUE if both - arguments are NULL. - -1999-05-12 Michael Widenius <monty@monty.pp.sci.fi> - -* The default base for the log, update-log and pid-file name is now - 'hostname' with everything after the first '.' removed. - -1999-05-11 Michael Widenius <monty@monty.pp.sci.fi> - -* Require '%' before format characters in DATE_FORMAT(). -* Add logging of GRANT and SET PASSWORD in the update log. - -1999-05-10 Michael Widenius <monty@monty.pp.sci.fi> - -* Changed LIKE compare to behave as =; This means that 'e' LIKE 'é' is now - true. - -1999-05-10 Michael Widenius <monty@tik.pp.sci.fi> - -* REPLACE now used direct read to find dupplicate row instead of key read; - This makes REPLACE a lot faster. - -1999-05-05 Michael Widenius <monty@tik.pp.sci.fi> - -* New option: CREATE TABLE SELECT .... -* Added syntax for CREATE TEMPORARY TABLE (not yet implemented) - -1999-05-03 Michael Widenius <monty@tik.pp.sci.fi> - -@code{DESCRIBE TABLE} returns a lot of information about the tables - -1999-05-02 Michael Widenius <monty@monty.pp.sci.fi> - -* Added comments to tables -* Added UNIQUE, in CREATE TABLE table_name (col int not null UNIQUE); - -1999-04-29 Michael Widenius <monty@monty.pp.sci.fi> - -* Use auto_increment value provided by MYISAM -* Use key_part statistics if available - -1999-04-28 Michael Widenius <monty@monty.pp.sci.fi> - -* null bits are now stored at start of row instead at the end. - (Now we only need one bit to mark a row deleted) - -* DELAYED is now a reserved words. (because of conflicts from yacc) - -1999-04-20 Michael Widenius <monty@monty.pp.sci.fi> - -* Added patches for DEC_3_2 by "Andrea Suatoni" <and@itaca.it> - -1999-04-19 Jani Tolonen <jani@monty.pp.sci.fi> - -* Added load_file() function - -1999-04-15 Michael Widenius <monty@monty.pp.sci.fi> - -* Added option --skip-show-databases to mysqld. - -1999-04-10 Michael Widenius <monty@monty.pp.sci.fi> - -* set start time when connection. - -1999-04-03 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed problem with 'DELETE FROM TABLE' when table was locked by another - thread. - -1999-04-03 Michael Widenius <monty@monty.pp.sci.fi> - -* Check if rows has changed now also works with BLOB/TEXT. -* Added the INNER JOIN syntax; This made 'INNER' a reserved word. - -1999-04-02 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed problem with 'Host '..' is not allowed to connect to this MySQL - server' after one had inserted a new MySQL user with a GRANT command. - -1999-04-01 Michael Widenius <monty@monty.pp.sci.fi> - -* Added support for netmasks to the hostname in the MySQL tables. - -1999-03-31 Michael Widenius <monty@monty.pp.sci.fi> - -* Changed net.cc to use TCP_NODELAY also on Linux. -* If one compares a NOT NULL DATE/DATETIME column with IS NULL, this - is changed to a compare against 0 to satisfy some ODBC applications. - (By shreeve@uci.edu) - -1999-03-30 Michael Widenius <monty@monty.pp.sci.fi> - -* NULL IN (...) now returns NULL instead of 0. - This will ensure that 'null_column NOT IN (...)' doesn't match NULL values. -* Changed the mysql.db entry to char(60). - -1999-03-16 Michael Widenius <monty@monty.pp.sci.fi> - -* Fix storage of floating point values in TIME columns -* Changed parsing of TIME strings to be more strict. Now the fractional - second part is detected (and currently skipped) - The following formats are supported - [[[DAYS] [H]H:]MM:]SS[.fraction] and [[[[H]H]H]H]MM]SS[.fraction] -* Detect (and ignore) second fraction part from DATETIME - -1999-03-10 Michael Widenius <monty@monty.pp.sci.fi> - -* On Win32 detect --basedir automaticly from path to mysqld. -* Added option --skip-column-names to mysql. -* Added some memory checks in sql_string.cc - -1999-03-08 Michael Widenius <monty@monty.pp.sci.fi> - -* Added the ODBC 3.0 EXTRACT(interval FROM datetime) function -* Added lots of 'out of memory' checks for SELECT statements. - -1999-03-05 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed std() for big tables when result should be 0. - -1999-03-04 Michael Widenius <monty@monty.pp.sci.fi> - -* INSERT DELAYED had some garbage at end in the update log. - -1999-03-03 Michael Widenius <monty@monty.pp.sci.fi> - -* Added a lot of casts in filesort.cc to make it more portable. - -1999-02-28 Michael Widenius <monty@monty.pp.sci.fi> - -* Changed default size of key_buffer to 4M -* Fixed problem with queries that needed temporary tables with blobs. - -1999-02-26 Michael Widenius <monty@monty.pp.sci.fi> - -* Added LOAD DATA [LOW_PRIORITY] INFILE. -* Added option 'flush-time' to force MySQL-Win32 version to flush - the tables once in a while. -* On Linux all process didn't die on shutdown. - -1999-02-18 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed a core dump problem when using --log-update and connecting - without a default database. -* Added more error check if one get an error writing to the log files. - -1999-02-16 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed some configure errors -* If one used @code{LEFT JOIN} on tables that had circular dependencies this - caused mysqld to hang forever. - -1999-02-05 Michael Widenius <monty@monty.pp.sci.fi> - -* Release of 3.22.16 -* mysqladmin processlist could core dump mysqld if a new user logged in. -* DELETE FROM table_name WHERE key_column=column_name didn't find any matching - rows. -* The default index name is now using the same case as the used column name. - -1999-02-03 Michael Widenius <monty@monty.pp.sci.fi> - -* Added the MODIFY attribute to ALTER TABLE (to be compatible with some other - SQL databases) -* Added LIKE to 'show status' - -1999-01-31 Michael Widenius <monty@monty.pp.sci.fi> - -* DATE_ADD(column,...) didn't work. -* INSERT DELAYED could deadlock with status 'upgrading lock' - -1999-01-30 Michael Widenius <monty@monty.pp.sci.fi> - -* Extended item_encrypt() to take longer salt strings than 2 characters. - (for FreeBSD) - -1999-01-26 Michael Widenius <monty@monty.pp.sci.fi> - -* Release of 3.22.15 -* LIKE on binary strings didn't work if one used a multi-byte character set. -* mysqladmin -w will now wait for the server to come up if it's killed. - -Tue Jan 26 00:06:10 1999 Michael Widenius <monty@bitch.pp.sci.fi> - -* Fixed problem with ORDER BY whith 'only index' optimzation when there - where multiple key definitions for an used column. -* GRANT with password didn't update in memory GRANT table before - 'mysqladmin flush' - -1999-01-20 Michael Widenius <monty@monty.pp.sci.fi> - -* Updating BLOB/TEXT through formulas didn't work for short (< 256 char) - strings. -* Changed option --extended_insert-insert to --extended-insert in mysqldump - -1999-01-19 Michael Widenius <monty@monty.pp.sci.fi> - -* Lots of changes to support INSERT DELAYED. - -1999-01-17 Michael Widenius <monty@monty.pp.sci.fi> - -* Changed unpacking of DATE and DATETIME; These are now about 5 times faster. - -1999-01-16 Michael Widenius <monty@monty.pp.sci.fi> - -* DATE_ADD with now() or curdate() reused the same string. -* Added BENCHMARK(loop-count,expression) function to time expressions. - -1999-01-14 Michael Widenius <monty@monty.pp.sci.fi> - -* LEFT JOIN USING (col1,col2) gave an error if one used it with tables - from 2 different databases. -* LOAD DATA LOCAL INFILE didn't work in the unix version because of a missing - file in the sql directory -* Fixed problems with VARCHAR/BLOB on very short rows (< 4 bytes); One - could get error 127 when deleting rows. - -1999-01-13 Michael Widenius <monty@monty.pp.sci.fi> - -* Nicer error messages for table types. -* Changed default number of connections to 100 - -1999-01-11 Michael Widenius <monty@monty.pp.sci.fi> - -* When one did a GRANT on a new host mysqld could die on the first connect - from this host. -* Use as default bigger buffers when using 'load data infile'. - -1999-01-06 Michael Widenius <monty@monty.pp.sci.fi> - -* All blob pointers have now reserved 8 bytes in the .frm files; This makes - the .frm files portable to 64 bit architectures. - -* DECIMAL(x,y) now works according to ANSI SQL. - -1998-12-30 Michael Widenius <monty@monty.pp.sci.fi> - -* If one used ORDER BY on column name that was the same name as an alias, - the ORDER BY was done on the alias. - -1998-12-29 Michael Widenius <monty@monty.pp.sci.fi> - -* Added aggregate UDF functions. Thanks to - Andreas F. Bobak <bobak@relog.ch> for this ! - -1998-12-28 Michael Widenius <monty@monty.pp.sci.fi> - -* Changed sql_crypt() a bit to make it a bit more secure; This will make old - string stored with the old decrypt() function unreadable! - -1998-12-27 Michael Widenius <monty@monty.pp.sci.fi> - -* Allow empty arguments to mysqld to make it easier to start it - from shell scripts! - -1998-12-23 Michael Widenius <monty@monty.pp.sci.fi> - -* last_insert_id() is now updated for INSERT INTO ... SELECT -* Setting a TIMESTAMP column to NULL didn't record the timestamp - value in the update log. - -1998-12-21 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed lock handler bug when one did: - INSERT INTO TABLE ... SELECT ... GROUP BY. -* Added a patch for localtime_r() on Win32 that it will not crash anymore - if your date is > 2039, but instead it will return a time of all zero. -* UDF function names are not longer case sensitive. -* Added escape of '^Z' to \Z as ^Z doesn't work with pipes on Win32 -* Changed optimizer to not use 'range search' in some cases. -* Changed optimizer to use result form 'check_range' in optimization of - searching of part keys. - -1998-12-16 Michael Widenius <monty@monty.pp.sci.fi> - -* SELECT COUNT(*) didn't work on LEFT JOIN queries with only had expressions - in the ON part and there where no WHERE clause. -* Added optional support for crypted frm files. - -1998-12-13 Michael Widenius <monty@monty.pp.sci.fi> - -* Saving NOW(), CURDATE() or CURTIME() directly in a column didn't work. -* SELECT COUNT(*) didn't work on LEFT JOIN queries with only had expressions - in the ON part and no WHERE clause. - -1998-12-09 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed a bug in sql_list.h that made ALTER TABLE dump a core in some context. - -1998-12-08 Michael Widenius <monty@monty.pp.sci.fi> - -* Allow use of negative real numbers without a decimal point. -* day number is now adjusted to max days in month if the resulting month - after DATE_ADD/DATE_SUB() doesn't have enough days. - -1998-12-07 Michael Widenius <monty@monty.pp.sci.fi> - -* Fix that GRANT compares columns case insensitive. -* Add / to TMPDIR if needed. - -1998-12-06 Michael Widenius <monty@monty.pp.sci.fi> - -* Allow GLOBAL as a table or database name. - -Thu Dec 3 10:29:11 1998 Michael Widenius <monty@tik> - -* Added option SQL_SMALL_RESULT to SELECT to force use of fast temporary - tables when one knows that the result set will be small! - -1998-11-27 Michael Widenius <monty@monty.pp.sci.fi> - -* The hostname in user@hostname can now include '.' and '-' without quotes. - -1998-11-26 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed problem when using DATE_ADD()/DATE_SUB() in a WHERE clause. -* One can now set the password for a user with the - GRANT ... user IDENTIFIED BY 'password' syntax. -* Fixed bug in GRANT checking with SELECT on many tables. -* Removed some 'no Database selected' errors. -* Release of 3.22.11 - -1998-11-21 Michael Widenius <monty@monty.pp.sci.fi> - -* Changed USER() to return user@host -* New command: FLUSH STATUS ; to reset most status variables. -* New status variables: aborted_threads and aborted_connects. - -1998-11-20 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed bug in ORDER BY on FIELD() -* New function make_set() (70% by Jani Tolonen) - -1998-11-18 Michael Widenius <monty@monty.pp.sci.fi> - -* Added functions encrypt() and decrypt(). Because of endspace stripping of - CHAR() and VARCHAR() these should only be used with fixed size strings or - with BLOB/TEXT columns. - -1998-11-17 Michael Widenius <monty@monty.pp.sci.fi> - -* Silently remove DEFAULT values from AUTO_INCREMENT columns. -* Added new variable to mysqld: connection_timeout - -1998-11-13 Michael Widenius <monty@monty.pp.sci.fi> - -* Better error message when table doesn't exists. - -1998-11-12 Michael Widenius <monty@monty.pp.sci.fi> - -* Added option SET SQL_WARNINGS=1 to get a warning count also for simple - inserts. -* IS NULL on a AUTO_INCREMENT column in a LEFT JOIN didn't work. -* MySQL now uses SIGTERM instead of SIGQUIT with shutdown to work better - on FreeBSD. -* Added option \G (print vertically) to mysql -* SELECT HIGH_PRIORITY ... killed mysqld. - -1998-11-11 Michael Widenius <monty@monty.pp.sci.fi> - -* Added grant checking to 'show tables' -* Large changes to get grants integrated with the current privilege system. - -1998-11-10 Michael Widenius <monty@monty.pp.sci.fi> - -* SELECT .. WHERE t1.id1=t2.id2 could fail if t1.id1 and t1.id2 was keys - and of radically differently types. -* Changed get_password to use getpass function. (Patch by Jaromir - Dolecek <dolecek@ics.muni.cz>) - -1998-11-04 Michael Widenius <monty@analytik> - -* Release of 3.22.10 -* Changed +, - (sign and minus), *, /, % and ABS() to be BIGINT aware. -* ALTER TABLE and UPDATE now writes out the values of any duplicated keys. - -1998-11-03 Michael Widenius <monty@monty.pp.sci.fi> - -* ADABASD like INSERT statement: - INSERT INTO table_name SET column=value,column=value... -* The client flag option 'CLIENT_IGNORE_SPACE' didn't work properly. -* Fixed bug in ALTER TABLE that caused a core dump. -* Added optimization of SELECT ... FROM table ORDER BY key_part1 LIMIT ... - This query will now use indexes instead of sorting the table. - -Mon Nov 2 20:52:15 1998 Jani Tolonen <jani@bitch.pp.sci.fi> - -* Added more variables to SHOW STATUS and changed format of output -* Added command extended-status to mysqladmin which will show the - new status - -1998-10-30 Michael Widenius <monty@monty.pp.sci.fi> - -* columns of type date, date_time and 'set' are now stored a little - more efficient if they are 0, NULL or ''. - -1998-10-26 Michael Widenius <monty@monty.pp.sci.fi> - -* Most errors are now printed through sql_write_error() which will add - date, time and thread id to the .err log. - -1998-10-25 Michael Widenius <monty@monty.pp.sci.fi> - -* Added option MYSQL_INIT_COMMAND to mysql_options() to make a query - on connect or reconnect. -* Added option MYSQL_READ_DEFAULT_FILE and MYSQL_READ_DEFAULT_GROUP to - mysql_option() to read the following parameters from the my.cnf file: - "port", "socket", "compress", "password", "pipe", "timeout", "user", - "init-command", "host" and "database" - -* Added maybe_null to the UDF structure - -1998-10-22 Michael Widenius <monty@monty.pp.sci.fi> - -* Added IGNORE to INSERT with many rows. -* Added SQL GRANT commands -* Release of 3.22.9 - -1998-10-18 Michael Widenius <monty@monty.pp.sci.fi> - -* One can new set the last_insert_id() value in an update with - LAST_INSERT_ID(expr). This makes it possible to return a value for things - like: - UPDATE table SET COUNT=LAST_INSERT_ID(COUNT+1) WHERE primary_key_col=# -* display key name used by 'range' in the 'key' column in 'show processlist' -* new SQL command: FLUSH [ TABLES | HOSTS | LOGS | PRIVILEGES ] [, ...] -* new SQL command: KILL thread_id - -Thu Oct 15 18:57:15 1998 Michael Widenius <monty@tik> - -* Reuse memory for identical set and enum fields. - -1998-10-14 Michael Widenius <monty@analytik> - -* Added open file information to mysqladmin debug -* Fixed conversion problem when using ALTER TABLE from a INT to a short CHAR() - column. -* Added 'SELECT HIGH_PRIORITY'; This will get a lock for the SELECT even if - there is a thread waiting another SELECT to get a WRITE LOCK. - NOTE: This makes HIGH_PRIORITY a reserved word - -1998-10-12 Michael Widenius <monty@analytik> - -* Moved wild_compare to string class to be able to use LIKE on BLOB/TEXT columns with \0 -* Added ESCAPE option to LIKE - -1998-10-08 Michael Widenius <monty@monty.pp.sci.fi> - -* Update for AIX: Added a cast to all bzero() calls and changed to use - my_gethostbyname_r instead of gethostbyname_r. - -1998-10-03 Michael Widenius <monty@monty.pp.sci.fi> - -* Release of 3.22.8 -* Added an extra thread signal loop on shutdown to avoid some error messages - from the client. -* MySQL now uses the next available number as extension for the update - log file. - -1998-09-25 Michael Widenius <monty@monty.pp.sci.fi> - -* MySQL clients on NT will now by default first try to connect with named pipes - and after this with TCP/IP. - -1998-09-24 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed problems with TIME columns and negative strings. -* Added a new column 'state' to 'mysqladmin proc' that gives some - information what the thread is doing. - -* DATE_ADD() and DATE_SUB() didn't work with group functions. - -1998-09-23 Michael Widenius <monty@monty.pp.sci.fi> - -* 'mysql' will now also try to reconnect on 'use database' commands. - -* Fix problem with ORDER BY and LEFT JOIN and const tables. - -1998-09-22 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed problem with ORDER BY if the first ORDER BY column was a key and - the rest wasn't. - -1998-09-17 Michael Widenius <monty@monty.pp.sci.fi> - -* Release of 3.22.7 -* OPTIMIZE TABLE table_name can now be used to reclaim disk space - after many deletes. This uses currently ALTER TABLE to re-generate - the table, but in the future it will use an integrated isamchk - for more speed. - -1998-09-16 Michael Widenius <monty@monty.pp.sci.fi> - -* Added functions for perfect hashing of symbols. Moved some other things - to the LEX structure for faster setup. -* Changed libmysql.dll on Win32 to use TLS to get better multi-threading - -1998-09-15 Michael Widenius <monty@monty.pp.sci.fi> -* Added --where to mysqldump (patch by Jim Faucette). -* Fixed slow UPDATE/DELETE when using DATETIME or DATE keys. - -1998-09-14 Michael Widenius <monty@monty.pp.sci.fi> - -* Changed some optimizations parameters to make better joins. -* Anyone can now use 'mysqladmin proc' to check ones own - threads. Only users with the 'Process_priv' privilege can get - information about all threads. -* Fixed very unlikely optimizer bug in the range optimizer - (bug introduced in 3.22.6) -* Added handling of formats YYMMDD, YYYYMMDD, YYMMDDHHMMSS to - DATETIME/TIMESTAMP when using numbers. (Before these formats only worked - with strings). - -1998-09-06 Michael Widenius <monty@monty.pp.sci.fi> - -* Added connect option CLIENT_IGNORE_SPACE to allow one to use - space after the function name and before '(' (Powerbuilder requires this). - This will make all function names reserved words. -* comments that start with /*! are now interpreted as commands. This feature - allows one to use MySQL extensions like: - 'SELECT /*! STRAIGHT_JOIN */ * from table1,table1' - in a portable manor. - -1998-09-04 Michael Widenius <monty@analytik> - -* Added SET OPTION INSERT_ID=# to force use of specific INSERT_ID. This is - usable with new --log-long-format option. - -1998-08-31 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed problem when INSERTING into TIME fields. - -1998-08-29 Michael Widenius <monty@monty.pp.sci.fi> - -* Added key cache and handler statistic to 'mysqladmin debug'. -* changed UPDATE and DELETE to not use 'index only' range detection. - (Fixed slow update_key in the benchmarks) -* Changed the insert benchmark because it was impossible to use it with - postgreSQL (to slow). - -Thu Aug 27 15:38:23 1998 Michael Widenius <monty@bitch.pp.sci.fi> - -* mysqldump will automaticly use LOAD DATA LOCAL INFILE if one uses - an TCP/IP connection. - -1998-08-27 Michael Widenius <monty@monty.pp.sci.fi> - -* Added support of local files with LOAD DATA LOCAL INFILE .. -* Save history if one kills mysql with ^C. Save history in MYSQL_HISTFILE. - Modfied patch by Tommy Larsen <tommy@mix.hive.no> - -1998-08-26 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed a possible problem with mysql_refresh(). - -Tue Aug 18 14:07:53 1998 Michael Widenius <monty@bitch.pp.sci.fi> - -* Give an error for queries that mix GROUP columns and fields when there - is no GROUP BY specification. - -1998-08-17 Michael Widenius <monty@monty.pp.sci.fi> - -* Changed sql_yacc.yy to allow field attributes in any order. - -1998-08-15 Michael Widenius <monty@monty.pp.sci.fi> - -* Increased max_allowed_packed to 1M as default. -* LOAD DATA INFILE didn't copy single field separators in some case: - "Hello"Atif"!" - -1998-08-13 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed fatal bug in lpad(). - -Thu Aug 13 01:00:44 1998 Michael Widenius <monty@bitch.pp.sci.fi> - -* REGEXP can now take a expression as the second argument. - -1998-08-12 Michael Widenius <monty@monty.pp.sci.fi> - -* Changed LIKE to be faster in some cases with many '%': LIKE '%c%ompiler%' - -1998-08-11 Michael Widenius <monty@monty.pp.sci.fi> - -* All table lock handing is changed to avoid some very subtitle - deadlocks when using DROP TABLE, ALTER TABLE, DELETE FROM TABLE and - mysqladmin flush-tables under heavy usage. - -1998-08-10 Michael Widenius <monty@monty.pp.sci.fi> - -* Allow one to use the syntax 'CONSTRAINT symbol' before FOREIGN KEY. -* new mysqld option '--low-priority-insert' to give inserts lower priority - than selects. -* One can now use {INSERT | REPLACE} LOW_PRIORITY INTO ... - One side effect is that LOW_PRIORITY is now a reserved word :( -* Changed locking code to get better handling of locks of different types. - -1998-08-09 Michael Widenius <monty@monty.pp.sci.fi> - -* mysqld will now ignore trailing ';' characters in queries. This is to - make it easier to emigrate from some other SQL servers that require the - end ';' -* One can now use a LIMIT value with DELETE to make it return after deleting - a given number of rows. -* Fix for corrupted output of fixed format and SELECT INTO OUTFILE: - select * from test into outfile "/tmp/test.txt" fields terminated by '' enclosed by '' - -1998-08-04 Michael Widenius <monty@monty.pp.sci.fi> - -* new mysqld option: '-O max_connect_errors=#'. - Connect errors are now reset for each correct connection. -* Add support for INSERT INTO table ... VALUES(...),(...),(...) - -1998-08-03 Michael Widenius <monty@monty.pp.sci.fi> - -* Added Oracle GREATEST() and LEAST() functions. One must now use - these instead if the MAX() and MIN() functions to get the biggest/smallest - value from a list of values. These can now handle real, bigint and - string values. -* The following query now uses indexing instead of sorting the table: - SELECT ... FROM table ORDER BY key_part1 desc,key_part2 desc,... -* Added check that the error message file has enough error messages. -* DAYOFWEEK() had offset 0 for Sunday. Changed the offset to 1. - -1998-08-02 Michael Widenius <monty@monty.pp.sci.fi> - -* new option to mysql: '--vertical' to print results in vertical mode. -* All count structures in the client (affected_rows, insert_id...) are now of - type BIGINT to allow one to use 64 bit values. - This required a minor change in the MySQL protocol which may affect - old clients when using tables with auto_increment values > 24M. -* The return type of mysql_fetch_lengths() has changed from uint * - to ulong *. This may give a warning for old clients but should work - on most machines. - -Thu Jul 30 15:29:05 1998 Michael Widenius <monty@tik> - -* COUNT(), STD() and AVG() are extended to handle more than 4G rows. - -Wed Jul 29 10:36:05 1998 Michael Widenius <monty@tik> - -* Added new option: - SET OPTION SQL_LOG_UPDATE=[0,1] to allow users with process_priv - privilege to bypass the update log. - (Modified patch from Sergey A Mukhin <violet@rosnet.net>) - -Thu Jul 23 15:58:13 1998 Michael Widenius <monty@tik> - -* Initialize line buffer in mysql.cc to make blob readings from pipes safer. - -Tue Jul 21 22:04:43 1998 Michael Widenius <monty@tik> - -* One can now store -838:59:59 <= x <= 838:59:59 in a TIME column. -* TIME_TO_SEC() and SEC_TO_TIME() can now handle negative times and hours - up to 32767. - -Mon Jul 20 20:34:33 1998 Michael Widenius <monty@tik> - -* Change mysys/dbug to allocate all thread varibles in one struct. - This makes it easier to make a threaded libmysql.dll - -Sun Jul 19 12:54:45 1998 Michael Widenius <monty@tik> - -* Changed ALTER TABLE to make it more multi-thread safe. -* normal INSERT INTO TABLE are now also cached when used with - LOCK TABLES. (previously only INSERT ... SELECT and LOAD DATA INFILE - was cached) - -Fri Jul 17 20:53:23 1998 Michael Widenius <monty@tik> - -* Allow group functions with HAVING: - SELECT col FROM table GROUP BY col HAVING COUNT(*)>0; - -Tue Jul 14 15:11:52 1998 Michael Widenius <monty@tik> - -* Use the result from 'gethostname' as the name for pid files - (instead of uname()). - -Sun Jul 12 12:38:45 1998 Michael Widenius <monty@tik> - -* Index only optimization; Some queries are now resolved using - only indexes. Until MySQL 4.0 this works only for number columns. - - SELECT key_part1,key_part2 FROM table WHERE key_part1=# - SELECT COUNT(*) FROM table WHERE key_part1=# and key_part2=# - SELECT key_part2 FROM table GROUP BY key_part1; - SELECT * FROM table ORDER BY key_part2; - -1998-07-07 Michael Widenius <monty@monty.pp.sci.fi> - -* Added function DATE_ADD() and DATE_SUB() - -1998-07-06 Michael Widenius <monty@monty.pp.sci.fi> - -* Added function SUBSTRING() with 2 arguments. - -1998-07-05 Michael Widenius <monty@monty.pp.sci.fi> - -* Added optimization to remove const reference tables from ORDER BY and - GROUP BY. -* Allow '$' in table and column names. - -1998-07-04 Michael Widenius <monty@monty.pp.sci.fi> - -* new option --tmpdir for mysqld. - -1998-07-03 Michael Widenius <monty@monty.pp.sci.fi> - -* MySQL now automaticly changes a query from an ODBC client: - SELECT ... from table WHERE auto_increment_column IS NULL - to - SELECT ... from table WHERE auto_increment_column == LAST_INSERT_ID(). - This allows some ODBC programs (Delphi, Access) to retrieve the newly - inserted row to fetch the auto_increment id. -* Drop table now waits for all users to free a table before deleting it - -1998-07-02 Michael Widenius <monty@monty.pp.sci.fi> - -* New functions: BIN(), HEX() and CONV() for converting between different - number bases. - -1998-07-01 Michael Widenius <monty@monty.pp.sci.fi> - -* If one created a table with smaller record length than 5, one couldn't - delete rows from this table -* mysqld now automaticly disables system locking on Linux, Win32 and if - one uses MIT-threads. One can force the use of locking by doing: - --enable-locking. -* Added new mysqld option --console, to force a console window (for error - messages) when using Win32. -* Removed a useless check in the ISAM delete code; Delete should now be - a bit faster. - -1998-06-28 Michael Widenius <monty@monty.pp.sci.fi> - -* Release of MySQL 3.22.3 -* New flag to mysqld: --one-thread for debugging with linuxthreads (or glibc) - -1998-06-27 Michael Widenius <monty@monty.pp.sci.fi> - -* Added the LEX structure to THD to get a bit more speed. -* Added DROP TABLE IF EXISTS to not get an error if the table doesn't exists. -* IF and EXISTS are now reserved words (they would have to be sooner or later) - -1998-06-26 Michael Widenius <monty@monty.pp.sci.fi> - -* Added lots of new options to mysqldump. - -Wed Jun 24 23:33:35 1998 Michael Widenius <monty@tik> - -* Server error messages are now in mysqld_errror.h -* Added compression server/client protocol. (By Sinisa). - -1998-06-22 Michael Widenius <monty@monty.pp.sci.fi> - -* New functions: <<, >>, rpad() and lpad(). -* Fixed a core-dump bug in the range optimizer. - -Fri Jun 19 01:51:09 1998 Michael Widenius <monty@tik> - -* One can now save default options (like passwords) in a config file (my.cnf). - -1998-06-17 Michael Widenius <monty@monty.pp.sci.fi> - -* searching on multiple constant keys that matched > 30 % of the rows didn't - always use the best possible key. - -1998-06-16 Michael Widenius <monty@monty.pp.sci.fi> - -* Lot's of small changes to get ORDER BY to work when no records are found - when using fields that are not in GROUP BY (MySQL extension) -* Added new option --chroot to mysqld to start mysqld in a chroot environment - (by Nikki Chumakov <nikkic@cityline.ru>) - -1998-06-15 Michael Widenius <monty@monty.pp.sci.fi> - -* Add option --one-database to mysql to only update one database - from a update log. - -1998-06-13 Michael Widenius <monty@monty.pp.sci.fi> - -* end space is now ignored when comparing case sensitive strings; - This should fix some problems with ODBC! -* mysql_free_result() now automaticly handles a mysql_use_result() set that - is not completely read. - -1998-06-10 Michael Widenius <monty@monty.pp.sci.fi> - -* Release of MySQL 3.22.1 -* Fixed problems with date_format() and wrong dates. -* enum() and set() columns was compared binary; Changed to be case insensitive. - -1998-06-08 Michael Widenius <monty@monty.pp.sci.fi> - -* Added new API functions: mysql_init() and mysql_options(). - One MUST now call mysql_init() before one calls mysql_real_connect(). - One doesn't have to call mysql_init if one only calls mysql_connect(). -* LEFT JOIN core dumped if the second table is used with a constant - WHERE/ON expression with uniquely identifies one record. - -1998-06-07 Michael Widenius <monty@monty.pp.sci.fi> - -* Range optimizer is not used anymore when comparing a string column - to a number. This will make such compares slower but safer. - -Sun Jun 7 04:47:14 1998 Michael Widenius <monty@tik> - -* UPDATE now returns a update information about how many rows was - matched, updated and if one got any 'warnings' when doing the update. - -Sat Jun 6 22:58:02 1998 Michael Widenius <monty@tik> - -* Fixed wrong result from 'format(-100,2)'. - -1998-06-06 Michael Widenius <monty@monty.pp.sci.fi> - -* Added new C-API function: mysql_ping(). -* Added options AFTER column and FIRST to ALTER TABLE ... ADD columns. - This makes is possible to add a new column at some specific location - in an old table. -* Fixed problem with find_in_set(). - -1998-05-18 Michael Widenius <monty@analytik> - -* Added new API function: mysql_ping(). - -1998-05-15 Michael Widenius <monty@monty.pp.sci.fi> - -* WEEK() now takes an optional argument to allow handling of weeks when the - first day of the week = Sunday (default or 0) or Monday ( extra argument is - 1). WEEK() now returns the week number in the range 0-53 for the used - year. - -1998-05-13 Michael Widenius <monty@monty.pp.sci.fi> - -* Added flag -T32 to mysqld for running all queries under the main thread. - This makes it possible to debug mysqld under Linux with gdb! - (This is now called --one-thread) - -1998-05-12 Michael Widenius <monty@monty.pp.sci.fi> - -* Added optimization of 'not_null_column IS NULL' (needed for some Access - queries) -* Made all time functions 'more streamlined'. - -1998-05-09 Michael Widenius <monty@monty.pp.sci.fi> - -* Allow one to use STRAIGHT_JOIN between two tables to force the optimizer - to join them in a specific order. - -Fri May 8 02:35:00 1998 Michael Widenius <monty@bitch.pp.sci.fi> - -* Added SET OPTION PASSWORD='new_crypted_password' and - SET OPTION PASSWORD= 'host' : 'user' : 'new_password'. The last version - only works for users with write access to the mysql database. - One can also use: SET OPTION PASSWORD=PASSWORD("new_password"); - -Tue May 5 14:41:47 1998 Michael Widenius <monty@bitch.pp.sci.fi> - -* String functions now return VARCHAR() instead of CHAR() and - the column type is now VARCHAR() for fields saved as VARCHAR(). - This should make the MyODBC driver better, but may break some old - MySQL clients that doesn't handle FIELD_TYPE_VARCHAR identical as - FIELD_TYPE_CHAR. - -Mon May 4 00:33:27 1998 Michael Widenius <monty@bitch.pp.sci.fi> - -* Added BOOL as a synonym for BIT and DISTINCTROW as a synonym for DISTINCT. -* CREATE INDEX and DROP INDEX are now implemented trough ALTER TABLE. - CREATE TABLE is still the recommended (fast) way to create indexes. -* Added option SET OPTION PASSWORD='new_password'. - mysqladmin can now be used by not anonymous users to change their - password. - -Sun May 3 18:47:24 1998 Michael Widenius <monty@bitch.pp.sci.fi> - -* Added option wait_timeout to mysqld. - -Sat Apr 18 14:14:23 1998 Michael Widenius <monty@bitch.pp.sci.fi> - -* Added hashing of fieldnames for tables with many fields. -* The most frequently used string functions are now in assembler (Linux-intel). - -Thu Apr 16 16:14:14 1998 Michael Widenius <monty@bitch.pp.sci.fi> - -* Added quick checking if ok host. -* Changed the interface for field->val_str() to better use stack buffers. - -Thu Apr 9 20:02:26 1998 Michael Widenius <monty@bitch.pp.sci.fi> - -* One can now reference to tables in different databases with: - table@database or database.table -* Added cacheing of users & access rights (for faster access rights checking) - -1998-04-08 Michael Widenius <monty@monty.pp.sci.fi> - -* Save of command line history to file in mysql client. - by Tommy Larsen <tommy@mix.hive.no> - -1998-04-07 Michael Widenius <monty@monty.pp.sci.fi> - -* Added time column to 'mysqladmin processes' to show how long a query - has taken or how long a thread has sleeped. - -1998-04-06 Michael Widenius <monty@monty.pp.sci.fi> - -* 'show variables' now gives the correct path for 'datadir'. -* Added logging and update_log to "show variables" - -1998-03-29 Michael Widenius <monty@analytik> - -* Added new type: YEAR. YEAR is stored on 1 byte with range 0, 1901-2155. -* Added new DATE type that is stored on 3 bytes instead of 4. All new - tables will created with the new date type if one doesn't use - --old-protocol. -* Fixed bug in record caches; One could get 'Error from table handler: #' - on some OS from some queries. - -1998-03-27 Michael Widenius <monty@monty.pp.sci.fi> - -* mysql (the command line tool) striped start space from new rows. - -1998-03-25 Michael Widenius <monty@monty.pp.sci.fi> - -* Added user level locks: GET_LOCK(string,timeout), RELEASE_LOCK(string) -* Fixed bug in range optimizer when using: - WHERE key_part_1 >= something and key_part_2 <= something_else -* Changed connect timeout to 3 seconds to make it somewhat harder - for crackers to kill mysqld trough telnet + TCP/IP. - -1998-03-24 Michael Widenius <monty@monty.pp.sci.fi> - -* new mysqld option --big-selects: - Allow big result sets by saving all temporary sets on file. - (Solves most 'table full' errors) - -1998-03-21 Michael Widenius <monty@monty.pp.sci.fi> - -* WHERE with string-column-key = constant-string didn't always find all rows - if the column had many values differing only with characters of the same sort - value (like e and é). -* Added opened_tables to 'show status'. -* Strings keys looked up with 'ref' was not compared case sensitively. -* Added flag '--big-selects' to avoid 'Table is full' errors. - Using this will slow down some queries thought. -* Added umask() to make log_files non-readable for normal users. -* Fixed some odd cases with queries that uses group functions where - the WHERE or HAVING didn't match anything. -* Ignore users with old password (8 byte) on startup if not using - --old-protocol. -* Changed name of the sql_memory allocation system and moved this to - the mysys library. - -1998-03-17 Michael Widenius <monty@monty.pp.sci.fi> - -* Added use of current_date, current_time and current_timestamp functions - without (). This automaticly made these reservered words :( - -Tue Mar 10 12:34:50 1998 Michael Widenius <monty@monty.pp.sci.fi> - -* Changed mysql_real_connect() to include possible db for faster connection - to a new db. -* select which matched all key fields returned the values in the same - case as the matched values instead of the found values. -* Release of 3.21.26 -* In DATE_FORMAT() PM and AM was swapped for hours 00 and 12. - -Mon Mar 9 14:15:00 1998 Michael Widenius <monty@monty.pp.sci.fi> - -* Added some tests to the table order optimizer to get some cases with - 'SELECT ... FROM many_tables' much faster. -* Added a retry loop around accept() to possible fix some problems on some - Linux machines. - -Fri Mar 6 01:18:47 1998 Michael Widenius <monty@monty.pp.sci.fi> - -* from_days(0) now returns "0000-00-00" -* Enchanted mysql_connect protocol to allow one to specify database - on connection. This will make MySQL twice as fast to connect to a database - for new clients. - -Thu Mar 5 18:09:45 1998 Michael Widenius <monty@monty.pp.sci.fi> - -* Updated record_cache code to be aligned for more speed. -* New tests to crash-me -* Extended the default max key size to 256. - -Wed Mar 4 00:02:16 1998 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed bug when using BLOB/TEXT in GROUP BY with many tables. - -Mon Mar 2 18:58:10 1998 Michael Widenius <monty@monty.pp.sci.fi> - -* A enum field that is not declared NOT NULL has NULL as default value. - (Before the default value was the first enum option) - -Tue Feb 24 20:11:30 1998 Michael Widenius <monty@monty.pp.sci.fi> - -* Fixed bug in the join optimizer code when using many part keys - on the same key: INDEX (Organisation,Surname(35),Initials(35)). - -Mon Feb 23 16:15:39 1998 Michael Widenius <monty@monty.pp.sci.fi> - -* One can now kill threads that are waiting for 'disk full'. -* Fixed some problems with UDF functions. -* ALTER TABLE + IGNORE now returns right number of affected rows. -* Fixed a bug when using 8 bytes long (alpha); filesort() didn't work. - Affects DISTINCT, ORDER BY and GROUP BY on 64 bit processors. - -Sat Feb 21 15:36:48 1998 Michael Widenius <monty@monty.pp.sci.fi> - -* Changed typedef string to my_string because of C++ new string class. -* now one can kill threads that's are waiting on 'disk full'. - -Fri Feb 13 23:19:23 1998 Michael Widenius <monty@monty.pp.sci.fi> - -* Release of MySQL 3.21.24 -* Fixed problem with LEFT JOIN and constant expressions in the ON part. - -Thu Feb 12 02:54:57 1998 Michael Widenius <monty@monty.pp.sci.fi> - -* Added much more descriptive error messages to mysqladmin if connect failed. -* Dynamic loadable functions. Based on source from: - Alexis Mikhailov <root@medinf.chuvashia.su> - -Thu Feb 5 15:19:14 1998 <monty@monty.pp.sci.fi> - -* One couldn't delete from a table if no one had done a select on the table. -* Fixed problem with range optimizer which many OR's on key parts inside - each other. - -Tue Feb 3 14:34:32 1998 <monty@monty.pp.sci.fi> - -* Changed default umask for new files from 0664 to 0660. - -Fri Jan 30 23:58:19 1998 <monty@monty.pp.sci.fi> - -* Release of MySQL 3.21.23 -* Changed ALTER TABLE to work with WIN32 (Win32 can't rename open files) - -Thu Jan 29 20:37:50 1998 <monty@monty.pp.sci.fi> - -* Fixed that the following symbols are not reserved words: - TIME DATE TIMESTAMP TEXT BIT ENUM NO ACTION CHECK YEAR MONTH DAY HOUR - MINUTE SECOND STATUS VARIABLES. -* Changed string handling in sql_yacc.yy and sql_lex.cc to be faster. -* Setting a TIMSTAMP to NULL in LOAD DATA INFILE... didn't set the current - time for the TIMESTAMP. -* Fixed that key conversions are tested in the WHERE clause -* LOAD DATA INFILE .... REPLACE INTO ... had wrong 'skipped' count - -Tue Jan 27 15:24:50 1998 <monty@monty.pp.sci.fi> - -* Added switch --skip-thread-prior for systems where mysqld's thread - scheduling doesn't work properly. At least BSDI 3.1 works better with - this! -* Added ODBC functions DAYNAME() and MONTHNAME(). -* Fixed unlikely(?) key optimizer bug when using ORs inside ANDs. - -Sat Jan 24 03:35:46 1998 <monty@monty.pp.sci.fi> - -* Release of 3.21.22 -* Added support of 'long constant strings' from ANSI SQL: - select 'first ' 'second'; -> 'first second'; - -Mon Jan 19 17:59:49 1998 <monty@monty.pp.sci.fi> - -* Fixed problem with Russian character set and LIKE. -* Fixed bug in ORDER BY on string formula with possible NULL values. -* Added functions DAYOFYEAR(), DAYOFMONTH(), MONTH(), YEAR(), WEEK(), - QUARTER(), HOUR(), MINUTE(), SECOND() and FIND_IN_SET(). -* Changed weighting, when using many key parts, in join optimizer to avoid - full joins for a couple of cases. - -Sun Jan 18 21:16:06 1998 <monty@monty.pp.sci.fi> - -* Removed that NULL = NULL is true. Now one must use IS NULL or IS NOT NULL - to test if a value is NULL. (This is according to ANSI SQL but may break - old applications that are ported from mSQL) - One can get the old behaviour by compiling with -DmSQL_COMPLIANT -* Fix of count(*) problems when the WHERE clause didn't match any records. -* Added function DAYOFMONTH() - -1998-01-14 Michael Widenius <monty@analytik> - -* Fixed mysqladmin.c to display only the used socket or TCP/IP port. - -Mon Jan 12 19:32:31 1998 <monty@monty.pp.sci.fi> - -* Changed SHOW FIELDS to return NULL as default value for TIMESTAMP - (This removes the DEFAULT "" entry for timestamps in mysqldump) -* Release of MySQL 3.21.21 -* Added commands SHOW STATUS and SHOW VARIABLES. -* Fixed optimizer bug when using - 'WHERE data_field=date_field2 and date_field2=constant' - -Sun Jan 11 05:07:59 1998 <monty@monty.pp.sci.fi> - -* Release of MySQL 3.21.20 -* Added long comments to MySQL /* */ -* Changed lex parsing to be a bit faster in some cases. - -Sat Jan 10 15:17:44 1998 <monty@monty.pp.sci.fi> - -* Fixed bug when using SELECT DISTINCT + NULL values. - -Fri Jan 9 16:45:26 1998 <monty@monty.pp.sci.fi> - -* Changed maximum table name and column name lengths from 32 to 64. -* Aliases can now be of 'any' length. - -Thu Jan 8 02:28:11 1998 <monty@monty.pp.sci.fi> - -* Now one gets an error if one tries to create an INDEX or UNIQUE - on a column that allows NULL values. (Before the column was silently - made NOT NULL). - -Wed Jan 7 23:19:11 1998 <monty@monty.pp.sci.fi> - -* Changed protocol (downward compatible) to mark if a column - is auto_increment or a timestamp. This is needed for the - new java driver. -* One can now in the clients check if a column is a automatic - TIMESTAMP or a AUTO_INCREMENT field. - -Sun Jan 4 20:10:21 1998 <monty@monty.pp.sci.fi> - -* Added update of big5 by jou@pdlc.ieo.nctu.edu.tw -* Added hebrew sorting order by Zeev Suraski. - -Thu Jan 1 12:57:04 1998 <monty@monty.pp.sci.fi> - -* Release of 3.21.19 -* unique key fields was not marked as unique keys in mysqlshow. -* Added function REVERSE() (by Zeev Suraski) -* Changed ni_range() to fixed a case of slow range searching. - -Wed Dec 31 15:46:25 1997 <monty@monty.pp.sci.fi> - -* Release of 3.21.18a -* Fixed problem with new filesort code from 3.21.18 on Linux - -Mon Dec 29 10:02:24 1997 <monty@monty.pp.sci.fi> - -* Added CROSS JOIN syntax. CROSS is now a reserved word -* USE database was not always written to output log. -* mysqladmin command 'status' doesn't increment 'Questions' anymore. - -Sun Dec 28 13:20:20 1997 <monty@monty.pp.sci.fi> - -* Recoded yacc/bison stack allocation to be even safer and allow MysQL - to handle even bigger expressions. - -Sat Dec 27 15:28:39 1997 <monty@monty.pp.sci.fi> - -* last_insert_id and used timestamp is now written to update log file. - timestamps, calculations with time and LAST_INSERT_ID() will now work - correctly when updating from the update log. - -Fri Dec 26 17:03:14 1997 <monty@monty.pp.sci.fi> - -* Give error message if client C functions are called in wrong order. -* Added automatic reconnect of clients for some cases. - -Mon Dec 22 00:25:34 1997 <monty@monty.pp.sci.fi> - -* Range optimizer didn't solve ranges of type: - key_part1= x AND key_part2 > y. This forced some ORDER BY queries to - do a full table scan when used with where like above. -* Small sort sets doesn't use temporary files anymore. - -Fri Dec 19 16:30:24 1997 <monty@monty.pp.sci.fi> - -* Release of MySQL 3.21.17a -* Fixed problem with compare of binary strings and blobs with ASCII - characters over 127. - -Thu Dec 18 00:33:25 1997 <monty@monty.pp.sci.fi> - -* Fixed core dump in first() when chaning some very specific AND and OR - key columns. -* Fixed lock problem: When freeing a read lock on a table with multiple - read locks, a thread waiting for write lock would have given the lock. - This shouldn't affect data integrity, but could possible make mysqld - to restart if one thread was reading data that another thread modified. -* LIMIT offset,count didn't work in INSERT ... SELECT. - -Wed Dec 17 12:35:11 1997 <monty@monty.pp.sci.fi> - -* optimized key block caching. This will be quicker than the old one when - using bigger key caches. - -Tue Dec 16 23:33:24 1997 <monty@monty.pp.sci.fi> - -* Changed bool to my_bool in some item structures to use less memory. -* Changed optimizer to use array references. This made the code 'nicer' - -Mon Dec 15 17:03:43 1997 <monty@monty.pp.sci.fi> - -* Release of Mysql 3.21.17 -* mysql: Added ouput of line number on errors when running batch. -* SELECT column,SUM(expr) now returns NULL for column when there is no - matching rows. - -Sun Dec 14 14:59:46 1997 <monty@monty.pp.sci.fi> - -* Fixed create problem with fixed length records of exactly 256 bytes. - (One couldn't insert more than 1 record in such a table). - -Fri Dec 12 18:31:32 1997 <monty@monty.pp.sci.fi> - -* Added ODBC and ANSI SQL style LEFT OUTER JOIN. - The following are new reserved words: LEFT, NATURAL, USING -* Changed use of table bits and key bits to use typedefs to make it easy - to extend join tables and keys to 64. -* The client library is now using the environment variable MYSQL_HOST as - the default host if it's defined. - -Wed Dec 10 01:29:11 1997 <monty@monty.pp.sci.fi> - -* Release of 3.21.16a -* Field type SET with 33-55 elements didn't work. -* Release of 3.21.16 -* Fixed bug in ALTER TABLE when copying from DATETIME to TIMESTAMP. - (All TIMESTAMP where set to current time). - -Tue Dec 9 14:53:15 1997 <monty@monty.pp.sci.fi> - -* Added function TIME_TO_SEC() - -Mon Dec 8 09:56:44 1997 <monty@monty.pp.sci.fi> - -* Allow empty strings as default values for BLOB and TEXT to be compatible with - mysqldump. -* Added ODBC 2.0 & 3.0 functions: POWER(), SPACE(), COT(), DEGREES(), RADIANS(), - ROUND(2 arg) and TRUNCATE(). -* Added optional (ignored) argument to CURRENT_TIME() and CURRENT_TIMESTAMP(). -* LOCATE() parameters where swapped according to ODBC standard. Fixed. -* Added detection of all ODBC 3.0 functions to crash-me -* In some cases default values was not used for NOT NULL fields. -* Timestamp wasn't updated in UPDATE SET... if the timestamp was used as - a value or in the WHERE clause. - -Sun Nov 30 04:06:31 1997 <monty@monty.pp.sci.fi> - -* Renamed version.h to mysql_version.h - -Sat Nov 29 10:50:28 1997 <monty@monty.pp.sci.fi> - -* Added dayofweek() for ODBC. -* Allow DATE '1997-01-01', TIME '12:10:10' and TIMESTAMP '1997-01-01 12:10:10' - formats required by ANSI SQL. - This has the unfortunate side-effect that one can't have columns named - DATE, TIME or TIMESTAMP anymore :( -* Changed net_write() to my_net_write() because of name conflict with sybase. -* Added --no-auto-rehash option to mysql. -* Added VARBINARY as synonym for VARCHAR BINARY - -Wed Nov 26 12:53:41 1997 <monty@monty.pp.sci.fi> - -* Added framework for multiple character sorting - -Tue Nov 25 04:03:29 1997 <monty@monty.pp.sci.fi> - -* Added extra client flag to mysql_real_connect to be compatible with - MyODBC. -* Zeev fixed bug in DATE_FORMAT: It forgot to reset the null marker. - -Mon Nov 24 20:19:18 1997 <monty@monty.pp.sci.fi> - -* Fixed problem with wrong result order when using all of - DISTINCT + JOIN + ORDER BY + LIMIT. - -Sun Nov 23 14:29:54 1997 <monty@monty.pp.sci.fi> - -* mysql: edit command now allows one to edit last query in a editor; - (patch by Zeev Suraski) -* Recoded all delete item to avoid use of stack space for deletes. - (For crash-me) -* Added command: SET SQL_LOG_OFF=1 to not log commands to standard log. - This will only affect users with process list privileges. - -Sat Nov 22 13:08:55 1997 <monty@monty.pp.sci.fi> - -* Added stack checking for crash-me :) - The following failed before: select 1+1+1+1+1+.... (687 times) - -Fri Nov 21 01:50:34 1997 <monty@monty.pp.sci.fi> - -* Added new patch for Chinese Big5 code. -* Change that blobs returns the max length for a blob instead of 8192 - to the client as field_length. - -Thu Nov 20 15:37:05 1997 <monty@monty.pp.sci.fi> - -* fixed bug in range-optimizer that crashed mysql on some queries. -* table and column name completion for mysql by - Zeev Suraski and Andi Gutmans -* Fixed problem with queries that didn't find any records: This happens only - when using multiple part keys where the first part is a number and some - other part is a char or varchar. -* Removed some wrong warning messages from range optimizer - -Wed Nov 19 16:41:14 1997 <monty@monty.pp.sci.fi> - -* Added new command REPLACE, which works like INSERT but replaces conflicting - records with the new record. REPLACE INTO TABLE ... SELECT ... works also. -* Added new commands: CREATE DATABASE db_name and DROP DATABASE db_name -* Added RENAME option to ALTER TABLE: ALTER TABLE name RENAME AS new_name - -Sun Nov 16 21:41:32 1997 <monty@monty.pp.sci.fi> - -* The thread stack was overwritten if one tried to create a table with too many - fields (more than 1000). -- Table scanning was a bit slower when using LOCK TABLE xxx WRITE. Fixed. - -Thu Nov 13 03:12:54 1997 <monty@monty.pp.sci.fi> - -* ALTER TABLE forgot BINARY attribute for strings and BLOBS -* Change comparision of strings to integer to compare as floats instead - of as integers. -* Added printing of Access denied errors to log. -* Fixed some not 100% portable typedefs in mysql_com.h -* Added Luuk de Boers defines for interval handling. - This isn't compleat yet. - -Wed Nov 12 00:28:58 1997 <monty@monty.pp.sci.fi> - -* Added automatic removal of 'ODBC function conversions': {fn now() } -* Added new function DATE_FORMAT(date_expr,format). The format string is the - same one that was previously integrated with from_unix_timestamp(). -* Changed from_unix_timestamp() to call function DATE_FORMAT() with format - element. - -Mon Nov 10 18:17:39 1997 <monty@monty.pp.sci.fi> - -* Added flag for stupid ODBC applications (like access) that wants found_rows - instead of affected_rows. -* Added basic functions for handling av ANSI INTERVAL. - -Sat Nov 8 01:20:03 1997 <monty@monty.pp.sci.fi> - -* compare with DATE and TIME with NULL didn't work. (IS NULL worked) -* Added many changes from the Win32 port. -* new function: DATE_ADD_MM(). - -Wed Nov 5 13:10:10 1997 Michael Widenius <monty@analytik> - -* SORTING on calculated DOUBLE values sorted on integer results instead. -* SELECT ... WHERE KEY=constant ORDER BY ... didn't use key to retrieve - records. This was slow because everything was sorted.. -* CHECK isn't a reserved word anymore. - -Mon Nov 3 07:55:47 1997 Michael Widenius <monty@monty.pp.sci.fi> - -* Allow start of mysqld.cc without a current database. -* Changed server version to include -debug and -log if compiled with debugging - and to show that one has a logging enabled. - -Sat Nov 1 13:08:00 1997 <monty@monty.pp.sci.fi> - -* Added missing expression 'NOT IN' -* Changed the place where HAVING should be. According to ANSI it should be - after GROUP BY but before ORDER BY. MySQL 3.20 had it wrongly last. -* Added Sybase command: USE DATABASE to start using another database. -* Fixed core dump when one had a wrong password in the password column. -* Added automatic adjusting of number of connections and table cache size - if the maximum number of files that can be opened are less than needed. - This should fix that mysqld doesn't crash even if one hasn't done a - ulimit -n 256 before starting mysqld. -* Added limit checks for create table. -* Added more checks of different errors from net_read for SCO port. - -Tue Oct 28 14:30:31 1997 <monty@monty.pp.sci.fi> - -* Fixed problem when using big table_caches; MySQL could previously only - open 256 files. - -Mon Oct 27 10:02:19 1997 <monty@monty.pp.sci.fi> - -* Added options LINE STARTING WITH to LOAD DATA INFILE and - SELECT ... into outfile. Now one can do: - - LOAD DATA INFILE '/tmp/syslog.sql' INTO TABLE uptime - FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED by "'" - LINES STARTING WITH 'VALUES (' LINES TERMINATED by ');\n' ignore 100 lines - -and - SELECT * from uptime into outfile '/tmp/syslog2.sql' - FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED by "'" - LINES STARTING WITH 'INSERT INTO uptime VALUES (' LINES TERMINATED by ');\n' - -* Added IGNORE # LINES to LOAD DATA INFILE. - -* Allow \N as a shorthand of NULL in SQL statements. - -Sun Oct 26 11:34:38 1997 <monty@monty.pp.sci.fi> - -* More memory checking. -* Fixed grouping of functions with many from tables. - -Sat Oct 25 01:46:27 1997 <monty@monty.pp.sci.fi> - -* New error message so one can check if the connection was lost while - the command was running or if the connection was down from the start. -* The mysql command tool now does a automatic reconnect if the connection - was lost when it does a query. -* new command: 'mysqladmin debug'. This forces the server to dump out some - useful information to stdout. Currently it prints all lock information. -* Rewrite lexer to be faster and more easy to extend. - -Fri Oct 24 13:57:06 1997 <monty@monty.pp.sci.fi> - -* Fixed bug when like on number key. -* Added --table option to mysql to print in table format. - Moved time and row information after query result. -* Added != as an alias for <>. - -Thu Oct 23 16:00:22 1997 <monty@monty.pp.sci.fi> - -* Added function VERSION() to make easier logs. - -Tue Oct 21 00:09:13 1997 <monty@monty.pp.sci.fi> - -* Relase of 3.21.12 -* Added memory checks to all string functions to return NULL if some - string gets bigger than max_allowed_packet. This is to make MySQL more - secure. -* Fixed core dump bug on range optimizer. -* In some cases doing a join + group + INTO OUTFILE, the result wasn't - grouped. -* Now SQL_BIG_TABLES + DISTINCT is also optimized. -* Changed the syntax of ALTER TABLE ... ALTER COLUMN ident SET DEFAULT ... - (The DEFAULT keyword wasn't allowed or required before). -* Added russian error messages. - -Mon Oct 20 04:10:53 1997 <monty@monty.pp.sci.fi> - -* LIKE with '_' as last character didn't work. Fixed -* Added many error checks for 'end of memory' -* Added ENCRYPT() function by Zeev Suraski. -* Fixed better FOREIGN KEY syntax skipping. - New reserved words: MATCH, FULL, PARTIAL - -Sun Oct 19 23:13:50 1997 <monty@monty.pp.sci.fi> - -* Force .log to logfile-name if one uses hostname as logfile. -* mysqld now allows ip and hostname to the --bind-address option. - -Sat Oct 18 22:02:36 1997 <monty@monty.pp.sci.fi> - -* Added "SET OPTION CHARACTER SET cp1251_koi8" to enable conversions off - data to/from different character sets. Currently cp1251_koi8 is the only - one, but it's now trivial to add others. - Conversions: strings in the query -> intern set - fields and items in result -> terminal set - One can get back to the old one with: - SET OPTION CHARACTER SET DEFAULT -* Lots of changes for Win95 port - -Fri Oct 17 15:29:44 1997 <monty@monty.pp.sci.fi> - -* Changed the create column syntax off NOT NULL to be after the DEFAULT value - as specified in the ANSI SQL standard. This will make mysqldump with - NOT NULL and default values incompatible with MySQL 3.20. -* New reserved words are: BOTH, FOR, LEADING and TRAILING -* Added a lot of function name alias so one can use the functions with - ODBC or ANSI SQL92 syntax. -* Fixed ALTER TABLE person ALTER COLUMN phone SET DEFAULT NULL syntax. -* Added CHAR and BIT as a synonyms for CHAR(1) -* Changed the name if the INTERVAL type to ENUM, because INTERVAL is used in - ANSI SQL. -* Added extended ANSI SQL TRIM() function. -* Added CURTIME(). - -Thu Oct 16 17:26:48 1997 <monty@monty.pp.sci.fi> - -* Fixed core dump when updating as user with only select privilige. - -Wed Oct 15 04:25:47 1997 <monty@monty.pp.sci.fi> - -* INSERT ... SELECT ... GROUP BY didn't work in some cases. On got - 'Invalid use of group function' -* When using LIMIT, SELECT now always uses keys instead of record scan. - This will give better performance on SELECT and a WHERE that matches many - rows. -* Added function last_insert_id() to retreive last auto_increment value. - This is for clients to ODBC that can't use the mysql_insert_id API function. -* Added option '--flush-logs' to mysqladmin. -* Added command 'status' to mysql. -* Moved some messages from libmysql.c to errmsg.c - -Mon Oct 13 18:38:01 1997 <monty@monty.pp.sci.fi> - -* Tested on BSDI 3.0 with the newest pthread library. -* Added new group functions: BIT_OR() and BIT_AND(). -* Added compatibility functions: CHECK, REFERENCES. -* Added BIT as a synonym for CHAR(1) to get better compatibility. -* Added option ALL to GRANT for better compatibility. (GRANT is still - a dummy fuction. -* CHECK is now a reserved word. - -Fri Oct 10 17:01:25 1997 <monty@monty.pp.sci.fi> - -* Added partly translated dutch messages. -* Fixed bug in ORDER BY and GROUP BY with NULL columns - -Thu Oct 9 10:26:47 1997 <monty@monty.pp.sci.fi> - -* Added test of create of table without columns. -* Release of 3.21.10 -* Fixed a couple of bugs in the range optimizer. Now test-select works. - -Tue Sep 30 02:40:42 1997 <monty@monty.pp.sci.fi> - -* Added new function: REPEAT(string,count). -* Added patch of support of Chinese(BIG5). -* Fixed awful slowdown of libmysql.c when configuring using '--with-debug=yes' - This affected all clients that got large results from the server. - (This didn't affect using --quick or mysql_use_result). - -Sun Sep 28 20:59:41 1997 <monty@monty.pp.sci.fi> - -* Made a new function: mysql_real_connect, that takes two extra arguments: - port and socket to use on connection. -* Added text types: TINYTEXT, TEXT, MIDDLETEXT and LONGTEXT. - These are actually blobs, but all searching is done text independent. - All old BLOB fields are now TEXT fields. -* LONG VARCHAR is a synonym for TEXT. LONG BINARY is a synonym for BLOB. -* 'LONG' is now a reserved word. - -Fri Sep 26 16:11:34 1997 <monty@monty.pp.sci.fi> - -* Release of 3.21.9 -* Fixed a couple of portable problems with include files. -* Fixed bug in range calculation that could return empty - set when searching on multiple key with only one entry (very rare). - -Wed Sep 24 15:51:37 1997 <monty@monty.pp.sci.fi> - -* Changed thread scope from PROCESS to SYSTEM. This should give better - scheduling (performance) on Solaris. -* Fixed duplicated free bug in sql_base with io_cache. - -Tue Sep 23 13:05:23 1997 <monty@monty.pp.sci.fi> - -* Allow also the old SELECT ... INTO OUTFILE syntax. -* Fixed bug with group by and select on key with many values. - -Mon Sep 22 14:54:00 1997 <monty@monty.pp.sci.fi> - -* mysql_fetch_lengths() returned sometimes wrong lengths when one used - mysql_use_result(). This affected at least some cases of mysqldump --quick. - -Sun Sep 21 20:50:07 1997 <monty@monty.pp.sci.fi> - -* Fixed memory leak bug in range optimizer. - -Sat Sep 20 00:03:51 1997 <monty@monty.pp.sci.fi> - -* Allow TIME, DATE and TIMESTAMP as column names. -* Fixed bug in optimization of WHERE const op field. - -Fri Sep 19 12:06:37 1997 <monty@monty.pp.sci.fi> - -* Fixed problem when sorting on NULL fields. -* Added handling of calculation of sum() functions. -* Added handling of trigometric functions: PI(), ACOS(), ASIN(), ATAN(), - COS(), SIN() and TAN(). -* Fixed sorting of big tables for 64 bit integers (Alpha). - -Fri Aug 29 13:06:32 1997 Michael Widenius <monty@analytik> - -* Added option --pid-file=# to mysqld -* Added date formating to from_unixtime(), originally by Zeev Suraski. - -Wed Aug 27 01:35:18 1997 <monty@monty.pp.sci.fi> - -* Fixed bug when using 'unsigned long' on Alpa. - -Tue Aug 26 03:23:28 1997 <monty@monty.pp.sci.fi> - -* Added option --bind-address to mysqld. -* Changed 'Access denied' to return username and password usage. -* Changed 'Access to database denied' to return username and database. - -Sun Aug 24 22:55:24 1997 Michael Widenius <monty@monty.pp.sci.fi> - -* Changed password crypt from 31 bits to 62 bits to make passwords more - secure. -* Changed protocol to allow for passing of mysql_errno to client. - -Fri Aug 22 18:14:00 1997 <monty@monty.pp.sci.fi> - -* Fixed bug in BETWEEN in range optimizer (Did only test = of the first - argument). - -Thu Aug 21 16:40:21 1997 <monty@monty.pp.sci.fi> - -* Version 3.21.6 -* Enabled range optimizer for update and delete. Now update and delete can - use keys again. -* Fixed bug when using unknown field in group clause. - -Tue Aug 19 00:49:13 1997 <monty@monty.pp.sci.fi> - -* The range optimizer is now enabled as default. Use msyqld --skip-new - to disable it. -* numerous small fixes to the range optimzer and a couple if fixes to - group and where handling. -* Added patch from JOERG_HENNE@Non-HP-Germany-om88.om.hp.com to allow - mit-threads to work on HPUX10. (This patch is regarded alpha) - -Fri Aug 15 02:29:21 1997 <monty@monty.pp.sci.fi> - -* Remove reverse lookup of hostnames because this takes 2 seconds - one some machines for every connection! - This can be enabled with the --secure option to mysqld. - -Thu Aug 14 22:40:15 1997 <monty@monty.pp.sci.fi> - -* remove HAVING -> WHERE optimization. To fix this one has to change - all Item_ref fields to Item_fields. -* Added patch for fast TCP/IP on FreeBSD. - -Wed Aug 13 17:14:50 1997 <monty@monty.pp.sci.fi> - -* Add optimizing of SELECT DISTINCT .... LIMIT # when there is no - GROUP or ORDER BY. -* Changed mysql to only print time information if not silent or if -vvv. -* Added polish error messages - -Sun Aug 10 11:31:10 1997 <monty@monty.pp.sci.fi> - -* new function: substring_index(), originally by Zeev Suraski. -* Added new option to mysqld: -O tmp_table_size=# -* Removed all use of PTHREAD_MUTEX_INIT and PTHREAD_COND_INIT for - porting to FreeBSD 3.0 and HPUX. - -Thu Aug 7 01:24:50 1997 <monty@monty.pp.sci.fi> - -* New function from_unixtime(timestamp) which returns a date string in - YYYY-MM-DD HH:MM:DD format. -* New function sec_to_time(seconds) which returns a string in H:MM:SS format. - -Sat Aug 2 17:18:22 1997 <monty@monty.pp.sci.fi> - -* Fixed some porting issues for OSF1 and for Alpha. - Now MySQL is know to configure on OSF1 with the Dec compiler, - after changeing one line in config.h: - #define SOCKET_SIZE_TYPE int - -Wed Jul 30 11:05:39 1997 <monty@monty.pp.sci.fi> - -* Added reverse check lookup of hostnames to get better security. -* Fixed some possible buffer overflows if one uses too long filenames. -* mysqld doesn't accept hostnames that starts with digits followed by a '.' - because the hostname may look like a IP. -* Added option --skip-networking to only allow socket connections. - (This will not work with MIT threads!) - -Tue Jul 29 10:38:55 1997 Michael Widenius <monty@monty.pp.sci.fi> - -* Removed wrong free() that killed the server on 'create/drop database'. -* Changed the name of some mysqld -O options to better names. -* Added option '-O join_cache_size=#'. -* Added option '-O max_join_size=#' to be able to set a limit how big queries - (in this case big = slow) one should be able to handle without specifying - 'SQL_OPTION OPTION_BIG_SELECTS=1'. - A # = is about 10 examined records. The default is 'unlimited'. -* When comparing a TIME, DATE, DATETIME or TIMESTAMP column to a - constant the constant is converted to a time value before comparing. - This will make it easier to get ODBC and particularly Access97 to work with - the above types. It should also make dates easier to use and the compares - should be quicker than before. -* added check of too long table names for alias. - -Mon Jul 21 16:09:47 1997 Michael Widenius <monty@monty.pp.sci.fi> - -* Applied patch from Jochen Wiedmann that fixes that query() in mysqlperl now - can take queries with \0 in it. - -Sat Jul 19 01:11:38 1997 Michael Widenius <monty@monty.pp.sci.fi> - -* Store of timestamp with 2 digit year YYMMDD didn't work. -* Fix that timestamp isn't automaticly updated if set in a update clause. -* Now the automatic timestamp field is the FIRST timestamp field. - -Thu Jul 3 13:34:26 1997 <monty@monty.pp.sci.fi> - -* Added check if database name is okey. -* Addded check if too long table names. -* SELECT * INTO OUTFILE, which didn't correctly if the outfile already existed. -* 'mysql' now shows thread id when starting or doing a reconnect. -* Changed the default sort buffer size from 2M to 1M. - -Mon Jun 30 10:18:39 1997 <monty@monty.pp.sci.fi> - -* mysqladmin: One can now do 'mysqladmin kill 5,6,7,8' -* Fixed 'Packets out of order' message. This error come sometimes when the - server was out of threads/memory. Now the correct message is retrieved by - the client. -* Added more checks with thread create for 'out of memory' errors. -* Added more checks if threads is killed to get faster kill. -* Changed the default record cache from 512K to 128K to get less problem on - systems with little memory. - -Sat Jun 28 00:18:02 1997 <monty@monty.pp.sci.fi> - -* When the max connection limit is reached, one extra connection by a user with - the PROCESS_ACL privilege is granted. - -Fri Jun 27 22:03:24 1997 <monty@monty.pp.sci.fi> - -* Added new mysqld option: -O backlog=# - -Tue Jun 24 22:08:58 1997 <monty@monty.pp.sci.fi> - -* Fixed SELECT DISTINCT when using 'hidden group'. For example: - SELECT DISTINCT MOD(some_field,10) FROM test GROUP BY some_field; -* Increased max packet size from 512K to 1024K for client. -* Removed a lot of unused functions - -Mon Jun 23 22:58:07 1997 <monty@monty.pp.sci.fi> - -* Changed key_parts to have own field for shortened keys. This gives much - nicer code in select. - -Thu Jun 19 13:09:14 1997 <monty@monty.pp.sci.fi> - -* ALTER TABLE now returns warnings from field conversions. - Changed all numerical fields to check for correct number and - increment warning counts if the value is wrong. - -Wed Jun 18 22:14:36 1997 <monty@monty.pp.sci.fi> - -* Fixed buffer overflow when retrieving big packets. - -Tue Jun 17 03:26:27 1997 <monty@monty.pp.sci.fi> - -* Port changed to 3306 (got it reserved from ISI). - -Mon Jun 16 15:46:42 1997 <monty@monty.pp.sci.fi> - -* All double are now rounded before storad as integer values. -* Fixed bug when using: SELECT WHERE A=const1 OR A=const2 OR A=const3, - and const1 = const3. In this case a key over A=const1 was wrongly used and - A=const2 wasn't used. -* Added a fix for Visual Fox Base so that any schema name from a table - specification is automaticly removed. - -Sun Jun 15 12:47:23 1997 <monty@monty.pp.sci.fi> - -* The thr_alarm array is now initialized based on number of connections -* Changed some memcpy() to bmove() to get rid of some warnings from purify. -* Changed the sql_yacc.c to drop schema name from table name. This is a crude - patch to get VFP - -Sat Jun 14 12:04:59 1997 <monty@monty.pp.sci.fi> - -* fixed missed ptr variable in filesort. -* Fixed wrong tablename and record count EXPLAIN. -* Changed the 'key use' test to prefere keys even more over full join. -* Fixed LIKE to work for binary strings. - -Fri Jun 13 13:38:14 1997 <monty@monty.pp.sci.fi> - -* New function char(num,....). - -Wed Jun 11 14:53:17 1997 <monty@monty.pp.sci.fi> - -* All field types tested with extrema values. date_time and timestamp - now require at least year, month and day on insert. - -Mon Jun 9 01:23:36 1997 <monty@monty.pp.sci.fi> - -* Added French error messages (by Therrien, Gilbert). English is still default. -* Added option '--skip-name-resolve' to get mysqld to use only IP's to - autenticate a host. 'localhost' will still be used for local UNIX sockets. -* Removed the between() function. On should use the 'col BETWEEN a AND b' - syntax instead. - -Sun Jun 8 11:05:46 1997 <monty@monty.pp.sci.fi> - -* New function ASCII. - -Sat May 31 01:00:18 1997 <monty@monty.pp.sci.fi> - -* host names are now compared case insensitive. - -Wed May 28 13:04:00 1997 <monty@monty.pp.sci.fi> - -* HAVING is added to WHERE if there is no grouping. -* MySQL now doesn't anymore have to use a extra temporary table when sorting - on functions or SUM functions. - -Tue May 27 00:54:51 1997 <monty@monty.pp.sci.fi> - -* Added function to print a item for debugging purposes. -* Fixed bug that one couldn't use 'table_name.field_name' in UPDATE. -* Removed init code with reset some of the mysqld -O variables to default after - they where set by start options. - -Thu May 22 14:52:26 1997 <monty@monty.pp.sci.fi> - -* Added varbinary syntax: 0x###### which can be used as a string (default) or a - number. - -Sun May 18 22:00:58 1997 <monty@bitch.sci.fi> - -* mysqldump: added options to lock tables and specify many tables to dump -* Add support of NULL fields in filesort -* SELECT with COUNT(),MIN() .... with no matching rows now returns 1 row. - -Sat May 17 22:06:29 1997 <monty@bitch.sci.fi> - -* New operator IN. This uses a binary search to find a match. -* Added 'SET OPTION SQL_BIG_TABLES= (0 | 1). Setting this to 1 will force - all temporary tables to disk. This will allow one to do big selects that - ordinary would give a 'table full' error. - -Fri May 16 18:53:21 1997 <monty@bitch.sci.fi> - -* New command LOCK TABLES table_name [alias] (READ | WRITE), .... - -Wed May 14 14:33:07 1997 <monty@bitch.sci.fi> - -* Renamed FIELD_TYPE_CHAR to FIELD_TYPE_TINY - -Mon May 12 09:54:24 1997 <monty@bitch.sci.fi> - -* Added command --log-update to get a update log for incremental backups. -* log file rotation for mysqld. -* log file for incremental backups -* new command: DESCRIBE SELECT .... -* Removed mysql_reload() and added mysql_refresh() instead. - Left a define to get old source to compile. - -Fri May 9 10:41:36 1997 <monty@bitch.sci.fi> - -* All functions now regards a binary type as 'sticky'. -* The time is now only requested once at start of each query. -* Splitted item_func.cc in two tables to get around that gcc uses too - much memory compiling it. -* Changed MIN() and MAX() to return the original type. -* Fixed bug in acl with anonymous user: Now if one gets accepted by the user - table as a empty user name, the user name is set to '' when checking against - the 'db' and 'host' tables. -* calculate all const expressions in the first optimizer pass. - -Tue May 6 19:16:56 1997 <monty@bitch.sci.fi> - -* Fixed ORDER BY bug when selecting on very small tables that made the - optimizer use a full join. - -Mon May 5 00:15:52 1997 <monty@bitch.sci.fi> - -* Added use of table alias in insert, delete and update. -* Removed FIELD_TYPE_TINY_BLOB, FIELD_TYPE_MEDIUM_BLOB, FIELD_TYPE_LONG_BLOB, - FIELD_TYPE_VAR_STRING from client code. -* Change syntax of SELECT .. WHERE ... INTO OUTFILE .. to the more standard - SELECT .. INTO OUTFILE 'name' WHERE ... - -Thu May 1 23:16:14 1997 <monty@bitch.sci.fi> - -* Added new API functions: - mysql_row_seek(),mysql_row_tell() and mysql_field_tell(). - mysql_field_seek() now returns old offset. -* Added expr BETWEEN expr2 AND expr3. - -Sun Apr 27 16:16:17 1997 <monty@bitch.sci.fi> - -* Changed range() detection to get queries on prefix to works faster. - Now SELECT name FROM table WHERE name="prefix" is quick even if there - are lots of rows where name starts with prefix. -* Fixed crash with shutdown and --log-isam -* Added group function STD() (standard derivation). -* mysql.cc: Fixed that NULL columns are always at least 4 wide for nicer output - of NULL values. -* Fixed that calculations that are not in GROUP BY works as expected. - (ANSI SQL extension) - Example: SELECT id,id+1 FROM table GROUP BY id - -Thu Apr 24 13:41:01 1997 Michael Widenius TcX DataKonsulter AB <monty@analytik> - -* Fixed convert bug which got mysqld to core dump with Aritmetic error on - Sparc-386 - -Wed Apr 23 12:11:05 1997 Michael Widenius TcX DataKonsulter AB <monty@analytik> - -* Added tty password to mysqlshow.c - -Tue Apr 22 15:44:11 1997 Michael Widenius TcX DataKonsulter AB <monty@analytik> - -* The test of using MYSQL_PWD was reversed. Now MYSQL_PWD is enabled as default - in the default release - -Sun Apr 20 14:36:39 1997 <monty@bitch.sci.fi> - -* Now one usually only have to give --basedir to mysqld. All other paths - are relative in a normal installation. -* BLOBs contained sometimes garbage when used with a SELECT on more than - one table and ORDER BY. -* Added option --unbuffered to mysql. (For new mysqlaccess) -* 'select *' without tables crashed server. -* When using overlapping (unnecessary keys) and join over many tables - the optimizer could get confused and return 0 records. -* Changed safe_mysqld to allow one to move installed releases. - -Sun Apr 13 10:40:50 1997 <monty@bitch.sci.fi> - -* Release 3.20.17 -* Added new function unix_timestamp([timestamp_column]) - -Sat Apr 12 11:27:57 1997 <monty@bitch.sci.fi> - -* Fixed memory over run bug when using selects with many brace levels. -* Change from_days() and weekday() to also take a full timestamp or - a datetime as argument. Before they only took a number of type YYYYMMDD or - YYMMDD. - -Wed Apr 9 13:22:24 1997 Michael Widenius <monty@bitch.sci.fi> - -* Changed stack usage to use less memory. -* All communication packages and row buffers are now alloced on demand. - The default communication buffers are now smaller than before. -* count(field) where field could have a NULL value didn't work. -* IS NULL and IS NOT NULL now work in the WHERE. -* BLOBs now work in the WHERE. -* Remove pre-space from numbers when writing decimal() coulmns to file. -* INSERT INTO ... SELECT .. WHERE could give the error 'Dupplicated field' - -Tue Apr 8 16:14:54 1997 Michael Widenius <monty@bitch.sci.fi> - -* Added commands SET OPTION SQL_SELECT_LIMIT=# to provide framework - for options and to get some ODBC things to work. -* Fixed bug in SELECT ... two tables ... GROUP BY -* Fixed bug in INSERT ... SELECT ... GROUP BY -* Fixed bug in acl: To use FILE_PRIV one also had to have SELECT PRIV - in the user grant table. -* Fixed fatal bug in ranged querie with OR when one part of the query didn't - have any matching records. - -Mon Apr 7 16:03:00 1997 Michael Widenius <monty@bitch.sci.fi> - -* Now connections are allowed even if hostname isn't found. - In this case all hostname checks are done on IP. -* When doing insert on timestamps, the timestamp was set to the - current time even if updated by a value. -* Fixed LOAD DATA.. that if one has COLUMN TERMINATED BY to be same as - LINE TERMINATED BY, then LINE TERMINATED BY is set to a empty string. - This wasn't a bug, but a common mistake when reading columns separated - with newlines. - -Sun Apr 6 22:37:53 1997 Michael Widenius <monty@bitch.sci.fi> - -* Changed definition of function ELT as it should have been: - ELT(index,element,element,element....) now returns the index:s - element in the list. The first element has index 1. - FIELD(find,string,string,string) searches after the 'find' string - in the string list and returns a index to the found string. - The strings are compared case insensitive. -* Added some tests to safe_mysqld to make it 'safer' - -Fri Apr 4 02:17:40 1997 Michael Widenius <monty@bitch.sci.fi> - -* When sorting the db grant table, host wasn't sorted. - -Wed Apr 2 03:00:14 1997 Michael Widenius <monty@bitch.sci.fi> - -* Fixed case 'WHERE key_num_column = "string"' -* LIKE was case sensitive in some places and case insensitive in other. - Now LIKE is always case insensitive. -* Fixed bug in select optimizer when using many tables with the same - column used as key to different tables. - -Sun Mar 30 21:22:39 1997 Michael Widenius <monty@bitch.sci.fi> - -* mysql.cc; Allow '#' anywhere on the line. - -Thu Mar 27 02:42:12 1997 Michael Widenius <monty@bitch.sci.fi> - -* Added new latin2 and Russian KOI8 character tables. -* Added support for a dummy GRANT command satisfy Powerbuilder. - -Wed Mar 26 03:03:07 1997 Michael Widenius <monty@bitch.sci.fi> - -* Release of 3.20.15 -* Removed possible loop when thread waits for command from client - and fcntl() fails. Thanks to Mike Bretz for finding this bug - -Tue Mar 25 18:03:15 1997 Michael Widenius <monty@bitch.sci.fi> - -* Changed alarm loop in mysqld.cc because shutdown didn't always - succeed in Linux. -* Removed use of termbits from mysql.cc This conflicted with glibc 2.0 -* Fixed syntax error in get_password.c (for BSD). Added flush of line. -* Added test if 'linux' style gethostbyaddr_r in mysqld.cc -* Fixed bug when doing a select as superuser without a database. -* Fixed bug when doing SELECT with group calculation to outfile. - -Mon Mar 24 16:03:01 1997 Michael Widenius <monty@bitch.sci.fi> - -* Release of 3.20.14 -* Added new function SOUNDEX() -* If one gives '-p' or -password to mysql or mysqladmin without an argument, - the password will be asked from the tty. - -Sun Mar 23 00:19:42 1997 Michael Widenius <monty@bitch.sci.fi> - -* Sometimes when doing a reconnect on a down connection this succeded - first on second try. Fixed by removing handling of SIGPIPE in client. -* When adding a auto_increment key with ALTER_TABLE on got the error: - 'Can't write, duplicate key'. - -Sat Mar 22 22:55:12 1997 Michael Widenius <monty@bitch.sci.fi> - -* AVG() gave too small value on some selects with GROUP BY and ORDER BY. - -Fri Mar 21 12:27:32 1997 Michael Widenius <monty@bitch.sci.fi> - -* Added new DATETIME type (by Giovanni Maruzzelli <maruzz@matrice.it>) -* Fixed that define 'DONT_USE_DEFAULT_FIELDS' works -* Added default password from MYSQL_PWD. (by Elmar Haneke) -* Changed C++ code to be compatible with Sun Workshop - -Thu Mar 20 12:28:06 1997 Michael Widenius TcX DataKonsulter AB <monty@analytik> - -* Changed to use a thread to handle alarms instead of signals on Solaris to - avoid race conditions. -* Fixed default length of signed numbers. (George Harvey <georgeh@pinacl.co.uk>) -* Added commando 'kill' to mysqladmin to kill a specific mysql thread. - -Wed Mar 19 12:21:33 1997 Michael Widenius TcX DataKonsulter AB <monty@analytik> - -* sql_base.cc: Allow anything for CREATE INDEX. - -Mon Mar 17 19:54:11 1997 Michael Widenius TcX DataKonsulter AB <monty@analytik> - -* Add prezeros when packing numbers to DATE, TIME and TIMESTAMP. -* Fixed the OR bug for good. - -Fri Mar 14 11:46:54 1997 Michael Widenius <monty@bitch.sci.fi> - -* Release 3.20.13 -* Added changes by bonis@kiss.de to allow WHERE const op field -* Fixed bug in mysql.c when reading long commands from batch. -* mysqldump.c - Changed newlines, return and ASCII 0 to "\n", "\r" and "\0", - to allow restoring of columns with these. - -Thu Mar 13 20:02:53 1997 Michael Widenius <monty@bitch.sci.fi> - -* Fixed bug in select with and-or levels. - -Mon Mar 10 04:04:03 1997 Michael Widenius <monty@bitch.sci.fi> - -* Added support for Slovenian characters. -* Fixed bug with limit and order by. -* Allow order and group on items that isn't in the select list. - -Sun Mar 9 00:21:36 1997 Michael Widenius <monty@bitch.sci.fi> - -* Added ANSISQL94 DATE and TIME types. Changed TIMESTAMP fields to work better - when updateing it with a number. - -Sat Mar 8 20:19:21 1997 Michael Widenius <monty@bitch.sci.fi> - -* Allow setting of timestamp values in INSERT. -* Fixed bug with SELECT ... WHERE ... = NULL. -* Added changes for glibc 2.0 - -Fri Mar 7 07:53:01 1997 Michael Widenius <monty@bitch.sci.fi> - -* Fixed bug in alter table when changeing a not null field to allow NULLs. -* Added HAVE_READDIR_R as a define which can be removed if one has - a broken readdir_r implementation (Sparc/Linux). - -Thu Mar 6 21:06:02 1997 Michael Widenius <monty@bitch.sci.fi> - -* Added some ANS92 synonyms as field types to CREATE TABLE. - CREATE TABLE now allows FLOAT(4) and FLOAT(8) to mean FLOAT and DOUBLE. - -Wed Mar 5 00:41:29 1997 Michael Widenius <monty@bitch.sci.fi> - -* Release 3.20.11 -* Added sync of records count in sql_update. This fixed slow updates on first - connection. (Thanks to Vaclav Bittner for the test) -* Changed temporary file prefix from UN to MY. -* When using SELECT .... INTO OUTFILE all temporary tables are ISAM instead of - HEAP to allow big dumps. -* Changed date functions to be 'string functions'. This fixed some 'funny' - side effects when sorting on dates. - -Tue Mar 4 23:07:03 1997 Michael Widenius <monty@bitch.sci.fi> - -* Changed FOREIGN KEY to not create a key. Now it's only for compability. -* Extended ALTER TABLE according to SQL92. -* Some minor compability changes. -* Added --port and --socket to all utility programs and mysqld. - -Sat Feb 15 01:27:51 1997 Michael Widenius <monty@bitch.sci.fi> - -* Added Oracle command DESCRIBE (DESC) as a synomym for some SHOW commands: - DESC table_name <==> SHOW FIELDS FROM table_name - DESC table_name column <==> SHOW FIELDS FROM table_name LIKE 'column' - DESC table_name 'column' <==> SHOW FIELDS FROM table_name LIKE 'column' - mysql.cc thought that tinyblob, mediumblob and longblob was numerical. - (Was right adjusted) - -Thu Feb 13 00:49:29 1997 Michael Widenius <monty@bitch.sci.fi> - -* mediumblob didn't work. -* Fixed safe_mysqld and make_binary_distribution to work better. -* ALTER TABLE and changeing a BLOB to a CHAR() added some garabage at - string end. - -Wed Feb 12 16:10:49 1997 Michael Widenius <monty@bitch.sci.fi> - -* new insert type: INSERT INTO ... SELECT ....; - -Tue Feb 11 12:58:36 1997 Michael Widenius <monty@bitch.sci.fi> - -* Fixed some defines to get mysql to compile on freebsd 2.0 (intel) -* Removed all _A() from prototype declaration. -* Removed use of ulong in mysql.h and mysql_com.h -* Changed mysqldump to dump keynames. -* SELECT ... INTO OUTFILE 'test' create the file in the base directory - instead in database directory (if one didn't give a full path) -* A primary key is now defined as a key with name PRIMARY or the first - unique key if there doesn't exist a key with name PRIMARY. - -Mon Feb 10 00:40:48 1997 Michael Widenius <monty@bitch.sci.fi> - -* Fixed leak bug when using LOAD DATA into a blob with is sometimes NULL. -* DROP TABLE can now take a list of tables. -* If a databas was crashed, in some cases a read of the wrong record - was used as a 'end of file', instead of returning an error. - -Sat Feb 8 00:16:07 1997 Michael Widenius <monty@bitch.sci.fi> - -* merged structs field_t and FIELD to FIELD. - -Fri Feb 7 12:49:01 1997 Michael Widenius <monty@bitch.sci.fi> - -* version 3.20.9 -* Alter table didn't copy null bit. This resulted that NULL fields where - always NULL. -* CREATE didn't take numbers as DEFAULT. - -Wed Feb 5 13:28:19 1997 Michael Widenius <monty@bitch.sci.fi> - -* New scripts 'add_file_priv' which add the new field 'file_priv' - to the user table. This scripts must be executed if one wants to - use the new SELECT ... INTO and LOAD DATA INFILE... commands - with a version of mysql less than 3.20.7. -* Found bug in locking code when another thread got a table opened - by another thread. This could make a thread block forever wating - for a write lock. - -Tue Feb 4 00:57:24 1997 Michael Widenius <monty@bitch.sci.fi> - -* Changed select_test.c and insert_test.c to include config.h - -Mon Feb 3 00:42:08 1997 Michael Widenius <monty@bitch.sci.fi> - -* Add an optional keyname for all key declarators. - -Sat Feb 1 19:02:43 1997 Michael Widenius <monty@bitch.sci.fi> - -* Added command 'status' to mysqladmin for short logging. -* Increased max keys to 16 and max key parts to 15. - -Fri Jan 31 00:05:23 1997 Michael Widenius <monty@bitch.sci.fi> - -* Added ANSI92 extended ALTER TABLE statement. -* Changed all locking code to detect ALTER table after one got a lock. - Tables are automaticly reopened if ALTERed. -* Changed some structs to classes to get better code when using CREATE TABLE. - -Thu Jan 30 01:12:13 1997 Michael Widenius <monty@bitch.sci.fi> - -* Added new privilege to the user grant table: file_priv -* Added some compitibility changes to mysql.cc -* Added new syntax for creating keys with is a sub part of some field. -* Did a lot of changes to get around bug when comparing fields of - different lengths. Hope I didn't break something else :) -* Added long options to mysqldump. -* Added new function NOW(). - -Wed Jan 29 15:51:22 1997 Michael Widenius <monty@bitch.sci.fi> - -* Added option -k for mysqlshow to get key info for table. -* Changed some definitions from int to uint in mysql.h to get fewer warning - with prolint. - -Mon Jan 27 02:01:29 1997 Michael Widenius <monty@bitch.sci.fi> - -* Added sql command 'load data infile...' for export from textfiles. -* Added new API function mysql->info to pass info to client. -* Added INTO OUTFILE as option to select to get result to file. - -Fri Jan 24 14:56:19 1997 Michael Widenius <monty@bitch.sci.fi> - -* Relase 3.20.5-beta -* Got first version to work which MIT-threads. -* Added long options to mysqld -* mysqld now starts without system locking if compiled with MIT threads. -* Added new sql function RAND([init]) -* Changed sql_lex to handle \0 unquoted, but the client can't send - the query through the C api, because it takes a str pointer. - one have to use mysql_real_query() to send the query. - -Thu Jan 23 00:33:26 1997 Michael Widenius <monty@bitch.sci.fi> - -* Added API function: mysql_get_client_info -* mysqld now uses the N_MAX_KEY_LENGTH from nisam.h as the max allowed key - length. -* The following now works: "select filter_nr,filter_nr from filter order by - filter_nr" - Before you got the error: "Column: 'filter_nr' in order clause is ambiguous" - -Wed Jan 22 14:48:58 1997 Michael Widenius <monty@bitch.sci.fi> - -* Changed fctnl flag O_NDELAY to O_NONBLOCK (Posix, and to get MIT threads - to work) - -Tue Jan 21 12:31:17 1997 Michael Widenius <monty@bitch.sci.fi> - -* mysql now outputs \0 \t \n and \\ when writing tab separated output. - when encountering ascii 0, tab, newline or \. This is to allow printing of - binary data in a portable format. - To get old behavior use -r (or --raw). -* Added long options to mysqladmin, mysql and mysqlshow. -* Added german error messages (60 of 80 error messages translated) -* Added new api function: mysql_fetch_lengths(MYSQL_RES *) which - returns a array of of column lengths (of type uint). - -Sat Jan 18 23:59:53 1997 Michael Widenius <monty@bitch.sci.fi> - -* Fixed bug with IS NULL in where clause. - -Fri Jan 17 12:14:38 1997 Michael Widenius <monty@bitch.sci.fi> - -* Changed the optimizer a little to get better results when searching on a key - part. -* Added select option STRAIGHT_JOIN to tell the optimizer that it should join - tables in the given order. - -Thu Jan 16 00:55:41 1997 Michael Widenius <monty@bitch.sci.fi> - -* Added support of comment starting with '--' in mysql.cc (Postgres syntax) -* You can now have select_expressions and table columns in a select which - are not used in the group part. This makes it efficient to implement lookups. - If the not used column is not a constant for the group the column value - is unspecified. - Example: SELECT id,lookup.text,sum(*) FROM test,lookup - WHERE test.id=lookup.id group by id; - -* Fixed bug in sum(function) (Could make core dump) -* Changed auto_increment according to SQL_SYNTAX: - INSERT into table (auto_field) values (0) inserted 0, but the SQL_SYNTAX - statied it should insert a auto_incremnt value. - -Wed Jan 15 10:42:09 1997 Michael Widenius <monty@bitch.sci.fi> - -* mysqlshow.c: Added number of records in table. Had to change the client code a - little to fix this. -* mysql now allows double '' or "" in strings for embedded ' or ". -* Changed copyright text in mysqlshow and mysqladmin. - -Mon Jan 13 02:33:09 1997 Michael Widenius <monty@bitch.sci.fi> - -* Relase 3.20.3 -* Using the new readline library from bash. -* Updated a lot of text files. -* safe_mysqld and mysql.server changed to be more compatible between the - source and the binary releases. - -Sun Jan 12 18:23:30 1997 Michael Widenius <monty@bitch.sci.fi> - -* LIMIT takes now one or two numerical arguments. - If one argument the argument indicates the maximum number of rows in a result. - If two arguments the first arguments says the offset to the first row to return, - the second is the maximum number of rows. - With this it's easy to do a poor mans next page/previous page www application. -* Changed name of SQL function FIELDS to ELT. -* Made SHOW COLUMNS a synonym for SHOW FIELDS. - Added compatibility syntax FRIEND KEY to create table. This creates in mysql - a non unique key on the given columns. -* Added CREATE INDEX and DROP INDEX as compatibility functions. In mysql - CREATE INDEX only checks if the index exists and gives an error if it doesn't - exists. DROP INDEX always succeeds. - -Sat Jan 11 00:44:29 1997 Michael Widenius <monty@bitch.sci.fi> - -* mysqladmin.c: Added client version to version info. - -Fri Jan 10 20:30:04 1997 Michael Widenius <monty@bitch.sci.fi> - -* Fixed core dump bug in sql_acl (core on new connection). -* Removed host,user and db tables from database test in the distribution. -* FIELD_TYPE_CHAR can now be signed (-128 - 127) or unsigned (0 - 255) - Before it was always unsigned. - -Thu Jan 9 00:02:03 1997 Michael Widenius <monty@bitch.sci.fi> - -* Changed name from mysqllib to mysqlclient for mysql client lib. -* The following failed: concat(1,concat(2),2). - Could not call a variable argument function in a variable argument count - function. Fixed. - -Wed Jan 8 15:58:49 1997 Michael Widenius <monty@bitch.sci.fi> - -* weekday() returned wrong day 6 of 7 times. - -Mon Jan 6 23:49:31 1997 Michael Widenius <monty@bitch.sci.fi> - -* changed a lot of source to get mysqld to be compiled with SUNPRO compiler. -* sql functions must now have a '(' directly after the function name. - user '(' is now regarders as an identifier and a '(' - -Fri Jan 3 12:18:14 1997 Michael Widenius <monty@bitch.sci.fi> - -* Fixed possible bug when sorting with float and double. - Changed static sort_length to thread variable. This may have caused some - big sorts to fail when running two simultaneous sorts. -* Changed sql function INTERVALL() to INTERVAL(). - -Wed Jan 1 16:18:30 1997 Michael Widenius <monty@bitch.sci.fi> - -* Added some portability files for testing with RTS threads. -* Lot of changes for configure. - -Sun Dec 29 13:26:52 1996 Michael Widenius <monty@bitch.sci.fi> - -* Remove Makefile-linux-pl and Makefile-solaris-pl from the binary distribution. - Now only Makefile.PL is needed. - -Sat Dec 28 22:41:09 1996 Michael Widenius <monty@bitch.sci.fi> - -* Fixed that insert with a timestamp set to NULL works. (This is for a cleaner - syntax) - -Fri Dec 27 01:28:02 1996 Michael Widenius <monty@bitch.sci.fi> - -* mysqld now has english & swedish error messages. -* unireg files moved to sql directory changed to c++. - -Thu Dec 26 11:57:57 1996 Michael Widenius <monty@bitch.sci.fi> - -* mysqld: Added option 'b' for mysql basedir. All given directories is - prefixed with this if not given with hard path. - added option '-L' (language). Default is 'english/' - Moved all unireg files to sql directory. - -Fri Dec 20 11:05:37 1996 Michael Widenius TcX DataKonsulter AB <monty@ozelot> - -* Changed lex to allow a database name, table name and field name to start with - number or '_'. - -* mysqldump should now be able to dump all field types. - Changed 'show fields from table' to be fully compatible with create. -* Some bugs when parsing 'create table' fixed. (Blobs and timestamps was effected) -* Fixed one possible dead lock bug when using many tables. -* Changed a lot for configure - -Sun Dec 15 02:29:53 1996 Michael Widenius <monty@bitch.sci.fi> - -* Added new functions: INSERT(),RTRIM(),LTRIM(),FORMAT(). - -* New relase 3.19.5 -* Added functions DATABASE(),USER(),POW(),LOG10() (needed for ODBC). - -Sat Dec 14 10:10:42 1996 Michael Widenius <monty@bitch.sci.fi> - -* In a WHERE with a ORDER BY on fields from only one table the table is - now preferred as first table in a multi-join. -* HAVING and IS NULL or IS NOT NULL now works. -* a group on one column and a sort on a group function (SUM,AVG...) didn't - work together. Fixed. - -Fri Dec 13 07:20:47 1996 Michael Widenius <monty@bitch.sci.fi> - -* mysqldump: Didn't send password to server. - -* New relase 3.19.4 -* Fixed horrible locking bug when inserting in one thread and reading - on another thread. -* Fixed one-off decimal bug. 1.00 was outputed as 1.0 -* Added attribute 'Locked' to process list as info if a query is - locked by another query. -* Fixed full magic timestamp. Timestamp length may now be 14,12,10,8,6,4 or 2. - -Thu Dec 12 18:14:57 1996 Michael Widenius <monty@bitch.sci.fi> - -* sort on some number functions could be sorted wrong on last number. -* if(arg,syntax_error,syntax_error) crashed. -* added functions ceiling() and round(), exp(), log() and sqrt() -* enchanted BETWEEN to handle strings. - -Wed Dec 11 09:09:02 1996 Michael Widenius <monty@bitch.sci.fi> - -* MYODBC: Sometimes password test failed because of faulty charactermap in - windows. - -Mon Dec 9 12:50:56 1996 Michael Widenius <monty@bitch.sci.fi> - -* new relase 3.19.3 -* Fixed that select with grouping on blob's doesn't return wrong blob info. - grouping, sorting and distinct on blobs will not yet work as expected - (Probably it will group/sort by the first 7 characters in the blob) - Groping on formulas with a fixed string size (use mid on blob) should work. -* When doing a full join (no direct keys) on multiple tables with blob fields, - the blob was garbage on output. -* Fixed distinct with calculated columns. - -Sun Dec 8 19:53:24 1996 Michael Widenius <monty@bitch.sci.fi> - -* Fixed bug when allocation string for group -* new release 3.19.2 -* mysqldump.c: Didn't output ' around blobs. - -Sat Dec 7 13:00:43 1996 Michael Widenius <monty@bitch.sci.fi> - -* Added user flag to mysqldump & mysqlshow. -* ODBC: Added full support of SQLGetInfo(). Fixed limit bug (from 1.0.3). - myodbc-1.0.4 released - -Fri Dec 6 01:35:22 1996 Michael Widenius <monty@bitch.sci.fi> - -* ODBC: Added more support SetStmtOptions(). Added more debugging code - myodbc-1.0.3 released - -Tue Dec 3 22:12:30 1996 Michael Widenius <monty@bitch.sci.fi> - -* Added 'max_connections' and 'table_cache' as start variables to mysqld. -* Changed weights in join optimizer: Now prefers to use keys even more: - Before the optimizer would prefer to do a full join on small tables - (< 300 records), even if there was a usable key. - -Mon Dec 2 00:17:42 1996 Michael Widenius <monty@bitch.sci.fi> - -* new release 3.19.1 -* Fixed bug when joining tables without keys and null fields and varchars. - (mysqld hang) -* Fixed output of 'mysql show'. All fields was 'unsigned zerofill'. - -* new release 3.19.0 -* Added new column specifier AUTO_INCREMENT. -* Changed format of sql command 'show fields'. -* Changed mysqlshow to use sql command 'show fields' to get more info. -* Added synonym RLIKE for REGEXP to be compatible with mSQL - -Sun Dec 1 12:53:05 1996 Michael Widenius <monty@bitch.sci.fi> - -* item_func.cc (fix_fields): Fixed new bug when calculation and levels. - Crashed stack when optimizing where! (fatal bug in 3.18.1) - -Fri Nov 29 00:32:09 1996 Michael Widenius <monty@bitch.sci.fi> - -* Distribution 3.18.1 -* Fixed optimizeing bug. -* New ODBC version with traceing in all functions with isn't supported yet - for easier debugging. Added NO WARRANTY info. - Released as 1.0.2 - -Wed Nov 27 17:18:51 1996 Michael Widenius TcX DataKonsulter AB <monty@ozelot> - -* Added Henry Spencer's regexp in 'field REGEXP string'. Can only be used - in select_expression or HAVING until I fix the where clause. - -Mon Nov 25 20:01:05 1996 Michael Widenius TcX DataKonsulter AB <monty@ozelot> - -* Created files: CREDITS, PUBLIC. Updated FAQ, README, TODO, SQL_SYNTAX... -* Done a lot of testing on HAVING. - -Sun Nov 24 00:45:07 1996 Michael Widenius <monty@bitch.sci.fi> - -* mysql didn't stop on error in batch mode even if -f wasn't used. -* Fixed DBD Makefile.PL for linux -* Added a function.tst & function.res (test and result file of mysql functions) -* libmysql.c: Added some checking for calls after connection has gone done. -* Implemented HAVING with full expr syntax -* Changed operators '=, - -Sat Nov 23 20:52:42 1996 Michael Widenius <monty@bitch.sci.fi> - -* SQL_SYNTAX added 'like' as a boolean expression in select. -* mysqladmin.c: 'mysqladmin garbage' didn't give an error. -* sql_insert.cc: If one read a deleted record and did a insert with all fields - then the new record was marked deleted. -* perl DBI interface ported. - -Thu Nov 21 00:58:44 1996 Michael Widenius <monty@bitch.sci.fi> - -* mysql only used the TCP connection, no socket was ever created -* There was a bug in when reading from getenv(MYSQL_TCP_PORT) -* Added some more start-logging to check for port & socket. -* If something got wrong at startup some threads was kept alive in Linux -* If argument -h to mysqld is a relative path, change it to './' -* Search after the 'unireg' directory from: current dir, - mysqld program dir/.. and in env(MY_BASEDIR_VERSION) -* Added longlong support to Linux -* Added copyright notices to all files. Everything should be ready for - distribution. - -Wed Nov 20 19:03:02 1996 Michael Widenius <monty@bitch.sci.fi> - -* Added function IF. -* Added select without FROM clause (for easy test of functions) - -Tue Nov 19 11:48:55 1996 Michael Widenius <monty@bitch.sci.fi> - -* mysql.c: Sometimes 'in-string' was not initialized. -* linux distribution - -Mon Nov 18 13:47:09 1996 Michael Widenius <monty@bitch.sci.fi> - -* Fixed blob:s to work (as varchar) in ODBC (myodbc-1.0.1.zip) -* Added option -O to set buffer sizes to mysqld - -Wed Nov 13 15:21:14 1996 Michael Widenius <monty@monty.pp.sci.fi> - -* New sql functions: REPLACE, LCASE and UCASE -* hacked search on '%xxx' to work. - -Tue Nov 12 00:52:35 1996 Michael Widenius <monty@monty.pp.sci.fi> - -* mysql.cc: Fixed problems with strings containing not backslashed ' or ". - -Mon Nov 11 14:52:30 1996 Michael Widenius <monty@monty.pp.sci.fi> - -* added braces to where clause. Change where to use items. - -Wed Nov 6 00:17:37 1996 Michael Widenius <monty@analytikerna.se> - -* added PRIMARY KEY, KEY and UNIQUE to sql create. diff --git a/sql/Makefile.am b/sql/Makefile.am index c4b641f714b..b1d9149ddf4 100644 --- a/sql/Makefile.am +++ b/sql/Makefile.am @@ -97,7 +97,7 @@ DEFS = -DMYSQL_SERVER \ # Don't put lex_hash.h in BUILT_SOURCES as this will give infinite recursion BUILT_SOURCES = sql_yacc.cc sql_yacc.h EXTRA_DIST = udf_example.cc $(BUILT_SOURCES) -YFLAGS = -d +AM_YFLAGS = -d link_sources: rm -f mini_client_errors.c diff --git a/sql/des_key_file.cc b/sql/des_key_file.cc index aa74a7880db..5b25819b657 100644 --- a/sql/des_key_file.cc +++ b/sql/des_key_file.cc @@ -107,4 +107,15 @@ error: VOID(pthread_mutex_unlock(&LOCK_des_key_file)); DBUG_RETURN(result); } + + +void free_des_key_file() +{ + if (initialized) + { + initialized= 01; + pthread_mutex_destroy(&LOCK_des_key_file); + } +} + #endif /* HAVE_OPENSSL */ diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index e4ffeef85c3..12aa7c0b6f5 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -231,7 +231,7 @@ convert_error_code_to_mysql( } else if (error == (int) DB_COL_APPEARS_TWICE_IN_INDEX) { - return(HA_ERR_WRONG_TABLE_DEF); + return(HA_ERR_CRASHED); } else if (error == (int) DB_OUT_OF_FILE_SPACE) { @@ -847,6 +847,7 @@ innobase_end(void) err = innobase_shutdown_for_mysql(); hash_free(&innobase_open_tables); my_free(internal_innobase_data_file_path,MYF(MY_ALLOW_ZERO_PTR)); + pthread_mutex_destroy(&innobase_mutex); if (err != DB_SUCCESS) { @@ -1944,9 +1945,14 @@ ha_innobase::write_row( the counter here. */ skip_auto_inc_decr = FALSE; - if (error == DB_DUPLICATE_KEY && - user_thd->lex.sql_command == SQLCOM_REPLACE) - skip_auto_inc_decr= TRUE; + + if (error == DB_DUPLICATE_KEY + && (user_thd->lex.sql_command == SQLCOM_REPLACE + || user_thd->lex.sql_command + == SQLCOM_REPLACE_SELECT)) { + + skip_auto_inc_decr= TRUE; + } if (!skip_auto_inc_decr && incremented_auto_inc_counter && prebuilt->trx->auto_inc_lock) { @@ -4213,6 +4219,16 @@ ha_innobase::store_lock( lock_type = TL_WRITE_ALLOW_WRITE; } + /* In queries of type INSERT INTO t1 SELECT ... FROM t2 ... + MySQL would use the lock TL_READ_NO_INSERT on t2, and that + would conflict with TL_WRITE_ALLOW_WRITE, blocking all inserts + to t2. Convert the lock to a normal read lock to allow + concurrent inserts to t2. */ + + if (lock_type == TL_READ_NO_INSERT && !thd->in_lock_tables) { + lock_type = TL_READ; + } + lock.type=lock_type; } diff --git a/sql/ha_isam.cc b/sql/ha_isam.cc index 6fa54d18aac..7371628890f 100644 --- a/sql/ha_isam.cc +++ b/sql/ha_isam.cc @@ -35,7 +35,7 @@ *****************************************************************************/ const char **ha_isam::bas_ext() const -{ static const char *ext[]= { ".ISD",".ISM", NullS }; return ext; } +{ static const char *ext[]= { ".ISM",".ISD", NullS }; return ext; } int ha_isam::open(const char *name, int mode, uint test_if_locked) diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index 754d7dc8641..7cd5927bd24 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -125,7 +125,7 @@ void mi_check_print_warning(MI_CHECK *param, const char *fmt,...) } const char **ha_myisam::bas_ext() const -{ static const char *ext[]= { ".MYD",".MYI", NullS }; return ext; } +{ static const char *ext[]= { ".MYI",".MYD", NullS }; return ext; } const char *ha_myisam::index_type(uint key_number) @@ -510,7 +510,7 @@ int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt) (uint) (T_RETRY_WITHOUT_QUICK | T_QUICK))) { param.testflag&= ~T_RETRY_WITHOUT_QUICK; - sql_print_error("Warning: Retrying repair of: '%s' without quick", + sql_print_error("Note: Retrying repair of: '%s' without quick", table->path); continue; } @@ -518,7 +518,7 @@ int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt) if ((param.testflag & T_REP_BY_SORT)) { param.testflag= (param.testflag & ~T_REP_BY_SORT) | T_REP; - sql_print_error("Warning: Retrying repair of: '%s' with keycache", + sql_print_error("Note: Retrying repair of: '%s' with keycache", table->path); continue; } @@ -528,7 +528,7 @@ int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt) !(check_opt->flags & T_VERY_SILENT)) { char llbuff[22],llbuff2[22]; - sql_print_error("Warning: Found %s of %s rows when repairing '%s'", + sql_print_error("Note: Found %s of %s rows when repairing '%s'", llstr(file->state->records, llbuff), llstr(start_records, llbuff2), table->path); diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc index 00052239f0b..5f07bbc4140 100644 --- a/sql/ha_myisammrg.cc +++ b/sql/ha_myisammrg.cc @@ -69,7 +69,7 @@ int ha_myisammrg::open(const char *name, int mode, uint test_if_locked) err: myrg_close(file); file=0; - return (my_errno= HA_ERR_WRONG_TABLE_DEF); + return (my_errno= HA_ERR_WRONG_MRG_TABLE_DEF); } int ha_myisammrg::close(void) diff --git a/sql/handler.cc b/sql/handler.cc index a36a77484e5..dcc732ba25a 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -679,7 +679,7 @@ void handler::print_error(int error, myf errflag) case HA_ERR_END_OF_FILE: textno=ER_KEY_NOT_FOUND; break; - case HA_ERR_WRONG_TABLE_DEF: + case HA_ERR_WRONG_MRG_TABLE_DEF: textno=ER_WRONG_MRG_TABLE; break; case HA_ERR_FOUND_DUPP_KEY: diff --git a/sql/hostname.cc b/sql/hostname.cc index 0124fa6d060..2905320cc15 100644 --- a/sql/hostname.cc +++ b/sql/hostname.cc @@ -27,7 +27,9 @@ extern "C" { // Because of SCO 3.2V4.2 #endif #if !defined( __WIN__) && !defined(OS2) +#if !defined(__NETWARE__) #include <sys/resource.h> +#endif /* __NETWARE__ */ #ifdef HAVE_SYS_UN_H #include <sys/un.h> #endif diff --git a/sql/item.h b/sql/item.h index 6f83348f0c6..8c7914cefeb 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB +/* Copyright (C) 2000-2003 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -97,6 +97,10 @@ public: virtual bool get_time(TIME *ltime); virtual bool is_null() { return 0; }; virtual void top_level_item() {} + virtual void set_result_field(Field *field) {} + virtual bool is_result_field() { return 0; } + virtual void save_in_result_field(bool no_conversions) {} + virtual void no_rows_in_result() {} virtual Item *copy_or_same(THD *thd) { return this; } virtual Item *get_tmp_table_item(THD *thd) { return copy_or_same(thd); } @@ -450,12 +454,19 @@ public: Field *tmp_table_field(TABLE *t_arg) { return result_field; } table_map used_tables() const { return 1; } virtual void fix_length_and_dec()=0; + void set_result_field(Field *field) { result_field= field; } + bool is_result_field() { return 1; } + void save_in_result_field(bool no_conversions) + { + save_in_field(result_field, no_conversions); + } }; class Item_ref :public Item_ident { public: + Field *result_field; /* Save result here */ Item **ref; Item_ref(char *db_par,char *table_name_par,char *field_name_par) :Item_ident(db_par,table_name_par,field_name_par),ref(0) {} @@ -504,6 +515,12 @@ public: enum Item_result result_type () const { return (*ref)->result_type(); } enum_field_types field_type() const { return (*ref)->field_type(); } table_map used_tables() const { return (*ref)->used_tables(); } + void set_result_field(Field *field) { result_field= field; } + bool is_result_field() { return 1; } + void save_in_result_field(bool no_conversions) + { + (*ref)->save_in_field(result_field, no_conversions); + } }; class Item_in_subselect; diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 59005930e31..30dad9d3f18 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB +/* Copyright (C) 2000-2003 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -400,6 +400,7 @@ longlong Item_func_strcmp::val_int() return !value ? 0 : (value < 0 ? (longlong) -1 : (longlong) 1); } + void Item_func_interval::fix_length_and_dec() { if (row->cols() > 8) @@ -420,8 +421,24 @@ void Item_func_interval::fix_length_and_dec() } maybe_null= 0; max_length= 2; + used_tables_cache|= item->used_tables(); + with_sum_func= with_sum_func || item->with_sum_func; } + +void Item_func_interval::split_sum_func(List<Item> &fields) +{ + if (item->with_sum_func && item->type() != SUM_FUNC_ITEM) + item->split_sum_func(fields); + else if (item->used_tables() || item->type() == SUM_FUNC_ITEM) + { + fields.push_front(item); + item= new Item_ref((Item**) fields.head_ref(), 0, item->name); + } + Item_int_func::split_sum_func(fields); +} + + /* return -1 if null value, 0 if lower than lowest @@ -907,17 +924,47 @@ Item_func_case::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) { used_tables_cache|=(first_expr)->used_tables(); const_item_cache&= (first_expr)->const_item(); + with_sum_func= with_sum_func || (first_expr)->with_sum_func; } if (else_expr) { used_tables_cache|=(else_expr)->used_tables(); const_item_cache&= (else_expr)->const_item(); + with_sum_func= with_sum_func || (else_expr)->with_sum_func; } if (!else_expr || else_expr->maybe_null) maybe_null=1; // The result may be NULL return 0; } + +void Item_func_case::split_sum_func(List<Item> &fields) +{ + if (first_expr) + { + if (first_expr->with_sum_func && first_expr->type() != SUM_FUNC_ITEM) + first_expr->split_sum_func(fields); + else if (first_expr->used_tables() || first_expr->type() == SUM_FUNC_ITEM) + { + fields.push_front(first_expr); + first_expr= new Item_ref((Item**) fields.head_ref(), 0, + first_expr->name); + } + } + if (else_expr) + { + if (else_expr->with_sum_func && else_expr->type() != SUM_FUNC_ITEM) + else_expr->split_sum_func(fields); + else if (else_expr->used_tables() || else_expr->type() == SUM_FUNC_ITEM) + { + fields.push_front(else_expr); + else_expr= new Item_ref((Item**) fields.head_ref(), 0, else_expr->name); + } + } + Item_func::split_sum_func(fields); +} + + void Item_func_case::set_outer_resolving() { first_expr->set_outer_resolving(); @@ -1388,9 +1435,7 @@ void Item_func_in::split_sum_func(Item **ref_pointer_array, List<Item> &fields) uint el= fields.elements; fields.push_front(item); ref_pointer_array[el]= item; - item=new Item_ref(ref_pointer_array + el, - 0, item->name); - + item= new Item_ref(ref_pointer_array + el, 0, item->name); } Item_func::split_sum_func(ref_pointer_array, fields); } diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 7ae60ba2fc9..6e47bbcc3d1 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB +/* Copyright (C) 2000-2003 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -304,6 +304,7 @@ public: args[0]->top_level_item(); return Item_func::fix_fields(thd, tlist, ref); } + void split_sum_func(List<Item> &fields); void fix_length_and_dec(); const char *func_name() const { return "if"; } }; @@ -353,6 +354,7 @@ public: const char *func_name() const { return "case"; } void print(String *str); bool fix_fields(THD *thd, struct st_table_list *tlist, Item **ref); + void split_sum_func(List<Item> &fields); Item *find_item(String *str); void set_outer_resolving(); }; diff --git a/sql/item_create.cc b/sql/item_create.cc index ab201fbfd71..610b7d77184 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB +/* Copyright (C) 2000-2003 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -84,7 +84,7 @@ Item *create_func_connection_id(void) { THD *thd=current_thd; thd->lex.safe_to_cache_query=0; - return new Item_int("CONNECTION_ID()",(longlong) thd->thread_id,10); + return new Item_int(NullS,(longlong) thd->thread_id,10); } Item *create_func_conv(Item* a, Item *b, Item *c) @@ -157,7 +157,7 @@ Item *create_func_found_rows(void) { THD *thd=current_thd; thd->lex.safe_to_cache_query=0; - return new Item_int("FOUND_ROWS()",(longlong) thd->found_rows(),21); + return new Item_int(NullS,(longlong) thd->found_rows(),21); } Item *create_func_from_days(Item* a) @@ -295,7 +295,7 @@ Item *create_func_period_diff(Item* a, Item *b) Item *create_func_pi(void) { - return new Item_real("PI()",M_PI,6,8); + return new Item_real(NullS,M_PI,6,8); } Item *create_func_pow(Item* a, Item *b) @@ -311,7 +311,7 @@ Item *create_func_current_user() length= (uint) (strxmov(buff, thd->priv_user, "@", thd->host_or_ip, NullS) - buff); - return new Item_string("CURRENT_USER()", thd->memdup(buff, length), length, + return new Item_string(NullS, thd->memdup(buff, length), length, default_charset_info); } @@ -418,7 +418,7 @@ Item *create_func_ucase(Item* a) Item *create_func_version(void) { - return new Item_string("VERSION()",server_version, + return new Item_string(NullS,server_version, (uint) strlen(server_version), default_charset_info); } @@ -439,11 +439,6 @@ Item *create_load_file(Item* a) return new Item_load_file(a); } -Item *create_wait_for_master_pos(Item* a, Item* b) -{ - current_thd->lex.uncacheable(); - return new Item_master_pos_wait(a, b); -} Item *create_func_cast(Item *a, Item_cast cast_type) { diff --git a/sql/item_create.h b/sql/item_create.h index 97386ca9b0b..0c469e82db8 100644 --- a/sql/item_create.h +++ b/sql/item_create.h @@ -95,7 +95,6 @@ Item *create_func_ucase(Item* a); Item *create_func_version(void); Item *create_func_weekday(Item* a); Item *create_load_file(Item* a); -Item *create_wait_for_master_pos(Item* a, Item* b); Item *create_func_is_free_lock(Item* a); Item *create_func_quote(Item* a); diff --git a/sql/item_func.cc b/sql/item_func.cc index a8a9111959c..b2faae9425c 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB +/* Copyright (C) 2000-2003 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1069,6 +1069,17 @@ longlong Item_func_field::val_int() return 0; } +void Item_func_field::split_sum_func(List<Item> &fields) +{ + if (item->with_sum_func && item->type() != SUM_FUNC_ITEM) + item->split_sum_func(fields); + else if (item->used_tables() || item->type() == SUM_FUNC_ITEM) + { + fields.push_front(item); + item= new Item_ref((Item**) fields.head_ref(), 0, item->name); + } + Item_func::split_sum_func(fields); +} longlong Item_func_ascii::val_int() { @@ -1613,6 +1624,7 @@ void item_user_lock_init(void) void item_user_lock_free(void) { hash_free(&hash_user_locks); + pthread_mutex_destroy(&LOCK_user_locks); } void item_user_lock_release(ULL *ull) @@ -1653,11 +1665,12 @@ longlong Item_master_pos_wait::val_int() null_value = 1; return 0; } - ulong pos = (ulong)args[1]->val_int(); + longlong pos = (ulong)args[1]->val_int(); + longlong timeout = (arg_count==3) ? args[2]->val_int() : 0 ; #ifdef HAVE_REPLICATION LOCK_ACTIVE_MI; - if ((event_count = active_mi->rli.wait_for_pos(thd, log_name, pos)) == -1) - { + if ((event_count = active_mi->rli.wait_for_pos(thd, log_name, pos, timeout)) == -2) + { null_value = 1; event_count=0; } diff --git a/sql/item_func.h b/sql/item_func.h index fbf9e712092..9c5982358f8 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -612,6 +612,7 @@ public: return (item->fix_fields(thd, tlist, &item) || item->check_cols(1) || Item_func::fix_fields(thd, tlist, ref)); } + void split_sum_func(List<Item> &fields); void update_used_tables() { item->update_used_tables() ; Item_func::update_used_tables(); @@ -892,9 +893,10 @@ class Item_master_pos_wait :public Item_int_func String value; public: Item_master_pos_wait(Item *a,Item *b) :Item_int_func(a,b) {} + Item_master_pos_wait(Item *a,Item *b,Item *c) :Item_int_func(a,b,c) {} longlong val_int(); const char *func_name() const { return "master_pos_wait"; } - void fix_length_and_dec() { max_length=1; maybe_null=1;} + void fix_length_and_dec() { max_length=21; maybe_null=1;} }; diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 73f2968c5f6..037bb60de3d 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -597,6 +597,17 @@ null: return 0; } +void Item_func_concat_ws::split_sum_func(List<Item> &fields) +{ + if (separator->with_sum_func && separator->type() != SUM_FUNC_ITEM) + separator->split_sum_func(fields); + else if (separator->used_tables() || separator->type() == SUM_FUNC_ITEM) + { + fields.push_front(separator); + separator= new Item_ref((Item**) fields.head_ref(), 0, separator->name); + } + Item_str_func::split_sum_func(fields); +} void Item_func_concat_ws::fix_length_and_dec() { @@ -610,6 +621,7 @@ void Item_func_concat_ws::fix_length_and_dec() } used_tables_cache|=separator->used_tables(); const_item_cache&=separator->const_item(); + with_sum_func= with_sum_func || separator->with_sum_func; } void Item_func_concat_ws::update_used_tables() @@ -1571,6 +1583,19 @@ void Item_func_elt::fix_length_and_dec() } +void Item_func_elt::split_sum_func(List<Item> &fields) +{ + if (item->with_sum_func && item->type() != SUM_FUNC_ITEM) + item->split_sum_func(fields); + else if (item->used_tables() || item->type() == SUM_FUNC_ITEM) + { + fields.push_front(item); + item= new Item_ref((Item**) fields.head_ref(), 0, item->name); + } + Item_str_func::split_sum_func(fields); +} + + void Item_func_elt::update_used_tables() { Item_func::update_used_tables(); @@ -1617,6 +1642,19 @@ String *Item_func_elt::val_str(String *str) } +void Item_func_make_set::split_sum_func(List<Item> &fields) +{ + if (item->with_sum_func && item->type() != SUM_FUNC_ITEM) + item->split_sum_func(fields); + else if (item->used_tables() || item->type() == SUM_FUNC_ITEM) + { + fields.push_front(item); + item= new Item_ref((Item**) fields.head_ref(), 0, item->name); + } + Item_str_func::split_sum_func(fields); +} + + void Item_func_make_set::fix_length_and_dec() { max_length=arg_count-1; @@ -1624,6 +1662,7 @@ void Item_func_make_set::fix_length_and_dec() max_length+=args[i]->max_length; used_tables_cache|=item->used_tables(); const_item_cache&=item->const_item(); + with_sum_func= with_sum_func || item->with_sum_func; } diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index ffa01c36ed7..75ef626bbd4 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB +/* Copyright (C) 2000-2003 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -105,6 +105,8 @@ public: separator->check_cols(1) || Item_func::fix_fields(thd, tlist, ref)); } + void split_sum_func(List<Item> &fields); + const char *func_name() const { return "concat_ws"; } const char *func_name() const { return "concat_ws"; } void set_outer_resolving() { @@ -379,6 +381,7 @@ public: item->check_cols(1) || Item_func::fix_fields(thd, tlist, ref)); } + void split_sum_func(List<Item> &fields); void fix_length_and_dec(); void update_used_tables(); const char *func_name() const { return "elt"; } @@ -405,6 +408,7 @@ public: item->check_cols(1) || Item_func::fix_fields(thd, tlist, ref)); } + void split_sum_func(List<Item> &fields); void fix_length_and_dec(); void update_used_tables(); const char *func_name() const { return "make_set"; } diff --git a/sql/item_sum.cc b/sql/item_sum.cc index c2725ed28cf..9af3eef3cd7 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -1196,7 +1196,7 @@ bool Item_sum_count_distinct::add() if (always_null) return 0; copy_fields(tmp_table_param); - copy_funcs(tmp_table_param->funcs); + copy_funcs(tmp_table_param->items_to_copy); for (Field **field=table->field ; *field ; field++) if ((*field)->is_real_null(0)) diff --git a/sql/item_sum.h b/sql/item_sum.h index 69966aa5796..dc412fe1750 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -76,6 +76,7 @@ public: void make_field(Send_field *field); void print(String *str); void fix_num_length_and_dec(); + void no_rows_in_result() { reset(); } virtual bool setup(THD *thd) {return 0;} Item *get_tmp_table_item(THD *thd); }; @@ -148,6 +149,7 @@ class Item_sum_count :public Item_sum_int bool const_item() const { return !used_table_cache; } enum Sumfunctype sum_func () const { return COUNT_FUNC; } void reset(); + void no_rows_in_result() { count=0; } bool add(); void make_const(longlong count_arg) { count=count_arg; used_table_cache=0; } longlong val_int(); diff --git a/sql/lex.h b/sql/lex.h index b17d3313c3f..67b2ba85dc0 100644 --- a/sql/lex.h +++ b/sql/lex.h @@ -512,9 +512,8 @@ static SYMBOL sql_functions[] = { { "LOWER", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_lcase)}, { "LPAD", SYM(FUNC_ARG3),0,CREATE_FUNC(create_func_lpad)}, { "LTRIM", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_ltrim)}, - { "MASTER_POS_WAIT", SYM(FUNC_ARG2),0, - CREATE_FUNC(create_wait_for_master_pos)}, { "MAKE_SET", SYM(MAKE_SET_SYM),0,0}, + { "MASTER_POS_WAIT", SYM(MASTER_POS_WAIT),0,0}, { "MAX", SYM(MAX_SYM),0,0}, { "MD5", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_md5)}, { "MID", SYM(SUBSTRING),0,0}, /* unireg function */ diff --git a/sql/log.cc b/sql/log.cc index 9a523915673..878606f73e0 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -101,8 +101,15 @@ MYSQL_LOG::MYSQL_LOG() MYSQL_LOG::~MYSQL_LOG() { + cleanup(); +} + +void MYSQL_LOG::cleanup() +{ if (inited) { + close(1); + inited= 0; (void) pthread_mutex_destroy(&LOCK_log); (void) pthread_mutex_destroy(&LOCK_index); (void) pthread_cond_destroy(&update_cond); @@ -1081,7 +1088,7 @@ bool MYSQL_LOG::write(Log_event* event_info) if (thd->last_insert_id_used) { Intvar_log_event e(thd,(uchar) LAST_INSERT_ID_EVENT, - thd->last_insert_id); + thd->current_insert_id); e.set_log_pos(this); if (thd->server_id) e.server_id = thd->server_id; @@ -1461,6 +1468,10 @@ void MYSQL_LOG:: wait_for_update(THD* thd) at once after close, in which case we don't want to close the index file. We only write a 'stop' event to the log if exiting is set + + NOTES + One can do an open on the object at once after doing a close. + The internal structures are not freed until cleanup() is called */ void MYSQL_LOG::close(bool exiting) @@ -1602,5 +1613,51 @@ void sql_perror(const char *message) #endif } +bool flush_error_log() +{ + bool result=0; + if (opt_error_log) + { + char err_renamed[FN_REFLEN], *end; + end= strmake(err_renamed,log_error_file,FN_REFLEN-4); + strmov(end, "-old"); +#ifdef __WIN__ + char err_temp[FN_REFLEN+4]; + /* + On Windows is necessary a temporary file for to rename + the current error file. + */ + strmov(strmov(err_temp, err_renamed),"-tmp"); + (void) my_delete(err_temp, MYF(0)); + if (freopen(err_temp,"a+",stdout)) + { + freopen(err_temp,"a+",stderr); + (void) my_delete(err_renamed, MYF(0)); + my_rename(log_error_file,err_renamed,MYF(0)); + if (freopen(log_error_file,"a+",stdout)) + freopen(log_error_file,"a+",stderr); + int fd, bytes; + char buf[IO_SIZE]; + if ((fd = my_open(err_temp, O_RDONLY, MYF(0))) >= 0) + { + while ((bytes = (int) my_read(fd, (byte*) buf, IO_SIZE, MYF(0))) > 0) + my_fwrite(stderr, (byte*) buf, (uint) strlen(buf),MYF(0)); + my_close(fd, MYF(0)); + } + (void) my_delete(err_temp, MYF(0)); + } + else + result= 1; +#else + my_rename(log_error_file,err_renamed,MYF(0)); + if (freopen(log_error_file,"a+",stdout)) + freopen(log_error_file,"a+",stderr); + else + result= 1; +#endif + } + return result; +} + diff --git a/sql/my_lock.c b/sql/my_lock.c index 4d451fcff22..7f47256703a 100644 --- a/sql/my_lock.c +++ b/sql/my_lock.c @@ -14,7 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __EMX__ +#if defined(__EMX__) || defined(__NETWARE__) #include "../mysys/my_lock.c" #else diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 176283837bf..5512272d71c 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB +/* Copyright (C) 2000-2003 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -416,7 +416,7 @@ int mysql_union(THD *thd, LEX *lex, select_result *result, SELECT_LEX_UNIT *unit, bool tables_and_fields_initied); int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *s, TABLE_LIST *t); Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type, - Item_result_field ***copy_func, Field **from_field, + Item ***copy_func, Field **from_field, bool group,bool modify_item); int mysql_create_table(THD *thd,const char *db, const char *table_name, HA_CREATE_INFO *create_info, @@ -500,6 +500,7 @@ extern struct st_des_keyschedule des_keyschedule[10]; extern uint des_default_key; extern pthread_mutex_t LOCK_des_key_file; bool load_des_key_file(const char *file_name); +void free_des_key_file(); #endif /* HAVE_OPENSSL */ /* sql_do.cc */ @@ -551,6 +552,7 @@ my_bool mysqld_show_warnings(THD *thd, ulong levels_to_show); /* sql_handler.cc */ int mysql_ha_open(THD *thd, TABLE_LIST *tables); int mysql_ha_close(THD *thd, TABLE_LIST *tables, bool dont_send_ok=0); +int mysql_ha_closeall(THD *thd, TABLE_LIST *tables, bool dont_send_ok=0); int mysql_ha_read(THD *, TABLE_LIST *,enum enum_ha_read_modes,char *, List<Item> *,enum ha_rkey_function,Item *,ha_rows,ha_rows); @@ -680,6 +682,7 @@ extern uchar *days_in_month; extern char language[LIBLEN],reg_ext[FN_EXTLEN]; extern char glob_hostname[FN_REFLEN], mysql_home[FN_REFLEN]; extern char pidfile_name[FN_REFLEN], time_zone[30], *opt_init_file; +extern char log_error_file[FN_REFLEN]; extern char blob_newline; extern double log_10[32]; extern ulonglong keybuff_size; @@ -717,7 +720,7 @@ extern uint delay_key_write_options; extern bool opt_endinfo, using_udf_functions, locked_in_memory; extern bool opt_using_transactions, mysql_embedded; extern bool using_update_log, opt_large_files; -extern bool opt_log, opt_update_log, opt_bin_log, opt_slow_log; +extern bool opt_log, opt_update_log, opt_bin_log, opt_slow_log, opt_error_log; extern bool opt_disable_networking, opt_skip_show_db; extern bool volatile abort_loop, shutdown_in_progress, grant_option; extern uint volatile thread_count, thread_running, global_read_lock; @@ -760,6 +763,7 @@ extern struct rand_struct sql_rand; extern SHOW_COMP_OPTION have_isam, have_innodb, have_berkeley_db; extern SHOW_COMP_OPTION have_raid, have_openssl, have_symlink; extern SHOW_COMP_OPTION have_query_cache, have_berkeley_db, have_innodb; +extern SHOW_COMP_OPTION have_crypt; #ifndef __WIN__ extern pthread_t signal_thread; @@ -846,7 +850,7 @@ int create_frm(char *name,uint reclength,uchar *fileinfo, HA_CREATE_INFO *create_info, uint keys); void update_create_info_from_table(HA_CREATE_INFO *info, TABLE *form); int rename_file_ext(const char * from,const char * to,const char * ext); -bool check_db_name(const char *db); +bool check_db_name(char *db); bool check_column_name(const char *name); bool check_table_name(const char *name, uint length); char *get_field(MEM_ROOT *mem,TABLE *table,uint fieldnr); @@ -871,6 +875,8 @@ extern int sql_cache_hit(THD *thd, char *inBuf, uint length); Item *get_system_var(enum_var_type var_type, LEX_STRING name); Item *get_system_var(enum_var_type var_type, const char *var_name, uint length, const char *item_name); +/* log.cc */ +bool flush_error_log(void); /* Some inline functions for more speed */ diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 0899a342abb..08c5889257b 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB +/* Copyright (C) 2000-2003 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -80,7 +80,9 @@ extern "C" { // Because of SCO 3.2V4.2 #if defined(OS2) # include <sys/un.h> #elif !defined( __WIN__) +# ifndef __NETWARE__ #include <sys/resource.h> +# endif /* __NETWARE__ */ #ifdef HAVE_SYS_UN_H # include <sys/un.h> #endif @@ -118,6 +120,15 @@ int deny_severity = LOG_WARNING; #include <sys/mman.h> #endif +#ifdef __NETWARE__ +#include <nks/vm.h> +#include <library.h> +#include <monitor.h> + +event_handle_t eh; +Report_t ref; +#endif /* __NETWARE__ */ + #ifdef _AIX41 int initgroups(const char *,unsigned int); #endif @@ -186,7 +197,7 @@ static bool opt_enable_named_pipe = 0; #ifdef __WIN__ static pthread_cond_t COND_handler_count; static uint handler_count; -static bool opt_console=0, start_mode=0, use_opt_args; +static bool start_mode=0, use_opt_args; static int opt_argc; static char **opt_argv; #endif @@ -242,6 +253,11 @@ SHOW_COMP_OPTION have_query_cache=SHOW_OPTION_YES; #else SHOW_COMP_OPTION have_query_cache=SHOW_OPTION_NO; #endif +#ifdef HAVE_CRYPT +SHOW_COMP_OPTION have_crypt=SHOW_OPTION_YES; +#else +SHOW_COMP_OPTION have_crypt=SHOW_OPTION_NO; +#endif const char *show_comp_option_name[]= {"YES", "NO", "DISABLED"}; @@ -266,7 +282,9 @@ my_bool opt_reckless_slave = 0; ulong back_log, connect_timeout, concurrency; char mysql_home[FN_REFLEN], pidfile_name[FN_REFLEN], time_zone[30]; +char log_error_file[FN_REFLEN]; bool opt_log, opt_update_log, opt_bin_log, opt_slow_log; +bool opt_error_log= IF_WIN(1,0); bool opt_disable_networking=0, opt_skip_show_db=0; my_bool opt_enable_named_pipe= 0; my_bool opt_local_infile, opt_external_locking, opt_slave_compressed_protocol; @@ -282,12 +300,14 @@ static my_string opt_logname=0,opt_update_logname=0, static char* mysql_home_ptr= mysql_home; static char* pidfile_name_ptr= pidfile_name; +char* log_error_file_ptr= log_error_file; static pthread_t select_thread; static my_bool opt_noacl=0, opt_bootstrap=0, opt_myisam_log=0; my_bool opt_safe_user_create = 0, opt_no_mix_types = 0; my_bool lower_case_table_names, opt_old_rpl_compat; my_bool opt_show_slave_auth_info, opt_sql_bin_update = 0; my_bool opt_log_slave_updates= 0, opt_old_passwords=0, use_old_passwords=0; +my_bool opt_console= 0; volatile bool mqh_used = 0; FILE *bootstrap_file=0; @@ -374,8 +394,8 @@ ulong bytes_sent = 0L, bytes_received = 0L; bool opt_endinfo,using_udf_functions, locked_in_memory; bool opt_using_transactions, using_update_log; -bool volatile abort_loop,select_thread_in_use,grant_option; -bool volatile ready_to_exit,shutdown_in_progress; +bool volatile abort_loop, select_thread_in_use, signal_thread_in_use; +bool volatile ready_to_exit, shutdown_in_progress, grant_option; ulong refresh_version=1L,flush_version=1L; /* Increments on each reload */ ulong query_id=1L,long_query_count,aborted_threads, aborted_connects,delayed_insert_timeout,delayed_insert_limit, @@ -491,6 +511,7 @@ static uint set_maximum_open_files(uint max_file_limit); #endif static ulong find_bit_type(const char *x, TYPELIB *bit_lib); static void clean_up(bool print_message); +static void clean_up_mutexes(void); #ifndef EMBEDDED_LIBRARY /**************************************************************************** @@ -519,7 +540,7 @@ static void close_connections(void) (void) pthread_mutex_unlock(&LOCK_manager); /* kill connection thread */ -#if !defined(__WIN__) && !defined(__EMX__) && !defined(OS2) +#if !defined(__WIN__) && !defined(__EMX__) && !defined(OS2) && !defined(__NETWARE__) DBUG_PRINT("quit",("waiting for select thread: %lx",select_thread)); (void) pthread_mutex_lock(&LOCK_thread_count); @@ -661,10 +682,6 @@ static void close_connections(void) } (void) pthread_mutex_unlock(&LOCK_thread_count); - mysql_log.close(1); - mysql_slow_log.close(1); - mysql_update_log.close(1); - mysql_bin_log.close(1); DBUG_PRINT("quit",("close_connections thread")); DBUG_VOID_RETURN; } @@ -682,10 +699,10 @@ static void close_server_sock() ip_sock=INVALID_SOCKET; DBUG_PRINT("info",("calling shutdown on TCP/IP socket")); VOID(shutdown(tmp_sock,2)); -#ifdef NOT_USED +#if defined(__NETWARE__) /* - The following code is disabled as it causes MySQL to hang on - AIX 4.3 during shutdown + The following code is disabled for normal systems as it causes MySQL + to hang on AIX 4.3 during shutdown */ DBUG_PRINT("info",("calling closesocket on TCP/IP socket")); VOID(closesocket(tmp_sock)); @@ -697,9 +714,9 @@ static void close_server_sock() unix_sock=INVALID_SOCKET; DBUG_PRINT("info",("calling shutdown on unix socket")); VOID(shutdown(tmp_sock,2)); -#ifdef NOT_USED +#if defined(__NETWARE__) /* - The following code is disabled as it may cause MySQL to hang on + The following code is disabled for normal systems as it causes MySQL AIX 4.3 during shutdown (not tested, but likely) */ DBUG_PRINT("info",("calling closesocket on unix/IP socket")); @@ -763,7 +780,7 @@ void kill_mysql(void) /* Force server down. kill all connections and threads and exit */ -#if defined(OS2) +#if defined(OS2) || defined(__NETWARE__) extern "C" void kill_server(int sig_ptr) #define RETURN_FROM_KILL_SERVER DBUG_RETURN #elif !defined(__WIN__) @@ -782,13 +799,16 @@ static void __cdecl kill_server(int sig_ptr) RETURN_FROM_KILL_SERVER; kill_in_progress=TRUE; abort_loop=1; // This should be set +#ifdef __NETWARE__ + ActivateScreen(getscreenhandle()); // Show the screen going down +#endif signal(sig,SIG_IGN); if (sig == MYSQL_KILL_SIGNAL || sig == 0) sql_print_error(ER(ER_NORMAL_SHUTDOWN),my_progname); else sql_print_error(ER(ER_GOT_SIGNAL),my_progname,sig); /* purecov: inspected */ -#if defined(USE_ONE_SIGNAL_HAND) && !defined(__WIN__) && !defined(OS2) +#if defined(__NETWARE__) || (defined(USE_ONE_SIGNAL_HAND) && !defined(__WIN__) && !defined(OS2)) my_thread_init(); // If this is a new thread #endif close_connections(); @@ -796,13 +816,19 @@ static void __cdecl kill_server(int sig_ptr) unireg_abort(1); /* purecov: inspected */ else unireg_end(); +#ifdef __NETWARE__ + pthread_join(select_thread, NULL); // wait for main thread +#else pthread_exit(0); /* purecov: deadcode */ +#endif /* __NETWARE__ */ + +pthread_exit(0); /* purecov: deadcode */ #endif /* EMBEDDED_LIBRARY */ RETURN_FROM_KILL_SERVER; } -#ifdef USE_ONE_SIGNAL_HAND +#if defined(USE_ONE_SIGNAL_HAND) || (defined(__NETWARE__) && defined(SIGNALS_DONT_BREAK_READ)) extern "C" pthread_handler_decl(kill_server_thread,arg __attribute__((unused))) { SHUTDOWN_THD; @@ -829,7 +855,7 @@ extern "C" sig_handler print_signal_warning(int sig) #ifdef DONT_REMEMBER_SIGNAL sigset(sig,print_signal_warning); /* int. thread system calls */ #endif -#if !defined(__WIN__) && !defined(OS2) +#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__) if (sig == SIGALRM) alarm(2); /* reschedule alarm */ #endif @@ -853,11 +879,13 @@ void unireg_end(void) { clean_up(1); my_thread_end(); +#ifndef __NETWARE__ #ifdef SIGNALS_DONT_BREAK_READ exit(0); #else pthread_exit(0); // Exit is in main thread #endif +#endif /* __NETWARE__ */ } @@ -869,6 +897,8 @@ extern "C" void unireg_abort(int exit_code) clean_up(1); /* purecov: inspected */ DBUG_PRINT("quit",("done with cleanup in unireg_abort")); my_thread_end(); + clean_up_mutexes(); + my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0); exit(exit_code); /* purecov: inspected */ } @@ -878,6 +908,12 @@ void clean_up(bool print_message) DBUG_PRINT("exit",("clean_up")); if (cleanup_done++) return; /* purecov: inspected */ + + mysql_log.cleanup(); + mysql_slow_log.cleanup(); + mysql_update_log.cleanup(); + mysql_bin_log.cleanup(); + #ifdef HAVE_REPLICATION if (use_slave_mask) bitmap_free(&slave_error_mask); @@ -913,6 +949,9 @@ void clean_up(bool print_message) #ifdef HAVE_REPLICATION end_slave_list(); #endif +#ifdef HAVE_OPENSSL + free_des_key_file(); +#endif /* HAVE_OPENSSL */ #ifdef USE_REGEX regex_end(); #endif @@ -940,6 +979,35 @@ void clean_up(bool print_message) } /* clean_up */ +static void clean_up_mutexes() +{ + (void) pthread_mutex_destroy(&LOCK_mysql_create_db); + (void) pthread_mutex_destroy(&LOCK_Acl); + (void) pthread_mutex_destroy(&LOCK_grant); + (void) pthread_mutex_destroy(&LOCK_open); + (void) pthread_mutex_destroy(&LOCK_thread_count); + (void) pthread_mutex_destroy(&LOCK_mapped_file); + (void) pthread_mutex_destroy(&LOCK_status); + (void) pthread_mutex_destroy(&LOCK_error_log); + (void) pthread_mutex_destroy(&LOCK_delayed_insert); + (void) pthread_mutex_destroy(&LOCK_delayed_status); + (void) pthread_mutex_destroy(&LOCK_delayed_create); + (void) pthread_mutex_destroy(&LOCK_manager); + (void) pthread_mutex_destroy(&LOCK_crypt); + (void) pthread_mutex_destroy(&LOCK_bytes_sent); + (void) pthread_mutex_destroy(&LOCK_bytes_received); + (void) pthread_mutex_destroy(&LOCK_timezone); + (void) pthread_mutex_destroy(&LOCK_user_conn); + (void) pthread_mutex_destroy(&LOCK_rpl_status); + (void) pthread_mutex_destroy(&LOCK_active_mi); + (void) pthread_mutex_destroy(&LOCK_global_system_variables); + (void) pthread_cond_destroy(&COND_thread_count); + (void) pthread_cond_destroy(&COND_refresh); + (void) pthread_cond_destroy(&COND_thread_cache); + (void) pthread_cond_destroy(&COND_flush_thread_cache); + (void) pthread_cond_destroy(&COND_manager); + (void) pthread_cond_destroy(&COND_rpl_status); +} /**************************************************************************** ** Init IP and UNIX socket @@ -973,7 +1041,7 @@ static void set_ports() static void set_user(const char *user) { -#if !defined(__WIN__) && !defined(OS2) +#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__) struct passwd *ent; // don't bother if we aren't superuser @@ -1034,7 +1102,7 @@ static void set_user(const char *user) static void set_root(const char *path) { -#if !defined(__WIN__) && !defined(__EMX__) && !defined(OS2) +#if !defined(__WIN__) && !defined(__EMX__) && !defined(OS2) && !defined(__NETWARE__) if (chroot(path) == -1) { sql_perror("chroot"); @@ -1347,7 +1415,92 @@ static void init_signals(void) } static void start_signal_handler(void) +{} + +static void check_data_home(const char *path) +{} + +#elif defined(__NETWARE__) + +// down server event callback +void mysql_down_server_cb(void *, void *) +{ + setscreenmode(SCR_AUTOCLOSE_ON_EXIT); // auto close the screen + kill_server(0); +} + +// destroy callback resources +void mysql_cb_destroy(void *) +{ + UnRegisterEventNotification(eh); // cleanup down event notification + NX_UNWRAP_INTERFACE(ref); +} + +// initialize callbacks +void mysql_cb_init() +{ + // register for down server event + void *handle = getnlmhandle(); + rtag_t rt = AllocateResourceTag(handle, "MySQL Down Server Callback", + EventSignature); + NX_WRAP_INTERFACE((void *)mysql_down_server_cb, 2, (void **)&ref); + eh = RegisterForEventNotification(rt, EVENT_DOWN_SERVER, + EVENT_PRIORITY_APPLICATION, + NULL, ref, NULL); + NXVmRegisterExitHandler(mysql_cb_destroy, NULL); // clean-up +} + +static void init_signals(void) +{ + int signals[] = {SIGINT,SIGILL,SIGFPE,SIGSEGV,SIGTERM,SIGABRT}; + + for (uint i=0 ; i < sizeof(signals)/sizeof(int) ; i++) + signal(signals[i], kill_server); + mysql_cb_init(); // initialize callbacks +} + +static void start_signal_handler(void) +{ + // Save vm id of this process + if (!opt_bootstrap) + { + File pidFile; + if ((pidFile = my_create(pidfile_name,0664, O_WRONLY, MYF(MY_WME))) >= 0) + { + char buff[21]; + sprintf(buff,"%lu",(ulong) getpid()); + (void) my_write(pidFile, buff,strlen(buff),MYF(MY_WME)); + (void) my_close(pidFile,MYF(0)); + } + } + // no signal handler +} + + +/* Warn if the data is on a Traditional volume */ + +static void check_data_home(const char *path) { + struct volume_info vol; + char buff[PATH_MAX], *pos; + + bzero((char*) &vol, sizeof(vol)); // clear struct + + // find volume name + if ((pos= strchr(path, ':'))) + { + uint length= (uint) (pos-path); + strmake(buff, path, min(length, sizeof(buff)-1)); + } + else + strmov(buff, "SYS"); // assume SYS volume + + netware_vol_info_from_name(&vol, buff); // retrieve information + if ((vol.flags & VOL_NSS_PRESENT) == 0) + { + sql_print_error("Error: %s is not on an NSS volume!", path); + unireg_abort(-1); + } } #elif defined(__EMX__) @@ -1382,8 +1535,10 @@ static void init_signals(void) } static void start_signal_handler(void) -{ -} +{} + +static void check_data_home(const char *path) +{} #else /* if ! __WIN__ && ! __EMX__ */ @@ -1587,7 +1742,8 @@ extern "C" void *signal_hand(void *arg __attribute__((unused))) int sig; my_thread_init(); // Init new thread DBUG_ENTER("signal_hand"); - SIGNAL_THD; + signal_thread_in_use= 1; + /* Setup alarm handler The two extra handlers are for slave threads @@ -1654,6 +1810,7 @@ extern "C" void *signal_hand(void *arg __attribute__((unused))) if (cleanup_done) { my_thread_end(); + signal_thread_in_use= 0; pthread_exit(0); // Safety } switch (sig) { @@ -1705,6 +1862,9 @@ extern "C" void *signal_hand(void *arg __attribute__((unused))) return(0); /* purecov: deadcode */ } +static void check_data_home(const char *path) +{} + #endif /* __WIN__*/ @@ -1856,6 +2016,12 @@ static int init_common_variables(const char *conf_file_name, int argc, max_system_variables.pseudo_thread_id= (ulong)~0; start_time=time((time_t*) 0); + +#ifdef __NETWARE__ + printf("MySQL Server %s, for %s (%s)\n", VERSION, SYSTEM_TYPE, MACHINE_TYPE); + fflush(stdout); +#endif /* __NETWARE__ */ + #ifdef OS2 { // fix timezone for daylight saving @@ -2038,10 +2204,26 @@ static int init_server_components() using_update_log=1; } + if (opt_error_log) + { + if (!log_error_file_ptr[0]) + fn_format(log_error_file, glob_hostname, mysql_data_home, ".err", 0); + else + fn_format(log_error_file, log_error_file_ptr, mysql_data_home, ".err", + MY_UNPACK_FILENAME | MY_SAFE_PATH); + if (!log_error_file[0]) + opt_error_log= 1; // Too long file name + else + { + if (freopen(log_error_file, "a+", stdout)) + freopen(log_error_file, "a+", stderr); + } + } + if (ha_init()) { sql_print_error("Can't init databases"); - return 1; + unireg_abort(1); } if (opt_myisam_log) (void) mi_log(1); @@ -2061,7 +2243,7 @@ static int init_server_components() locked_in_memory=0; #endif - ft_init_stopwords(ft_precompiled_stopwords); + ft_init_stopwords(); init_max_user_conn(); init_update_queries(); @@ -2208,6 +2390,7 @@ int main(int argc, char **argv) /* We have enough space for fiddling with the argv, continue */ + check_data_home(mysql_real_data_home); if (my_setwd(mysql_real_data_home,MYF(MY_WME))) { unireg_abort(1); /* purecov: inspected */ @@ -2260,7 +2443,9 @@ The server will not act as a slave."); { abort_loop=1; select_thread_in_use=0; - (void) pthread_kill(signal_thread,MYSQL_KILL_SIGNAL); +#ifndef __NETWARE__ + (void) pthread_kill(signal_thread, MYSQL_KILL_SIGNAL); +#endif /* __NETWARE__ */ #ifndef __WIN__ if (!opt_bootstrap) (void) my_delete(pidfile_name,MYF(MY_WME)); // Not needed anymore @@ -2297,7 +2482,9 @@ The server will not act as a slave."); create_shutdown_thread(); create_maintenance_thread(); - printf(ER(ER_READY),my_progname,server_version,""); + printf(ER(ER_READY),my_progname,server_version, + ((unix_sock == INVALID_SOCKET) ? (char*) "" : mysql_unix_port), + mysql_port); fflush(stdout); #if defined(__NT__) || defined(HAVE_SMEM) @@ -2340,6 +2527,22 @@ The server will not act as a slave."); CloseHandle(hEventShutdown); } #endif +#ifndef __NETWARE__ + { + uint i; + /* + Wait up to 10 seconds for signal thread to die. We use this mainly to + avoid getting warnings that my_thread_end has not been called + */ + for (i= 0 ; i < 100 && signal_thread_in_use; i++) + { + if (pthread_kill(signal_thread, MYSQL_KILL_SIGNAL)) + break; + my_sleep(100); // Give it time to die + } + } +#endif + clean_up_mutexes(); my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0); exit(0); return(0); /* purecov: deadcode */ @@ -2626,7 +2829,10 @@ static void create_new_thread(THD *thd) inline void kill_broken_server() { /* hack to get around signals ignored in syscalls for problem OS's */ - if (unix_sock == INVALID_SOCKET || + if ( +#if !defined(__NETWARE__) + unix_sock == INVALID_SOCKET || +#endif (!opt_disable_networking && ip_sock == INVALID_SOCKET)) { select_thread_in_use = 0; @@ -2728,6 +2934,13 @@ extern "C" pthread_handler_decl(handle_connections_sockets, size_socket length=sizeof(struct sockaddr_in); new_sock = accept(sock, my_reinterpret_cast(struct sockaddr *) (&cAddr), &length); +#ifdef __NETWARE__ + // TODO: temporary fix, waiting for TCP/IP fix - DEFECT000303149 + if ((new_sock == INVALID_SOCKET) && (socket_errno == EINVAL)) + { + kill_server(SIGTERM); + } +#endif if (new_sock != INVALID_SOCKET || (socket_errno != SOCKET_EINTR && socket_errno != SOCKET_EAGAIN)) break; @@ -3222,7 +3435,7 @@ enum options OPT_CONNECT_TIMEOUT, OPT_DELAYED_INSERT_TIMEOUT, OPT_DELAYED_INSERT_LIMIT, OPT_DELAYED_QUEUE_SIZE, OPT_FLUSH_TIME, OPT_FT_MIN_WORD_LEN, - OPT_FT_MAX_WORD_LEN, OPT_FT_MAX_WORD_LEN_FOR_SORT, + OPT_FT_MAX_WORD_LEN, OPT_FT_MAX_WORD_LEN_FOR_SORT, OPT_FT_STOPWORD_FILE, OPT_INTERACTIVE_TIMEOUT, OPT_JOIN_BUFF_SIZE, OPT_KEY_BUFFER_SIZE, OPT_LONG_QUERY_TIME, OPT_LOWER_CASE_TABLE_NAMES, OPT_MAX_ALLOWED_PACKET, @@ -3260,6 +3473,8 @@ enum options OPT_BDB_CACHE_SIZE, OPT_BDB_LOG_BUFFER_SIZE, OPT_BDB_MAX_LOCK, + OPT_ERROR_LOG_FILE, + OPT_AUTOCLOSE, OPT_ENABLE_SHARED_MEMORY, OPT_SHARED_MEMORY_BASE_NAME, OPT_OLD_PASSWORDS @@ -3272,6 +3487,9 @@ struct my_option my_long_options[] = { {"ansi", 'a', "Use ANSI SQL syntax instead of MySQL syntax", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, +#ifdef __NETWARE__ + {"autoclose", OPT_AUTOCLOSE, "Auto close screen. (NetWare only)", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, +#endif /* __NETWARE__ */ {"basedir", 'b', "Path to installation directory. All paths are usually resolved relative to this.", (gptr*) &mysql_home_ptr, (gptr*) &mysql_home_ptr, 0, GET_STR, REQUIRED_ARG, @@ -3313,10 +3531,10 @@ struct my_option my_long_options[] = REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"bootstrap", OPT_BOOTSTRAP, "Used by mysql installation scripts", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#ifdef __WIN__ - {"console", OPT_CONSOLE, "Don't remove the console window", + {"console", OPT_CONSOLE, "Write error output on screen; Don't remove the console window on windows", (gptr*) &opt_console, (gptr*) &opt_console, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, +#ifdef __WIN__ {"standalone", OPT_STANDALONE, "Dummy option to start as a standalone program (NT)", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -3558,6 +3776,9 @@ struct my_option my_long_options[] = {"pid-file", OPT_PID_FILE, "Pid file used by safe_mysqld", (gptr*) &pidfile_name_ptr, (gptr*) &pidfile_name_ptr, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"log-error", OPT_ERROR_LOG_FILE, "Log error file", + (gptr*) &log_error_file_ptr, (gptr*) &log_error_file_ptr, 0, GET_STR, + OPT_ARG, 0, 0, 0, 0, 0, 0}, {"port", 'P', "Port number to use for connection.", (gptr*) &mysql_port, (gptr*) &mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"reckless-slave", OPT_RECKLESS_SLAVE, "For debugging", 0, 0, 0, GET_NO_ARG, @@ -3737,7 +3958,8 @@ struct my_option my_long_options[] = (gptr*) &max_system_variables.log_warnings, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, { "back_log", OPT_BACK_LOG, - "The number of outstanding connection requests MySQL can have. This comes into play when the main MySQL thread gets very many connection requests in a very short time.", (gptr*) &back_log, (gptr*) &back_log, 0, GET_ULONG, + "The number of outstanding connection requests MySQL can have. This comes into play when the main MySQL thread gets very many connection requests in a very short time.", + (gptr*) &back_log, (gptr*) &back_log, 0, GET_ULONG, REQUIRED_ARG, 50, 1, 65535, 0, 1, 0 }, #ifdef HAVE_BERKELEY_DB { "bdb_cache_size", OPT_BDB_CACHE_SIZE, @@ -3790,9 +4012,13 @@ struct my_option my_long_options[] = (gptr*) &ft_max_word_len, (gptr*) &ft_max_word_len, 0, GET_ULONG, REQUIRED_ARG, HA_FT_MAXLEN, 10, HA_FT_MAXLEN, 0, 1, 0}, { "ft_max_word_len_for_sort", OPT_FT_MAX_WORD_LEN_FOR_SORT, - "Undocumented", (gptr*) &ft_max_word_len_for_sort, - (gptr*) &ft_max_word_len_for_sort, 0, GET_ULONG, REQUIRED_ARG, 20, 4, - HA_FT_MAXLEN, 0, 1, 0}, + "The maximum length of the word for repair_by_sorting. Longer words are included the slow way. The lower this value, the more words will be put in one sort bucket.", + (gptr*) &ft_max_word_len_for_sort, (gptr*) &ft_max_word_len_for_sort, 0, GET_ULONG, + REQUIRED_ARG, 20, 4, HA_FT_MAXLEN, 0, 1, 0}, + { "ft_stopword_file", OPT_FT_STOPWORD_FILE, + "Use stopwords from this file instead of built-in list.", + (gptr*) &ft_stopword_file, (gptr*) &ft_stopword_file, 0, GET_STR, + REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #ifdef HAVE_INNOBASE_DB {"innodb_mirrored_log_groups", OPT_INNODB_MIRRORED_LOG_GROUPS, "Number of identical copies of log groups we keep for the database. Currently this should be set to 1.", @@ -4185,8 +4411,8 @@ struct show_var_st status_vars[]= { {"Not_flushed_key_blocks", (char*) &_my_blocks_changed, SHOW_LONG_CONST}, {"Not_flushed_delayed_rows", (char*) &delayed_rows_in_use, SHOW_LONG_CONST}, {"Open_tables", (char*) 0, SHOW_OPENTABLES}, - {"Open_files", (char*) &my_file_opened, SHOW_INT_CONST}, - {"Open_streams", (char*) &my_stream_opened, SHOW_INT_CONST}, + {"Open_files", (char*) &my_file_opened, SHOW_LONG_CONST}, + {"Open_streams", (char*) &my_stream_opened, SHOW_LONG_CONST}, {"Opened_tables", (char*) &opened_tables, SHOW_LONG}, {"Questions", (char*) 0, SHOW_QUESTION}, #ifdef HAVE_QUERY_CACHE @@ -4275,7 +4501,6 @@ Starts the MySQL server\n"); printf("Usage: %s [OPTIONS]\n", my_progname); #ifdef __WIN__ puts("NT and Win32 specific options:\n\ - --console Don't remove the console window\n\ --install Install the default service (NT)\n\ --install-manual Install the default service started manually (NT)\n\ --install service_name Install an optional service (NT)\n\ @@ -4320,8 +4545,8 @@ static void set_options(void) global_system_variables.max_join_size= (ulonglong) HA_POS_ERROR; max_system_variables.max_join_size= (ulonglong) HA_POS_ERROR; -#ifdef __WIN__ - /* Allow Win32 users to move MySQL anywhere */ +#if defined(__WIN__) || defined(__NETWARE__) + /* Allow Win32 and NetWare users to move MySQL anywhere */ { char prg_dev[LIBLEN]; my_path(prg_dev,my_progname,"mysql/bin"); @@ -4423,6 +4648,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), case (int) OPT_BIN_LOG: opt_bin_log=1; break; + case (int) OPT_ERROR_LOG_FILE: + opt_error_log= 1; + break; #ifdef HAVE_REPLICATION case (int) OPT_INIT_RPL_ROLE: { @@ -4645,6 +4873,15 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), case (int) OPT_STANDALONE: /* Dummy option for NT */ break; #endif + case OPT_CONSOLE: + if (opt_console) + opt_error_log= 0; // Force logs to stdout + break; +#ifdef __NETWARE__ + case (int) OPT_AUTOCLOSE: + setscreenmode(SCR_AUTOCLOSE_ON_EXIT); + break; +#endif case (int) OPT_FLUSH: #ifdef HAVE_ISAM nisam_flush=1; @@ -4821,7 +5058,7 @@ static void get_options(int argc,char **argv) if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) exit(ho_error); -#ifdef HAVE_BROKEN_REALPATH +#if defined(HAVE_BROKEN_REALPATH) my_use_symdir=0; my_disable_symlinks=1; have_symlink=SHOW_OPTION_NO; diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc index 492834b5bb9..2ca6ddbab10 100644 --- a/sql/opt_sum.cc +++ b/sql/opt_sum.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB +/* Copyright (C) 2000-2003 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,28 +22,55 @@ static bool find_range_key(TABLE_REF *ref, Field* field,COND *cond); -/***************************************************************************** -** This function is only called for queries with sum functions and no -** GROUP BY part. -** This substitutes constants for some COUNT(), MIN() and MAX() functions. -** The function returns 1 if all items was resolved and -1 on impossible -** conditions -****************************************************************************/ +/* + Substitutes constants for some COUNT(), MIN() and MAX() functions. + + SYNOPSIS + opt_sum_query() + tables Tables in query + all_fields All fields to be returned + conds WHERE clause + + NOTE: + This function is only called for queries with sum functions and no + GROUP BY part. + + RETURN VALUES + 0 No errors + 1 if all items was resolved + -1 on impossible conditions +*/ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds) { List_iterator_fast<Item> it(all_fields); - int const_result=1; - bool recalc_const_item=0; - table_map removed_tables=0; + int const_result= 1; + bool recalc_const_item= 0; + table_map removed_tables= 0, outer_tables= 0, used_tables= 0; + table_map where_tables= 0; Item *item; COND *org_conds= conds; - /* Add all ON conditions to WHERE condition */ + if (conds) + where_tables= conds->used_tables(); + + /* Don't replace expression on a table that is part of an outer join */ for (TABLE_LIST *tl=tables; tl ; tl= tl->next) { if (tl->on_expr) - conds= and_expressions(conds, tl->on_expr, &org_conds); + { + outer_tables|= tl->table->map; + + /* + We can't optimise LEFT JOIN in cases where the WHERE condition + restricts the table that is used, like in: + SELECT MAX(t1.a) FROM t1 LEFT JOIN t2 join-condition + WHERE t2.field IS NULL; + */ + if (tl->table->map & where_tables) + return 0; + } + used_tables|= tl->table->map; } /* @@ -68,8 +95,8 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds) TABLE_LIST *table; for (table=tables; table ; table=table->next) { - if (table->on_expr || (table->table->file->table_flags() & - HA_NOT_EXACT_COUNT)) + if (outer_tables || (table->table->file->table_flags() & + HA_NOT_EXACT_COUNT)) { const_result=0; // Can't optimize left join break; @@ -99,21 +126,35 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds) byte key_buff[MAX_KEY_LENGTH]; TABLE_REF ref; ref.key_buff=key_buff; + Item_field *item_field= ((Item_field*) expr); + TABLE *table= item_field->field->table; - if (!find_range_key(&ref, ((Item_field*) expr)->field,conds)) + if ((outer_tables & table->map) || + (!find_range_key(&ref, item_field->field,conds))) { const_result=0; break; } - TABLE *table=((Item_field*) expr)->field->table; - bool error=table->file->index_init((uint) ref.key); + bool error= table->file->index_init((uint) ref.key); + enum ha_rkey_function find_flag= HA_READ_KEY_OR_NEXT; + uint prefix_len= ref.key_length; + /* + If we are doing MIN() on a column with NULL fields + we must read the key after the NULL column + */ + if (item_field->field->null_bit) + { + ref.key_buff[ref.key_length++]=1; + find_flag= HA_READ_AFTER_KEY; + } + if (!ref.key_length) error=table->file->index_first(table->record[0]) !=0; else error=table->file->index_read(table->record[0],key_buff, ref.key_length, - HA_READ_KEY_OR_NEXT) || - key_cmp(table, key_buff, ref.key, ref.key_length); + find_flag) || + key_cmp(table, key_buff, ref.key, prefix_len); if (table->key_read) { table->key_read=0; @@ -121,7 +162,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds) } table->file->index_end(); if (error) - return -1; // Impossible query + return -1; // No rows matching where removed_tables|= table->map; } else if (!expr->const_item()) // This is VERY seldom false @@ -147,13 +188,14 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds) byte key_buff[MAX_KEY_LENGTH]; TABLE_REF ref; ref.key_buff=key_buff; + TABLE *table=((Item_field*) expr)->field->table; - if (!find_range_key(&ref, ((Item_field*) expr)->field,conds)) + if ((outer_tables & table->map) || + !find_range_key(&ref, ((Item_field*) expr)->field,conds)) { const_result=0; break; } - TABLE *table=((Item_field*) expr)->field->table; if ((table->file->table_flags() & HA_NOT_READ_AFTER_KEY)) { const_result=0; @@ -203,8 +245,8 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds) const_result=0; } } - if (conds && (conds->used_tables() & ~ removed_tables)) - const_result=0; + if (used_tables != removed_tables) + const_result=0; // We didn't remove all tables return const_result; } diff --git a/sql/protocol.cc b/sql/protocol.cc index a89872e087f..c338feea9bc 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB +/* Copyright (C) 2000-2003 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,8 +30,12 @@ bool Protocol::net_store_data(const char *from, uint length) { ulong packet_length=packet->length(); - if (packet_length+5+length > packet->alloced_length() && - packet->realloc(packet_length+5+length)) + /* + The +9 comes from that strings of length longer than 16M require + 9 bytes to be stored (see net_store_length). + */ + if (packet_length+9+length > packet->alloced_length() && + packet->realloc(packet_length+9+length)) return 1; char *to=(char*) net_store_length((char*) packet->ptr()+packet_length, (ulonglong) length); diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc index 49b061ae6b4..9a7fb2282f4 100644 --- a/sql/repl_failsafe.cc +++ b/sql/repl_failsafe.cc @@ -77,7 +77,7 @@ static int init_failsafe_rpl_thread(THD* thd) DBUG_RETURN(-1); } -#if !defined(__WIN__) && !defined(OS2) +#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__) sigset_t set; VOID(sigemptyset(&set)); // Get mask in use VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals)); diff --git a/sql/set_var.cc b/sql/set_var.cc index cd02010c499..5686adb765e 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -444,11 +444,13 @@ struct show_var_st init_vars[]= { {sys_delayed_queue_size.name,(char*) &sys_delayed_queue_size, SHOW_SYS}, {sys_flush.name, (char*) &sys_flush, SHOW_SYS}, {sys_flush_time.name, (char*) &sys_flush_time, SHOW_SYS}, + {"ft_boolean_syntax", (char*) ft_boolean_syntax, SHOW_CHAR}, {"ft_min_word_len", (char*) &ft_min_word_len, SHOW_LONG}, {"ft_max_word_len", (char*) &ft_max_word_len, SHOW_LONG}, {"ft_max_word_len_for_sort",(char*) &ft_max_word_len_for_sort, SHOW_LONG}, - {"ft_boolean_syntax", (char*) ft_boolean_syntax, SHOW_CHAR}, + {"ft_stopword_file", (char*) &ft_stopword_file, SHOW_CHAR_PTR}, {"have_bdb", (char*) &have_berkeley_db, SHOW_HAVE}, + {"have_crypt", (char*) &have_crypt, SHOW_HAVE}, {"have_innodb", (char*) &have_innodb, SHOW_HAVE}, {"have_isam", (char*) &have_isam, SHOW_HAVE}, {"have_raid", (char*) &have_raid, SHOW_HAVE}, @@ -528,6 +530,7 @@ struct show_var_st init_vars[]= { {sys_net_write_timeout.name,(char*) &sys_net_write_timeout, SHOW_SYS}, {"open_files_limit", (char*) &open_files_limit, SHOW_LONG}, {"pid_file", (char*) pidfile_name, SHOW_CHAR}, + {"log_error", (char*) log_error_file, SHOW_CHAR}, {"port", (char*) &mysql_port, SHOW_INT}, {"protocol_version", (char*) &protocol_version, SHOW_INT}, {sys_pseudo_thread_id.name, (char*) &sys_pseudo_thread_id, SHOW_SYS}, diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt index 465992e63b2..954b7cd2fb3 100644 --- a/sql/share/english/errmsg.txt +++ b/sql/share/english/errmsg.txt @@ -77,7 +77,7 @@ "BLOB column '%-.64s' can't be used in key specification with the used table type", "Too big column length for column '%-.64s' (max = %d). Use BLOB instead", "Incorrect table definition; There can only be one auto column and it must be defined as a key", -"%s: ready for connections\n", +"%s: ready for connections.\nVersion: '%s' socket: '%s' port: %d\n", "%s: Normal shutdown\n", "%s: Got signal %d. Aborting!\n", "%s: Shutdown Complete\n", diff --git a/sql/slave.cc b/sql/slave.cc index 4572a265294..4b6ebfab5c8 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB +/* Copyright (C) 2000-2003 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -34,8 +34,7 @@ typedef bool (*CHECK_KILLED_FUNC)(THD*,void*); volatile bool slave_sql_running = 0, slave_io_running = 0; char* slave_load_tmpdir = 0; -MASTER_INFO main_mi; -MASTER_INFO* active_mi; +MASTER_INFO *active_mi; volatile int active_mi_in_use = 0; HASH replicate_do_table, replicate_ignore_table; DYNAMIC_ARRAY replicate_wild_do_table, replicate_wild_ignore_table; @@ -78,14 +77,23 @@ static int check_master_version(MYSQL* mysql, MASTER_INFO* mi); char* rewrite_db(char* db); -/***************************************************************************** - - init_thread_mask() - - Get a bit mask for which threads are running so that we can later restart - these threads. +/* + Find out which replications threads are running -*****************************************************************************/ + SYNOPSIS + init_thread_mask() + mask Return value here + mi master_info for slave + inverse If set, returns which threads are not running + + IMPLEMENTATION + Get a bit mask for which threads are running so that we can later restart + these threads. + + RETURN + mask If inverse == 0, running threads + If inverse == 1, stopped threads +*/ void init_thread_mask(int* mask,MASTER_INFO* mi,bool inverse) { @@ -100,11 +108,11 @@ void init_thread_mask(int* mask,MASTER_INFO* mi,bool inverse) *mask = tmp_mask; } -/***************************************************************************** +/* lock_slave_threads() +*/ -*****************************************************************************/ void lock_slave_threads(MASTER_INFO* mi) { //TODO: see if we can do this without dual mutex @@ -112,11 +120,11 @@ void lock_slave_threads(MASTER_INFO* mi) pthread_mutex_lock(&mi->rli.run_lock); } -/***************************************************************************** +/* unlock_slave_threads() +*/ -*****************************************************************************/ void unlock_slave_threads(MASTER_INFO* mi) { //TODO: see if we can do this without dual mutex @@ -124,11 +132,9 @@ void unlock_slave_threads(MASTER_INFO* mi) pthread_mutex_unlock(&mi->run_lock); } -/***************************************************************************** - init_slave() +/* Initialize slave structures */ -*****************************************************************************/ int init_slave() { DBUG_ENTER("init_slave"); @@ -137,18 +143,19 @@ int init_slave() TODO: re-write this to interate through the list of files for multi-master */ - active_mi = &main_mi; + active_mi= new MASTER_INFO; /* If master_host is not specified, try to read it from the master_info file. If master_host is specified, create the master_info file if it doesn't exists. */ - if (init_master_info(active_mi,master_info_file,relay_log_info_file, + if (!active_mi || + init_master_info(active_mi,master_info_file,relay_log_info_file, !master_host)) { - sql_print_error("Warning: failed to initialized master info"); - DBUG_RETURN(0); + sql_print_error("Note: Failed to initialized master info"); + goto err; } /* @@ -166,26 +173,24 @@ int init_slave() master_info_file, relay_log_info_file, SLAVE_IO | SLAVE_SQL)) + { sql_print_error("Warning: Can't create threads to handle slave"); + goto err; + } } DBUG_RETURN(0); -} -/***************************************************************************** +err: + DBUG_RETURN(1); +} - free_table_ent() -*****************************************************************************/ static void free_table_ent(TABLE_RULE_ENT* e) { my_free((gptr) e, MYF(0)); } -/***************************************************************************** - - get_table_key() -*****************************************************************************/ static byte* get_table_key(TABLE_RULE_ENT* e, uint* len, my_bool not_used __attribute__((unused))) { @@ -193,10 +198,8 @@ static byte* get_table_key(TABLE_RULE_ENT* e, uint* len, return (byte*)e->db; } -/***************************************************************************** - - init_relay_log_pos() +/* Open the given relay log SYNOPSIS @@ -223,8 +226,8 @@ static byte* get_table_key(TABLE_RULE_ENT* e, uint* len, RETURN VALUES 0 ok 1 error. errmsg is set to point to the error message +*/ -*****************************************************************************/ int init_relay_log_pos(RELAY_LOG_INFO* rli,const char* log, ulonglong pos, bool need_data_lock, const char** errmsg) @@ -305,13 +308,18 @@ err: DBUG_RETURN ((*errmsg) ? 1 : 0); } -/***************************************************************************** - init_slave_skip_errors() +/* + Init functio to set up array for errors that should be skipped for slave - called from get_options() in mysqld.cc on start-up + SYNOPSIS + init_slave_skip_errors() + arg List of errors numbers to skip, separated with ',' + + NOTES + Called from get_options() in mysqld.cc on start-up +*/ -*****************************************************************************/ void init_slave_skip_errors(const char* arg) { const char *p; @@ -340,13 +348,14 @@ void init_slave_skip_errors(const char* arg) } } -/***************************************************************************** +/* purge_relay_logs() - Assumes to have a run lock on rli and that no slave thread are running. + NOTES + Assumes to have a run lock on rli and that no slave thread are running. +*/ -*****************************************************************************/ int purge_relay_logs(RELAY_LOG_INFO* rli, THD *thd, bool just_reset, const char** errmsg) { @@ -391,11 +400,6 @@ err: } -/***************************************************************************** - - terminate_slave_threads() - -*****************************************************************************/ int terminate_slave_threads(MASTER_INFO* mi,int thread_mask,bool skip_lock) { if (!mi->inited) @@ -438,11 +442,7 @@ int terminate_slave_threads(MASTER_INFO* mi,int thread_mask,bool skip_lock) DBUG_RETURN(0); } -/***************************************************************************** - - terminate_slave_thread() -*****************************************************************************/ int terminate_slave_thread(THD* thd, pthread_mutex_t* term_lock, pthread_mutex_t *cond_lock, pthread_cond_t* term_cond, @@ -487,11 +487,6 @@ int terminate_slave_thread(THD* thd, pthread_mutex_t* term_lock, } -/***************************************************************************** - - start_slave_thread() - -*****************************************************************************/ int start_slave_thread(pthread_handler h_func, pthread_mutex_t *start_lock, pthread_mutex_t *cond_lock, pthread_cond_t *start_cond, @@ -554,15 +549,16 @@ int start_slave_thread(pthread_handler h_func, pthread_mutex_t *start_lock, DBUG_RETURN(0); } -/***************************************************************************** +/* start_slave_threads() - SLAVE_FORCE_ALL is not implemented here on purpose since it does not make - sense to do that for starting a slave--we always care if it actually - started the threads that were not previously running + NOTES + SLAVE_FORCE_ALL is not implemented here on purpose since it does not make + sense to do that for starting a slave--we always care if it actually + started the threads that were not previously running +*/ -*****************************************************************************/ int start_slave_threads(bool need_slave_mutex, bool wait_for_start, MASTER_INFO* mi, const char* master_info_fname, const char* slave_info_fname, int thread_mask) @@ -602,11 +598,7 @@ int start_slave_threads(bool need_slave_mutex, bool wait_for_start, DBUG_RETURN(error); } -/***************************************************************************** - - init_table_rule_hash() -*****************************************************************************/ void init_table_rule_hash(HASH* h, bool* h_inited) { hash_init(h, system_charset_info,TABLE_RULE_HASH_SIZE,0,0, @@ -615,11 +607,7 @@ void init_table_rule_hash(HASH* h, bool* h_inited) *h_inited = 1; } -/***************************************************************************** - init_table_rule_array() - -*****************************************************************************/ void init_table_rule_array(DYNAMIC_ARRAY* a, bool* a_inited) { my_init_dynamic_array(a, sizeof(TABLE_RULE_ENT*), TABLE_RULE_ARR_SIZE, @@ -627,11 +615,7 @@ void init_table_rule_array(DYNAMIC_ARRAY* a, bool* a_inited) *a_inited = 1; } -/***************************************************************************** - - find_wild() -*****************************************************************************/ static TABLE_RULE_ENT* find_wild(DYNAMIC_ARRAY *a, const char* key, int len) { uint i; @@ -651,52 +635,121 @@ static TABLE_RULE_ENT* find_wild(DYNAMIC_ARRAY *a, const char* key, int len) return 0; } -/***************************************************************************** - tables_ok() +/* + Checks whether tables match some (wild_)do_table and (wild_)ignore_table + rules (for replication) + + SYNOPSIS + tables_ok() + thd thread (SQL slave thread normally) + tables list of tables to check + + NOTES + Note that changing the order of the tables in the list can lead to + different results. Note also the order of precedence of the do/ignore + rules (see code below). For that reason, users should not set conflicting + rules because they may get unpredicted results. + + RETURN VALUES + 0 should not be logged/replicated + 1 should be logged/replicated +*/ -*****************************************************************************/ int tables_ok(THD* thd, TABLE_LIST* tables) { + DBUG_ENTER("tables_ok"); + for (; tables; tables = tables->next) { + char hash_key[2*NAME_LEN+2]; + char *end; + uint len; + if (!tables->updating) continue; - char hash_key[2*NAME_LEN+2]; - char* p; - p = strmov(hash_key, tables->db ? tables->db : thd->db); - *p++ = '.'; - uint len = strmov(p, tables->real_name) - hash_key ; + end= strmov(hash_key, tables->db ? tables->db : thd->db); + *end++= '.'; + len= (uint) (strmov(end, tables->real_name) - hash_key); if (do_table_inited) // if there are any do's { if (hash_search(&replicate_do_table, (byte*) hash_key, len)) - return 1; + DBUG_RETURN(1); } if (ignore_table_inited) // if there are any ignores { if (hash_search(&replicate_ignore_table, (byte*) hash_key, len)) - return 0; + DBUG_RETURN(0); } if (wild_do_table_inited && find_wild(&replicate_wild_do_table, hash_key, len)) - return 1; + DBUG_RETURN(1); if (wild_ignore_table_inited && find_wild(&replicate_wild_ignore_table, hash_key, len)) - return 0; + DBUG_RETURN(0); } /* If no explicit rule found and there was a do list, do not replicate. If there was no do list, go ahead */ - return !do_table_inited && !wild_do_table_inited; + DBUG_RETURN(!do_table_inited && !wild_do_table_inited); } -/***************************************************************************** - add_table_rule() +/* + Checks whether a db matches wild_do_table and wild_ignore_table + rules (for replication) + + SYNOPSIS + db_ok_with_wild_table() + db name of the db to check. + Is tested with check_db_name() before calling this function. + + NOTES + Here is the reason for this function. + We advise users who want to exclude a database 'db1' safely to do it + with replicate_wild_ignore_table='db1.%' instead of binlog_ignore_db or + replicate_ignore_db because the two lasts only check for the selected db, + which won't work in that case: + USE db2; + UPDATE db1.t SET ... #this will be replicated and should not + whereas replicate_wild_ignore_table will work in all cases. + With replicate_wild_ignore_table, we only check tables. When + one does 'DROP DATABASE db1', tables are not involved and the + statement will be replicated, while users could expect it would not (as it + rougly means 'DROP db1.first_table, DROP db1.second_table...'). + In other words, we want to interpret 'db1.%' as "everything touching db1". + That is why we want to match 'db1' against 'db1.%' wild table rules. + + RETURN VALUES + 0 should not be logged/replicated + 1 should be logged/replicated + */ + +int db_ok_with_wild_table(const char *db) +{ + char hash_key[NAME_LEN+2]; + char *end; + int len; + end= strmov(hash_key, db); + *end++= '.'; + len= end - hash_key ; + if (wild_do_table_inited && find_wild(&replicate_wild_do_table, + hash_key, len)) + return 1; + if (wild_ignore_table_inited && find_wild(&replicate_wild_ignore_table, + hash_key, len)) + return 0; + + /* + If no explicit rule found and there was a do list, do not replicate. + If there was no do list, go ahead + */ + return !wild_do_table_inited; +} + -*****************************************************************************/ int add_table_rule(HASH* h, const char* table_spec) { const char* dot = strchr(table_spec, '.'); @@ -714,11 +767,11 @@ int add_table_rule(HASH* h, const char* table_spec) return 0; } -/***************************************************************************** - add_wild_table_rule() +/* + Add table expression with wildcards to dynamic array +*/ -*****************************************************************************/ int add_wild_table_rule(DYNAMIC_ARRAY* a, const char* table_spec) { const char* dot = strchr(table_spec, '.'); @@ -735,11 +788,7 @@ int add_wild_table_rule(DYNAMIC_ARRAY* a, const char* table_spec) return 0; } -/***************************************************************************** - free_string_array() - -*****************************************************************************/ static void free_string_array(DYNAMIC_ARRAY *a) { uint i; @@ -752,11 +801,7 @@ static void free_string_array(DYNAMIC_ARRAY *a) delete_dynamic(a); } -/***************************************************************************** - - end_slave_on_walk() -*****************************************************************************/ #ifdef NOT_USED_YET static int end_slave_on_walk(MASTER_INFO* mi, gptr /*unused*/) { @@ -765,35 +810,39 @@ static int end_slave_on_walk(MASTER_INFO* mi, gptr /*unused*/) } #endif -/***************************************************************************** - end_slave() +/* + Free all resources used by slave + + SYNOPSIS + end_slave() +*/ -*****************************************************************************/ void end_slave() { - /* - TODO: replace the line below with - list_walk(&master_list, (list_walk_action)end_slave_on_walk,0); - once multi-master code is ready. - */ - terminate_slave_threads(active_mi,SLAVE_FORCE_ALL); - end_master_info(active_mi); - if (do_table_inited) - hash_free(&replicate_do_table); - if (ignore_table_inited) - hash_free(&replicate_ignore_table); - if (wild_do_table_inited) - free_string_array(&replicate_wild_do_table); - if (wild_ignore_table_inited) - free_string_array(&replicate_wild_ignore_table); + if (active_mi) + { + /* + TODO: replace the line below with + list_walk(&master_list, (list_walk_action)end_slave_on_walk,0); + once multi-master code is ready. + */ + terminate_slave_threads(active_mi,SLAVE_FORCE_ALL); + end_master_info(active_mi); + if (do_table_inited) + hash_free(&replicate_do_table); + if (ignore_table_inited) + hash_free(&replicate_ignore_table); + if (wild_do_table_inited) + free_string_array(&replicate_wild_do_table); + if (wild_ignore_table_inited) + free_string_array(&replicate_wild_ignore_table); + delete active_mi; + active_mi= 0; + } } -/***************************************************************************** - - io_slave_killed() -*****************************************************************************/ static bool io_slave_killed(THD* thd, MASTER_INFO* mi) { DBUG_ASSERT(mi->io_thd == thd); @@ -801,11 +850,7 @@ static bool io_slave_killed(THD* thd, MASTER_INFO* mi) return mi->abort_slave || abort_loop || thd->killed; } -/***************************************************************************** - sql_slave_killed() - -*****************************************************************************/ static bool sql_slave_killed(THD* thd, RELAY_LOG_INFO* rli) { DBUG_ASSERT(rli->sql_thd == thd); @@ -813,11 +858,7 @@ static bool sql_slave_killed(THD* thd, RELAY_LOG_INFO* rli) return rli->abort_slave || abort_loop || thd->killed; } -/***************************************************************************** - - slave_print_error() -*****************************************************************************/ void slave_print_error(RELAY_LOG_INFO* rli, int err_code, const char* msg, ...) { va_list args; @@ -829,13 +870,13 @@ void slave_print_error(RELAY_LOG_INFO* rli, int err_code, const char* msg, ...) rli->last_slave_errno = err_code; } -/***************************************************************************** - +/* skip_load_data_infile() - This is used to tell a 3.23 master to break send_file() + NOTES + This is used to tell a 3.23 master to break send_file() +*/ -*****************************************************************************/ void skip_load_data_infile(NET *net) { (void)net_request_file(net, "/dev/null"); @@ -843,22 +884,14 @@ void skip_load_data_infile(NET *net) (void)net_write_command(net, 0, "", 0, "", 0); // Send ok } -/***************************************************************************** - net_request_file() - -*****************************************************************************/ bool net_request_file(NET* net, const char* fname) { DBUG_ENTER("net_request_file"); DBUG_RETURN(net_write_command(net, 251, fname, strlen(fname), "", 0)); } -/***************************************************************************** - - rewrite_db() -*****************************************************************************/ char* rewrite_db(char* db) { if (replicate_rewrite_db.is_empty() || !db) @@ -874,11 +907,22 @@ char* rewrite_db(char* db) return db; } -/***************************************************************************** - db_ok() +/* + Checks whether a db matches some do_db and ignore_db rules + (for logging or replication) + + SYNOPSIS + db_ok() + db name of the db to check + do_list either binlog_do_db or replicate_do_db + ignore_list either binlog_ignore_db or replicate_ignore_db + + RETURN VALUES + 0 should not be logged/replicated + 1 should be logged/replicated +*/ -*****************************************************************************/ int db_ok(const char* db, I_List<i_string> &do_list, I_List<i_string> &ignore_list ) { @@ -918,11 +962,7 @@ int db_ok(const char* db, I_List<i_string> &do_list, } } -/***************************************************************************** - init_strvar_from_file() - -*****************************************************************************/ static int init_strvar_from_file(char *var, int max_size, IO_CACHE *f, const char *default_val) { @@ -951,11 +991,7 @@ static int init_strvar_from_file(char *var, int max_size, IO_CACHE *f, return 1; } -/***************************************************************************** - - init_intvar_from_file() -*****************************************************************************/ static int init_intvar_from_file(int* var, IO_CACHE* f, int default_val) { char buf[32]; @@ -973,11 +1009,7 @@ static int init_intvar_from_file(int* var, IO_CACHE* f, int default_val) return 1; } -/***************************************************************************** - check_master_version() - -*****************************************************************************/ static int check_master_version(MYSQL* mysql, MASTER_INFO* mi) { const char* errmsg= 0; @@ -1003,11 +1035,7 @@ static int check_master_version(MYSQL* mysql, MASTER_INFO* mi) return 0; } -/***************************************************************************** - - create_table_from_dump() -*****************************************************************************/ static int create_table_from_dump(THD* thd, NET* net, const char* db, const char* table_name) { @@ -1110,11 +1138,7 @@ err: return error; } -/***************************************************************************** - - fetch_master_table() -*****************************************************************************/ int fetch_master_table(THD *thd, const char *db_name, const char *table_name, MASTER_INFO *mi, MYSQL *mysql) { @@ -1161,11 +1185,8 @@ int fetch_master_table(THD *thd, const char *db_name, const char *table_name, send_error(thd, error, errmsg); DBUG_RETURN(test(error)); // Return 1 on error } -/***************************************************************************** - end_master_info() -*****************************************************************************/ void end_master_info(MASTER_INFO* mi) { DBUG_ENTER("end_master_info"); @@ -1184,11 +1205,7 @@ void end_master_info(MASTER_INFO* mi) DBUG_VOID_RETURN; } -/***************************************************************************** - init_relay_log_info() - -*****************************************************************************/ int init_relay_log_info(RELAY_LOG_INFO* rli, const char* info_fname) { char fname[FN_REFLEN+128]; @@ -1322,11 +1339,7 @@ err: DBUG_RETURN(1); } -/***************************************************************************** - - add_relay_log() -*****************************************************************************/ static inline int add_relay_log(RELAY_LOG_INFO* rli,LOG_INFO* linfo) { MY_STAT s; @@ -1345,11 +1358,7 @@ static inline int add_relay_log(RELAY_LOG_INFO* rli,LOG_INFO* linfo) DBUG_RETURN(0); } -/***************************************************************************** - - wait_for_relay_log_space() -*****************************************************************************/ static bool wait_for_relay_log_space(RELAY_LOG_INFO* rli) { bool slave_killed=0; @@ -1373,11 +1382,7 @@ static bool wait_for_relay_log_space(RELAY_LOG_INFO* rli) DBUG_RETURN(slave_killed); } -/***************************************************************************** - count_relay_log_space() - -*****************************************************************************/ static int count_relay_log_space(RELAY_LOG_INFO* rli) { LOG_INFO linfo; @@ -1396,11 +1401,7 @@ static int count_relay_log_space(RELAY_LOG_INFO* rli) DBUG_RETURN(0); } -/***************************************************************************** - - init_master_info() -*****************************************************************************/ int init_master_info(MASTER_INFO* mi, const char* master_info_fname, const char* slave_info_fname, bool abort_if_no_master_info_file) @@ -1518,11 +1519,7 @@ err: DBUG_RETURN(1); } -/***************************************************************************** - - register_slave_on_master() -*****************************************************************************/ int register_slave_on_master(MYSQL* mysql) { char buf[1024], *pos= buf; @@ -1560,11 +1557,7 @@ int register_slave_on_master(MYSQL* mysql) return 0; } -/***************************************************************************** - show_master_info() - -*****************************************************************************/ int show_master_info(THD* thd, MASTER_INFO* mi) { // TODO: fix this for multi-master @@ -1641,11 +1634,7 @@ int show_master_info(THD* thd, MASTER_INFO* mi) DBUG_RETURN(0); } -/***************************************************************************** - - flush_master_info() -*****************************************************************************/ bool flush_master_info(MASTER_INFO* mi) { IO_CACHE* file = &mi->file; @@ -1662,73 +1651,214 @@ bool flush_master_info(MASTER_INFO* mi) DBUG_RETURN(0); } -/***************************************************************************** - st_relay_log_info::wait_for_pos() +st_relay_log_info::st_relay_log_info() + :info_fd(-1), cur_log_fd(-1), master_log_pos(0), save_temporary_tables(0), + cur_log_old_open_count(0), log_space_total(0), + slave_skip_counter(0), abort_pos_wait(0), slave_run_id(0), + sql_thd(0), last_slave_errno(0), inited(0), abort_slave(0), + slave_running(0), log_pos_current(0), skip_log_purge(0), + inside_transaction(0) /* the default is autocommit=1 */ +{ + relay_log_name[0] = master_log_name[0] = 0; + last_slave_error[0]=0; + + + bzero(&info_file,sizeof(info_file)); + bzero(&cache_buf, sizeof(cache_buf)); + pthread_mutex_init(&run_lock, MY_MUTEX_INIT_FAST); + pthread_mutex_init(&data_lock, MY_MUTEX_INIT_FAST); + pthread_mutex_init(&log_space_lock, MY_MUTEX_INIT_FAST); + pthread_cond_init(&data_cond, NULL); + pthread_cond_init(&start_cond, NULL); + pthread_cond_init(&stop_cond, NULL); + pthread_cond_init(&log_space_cond, NULL); +} + + +st_relay_log_info::~st_relay_log_info() +{ + pthread_mutex_destroy(&run_lock); + pthread_mutex_destroy(&data_lock); + pthread_mutex_destroy(&log_space_lock); + pthread_cond_destroy(&data_cond); + pthread_cond_destroy(&start_cond); + pthread_cond_destroy(&stop_cond); + pthread_cond_destroy(&log_space_cond); +} + +/* + Waits until the SQL thread reaches (has executed up to) the + log/position or timed out. + + SYNOPSIS + wait_for_pos() + thd client thread that sent SELECT MASTER_POS_WAIT + log_name log name to wait for + log_pos position to wait for + timeout timeout in seconds before giving up waiting + + NOTES + timeout is longlong whereas it should be ulong ; but this is + to catch if the user submitted a negative timeout. + + RETURN VALUES + -2 improper arguments (log_pos<0) + or slave not running, or master info changed + during the function's execution, + or client thread killed. -2 is translated to NULL by caller + -1 timed out + >=0 number of log events the function had to wait + before reaching the desired log/position + */ -*****************************************************************************/ int st_relay_log_info::wait_for_pos(THD* thd, String* log_name, - ulonglong log_pos) + longlong log_pos, + longlong timeout) { if (!inited) return -1; int event_count = 0; ulong init_abort_pos_wait; + int error=0; + struct timespec abstime; // for timeout checking + set_timespec(abstime,timeout); + DBUG_ENTER("wait_for_pos"); - DBUG_PRINT("enter",("master_log_name: '%s' pos: %ld", - master_log_name, (ulong) master_log_pos)); + DBUG_PRINT("enter",("master_log_name: '%s' pos: %lu timeout: %ld", + master_log_name, (ulong) master_log_pos, + (long) timeout)); pthread_mutex_lock(&data_lock); - // abort only if master info changes during wait + /* + This function will abort when it notices that + some CHANGE MASTER or RESET MASTER has changed + the master info. To catch this, these commands + modify abort_pos_wait ; we just monitor abort_pos_wait + and see if it has changed. + */ init_abort_pos_wait= abort_pos_wait; + /* + We'll need to + handle all possible log names comparisons (e.g. 999 vs 1000). + We use ulong for string->number conversion ; this is no + stronger limitation than in find_uniq_filename in sql/log.cc + */ + ulong log_name_extension; + char log_name_tmp[FN_REFLEN]; //make a char[] from String + char *end= strmake(log_name_tmp, log_name->ptr(), min(log_name->length(), + FN_REFLEN-1)); + char *p= fn_ext(log_name_tmp); + char *p_end; + if (!*p || log_pos<0) + { + error= -2; //means improper arguments + goto err; + } + //p points to '.' + log_name_extension= strtoul(++p, &p_end, 10); + /* + p_end points to the first invalid character. + If it equals to p, no digits were found, error. + If it contains '\0' it means conversion went ok. + */ + if (p_end==p || *p_end) + { + error= -2; + goto err; + } + + //"compare and wait" main loop while (!thd->killed && - init_abort_pos_wait == abort_pos_wait && - mi->slave_running) + init_abort_pos_wait == abort_pos_wait && + mi->slave_running) { bool pos_reached; - int different_file= 0; + int cmp_result= 0; DBUG_ASSERT(*master_log_name || master_log_pos == 0); if (*master_log_name) { + char *basename= master_log_name + dirname_length(master_log_name); /* - TODO: - Replace strncmp() with a comparison function that - can handle comparison of the following files: - mysqlbin.999 - mysqlbin.1000 + First compare the parts before the extension. + Find the dot in the master's log basename, + and protect against user's input error : + if the names do not match up to '.' included, return error */ - char *basename= master_log_name + dirname_length(master_log_name); - different_file = strncmp(basename, log_name->ptr(), - log_name->length()); + char *q= (char*)(fn_ext(basename)+1); + if (strncmp(basename, log_name_tmp, (int)(q-basename))) + { + error= -2; + break; + } + // Now compare extensions. + char *q_end; + ulong master_log_name_extension= strtoul(q, &q_end, 10); + if (master_log_name_extension < log_name_extension) + cmp_result = -1 ; + else + cmp_result= (master_log_name_extension > log_name_extension) ? 1 : 0 ; } - pos_reached = ((!different_file && master_log_pos >= log_pos) || - different_file > 0); + pos_reached = ((!cmp_result && master_log_pos >= (ulonglong)log_pos) || + cmp_result > 0); if (pos_reached || thd->killed) break; + + //wait for master update, with optional timeout. DBUG_PRINT("info",("Waiting for master update")); const char* msg = thd->enter_cond(&data_cond, &data_lock, - "Waiting for master update"); - pthread_cond_wait(&data_cond, &data_lock); + "Waiting for master update"); + if (timeout > 0) + { + /* + Note that pthread_cond_timedwait checks for the timeout + before for the condition ; i.e. it returns ETIMEDOUT + if the system time equals or exceeds the time specified by abstime + before the condition variable is signaled or broadcast, _or_ if + the absolute time specified by abstime has already passed at the time + of the call. + For that reason, pthread_cond_timedwait will do the "timeoutting" job + even if its condition is always immediately signaled (case of a loaded + master). + */ + error=pthread_cond_timedwait(&data_cond, &data_lock, &abstime); + } + else + pthread_cond_wait(&data_cond, &data_lock); thd->exit_cond(msg); + if (error == ETIMEDOUT || error == ETIME) + { + error= -1; + break; + } + error=0; event_count++; } + +err: pthread_mutex_unlock(&data_lock); - DBUG_PRINT("exit",("killed: %d abort: %d slave_running: %d", - (int) thd->killed, - (int) (init_abort_pos_wait != abort_pos_wait), - (int) mi->slave_running)); - DBUG_RETURN((thd->killed || init_abort_pos_wait != abort_pos_wait || - !mi->slave_running) ? - -1 : event_count); + DBUG_PRINT("exit",("killed: %d abort: %d slave_running: %d \ +improper_arguments: %d timed_out: %d", + (int) thd->killed, + (int) (init_abort_pos_wait != abort_pos_wait), + (int) mi->slave_running, + (int) (error == -2), + (int) (error == -1))); + if (thd->killed || init_abort_pos_wait != abort_pos_wait || + !mi->slave_running) + { + error= -2; + } + DBUG_RETURN( error ? error : event_count ); } -/***************************************************************************** +/* init_slave_thread() +*/ -*****************************************************************************/ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type) { DBUG_ENTER("init_slave_thread"); @@ -1753,7 +1883,7 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type) DBUG_RETURN(-1); } -#if !defined(__WIN__) && !defined(OS2) +#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__) sigset_t set; VOID(sigemptyset(&set)); // Get mask in use VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals)); @@ -1771,11 +1901,7 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type) DBUG_RETURN(0); } -/***************************************************************************** - - safe_sleep() -*****************************************************************************/ static int safe_sleep(THD* thd, int sec, CHECK_KILLED_FUNC thread_killed, void* thread_killed_arg) { @@ -1804,11 +1930,7 @@ static int safe_sleep(THD* thd, int sec, CHECK_KILLED_FUNC thread_killed, return 0; } -/***************************************************************************** - request_dump() - -*****************************************************************************/ static int request_dump(MYSQL* mysql, MASTER_INFO* mi, bool *suppress_warnings) { @@ -1843,11 +1965,7 @@ static int request_dump(MYSQL* mysql, MASTER_INFO* mi, DBUG_RETURN(0); } -/***************************************************************************** - - request_table_dump() -*****************************************************************************/ static int request_table_dump(MYSQL* mysql, const char* db, const char* table) { char buf[1024]; @@ -1877,10 +1995,7 @@ command"); } -/***************************************************************************** - - read_event() - +/* Read one event from the master SYNOPSIS @@ -1895,8 +2010,8 @@ command"); RETURN VALUES 'packet_error' Error number Length of packet +*/ -*****************************************************************************/ static ulong read_event(MYSQL* mysql, MASTER_INFO *mi, bool* suppress_warnings) { ulong len; @@ -1945,11 +2060,7 @@ server_errno=%d)", return len - 1; } -/***************************************************************************** - - check_expected_error() -*****************************************************************************/ int check_expected_error(THD* thd, RELAY_LOG_INFO* rli, int expected_error) { switch (expected_error) { @@ -1971,11 +2082,7 @@ point. If you are sure that your master is ok, run this query manually on the\ } } -/***************************************************************************** - exec_relay_log_event() - -*****************************************************************************/ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli) { DBUG_ASSERT(rli->sql_thd==thd); @@ -2040,9 +2147,8 @@ This may also be a network problem, or just a bug in the master or slave code.\ } } -/***************************************************************************** - Slave I/O Thread entry point -*****************************************************************************/ + +/* Slave I/O Thread entry point */ extern "C" pthread_handler_decl(handle_slave_io,arg) { @@ -2303,20 +2409,21 @@ err: THD_CHECK_SENTRY(thd); delete thd; pthread_mutex_unlock(&LOCK_thread_count); - my_thread_end(); // clean-up before broadcast pthread_cond_broadcast(&mi->stop_cond); // tell the world we are done pthread_mutex_unlock(&mi->run_lock); #ifndef DBUG_OFF if (abort_slave_event_count && !events_till_abort) goto slave_begin; #endif + my_thread_end(); +#ifndef __NETWARE__ pthread_exit(0); +#endif /* __NETWARE__ */ DBUG_RETURN(0); // Can't return anything here } -/***************************************************************************** - Slave SQL Thread entry point -*****************************************************************************/ + +/* Slave SQL Thread entry point */ extern "C" pthread_handler_decl(handle_slave_sql,arg) { @@ -2443,7 +2550,6 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \ THD_CHECK_SENTRY(thd); delete thd; pthread_mutex_unlock(&LOCK_thread_count); - my_thread_end(); // clean-up before broadcasting termination pthread_cond_broadcast(&rli->stop_cond); // tell the world we are done pthread_mutex_unlock(&rli->run_lock); @@ -2451,15 +2557,18 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \ if (abort_slave_event_count && !rli->events_till_abort) goto slave_begin; #endif + my_thread_end(); +#ifndef __NETWARE__ pthread_exit(0); +#endif /* __NETWARE__ */ DBUG_RETURN(0); // Can't return anything here } -/***************************************************************************** +/* process_io_create_file() +*/ -*****************************************************************************/ static int process_io_create_file(MASTER_INFO* mi, Create_file_log_event* cev) { int error = 1; @@ -2491,9 +2600,10 @@ static int process_io_create_file(MASTER_INFO* mi, Create_file_log_event* cev) goto err; } - /* this dummy block is so we could instantiate Append_block_log_event - once and then modify it slightly instead of doing it multiple times - in the loop + /* + This dummy block is so we could instantiate Append_block_log_event + once and then modify it slightly instead of doing it multiple times + in the loop */ { Append_block_log_event aev(thd,0,0,0); @@ -2554,10 +2664,8 @@ err: DBUG_RETURN(error); } -/***************************************************************************** - - process_io_rotate() +/* Start using a new binary log on the master SYNOPSIS @@ -2576,7 +2684,8 @@ err: 0 ok 1 Log event is illegal -*****************************************************************************/ +*/ + static int process_io_rotate(MASTER_INFO *mi, Rotate_log_event *rev) { int return_val= 1; @@ -2601,15 +2710,15 @@ static int process_io_rotate(MASTER_INFO *mi, Rotate_log_event *rev) DBUG_RETURN(0); } -/***************************************************************************** +/* queue_old_event() TODO: Test this code before release - it has to be tested on a separate setup with 3.23 master +*/ -*****************************************************************************/ static int queue_old_event(MASTER_INFO *mi, const char *buf, ulong event_len) { @@ -2697,14 +2806,14 @@ static int queue_old_event(MASTER_INFO *mi, const char *buf, DBUG_RETURN(0); } -/***************************************************************************** +/* queue_event() TODO: verify the issue with stop events, see if we need them at all in the relay log +*/ -*****************************************************************************/ int queue_event(MASTER_INFO* mi,const char* buf, ulong event_len) { int error= 0; @@ -2757,11 +2866,7 @@ int queue_event(MASTER_INFO* mi,const char* buf, ulong event_len) DBUG_RETURN(error); } -/***************************************************************************** - - end_relay_log_info() -*****************************************************************************/ void end_relay_log_info(RELAY_LOG_INFO* rli) { DBUG_ENTER("end_relay_log_info"); @@ -2786,26 +2891,35 @@ void end_relay_log_info(RELAY_LOG_INFO* rli) DBUG_VOID_RETURN; } -/***************************************************************************** +/* + Try to connect until successful or slave killed - safe_connect() + SYNPOSIS + safe_connect() + thd Thread handler for slave + mysql MySQL connection handle + mi Replication handle - Try to connect until successful or slave killed + RETURN + 0 ok + # Error +*/ -*****************************************************************************/ static int safe_connect(THD* thd, MYSQL* mysql, MASTER_INFO* mi) { return connect_to_master(thd, mysql, mi, 0, 0); } -/***************************************************************************** - connect_to_master() +/* + SYNPOSIS + connect_to_master() - Try to connect until successful or slave killed or we have retried - master_retry_count times + IMPLEMENTATION + Try to connect until successful or slave killed or we have retried + master_retry_count times +*/ -*****************************************************************************/ static int connect_to_master(THD* thd, MYSQL* mysql, MASTER_INFO* mi, bool reconnect, bool suppress_warnings) { @@ -2884,24 +2998,23 @@ replication resumed in log '%s' at position %s", mi->user, DBUG_RETURN(slave_was_killed); } -/***************************************************************************** +/* safe_reconnect() - Try to connect until successful or slave killed or we have retried - master_retry_count times + IMPLEMENTATION + Try to connect until successful or slave killed or we have retried + master_retry_count times +*/ -*****************************************************************************/ static int safe_reconnect(THD* thd, MYSQL* mysql, MASTER_INFO* mi, bool suppress_warnings) { return connect_to_master(thd, mysql, mi, 1, suppress_warnings); } -/***************************************************************************** - - flush_relay_log_info() +/* Store the file and position where the execute-slave thread are in the relay log. @@ -2928,8 +3041,8 @@ static int safe_reconnect(THD* thd, MYSQL* mysql, MASTER_INFO* mi, RETURN VALUES 0 ok 1 write error +*/ -*****************************************************************************/ bool flush_relay_log_info(RELAY_LOG_INFO* rli) { bool error=0; @@ -2958,13 +3071,11 @@ bool flush_relay_log_info(RELAY_LOG_INFO* rli) return error; } -/***************************************************************************** - - reopen_relay_log() +/* Called when we notice that the current "hot" log got rotated under our feet. +*/ -*****************************************************************************/ static IO_CACHE *reopen_relay_log(RELAY_LOG_INFO *rli, const char **errmsg) { DBUG_ASSERT(rli->cur_log != &rli->cache_buf); @@ -2984,11 +3095,7 @@ static IO_CACHE *reopen_relay_log(RELAY_LOG_INFO *rli, const char **errmsg) DBUG_RETURN(cur_log); } -/***************************************************************************** - - next_event() -*****************************************************************************/ Log_event* next_event(RELAY_LOG_INFO* rli) { Log_event* ev; diff --git a/sql/slave.h b/sql/slave.h index 8122975a809..5dd7fe8072b 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -117,7 +117,7 @@ typedef struct st_relay_log_info created temporary tables. Modified only on init/end and by the SQL thread, read only by SQL thread. */ - TABLE* save_temporary_tables; + TABLE *save_temporary_tables; /* standard lock acquistion order to avoid deadlocks: @@ -190,33 +190,8 @@ typedef struct st_relay_log_info bool skip_log_purge; bool inside_transaction; - st_relay_log_info() - :info_fd(-1),cur_log_fd(-1), cur_log_old_open_count(0), abort_pos_wait(0), - slave_run_id(0), inited(0), abort_slave(0), slave_running(0), - log_pos_current(0), skip_log_purge(0), - inside_transaction(0) /* the default is autocommit=1 */ - { - relay_log_name[0] = master_log_name[0] = 0; - bzero(&info_file,sizeof(info_file)); - bzero(&cache_buf, sizeof(cache_buf)); - pthread_mutex_init(&run_lock, MY_MUTEX_INIT_FAST); - pthread_mutex_init(&data_lock, MY_MUTEX_INIT_FAST); - pthread_mutex_init(&log_space_lock, MY_MUTEX_INIT_FAST); - pthread_cond_init(&data_cond, NULL); - pthread_cond_init(&start_cond, NULL); - pthread_cond_init(&stop_cond, NULL); - pthread_cond_init(&log_space_cond, NULL); - } - ~st_relay_log_info() - { - pthread_mutex_destroy(&run_lock); - pthread_mutex_destroy(&data_lock); - pthread_mutex_destroy(&log_space_lock); - pthread_cond_destroy(&data_cond); - pthread_cond_destroy(&start_cond); - pthread_cond_destroy(&stop_cond); - pthread_cond_destroy(&log_space_cond); - } + st_relay_log_info(); + ~st_relay_log_info(); inline void inc_pending(ulonglong val) { pending += val; @@ -245,7 +220,8 @@ typedef struct st_relay_log_info pthread_mutex_unlock(&data_lock); } - int wait_for_pos(THD* thd, String* log_name, ulonglong log_pos); + int wait_for_pos(THD* thd, String* log_name, longlong log_pos, + longlong timeout); } RELAY_LOG_INFO; @@ -414,6 +390,7 @@ int tables_ok(THD* thd, TABLE_LIST* tables); */ int db_ok(const char* db, I_List<i_string> &do_list, I_List<i_string> &ignore_list ); +int db_ok_with_wild_table(const char *db); int add_table_rule(HASH* h, const char* table_spec); int add_wild_table_rule(DYNAMIC_ARRAY* a, const char* table_spec); diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 3dc370b7b63..689b14caac9 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -2849,8 +2849,6 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user) VOID(pthread_mutex_lock(&acl_cache->lock)); /* Add first global access grants */ - if (acl_user->access || acl_user->password || - acl_user->ssl_type != SSL_TYPE_NONE) { want_access=acl_user->access; String global(buff,sizeof(buff),&my_charset_latin1); @@ -2983,6 +2981,8 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user) if (test_all_bits(want_access,(DB_ACLS & ~GRANT_ACL))) db.append("ALL PRIVILEGES",14); + else if (!(want_access & ~GRANT_ACL)) + db.append("USAGE",5); else { int found=0, cnt; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 21cdaa28a4f..f4a32b482b3 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -495,7 +495,7 @@ void close_temporary_tables(THD *thd) query_buf_size= 50; // Enough for DROP ... TABLE for (table=thd->temporary_tables ; table ; table=table->next) - query_buf_size += table->key_length; + query_buf_size+= table->key_length+1; if ((query = alloc_root(&thd->mem_root, query_buf_size))) end=strmov(query, "DROP /*!40005 TEMPORARY */ TABLE "); diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 3975f65a43c..4d78a03289b 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -186,7 +186,7 @@ THD::THD():user_time(0), is_fatal_error(0), */ { pthread_mutex_lock(&LOCK_thread_count); - ulong tmp=(ulong) (rnd(&sql_rand) * 3000000); + ulong tmp=(ulong) (rnd(&sql_rand) * 0xffffffff); /* make all bits random */ pthread_mutex_unlock(&LOCK_thread_count); randominit(&rand, tmp + (ulong) &rand, tmp + (ulong) ::query_id); } diff --git a/sql/sql_class.h b/sql/sql_class.h index 32ad4a8fbd3..51067d94990 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -120,6 +120,7 @@ public: void init(enum_log_type log_type_arg, enum cache_type io_cache_type_arg = WRITE_CACHE, bool no_auto_events_arg = 0); + void cleanup(); bool open(const char *log_name,enum_log_type log_type, const char *new_name, const char *index_file_name_arg, enum cache_type io_cache_type_arg, @@ -409,7 +410,9 @@ void free_tmp_table(THD *thd, TABLE *entry); For each client connection we create a separate thread with THD serving as a thread/connection descriptor */ -class THD :public ilink { + +class THD :public ilink +{ public: #ifdef EMBEDDED_LIBRARY struct st_mysql *mysql; @@ -583,7 +586,7 @@ public: active_vio = 0; pthread_mutex_unlock(&LOCK_delete); } - void THD::close_active_vio(); + void close_active_vio(); #endif void awake(bool prepare_to_die); inline const char* enter_cond(pthread_cond_t *cond, pthread_mutex_t* mutex, @@ -965,12 +968,7 @@ public: class multi_delete : public select_result { TABLE_LIST *delete_tables, *table_being_deleted; -#ifdef SINISAS_STRIP - IO_CACHE **tempfiles; - byte *memory_lane; -#else Unique **tempfiles; -#endif THD *thd; ha_rows deleted; uint num_of_tables; diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 1c441ea7a26..ffc7f3c9ca2 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB +/* Copyright (C) 2000-2003 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -560,8 +560,6 @@ bool mysql_change_db(THD *thd, const char *name) x_free(dbname); DBUG_RETURN(1); } - if (lower_case_table_names) - my_casedn_str(system_charset_info, dbname); DBUG_PRINT("info",("Use database: %s", dbname)); if (test_all_bits(thd->master_access,DB_ACLS)) db_access=DB_ACLS; diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index ea5c07048ab..7683abb41fe 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB +/* Copyright (C) 2000-2003 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -42,8 +42,8 @@ thd->open_tables=thd->handler_tables; \ thd->handler_tables=tmp; } -static TABLE **find_table_ptr_by_name(THD *thd, const char *db, - const char *table_name); +static TABLE **find_table_ptr_by_name(THD *thd,const char *db, + const char *table_name, bool is_alias); int mysql_ha_open(THD *thd, TABLE_LIST *tables) { @@ -67,7 +67,7 @@ int mysql_ha_open(THD *thd, TABLE_LIST *tables) int mysql_ha_close(THD *thd, TABLE_LIST *tables, bool dont_send_ok) { - TABLE **ptr=find_table_ptr_by_name(thd, tables->db, tables->alias); + TABLE **ptr=find_table_ptr_by_name(thd, tables->db, tables->alias, 1); if (*ptr) { @@ -86,6 +86,21 @@ int mysql_ha_close(THD *thd, TABLE_LIST *tables, bool dont_send_ok) return 0; } +int mysql_ha_closeall(THD *thd, TABLE_LIST *tables, bool dont_send_ok) +{ + TABLE **ptr=find_table_ptr_by_name(thd, tables->db, tables->real_name, 0); + + DBUG_ASSERT(dont_send_ok); + if (*ptr) + { +// if (!dont_send_ok) VOID(pthread_mutex_lock(&LOCK_open)); + close_thread_table(thd, ptr); +// if (!dont_send_ok) VOID(pthread_mutex_unlock(&LOCK_open)); + } +// if (!dont_send_ok) send_ok(&thd->net); + return 0; +} + static enum enum_ha_read_modes rkey_to_rnext[]= { RNEXT, RNEXT, RPREV, RNEXT, RPREV, RNEXT, RPREV, RPREV }; @@ -96,7 +111,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables, ha_rows select_limit,ha_rows offset_limit) { int err, keyno=-1; - TABLE *table=*find_table_ptr_by_name(thd, tables->db, tables->alias); + TABLE *table=*find_table_ptr_by_name(thd, tables->db, tables->alias, 1); if (!table) { my_printf_error(ER_UNKNOWN_TABLE,ER(ER_UNKNOWN_TABLE),MYF(0), @@ -281,6 +296,9 @@ static TABLE **find_table_ptr_by_name(THD *thd, const char *db, for (TABLE *table= *ptr; table ; table= *ptr) { if (!memcmp(table->table_cache_key, db, dblen) && + !my_strcasecmp(system_charset_info, + (is_alias ? table->table_name : table->real_name), + table_name)) !my_strcasecmp(system_charset_info,table->table_name,alias)) break; ptr= &(table->next); diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 74e880eb718..0a06822d36e 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -992,7 +992,7 @@ extern "C" pthread_handler_decl(handle_delayed_insert,arg) strmov(thd->net.last_error,ER(thd->net.last_errno=ER_OUT_OF_RESOURCES)); goto end; } -#if !defined(__WIN__) && !defined(OS2) +#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__) sigset_t set; VOID(sigemptyset(&set)); // Get mask in use VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals)); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index a9085e253b3..69e8b68bab0 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (C) 2000-2003 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -751,7 +751,7 @@ pthread_handler_decl(handle_one_connection,arg) #if defined(__WIN__) init_signals(); // IRENA; testing ? -#elif !defined(OS2) +#elif !defined(OS2) && !defined(__NETWARE__) sigset_t set; VOID(sigemptyset(&set)); // Get mask in use VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals)); @@ -781,7 +781,9 @@ pthread_handler_decl(handle_one_connection,arg) statistic_increment(aborted_connects,&LOCK_status); goto end_thread; } - +#ifdef __NETWARE__ + netware_reg_user(thd->ip, thd->user, "MySQL"); +#endif if (thd->variables.max_join_size == HA_POS_ERROR) thd->options |= OPTION_BIG_SELECTS; if (thd->client_capabilities & CLIENT_COMPRESS) @@ -850,12 +852,10 @@ extern "C" pthread_handler_decl(handle_bootstrap,arg) pthread_detach_this_thread(); thd->thread_stack= (char*) &thd; -#if !defined(__WIN__) && !defined(OS2) +#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__) sigset_t set; VOID(sigemptyset(&set)); // Get mask in use VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals)); - - #endif if (thd->variables.max_join_size == HA_POS_ERROR) @@ -930,16 +930,19 @@ int mysql_table_dump(THD* thd, char* db, char* tbl_name, int fd) table_list->real_name = table_list->alias = tbl_name; table_list->lock_type = TL_READ_NO_INSERT; table_list->next = 0; - remove_escape(table_list->real_name); - - if (!(table=open_ltable(thd, table_list, TL_READ_NO_INSERT))) - DBUG_RETURN(1); if (!db || check_db_name(db)) { net_printf(thd,ER_WRONG_DB_NAME, db ? db : "NULL"); goto err; } + if (lower_case_table_names) + casedn_str(tbl_name); + remove_escape(table_list->real_name); + + if (!(table=open_ltable(thd, table_list, TL_READ_NO_INSERT))) + DBUG_RETURN(1); + if (check_access(thd, SELECT_ACL, db, &table_list->grant.privilege)) goto err; if (grant_option && check_grant(thd, SELECT_ACL, table_list)) @@ -1172,7 +1175,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd, restore_user: x_free(thd->user); - x_free(thd->db); thd->master_access=save_master_access; thd->db_access=save_db_access; thd->db=save_db; @@ -1262,8 +1264,13 @@ bool dispatch_command(enum enum_server_command command, THD *thd, if (!(thd->query=fields=thd->memdup(packet,thd->query_length+1))) break; mysql_log.write(thd,command,"%s %s",table_list.real_name,fields); + if (lower_case_table_names) + my_casedn_str(files_charset_info, table_list.real_name); remove_escape(table_list.real_name); // This can't have wildcards + if (!(table=open_ltable(thd, table_list, TL_READ_NO_INSERT))) + DBUG_RETURN(1); + if (check_access(thd,SELECT_ACL,table_list.db,&thd->col_access)) break; table_list.grant.privilege=thd->col_access; @@ -1291,8 +1298,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd, net_printf(thd,ER_WRONG_DB_NAME, db ? db : "NULL"); break; } - if (lower_case_table_names) - my_casedn_str(files_charset_info, db); if (check_access(thd,CREATE_ACL,db,0,1)) break; mysql_log.write(thd,command,packet); @@ -1309,8 +1314,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd, net_printf(thd,ER_WRONG_DB_NAME, db ? db : "NULL"); break; } - if (lower_case_table_names) - my_casedn_str(files_charset_info, db); if (check_access(thd,DROP_ACL,db,0,1)) break; if (thd->locked_tables || thd->active_transaction()) @@ -2639,8 +2642,18 @@ mysql_execute_command(THD *thd) net_printf(thd,ER_WRONG_DB_NAME, lex->name); break; } - if (lower_case_table_names) - my_casedn_str(files_charset_info, lex->name); + /* + If in a slave thread : + CREATE DATABASE DB was certainly not preceded by USE DB. + For that reason, db_ok() in sql/slave.cc did not check the + do_db/ignore_db. And as this query involves no tables, tables_ok() + above was not called. So we have to check rules again here. + */ + if (thd->slave_thread && + (!db_ok(lex->name, replicate_do_db, replicate_ignore_db) || + !db_ok_with_wild_table(lex->name))) + break; + if (check_access(thd,CREATE_ACL,lex->name,0,1)) break; res=mysql_create_db(thd,lex->name,&lex->create_info,0); @@ -2653,8 +2666,17 @@ mysql_execute_command(THD *thd) net_printf(thd,ER_WRONG_DB_NAME, lex->name); break; } - if (lower_case_table_names) - my_casedn_str(files_charset_info, lex->name); + /* + If in a slave thread : + DROP DATABASE DB may not be preceded by USE DB. + For that reason, maybe db_ok() in sql/slave.cc did not check the + do_db/ignore_db. And as this query involves no tables, tables_ok() + above was not called. So we have to check rules again here. + */ + if (thd->slave_thread && + (!db_ok(lex->name, replicate_do_db, replicate_ignore_db) || + !db_ok_with_wild_table(lex->name))) + break; if (check_access(thd,DROP_ACL,lex->name,0,1)) break; if (thd->locked_tables || thd->active_transaction()) @@ -3763,10 +3785,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, ptr->alias= alias_str; if (lower_case_table_names) - { - my_casedn_str(files_charset_info,ptr->db); my_casedn_str(files_charset_info,table->table.str); - } ptr->real_name=table->table.str; ptr->real_name_length=table->table.length; ptr->lock_type= lock_type; @@ -3876,6 +3895,8 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables) mysql_slow_log.new_file(1); if (ha_flush_logs()) result=1; + if (flush_error_log()) + result=1; } #ifdef HAVE_QUERY_CACHE if (options & REFRESH_QUERY_CACHE_FREE) diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 522ec9f6aeb..05a70c24bfd 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -927,18 +927,17 @@ int cmp_master_pos(const char* log_file_name1, ulonglong log_pos1, const char* log_file_name2, ulonglong log_pos2) { int res; - /* - TODO: Change compare function to work with file name of type - '.999 and .1000' - */ + uint log_file_name1_len= strlen(log_file_name1); + uint log_file_name2_len= strlen(log_file_name2); - if ((res = strcmp(log_file_name1, log_file_name2))) - return res; - if (log_pos1 > log_pos2) - return 1; - else if (log_pos1 == log_pos2) - return 0; - return -1; + // We assume that both log names match up to '.' + if (log_file_name1_len == log_file_name2_len) + { + if ((res= strcmp(log_file_name1, log_file_name2))) + return res; + return (log_pos1 < log_pos2) ? -1 : (log_pos1 == log_pos2) ? 0 : 1; + } + return ((log_file_name1_len < log_file_name2_len) ? -1 : 1); } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 981ff715c54..f61ea4e8c10 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -548,6 +548,16 @@ JOIN::optimize() error= -1; /* if goto err */ /* Optimize distinct away if possible */ + { + ORDER *org_order= order; + order=remove_const(this, order,conds,&simple_order); + /* + If we are using ORDER BY NULL or ORDER BY const_expression, + return result in any order (even if we are using a GROUP BY) + */ + if (!order && org_order) + skip_sort_order= 1; + } order= remove_const(this, order, conds, &simple_order); if (group_list || tmp_table_param.sum_func_count) { @@ -1011,7 +1021,7 @@ JOIN::exec() if (curr_tmp_table->group) { // Already grouped - if (!curr_join->order && !curr_join->no_order) + if (!curr_join->order && !curr_join->no_order && !skip_sort_order) curr_join->order= curr_join->group_list; /* order by group */ curr_join->group_list= 0; } @@ -3513,7 +3523,13 @@ return_zero_rows(JOIN *join, select_result *result,TABLE_LIST *tables, if (!(result->send_fields(fields,1))) { if (send_row) + { + List_iterator_fast<Item> it(fields); + Item *item; + while ((item= it++)) + item->no_rows_in_result(); result->send_data(fields); + } if (tables) // Not from do_select() { /* Close open cursors */ @@ -3947,7 +3963,7 @@ const_expression_in_where(COND *cond, Item *comp_item, Item **const_item) */ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type, - Item_result_field ***copy_func, Field **from_field, + Item ***copy_func, Field **from_field, bool group, bool modify_item) { switch (type) { @@ -4013,13 +4029,13 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type, } return new_field; } - case Item::PROC_ITEM: case Item::FUNC_ITEM: case Item::COND_ITEM: case Item::FIELD_AVG_ITEM: case Item::FIELD_STD_ITEM: case Item::SUBSELECT_ITEM: /* The following can only happen with 'CREATE TABLE ... SELECT' */ + case Item::PROC_ITEM: case Item::INT_ITEM: case Item::REAL_ITEM: case Item::STRING_ITEM: @@ -4052,10 +4068,10 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type, DBUG_ASSERT(0); break; } - if (copy_func) - *((*copy_func)++) = (Item_result_field*) item; // Save for copy_funcs + if (copy_func && item->is_result_field()) + *((*copy_func)++) = item; // Save for copy_funcs if (modify_item) - ((Item_result_field*) item)->result_field=new_field; + item->set_result_field(new_field); return new_field; } default: // Dosen't have to be stored @@ -4089,7 +4105,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields, Copy_field *copy=0; KEY *keyinfo; KEY_PART_INFO *key_part_info; - Item_result_field **copy_func; + Item **copy_func; MI_COLUMNDEF *recinfo; uint temp_pool_slot=MY_BIT_NONE; @@ -4153,7 +4169,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields, my_free((gptr) table,MYF(0)); /* purecov: inspected */ DBUG_RETURN(NULL); /* purecov: inspected */ } - param->funcs=copy_func; + param->items_to_copy= copy_func; strmov(tmpname,path); /* make table according to fields */ @@ -5681,7 +5697,7 @@ end_write(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), if (!end_of_records) { copy_fields(&join->tmp_table_param); - copy_funcs(join->tmp_table_param.funcs); + copy_funcs(join->tmp_table_param.items_to_copy); #ifdef TO_BE_DELETED if (!table->uniques) // If not unique handling @@ -5785,7 +5801,7 @@ end_update(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), memcpy(table->record[0]+key_part->offset, group->buff, key_part->length); init_tmptable_sum_functions(join->sum_funcs); - copy_funcs(join->tmp_table_param.funcs); + copy_funcs(join->tmp_table_param.items_to_copy); if ((error=table->file->write_row(table->record[0]))) { if (create_myisam_from_heap(join->thd, table, &join->tmp_table_param, @@ -5819,7 +5835,7 @@ end_unique_update(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), init_tmptable_sum_functions(join->sum_funcs); copy_fields(&join->tmp_table_param); // Groups are copied twice. - copy_funcs(join->tmp_table_param.funcs); + copy_funcs(join->tmp_table_param.items_to_copy); if (!(error=table->file->write_row(table->record[0]))) join->send_records++; // New group @@ -5905,7 +5921,7 @@ end_write_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), if (idx < (int) join->send_group_parts) { copy_fields(&join->tmp_table_param); - copy_funcs(join->tmp_table_param.funcs); + copy_funcs(join->tmp_table_param.items_to_copy); init_sum_functions(join->sum_funcs); if (join->procedure) join->procedure->add(); @@ -7755,7 +7771,7 @@ copy_sum_funcs(Item_sum **func_ptr) { Item_sum *func; for (; (func = *func_ptr) ; func_ptr++) - (void) func->save_in_field(func->result_field, 1); + (void) func->save_in_result_field(1); return; } @@ -7782,12 +7798,11 @@ update_sum_func(Item_sum **func_ptr) /* Copy result of functions to record in tmp_table */ void -copy_funcs(Item_result_field **func_ptr) +copy_funcs(Item **func_ptr) { - Item_result_field *func; + Item *func; for (; (func = *func_ptr) ; func_ptr++) - (void) func->save_in_field(func->result_field, 1); - return; + func->save_in_result_field(1); } diff --git a/sql/sql_select.h b/sql/sql_select.h index 8cdfc8c1062..bb928846186 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -124,7 +124,7 @@ class TMP_TABLE_PARAM :public Sql_alloc Copy_field *copy_field, *copy_field_end; Copy_field *save_copy_field, *save_copy_field_end; byte *group_buff; - Item_result_field **funcs; + Item **items_to_copy; /* Fields in tmp table */ MI_COLUMNDEF *recinfo,*start_recinfo; KEY *keyinfo; ha_rows end_write_records; @@ -293,7 +293,7 @@ bool setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param, List<Item> &new_list1, List<Item> &new_list2, uint elements, List<Item> &fields); void copy_fields(TMP_TABLE_PARAM *param); -void copy_funcs(Item_result_field **func_ptr); +void copy_funcs(Item **func_ptr); bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param, int error, bool ignore_last_dupp_error); diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 479abf82b91..b084238a3a4 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -527,6 +527,8 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild) protocol->store(file_name); table_list.db=(char*) db; table_list.real_name= table_list.alias= file_name; + if (lower_case_table_names) + casedn_str(file_name); if (!(table = open_ltable(thd, &table_list, TL_READ))) { for (uint i=0 ; i < field_list.elements ; i++) diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 931d3ab4512..9738e1dd86d 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -39,11 +39,28 @@ static int copy_data_between_tables(TABLE *from,TABLE *to, uint order_num, ORDER *order, ha_rows *copied,ha_rows *deleted); -/***************************************************************************** -** Remove all possbile tables and give a compact errormessage for all -** wrong tables. -** This will wait for all users to free the table before dropping it -*****************************************************************************/ +/* + delete (drop) tables. + + SYNOPSIS + mysql_rm_table() + thd Thread handle + tables List of tables to delete + if_exists If 1, don't give error if one table doesn't exists + + NOTES + Will delete all tables that can be deleted and give a compact error + messages for tables that could not be deleted. + If a table is in use, we will wait for all users to free the table + before dropping it + + Wait if global_read_lock (FLUSH TABLES WITH READ LOCK) is set. + + RETURN + 0 ok. In this case ok packet is sent to user + -1 Error (Error message given but not sent to user) + +*/ int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists, my_bool drop_temporary) @@ -89,6 +106,26 @@ int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists, DBUG_RETURN(0); } + +/* + delete (drop) tables. + + SYNOPSIS + mysql_rm_table_part2_with_lock() + thd Thread handle + tables List of tables to delete + if_exists If 1, don't give error if one table doesn't exists + dont_log_query Don't write query to log files + + NOTES + Works like documented in mysql_rm_table(), but don't check + global_read_lock and don't send_ok packet to server. + + RETURN + 0 ok + 1 error +*/ + int mysql_rm_table_part2_with_lock(THD *thd, TABLE_LIST *tables, bool if_exists, bool drop_temporary, bool dont_log_query) @@ -111,6 +148,7 @@ int mysql_rm_table_part2_with_lock(THD *thd, return error; } + /* Execute the drop of a normal or temporary table @@ -153,6 +191,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, for (table=tables ; table ; table=table->next) { char *db=table->db ? table->db : thd->db; + mysql_ha_closeall(thd, table, 1); if (!close_temporary_table(thd, db, table->real_name)) { tmp_table_deleted=1; @@ -938,7 +977,7 @@ TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info, field=item->tmp_table_field(&tmp_table); else field=create_tmp_field(thd, &tmp_table, item, item->type(), - (Item_result_field***) 0, &tmp_field,0,0); + (Item ***) 0, &tmp_field,0,0); if (!field || !(cr_field=new create_field(field,(item->type() == Item::FIELD_ITEM ? ((Item_field *)item)->field : @@ -1694,6 +1733,8 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, } send_ok(thd); } + table_list->table=0; // For query cache + query_cache_invalidate3(thd, table_list, 0); DBUG_RETURN(error); } diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc index 3b362bf3e3f..4cecebfa90c 100644 --- a/sql/sql_udf.cc +++ b/sql/sql_udf.cc @@ -147,7 +147,7 @@ void udf_init() tables.lock_type = TL_READ; tables.db=new_thd->db; - if (open_tables(new_thd, &tables)) + if (open_and_lock_tables(new_thd, &tables)) { DBUG_PRINT("error",("Can't open udf table")); sql_print_error("Can't open mysql/func table"); @@ -233,6 +233,11 @@ void udf_free() } hash_free(&udf_hash); free_root(&mem,MYF(0)); + if (initialized) + { + initialized= 0; + pthread_mutex_destroy(&THR_LOCK_udf); + } DBUG_VOID_RETURN; } diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index e40053f512a..a633c307830 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -470,6 +470,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); %token LINESTRING %token LOCATE %token MAKE_SET_SYM +%token MASTER_POS_WAIT %token MINUTE_SECOND_SYM %token MINUTE_SYM %token MODE_SYM @@ -2241,6 +2242,16 @@ simple_expr: { $$= new Item_func_geometry_from_text($3); } | LINEFROMTEXT '(' expr ',' expr ')' { $$= new Item_func_geometry_from_text($3); } + | MASTER_POS_WAIT '(' expr ',' expr ')' + { + $$= new Item_master_pos_wait($3, $5); + Lex->safe_to_cache_query=0; + } + | MASTER_POS_WAIT '(' expr ',' expr ',' expr ')' + { + $$= new Item_master_pos_wait($3, $5, $7); + Lex->safe_to_cache_query=0; + } | MINUTE_SYM '(' expr ')' { $$= new Item_func_minute($3); } | MOD_SYM '(' expr ',' expr ')' @@ -2864,6 +2875,7 @@ delete_limit_clause: ULONG_NUM: NUM { $$= strtoul($1.str,NULL,10); } + | LONG_NUM { $$= (ulonglong) strtoll($1.str,NULL,10); } | ULONGLONG_NUM { $$= (ulong) strtoull($1.str,NULL,10); } | REAL_NUM { $$= strtoul($1.str,NULL,10); } | FLOAT_NUM { $$= strtoul($1.str,NULL,10); }; @@ -2871,7 +2883,7 @@ ULONG_NUM: ulonglong_num: NUM { $$= (ulonglong) strtoul($1.str,NULL,10); } | ULONGLONG_NUM { $$= strtoull($1.str,NULL,10); } - | LONG_NUM { $$= (ulonglong) strtoul($1.str,NULL,10); } + | LONG_NUM { $$= (ulonglong) strtoll($1.str,NULL,10); } | REAL_NUM { $$= strtoull($1.str,NULL,10); } | FLOAT_NUM { $$= strtoull($1.str,NULL,10); }; @@ -3731,8 +3743,8 @@ param_marker: }; literal: text_literal { $$ = $1; } - | NUM { $$ = new Item_int($1.str, (longlong) atol($1.str),$1.length); } - | LONG_NUM { $$ = new Item_int($1.str); } + | NUM { $$ = new Item_int($1.str, (longlong) strtol($1.str, NULL, 10),$1.length); } + | LONG_NUM { $$ = new Item_int($1.str, (longlong) strtoll($1.str,NULL,10), $1.length); } | ULONGLONG_NUM { $$ = new Item_uint($1.str, $1.length); } | REAL_NUM { $$ = new Item_real($1.str, $1.length); } | FLOAT_NUM { $$ = new Item_float($1.str, $1.length); } diff --git a/sql/table.cc b/sql/table.cc index 57a0831bf2e..051048b72d1 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1133,9 +1133,29 @@ char *get_field(MEM_ROOT *mem, TABLE *table, uint fieldnr) return to; } -bool check_db_name(const char *name) + +/* + Check if database name is valid + + SYNPOSIS + check_db_name() + name Name of database + + NOTES + If lower_case_table_names is set then database is converted to lower case + + RETURN + 0 ok + 1 error +*/ + +bool check_db_name(char *name) { - const char *start=name; + char *start=name; + + if (lower_case_table_names) + casedn_str(name); + while (*name) { #if defined(USE_MB) && defined(USE_MB_IDENT) |