Commit graph

373 commits

Author SHA1 Message Date
unknown
e9c420ccf1 Merge mysql.com:/home/emurphy/src/bk-clean/mysql-4.1
into  mysql.com:/home/emurphy/src/work/mysql-5.0


BitKeeper/deleted/.del-ctype-cp932.c:
  Auto merged
BitKeeper/deleted/.del-ctype_cp932.result:
  Auto merged
BitKeeper/deleted/.del-ctype_cp932.test:
  Auto merged
include/m_ctype.h:
  Auto merged
include/my_sys.h:
  Auto merged
innobase/srv/srv0start.c:
  Auto merged
mysql-test/mysql-test-run.pl:
  Auto merged
mysys/charset.c:
  Auto merged
netware/BUILD/nwbootstrap:
  Auto merged
sql/item.h:
  Auto merged
sql/log_event.cc:
  Auto merged
sql/log_event.h:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
strings/ctype-big5.c:
  Auto merged
strings/ctype-bin.c:
  Auto merged
strings/ctype-czech.c:
  Auto merged
strings/ctype-euc_kr.c:
  Auto merged
strings/ctype-extra.c:
  Auto merged
strings/ctype-gb2312.c:
  Auto merged
strings/ctype-gbk.c:
  Auto merged
strings/ctype-latin1.c:
  Auto merged
strings/ctype-sjis.c:
  Auto merged
strings/ctype-tis620.c:
  Auto merged
strings/ctype-uca.c:
  Auto merged
strings/ctype-ucs2.c:
  Auto merged
strings/ctype-ujis.c:
  Auto merged
strings/ctype-utf8.c:
  Auto merged
strings/ctype-win1250ch.c:
  Auto merged
configure.in:
  Manual merge from 4.1
include/config-netware.h:
  Manual merge from 4.1
sql/item.cc:
  Manual merge from 4.1
sql/mysqld.cc:
  Manual merge from 4.1
2005-08-19 15:29:30 -04:00
unknown
1b970e94e0 Bug#11338 Fixes from review (identical functionality).
include/my_sys.h:
  Fixes from review (use version in log_event.cc instead)
mysql-test/r/ctype_cp932.result:
  Updated test for bug#11338 (logging of prepared statement w/ blob type)
mysql-test/t/ctype_cp932.test:
  udpated test for bug#11338 (logging of prepared statement w/ blob type)
mysys/charset.c:
  Fixes from review (use version in log_event.cc instead)
sql/item.cc:
  Fixes from review (store character_set_client differently so that
  fix can be merged forward to 5.0)
sql/item.h:
  Fixes from review
sql/log_event.cc:
  Fixes from review, str_to_hex is now used by item.cc
sql/log_event.h:
  Added prototype for str_to_hex (now used by item.cc)
sql/sql_prepare.cc:
  Fixes from review, store character_set_client differently so that 
  Item_param::query_val_str can use it.
2005-08-19 14:49:34 -04:00
unknown
a29b1d7151 BUG#11338 (logging of prepared statement w/ blob type)
In cp932, '\' character can be the second byte in a 
multi-byte character stream. This makes it difficult to use
mysql_escape_string. Added flag to indicate which languages allow
'\' as second byte of multibyte sequence so that when putting a prepared
statement into the binlog we can decide at runtime whether hex encoding
is really needed.


include/m_ctype.h:
  Added bool to indicate character sets which allow '\' as the second
  byte of a multibyte character set (currently only cp932). For these
  character sets, escaping with '\' is dangerous and leads to corruption
  in replication.
include/my_sys.h:
  Add function to enocde a string as hex with no prefix (bare)
mysys/charset.c:
  Add function to encode string as hex with no prefix (bare).
sql/item.cc:
  Check the connection character set to see if escape_string_for_mysql
  is safe, or if character set requires unambiguous (hex) encoding
sql/item.h:
  Pass thd to query_val_str for access to charset()
sql/sql_prepare.cc:
  Pass thd to query_val_str.
strings/ctype-big5.c:
  Add escape_with_backslash_is_dangerous flag.
strings/ctype-bin.c:
  Add escape_with_backslash_is_dangerous flag
strings/ctype-cp932.c:
  Add escape_with_backslash_is_dangerous flag.
strings/ctype-czech.c:
  Add escape_with_backslash_is_dangerous flag.
strings/ctype-euc_kr.c:
  Add escape_with_backslash_is_dangerous flag.
strings/ctype-extra.c:
  Add escape_with_backslash_is_dangerous flag.
strings/ctype-gb2312.c:
  Add escape_with_backslash_is_dangerous flag.
strings/ctype-gbk.c:
  Added escape_with_backslash_is_dangerous flag.
strings/ctype-latin1.c:
  Added escape_with_backslash_is_dangerous flag.
strings/ctype-sjis.c:
  Added escape_with_backslash_is_dangerous flag.
strings/ctype-tis620.c:
  Added esacpe_with_backslash_character_is_dangerous flag.
strings/ctype-uca.c:
  Added escape_with_backslash_is_dangerous flag.
strings/ctype-ucs2.c:
  Added escape_with_backslash_is_dangerous.
strings/ctype-ujis.c:
  Added escape_with_backslash_is_dangerous flag.
strings/ctype-utf8.c:
  Added escape_with_backslash_is_dangerous.
strings/ctype-win1250ch.c:
  Added escape_with_backslash_is_dangerous.
2005-08-17 04:26:32 -04:00
unknown
98da6d5ffb Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/dlenev/src/mysql-5.0-bg11973-2


sql/item_subselect.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
sql/sql_update.cc:
  Auto merged
mysql-test/r/trigger.result:
  SCCS merged
mysql-test/t/trigger.test:
  SCCS merged
2005-08-11 10:39:33 +04:00
unknown
42fec6b68b Merge mysql.com:/home/psergey/mysql-5.0-bug12228-r4
into mysql.com:/home/psergey/mysql-5.0-bug12228-r5


mysql-test/r/type_bit.result:
  Auto merged
mysql-test/t/sp-threads.test:
  Auto merged
mysql-test/t/type_bit.test:
  Auto merged
sql/sp.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
2005-08-10 21:17:52 +00:00
unknown
6b9ec78be0 BUG#12228: Post review fixes: Added test case, code cleanup.
mysql-test/r/sp-threads.result:
  Testcase for BUG#12228
mysql-test/t/sp-threads.test:
  Testcase for BUG#12228
sql/sp_cache.cc:
  BUG#12228: Post-review fixes: small code cleanup
sql/sp_cache.h:
  BUG#12228: Post-review fixes: fixed the comment
sql/sql_parse.cc:
  BUG#12228: Post-review fixes: in mysql_parse, flush obsolete SPs from the caches only if 
   the query hasn't been handled by the query cache.
sql/sql_prepare.cc:
  BUG#12228: Post-review fixes: in mysql_stmt_prepare/execute, flush SP caches 
   "closer to the execution"
2005-08-10 21:17:02 +00:00
unknown
61a68ed6fa Clumsy but working fix for bug #11973 "SELECT .. INTO var_name; in trigger
cause crash on update".

Let us update "thd" pointer in LEX, all its units and in LEX::result before
executing statement in trigger body, since triggers are associated with TABLE
object and because of this can be used in different threads.


mysql-test/r/trigger.result:
  Added test case for bug #11973 "SELECT .. INTO var_name; in trigger cause
  crash on update".
mysql-test/t/trigger.test:
  Added test case for bug #11973 "SELECT .. INTO var_name; in trigger cause
  crash on update".
