Commit graph

285 commits

Author SHA1 Message Date
konstantin@mysql.com
568c6e8526 Fix for bug#4912 "mysqld crashs in case a statement is executed
a second time". The bug was caused by incompatibility of
negations elimination algorithm and PS: during first statement 
execute a subtree with negation was replaced with equivalent 
subtree without NOTs.
The problem was that although this transformation was permanent, 
items of the new subtree were created in execute-local memory.
The patch adds means to check if it is the first execute of a
prepared statement, and if this is the case, to allocate items
in memory of the prepared statement.
The implementation:
- backports Item_arena from 5.0
- adds Item_arena::is_stmt_prepare(), 
  Item_arena::is_first_stmt_execute().
- deletes THD::allocate_temporary_pool_for_ps_preparing(),
  THD::free_temporary_pool_for_ps_preparing(); they
  were redundant.
and adds a few invariants:
- thd->free_list never contains junk (= freed items)
- thd->current_arena is never null. If there is no
  prepared statement, it points at the thd. 
The rest of the patch contains mainly mechanical changes and
cleanups.
2004-08-21 02:02:46 +04:00
serg@serg.mylan
e1237cbc53 manually merged 2004-08-18 19:57:55 +02:00
guilhem@mysql.com
0f20e2fece Avoiding a theoretically possible crash (pthread_mutex_lock(0)) which could (at least in POSIX Threads books)
happen on SMP machines, when a thread is going to wait on a condition and it is KILLed at the
same time.
Cleaning code a bit by adding a test in enter_cond() that we have the mutex (was already the case in all places
where it's called except one which is fixed here).
2004-07-30 00:53:25 +02:00
bar@mysql.com
30a86a0be9 Bug#4417 binary character set breaks multi-byte table/field name. 2004-07-06 17:15:43 +05:00
monty@mysql.com
d69a36d118 merge 2004-06-21 10:24:40 +03:00
monty@mysql.com
1388c164bc After merge fixes
Return NULL if a time argument is given to date_add(). (Warning will be shown after Dimitri's timezone patch is pushed)
2004-06-21 10:21:20 +03:00
dlenev@brandersnatch.localdomain
09ba29e539 WL#1264 "Per-thread time zone support infrastructure".
Added basic per-thread time zone functionality (based on public
domain elsie-code). Now user can select current time zone
(from the list of time zones described in system tables).
All NOW-like functions honor this time zone, values of TIMESTAMP
type are interpreted as values in this time zone, so now
our TIMESTAMP type behaves similar to Oracle's TIMESTAMP WITH
LOCAL TIME ZONE (or proper PostgresSQL type).
  
WL#1266 "CONVERT_TZ() - basic time with time zone conversion 
function".
  
Fixed problems described in Bug #2336 (Different number of warnings 
when inserting bad datetime as string or as number). This required
reworking of datetime realted warning hadling (they now generated 
at Field object level not in conversion functions).
  
Optimization: Now Field class descendants use table->in_use member
instead of current_thd macro.
2004-06-18 10:11:31 +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
bec20d1fd7 Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/dbdata/psergey/mysql-4.1-ps-merge
2004-06-04 05:37:14 +04:00
guilhem@mysql.com
da835a0a06 Merge gbichot@213.136.52.20:/home/bk/mysql-4.1
into mysql.com:/home/mysql_src/mysql-4.1
2004-06-03 23:19:01 +02:00
guilhem@mysql.com
86e8ecc965 Implementation of WL#1824 "Add replication of character set variables in 4.1",
by binlogging some SET ONE_SHOT CHARACTER_SETetc,
which will be enough until we have it more compact and more complete in 5.0. With the present patch,
replication will work ok between 4.1.3 master and slaves, as long as:
- master and slave have the same GLOBAL.COLLATION_SERVER
- COLLATION_DATABASE and CHARACTER_SET_DATABASE are not used
- application does not use the fact that table is created with charset of the USEd db (BUG#2326).
all of which are not too hard to fulfill. 
ONE_SHOT is reserved for internal use of mysqlbinlog|mysql and works only for charsets,
so we give error if used for non-charset vars.
Fix for BUG#3875 "mysqlbinlog produces wrong ouput  if query uses
 variables containing quotes" and BUG#3943 "Queries with non-ASCII literals are not replicated
 properly after SET NAMES".
Detecting that master and slave have different global charsets or server ids.
2004-06-03 23:17:18 +02:00
sergefp@mysql.com
bd04f52552 Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/dbdata/psergey/mysql-4.1-ps-merge
2004-06-03 20:54:46 +04:00
hf@deer.(none)
38334f62a4 Proposed fix for bug #3412 (embedded server: prepared statement returns
empty recordset where some records should be found)
2004-05-28 15:59:29 +05: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
f75b1adece Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/dbdata/psergey/mysql-4.1-ps-merge
2004-05-21 04:31:07 +04:00
monty@mysql.com
e0a4b51215 Better fix for bug #3749 (bug in deleting automatic generated foreign keys) 2004-05-15 11:57:40 +03:00
sergefp@mysql.com
3711c98b2a Trivial manual merge 2004-05-15 00:06:16 +04:00
monty@mysql.com
116f61c656 Don't automaticly generate a new key for a foreign key constraint if there is already a usable key.
Prefer not automatic keys before automatic keys. If there is two conf
2004-05-12 00:29:52 +03:00
sergefp@mysql.com
9a4acccd05 WL#1622 "SQL Syntax for Prepared Statements" - cosmetic code review fixes 2004-04-30 20:08:38 +04:00
marko@hundin.mysql.fi
df5336a3cc Introduce keys in child tables corresponding to FOREIGN KEYs
Remove redundant keys in CREATE TABLE and ALTER TABLE
2004-04-21 13:15:43 +03:00
sergefp@mysql.com
a314cbefa1 WL#1622 "SQL Syntax for Prepared Statements": post-review fixes:
Moved PS name to Statement class, Statement_map now handles name-to-statement resolution.
  Both named and unnamed statements are now executed in one function (sql_prepare.cc:execute_stmt)
  Fixed a problem: Malformed sequence of commands from client could cause server to use previously deleted objects.
  Some code cleanup and small fixes
2004-04-13 01:58:48 +04:00
sergefp@mysql.com
ac563b1b8e Merge 2004-04-08 17:08:56 +04: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
bell@sanja.is.com.ua
1e4af935c1 removed old way to prevent using stack tables for caching Items in PS
fixed error code in union test
2004-04-04 03:05:44 +03:00
bell@sanja.is.com.ua
5568155e04 fix for table/field caching mechanism
save moving ON/USING tables conditions to WHERE clause (BUG#2794)
2004-04-01 03:00:38 +03:00
guilhem@mysql.com
90a5e244be To save 32KB memory per thread when --log-bin is not used, we do not
init the binlog_cache (THD::transaction.trans_log).
I have checked all places where trans_log is used, because as now
it may not be inited in some cases, we have to be cautious
(will forward this commit mail to Heikki).
2004-03-26 19:11:37 +01:00
bell@sanja.is.com.ua
7e48a0f610 merge 2004-03-09 12:52:25 +02: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
serg@serg.mylan
ed2e1aa14d my_gethwaddr() for linux/freebsd
UUID() function
2004-02-27 20:30:08 +01:00
bell@sanja.is.com.ua
14b9fa3588 revision of fix_fields() calls (BUG2838) 2004-02-18 01:08:52 +02:00
bell@sanja.is.com.ua
a66b398eb8 merge 2004-02-17 11:12:55 +02: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
monty@mysql.com
ce14578909 Merge with 4.0.18 2004-02-11 00:06:46 +01:00
bell@sanja.is.com.ua
cefdd4fec6 merge 2004-02-09 15:49:11 +02:00
monty@mysql.com
06432eac36 Added --compact to mysqlbinlog
Fixed output from mysqlbinlog when using --skip-comments
Fixed warnings from valgrind
Fixed ref_length when used with HEAP tables
More efficent need_conversion()
Fixed error handling in UPDATE with not updateable tables
Fixed bug in null handling in CAST to signed/unsigned
2004-02-09 12:31:03 +01:00
bell@sanja.is.com.ua
69e2460bd4 fixed subquery with PS (BUG#2462)
fixed UNION preparation
2004-02-08 20:14:13 +02:00
monty@mysql.com
480b082cf4 merge 2004-02-05 18:14:48 +01:00
vva@eagle.mysql.r18.ru
128751d3f7 Merge eagle.mysql.r18.ru:/home/vva/work/mysql.orig/clear/mysql-4.0
into eagle.mysql.r18.ru:/home/vva/work/BUG_2526/mysql-4.0
2004-02-05 17:53:46 +04:00
vva@eagle.mysql.r18.ru
fedeafaef0 code cleanup 2004-02-05 17:52:41 +04:00
monty@mysql.com
6bfede9639 Added SQL_SELECT::cleanup() to make it easier to reuse SQL_SELECT item's for sub selects. Needed for proper fix for bug #2479.
Added 'select_to_file' class to be able to merge identical code for select_export and select_dump
2004-02-05 10:22:08 +01:00
vva@eagle.mysql.r18.ru
7769e5a677 added checking for bootstrap in select_send::send_data
(fixed bug #2526 "--init-file crashes MySQL if contains large select")
Such checking usually works in send_ok, send_eof, but in this case large 
result causes interim flushing.
2004-02-04 21:35:20 +04:00
monty@mysql.com
ed44e769ba Fixed parsing of column names and foreign key constraints in Innobase to handle quoted identifiers and identifiers with space. (Bug #1725)
Fix optimizer tuning bug when first used key part was a constant. (Bug #1679)
2004-01-30 10:46:30 +01:00
hf@deer.(none)
94b0713ca1 bugfix to #1224
code slightly modified with Monty's suggestions
2004-01-27 13:46:47 +04:00
bell@sanja.is.com.ua
242e8dbbbb merge 2004-01-17 13:13:48 +02:00
jani@rhols221.adsl.netsonic.fi
1cc08ed699 Fixed Bug#2123, mysqld segmentation faulted when it tried to
open a file that already existed. The problem was that end_io_cache()
was called even if init_io_cache() was not. This affected both
OUTFILE and DUMPFILE (both fixed). Sometimes wrongly aligned pointer was freed,
sometimes mysqld core dumped.

Other problem was that select_dump::send_error removed the dumpfile,
even if it was created by an earlier run, or by some other program, if
the file permissions just permitted it. Fixed it so that the file will
only be deleted, if an error occurred, but the file was created by mysqld
just a moment ago, in that thread.

On the other hand, select_export did not handle the corresponding garbage
file at all. Both fixed.

After these fixes, a big part of the select_export::prepare and select_dump::prepare
code became identical. Merged the code into a new function called create_file(),
which is now called by the two latter functions.

Regards,
Jani
2004-01-15 06:48:31 +02:00
hf@deer.(none)
3348564447 Fix for 1224 (USER() CURRENT_USER() functions in embedded library)
Now we return user@host for USER() in embedded library
CURRENT_USER returns empty string if library compiled with
NO_EMBEDDED_ACCESS_CHECKS
2004-01-07 21:30:15 +04:00
bell@sanja.is.com.ua
e5fa5585f0 removed droping field->query_id for reinitialization tables for subquery.
(BUG#2089)
2004-01-03 00:12:07 +02:00
konstantin@oak.local
3382eea70e short patch for bug #2184 'Prepared statements in embedded library was
broken with recent changes' (attempt 2).
Adding Statement_core is better because:
- set_statement() code is shorter and you don't need to modify it when adding
new members to Statement_core
- a bit faster (you don't have virtual call and don't free_root() twice)
Do that short patch instead in hope that set_statement() will be sooner or
later removed entirely
2003-12-23 15:38:19 +03:00