Commit graph

332 commits

Author SHA1 Message Date
konstantin@mysql.com
daa4c2495c A fix and test case for Bug#5987 "subselect in bool function
crashes server (prepared statements)": the bug was that all boolean
items always recovered its original arguments at statement cleanup 
stage.
This collided with Item_subselect::select_transformer, which tries to 
permanently change the item tree to use a transformed subselect instead of
original one.
So we had this call sequence for prepare:
mysql_stmt_prepare -> JOIN::prepare -> 
Item_subselect::fix_fields -> the item tree gets transformed ->
Item_bool_rowready_func2::cleanup, item tree is recovered to original
state, while it shouldn't have been;
mysql_stmt_execute -> attempts to execute a broken tree -> crash.
Now instead of bluntly recovering all arguments of bool functions in 
Item_bool_rowready_func2::cleanup, we recover only those
which were changed, and do it in one place.
There still would exist a possibility for a collision with subselect
tranformation, if permanent and temporary changes were performed at the 
same stage.
But fortunately subselect transformation is always done first, so it 
doesn't conflict with the optimization done by propogate_cond_constants.
Now we have: 
mysql_stmt_prepare -> JOIN::prepare -> subselect transformation 
permanently changes the tree -> cleanup doesn't recover anything, 
because nothing was registered for recovery.
mysql_stmt_execute -> JOIN::prepare (the tree is already transformed, 
so it doesn't change), JOIN::optimize -> 
propogate_cond_constants -> temporary changes the item tree 
with constants -> JOIN::execute -> cleanup -> 
the changes done by propogate_cond_constants are recovered, as
they were registered for recovery.
2004-10-10 02:39:22 +04:00
bell@sanja.is.com.ua
b2d9799b54 args_copy and cleunup() removed from Item_sum
registration changing ITEM_SUM arguments added
2004-10-09 01:01:19 +03:00
konstantin@mysql.com
234c80b689 Deployment of centralized Item change registry, step 2: Item_ref
doesn't need to have it's own recovery mechanism.
2004-10-08 19:13:09 +04:00
konstantin@mysql.com
2aa7ec0d9d A fix for Bug#5748 "Prepared statement with BETWEEN and bigint values
crashes mysqld": implementation for a generic item tree modifications
registry. Every item tree modification which should be rolled back for
subsequent execution of a prepared statement or stored procedure should
be saved in the registry. All such modifications are rolled back at once
during cleanup stage of PS.
Actual fix for the bug just adds a call to register modifications to
convert_constant_item.
Post review fixes implemented.
2004-10-08 02:21:19 +04:00
bell@sanja.is.com.ua
cd32040889 some comments added 2004-09-25 16:05:50 +03:00
bar@mysql.com
7c4ab566d2 Return character strings in table, type, possible_keys, key fields
of EXPLAIN SELECT, rather than binary strings.
2004-09-16 14:47:39 +05:00
bar@mysql.com
4f32cd2b3d Move collation aggregation with superset conversion code
from Item_bool_func2 into DTCollation to make it reusable
for other types of items.
2004-09-01 13:56:33 +05:00
bell@sanja.is.com.ua
2cf1234ba2 after review patch 2004-08-31 21:10:57 +03:00
sergefp@mysql.com
4ddeee9d2f Fix for BUG#4488: first portion: sign aware '<' and '>' comparisons. 2004-08-11 23:08:20 +04:00
bell@sanja.is.com.ua
b8742e4a56 unused field removed 2004-06-28 20:01:11 +03:00
serg@serg.mylan
a5c8b3ee59 correct eq() method for Item_param (BUG#4233) 2004-06-26 23:55:38 +02:00
bell@sanja.is.com.ua
74b01ca387 type of parameter assignment for parameters from variables added (BUG#4280) 2004-06-25 15:16:00 +03:00
ram@gw.mysql.r18.ru
f3d11147c9 after merge fix 2004-06-22 14:48:29 +05:00
konstantin@mysql.com
7bbdb8408b Fix for bug#4105 "Server crash on attempt to prepare a statement with
character set introducer": add new item type to be returned before from 
Item_param until it's value is set.
This way items like Item_bool_func2 and udf_handler won't treat this item
as constant literal when statement is prepared.
2004-06-18 04:16:08 +04:00
bell@sanja.is.com.ua
96b470ae59 after review fix (BUG#4067) 2004-06-17 13:48:31 +03:00
ram@gw.mysql.r18.ru
6b8222d3a7 a fix (Bug #4102 Crash with a DBUG window after a request) 2004-06-16 18:43:05 +05:00
bell@sanja.is.com.ua
002364c20f new length detection for non-string in UNION (BUG#4067) 2004-06-16 16:06:30 +03:00
konstantin@mysql.com
f3e018f833 Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/kostja/mysql/mysql-4.1-4026
2004-06-09 03:22:55 +04:00
konstantin@mysql.com
dc11d3cfa1 Proposed fix for Bug#4026 "Microseconds part of TIME/DATETIME types
is broken (prepared statements)": fixed date handling in many places 
of prepared statements code.
2004-06-09 03:21:50 +04:00
sergefp@mysql.com
1e05e6cb82 Post review fixes for "SQL Syntax for Prepared Statements". 2004-06-07 12:09:10 +04:00
sergefp@mysql.com
dc38512390 Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/dbdata/psergey/mysql-4.1-ps-merge
2004-06-01 17:29:13 +04:00
konstantin@mysql.com
eaa4d106e6 Fix for Bug#3796 "Prepared statement, select concat(<parameter>,<column>), wrong
result": new Item_param member for use in val_str()
2004-05-31 14:21:48 +04:00
sergefp@mysql.com
d7dd97089e Manually merged, requirees more merging 2004-05-25 08:15:50 +04:00
konstantin@mysql.com
f207b33a7b Support for character set conversion in binary protocol: another go
after Monty's review.
- Item_param was rewritten.
- it turns out that we can't convert string data to character set of
  connection on the fly, because they first should be written to the binary
  log.
  To support efficient conversion we need to rewrite prepared statements
  binlogging code first.
2004-05-25 02:03:49 +04:00
sergefp@mysql.com
fb17025b3e WL#1622 "SQL Syntax for Prepared Statements": Post-review fixes (1 of 2) 2004-05-21 04:27:50 +04:00
sergefp@mysql.com
7af3097e60 Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/dbdata/psergey/mysql-4.1-ps-merge
2004-05-07 03:33:39 +04:00
monty@mysql.com
939ea71ecd Portability fixes
Change strtoll -> my_strtoll10()
Fixed bug in my_strntoul() and my_strntol() where we got different values on 32 and 64 bit systems (Bug #3472)
2004-05-07 01:43:17 +03:00
sergefp@mysql.com
67ad78cb5d Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/dbdata/psergey/mysql-4.1-ps-merge
2004-05-06 23:02:32 +04:00
sergefp@mysql.com
7c3376229e Make Item_param::val_int and Item_param::val_str follow the used convention and return 0 if null_value==1. 2004-05-05 20:04:25 +04:00
sergefp@mysql.com
fdfcadc735 Manual merge for WL#1622 code, will need fixes 2004-05-05 16:10:16 +04:00
dlenev@brandersnatch.localdomain
c7fbcbca7a Fix for remaining issues described in Bug #1664
"mysql_send_long_data() API call is completely broken".

Now we are resetting some members (long_data_supplied/null_value...) of Item_param to its 
initial state after each execution of prepared statement. We also manipulating 
Item_param::maybe_null/null_value only via Item_param::set_* setters which makes code a bit 
more robust.
2004-05-04 19:08:19 +04:00
sergefp@mysql.com
194027d5d8 Merged 2004-04-13 02:18:09 +04:00
monty@mysql.com
dc0d2b83c2 Added function comment 2004-04-12 01:42:39 +03:00
sergefp@mysql.com
1f8505d66f Post-merge fixes 2004-04-05 19:52:10 +04:00
sergefp@mysql.com
a8386d01c2 Many files:
SQL Syntax for Prepared Statements (WL#1622)
ps.test, ps.result:
  new file
2004-04-05 19:43:37 +04:00
dlenev@brandersnatch.localdomain
f38e0a935d Merge of fix for bug #2050 and bug #3307 2004-03-31 22:17:10 +04:00
dlenev@brandersnatch.localdomain
4122188cc2 Fix for Bug #3307 "FLUSH TABLES sometimes breaks prepared statement
table resolution".
Added members to Item_ident for storing original db, table and field
names since those that set later from Field have shorter life-time 
than required by prep. stmt. So we need to restore original names in 
Item_ident::cleanup(). Also now using special construnctor for creation
of Item_field from Field object that ensures that table and field name 
have big enough life-time.

"Fix" for bug #2050 "10 to 1 performance drop with server 4.1.1"
Clean ups in implementation of caching of field number in table.
Added caching of table in which field is found in find_field_in_tables().
2004-03-31 21:25:55 +04:00
dlenev@brandersnatch.localdomain
9e28b7698d "Fix" for BUG #2050 "10 to 1 performance drop with server 4.1.1".
Actually it is not a bug but right behavior observed as pefomance 
degradation after we have forced Item_field::fix_fields() to 
re-execute each time when we are executing prep stmt.

This patch implements small optimization which heals this bad 
behavior. We are caching field position in TABLE::field array in
Item's member and are using this position for speeding up field
lookups in fix_fields() in case of its re-execution.
2004-03-28 04:11:54 +04:00
monty@mysql.com
1448199bd7 Cleanups & safety fixes 2004-03-25 22:11:22 +02:00
bell@sanja.is.com.ua
d095d4753e after review changes 2004-03-20 13:36:26 +02:00
bell@sanja.is.com.ua
ede07fcdcf fixed signed numeric literal parsing 2004-03-18 18:27:03 +02:00
bell@sanja.is.com.ua
613104ad25 merge 2004-03-18 15:21:06 +02:00
bell@sanja.is.com.ua
2b45b53066 DBUG_ASSERT(fixed == 1); added to val*
small optimisation in signed_literal
2004-03-18 15:14:36 +02:00
ram@gw.mysql.r18.ru
99d374159a merge 2004-03-17 18:57:51 +04:00
ram@gw.mysql.r18.ru
757cff9f9b Code cleanup:
- added unsigned_flag= 1; to Item_uint constructors
- removed Item_uint::fix_fields()
- added a comment about fix_fields() call
2004-03-17 18:40:04 +04:00
bell@sanja.is.com.ua
8035ce40ec DBUG_ASSERT(fixed == 0) added to fix_fields() 2004-03-17 14:26:26 +02:00
ram@gw.mysql.r18.ru
f54827e5d0 Fix for the bug #3118: Subquery and order by 2004-03-16 16:28:50 +04:00
konstantin@mysql.com
e43ac76094 Fixes for bugs #2274 "mysqld gets SIGSEGV during processing of malformed
COM_EXECUTE packet" and #2795 "prepare + execute without bind_param crashes
 server" and #2473 "seg fault running tests/client_test.c": 
- length checking added to packet parser 
- default impelemntation of Item_param::set_param_func will work in
case of malformed packet.
No test cases are possible in our test suite, as there are no tests 
operating on protocol layer.
2004-03-15 20:20:47 +03:00
bar@bar.intranet.mysql.r18.ru
c93ff40c51 Bug #2959 UTF8 charset breaks joins with mixed column/string constant 2004-03-03 11:22:25 +04:00
konstantin@oak.local
8cc8b0ea5c Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
2004-03-02 22:39:50 +03:00
lenz@kallisto.local
b8c47718d4 - removed extraneous Item_ident:: to fix a compile error on HP-UX 2004-02-27 19:08:56 +01:00
bell@sanja.is.com.ua
8a442c4e0d after review fix 2004-02-20 15:37:45 +02:00
bell@sanja.is.com.ua
44b37b089a merge 2004-02-14 13:31:39 +02:00
serg@serg.mylan
01c2ca5b8a Merge bk-internal:/home/bk/mysql-4.1/
into serg.mylan:/usr/home/serg/Abk/mysql-4.1
2004-02-13 15:30:00 +01:00
serg@serg.mylan
5914e5705c my_atof is deleted
strtod from mit-threads is restored and cleaned up
2004-02-13 15:27:21 +01:00
bell@sanja.is.com.ua
272bd74abb memory leacks in PS with subqueries fixed (adddition to fix of BUG#2462) 2004-02-12 03:10:26 +02:00
bell@sanja.is.com.ua
69e2460bd4 fixed subquery with PS (BUG#2462)
fixed UNION preparation
2004-02-08 20:14:13 +02:00
bar@bar.intranet.mysql.r18.ru
e2ffbc1a6a Indexes can be used for optimization if the operation
collation is the same with the index collation.
2004-02-02 17:50:14 +04:00
hf@deer.(none)
5b32ce5b0d Merge deer.(none):/home/hf/work/mysql-4.1.clean
into deer.(none):/home/hf/work/mysql-4.1.1676
2004-01-20 21:00:29 +04:00
hf@deer.(none)
37abf689ec Pack of changes about 'cleanup()'-s
Some errorneous code trimmed
2004-01-20 20:55:47 +04:00
hf@deer.(none)
7dda8c102f Merge deer.(none):/home/hf/work/mysql-4.1.clean
into deer.(none):/home/hf/work/mysql-4.1.1676
2004-01-19 21:06:27 +04:00
hf@deer.(none)
1f8eb40310 Code cleanup (working on PS & cleanup() code)
Item & changed with Item* in Item_xxx constructors
tables_list.first -> get_table_list()
2004-01-19 19:53:25 +04:00
bar@bar.intranet.mysql.r18.ru
d921a05ec6 Merge abarkov@bk-internal.mysql.com:/home/bk/mysql-4.1
into bar.intranet.mysql.r18.ru:/usr/home/bar/mysql-4.1
2004-01-19 19:21:07 +04:00
bar@bar.intranet.mysql.r18.ru
f802ec0215 UCS-2 aligning 0xAA -> 0x00AA 2004-01-19 19:16:30 +04:00
hf@deer.(none)
bfe134b86f Fix for prepared statements
Here i added Item_*::cleanup() functions,
removed a lot of ~Item_*'s,
added code to restore order_list and group_list
2003-12-30 14:08:19 +04:00
ram@gw.mysql.r18.ru
9dba5a709b Fix for the bug #2198: SELECT INTO OUTFILE (with Sub-Select) Problem.
Proper Item_cache::setup() method.
Code cleanup.
(discussed with sanja)
2003-12-25 18:50:22 +04:00
monty@mysql.com
0279dc4234 Portability fixes found during 5.0 test compilation
Fixed bug in ORDER BY on a small column (Bug #2147)
Fixed error from pthread_mutex_destroy() when one had wrong errmsg file
2003-12-21 19:39:32 +02:00
monty@mysql.com
031390a9a4 Fixes after merge with 4.0
Cleaned up embedded library access and query cache handling
Changed min stack size to 128K (to allow longer MyISAM keys)
Fixed wrong priority for XOR (should be less than NEG to get -1^1 to work)
2003-12-19 16:25:50 +02:00
monty@mysql.com
e0cc6799ec Merge with 4.0.17 2003-12-17 17:35:34 +02:00
monty@mysql.com
d47deebb58 Extend max_allowed_packet to 2G in mysql and mysqldump (Bug #2105)
Don't dump data for MRG_ISAM or MRG_MYISAM tables. (Bug #1846)
Ensure that 'lower_case_table_names' is always set on case insensitive file systems. (Bug #1812)
One can now configure MySQL as windows service as a normal user. (Bug #1802)
Database names is now compared with lower case in ON clause when lower_case_table_names is set. (Bug #1736)
IGNORE ... LINES option didn't work when used with fixed length rows. (Bug #1704)
Change INSERT DELAYED ... SELECT... to INSERT .... SELECT (Bug #1983)
Safety fix for service 'mysql start' (Bug #1815)
2003-12-14 06:39:52 +02:00
monty@mysql.com
ede8169d24 Added missing SSL library (Should be in source distribution)
Fixed compiler warnings (a lot of hidden variables detected by the Forte compiler)
Added a lot of 'version_xxx' strings to 'show variables'
Prevent copying of TMP_TABLE_PARAM (This caused core dump bug on Solaris)
Fixed problem with printing sub selects to debug log
2003-11-28 12:18:13 +02:00
bell@sanja.is.com.ua
5474ada47a added collation processing in UNION merging
temporary table BLOB now is longblob
2003-11-25 23:52:10 +02:00
bell@sanja.is.com.ua
9fbf629cdc Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/bk/work-union-4.1
2003-11-23 17:59:28 +02:00
bell@sanja.is.com.ua
7191ea0ae3 Fixed UNION fields type/length detecting 2003-11-23 02:01:15 +02:00
dlenev@mysql.com
baa6ee20b2 Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/dlenev/src/mysql-4.1-bg1500-2
2003-11-23 00:48:59 +03:00
dlenev@dlenev.mshome
625371f306 Fix for bug #1500 "Server crash with mysql_prepare"
We treat Item_param whose value is not set as non-const.
This allows us to avoid use of Item_param's value (not yet existing) in 
those fix_fields and fix_length_and_dec that do calculations if their 
Items arguments are const. So we can call fix_fields for such items from
mysql_prepare safely.
2003-11-23 00:48:18 +03:00
monty@mysql.com
41eda1c949 Revert patch for bigint handling in double context as it broke normal bigint handling
The right way to fix this is to change the Field::store(longlong) method to be
Field::store(longlong, bool unsigned_flag), but this is better to do in 4.1 than in 4.0
2003-11-21 00:11:50 +02:00
monty@mysql.com
b01fcb4e14 Merge with 4.0 to get:
Fix for storing negative values in decimal fields
Fix for FLUSH TABLE with HANDLER
2003-11-20 22:30:48 +02:00
monty@mashka.mysql.fi
cab1dc628c CLIENT_MULTI_QUERIES -> CLIENT_MULTI_STATEMENTS
New multi-key-cache handling. This was needed becasue the old one didn't work reliable with MERGE tables.
ALTER TABLE table_name ... CHARACTER SET  ... now changes all char/varchar/text columns to the given character set
(One must use ALTER TABLE ... DEFAULT CHARACTER SET ... to change the default character set)
Fixed that have_compress is detected properly (fixes problems with func_compress.test on platforms without zlib)
New syntax for CACHE INDEX ('keys' is optional if no index name is given and one mentions the key cache name only ones)
Removed compiler warnings
Added mysql_set_server_option() to allow clients like PHP to easaily set/reset the multi-statement flag.
2003-11-18 13:47:27 +02:00
serg@serg.mylan
60d60a299e Item_uint::save_in_field() added to take into account bigint->decimal case 2003-11-16 17:37:15 +01:00
monty@narttu.mysql.fi
6b79cd5c23 Merge 2003-11-03 22:48:03 +02:00
monty@narttu.mysql.fi
a444a3449f Simplified 'wrong xxx name' error messages by introducing 'general' ER_WRONG_NAME error
Cleaned up (and disabled part of) date/time/datetime format patch. One can't anymore change default read/write date/time/formats.
This is becasue the non standard datetime formats can't be compared as strings and MySQL does still a lot of datetime comparisons as strings
Changed flag argument to str_to_TIME() and get_date() from bool to uint
Removed THD from str_to_xxxx functions and Item class.
Fixed core dump when doing --print-defaults
Move some common string functions to strfunc.cc
Dates as strings are now of type my_charset_bin instead of default_charset()
Introduce IDENT_QUOTED to not have to create an extra copy of simple identifiers (all chars < 128)
Removed xxx_FORMAT_TYPE enums and replaced them with the old TIMESTAMP_xxx enums
Renamed some TIMESTAMP_xxx enums to more appropriate names
Use defines instead of integers for date/time/datetime string lengths
Added to build system and use the new my_strtoll10() function.
2003-11-03 14:01:59 +02:00
bell@sanja.is.com.ua
0747324ede merge 2003-10-31 22:14:49 +02:00
ram@gw.mysql.r18.ru
c5b481d99a Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-4.1
into gw.mysql.r18.ru:/usr/home/ram/work/4.1.wl1056
2003-10-31 13:03:12 +04:00
ram@gw.mysql.r18.ru
90ffe1be00 WL #1056: Eliminate NOT operators from where condition 2003-10-31 13:02:16 +04:00
bell@sanja.is.com.ua
33346e26af added code covarage for functions convert(), nullif(), crc32(), is_used_lock(), char_lengtrh(), bit_xor()
added string length for more speed
made code covarage for print() method of Item
fixed printability of some items (SCRUM) (WL#1274)
2003-10-30 12:57:26 +02:00
bell@sanja.is.com.ua
934fa2a104 Merge 2003-10-22 20:52:47 +03:00
gluh@gluh.mysql.r18.ru
4bed4abb62 Merge commit 2003-10-20 13:45:28 +05:00
gluh@gluh.mysql.r18.ru
62b0b8b800 Scrum task 835 - text-to-datetime conversion function 2003-10-20 13:24:18 +05:00
lenz@kallisto.local
e8216b44a8 - portability fix: fix compile bug on HP-UX (thanks to acurtis for the
patch)
  (BUG#1440: Redundant class name confusing hpux compiler)
2003-10-16 22:15:46 +02:00
bell@sanja.is.com.ua
a7bdd19707 subqueries made printable
new EXPLAIN parameter to show real query as it was interpreted
(SCRUM) (WL#1274)
2003-10-16 15:54:47 +03:00
bell@laptop.sanja.is.com.ua
ddf4d1e529 fixed printability of Items (all items except subselects)
(SCRUM) (WL#1274)
2003-10-12 17:56:05 +03:00
bell@laptop.sanja.is.com.ua
e1b53fdd42 Merge 2003-10-06 20:55:06 +03:00
hf@deer.(none)
73f2e739b2 Fix for #1430
there was an error about sendind prepared parameters to the server
2003-10-01 16:44:57 +05:00
lenz@kallisto.local
f01a6f7eae - Polished mysql-copyright a bit and added call to remove
cmd-line-utils/readline from the commercial distribution
 - fixed some copyright headers so mysql-copyright can process them
2003-09-23 00:38:01 +02:00
monty@mashka.mysql.fi
7538242e4f merge with 4.1 tree 2003-09-11 20:31:40 +03:00
monty@narttu.mysql.fi
4b3b4b9250 merge 2003-09-03 19:53:08 +03:00
bell@sanja.is.com.ua
51374e569d fixed BUG#1180 (changing WHERE clause of prepared statements by optimisation) 2003-09-02 19:56:55 +03:00
bell@sanja.is.com.ua
334841d902 tmp_table_field() renamed to get_tmp_table_field() to avoid redifinition of tmp_table_field(TABLE *t_arg) 2003-08-29 16:24:03 +03:00
monty@narttu.mysql.fi
77a70a0a24 merge with 4.0.15 2003-08-29 13:44:35 +03:00