sql/item_subselect.cc:
  subselect_engine:
    Moved implementation of set_thd() method to item_subselect.cc,
    since now it also sets "thd" for subselect_engine::result.
sql/item_subselect.h:
  subselect_engine:
    Moved implementation of set_thd() method to item_subselect.cc,
    since now it also sets "thd" for subselect_engine::result.
sql/sql_class.h:
  select_result:
    Added set_thd() method for updating select_result::thd value (we need this
    in cases when statement to which this select_result belongs will be used
    in different threads, as it happens for statements in trigger body).
  multi_delete/multi_update:
    Got rid of redundant "thd" member (we already have it in select_result).
sql/sql_delete.cc:
  multi_delete:
    Got rid of redundant "thd" member (we already have it in select_result).
sql/sql_lex.h:
  st_select_lex_unit:
    Added set_thd() method for updating st_select_lex_unit::thd value
    (we need this in cases when statement to which this unit belongs will
     be used in different threads, as it happens for statements in trigger body).
    We don't update thd of select_result pointed by st_select_lex_unit::result
    in this method, since it is either have too short lifetime (i.e. created for
    each execution) or is accessible via Item_subquery or LEX::result and thus
    already taken care of.
sql/sql_parse.cc:
  multi_delete:
    Got rid of redundant "thd" member (we already have it in select_result).
sql/sql_prepare.cc:
  reinit_stmt_before_use():
    We have to update "thd" pointer in LEX, all its units and in LEX::result,
    since statements which belong to trigger body are associated with TABLE
    object and because of this can be used in different threads.
sql/sql_update.cc:
  multi_update:
    Got rid of redundant "thd" member (we already have it in select_result).
2005-08-10 00:23:56 +04:00
unknown
8103db27bb Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/dlenev/src/mysql-5.0-is


mysql-test/r/information_schema.result:
  Auto merged
mysql-test/t/information_schema.test:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/sp.cc:
  Auto merged
sql/sp.h:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
mysql-test/r/sp.result:
  Manual merge
mysql-test/t/sp.test:
  Manual merge
sql/sql_class.h:
  Manual merge
2005-08-09 11:43:55 +04:00
unknown
502e97f875 Fix for BUG#12228: SP cache code:
* Cleanup SP Cache code, now SP Cache only deletes sp_head objects in 
  sp_cache_flush_obsolete() invalidates all pointers to routines in the cache.
* Use new SP Cache use contract in the code.

There is no test case because it doesn't seem to be possible to cause thread races to end
the same way they end in heavy-load test. This patch removes the crash in heavy test.


mysql-test/r/type_bit.result:
  Drop the tables this test tries to create
mysql-test/r/view.result:
  Drop function this test creates
mysql-test/t/type_bit.test:
  Drop the tables this test tries to create
mysql-test/t/view.test:
  Drop function this test creates
sql/sp.cc:
  Fix for BUG#12228: When a routine is deleted/modified, invalidate all cached SPs in all
  threads. We need to do so because sp_lex_keeper::{prelocking_tables, query_tables_own_last}
  in one SP may depend on another SP sp_lex_keeper::m_lex is using.
sql/sp_cache.cc:
  Fix for BUG#12228:
  * Move class sp_cache to here from sp_cache.h, document the functions.
  * sp_cache_insert, sp_cache_remove, sp_cache_invalidate and sp_cache_lookup must not delete
    sp_head* objects as they may be called during SP execution when sp_head objects are used.
  * Added sp_cache_flush_obsolete() function that may delete sp_head objects.
  * Removed sp_cache_remove as there is no need for it now - when we change one SP we should
    invalidate all other SPs, because sp_lex_keeper::{prelocking_tables, 
    query_tables_own_last} from one SP depend on content of another SP (used in 
    sp_lex_keeper::m_lex).
sql/sp_cache.h:
  Fix for BUG#12228:
  * Move class sp_cache to sp_cache.cc it is not needed in .h file
  * Added comments
sql/sql_parse.cc:
  Fix for BUG#12228: Call new sp_cache_flush_obsolete() function before running the query
sql/sql_prepare.cc:
  Fix for BUG#12228: Call new sp_cache_flush_obsolete() function before preparing/executing a PS
2005-08-08 23:23:34 +00:00
unknown
76a280f180 A fix and a test case for Bug#11909 "mysql_stmt_attr_set
CURSOR_TYPE_READ_ONLY nested queries corrupt result"


sql/sql_prepare.cc:
  If there is a cursor, use its protocol for fetch: 
  Protocol instances have a state and thd->protocol_prep can't
  be used for multiple cursors.
sql/sql_select.cc:
  - init Cursor::protocol
sql/sql_select.h:
  - add Cursor::protocol
tests/mysql_client_test.c:
  A test case for Bug#11909 "mysql_stmt_attr_set CURSOR_TYPE_READ_ONLY
   nested queries corrupt result"
2005-08-08 19:24:56 +04:00
unknown
39fda60043 Fix for bug #10055 "Using stored function with information_schema causes empty
result set".

To enable full access to contents of I_S tables from stored functions
or statements that use them, we manipulate with thread's open tables
state and ensure that we won't cause deadlock when we open tables by
ignoring flushes and name-locks.
Building of contents of I_S.TABLES no longer requires locking of tables
since we use use handler::info() method with HA_STATUS_AUTO flag instead
of handler::update_auto_increment() for obtaining information about
auto-increment values. But this also means that handlers have to implement
support for HA_STATUS_AUTO flag (particularly InnoDB needs it).


mysql-test/r/alter_table.result:
  Updated test results. This change was caused by the fact that now when
  we build contents of I_S tables (and thus output of SHOW INDEX) we
  don't use instances of tables which may be already opened and locked
  by thread (we always use new instance).
mysql-test/r/information_schema.result:
  Added test which checks how information about current auto-increment value for
  table is reported in INFORMATION_SCHEMA.TABLES view.
mysql-test/r/sp.result:
  Added test for bug #10055 "Using stored function with information_schema causes
  empty result set".
mysql-test/t/information_schema.test:
  Added test which checks how information about current auto-increment value for
  table is reported in INFORMATION_SCHEMA.TABLES view.
mysql-test/t/sp.test:
  Added test for bug #10055 "Using stored function with information_schema causes
  empty result set".
sql/mysql_priv.h:
  close_thread_tables():
    Get rid of 'stopper' argument which is no longer used. Now when we need
    to open and then close some table without touching tables which are already
    opened we use THD::reset_n/restore_backup_open_tables_state() methods.
  open_tables()/open_normal_and_derived_tables():
    Added 'flags' argument to be able open tables even if some has done
    a flush or hold namelock on them.
sql/sp.cc:
  close_proc_table/open_proc_table_for_read/db_find_routine():
    Replaced push_open_tables_state/pop_open_tables_state() methods which
    were saving/restoring current open tables state in/from THD::open_state_list
    with reset_n_backup_open_tables_state/restore_backup_open_tables_state()
    methods which assume that backup storage for this state is allocated on
    stack (or elsewhere) by their caller.
  open_proc_table_for_read():
    Since now we can have several open tables states stacked up we can't rely
    rely on checking whether we have some tables open in previous state.
    Instead we always assume that some tables are open and we need to ignore
    flush while locking mysql.proc. We don't really need 
    MYSQL_LOCK_IGNORE_GLOBAL_READ_LOCK in this case since we open mysql.proc table
    only for reading.
sql/sp.h:
  Added declarations of open_proc_table_for_read()/close_proc_table() to be
  able to use them in sql_show.cc.
sql/sql_base.cc:
  close_thread_tables():
    Get rid of 'stopper' argument which is no longer used. Now when we need
    to open and then close some table without touching tables which are already
    opened we use THD::reset_n/restore_backup_open_tables_state() methods.
  open_tables()/open_normal_and_derived_tables():
    Added 'flags' argument to be able open tables even if some has done
    a flush or hold namelock on them.
sql/sql_class.cc:
  Open_tables_state, THD:
    Replaced push_open_tables_state/pop_open_tables_state() methods which
    were saving/restoring current open tables state in/from THD::open_state_list
    with reset_n_backup_open_tables_state/restore_backup_open_tables_state()
    methods which assume that backup storage for this state is allocated on
    stack (or elsewhere) by their caller.
sql/sql_class.h:
  Open_tables_state, THD:
    Replaced push_open_tables_state/pop_open_tables_state() methods which
    were saving/restoring current open tables state in/from THD::open_state_list
    with reset_n_backup_open_tables_state/restore_backup_open_tables_state()
    methods which assume that backup storage for this state is allocated on
    stack (or elsewhere) by their caller.
sql/sql_handler.cc:
  open_tables()/open_normal_and_derived_tables():
    Added 'flags' argument to be able open tables even if some has done
    a flush or hold namelock on them.
sql/sql_prepare.cc:
  open_tables()/open_normal_and_derived_tables():
    Added 'flags' argument to be able open tables even if some has done
    a flush or hold namelock on them.
sql/sql_show.cc:
  get_all_tables():
    Now we use THD::reset_n_/restore_backup_open_tables_state() for 
    saving/restoring open tables state instead of working with it directly
    (This also allows us to have proper content of I_S system tables in
    statements with stored functions and in stored functions). We also
    ignore possible flushes when opening tables (we may create deadlock
    otherwise). Also we do all needed manipulations with LEX in this function
    and not in get_schema_tables_result() now.
  get_schema_tables_record():
    Let us use handler::info() method with HA_STATUS_AUTO flag for obtaining
    information about table's auto-increment value. This allows to avoid locking
    of tables which is needed when we use handler::update_auto_increment() method.
  fill_schema_proc():
    Now we use open_proc_table_for_read/close_proc_table() for access to
    mysql.proc table (so we won't cause deadlock if we already have some
    tables open and locked, this also allows us to have proper content in
    ROUTINES system table in statements using stored functions/in stored
    functions).
  get_schema_tables_result():
    Moved all manipulations with Open_tables_state and LEX needed for
    safe opening of tables to ST_SCHEMA_TABLE::fill_table functions
    (i.e. get_all_tables() and fill_schema_proc()).
sql/sql_update.cc:
  open_tables()/open_normal_and_derived_tables():
    Added 'flags' argument to be able open tables even if some has done
    a flush or hold namelock on them.
2005-08-08 17:46:06 +04:00
unknown
243e9f32b7 Merge grichter@bk-internal.mysql.com:/home/bk/mysql-5.0
into lmy002.wdf.sap.corp:/home/georg/work/mysql/prod/mysql-5.0


sql/sql_prepare.cc:
  Auto merged
2005-07-29 16:11:49 +02:00
unknown
90b2daa713 Ensure we free all items for prepared statements
Before the fix in ~Prepared_statments we got a memory leak when executing mysql_client_test.test
Note that test 'variables.test' fails.
This will be fixed when Jimw pushes the fix for Bug 10351


mysys/default.c:
  Fixed typo
sql/item.cc:
  More debugging information
sql/sql_prepare.cc:
  More debugging information
  Ensure we free all items for prepared statements
  Before the fix in ~Prepared_statments we got a memory leak when executing mysql_client_test.test
2005-07-29 05:06:35 +03:00
unknown
b8d992f0a7 fix for bug#9968 (slow query log contains useless entries)
Query has to be written to the log before calling
thd->set_statement(&stmt_backup), otherwise query will be empty.
Setting thd->enabe_slow_log to FALSE prevents that dispatch_command
logs the (empty) query again.
2005-07-27 12:45:32 +02:00
unknown
53e598665e Merge bk-internal:/home/bk/mysql-5.0
into  mysql.com:/home/jimw/my/mysql-5.0-clean


sql/mysql_priv.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
tests/mysql_client_test.c:
  Auto merged
sql/item_timefunc.cc:
  Auto merged
2005-07-19 19:59:32 -07:00
unknown
de6f5ae5ab A fix and a test case for Bug#10760 and complementary cleanups.
The idea of the patch
is that every cursor gets its own lock id for table level locking.
Thus cursors are protected from updates performed within the same 
connection. Additionally a list of transient (must be closed at
commit) cursors is maintained and all transient cursors are closed
when necessary. Lastly, this patch adds support for deadlock
timeouts to TLL locking when using cursors.
+ post-review fixes.


include/thr_lock.h:
  - add a notion of lock owner to table level locking. When using
    cursors, lock owner can not be identified by a thread id any more, 
    as we must protect cursors from updates issued within the same 
    connection (thread). So, each cursor has its own lock identifier to 
    use with table level locking.
  - extend return values of thr_lock and thr_multi_lock with
    THR_LOCK_TIMEOUT and THR_LOCK_DEADLOCK, since these conditions
    are now possible (see comments to thr_lock.c)
mysys/thr_lock.c:
  Better support for cursors:
  - use THR_LOCK_OWNER * as lock identifier, not pthread_t.
  - check and return an error for a trivial deadlock case, when an
    update statement is issued to a table locked by a cursor which has 
    been previously opened in the same connection.
  - add support for locking timeouts: with use of cursors, trivial 
    deadlocks can occur. For now the only remedy is the lock wait timeout,
    which is initialized from a new global variable 'table_lock_wait_timeout'
    Example of a deadlock (assuming the storage engine does not downgrade 
    locks):
    con1: open cursor for select * from t1;
    con2: open cursor for select * from t2;
    con1: update t2 set id=id*2;  -- blocked
    con2: update t1 set id=id*2;  -- deadlock
    Lock timeouts are active only if a connection is using cursors.
  - the check in the wait_for_lock loop has been changed from
    data->cond != cond to data->cond != 0. data->cond is zeroed
    in every place it's changed. 
  - added comments
sql/examples/ha_archive.cc:
  - extend the handlerton with the info about cursor behaviour at commit.
sql/examples/ha_archive.h:
  - ctor moved to .cc to make use of archive handlerton
sql/examples/ha_example.cc:
  - add handlerton instance, init handler::ht with it
sql/examples/ha_example.h:
  - ctor moved to .cc to make use of ha_example handlerton
sql/examples/ha_tina.cc:
  - add handlerton instance, init handler::ht with it
sql/examples/ha_tina.h:
  - ctor moved to .cc to make use of CSV handlerton
sql/ha_berkeley.cc:
  - init handlerton::flags and handler::ht
sql/ha_berkeley.h:
  - ctor moved to .cc to make use of BerkeleyDB handlerton
sql/ha_blackhole.cc:
  - add handlerton instance, init handler::ht with it
sql/ha_blackhole.h:
  - ctor moved to .cc to make use of blackhole handlerton
sql/ha_federated.cc:
  - add handlerton instance, init handler::ht with it
sql/ha_federated.h:
  - ctor moved to .cc to make use of federated handlerton
sql/ha_heap.cc:
  - add handlerton instance, init handler::ht with it
sql/ha_heap.h:
  - ctor moved to .cc to make use of ha_heap handlerton
sql/ha_innodb.cc:
  - init handlerton::flags and handler::ht of innobase storage engine
sql/ha_innodb.h:
  - ctor moved to .cc to make use of archive handlerton
sql/ha_myisam.cc:
  - add handlerton instance, init handler::ht with it
sql/ha_myisam.h:
  - ctor moved to .cc to make use of MyISAM handlerton
sql/ha_myisammrg.cc:
  - init handler::ht in the ctor
sql/ha_myisammrg.h:
  - ctor moved to .cc to make use of MyISAM MERGE handlerton
sql/ha_ndbcluster.cc:
  - init handlerton::flags and handler::ht
sql/handler.cc:
  - drop support for ISAM storage engine, which was removed from 5.0
  - close all "transient" cursors at COMMIT/ROLLBACK. A "transient"
    SQL level cursor is a cursor that uses tables that have a transaction-
    specific state.
sql/handler.h:
  - extend struct handlerton with flags, add handlerton *ht to every
    handler instance.
sql/lock.cc:
  - extend mysql_lock_tables to send error to the client if 
    thr_multi_lock returns a timeout or a deadlock error.
sql/mysqld.cc:
  - add server option --table_lock_wait_timeout (in seconds)
sql/set_var.cc:
  - add new global variable 'table_lock_wait_timeout' to specify
  a wait timeout for table-level locks of MySQL (in seconds). The default
  timeout is 50 seconds. The timeout is active only if the connection
  has open cursors.
sql/sql_class.cc:
  - implement Statement_map::close_transient_cursors
  - safety suggests that we need an assert ensuring 
   llock_info->n_cursors is functioning properly, adjust destruction of
   the Statement_map to allow such assert in THD::~THD
sql/sql_class.h:
  - add support for Cursors registry to Statement map.
sql/sql_prepare.cc:
  - maintain a list of cursors that must be closed at commit/rollback.
sql/sql_select.cc:
  - extend class Cursor to support specific at-COMMIT/ROLLBACK behavior.
  If a cursor uses tables of a storage engine that 
  invalidates all open tables at COMMIT/ROLLBACK, it must be closed
  before COMMIT/ROLLBACK is executed.
sql/sql_select.h:
  - add an own lock_id and commit/rollback status flag to class Cursor
tests/mysql_client_test.c:
  A test case for Bug#10760 and complementary issues: test a simple
  deadlock case too.
mysql-test/var:
  New BitKeeper file ``mysql-test/var''
2005-07-19 22:21:12 +04:00
unknown
e9c64ae296 Merge mysql.com:/home/jimw/my/mysql-4.1-clean
into  mysql.com:/home/jimw/my/mysql-5.0-clean


extra/perror.c:
  Auto merged
include/my_global.h:
  Auto merged
mysql-test/r/ps_1general.result:
  Auto merged
mysql-test/r/ps_2myisam.result:
  Auto merged
mysql-test/r/ps_3innodb.result:
  Auto merged
mysql-test/r/ps_4heap.result:
  Auto merged
mysql-test/r/ps_5merge.result:
  Auto merged
mysql-test/r/ps_6bdb.result:
  Auto merged
mysql-test/r/ps_7ndb.result:
  Auto merged
mysql-test/r/select.result:
  Auto merged
ndb/src/mgmsrv/ConfigInfo.cpp:
  Auto merged
ndb/src/mgmsrv/main.cpp:
  Auto merged
sql/des_key_file.cc:
  Auto merged
sql/field_conv.cc:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_strfunc.cc:
  Auto merged
sql/item_timefunc.cc:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
tests/mysql_client_test.c:
  Auto merged
mysql-test/t/select.test:
  Resolve conflicts
scripts/mysqld_safe.sh:
  Resolve conflict
sql/item.cc:
  Resolve conflict, don't return FIELD_TYPE_BLOB since VARCHAR
  can be longer in 5.0 than 4.1.
sql/log_event.cc:
  Resolve conflict
sql/mysql_priv.h:
  Resolve conflict
sql/mysqld.cc:
  Remove incorrect fix (merge from 4.1)
sql/sql_show.cc:
  Resolve conflict
2005-07-19 11:05:49 -07:00
unknown
3a31f7b91f Simple fixes during review of new code
include/my_global.h:
  Added floatget() to read unaligned flaot
mysql-test/r/select.result:
  Added test for found_rows()
mysql-test/t/select.test:
  Added test for found_rows()
sql/des_key_file.cc:
  Moved initalization of LOCK_des_key_file to mysqld to make simpler code and avoid theoretical race condition
sql/field_conv.cc:
  Added optimizzed varsion of do_cut_string (for simple character sets)
sql/item_func.cc:
  Simplify code (and ensure DBUG_ENTER is excuted before main code)
sql/item_strfunc.cc:
  Safe calculation of max_length
  This was needed as max_length can now be 1<<32-1 (after konstantins recent patch to fix BLOB_LENGTH)
  Remove init_des_key_file() as this is not initialized in mysqld.cc
sql/item_timefunc.cc:
  Safe calculation of max_length
  This was needed as max_length can now be 1<<32-1 (after konstantins recent patch to fix BLOB_LENGTH)
sql/log_event.cc:
  Simplify code
sql/mysql_priv.h:
  Moved initalization of LOCK_des_key_file to mysqld to make simpler code and avoid theoretical race condition
sql/mysqld.cc:
  Moved initalization of LOCK_des_key_file to mysqld to make simpler code and avoid theoretical race condition
  Revert wrong patch of calling close_connection() in first close_connections() loop. (Bug #7403)
  Instead we now print a warning for closed connections only if mysqld is sarted with --warnings
  Added comments to make the close_connections() logic clearer
sql/sql_prepare.cc:
  Use floatget() and doubleget() to protect against unaligned data
sql/sql_select.cc:
  Fixed some cases unlikely cases where found_rows() would return wrong for queries that would return 0 or 1 rows
2005-07-19 19:25:05 +03:00
unknown
5b6c1348c7 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mishka.local:/home/my/mysql-5.0


client/mysqldump.c:
  Auto merged
include/my_sys.h:
  Auto merged
mysys/Makefile.am:
  Auto merged
sql/ha_innodb.cc:
  Auto merged
sql/ha_ndbcluster.cc:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/item_strfunc.cc:
  Auto merged
sql/log.cc:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/opt_range.cc:
  Auto merged
sql/sql_cache.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
tests/mysql_client_test.c:
  Auto merged
sql/sql_select.cc:
  Auto merged
mysys/default.c:
  SCCS merged
2005-07-18 19:03:01 +03:00
unknown
68b4d7b74d Cleanups during review
Changed defaults option --instance to --defaults-group-suffix
Changed option handling to allow --defaults-file, --defaults-extra-file and --defaults-group-suffix to be given in any order
Changed MYSQL_INSTANCE to MYSQL_GROUP_SUFFIX
mysql_print_defaults now understands --defaults-group-suffix
Remove usage of my_tempnam() (not safe function)
if( -> if ( and while( to while (


BitKeeper/deleted/.del-my_tempnam.c~a8562f15dad3012f:
  Delete: mysys/my_tempnam.c
VC++Files/client/mysqlclient.dsp:
  Remove not used file my_tempnam.c
VC++Files/client/mysqlclient_ia64.dsp:
  Remove not used file my_tempnam.c
VC++Files/libmysql/libmysql.dsp:
  Remove not used file my_tempnam.c
VC++Files/libmysql/libmysql_ia64.dsp:
  Remove not used file my_tempnam.c
VC++Files/mysys/mysys.dsp:
  Remove not used file my_tempnam.c
VC++Files/mysys/mysys_ia64.dsp:
  Remove not used file my_tempnam.c
client/mysql.cc:
  Change to use get_defaults_options()
  Remove compiler warnings
client/mysqldump.c:
  Indentation fixes
  Use quoted table name for 'primary_key_fields'
extra/my_print_defaults.c:
  Add support for --defaults-group-suffix
  change to use get_default_options()
extra/replace.c:
  Replace my_tempnam() with create_tmp_file() to allow us to remove my_tempnam.c
include/config-win.h:
  Added DEFAULT_GROUP_SUFFIX_ENV
include/my_sys.h:
  Change defaults_instance -> defaults_group_suffix
  Change get_defaults_files -> get_defaults_options
libmysql/Makefile.shared:
  Added DEFAULT_GROUP_SUFFIX_ENV
mysys/Makefile.am:
  Added DEFAULT_GROUP_SUFFIX_ENV
  Remove my_tempnam.c
mysys/default.c:
  Changed --instance to --defaults-group-suffix
  Changed MYSQL_INSTANCE to MYSQL_GROUP_SUFFIX and moved the name to Makefile.am
  (mysys shouldn't by MySQL independent)
  Changed option handling to allow --defaults-file, --defaults-extra-file and --defaults-group-suffix to be given in any order
mysys/default_modify.c:
  Optimized code to use allocated space more efficently
  Reduce code size
  Ensure that realloc() works independent of argument size
mysys/my_bitmap.c:
  Added missing return
sql/ha_innodb.cc:
  Change if( -> if (
sql/ha_ndbcluster.cc:
  Change while( -> while (
sql/item_cmpfunc.cc:
  Break loop early (simple optimization)
sql/item_strfunc.cc:
  Change if( -> if (
sql/log.cc:
  Fixed comment
sql/mysqld.cc:
  Change if( -> if (
sql/opt_range.cc:
  while( -> while (
  if( -> if (
sql/parse_file.cc:
  Change if( -> if (
sql/sql_cache.cc:
  while( -> while (
sql/sql_parse.cc:
  Change if( -> if (
sql/sql_prepare.cc:
  Added comment
sql/sql_select.cc:
  while( -> while (
  Removed index variable by incrementing pointer
sql/sql_show.cc:
  Change if( -> if (
sql/sql_yacc.yy:
  Change if( -> if (
tests/mysql_client_test.c:
  Added cast to first argument to bzero()
2005-07-18 15:33:18 +03:00
unknown
2a48132e01 Merge poseidon.ndb.mysql.com:/home/tomas/mysql-4.1-release
into poseidon.ndb.mysql.com:/home/tomas/mysql-4.1-new


mysql-test/t/ctype_utf8.test:
  Auto merged
ndb/src/common/mgmcommon/ConfigRetriever.cpp:
  Auto merged
ndb/src/common/transporter/TransporterRegistry.cpp:
  Auto merged
ndb/src/mgmclient/CommandInterpreter.cpp:
  Auto merged
ndb/src/mgmsrv/MgmtSrvr.cpp:
  Auto merged
ndb/src/mgmsrv/MgmtSrvr.hpp:
  Auto merged
ndb/src/mgmsrv/Services.cpp:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
2005-07-15 13:32:08 +02:00
unknown
56a6aa9eb1 Merge mysql.com:/space/my/mysql-4.1.13-clone
into mysql.com:/space/my/mysql-5.0-build


sql/sql_prepare.cc:
  Auto merged
support-files/mysql.spec.sh:
  Auto merged
2005-07-15 09:23:36 +02:00
unknown
10b76d41a4 Jim's fix for the #10443.
Fix handling of floats and doubles when using prepared statements             
API in the embedded server. 


sql/sql_prepare.cc:
  Jim's fix for the #10443.
  
  Within the embedded server, there's no need to use float4get()              
  and float8get() for setting parameters, since they are never                
  stored.
2005-07-15 11:17:57 +05:00
unknown
fd9f67f8d2 Implement MarkM optimization request to avoid redundnat packet exchange
in cursors.


libmysql/libmysql.c:
  - reset_stmt_handle(): don't reset the server side just because we have 
    an open cursor: the server will close the cursor automatically if 
    needed
sql/sql_prepare.cc:
  - implement Prepared_statement::close_cursor,
  - implicitly close an open cursor in mysql_stmt_execute instead of 
    issuing an error (to reduce the need to explicitly close cursors
    and save network bandwidth).
  - cleanup
sql/sql_select.cc:
  Remove a destructor: cursor destruction can not be done by simply
  calling a destructor, because of cross-references between cursor
  and statement memory.
sql/sql_select.h:
  - add an empty Cursor destructor
tests/mysql_client_test.c:
  - remove a test for dropped functionality
2005-07-14 15:27:24 +04:00
unknown
91c97a76fc Merge mysql.com:/opt/local/work/mysql-4.1-11458
into  mysql.com:/opt/local/work/mysql-5.0-root


sql/mysql_priv.h:
  Auto merged
sql/sql_lex.h:
  Auto merged
mysql-test/r/ps.result:
  Manual merge.
mysql-test/t/ps.test:
  Manual merge.
sql/item.cc:
  Manual merge.
sql/item.h:
  Manual merge.
sql/item_subselect.h:
  Manual merge.
sql/sql_parse.cc:
  Manual merge.
sql/sql_prepare.cc:
  Manual merge.
2005-07-13 18:05:57 +04:00
unknown
ece17ba3cf - a fix for Bug#11458 "Prepared statement with subselects return random
data": remove the fix for another bug (8807) that
added OUTER_REF_TABLE_BIT to all subqueries that used a placeholder
to prevent their evaluation at prepare. As this bit hanged in 
Item_subselect::used_tables_cache for ever, a constant subquery with
a placeholder was never evaluated as such, which caused wrong 
choice of the execution plan for the statement.
- to fix Bug#8807 backport a better fix from 5.0
- post-review fixes.


mysql-test/r/ps.result:
  Bug#11458: test results fixed
mysql-test/t/ps.test:
  - add a test case for Bug#11458 "Prepared statement with subselects return 
  random data"
sql/item.cc:
  - remove unnecessary Item_param::fix_fields
  - fix Item_param::set_null to set item_type accordingly (safety:
    Item_param should behave like a basic constant).
sql/item.h:
  Remove Item_param::fix_fields
sql/item_subselect.h:
  Remove no more existing friend.
sql/mysql_priv.h:
  Add UNCACHEABLE_PREPARE to mark all subqueries as uncacheable if
  in statement prepare (backport from 5.0).
sql/sql_lex.h:
  Comment fixed.
sql/sql_parse.cc:
  If in statement prepare, mark all subqueries as uncacheable (backport
  from 5.0)
sql/sql_prepare.cc:
  Switch off the uncacheable flag from all subqueries after statement
  prepare is done (backport from 5.0)
2005-07-13 17:38:55 +04:00
unknown
428830c500 After merge fixes
Better fix for ON DUPLICATE KEY UPDATE


mysql-test/r/group_by.result:
  After merge fixes
mysql-test/r/select.result:
  Reorder test to match 4.1 tests (will make future merges easier)
mysql-test/t/group_by.test:
  Added --disable_ps_protocol to avoid extra warning
mysql-test/t/select.test:
  Reorder test to match 4.1 tests (will make future merges easier)
sql/mysql_priv.h:
  Better fix for ON DUPLICATE KEY UPDATE
sql/sql_base.cc:
  After merge fixes
sql/sql_insert.cc:
  Better fix for ON DUPLICATE KEY UPDATE
  (old solution gave problem with item->cached_table)
sql/sql_prepare.cc:
  Better fix for ON DUPLICATE KEY UPDATE
2005-07-04 03:24:25 +03:00
unknown
eeee5fb10b Merge with 4.1
Makefile.am:
  Auto merged
myisam/mi_create.c:
  Auto merged
myisam/mi_open.c:
  Auto merged
mysql-test/r/ctype_utf8.result:
  Auto merged
mysys/thr_alarm.c:
  Auto merged
VC++Files/sql/mysqld.dsp:
  Keep old
client/mysqldump.c:
  Manual merge
client/mysqltest.c:
  Automatic merge
configure.in:
  Manual merge
mysql-test/r/ctype_ucs.result:
  Auto merge
mysql-test/r/func_str.result:
  Auto merge
mysql-test/r/group_by.result:
  Auto merge
mysql-test/r/insert_select.result:
  Auto merge
mysql-test/r/insert_update.result:
  Auto merge
mysql-test/r/lowercase_table2.result:
  Auto merge
mysql-test/r/select.result:
  Manual merge
mysql-test/r/variables.result:
  Auto merge
mysql-test/t/ctype_ucs.test:
  Auto merge
mysql-test/t/func_str.test:
  Auto merge
mysql-test/t/group_by.test:
  Auto merge
mysql-test/t/insert_select.test:
  Auto merge
mysql-test/t/insert_update.test:
  Auto merge
mysql-test/t/ndb_alter_table.test:
  Auto merge
mysql-test/t/select.test:
  Auto merge
mysql-test/t/variables.test:
  Auto merge
mysys/my_access.c:
  Auto merge
scripts/make_win_src_distribution.sh:
  Auto merge
sql/field.cc:
  Manual merge
sql/ha_ndbcluster.cc:
  Auto merge
sql/handler.cc:
  Auto merge
sql/item.cc:
  Auto merge
sql/item.h:
  Manual merge
sql/item_cmpfunc.h:
  Auto merge
sql/item_strfunc.cc:
  Auto merge
sql/item_strfunc.h:
  Auto merge
sql/mysql_priv.h:
  manual merge
sql/mysqld.cc:
  manual merge
sql/opt_range.cc:
  manual merge
sql/set_var.cc:
  Auto merge
sql/sql_base.cc:
  manual merge
  Restore processing of ON DUPLICATE KEY UPDATE
sql/sql_insert.cc:
  manual merge
  Restore processing of ON DUPLICATE KEY UPDATE
  Simplify mysql_prepare_insert by using local variable for select_lex and save old values just before they are changed
sql/sql_parse.cc:
  Restore processing of ON DUPLICATE KEY UPDATE
sql/sql_prepare.cc:
  New ON DUPLICATE KEY UPDATE handling
sql/sql_select.cc:
  manual merge
sql/sql_table.cc:
  auto merge
sql/sql_yacc.yy:
  auto merge
strings/ctype-ucs2.c:
  auto merge
strings/ctype-utf8.c:
  auto merge
2005-07-03 14:17:52 +03:00
unknown
d0df504b83 Fix a crash I introduced by the last push. 2005-07-01 19:01:02 +04:00
unknown
b32d2ac276 Fix a valgrind warning.
sql/sql_prepare.cc:
  A small fix for the previous patch: we should first free the
  prepared statement items, and then free the runtime memory root,
  as some memory used for cleanup is allocated in that mem root.
sql/sql_select.cc:
  - ever free the cursor mem root in close() (it's too early).
2005-07-01 17:51:04 +04:00
unknown
dc22424bd9 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/opt/local/work/mysql-5.0-11172-new


sql/sql_class.cc:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
2005-07-01 15:50:32 +04:00
unknown
d36c14f748 A fix and a test case for Bug#11172 "mysql_stmt_attr_set
CURSOR_TYPE_READ_ONLY date/datetime filter server crash".
The fix adds support for Item_change_list in cursors (proper rollback
of the modified item tree). 


sql/sql_class.cc:
  No need to call fatal_error() twice.
sql/sql_prepare.cc:
  - implement proper cleanup of the prepared statement in mysql_stmt_reset
    if there is a cursor.
  - take into account thd->change_list when fetching data through a
    cursor.
sql/sql_select.cc:
  - take into account thd->change_list when fetching data from a cursor:
    grab it when we open a cursor, and rollback the changes to the parsed
    tree when we close it.
sql/sql_select.h:
  - Cursor::change_list added
tests/mysql_client_test.c:
  - a test case for Bug#11172 "mysql_stmt_attr_set CURSOR_TYPE_READ_ONLY date/datetime
   filter server crash"
2005-07-01 15:47:45 +04:00
unknown
b4f595b95f Name resolution context added (BUG#6443)
include/my_bitmap.h:
  new bitmap operation
mysql-test/r/view.result:
  added warnings
  Correct inserting data check (absence of default value) for view underlying tables (BUG#6443)
mysql-test/t/view.test:
  Correct inserting data check (absence of default value) for view underlying tables (BUG#6443)
mysys/my_bitmap.c:
  new bitmap operation
sql/field.h:
  index of field in table added
sql/item.cc:
  Name resolution context added
  table list removed from fix_fields() arguments
sql/item.h:
  Name resolution context added
  table list removed from fix_fields() arguments
sql/item_cmpfunc.cc:
  table list removed from fix_fields() arguments
sql/item_cmpfunc.h:
  table list removed from fix_fields() arguments
sql/item_func.cc:
  table list removed from fix_fields() arguments
sql/item_func.h:
  table list removed from fix_fields() arguments
sql/item_row.cc:
  table list removed from fix_fields() arguments
sql/item_row.h:
  table list removed from fix_fields() arguments
sql/item_strfunc.cc:
  fixed server crash on NULL argument
sql/item_strfunc.h:
  table list removed from fix_fields() arguments
sql/item_subselect.cc:
  table list removed from fix_fields() arguments
sql/item_subselect.h:
  table list removed from fix_fields() arguments
sql/item_sum.cc:
  table list removed from fix_fields() arguments
sql/item_sum.h:
  table list removed from fix_fields() arguments
sql/item_timefunc.cc:
  table list removed from fix_fields() arguments
sql/item_timefunc.h:
  table list removed from fix_fields() arguments
sql/item_uniq.h:
  table list removed from fix_fields() arguments
sql/log_event.cc:
  Name resolution context added
sql/log_event.h:
  Name resolution context added
sql/mysql_priv.h:
  Name resolution context added
sql/set_var.cc:
  table list removed from fix_fields() arguments
sql/share/errmsg.txt:
  new error message
sql/sp.cc:
  Name resolution context added
sql/sp_head.cc:
  table list removed from fix_fields() arguments
sql/sp_head.h:
  Name resolution context added
sql/sql_base.cc:
  table list removed from fix_fields() arguments
  Name resolution context added
sql/sql_class.cc:
  renamed variable
sql/sql_delete.cc:
  Name resolution context added
sql/sql_derived.cc:
  Name resolution context added
sql/sql_do.cc:
  table list removed from fix_fields() arguments
sql/sql_handler.cc:
  Name resolution context added
sql/sql_help.cc:
  Name resolution context added
sql/sql_insert.cc:
  Name resolution context added
  table list removed from fix_fields() arguments
sql/sql_lex.cc:
  Name resolution context added
sql/sql_lex.h:
  removed resolve mode (information stored into name resolution context)
sql/sql_load.cc:
  table list removed from fix_fields() arguments
sql/sql_olap.cc:
  Name resolution context added
sql/sql_parse.cc:
  Name resolution context added
sql/sql_prepare.cc:
  table list removed from fix_fields() arguments
sql/sql_select.cc:
  table list removed from fix_fields() arguments
sql/sql_show.cc:
  Name resolution context added
sql/sql_trigger.cc:
  table list removed from fix_fields() arguments
sql/sql_udf.h:
  table list removed from fix_fields() arguments
sql/sql_union.cc:
  Name resolution context added
sql/sql_update.cc:
  Name resolution context added
sql/sql_view.cc:
  Name resolution context added
sql/sql_view.h:
  table list removed from fix_fields() arguments
sql/sql_yacc.yy:
  Name resolution context added
sql/table.cc:
  Name resolution context added
  merged view processing moved
sql/table.h:
  merged view processing moved
2005-07-01 07:05:42 +03:00
unknown
d10877ce8c Better bug fix for:
#9728  'Decreased functionality in "on duplicate key update
#8147  'a column proclaimed ambigous in INSERT ... SELECT .. ON DUPLICATE'

This ensures fields are uniquely qualified and also that one can't update other tables in the ON DUPLICATE KEY UPDATE part


mysql-test/r/insert_select.result:
  More tests for bug #9728 and #8147
mysql-test/r/insert_update.result:
  Updated tests after changing how INSERT ... SELECT .. ON DUPLICATE KEY works
mysql-test/t/insert_select.test:
  More tests for bug #9728 and #8147
mysql-test/t/insert_update.test:
  Updated tests after changing how INSERT ... SELECT .. ON DUPLICATE KEY works
mysys/my_access.c:
  Cleanup (shorter loop variable names)
sql/ha_ndbcluster.cc:
  Indentation fixes
sql/item.cc:
  Remove item_flags
sql/item.h:
  Remove item_flags
sql/mysql_priv.h:
  New arguments to mysql_prepare_insert
sql/sql_base.cc:
  Remove old fix for bug #8147
sql/sql_insert.cc:
  Extend mysql_prepare_insert() with new field list for tables that can be used in the values port of ON DUPLICATE KEY UPDATE
sql/sql_parse.cc:
  Revert fix for #9728
  Allow one to use other tables in ON DUPLICATE_KEY for INSERT ... SELECT if there is no GROUP BY clause
sql/sql_prepare.cc:
  New arguments to mysql_prepare_insert
sql/sql_yacc.yy:
  Revert bug fix for #9728
2005-06-27 16:46:41 +03:00
unknown
91180cb8ab - implement inheritance of sp_instr: public Query_arena.
We need every instruction to have its own arena, because we want to
  track instruction's state (INITIALIZED_FOR_SP -> EXECUTED). Because of 
  `if' statements and other conditional instructions used in stored 
  procedures, not every instruction of a stored procedure gets executed 
  during the first (or even subsequent) execution of the procedure. 
  So it's better if we track the execution state of every instruction 
  independently.
  All instructions of a given procedure now also share sp_head's 
  mem_root, but keep their own free_list.
  This simplifies juggling with free Item lists in sp_head::execute.
- free_items() moved to be a member of Query_arena. 
- logic of 'backup_arena' debug member of Query_arena has been
  changed to support
  multi-backups. Until now, TRUE 'backup_arena' meant that there is
  exactly one active backup of the THD arena. Now it means simply that
  the arena is used for backup, so that we can't accidentally overwrite an 
  existing backup. This allows doing multiple backups, e.g. in
  sp_head::execute and Cursor::fetch, when THD arena is already backed up
  but we want to set yet another arena (usually the 'permanent' arena,
  to save permanent transformations/optimizations of a parsed tree).


sql/sp_head.cc:
  - use Query_arena support in sp_head::execute() as now sp_instr inherites
    from it.
sql/sp_head.h:
  - inherite sp_instr from Query_arena
sql/sql_class.cc:
  - changed the principle of Query_arena::backup_arena; free_items is now
    a member of Query_arena.
sql/sql_class.h:
  - changed the principle of Query_arena::backup_arena; free_items is now
    a member of Query_arena.
sql/sql_prepare.cc:
  free_items() is now a member of Query_arena.
sql/sql_select.cc:
  free_items() now automatically sets free_list to zero.
2005-06-23 20:22:08 +04:00
unknown
60d6b87775 Remove THD::stmt_backup
sql/sql_class.cc:
  Statement constructor for the case when it's used for backup only
  was removed.
sql/sql_class.h:
  Remove THD::stmt_backup and simplify Statement constructors.
sql/sql_prepare.cc:
  Use an object on stack instead of THD::stmt_backup
sql/sql_select.cc:
  Use an object on stack instead of THD::stmt_backup
2005-06-22 23:12:25 +04:00
unknown
40f0738b9c Adjust to the changed Query_arena constructor:
main_mem_root is moved out of class Query_arena.


sql/sp_head.cc:
  Adjust to the changed Query_arena constructor. 
  main_mem_root is moved out of class Query_arena.
sql/sp_head.h:
  main_mem_root is moved out of class Query_arena: add it to class sp_head.
sql/sql_class.cc:
  main_mem_root is moved out of class Query_arena: remove
  constructors no longer relevant, remove dead code.
sql/sql_class.h:
  main_mem_root is moved out of class Query_arena.
sql/sql_prepare.cc:
  It's better to not use main_mem_root anywhere: logically, it's not
  a public member (can't fix sp_head::make_field and Item_subselect::exec
  to make it protected)
sql/sql_select.cc:
  New Cursor constructor, which avoids unneeded memory allocation
  when initializign main_mem_root.
sql/sql_select.h:
  main_mem_root is moved out of class Query_arena.
2005-06-22 11:59:13 +04:00
unknown
c8c0140eec Fix a formatting bug and add a test for it.
sql/share/errmsg.txt:
  Fix a formatting bug.
sql/sql_prepare.cc:
  Fix a formatting bug.
tests/mysql_client_test.c:
  Test the server side error message.
2005-06-20 15:38:15 +04:00
unknown
c0918af2c7 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/opt/local/work/mysql-5.0-10736


sql/sql_class.h:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
2005-06-17 23:27:23 +04:00
unknown
63c21c07fc Rename all prepared statements COM_ commands to prefix with COM_STMT_
libmysql/libmysql.c:
  Rename.
libmysqld/lib_sql.cc:
  Rename.
sql/item_cmpfunc.cc:
  Use proper method to check for stmt prepare, only_prepare is removed.
sql/mysql_priv.h:
  Remove an obsolete define. Rename mysql_stmt_free to mysql_stmt_close.
sql/sql_class.h:
  Remove THD::only_prepare.
  Rename.
sql/sql_lex.cc:
  Rename COM_PREPARE -> COM_STMT_PREPARE
sql/sql_parse.cc:
  Rename.
sql/sql_prepare.cc:
  Rename.
sql/sql_yacc.yy:
  Rename.
tests/mysql_client_test.c:
  Rename.
2005-06-17 23:26:25 +04:00
unknown
8f8f697490 Merge bk-internal:/home/bk/mysql-5.0
into serg.mylan:/usr/home/serg/Abk/mysql-5.0


sql/sql_class.h:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
2005-06-17 11:29:55 +02:00
unknown
db10586e80 Post-merge fixes. 2005-06-17 01:58:36 +04:00
unknown
574f6c8dcc Manual merge (4.1->5.0) 2005-06-17 00:34:35 +04:00
unknown
c0484a301f Fix Bug#9334 "PS API queries in log file" and
Bug#8367 "low log doesn't gives complete information about prepared 
statements"
Implement status variables for prepared statements commands (a port of
the patch by Andrey Hristov).
See details in comments to the changed files.
No test case as there is no way to test slow log/general log in 
mysqltest.


mysql-test/r/ps_grant.result:
  Now execute is logged with tag 'Execute' (changed result file).
sql/mysql_priv.h:
  - remove obsolete macro.
  - add declarations for new status variables.
  - export function log_slow_statement, which now is used in sql_prepare.cc
sql/mysqld.cc:
  Add status variables for prepared statements API: now we record
  mysql_stmt_close, mysql_stmt_reset, mysql_stmt_prepare, mysql_stmt_execute
  mysql_stmt_send_long_data, PREPARE, EXECUTE, DEALLOCATE.
sql/sql_parse.cc:
  - account DEALLOCATE prepare as a Com_stmt_close command (close of a
  prepared statement).
sql/sql_prepare.cc:
  - fix a bug in SQL syntax for prepared statements + logging:
    if we use --log and EXECUTE stmt USING @no_such_variable;, the
    server crashed because the old code assumed that the variable 
    returned by get_var_with_binlog is never NULL.
  - account statistics for 
    mysql_stmt_{prepare,execute,close,reset,send_long_data} in
    Com_stmt_{prepare,execute,close,reset,send_long_data} correspondingly.
  - log slow statements into the slow log early, when thd->query
    points to a valid (with expanded placeholder values) query.
    The previous version was logging it in sql_parse, when thd->query
    is empty. Prevent the server from logging the statement twice by 
    setting thd->enable_slow_log= FALSE.
  - now in case of EXECUTE stmt in SQL syntax for prepared statements the 
    general log gets two queries, e.g.
    Query    EXECUTE stmt USING @a, @b, @c
    Execute  INSERT INTO t1 VALUES (1, 2, 3)
    This makes the behavior consistent with PREPARE command, which
    also logs the statement twice.
2005-06-17 00:11:48 +04:00
unknown
f1e42a0b35 renamed:
Item_buff -> Cached_item
  Item_arena -> Query_arena
  TEST_ASSERT -> YYERROR_UNLESS


sql/item.h:
  renamed:
    Item_buff -> Cached_item
sql/item_buff.cc:
  renamed:
    Item_buff -> Cached_item
sql/item_func.cc:
  renamed:
    Item_arena -> Query_arena
sql/item_subselect.cc:
  renamed:
    Item_arena -> Query_arena
sql/sp_head.cc:
  renamed:
    Item_arena -> Query_arena
sql/sp_head.h:
  renamed:
    Item_arena -> Query_arena
sql/sql_base.cc:
  renamed:
    Item_arena -> Query_arena
sql/sql_class.cc:
  renamed:
    Item_arena -> Query_arena
sql/sql_class.h:
  renamed:
    Item_arena -> Query_arena
sql/sql_lex.cc:
  renamed:
    Item_arena -> Query_arena
sql/sql_prepare.cc:
  renamed:
    Item_arena -> Query_arena
sql/sql_select.cc:
  renamed:
    Item_arena -> Query_arena
sql/sql_select.h:
  renamed:
    Item_buff -> Cached_item
    Item_arena -> Query_arena
sql/sql_union.cc:
  renamed:
    Item_arena -> Query_arena
sql/sql_view.cc:
  renamed:
    Item_arena -> Query_arena
sql/sql_yacc.yy:
  renamed:
    TEST_ASSERT -> YYERROR_UNLESS
sql/table.cc:
  renamed:
    Item_arena -> Query_arena
2005-06-15 19:58:35 +02:00
unknown
d0db70270c A fix and test case for Bug#10729 "mysql_stmt_attr_set
CURSOR_TYPE_READ_ONLY". The bug was that we (me) don't perform proper
cleanups of the prepared statement when done fetching from a cursor.
Another patch.


sql/mysql_priv.h:
  Rename reset_stmt_for_execute to init_stmt_before_use (to correspond to
  cleanup_stmt_and_thd_after_use).
sql/sp_head.cc:
  Rename.
sql/sql_prepare.cc:
  Move common cleanup code to a cleanup function, call it when we close
  a cursor.
sql/sql_select.cc:
  Cleanup.
sql/sql_select.h:
  No need for init_thd, this code has been inlined in Cursor::open.
tests/mysql_client_test.c:
  Add a test case for Bug#10729 "mysql_stmt_attr_set CURSOR_TYPE_READ_ONLY"
  (problem reusing a prepared statemnt if there was a cursor)
2005-06-09 18:17:45 +04:00
unknown
c6c49859b7 Manual merge
sql/mysql_priv.h:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
2005-06-09 01:13:20 +04:00
unknown
4e0bbc1b6e Fix for bug #11158 "Can't perform multi-delete in stored procedure".
In order to make multi-delete SP friendly we need to have all table 
locks for the elements of main statement table list properly set 
at the end of parsing.

Also performed small cleanup: We don't need relink_tables_for_multidelete()
any longer since the only case now when TABLE_LIST::correspondent_table
is non-zero are tables in auxilary table list of multi-delete and these
tables are handled specially in mysql_multi_delete_prepare().


mysql-test/r/sp-threads.result:
  Added test case for bug #11158 "Can't perform multi-delete in stored
  procedure".
mysql-test/t/sp-threads.test:
  Added test case for bug #11158 "Can't perform multi-delete in stored
  procedure".
sql/mysql_priv.h:
  - Removed third argument from the declaration of multi_delete_precheck()
    as nowdays we calculate number of tables in multi-delete from which
    we are going to delete rows right at the end of statement parsing.
  - Introduced definition of multi_delete_set_locks_and_link_aux_tables()
    which is responsible for propagation of proper table locks from
    multi-delete's auxilary table list to the main list and binding
    corresponding tables in these two lists.
sql/sql_base.cc:
  Removed relink_tables_for_multidelete() routine and its invocations.
  We don't need them in 5.0 since the only case now when
  TABLE_LIST::correspondent_table is non-zero are tables in auxilary table
  list of multi-delete and these tables are handled specially in
  mysql_multi_delete_prepare().
sql/sql_lex.h:
  LEX::table_count
    Added description of new role of this LEX member for multi-delete. 
    Now for this statement we store number of tables from which we should
    delete records there.
sql/sql_parse.cc:
  multi_delete_precheck():
    Moved code which is responsible for iterating through auxilary table
    list and binding its elements with corresponding elements of main
    table list, and properly updating locks in it to separate function -
    multi_delete_set_locks_and_link_aux_tables(). This is because in order
    to make multi-delete SP friendly we need to have all locks set properly
    at the end of statement parsing. So we are introducing new function
    which will be called from parser.
    We also calculate number of tables from which we are going to perform
    deletions there and store this number for later usage in
    LEX::table_count.
    Also removed some no longer needed code.
sql/sql_prepare.cc:
  mysql_test_multidelete():
    Now multi_delete_precheck() takes only two arguments, so we don't
    need to pass fake third parameter.
sql/sql_yacc.yy:
  delete:
    In order to make multi-delete SP friendly we need to have all table 
    locks for the elements of main statement table list properly set 
    at the end of parsing.
2005-06-09 01:07:52 +04:00
unknown
8aba6f29cb Trim trailing spaces. 2005-06-08 19:57:26 +04:00
unknown
70c0f31086 Cleanup sql_prepare.cc
sql/sql_prepare.cc:
  Cleanup mysql_test_* family of calls: now we don't send error message
  from mysql_stmt_prepare, so no need to support -1 return code 
  (meaning error is not sent to client) in these functions.
  Move unit->cleanup() to mysql_stmt_prepare() as it's done in most
  of the mysql_test_ functions, and is a no-op for those which don't
  call unit->prepare(). This should make fixing of Bug#10729 (cursors)
  easier.
2005-06-08 19:31:34 +04:00